Class: MoshGenerator::AppGenerator

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

Overview

Override Rails default AppGenerator.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

Banner for the cli.



15
16
17
# File 'lib/mosh_generator/generators/app_generator.rb', line 15

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

Instance Method Details

#create_application_structureObject

Create the minimal application structure.



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

def create_application_structure
  build :create_helpers
  build :create_layout
  build :create_partial_views
  build :configure_grunt
end

#create_configuration_filesObject

Creates some configuration files for tools.



62
63
64
65
66
# File 'lib/mosh_generator/generators/app_generator.rb', line 62

def create_configuration_files
  build :create_editorconfig_file
  build :create_ruby_version_file
  build :create_ruby_gemset_file
end

#create_staging_environmentObject

Creates a staging environment



71
72
73
# File 'lib/mosh_generator/generators/app_generator.rb', line 71

def create_staging_environment
  build :create_staging_environment_file
end

#finish_templateObject

Overrides default implementation to run customization code.



35
36
37
38
# File 'lib/mosh_generator/generators/app_generator.rb', line 35

def finish_template
  invoke :mosh_generator_customization
  super
end

#mosh_generator_customizationObject

Customized generator wrapper.



43
44
45
46
47
48
# File 'lib/mosh_generator/generators/app_generator.rb', line 43

def mosh_generator_customization
  invoke :remove_files_we_dont_need
  invoke :create_configuration_files
  invoke :create_staging_environment
  invoke :create_application_structure
end

#remove_files_we_dont_needObject

Do some clean up.



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

def remove_files_we_dont_need
  build :remove_public_index
  build :remove_assets_directories
  build :remove_doc_directory
end

#run_bundleObject

Override the original run_bundle to do nothing.



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

def run_bundle
  bundle_command 'install --without production staging'
end