Class: Yoda::Commands::Setup
Instance Attribute Summary collapse
- #bars ⇒ Hash{ Symbol => ProgressBar } readonly
- #dir ⇒ String readonly
- #force_build ⇒ true, false readonly
Instance Method Summary collapse
-
#initialize(dir: nil, force_build: false) ⇒ Setup
constructor
A new instance of Setup.
- #project ⇒ Object
- #run ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(dir: nil, force_build: false) ⇒ Setup
Returns a new instance of Setup.
16 17 18 19 20 |
# File 'lib/yoda/commands/setup.rb', line 16 def initialize(dir: nil, force_build: false) @dir = dir || Dir.pwd @force_build = force_build @bars = {} end |
Instance Attribute Details
#bars ⇒ Hash{ Symbol => ProgressBar } (readonly)
13 14 15 |
# File 'lib/yoda/commands/setup.rb', line 13 def @bars end |
#dir ⇒ String (readonly)
7 8 9 |
# File 'lib/yoda/commands/setup.rb', line 7 def dir @dir end |
#force_build ⇒ true, false (readonly)
10 11 12 |
# File 'lib/yoda/commands/setup.rb', line 10 def force_build @force_build end |
Instance Method Details
#project ⇒ Object
34 35 36 |
# File 'lib/yoda/commands/setup.rb', line 34 def project @project ||= Store::Project.new(dir) end |
#run ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/yoda/commands/setup.rb', line 22 def run build_core_index if File.exist?(File.('Gemfile.lock', dir)) || force_build Logger.info 'Building index for the current project...' Instrument.instance.hear(initialization_progress: method(:on_progress), registry_dump: method(:on_progress)) do force_build ? project.rebuild_cache : project.build_cache end else Logger.info 'Skipped building project index because Gemfile.lock is not exist for the current dir' end end |