Module: Ramix::Helpers
- Included in:
- Builder
- Defined in:
- lib/ramix/helpers.rb
Overview
A set of helper methods will append to the template
Instance Method Summary collapse
- #before_callbacks ⇒ Object
- #callback_functions ⇒ Object
- #callbacks ⇒ Object
- #preparation_methods ⇒ Object
- #rails_version ⇒ Object
Instance Method Details
#before_callbacks ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/ramix/helpers.rb', line 36 def before_callbacks " if File.exist?('config/initializers/wrap_parameters.rb') and RUBY_VERSION < '1.9'\n gsub_file 'config/initializers/wrap_parameters.rb', \"wrap_parameters format: [:json]\", \"wrap_parameters format => [:json]\"\n end\n\n # WARNING: This version of mysql2 (0.3.11) doesn't ship with the ActiveRecord adapter bundled anymore as it's now part of Rails 3.1\n # WARNING: Please use the 0.2.x releases if you plan on using it in Rails <= 3.0.x\n case rails_version\n when /3.0/\n gsub_file 'Gemfile', \"gem 'mysql2'\", \"gem 'mysql2', '~>0.2.18'\"\n end\n\n # Use unicorn as the web server\n say_wizard('Use unicorn as the web server')\n gsub_file 'Gemfile', \"# gem 'unicorn'\", \"gem 'unicorn'\"\n TEMPLATE\nend\n" |
#callback_functions ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ramix/helpers.rb', line 23 def callback_functions " @after_bundler_blocks = []\n def after_bundler(&block)\n @after_bundler_blocks << block\n end\n @after_everything_blocks = []\n def after_everything(&block)\n @after_everything_blocks << block\n end\n TEMPLATE\nend\n" |
#callbacks ⇒ Object
55 56 57 58 59 60 61 62 |
# File 'lib/ramix/helpers.rb', line 55 def callbacks " say_wizard 'Install bundle'\n run 'bundle install'\n @after_bundler_blocks.each{ |b| b.call }\n @after_everything_blocks.each{ |b| b.call }\n TEMPLATE\nend\n" |
#preparation_methods ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/ramix/helpers.rb', line 5 def preparation_methods " def say_wizard(text)\n say \"******\" + text + \"******\"\n end\n TEMPLATE\nend\n" |
#rails_version ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/ramix/helpers.rb', line 13 def rails_version " # Check the version of your rails gem\n # Only support above 3.0\n def rails_version\n [Rails::VERSION::MAJOR, Rails::VERSION::MINOR].join('.')\n end\n TEMPLATE\nend\n" |