Class: Tirantes::AppGenerator

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

Instance Method Summary collapse

Instance Method Details

#configure_appObject



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/tirantes/generators/app_generator.rb', line 112

def configure_app
  say 'Configuring app'
  build :configure_action_mailer
  build :blacklist_active_record_attributes
  build :configure_strong_parameters
  build :configure_time_zone
  build :configure_time_formats
  build :configure_pretty_formatter
  build :configure_simple_form
  build :configure_rack_timeout
  build :disable_xml_params
  build :setup_secret_token
  build :setup_default_rake_task
  build :configure_puma
  build :setup_foreman
end

#copy_librariesObject



165
166
167
168
# File 'lib/tirantes/generators/app_generator.rb', line 165

def copy_libraries
  say 'Copying libraries'
  build :copy_libraries
end

#copy_miscellaneous_filesObject



170
171
172
173
# File 'lib/tirantes/generators/app_generator.rb', line 170

def copy_miscellaneous_files
  say 'Copying miscellaneous support files'
  build :copy_miscellaneous_files
end

#create_github_repoObject



150
151
152
153
154
155
# File 'lib/tirantes/generators/app_generator.rb', line 150

def create_github_repo
  if !options[:skip_git] && options[:github]
    say 'Creating Github repo'
    build :create_github_repo, options[:github]
  end
end

#create_heroku_appsObject



142
143
144
145
146
147
148
# File 'lib/tirantes/generators/app_generator.rb', line 142

def create_heroku_apps
  if options[:heroku]
    say 'Creating Heroku apps'
    build :create_heroku_apps
    build :set_heroku_remotes
  end
end

#create_tirantes_viewsObject



98
99
100
101
102
103
104
# File 'lib/tirantes/generators/app_generator.rb', line 98

def create_tirantes_views
  say 'Creating tirantes views'
  build :create_partials_directory
  build :create_shared_flashes
  build :create_shared_javascripts
  build :create_application_layout
end

#customize_error_pagesObject



175
176
177
178
# File 'lib/tirantes/generators/app_generator.rb', line 175

def customize_error_pages
  say 'Customizing the 500/404/422 pages'
  build :customize_error_pages
end

#customize_gemfileObject



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

def customize_gemfile
  build :replace_gemfile
  build :set_ruby_to_version_being_used
  bundle_command 'install'
end

#finish_templateObject



18
19
20
21
# File 'lib/tirantes/generators/app_generator.rb', line 18

def finish_template
  invoke :tirantes_customization
  super
end

#init_gitObject



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

def init_git
  build :init_git
end

#outroObject



184
185
186
187
# File 'lib/tirantes/generators/app_generator.rb', line 184

def outro
  say 'Congratulations! You just pulled our tirantes.'
  say 'Please execute bin/setup to complete this application setup'
end

#remove_files_we_dont_needObject



44
45
46
47
# File 'lib/tirantes/generators/app_generator.rb', line 44

def remove_files_we_dont_need
  build :remove_public_index
  build :remove_rails_logo_image
end

#remove_routes_comment_linesObject



180
181
182
# File 'lib/tirantes/generators/app_generator.rb', line 180

def remove_routes_comment_lines
  build :remove_routes_comment_lines
end

#run_bundleObject



189
190
191
# File 'lib/tirantes/generators/app_generator.rb', line 189

def run_bundle
  # Let's not: We'll bundle manually at the right spot
end

#setup_coffeescriptObject



106
107
108
109
110
# File 'lib/tirantes/generators/app_generator.rb', line 106

def setup_coffeescript
  say 'Setting up CoffeeScript defaults'
  build :remove_turbolinks
  build :create_common_javascripts
end

#setup_databaseObject



55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/tirantes/generators/app_generator.rb', line 55

def setup_database
  say 'Setting up database'

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

  build :create_database

  say 'If you want to use pg text search, remember to'
  say 'to generate and migrate pg_search_documents table'
  say 'rails g pg_search:migration:multisearch'
  say 'rake db:migrate'
end

#setup_development_environmentObject



70
71
72
73
74
75
76
# File 'lib/tirantes/generators/app_generator.rb', line 70

def setup_development_environment
  say 'Setting up the development environment'
  build :raise_on_delivery_errors
  build :raise_on_unpermitted_parameters
  build :provide_setup_script
  build :configure_generators
end

#setup_gitObject



134
135
136
137
138
139
140
# File 'lib/tirantes/generators/app_generator.rb', line 134

def setup_git
  if !options[:skip_git]
    say 'Initializing git'
    invoke :setup_gitignore
    invoke :init_git
  end
end

#setup_gitignoreObject



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

def setup_gitignore
  build :gitignore_files
end

#setup_production_environmentObject



87
88
89
90
91
# File 'lib/tirantes/generators/app_generator.rb', line 87

def setup_production_environment
  say 'Setting up the production environment'
  build :configure_smtp
  build :configure_exception_notifier
end

#setup_staging_environmentObject



93
94
95
96
# File 'lib/tirantes/generators/app_generator.rb', line 93

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

#setup_stylesheetsObject



129
130
131
132
# File 'lib/tirantes/generators/app_generator.rb', line 129

def setup_stylesheets
  say 'Set up stylesheets'
  build :setup_stylesheets
end

#setup_test_environmentObject



78
79
80
81
82
83
84
85
# File 'lib/tirantes/generators/app_generator.rb', line 78

def setup_test_environment
  say 'Setting up the test environment'
  build :generate_minitest
  build :configure_minitest
  build :configure_background_jobs_for_minitest
  build :enable_database_cleaner
  build :configure_capybara_webkit
end

#tirantes_customizationObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/tirantes/generators/app_generator.rb', line 23

def tirantes_customization
  invoke :remove_files_we_dont_need
  invoke :customize_gemfile
  invoke :setup_database
  invoke :setup_development_environment
  invoke :setup_test_environment
  invoke :setup_production_environment
  invoke :setup_staging_environment
  invoke :create_tirantes_views
  invoke :setup_coffeescript
  invoke :configure_app
  invoke :setup_stylesheets
  invoke :copy_miscellaneous_files
  invoke :customize_error_pages
  invoke :remove_routes_comment_lines
  invoke :setup_git
  invoke :create_heroku_apps
  invoke :create_github_repo
  invoke :outro
end