Sha256: 72aca329e3c4891b60cf6954eb220438837c666f1ae0260491a69e30c61c57df
Contents?: true
Size: 848 Bytes
Versions: 5
Compression:
Stored size: 848 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} opt.on('-e', '--events=number_of_event', Integer, "Number of events sent in one package to Beholder") {|v| options[:events] = 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, :events => events_exp} end end def api_key_exp "#{options[:api_key]}" end def events_exp s = if options[:events] "#{options[:events]}" else "1" end 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
5 entries across 5 versions & 1 rubygems