Class: MakeItSo::Rails::AppBuilder
- Inherits:
-
Rails::AppBuilder
- Object
- Rails::AppBuilder
- MakeItSo::Rails::AppBuilder
- Defined in:
- lib/make_it_so/rails/app_builder.rb
Instance Method Summary collapse
- #application_controller ⇒ Object
- #base_javascripts ⇒ Object
- #base_stylesheets ⇒ Object
- #devise_dependency ⇒ Object
- #eliminate_byebug ⇒ Object
- #factory_bot_rspec ⇒ Object
- #fix_generators ⇒ Object
- #foundation_dependency ⇒ Object
- #pry_rails_dependency ⇒ Object
- #rspec_dependency ⇒ Object
- #shoulda_rspec ⇒ Object
- #teaspoon_jasmine ⇒ Object
- #valid_attribute_rspec ⇒ Object
Instance Method Details
#application_controller ⇒ Object
6 7 8 9 10 |
# File 'lib/make_it_so/rails/app_builder.rb', line 6 def application_controller inside 'app/controllers' do template 'application_controller.rb' end end |
#base_javascripts ⇒ Object
12 13 14 15 16 |
# File 'lib/make_it_so/rails/app_builder.rb', line 12 def base_javascripts inside 'app/assets/javascripts' do template 'application.js' end end |
#base_stylesheets ⇒ Object
18 19 20 21 22 |
# File 'lib/make_it_so/rails/app_builder.rb', line 18 def base_stylesheets inside 'app/assets/stylesheets' do template 'application.css' end end |
#devise_dependency ⇒ Object
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/make_it_so/rails/app_builder.rb', line 115 def devise_dependency self.gem 'devise' after_bundle do generate 'devise:install' generate 'devise:views' generate 'devise user' if [:rspec] inside 'spec' do directory 'features' inside 'support' do insert_into_file 'factory_bot.rb', after: "FactoryBot.define do\n" do snippet('user_factory.rb') end end end end route "root 'homes\#index'" end end |
#eliminate_byebug ⇒ Object
34 35 36 37 |
# File 'lib/make_it_so/rails/app_builder.rb', line 34 def eliminate_byebug both_lines = /^[[:space:]]*# Call 'byebug'.*gem 'byebug'.*?$\n/m gsub_file 'Gemfile', both_lines, "\n" end |
#factory_bot_rspec ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/make_it_so/rails/app_builder.rb', line 63 def factory_bot_rspec self.gem 'factory_bot', group: [:development, :test] after_bundle do inside 'spec' do uncomment_lines 'rails_helper.rb', /spec\/support\/\*\*\/\*.rb/ inside 'support' do template 'factory_bot.rb' end end end end |
#fix_generators ⇒ Object
28 29 30 31 32 |
# File 'lib/make_it_so/rails/app_builder.rb', line 28 def fix_generators inject_into_class 'config/application.rb', 'Application' do snippet('application_generator.rb') end end |
#foundation_dependency ⇒ Object
141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/make_it_so/rails/app_builder.rb', line 141 def foundation_dependency self.gem 'foundation-rails', '~> 5.0' after_bundle do generate 'foundation:install foundation' # foundation-rails generates an application layout so we # must remove it # there is a pull request open to skip this: # https://github.com/zurb/foundation-rails/pull/108 remove_file 'app/views/layouts/foundation.html.erb' end end |
#pry_rails_dependency ⇒ Object
24 25 26 |
# File 'lib/make_it_so/rails/app_builder.rb', line 24 def pry_rails_dependency self.gem 'pry-rails', group: [:development, :test] end |
#rspec_dependency ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/make_it_so/rails/app_builder.rb', line 39 def rspec_dependency self.gem 'rspec-rails', group: [:development, :test] self.gem 'capybara', group: [:development, :test] self.gem 'launchy', group: [:development, :test] after_bundle do #stop spring in case it is running - it will hang #https://github.com/rails/rails/issues/13381 run 'spring stop' generate 'rspec:install' inside 'spec' do empty_directory 'support' end inside 'spec' do insert_into_file 'rails_helper.rb', after: rails_helper_insertion_hook do "require 'capybara/rspec'\n" end end end end |
#shoulda_rspec ⇒ Object
93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/make_it_so/rails/app_builder.rb', line 93 def shoulda_rspec self.gem 'shoulda-matchers', group: [:development, :test], require: false after_bundle do inside 'spec' do insert_into_file 'rails_helper.rb', after: rails_helper_insertion_hook do "require 'shoulda-matchers'\n" end end end end |
#teaspoon_jasmine ⇒ Object
108 109 110 111 112 113 |
# File 'lib/make_it_so/rails/app_builder.rb', line 108 def teaspoon_jasmine self.gem 'teaspoon-jasmine' after_bundle do generate 'teaspoon:install' end end |
#valid_attribute_rspec ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/make_it_so/rails/app_builder.rb', line 76 def valid_attribute_rspec self.gem 'valid_attribute', group: [:development, :test] after_bundle do inside 'spec' do insert_into_file 'rails_helper.rb', after: rails_helper_insertion_hook do "require File.join(File.dirname(__FILE__), 'support/valid_attribute')\n" end inside 'support' do template 'valid_attribute.rb' end end end end |