Class: Discharger::Setup
- Inherits:
-
Object
- Object
- Discharger::Setup
- Defined in:
- lib/discharger/setup.rb
Instance Attribute Summary collapse
-
#app_root ⇒ Object
readonly
Returns the value of attribute app_root.
-
#config_path ⇒ Object
readonly
Returns the value of attribute config_path.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(config_path, app_root: nil) ⇒ Setup
constructor
A new instance of Setup.
- #run ⇒ Object
Constructor Details
#initialize(config_path, app_root: nil) ⇒ Setup
Returns a new instance of Setup.
23 24 25 26 |
# File 'lib/discharger/setup.rb', line 23 def initialize(config_path, app_root: nil) @config_path = config_path @app_root = app_root || Dir.pwd end |
Instance Attribute Details
#app_root ⇒ Object (readonly)
Returns the value of attribute app_root.
21 22 23 |
# File 'lib/discharger/setup.rb', line 21 def app_root @app_root end |
#config_path ⇒ Object (readonly)
Returns the value of attribute config_path.
21 22 23 |
# File 'lib/discharger/setup.rb', line 21 def config_path @config_path end |
Class Method Details
.run(config_path = "config/setup.yml", app_root: nil) ⇒ Object
28 29 30 |
# File 'lib/discharger/setup.rb', line 28 def self.run(config_path = "config/setup.yml", app_root: nil) new(config_path, app_root: app_root).run end |
Instance Method Details
#run ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/discharger/setup.rb', line 32 def run FileUtils.chdir(app_root) do validate_environment print_header # Phase 1: Load bundler first (activates correct gem versions) # This must happen before we parse YAML to avoid psych version conflicts load_bundler # Phase 2: Pre-Rails setup (env vars, system dependencies) # These run AFTER bundler but BEFORE Rails loads run_prerequisites # Phase 3: Load Rails (uses env vars from phase 2) load_rails # Phase 4: Run Discharger commands (after Rails loads) run_setup_commands end end |