Class: GreenOnion::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/green_onion/cli.rb

Instance Method Summary collapse

Instance Method Details

#generate_skinnerObject



37
38
39
40
41
# File 'lib/green_onion/cli.rb', line 37

def generate_skinner
  options[:dir] ? dir = options[:dir] : dir = "spec"
  options[:url] ? config = { :url => options[:url] } : config = { :url => "http://localhost:3000" }
  template('skinner.erb', "#{dir}/skinner.rb", config)
end

#skin(url) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/green_onion/cli.rb', line 18

def skin(url)
  GreenOnion.configure do |c|
    c.skins_dir = options[:dir] if options[:dir]
    c.threshold = options[:threshold] if options[:threshold]
    c.dimensions = { :width => options[:width], :height => options[:height] } if options[:width] && options[:height]
    c.driver = options[:driver].to_sym if options[:driver]
  end
  case options[:method]
  when "v"
    GreenOnion.skin_visual(url)
  when "p"
    GreenOnion.skin_percentage(url)
  else
    GreenOnion.skin_visual_and_percentage(url)
  end
end