Class: Startblock::AppBuilder
- Inherits:
-
Rails::AppBuilder
- Object
- Rails::AppBuilder
- Startblock::AppBuilder
show all
- Includes:
- Actions
- Defined in:
- lib/startblock/app_builder.rb
Instance Method Summary
collapse
Methods included from Actions
#action_mailer_host, #configure_environment, #replace_in_file
Instance Method Details
92
93
94
95
96
|
# File 'lib/startblock/app_builder.rb', line 92
def configure_action_mailer
config = "config.action_mailer.delivery_method = :letter_opener"
configure_environment("development", config)
action_mailer_host "test", %{"www.example.com"}
end
|
46
47
48
49
|
# File 'lib/startblock/app_builder.rb', line 46
def configure_i18n_for_missing_translations
raise_on_missing_translations_in("development")
raise_on_missing_translations_in("test")
end
|
#configuring_test_helper ⇒ Object
51
52
53
54
|
# File 'lib/startblock/app_builder.rb', line 51
def configuring_test_helper
remove_file "test/test_helper.rb"
template "test_helper.erb", "test/test_helper.rb"
end
|
#copy_puma_config ⇒ Object
125
126
127
|
# File 'lib/startblock/app_builder.rb', line 125
def copy_puma_config
copy_file 'puma.rb', 'config/puma.rb'
end
|
#create_application_layout ⇒ Object
86
87
88
89
90
|
# File 'lib/startblock/app_builder.rb', line 86
def create_application_layout
template 'startblock_layout.html.erb.erb',
'app/views/layouts/application.html.erb',
force: true
end
|
#create_database ⇒ Object
23
24
25
|
# File 'lib/startblock/app_builder.rb', line 23
def create_database
bundle_command 'exec rake db:create db:migrate'
end
|
#create_partials_directory ⇒ Object
74
75
76
|
# File 'lib/startblock/app_builder.rb', line 74
def create_partials_directory
empty_directory 'app/views/application'
end
|
#create_shared_flashes ⇒ Object
78
79
80
|
# File 'lib/startblock/app_builder.rb', line 78
def create_shared_flashes
copy_file '_flashes.html.erb', 'app/views/application/_flashes.html.erb'
end
|
#create_shared_javascripts ⇒ Object
82
83
84
|
# File 'lib/startblock/app_builder.rb', line 82
def create_shared_javascripts
copy_file '_javascript.html.erb', 'app/views/application/_javascript.html.erb'
end
|
#gitignore_files ⇒ Object
120
121
122
123
|
# File 'lib/startblock/app_builder.rb', line 120
def gitignore_files
remove_file '.gitignore'
copy_file 'startblock_gitignore', '.gitignore'
end
|
#init_git ⇒ Object
129
130
131
|
# File 'lib/startblock/app_builder.rb', line 129
def init_git
run 'git init'
end
|
#provide_setup_script ⇒ Object
40
41
42
43
44
|
# File 'lib/startblock/app_builder.rb', line 40
def provide_setup_script
remove_file "bin/setup"
template "bin_setup.erb", "bin/setup"
run "chmod a+x bin/setup"
end
|
#raise_on_delivery_errors ⇒ Object
27
28
29
30
|
# File 'lib/startblock/app_builder.rb', line 27
def raise_on_delivery_errors
replace_in_file 'config/environments/development.rb',
'raise_delivery_errors = false', 'raise_delivery_errors = true'
end
|
#raise_on_unpermitted_parameters ⇒ Object
32
33
34
35
36
37
38
|
# File 'lib/startblock/app_builder.rb', line 32
def raise_on_unpermitted_parameters
config = "config.action_controller.action_on_unpermitted_parameters = :raise\n RUBY\n\n inject_into_class \"config/application.rb\", \"Application\", config\nend\n"
|
#readme ⇒ Object
5
6
7
|
# File 'lib/startblock/app_builder.rb', line 5
def readme
template 'README.md.erb', 'README.md'
end
|
114
115
116
117
118
|
# File 'lib/startblock/app_builder.rb', line 114
def
replace_in_file 'config/routes.rb',
/Rails\.application\.routes\.draw do.*end/m,
"Rails.application.routes.draw do\nend"
end
|
#replace_gemfile ⇒ Object
9
10
11
12
|
# File 'lib/startblock/app_builder.rb', line 9
def replace_gemfile
remove_file 'Gemfile'
template 'Gemfile.erb', 'Gemfile'
end
|
#set_ruby_to_version_being_used ⇒ Object
14
15
16
|
# File 'lib/startblock/app_builder.rb', line 14
def set_ruby_to_version_being_used
create_file '.ruby-version', "#{Startblock::RUBY_VERSION}\n"
end
|
#setup_foreman ⇒ Object
98
99
100
101
|
# File 'lib/startblock/app_builder.rb', line 98
def setup_foreman
copy_file 'sample.env', '.sample.env'
copy_file 'Procfile', 'Procfile'
end
|
#setup_javascripts ⇒ Object
109
110
111
112
|
# File 'lib/startblock/app_builder.rb', line 109
def setup_javascripts
remove_file "app/assets/javascripts/application.js"
copy_file "application.js", "app/assets/javascripts/application.js"
end
|
#setup_mixpanel ⇒ Object
133
134
135
136
|
# File 'lib/startblock/app_builder.rb', line 133
def setup_mixpanel
copy_file '_mixpanel.html.erb',
'app/views/application/_mixpanel.html.erb'
end
|
#setup_rubocop ⇒ Object
138
139
140
|
# File 'lib/startblock/app_builder.rb', line 138
def setup_rubocop
copy_file "rubocop.yml", ".rubocop.yml"
end
|
#setup_secret_token ⇒ Object
70
71
72
|
# File 'lib/startblock/app_builder.rb', line 70
def setup_secret_token
template 'secrets.yml', 'config/secrets.yml', force: true
end
|
#setup_staging_environment ⇒ Object
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/startblock/app_builder.rb', line 56
def setup_staging_environment
staging_file = 'config/environments/staging.rb'
copy_file 'staging.rb', staging_file
config = "\nRails.application.configure do\n # ...\nend\n RUBY\n\n append_file staging_file, config\nend\n"
|
#setup_stylesheets ⇒ Object
103
104
105
106
107
|
# File 'lib/startblock/app_builder.rb', line 103
def setup_stylesheets
remove_file 'app/assets/stylesheets/application.css'
copy_file 'application.scss',
'app/assets/stylesheets/application.scss'
end
|
#use_postgres_config_template ⇒ Object
18
19
20
21
|
# File 'lib/startblock/app_builder.rb', line 18
def use_postgres_config_template
template 'postgresql_database.yml.erb', 'config/database.yml',
force: true
end
|