Class: Omnisocial::Generators::OmnisocialGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Omnisocial::Generators::OmnisocialGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/omnisocial/omnisocial_generator.rb
Class Method Summary collapse
-
.next_migration_number(dirname) ⇒ Object
Implement the required interface for Rails::Generators::Migration: github.com/rails/rails/blob/master/activerecord/lib/generators/active_record.rb.
- .source_root ⇒ Object
Instance Method Summary collapse
- #copy_assets ⇒ Object
- #copy_initializer ⇒ Object
- #copy_user_model ⇒ Object
- #create_migration_file ⇒ Object
- #show_readme ⇒ Object
Class Method Details
.next_migration_number(dirname) ⇒ Object
Implement the required interface for Rails::Generators::Migration: github.com/rails/rails/blob/master/activerecord/lib/generators/active_record.rb
17 18 19 20 21 22 23 |
# File 'lib/generators/omnisocial/omnisocial_generator.rb', line 17 def self.next_migration_number(dirname) if ActiveRecord::Base. Time.now.utc.strftime("%Y%m%d%H%M%S") else "%.3d" % (current_migration_number(dirname) + 1) end end |
.source_root ⇒ Object
11 12 13 |
# File 'lib/generators/omnisocial/omnisocial_generator.rb', line 11 def self.source_root File.join(File.dirname(__FILE__), 'templates') end |
Instance Method Details
#copy_assets ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/generators/omnisocial/omnisocial_generator.rb', line 37 def copy_assets copy_file 'assets/stylesheets/omnisocial.css', 'public/stylesheets/omnisocial.css' copy_file 'assets/images/twitter.gif', 'public/images/omnisocial/twitter.gif' copy_file 'assets/images/facebook.png', 'public/images/omnisocial/facebook.png' copy_file 'assets/images/signin_twitter.png', 'public/images/omnisocial/signin_twitter.png' copy_file 'assets/images/signin_facebook.png', 'public/images/omnisocial/signin_facebook.png' end |
#copy_initializer ⇒ Object
29 30 31 |
# File 'lib/generators/omnisocial/omnisocial_generator.rb', line 29 def copy_initializer template 'omnisocial.rb', 'config/initializers/omnisocial.rb' end |
#copy_user_model ⇒ Object
33 34 35 |
# File 'lib/generators/omnisocial/omnisocial_generator.rb', line 33 def copy_user_model template 'user.rb', 'app/models/user.rb' end |
#create_migration_file ⇒ Object
25 26 27 |
# File 'lib/generators/omnisocial/omnisocial_generator.rb', line 25 def create_migration_file migration_template 'migration.rb', 'db/migrate/create_omnisocial_tables.rb' end |
#show_readme ⇒ Object
45 46 47 |
# File 'lib/generators/omnisocial/omnisocial_generator.rb', line 45 def show_readme readme 'README' if behavior == :invoke end |