Class: Jobshop::Generators::AppGenerator

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

Direct Known Subclasses

DummyGenerator

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ AppGenerator

Returns a new instance of AppGenerator.



69
70
71
72
73
74
75
# File 'lib/generators/jobshop/app/app_generator.rb', line 69

def initialize(*args)
  super

  config = args.last.is_a?(Hash) ? args.pop : { }
  jobshop_options = config[:jobshop_options] || { }
  self.options = options.merge(jobshop_options).freeze
end

Class Method Details



77
78
79
# File 'lib/generators/jobshop/app/app_generator.rb', line 77

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

.source_pathsObject



57
58
59
60
# File 'lib/generators/jobshop/app/app_generator.rb', line 57

def self.source_paths
  [ Rails::Generators::AppGenerator.source_root,
    Jobshop::Generators::AppGenerator.source_root ]
end

.source_rootObject



53
54
55
# File 'lib/generators/jobshop/app/app_generator.rb', line 53

def self.source_root
  File.expand_path("templates", __dir__)
end

Instance Method Details

#finish_templateObject



85
86
87
88
89
90
# File 'lib/generators/jobshop/app/app_generator.rb', line 85

def finish_template
  generate "jobshop:config"
  build :config_schema_format
  build :mount_engine
  super
end

#remove_session_store_initializer_until_rails_5_1Object



81
82
83
# File 'lib/generators/jobshop/app/app_generator.rb', line 81

def remove_session_store_initializer_until_rails_5_1
  remove_file "config/initializers/session_store.rb"
end

#run_bundleObject



92
93
94
95
# File 'lib/generators/jobshop/app/app_generator.rb', line 92

def run_bundle
  super
  bundle_command("binstub jobshop") if bundle_install?
end