lib/appsignal/cli.rb in appsignal-0.8.6.beta.1 vs lib/appsignal/cli.rb in appsignal-0.8.6
- old
+ new
@@ -6,14 +6,15 @@
module Appsignal
class CLI
AVAILABLE_COMMANDS = %w(notify_of_deploy).freeze
class << self
- attr_accessor :options, :config
+ attr_accessor :options, :config, :initial_config
def run(argv=ARGV)
@options = {}
+ @initial_config = {}
global = global_option_parser
commands = command_option_parser
global.order!(argv)
command = argv.shift
if command
@@ -41,11 +42,11 @@
def config
@config ||= Appsignal::Config.new(
ENV['PWD'],
options[:environment],
- {},
+ @initial_config,
logger
)
end
def global_option_parser
@@ -74,33 +75,32 @@
o.on '--revision=<revision>', "The revision you're deploying" do |arg|
options[:revision] = arg
end
- o.on '--repository=<repository>', "The location of the main code repository" do |arg|
- options[:repository] = arg
- end
-
o.on '--user=<user>', "The name of the user that's deploying" do |arg|
options[:user] = arg
end
o.on '--environment=<rails_env>', "The environment you're deploying to" do |arg|
options[:environment] = arg
end
+
+ o.on '--name=<name>', "The name of the app (optional)" do |arg|
+ initial_config[:name] = arg
+ end
end
}
end
def notify_of_deploy
- validate_config_loaded
+ validate_active_config
validate_required_options([:revision, :user, :environment])
Appsignal::Marker.new(
{
:revision => options[:revision],
- :repository => options[:repository],
:user => options[:user]
},
config,
logger
).transmit
@@ -116,11 +116,11 @@
puts "Missing options: #{missing.join(', ')}"
exit(1)
end
end
- def validate_config_loaded
- unless config.loaded?
+ def validate_active_config
+ unless config.active?
puts 'Exiting: No config file or push api key env var found'
exit(1)
end
end
end