Sha256: 57f0e8cee1a748c069e5b4cee87088108123bf1437cbb2ef6cf443c7ec2355c0

Contents?: true

Size: 1.91 KB

Versions: 2

Compression:

Stored size: 1.91 KB

Contents

class SocialStream::InstallGenerator < Rails::Generators::Base #:nodoc:
  include Rails::Generators::Migration

  hook_for :javascript
  hook_for :authentication

  source_root File.expand_path('../templates', __FILE__)

  def devise_initializer_config
    inject_into_file "config/initializers/devise.rb",
                     "\n  config.omniauth :linked_in, \"ekxfXU8nueVSMQ9fc5KJAryBkyztUlCBYMW3DoQPzbE79WhivvzhQloRNHCHgPeB\", \"WYiHFT-KKFgjd45W3-pEAficmXRHmN6_6DGwj1C_ZILJlSO1gBvv6VNYXU9tybGY\"
                      \n  config.omniauth :facebook, \"129571360447856\",\"eef39dce5e20e76f77495c59623bdb38\"
                      \n  #config.omniauth :twitter, \"wgTxO0fTpjTeSnjKC9ZHA\",\"JepulVWwLcuAnGfWjwCu47yEP0TcJJfKtvISPBsilI\"
                      \n  config.token_authentication_key = :auth_token
                      \n  config.stateless_token = true",
                      :after => "  # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'"
  end

  def create_devise_route
    route "devise_for :users, :controllers => {:omniauth_callbacks => 'omniauth_callbacks'}"
  end

  def create_initializer_file
    copy_file 'initializer.rb', 'config/initializers/social_stream.rb'
  end

  def create_config_relations_file
    copy_file 'relations.yml', 'config/relations.yml'
  end

  def copy_public
    directory "public"
  end

  def remove_public_index
    remove_file 'public/index.html'
  end

  def create_application_layout
    copy_file File.join(File.dirname(__FILE__), '../../../',
                        'app/views/layouts/application.html.erb'),
              'app/views/layouts/application.html.erb'
  end

  # TODO: hook_for :orm
  require 'rails/generators/active_record'

  def self.next_migration_number(dirname)
    ActiveRecord::Generators::Base.next_migration_number(dirname)
  end

  def create_migration_file
    migration_template 'migration.rb', 'db/migrate/create_social_stream.rb'
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
social_stream-0.4.1 lib/generators/social_stream/install_generator.rb
social_stream-0.4.0 lib/generators/social_stream/install_generator.rb