Skip to content

Commit

Permalink
clean up this
Browse files Browse the repository at this point in the history
  • Loading branch information
nofxx committed Jun 27, 2015
1 parent ccb5520 commit d3f594e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bin/yamg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env ruby
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'yamg'
YAMG::CLI.new(ARGV)
YAMG::CLI.new(ARGV).work!
11 changes: 8 additions & 3 deletions lib/yamg/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ def initialize(argv)
return YAMG.init if argv.join =~ /init/
YAMG.load_config # (argv)
@works = YAMG.config['compile']
compile
screenshot
end

def setup_for(opts)
Expand Down Expand Up @@ -58,15 +56,22 @@ def compile_work(scope, opts)
end

def compile(scope = nil)
time = Time.now
works.select! { |w| w =~ scope } if scope
works.each { |out, opts| compile_work(out, opts) }
works.select! { |w| w =~ scope } if scope
puts Rainbow("Working on #{works.keys.join(', ')}").yellow
end

def screenshot
YAMG.config['screenshots'].each do |ss|
Thread.new { Screenshot.new(ss).work('./media') }
end
end

def work!
time = Time.now
compile
screenshot
puts Rainbow(Thread.list.size.to_s + ' jobs').black
Thread.list.reject { |t| t == Thread.current }.each(&:join)
puts Rainbow('-' * 59).black
Expand Down

0 comments on commit d3f594e

Please sign in to comment.