Sha256: e4b8b81d7bb2209a7814f7830906f39909cff43c224dc572928cf3339213d5f3

Contents?: true

Size: 740 Bytes

Versions: 25

Compression:

Stored size: 740 Bytes

Contents

require 'rails/generators'

# Rails 3 Generator
class PostageappGenerator < Rails::Generators::Base
  
  class_option :api_key, :aliases => ['-k=value', '--api-key=value'], :type => :string, :desc => 'Your PostageApp API key'
  
  def self.source_root
    @_hoptoad_source_root ||= File.expand_path('../../../../generators/postageapp/templates', __FILE__)
  end
  
  def install
    if !options[:api_key]
      puts 'Must pass --api-key with API key of your PostageApp.com project'
      exit
    end
    
    template 'initializer.rb', 'config/initializers/postageapp.rb'
    copy_file 'postageapp_tasks.rake', 'lib/tasks/postageapp_tasks.rake'
    puts run('rake postageapp:test')
  end
  
  def api_key
    options[:api_key]
  end
  
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
postageapp-1.0.4 lib/generators/postageapp/postageapp_generator.rb
postageapp-1.0.3 lib/generators/postageapp/postageapp_generator.rb
postageapp-1.0.2 lib/generators/postageapp/postageapp_generator.rb
postageapp-1.0.1 lib/generators/postageapp/postageapp_generator.rb
postageapp-1.0.0 lib/generators/postageapp/postageapp_generator.rb