class PostageappGenerator

Rails 3 Generator

Public Class Methods

source_root() click to toggle source
# File lib/generators/postageapp/postageapp_generator.rb, line 10
def self.source_root
  @__source_root ||= File.expand_path(
    '../../../generators/postageapp/templates',
    __dir__
  )
end

Public Instance Methods

api_key() click to toggle source
# File lib/generators/postageapp/postageapp_generator.rb, line 33
def api_key
  options[:api_key]
end
install() click to toggle source
# File lib/generators/postageapp/postageapp_generator.rb, line 17
def install
  unless (PostageApp::Env.rails_with_encrypted_credentials?)
    unless (options[:api_key])
      puts 'Must pass --api-key with API key of your PostageApp.com project'

      exit(-1)
    end
    
    template('initializer.rb', 'config/initializers/postageapp.rb')
  end

  copy_file('postageapp_tasks.rake', 'lib/tasks/postageapp_tasks.rake')

  puts run('rake postageapp:test')
end