Class: Brut::CLI::Apps::New::AddSegment
- Inherits:
-
Object
- Object
- Brut::CLI::Apps::New::AddSegment
- Defined in:
- lib/brut/cli/apps/new/add_segment.rb
Instance Method Summary collapse
-
#add! ⇒ Object
-
#initialize(current_dir:, add_segment_options:, out:, err:) ⇒ AddSegment
constructor
A new instance of AddSegment.
Constructor Details
#initialize(current_dir:, add_segment_options:, out:, err:) ⇒ AddSegment
Returns a new instance of AddSegment.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/brut/cli/apps/new/add_segment.rb', line 6 def initialize(current_dir:, add_segment_options:, out:, err:) @out = out @add_segment_options = @out.puts "Adding #{@add_segment_options.segment_name} to this app" if @add_segment_options.dry_run? @out.puts "Dry Run" Brut::CLI::Apps::New::Ops::BaseOp.dry_run = true end templates_dir = Pathname( Gem::Specification.find_by_name("brut").gem_dir ) / "templates" @segment = if @add_segment_options.segment_name == "sidekiq" Brut::CLI::Apps::New::Segments::Sidekiq.new( project_root: .project_root, templates_dir: ) elsif @add_segment_options.segment_name == "heroku" Brut::CLI::Apps::New::Segments::Heroku.new( project_root: .project_root, templates_dir: ) end end |
Instance Method Details
#add! ⇒ Object
34 35 36 |
# File 'lib/brut/cli/apps/new/add_segment.rb', line 34 def add! @segment.add! end |