Class: TractorBeam::AppGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details



127
128
129
# File 'lib/tractor_beam/generators/app_generator.rb', line 127

def self.banner
  "tractor_beam #{arguments.map(&:usage).join(' ')} [options]"
end

Instance Method Details

#beam_customizationsObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/tractor_beam/generators/app_generator.rb', line 46

def beam_customizations
  build :set_ruby_version

  invoke :setup_development_environment
  invoke :run_bundle
  invoke :run_webpack
  invoke :setup_test_environment
  invoke :setup_production_environment
  invoke :setup_default_rails_features_on_webpack
  invoke :setup_component_based_frontend
  invoke :setup_linters
  invoke :generate_spring_binstubs
  invoke :git_first_commit
  invoke :outro
end

#finish_templateObject



40
41
42
43
44
# File 'lib/tractor_beam/generators/app_generator.rb', line 40

def finish_template
  invoke :beam_customizations

  super
end

#git_first_commitObject



110
111
112
113
114
# File 'lib/tractor_beam/generators/app_generator.rb', line 110

def git_first_commit
  say "Commiting skeleton app to git"

  run("git add . && git commit -m 'first commit'")
end

#outroObject



116
117
118
119
120
121
122
123
124
125
# File 'lib/tractor_beam/generators/app_generator.rb', line 116

def outro
  outro_text = <<-OUTRO

========================
= Abduction complete!! =
========================
OUTRO

  say outro_text, :blue
end

#setup_component_based_frontendObject



62
63
64
65
66
67
68
69
70
71
# File 'lib/tractor_beam/generators/app_generator.rb', line 62

def setup_component_based_frontend
  say "Setting modern frontend architecture"

  build :remove_legacy_assets_folder
  build :setup_root_frontend_folder
  build :create_application_layout
  build :setup_browserlist_rc
  build :customize_webpacker_yml
  build :prepend_view_path_to_application_controller
end

#setup_default_rails_features_on_webpackObject



104
105
106
107
108
# File 'lib/tractor_beam/generators/app_generator.rb', line 104

def setup_default_rails_features_on_webpack
  build :setup_rails_ujs
  build :setup_actioncable
  build :setup_turbolinks
end

#setup_development_environmentObject



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

def setup_development_environment
  say "Setting up development environment"

  build :configure_generators
  build :component_generator
  build :procfile_dev
  build :provide_setup_script
end

#setup_lintersObject



73
74
75
76
77
78
79
# File 'lib/tractor_beam/generators/app_generator.rb', line 73

def setup_linters
  say "Setting up linters"

  build :setup_js_linter
  build :setup_style_linter
  build :add_scripts_to_package_json
end

#setup_production_environmentObject



96
97
98
99
100
101
102
# File 'lib/tractor_beam/generators/app_generator.rb', line 96

def setup_production_environment
  say "Setting up production environment"

  build :customize_rakefile
  # build :boot_file
  build :procfile
end

#setup_test_environmentObject



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

def setup_test_environment
  say "Setting up test environment"

  build :setup_rspec
end