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.24 lib/generators/postageapp/postageapp_generator.rb
postageapp-1.0.23 lib/generators/postageapp/postageapp_generator.rb
postageapp-1.0.22 lib/generators/postageapp/postageapp_generator.rb
postageapp-1.0.21 lib/generators/postageapp/postageapp_generator.rb
postageapp-1.0.20 lib/generators/postageapp/postageapp_generator.rb
postageapp-1.0.19 lib/generators/postageapp/postageapp_generator.rb
postageapp-1.0.18 lib/generators/postageapp/postageapp_generator.rb
postageapp-1.0.17 lib/generators/postageapp/postageapp_generator.rb
postageapp-1.0.16 lib/generators/postageapp/postageapp_generator.rb
postageapp-1.0.15 lib/generators/postageapp/postageapp_generator.rb
postageapp-1.0.14 lib/generators/postageapp/postageapp_generator.rb
postageapp-1.0.13 lib/generators/postageapp/postageapp_generator.rb
postageapp-1.0.12 lib/generators/postageapp/postageapp_generator.rb
postageapp-1.0.11 lib/generators/postageapp/postageapp_generator.rb
postageapp-1.0.10 lib/generators/postageapp/postageapp_generator.rb
postageapp-1.0.9 lib/generators/postageapp/postageapp_generator.rb
postageapp-1.0.8 lib/generators/postageapp/postageapp_generator.rb
postageapp-1.0.7 lib/generators/postageapp/postageapp_generator.rb
postageapp-1.0.6 lib/generators/postageapp/postageapp_generator.rb
postageapp-1.0.5 lib/generators/postageapp/postageapp_generator.rb