Skip to content

Commit

Permalink
Warn about --archive/--resource when not publishing.
Browse files Browse the repository at this point in the history
  • Loading branch information
clonezone committed Jun 14, 2012
1 parent 43b7a0d commit 9bf09a1
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
v0.1.xxx

Bug fixes:

- Warns on ignored --archive/--resource statements.

v0.1.68.beta.2

Backwards incompatibilities:
Expand Down
19 changes: 19 additions & 0 deletions lib/fig/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def run_fig(argv, options = nil)
if actions.any? {|action| not action.allow_both_descriptor_and_file? }
ensure_descriptor_and_file_were_not_both_specified()
end
check_package_content_options()

configure()
set_up_base_package()
Expand Down Expand Up @@ -349,6 +350,24 @@ def check_descriptor_requirement()
return
end

def check_package_content_options()
statements = @options.package_contents_statements
return if statements.empty?

return if @options.actions.any? \
{|action| action.cares_about_package_content_options?}

statements.each do
|statement|

Fig::Logging.warn(
"Ignored #{statement.source_description} for #{statement.url}."
)
end

return
end

def remote_operation_necessary?()
return @options.actions.any? {|action| action.remote_operation_necessary?}
end
Expand Down
4 changes: 4 additions & 0 deletions lib/fig/command/action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ def allow_both_descriptor_and_file?()
return false
end

def cares_about_package_content_options?()
return false
end

def load_base_package?()
raise NotImplementedError
end
Expand Down
4 changes: 4 additions & 0 deletions lib/fig/command/action/role/publish.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ def allow_both_descriptor_and_file?()
return true
end

def cares_about_package_content_options?()
return true
end

def load_base_package?()
return true
end
Expand Down
10 changes: 10 additions & 0 deletions spec/command/usage_errors_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,16 @@
out.should == ''
end

%w< --archive --resource >.each do
|option|

it %Q<warns about #{option} when not publishing> do
out, err = fig("--get some_variable #{option} some-asset")
err.should =~ /#{option}/
err.should =~ /\bsome-asset\b/
end
end

it %q<prints error when FIG_REMOTE_URL is not defined> do
begin
ENV.delete('FIG_REMOTE_URL')
Expand Down

0 comments on commit 9bf09a1

Please sign in to comment.