Class: Generapp::Generators::AppGenerator

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

Overview

Rails App generator

Instance Method Summary collapse

Instance Method Details

#configure_appObject



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

def configure_app
  say 'Configuring app'
  Generapp::Actions::Configuration.instance_methods(false).each do |action|
    build action.to_sym
  end
end

#create_generapp_viewsObject



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

def create_generapp_views
  say 'Creating views'
  Generapp::Actions::Views.instance_methods(false).each do |action|
    build action.to_sym
  end
end

#finish_templateObject



32
33
34
35
# File 'lib/generapp/generators/app_generator.rb', line 32

def finish_template
  invoke :generapp_customization
  super
end

#generapp_customizationObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/generapp/generators/app_generator.rb', line 37

def generapp_customization
  invoke :setup_gems
  invoke :setup_development_environment
  invoke :setup_test_environment
  invoke :setup_production_environment
  invoke :create_generapp_views
  invoke :configure_app
  invoke :setup_stylesheets
  invoke :setup_database
  invoke :setup_git
  invoke :setup_bundler_audit
  invoke :setup_rubocop
  invoke :generate_spring_binstubs
  invoke :outro
end

#generate_spring_binstubsObject



122
123
124
125
# File 'lib/generapp/generators/app_generator.rb', line 122

def generate_spring_binstubs
  say 'Springifying executables'
  build :generate_spring_binstubs
end

#get_builder_classObject (protected)



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

def get_builder_class
  Generapp::AppBuilder
end

#init_gitObject



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

def init_git
  build :init_git
end

#outroObject



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

def outro
  say "Done generating #{app_name}"
  say "Remember to run 'bundle exec honeybadger install [YOUR API KEY HERE]'"
end

#setup_bundler_auditObject



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

def setup_bundler_audit
  say 'Setting up bundler-audit'
  build :setup_bundler_audit
end

#setup_databaseObject



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

def setup_database
  say 'Setting up database'
  if 'postgresql' == options[:database]
    build :use_postgres_config_template
  end
  build :create_database
end

#setup_development_environmentObject



58
59
60
61
62
63
# File 'lib/generapp/generators/app_generator.rb', line 58

def setup_development_environment
  say 'Setting up the development environment'
  Generapp::Actions::Develop.instance_methods(false).each do |action|
    build action.to_sym
  end
end

#setup_gemsObject



53
54
55
56
# File 'lib/generapp/generators/app_generator.rb', line 53

def setup_gems
  build :set_ruby_version
  bundle_command 'install'
end

#setup_gitObject



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

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

#setup_production_environmentObject



72
73
74
75
76
77
# File 'lib/generapp/generators/app_generator.rb', line 72

def setup_production_environment
  say 'Setting up the production environment'
  Generapp::Actions::Production.instance_methods(false).each do |action|
    build action.to_sym
  end
end

#setup_rubocopObject



117
118
119
120
# File 'lib/generapp/generators/app_generator.rb', line 117

def setup_rubocop
  say 'Setting up rubocop'
  build :setup_rubocop
end

#setup_stylesheetsObject



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

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

#setup_test_environmentObject



65
66
67
68
69
70
# File 'lib/generapp/generators/app_generator.rb', line 65

def setup_test_environment
  say 'Setting up the test environment'
  Generapp::Actions::Test.instance_methods(false).each do |action|
    build action.to_sym
  end
end

#using_active_record?Boolean (protected)

Returns:

  • (Boolean)


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

def using_active_record?
  !options[:skip_active_record]
end