Skip to content

Commit

Permalink
Switch cli options to negative (ie, skip-welds)
Browse files Browse the repository at this point in the history
  • Loading branch information
alextwoods committed Jan 6, 2025
1 parent 0b59e7a commit 09b2790
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions gems/smithy/lib/smithy/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ def self.gem_options!
method_option :gem_namespace, type: :string,
desc: 'The namespace of the gem to generate, e.g. `MyGem::Namespace`.' \
'If not provided, the gem name will be used to infer the namespace.'
method_option :welds, type: :boolean, default: true,
desc: 'Whether or not to apply welds.'
method_option :skip_welds, type: :boolean, default: false,
desc: 'Whether or not to apply welds.'

method_option :polishes, type: :boolean, default: true,
desc: 'Whether or not to apply polishes.'
method_option :skip_polishes, type: :boolean, default: false,
desc: 'Whether or not to apply polishes.'
end

gem_options!
Expand Down
4 changes: 2 additions & 2 deletions gems/smithy/lib/smithy/plan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ def initialize(model, type, options = {})

Welds.load!(self)
Polishes.load!(self)
@welds = options[:welds] ? Welds.for(model) : []
@polishes = options[:polishes] ? Polishes.for(model) : []
@welds = options[:skip_welds] ? [] : Welds.for(model)
@polishes = options[:skip_polishes] ? [] : Polishes.for(model)
end

# @return [Hash] The API model as a JSON hash.
Expand Down
2 changes: 1 addition & 1 deletion gems/smithy/spec/interfaces/polish_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def polish(artifact)
end
end
end
@tmpdir = SpecHelper.generate(['Weather'], :types, { polishes: true })
@tmpdir = SpecHelper.generate(['Weather'], :types, { skip_polishes: false })
end

after(:all) do
Expand Down
2 changes: 1 addition & 1 deletion gems/smithy/spec/smithy/plan_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Smithy
let(:fixture) { File.expand_path('../fixtures/weather/model.json', __dir__) }
let(:model) { JSON.load_file(fixture) }
let(:type) { :client }
let(:options) { { welds: true, polishes: true } }
let(:options) { {} }

subject { described_class.new(model, type, options) }

Expand Down
4 changes: 2 additions & 2 deletions gems/smithy/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ def create_plan(modules, model, type, options)
gem_name: options.fetch(:gem_name, Smithy::Tools::Namespace.gem_name_from_namespaces(modules)),
gem_version: options.fetch(:gem_version, '1.0.0'),
destination_root: options.fetch(:destination_root, Dir.mktmpdir),
polishes: options.fetch(:polishes, false),
welds: options.fetch(:welds, true)
skip_polishes: options.fetch(:skip_polishes, true),
skip_welds: options.fetch(:skip_welds, false)
}
Smithy::Plan.new(model, type, plan_options)
end
Expand Down

0 comments on commit 09b2790

Please sign in to comment.