3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/myrails/modules/gems.rb', line 3
def self.included(thor)
thor.class_eval do
desc 'add_test_group', 'Add test group gems to Gemfile'
def add_test_group
insert_into_file 'Gemfile', before: "group :development, :test do" do <<-CODE
group :test do
gem 'simplecov'
gem 'shoulda-matchers'
gem 'factory_bot_rails'
gem 'database_cleaner'
gem 'chromedriver-helper'
gem 'launchy'
gem 'rails-controller-testing'
end
CODE
end
end
desc 'add_development_test_gems', 'Add test and development group gems to Gemfile'
def add_development_test_gems
insert_into_file 'Gemfile', after: "group :development, :test do\n" do <<-CODE
gem 'faker'
gem 'yard'
gem 'letter_opener'
gem "rails-erd"
CODE
end
end
desc 'add_rails_gems', 'Add commonly used gems to Gemfile'
def add_rails_gems
insert_into_file 'Gemfile', after: "gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]\n" do <<-CODE
gem 'haml-rails'
gem "ransack"
gem 'will_paginate'
gem "font-awesome-rails"
gem 'trix'
gem 'record_tag_helper'
gem 'jquery-rails'
CODE
end
end
desc 'add_private_section', 'Add private section to appliation controller'
def add_private_section
insert_into_file 'app/controllers/application_controller.rb', before: 'end' do <<-CODE
private
CODE
end
end
desc 'setup_gems', 'Install development, test and prodution gems'
def setup_gems
add_test_group
add_development_test_gems
add_rails_gems
run 'bundle install'
add_private_section
end
end
end
|