class WsChatter::InstallGenerator
Public Instance Methods
copy_initializer()
click to toggle source
# File lib/rails/generators/ws_chatter/install_generator.rb, line 30 def copy_initializer template "ws_chatter.rb", "config/initializers/ws_chatter.rb" end
copy_messages_migration()
click to toggle source
# File lib/rails/generators/ws_chatter/install_generator.rb, line 38 def copy_messages_migration migration_template "messages_migration.rb", "db/migrate/create_#{messages_table}.rb" end
copy_messages_model()
click to toggle source
# File lib/rails/generators/ws_chatter/install_generator.rb, line 42 def copy_messages_model template "message.rb", "app/models/#{messages}.rb" end
copy_users_migration()
click to toggle source
# File lib/rails/generators/ws_chatter/install_generator.rb, line 34 def copy_users_migration migration_template "users_migration.rb", "db/migrate/add_#{status_column}_to_#{table_name}.rb" end
inject_ws_chatter()
click to toggle source
# File lib/rails/generators/ws_chatter/install_generator.rb, line 15 def inject_ws_chatter if File.exist?(manifest) comment_prefix = File.extname(manifest) == ".coffee" ? "#" : "//" require_ws_chatter = "#{comment_prefix}= require ws_chatter\n" manifest_contents = File.read(manifest) if manifest_contents.include? 'require turbolinks' inject_into_file manifest, require_ws_chatter, after: "#{comment_prefix}= require turbolinks\n" elsif manifest_contents.include? 'require_tree' inject_into_file manifest, require_ws_chatter, before: "#{comment_prefix}= require_tree" end end end
Private Instance Methods
manifest()
click to toggle source
# File lib/rails/generators/ws_chatter/install_generator.rb, line 75 def manifest Dir[File.join(destination_root, "app/assets/javascripts/application.*")][0] end
messages()
click to toggle source
# File lib/rails/generators/ws_chatter/install_generator.rb, line 63 def messages @messages ||= options[:messages].underscore end
messages_model()
click to toggle source
# File lib/rails/generators/ws_chatter/install_generator.rb, line 71 def messages_model @messages_model ||= messages.camelize end
messages_table()
click to toggle source
# File lib/rails/generators/ws_chatter/install_generator.rb, line 67 def messages_table @messages_table ||= messages.pluralize end
model_name()
click to toggle source
# File lib/rails/generators/ws_chatter/install_generator.rb, line 55 def model_name @model_name ||= scope.camelize end
scope()
click to toggle source
# File lib/rails/generators/ws_chatter/install_generator.rb, line 47 def scope @scope ||= options[:scope].underscore end
status_column()
click to toggle source
# File lib/rails/generators/ws_chatter/install_generator.rb, line 59 def status_column @status_column ||= options[:status_column].underscore end
table_name()
click to toggle source
# File lib/rails/generators/ws_chatter/install_generator.rb, line 51 def table_name @table_name ||= scope.pluralize end