Class: BlueberryRails::AppGenerator

Inherits:
Rails::Generators::AppGenerator
  • Object
show all
Defined in:
lib/blueberry_rails/generators/app_generator.rb

Instance Method Summary collapse

Instance Method Details

#blueberry_customizationObject



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/blueberry_rails/generators/app_generator.rb', line 54

def blueberry_customization
  invoke :customize_gemfile
  invoke :setup_database
  invoke :setup_development_environment
  invoke :setup_test_environment
  invoke :setup_staging_environment
  invoke :setup_integration_environment
  invoke :create_views
  invoke :create_assets
  invoke :configure_app
  invoke :remove_routes_comment_lines
  invoke :setup_gems
  invoke :setup_git
  invoke :setup_admin
  invoke :rake_tasks
  invoke :setup_custom_errors
  invoke :setup_initializers
  invoke :setup_heroku
  invoke :setup_cache_and_compress
  invoke :setup_linters
end

#configure_appObject



146
147
148
149
150
151
152
153
154
155
# File 'lib/blueberry_rails/generators/app_generator.rb', line 146

def configure_app
  build :secret_token
  build :setup_mailer_hosts
  build :create_pryrc
  build :create_procfile
  build :create_puma_config
  build :add_ruby_version_file
  build :configure_i18n
  build :configure_bin_setup
end

#create_assetsObject



142
143
144
# File 'lib/blueberry_rails/generators/app_generator.rb', line 142

def create_assets
  build :copy_assets_directory if options[:bootstrap]
end

#create_viewsObject



137
138
139
140
# File 'lib/blueberry_rails/generators/app_generator.rb', line 137

def create_views
  build :create_partials_directory
  build :create_application_layout
end

#customize_gemfileObject



76
77
78
# File 'lib/blueberry_rails/generators/app_generator.rb', line 76

def customize_gemfile
  bundle_command 'install'
end

#finish_templateObject



46
47
48
49
50
51
52
# File 'lib/blueberry_rails/generators/app_generator.rb', line 46

def finish_template
  if options[:administration] && (!options[:devise] || !options[:bootstrap])
    raise 'Administration depends on bootstrap and devise!'
  end
  invoke :blueberry_customization
  super
end

#rake_tasksObject



202
203
204
# File 'lib/blueberry_rails/generators/app_generator.rb', line 202

def rake_tasks
  build :copy_rake_tasks
end

#remove_routes_comment_linesObject



157
158
159
# File 'lib/blueberry_rails/generators/app_generator.rb', line 157

def remove_routes_comment_lines
  build :remove_routes_comment_lines
end

#run_bundleObject



206
207
# File 'lib/blueberry_rails/generators/app_generator.rb', line 206

def run_bundle
end

#setup_adminObject



124
125
126
127
128
# File 'lib/blueberry_rails/generators/app_generator.rb', line 124

def setup_admin
  if options[:administration]
    build :setup_admin
  end
end

#setup_cache_and_compressObject



161
162
163
164
# File 'lib/blueberry_rails/generators/app_generator.rb', line 161

def setup_cache_and_compress
  say 'Setting up compress and cache for production env'
  build :cache_and_compress
end

#setup_cocoonObject



197
198
199
200
# File 'lib/blueberry_rails/generators/app_generator.rb', line 197

def setup_cocoon
  say 'Setting up Cocoon'
  build :cocoon_config
end

#setup_custom_errorsObject



130
131
132
133
134
135
# File 'lib/blueberry_rails/generators/app_generator.rb', line 130

def setup_custom_errors
  if options[:custom_errors]
    say 'Setting up custom errors'
    build :copy_custom_errors
  end
end

#setup_databaseObject



80
81
82
83
84
85
86
87
88
# File 'lib/blueberry_rails/generators/app_generator.rb', line 80

def setup_database
  say 'Setting up database'

  if 'postgresql' == options[:database]
    build :use_postgres_config_template
  end

  build :create_database
end

#setup_development_environmentObject



90
91
92
93
94
95
96
# File 'lib/blueberry_rails/generators/app_generator.rb', line 90

def setup_development_environment
  say 'Setting up the development environment'
  build :configure_generators
  build :raise_on_unpermitted_parameters
  build :configure_i18n_logger
  build :configure_mailcatcher
end

#setup_gemsObject



166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/blueberry_rails/generators/app_generator.rb', line 166

def setup_gems
  say 'Setting up SimpleForm'
  build :configure_simple_form
  if options[:devise]
    say 'Setting up devise'
    build :install_devise
    build :replace_users_factory
    build :replace_root_controller_spec
  else
    build :create_root_page
  end
end

#setup_gitObject



179
180
181
182
183
# File 'lib/blueberry_rails/generators/app_generator.rb', line 179

def setup_git
  say 'Initializing git'
  build :setup_gitignore
  build :init_git
end

#setup_herokuObject



185
186
187
188
189
190
# File 'lib/blueberry_rails/generators/app_generator.rb', line 185

def setup_heroku
  if options[:heroku]
    say 'Add heroku reviews apps config'
    build :reviews_app
  end
end

#setup_initializersObject



119
120
121
122
# File 'lib/blueberry_rails/generators/app_generator.rb', line 119

def setup_initializers
  say 'Setting up initializers'
  build :copy_initializers
end

#setup_integration_environmentObject



114
115
116
117
# File 'lib/blueberry_rails/generators/app_generator.rb', line 114

def setup_integration_environment
  say 'Setting up the integration environment'
  build :setup_integration_environment
end

#setup_lintersObject



192
193
194
195
# File 'lib/blueberry_rails/generators/app_generator.rb', line 192

def setup_linters
  say 'Setting up linters'
  build :hound_config
end

#setup_staging_environmentObject



109
110
111
112
# File 'lib/blueberry_rails/generators/app_generator.rb', line 109

def setup_staging_environment
  say 'Setting up the staging environment'
  build :setup_staging_environment
end

#setup_test_environmentObject



98
99
100
101
102
103
104
105
106
107
# File 'lib/blueberry_rails/generators/app_generator.rb', line 98

def setup_test_environment
  say 'Setting up the test environment'
  build :generate_rspec
  build :configure_rspec
  build :setup_rspec_support_files
  build :test_factories_first
  build :configure_circle
  build :init_guard
  build :setup_guard
end