Class: Scoby::AppBuilder
- Inherits:
-
Rails::AppBuilder
- Object
- Rails::AppBuilder
- Scoby::AppBuilder
show all
- Extended by:
- Forwardable
- Includes:
- Actions
- Defined in:
- lib/scoby/app_builder.rb
Instance Method Summary
collapse
Methods included from Actions
#action_mailer_host, #configure_application_file, #configure_environment, #replace_in_file
Instance Method Details
80
81
82
|
# File 'lib/scoby/app_builder.rb', line 80
def configure_action_mailer_in_specs
copy_file 'action_mailer_rspec.rb', 'spec/support/action_mailer.rb'
end
|
69
70
71
|
# File 'lib/scoby/app_builder.rb', line 69
def configure_database_cleaner_in_specs
copy_file 'database_cleaner_rspec.rb', 'spec/support/database_cleaner.rb'
end
|
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/scoby/app_builder.rb', line 38
def configure_generators
inject_into_file "config/application.rb", after: "config.active_record.raise_in_transactional_callbacks = true\n" do
<<-RUBY
# Don't generate helpers, assets, and view specs by default.
config.generators do |generate|
generate.helper false
generate.assets false
generate.erb false
generate.view_specs false
generate.test_framework :rspec
end
RUBY
end
end
|
62
63
64
65
66
67
|
# File 'lib/scoby/app_builder.rb', line 62
def configure_rspec
remove_file "spec/rails_helper.rb"
remove_file "spec/spec_helper.rb"
copy_file "rails_helper.rb", "spec/rails_helper.rb"
copy_file "spec_helper.rb", "spec/spec_helper.rb"
end
|
73
74
75
76
77
78
|
# File 'lib/scoby/app_builder.rb', line 73
def configure_shoulda_matchers_in_specs
copy_file(
"shoulda_matchers_rspec.rb",
"spec/support/shoulda_matchers.rb"
)
end
|
84
85
86
|
# File 'lib/scoby/app_builder.rb', line 84
def configure_simple_cov_in_specs
copy_file 'simple_cov_rspec.rb', 'spec/support/simple_cov.rb'
end
|
#copy_dotfiles ⇒ Object
102
103
104
|
# File 'lib/scoby/app_builder.rb', line 102
def copy_dotfiles
directory("dotfiles", ".")
end
|
#create_templates_directory ⇒ Object
16
17
18
|
# File 'lib/scoby/app_builder.rb', line 16
def create_templates_directory
directory 'app/views', 'app/templates'
end
|
#gemfile ⇒ Object
8
9
10
|
# File 'lib/scoby/app_builder.rb', line 8
def gemfile
template "Gemfile.erb", "Gemfile"
end
|
#generate_rspec ⇒ Object
58
59
60
|
# File 'lib/scoby/app_builder.rb', line 58
def generate_rspec
generate 'rspec:install'
end
|
#remove_layout_from_views ⇒ Object
20
21
22
|
# File 'lib/scoby/app_builder.rb', line 20
def remove_layout_from_views
remove_dir 'app/views/layouts'
end
|
#set_ruby_to_version_being_used ⇒ Object
12
13
14
|
# File 'lib/scoby/app_builder.rb', line 12
def set_ruby_to_version_being_used
create_file '.ruby-version', "#{Scoby::RUBY_VERSION}\n"
end
|
#setup_default_rspec_directories ⇒ Object
88
89
90
91
92
93
94
95
96
97
98
99
100
|
# File 'lib/scoby/app_builder.rb', line 88
def setup_default_rspec_directories
[
'spec/cassettes',
'spec/controllers',
'spec/factories',
'spec/lib',
'spec/models',
'spec/routing',
'spec/views'
].each do |dir|
empty_directory_with_keep_file dir
end
end
|
#setup_factory_girl_for_rspec ⇒ Object
54
55
56
|
# File 'lib/scoby/app_builder.rb', line 54
def setup_factory_girl_for_rspec
copy_file 'factory_girl_rspec.rb', 'spec/support/factory_girl.rb'
end
|
#support_templates_and_views_in_application_rb ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/scoby/app_builder.rb', line 24
def support_templates_and_views_in_application_rb
inject_into_file "config/application.rb", after: "config.active_record.raise_in_transactional_callbacks = true\n" do
<<-RUBY
# Support /app/view .rb classes and /app/templates files.
config.autoload_paths << (Rails.root + "app/views/concerns").to_s
config.autoload_paths << (Rails.root + "app/views").to_s
config.to_prepare do
ApplicationController.send(:append_view_path, Rails.root.join("app", "templates"))
end
RUBY
end
end
|