Class: SocialStream::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/social_stream/install_generator.rb

Overview

:nodoc:

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object



38
39
40
# File 'lib/generators/social_stream/install_generator.rb', line 38

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

Instance Method Details

#copy_publicObject



17
18
19
# File 'lib/generators/social_stream/install_generator.rb', line 17

def copy_public
  directory "public"
end

#create_application_layoutObject



21
22
23
24
25
# File 'lib/generators/social_stream/install_generator.rb', line 21

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

#create_config_fileObject



13
14
15
# File 'lib/generators/social_stream/install_generator.rb', line 13

def create_config_file
  copy_file 'seeds.yml', 'db/seeds/social_stream.yml'
end

#create_initializer_fileObject



9
10
11
# File 'lib/generators/social_stream/install_generator.rb', line 9

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

#create_migration_fileObject



42
43
44
# File 'lib/generators/social_stream/install_generator.rb', line 42

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

#create_seed_codeObject



27
28
29
30
31
32
33
# File 'lib/generators/social_stream/install_generator.rb', line 27

def create_seed_code
  seed_code = "\nSocialStream.seed!"

  in_root do
    append_file 'db/seeds.rb', seed_code
  end
end