Class: Sparkler::AppGenerator

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

Instance Method Summary collapse

Instance Method Details

#configure_generatorsObject



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

def configure_generators
  say 'Configuring generators'
  build :configure_generators
end

#copy_miscellaneous_filesObject



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

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

#create_views_and_layoutsObject



59
60
61
62
63
64
65
66
# File 'lib/sparkler/generators/app_generator.rb', line 59

def create_views_and_layouts
  say 'Creating layouts and partials'
  build :create_partials_directory
  build :create_shared_flashes

  say 'Setting up High Voltage and a home page'
  build :setup_high_voltage
end

#customize_gemfileObject



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

def customize_gemfile
  say 'Setting up gems and bundling'
  build :gemfile
  bundle_command 'install --path vendor'
  bundle_command 'package'
end

#finish_templateObject



10
11
12
13
# File 'lib/sparkler/generators/app_generator.rb', line 10

def finish_template
  invoke :sparkler_customization
  super
end

#outroObject



128
129
130
# File 'lib/sparkler/generators/app_generator.rb', line 128

def outro
  say 'Congratulations! Your app is ready to go!'
end

#remove_routes_comment_linesObject



124
125
126
# File 'lib/sparkler/generators/app_generator.rb', line 124

def remove_routes_comment_lines
  build :remove_routes_comment_lines
end

#remove_useless_filesObject



38
39
40
41
# File 'lib/sparkler/generators/app_generator.rb', line 38

def remove_useless_files
  build :remove_public_index
  build :remove_rails_logo_image
end

#run_bundleObject



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

def run_bundle

end

#setup_databaseObject



43
44
45
46
47
48
49
50
51
52
# File 'lib/sparkler/generators/app_generator.rb', line 43

def setup_database
  if options[:database] == 'postgresql'
    build :use_postgres_config_template
    build :setup_local_postgres if options[:local_database]
    build :create_postgres_database
  elsif options[:database] == 'sqlite3'
    build :use_sqlite_config_template
    build :create_sqlite_database
  end
end

#setup_envObject



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

def setup_env
  say 'Adding an .env file'
  build :add_env_from_template
end

#setup_foundationObject



68
69
70
71
72
73
# File 'lib/sparkler/generators/app_generator.rb', line 68

def setup_foundation
  say 'Generating Foundation'
  build :setup_foundation
  build :add_foundation_to_application
  build :create_application_layout
end

#setup_gitObject



92
93
94
95
96
97
# File 'lib/sparkler/generators/app_generator.rb', line 92

def setup_git
  say 'Initalizing git repo'
  build :setup_gitignore
  build :init_git
  build :ignore_local_postgres if options[:local_database]
end

#setup_rspecObject



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

def setup_rspec
  say 'Configuring Rspec'
  build :configure_rspec
end

#setup_scriptsObject



99
100
101
102
# File 'lib/sparkler/generators/app_generator.rb', line 99

def setup_scripts
  say 'Adding convenience scripts'
  build :setup_scripts
end

#setup_sentryObject



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

def setup_sentry
  say 'Configuring Sentry'
  build :setup_sentry
end

#setup_springObject



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

def setup_spring
  say 'Setting up Spring binstubs'
  build :use_spring_binstubs
end

#setup_staging_environmentObject



54
55
56
57
# File 'lib/sparkler/generators/app_generator.rb', line 54

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

#sparkler_customizationObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/sparkler/generators/app_generator.rb', line 15

def sparkler_customization
  invoke :configure_generators
  invoke :customize_gemfile
  invoke :setup_database
  invoke :remove_useless_files
  invoke :remove_routes_comment_lines
  invoke :setup_staging_environment
  invoke :create_views_and_layouts
  invoke :copy_miscellaneous_files
  invoke :setup_foundation
  invoke :use_coffeescript
  invoke :setup_sentry
  invoke :setup_env
  invoke :setup_rspec
  invoke :setup_git
  invoke :setup_scripts
  invoke :setup_spring
end

#use_coffeescriptObject



34
35
36
# File 'lib/sparkler/generators/app_generator.rb', line 34

def use_coffeescript
  build :use_coffeescript
end