lib/fig/command.rb in fig-0.1.69 vs lib/fig/command.rb in fig-0.1.71
- old
+ new
@@ -58,13 +58,15 @@
@descriptor = @options.descriptor
check_descriptor_requirement()
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()
+ invoke_post_set_up_actions()
context = ExecutionContext.new(
@base_package,
base_config(),
@environment,
@@ -99,17 +101,25 @@
end
return Fig::Command::Action::EXIT_FAILURE
end
+ # Extension mechanism for customizing Fig.
+ def add_post_set_up_action(action)
+ @post_set_up_actions << action
+
+ return
+ end
+
def add_publish_listener(listener)
@publish_listeners << listener
return
end
def initialize()
+ @post_set_up_actions = []
@publish_listeners = []
end
private
@@ -121,21 +131,10 @@
:repository,
:operating_system,
:package_source_description
)
- def derive_remote_url()
- if remote_operation_necessary?()
- if ENV['FIG_REMOTE_URL'].nil?
- raise Fig::UserInputError.new('Please define the FIG_REMOTE_URL environment variable.')
- end
- return ENV['FIG_REMOTE_URL']
- end
-
- return nil
- end
-
def check_include_statements_versions?()
return false if @options.suppress_warning_include_statement_missing_version?
suppressed_warnings = @application_configuration['suppress warnings']
return true if not suppressed_warnings
@@ -174,16 +173,25 @@
end
def set_up_application_configuration()
@application_configuration = Fig::FigRC.find(
@options.figrc(),
- derive_remote_url(),
+ ENV['FIG_REMOTE_URL'],
@options.login?,
@options.home(),
@options.no_figrc?
)
+ if \
+ remote_operation_necessary? \
+ && @application_configuration.remote_repository_url.nil?
+
+ raise Fig::UserInputError.new(
+ 'Please define the FIG_REMOTE_URL environment variable.'
+ )
+ end
+
return
end
def prepare_repository()
@repository = Fig::Repository.new(
@@ -258,10 +266,20 @@
end
return
end
+ def invoke_post_set_up_actions()
+ @post_set_up_actions.each do
+ |action|
+
+ action.set_up_finished(@application_configuration)
+ end
+
+ return
+ end
+
def base_config()
return @options.config() ||
@descriptor && @descriptor.config ||
Fig::Package::DEFAULT_CONFIG
end
@@ -323,9 +341,27 @@
Fig::Logging.warn(
%Q<Ignored descriptor "#{@descriptor.to_string}".>
)
end
end
+ end
+
+ 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