Sha256: 04c1d5ab38854f5a030493109c610ac2ea9ff8acf525312c92d70ee06a631857

Contents?: true

Size: 583 Bytes

Versions: 1

Compression:

Stored size: 583 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 or create config/initializers/eotb.rb"
      exit
    end
  end


  
end

Version data entries

1 entries across 1 versions & 1 rubygems

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