Class: Marilyn::Generators::FishGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Marilyn::Generators::FishGenerator
- Defined in:
- lib/generators/marilyn/fish/fish_generator.rb
Instance Method Summary collapse
- #copy_default_user_migration ⇒ Object
- #copy_error_messages_partial ⇒ Object
- #copy_locales ⇒ Object
- #copy_reset_css ⇒ Object
- #copy_templates ⇒ Object
-
#install_devise ⇒ Object
def invoke_jquery_rails log :invoke, ‘jquery:install’ invoke(‘jquery:install’, [], :ui => true) install_gem_into_gemfile(‘jquery-rails’) end.
- #install_russian_game ⇒ Object
- #invoke_cancan_ability ⇒ Object
- #invoke_stars_form_generator ⇒ Object
- #invoke_welcome_controller_generator ⇒ Object
- #replace_application_helper ⇒ Object
- #replace_layout ⇒ Object
- #say_than_need_bundle ⇒ Object
- #support_ruby192 ⇒ Object
Instance Method Details
#copy_default_user_migration ⇒ Object
82 83 84 85 86 87 |
# File 'lib/generators/marilyn/fish/fish_generator.rb', line 82 def copy_default_user_migration migration_path = 'db/migrate/' migration_file = 'add_default_user.rb' copy_file("#{migration_path}#{migration_file}", "#{migration_path}#{Time.now.strftime('%Y%m%d%H%M%S')}_#{migration_file}") end |
#copy_error_messages_partial ⇒ Object
31 32 33 |
# File 'lib/generators/marilyn/fish/fish_generator.rb', line 31 def copy_file('app/views/shared/_error_messages.html.erb') end |
#copy_locales ⇒ Object
35 36 37 38 39 |
# File 'lib/generators/marilyn/fish/fish_generator.rb', line 35 def copy_locales en_locale_file = 'config/locales/en.yml' copy_file(en_locale_file, :force => force_change?(en_locale_file)) copy_file('config/locales/ru.yml') end |
#copy_reset_css ⇒ Object
46 47 48 49 50 |
# File 'lib/generators/marilyn/fish/fish_generator.rb', line 46 def copy_reset_css application_css_file = 'app/assets/stylesheets/application.css' copy_file(application_css_file, :force => force_change?(application_css_file)) copy_file('app/assets/stylesheets/reset.css') end |
#copy_templates ⇒ Object
17 18 19 |
# File 'lib/generators/marilyn/fish/fish_generator.rb', line 17 def copy_templates directory('lib/templates') end |
#install_devise ⇒ Object
def invoke_jquery_rails
log :invoke, 'jquery:install'
invoke('jquery:install', [], :ui => true)
install_gem_into_gemfile('jquery-rails')
end
67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/generators/marilyn/fish/fish_generator.rb', line 67 def install_devise log :invoke, 'devise' invoke('devise:install') invoke('devise', ['User']) install_gem_into_gemfile('devise') last_line_regexp = /config\.assets\.debug = true\n/ inject_into_file('config/environments/development.rb', action_mailer_str('localhost:3000'), :after => last_line_regexp) last_line_regexp = /config\.active_support\.deprecation = :notify\n/ inject_into_file('config/environments/production.rb', action_mailer_str('black-sheep.ru'), :after => last_line_regexp) end |
#install_russian_game ⇒ Object
57 58 59 |
# File 'lib/generators/marilyn/fish/fish_generator.rb', line 57 def install_russian_game install_gem_into_gemfile('russian') end |
#invoke_cancan_ability ⇒ Object
89 90 91 92 93 |
# File 'lib/generators/marilyn/fish/fish_generator.rb', line 89 def invoke_cancan_ability log :invoke, 'cancan:ability' invoke('cancan:ability') install_gem_into_gemfile('cancan') end |
#invoke_stars_form_generator ⇒ Object
41 42 43 44 |
# File 'lib/generators/marilyn/fish/fish_generator.rb', line 41 def invoke_stars_form_generator log :invoke, 'marilyn:stars_form' invoke('marilyn:stars_form') end |
#invoke_welcome_controller_generator ⇒ Object
52 53 54 55 |
# File 'lib/generators/marilyn/fish/fish_generator.rb', line 52 def invoke_welcome_controller_generator log :invoke, 'marilyn:welcome' invoke('marilyn:welcome') end |
#replace_application_helper ⇒ Object
21 22 23 24 |
# File 'lib/generators/marilyn/fish/fish_generator.rb', line 21 def replace_application_helper application_helper_file = 'app/helpers/application_helper.rb' copy_file(application_helper_file, :force => force_change?(application_helper_file)) end |
#replace_layout ⇒ Object
26 27 28 29 |
# File 'lib/generators/marilyn/fish/fish_generator.rb', line 26 def replace_layout application_layout_file = 'app/views/layouts/application.html.erb' copy_file(application_layout_file, :force => force_change?(application_layout_file)) end |
#say_than_need_bundle ⇒ Object
95 96 97 98 |
# File 'lib/generators/marilyn/fish/fish_generator.rb', line 95 def say_than_need_bundle say "Fish successfully installed." say "Now you need run bundle install.", :green end |
#support_ruby192 ⇒ Object
11 12 13 14 15 |
# File 'lib/generators/marilyn/fish/fish_generator.rb', line 11 def support_ruby192 support_str = "\nrequire 'yaml'\nYAML::ENGINE.yamler= 'syck'\n" rubygems_regexp = /require 'rubygems'\n/ inject_into_file('config/boot.rb', support_str, :after => rubygems_regexp) end |