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



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

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

#configure_appObject



152
153
154
155
156
157
158
159
160
161
162
# File 'lib/blueberry_rails/generators/app_generator.rb', line 152

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 :hound_config
  build :configure_i18n
  build :configure_bin_setup
end

#create_assetsObject



148
149
150
# File 'lib/blueberry_rails/generators/app_generator.rb', line 148

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

#create_viewsObject



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

def create_views
  build :create_partials_directory
  build :create_application_layout
end

#customize_gemfileObject



79
80
81
# File 'lib/blueberry_rails/generators/app_generator.rb', line 79

def customize_gemfile
  bundle_command 'install'
end

#finish_templateObject



49
50
51
52
53
54
55
# File 'lib/blueberry_rails/generators/app_generator.rb', line 49

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



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

def rake_tasks
  build :copy_rake_tasks
end

#remove_routes_comment_linesObject



164
165
166
# File 'lib/blueberry_rails/generators/app_generator.rb', line 164

def remove_routes_comment_lines
  build :remove_routes_comment_lines
end

#run_bundleObject



210
211
# File 'lib/blueberry_rails/generators/app_generator.rb', line 210

def run_bundle
end

#setup_adminObject



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

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

#setup_cache_and_compressObject



168
169
170
171
# File 'lib/blueberry_rails/generators/app_generator.rb', line 168

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

#setup_custom_errorsObject



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

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

#setup_databaseObject



83
84
85
86
87
88
89
90
91
# File 'lib/blueberry_rails/generators/app_generator.rb', line 83

def setup_database
  say 'Setting up database'

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

  build :create_database
end

#setup_development_environmentObject



93
94
95
96
97
98
99
# File 'lib/blueberry_rails/generators/app_generator.rb', line 93

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_fontcustomObject



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

def setup_fontcustom
  if options[:fontcustom]
    say 'Setting up fontcustom'
    build :copy_fontcustom_config
  end
end

#setup_gemsObject



173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/blueberry_rails/generators/app_generator.rb', line 173

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



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

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

#setup_gulpObject



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

def setup_gulp
  if options[:gulp]
    say 'Adding Gulp asset pipeline'
    build :gulp_files
  end
end

#setup_herokuObject



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

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

#setup_initializersObject



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

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

#setup_staging_environmentObject



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

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

#setup_test_environmentObject



101
102
103
104
105
106
107
108
109
110
# File 'lib/blueberry_rails/generators/app_generator.rb', line 101

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