Sha256: bff957223d65ecc90f03a258c1252b36257d23998e2f9764f59af5b280add77c

Contents?: true

Size: 566 Bytes

Versions: 1

Compression:

Stored size: 566 Bytes

Contents

class EotbGenerator < Rails::Generator::Base
 
  def add_options!(opt)
    opt.on('-k', '--api-key=key', String, "Your Beholder API key") {|v| options[:api_key] = v}
  end
  
  def manifest
    record do |m|
      ensure_parameter_was_set
      m.template "initializer.rb", "config/initializers/eotb.rb", :assigns => {:api_key => api_key_exp }
    end
   
  end
   
  def api_key_exp
    "#{options[:api_key]}"
  end

  def ensure_parameter_was_set
    if !options[:api_key]
      puts "Must pass --api-key='your_api_key' or -k 'your_api_key'"
      exit
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eotb-0.5.18 generators/eotb/eotb_generator.rb