Sha256: 8de57a843322cbcfb6982530e10f593d4e3ba491baa7a322fe99e5cb3a94870f

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

class Social2social::InstallGenerator < Rails::Generators::Base
  include Rails::Generators::Migration
  
  hook_for :social_stream
  
  source_root File.expand_path('../templates', __FILE__)
  
  def route_pshb
    route "match 'pshb/callback' => 'pshb#callback', :as => :pshb_callback"
  end
  
  def route_ru
    route "match 'remoteuser/' => 'remoteusers#index', :as => :add_remote_user"
  end
  
  def config_initializer
    copy_file 'initializer.rb', 'config/initializers/social2social.rb'
  end
  
  def inject_remote_user_relation
    append_file 'config/relations.yml',
                     "\nremote_subject:\n  friend:\n    name: friend\n    permissions:\n      - [ follow ]\n    sphere: personal\n"+
                                        "  public:\n    name: public\n    permissions:\n      - [ read, tie, star_tie ]\n    sphere: personal"  
  end
  
  def inject_translations
    copy_file 'en.yml', 'config/locales/s2s.en.yml'
  end
  
  def copy_public
    directory "public"
  end
  
  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_social2social.rb'
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
social2social-0.0.3 lib/generators/social2social/install_generator.rb