class Preseason::Recipe::Gemfile
Public Instance Methods
prepare()
click to toggle source
# File lib/preseason/recipe/gemfile.rb, line 2 def prepare remove_comments remove_unwanted_gems remove_empty_lines add_ruby_version add_database_gem add_global_gems add_non_heroku_gems add_production_gems add_development_gems add_development_test_gems add_test_gems add_factory_gem add_bourbon_gems add_bitters_gem add_templating_gem add_active_admin_gem add_authentication_gem add_modernizr_gem add_normalize_gem add_ie8_gems end
Private Instance Methods
add_active_admin_gem()
click to toggle source
# File lib/preseason/recipe/gemfile.rb, line 155 def add_active_admin_gem if config.authentication.active_admin? insert_into_file 'Gemfile', :after => "gem 'jquery-rails'\n" do "gem 'activeadmin', :github => 'gregbell/active_admin'\n" end end end
add_authentication_gem()
click to toggle source
# File lib/preseason/recipe/gemfile.rb, line 163 def add_authentication_gem if config.authentication.devise? insert_into_file 'Gemfile', :after => "gem 'jquery-rails'\n" do "gem 'devise'\n" end end end
add_bitters_gem()
click to toggle source
# File lib/preseason/recipe/gemfile.rb, line 135 def add_bitters_gem if config.bitters.bitters? insert_into_file 'Gemfile', :after => "gem 'jquery-rails'\n" do "gem 'bitters', '1.1.0'\n" end end end
add_bourbon_gems()
click to toggle source
# File lib/preseason/recipe/gemfile.rb, line 127 def add_bourbon_gems if config.bourbon.bourbon? insert_into_file 'Gemfile', :after => "gem 'jquery-rails'\n" do "gem 'bourbon', '~> 4.2', '>= 4.2.6'\ngem 'neat', '~> 2.0.0'\n" end end end
add_database_gem()
click to toggle source
# File lib/preseason/recipe/gemfile.rb, line 44 def add_database_gem insert_into_file 'Gemfile', "gem '#{config.database.gem_name}'\n", :after => /gem 'rails'.*\n/ unless config.database.sqlite? end
add_development_gems()
click to toggle source
# File lib/preseason/recipe/gemfile.rb, line 89 def add_development_gems gem_group :development do gem 'foreman' gem 'guard-bundler' gem 'guard-rspec' gem 'rb-fsevent', :require => false end end
add_development_test_gems()
click to toggle source
# File lib/preseason/recipe/gemfile.rb, line 98 def add_development_test_gems gem_group :development, :test do gem 'pry-rails' gem 'pry-nav' gem 'awesome_print' gem 'rspec-rails' end end
add_factory_gem()
click to toggle source
# File lib/preseason/recipe/gemfile.rb, line 119 def add_factory_gem if config.factory.factory_girl? insert_into_file 'Gemfile', :after => "gem 'rspec-rails'\n" do " gem 'factory_girl_rails'\n" end end end
add_global_gems()
click to toggle source
# File lib/preseason/recipe/gemfile.rb, line 48 def add_global_gems insert_into_file 'Gemfile', :after => /gem '#{config.database.gem_name}'.*\n/ do %w( whiskey_disk jquery-rails ).map { |gem_name| "gem '#{gem_name}'" }.join("\n") << "\n" end end
add_ie8_gems()
click to toggle source
# File lib/preseason/recipe/gemfile.rb, line 65 def add_ie8_gems if config.ie8.enabled? insert_into_file 'Gemfile', :after => /gem 'jquery-rails'\n/ do "gem 'selectivizr-rails'\ngem 'respond-rails'\n" end end end
add_modernizr_gem()
click to toggle source
# File lib/preseason/recipe/gemfile.rb, line 57 def add_modernizr_gem insert_into_file 'Gemfile', "gem 'modernizr-rails'\n", :after => /gem 'uglifier'.*\n/ end
add_non_heroku_gems()
click to toggle source
# File lib/preseason/recipe/gemfile.rb, line 73 def add_non_heroku_gems unless config.heroku.use? insert_into_file 'Gemfile', :after => /gem 'jquery-rails'\n/ do "gem 'lograge'\ngem 'whenever', :require => false\n" end end end
add_normalize_gem()
click to toggle source
# File lib/preseason/recipe/gemfile.rb, line 61 def add_normalize_gem insert_into_file 'Gemfile', "gem 'normalize-rails'\n", :after => /gem 'modernizr-rails'.*\n/ end
add_production_gems()
click to toggle source
# File lib/preseason/recipe/gemfile.rb, line 81 def add_production_gems if config.heroku.use? gem_group :production do gem 'heroku_rails_deflate' end end end
add_ruby_version()
click to toggle source
# File lib/preseason/recipe/gemfile.rb, line 40 def add_ruby_version insert_into_file 'Gemfile', "ruby '#{RUBY_VERSION}'\n\n", :after => /source 'https:\/\/rubygems.org'.*\n/ end
add_templating_gem()
click to toggle source
# File lib/preseason/recipe/gemfile.rb, line 143 def add_templating_gem if config.templating.slim? insert_into_file 'Gemfile', :after => "gem 'jquery-rails'\n" do "gem 'slim-rails'\n" end elsif config.templating.haml? insert_into_file 'Gemfile', :after => "gem 'jquery-rails'\n" do "gem 'haml-rails'\n" end end end
add_test_gems()
click to toggle source
# File lib/preseason/recipe/gemfile.rb, line 107 def add_test_gems gem_group :test do gem 'zeus' gem 'database_cleaner' gem 'shoulda-matchers' gem 'capybara-webkit' gem 'launchy' gem 'fuubar' gem 'simplecov' end end
remove_comments()
click to toggle source
# File lib/preseason/recipe/gemfile.rb, line 26 def remove_comments gsub_file 'Gemfile', /^\s*#\s*.*$/, '' end
remove_empty_lines()
click to toggle source
# File lib/preseason/recipe/gemfile.rb, line 36 def remove_empty_lines gsub_file 'Gemfile', /^\n/, '' end
remove_unwanted_gems()
click to toggle source
# File lib/preseason/recipe/gemfile.rb, line 30 def remove_unwanted_gems gems_to_remove = %w(jquery-rails) # removing jquery-rails now so we can move it to top of Gemfile gems_to_remove << 'sqlite3' unless config.database.sqlite? gsub_file 'Gemfile', /^\s*gem '(#{Regexp.union(gems_to_remove)})'.*$/, '' end