Sha256: d743474d967f7f383e0fa0b10c2764542bb58f38e10c92c1b933cda4865dbbec

Contents?: true

Size: 1.95 KB

Versions: 24

Compression:

Stored size: 1.95 KB

Contents

require File.expand_path(File.dirname(__FILE__) + "/../oauth_provider/lib/insert_routes.rb")

class OauthConsumerGenerator < Rails::Generator::Base
  default_options :skip_migration => false

  def manifest
    record do |m|
      
      # Controller, helper, views, and test directories.
      m.directory File.join('app/models')
      m.directory File.join('app/controllers')
      m.directory File.join('app/helpers')
      m.directory File.join('app/views', 'oauth_consumers')
      m.directory File.join('config/initializers')
      
      m.template 'oauth_config.rb',File.join('config/initializers', "oauth_consumers.rb")
      m.template 'consumer_token.rb',File.join('app/models',"consumer_token.rb")

      m.template 'controller.rb',File.join('app/controllers',"oauth_consumers_controller.rb")
      m.route_entry "map.resources :oauth_consumers,:member=>{:callback=>:get}"
      
      @template_extension= options[:haml] ? "haml" : "erb"
      
      m.template "show.html.#{@template_extension}",  File.join('app/views', 'oauth_consumers', "show.html.#{@template_extension}")
      m.template "index.html.#{@template_extension}",  File.join('app/views', 'oauth_consumers', "index.html.#{@template_extension}")
      
      unless options[:skip_migration] 
        m.migration_template 'migration.rb', 'db/migrate', :assigns => {
          :migration_name => "CreateOauthConsumerTokens"
        }, :migration_file_name => "create_oauth_consumer_tokens"
      end
    end
  end

  protected
    def banner
      "Usage: #{$0} #{spec.name}"
    end

    def add_options!(opt)
      opt.separator ''
      opt.separator 'Options:'
      opt.on("--skip-migration", 
             "Don't generate a migration file") { |v| options[:skip_migration] = v }
#      opt.on("--test-unit", 
#             "Generate the Test::Unit compatible tests instead of RSpec") { |v| options[:test_unit] = v }
      opt.on("--haml", 
            "Templates use haml") { |v| options[:haml] = v }
    end
end

Version data entries

24 entries across 24 versions & 5 rubygems

Version Path
filiptepper-oauth-plugin-0.3.11 generators/oauth_consumer/oauth_consumer_generator.rb
pelle-oauth-plugin-0.3.10 generators/oauth_consumer/oauth_consumer_generator.rb
pelle-oauth-plugin-0.3.11 generators/oauth_consumer/oauth_consumer_generator.rb
pelle-oauth-plugin-0.3.9 generators/oauth_consumer/oauth_consumer_generator.rb
oauth-plugin-0.4.0.rc2 generators/oauth_consumer/oauth_consumer_generator.rb
oauth-plugin-0.4.0.rc1 generators/oauth_consumer/oauth_consumer_generator.rb
oauth-plugin-0.4.0.pre7 generators/oauth_consumer/oauth_consumer_generator.rb
oauth-plugin-0.4.0.pre6 generators/oauth_consumer/oauth_consumer_generator.rb
oauth-plugin-0.4.0.pre5 generators/oauth_consumer/oauth_consumer_generator.rb
insrc-oauth-plugin-0.4.0.pre6 generators/oauth_consumer/oauth_consumer_generator.rb
insrc-oauth-plugin-0.4.0.pre5 generators/oauth_consumer/oauth_consumer_generator.rb
le1t0-oauth-plugin-0.3.14.001 generators/oauth_consumer/oauth_consumer_generator.rb
le1t0-oauth-plugin-0.4.0.pre4.001 generators/oauth_consumer/oauth_consumer_generator.rb
oauth-plugin-0.4.0.pre4 generators/oauth_consumer/oauth_consumer_generator.rb
oauth-plugin-0.4.0.pre3 generators/oauth_consumer/oauth_consumer_generator.rb
oauth-plugin-0.4.0.pre2 generators/oauth_consumer/oauth_consumer_generator.rb
oauth-plugin-0.4.0.pre1 generators/oauth_consumer/oauth_consumer_generator.rb
oauth-plugin-0.3.14 generators/oauth_consumer/oauth_consumer_generator.rb
oauth-plugin-0.3.13 generators/oauth_consumer/oauth_consumer_generator.rb
oauth-plugin-0.3.12 generators/oauth_consumer/oauth_consumer_generator.rb