boxen 2.9.0 → 3.0.0.beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/boxen.gemspec +12 -12
- data/lib/boxen/check.rb +8 -39
- data/lib/boxen/cli.rb +19 -45
- data/lib/boxen/command.rb +142 -0
- data/lib/boxen/command/help.rb +40 -0
- data/lib/boxen/command/preflight.rb +38 -0
- data/lib/boxen/command/project.rb +49 -0
- data/lib/boxen/command/project/install.rb +33 -0
- data/lib/boxen/command/run.rb +199 -0
- data/lib/boxen/command/service.rb +61 -0
- data/lib/boxen/command/service/disable.rb +15 -0
- data/lib/boxen/command/service/enable.rb +15 -0
- data/lib/boxen/command/service/restart.rb +24 -0
- data/lib/boxen/command/version.rb +29 -0
- data/lib/boxen/command_status.rb +15 -0
- data/lib/boxen/config.rb +43 -61
- data/lib/boxen/hook.rb +15 -8
- data/lib/boxen/keychain.rb +1 -1
- data/lib/boxen/postflight/env.rb +1 -1
- data/lib/boxen/postflight/github_issue.rb +124 -0
- data/lib/boxen/postflight/hooks.rb +16 -0
- data/lib/boxen/postflight/web_hook.rb +63 -0
- data/lib/boxen/preflight.rb +4 -7
- data/lib/boxen/preflight/creds.rb +8 -47
- data/lib/boxen/preflight/facts.rb +36 -0
- data/lib/boxen/preflight/homebrew.rb +13 -0
- data/lib/boxen/preflight/identity.rb +2 -0
- data/lib/boxen/preflight/offline.rb +33 -0
- data/lib/boxen/preflight/os.rb +1 -1
- data/lib/boxen/preflight/update.rb +109 -0
- data/lib/boxen/util/logging.rb +59 -0
- data/lib/boxen/version.rb +3 -0
- data/script/bootstrap +1 -1
- data/script/tests +1 -0
- data/test/boxen/test.rb +1 -1
- data/test/boxen_cli_test.rb +8 -31
- data/test/boxen_command_test.rb +93 -0
- data/test/boxen_config_test.rb +1 -31
- data/test/boxen_directories_test.rb +4 -4
- data/test/boxen_hook_test.rb +25 -0
- data/test/command/help_test.rb +49 -0
- data/test/command/project/install_test.rb +34 -0
- data/test/command/project_test.rb +32 -0
- data/test/command/run_test.rb +21 -0
- data/test/command/service/disable_test.rb +49 -0
- data/test/command/service/enable_test.rb +49 -0
- data/test/command/service/restart_test.rb +53 -0
- data/test/command/service_test.rb +55 -0
- data/test/command/version_test.rb +15 -0
- data/test/{boxen_postflight_active_test.rb → postflight/boxen_postflight_active_test.rb} +3 -3
- data/test/{boxen_postflight_env_test.rb → postflight/boxen_postflight_env_test.rb} +0 -0
- data/test/{boxen_hook_github_issue_test.rb → postflight/boxen_postflight_github_issue_test.rb} +72 -82
- data/test/{boxen_hook_web_test.rb → postflight/boxen_postflight_web_hook_test.rb} +12 -11
- data/test/preflight/boxen_preflight_creds_test.rb +82 -0
- data/test/{boxen_preflight_etc_my_cnf_test.rb → preflight/boxen_preflight_etc_my_cnf_test.rb} +1 -1
- data/test/preflight/boxen_preflight_homebrew_test.rb +10 -0
- data/test/{boxen_preflight_rvm_test.rb → preflight/boxen_preflight_rvm_test.rb} +1 -1
- metadata +247 -171
- checksums.yaml +0 -7
- data/lib/boxen/flags.rb +0 -282
- data/lib/boxen/hook/github_issue.rb +0 -120
- data/lib/boxen/hook/web.rb +0 -56
- data/lib/boxen/puppeteer.rb +0 -121
- data/lib/boxen/runner.rb +0 -149
- data/test/boxen_check_test.rb +0 -55
- data/test/boxen_flags_test.rb +0 -217
- data/test/boxen_preflight_creds_test.rb +0 -177
- data/test/boxen_puppeteer_test.rb +0 -101
- data/test/boxen_runner_test.rb +0 -171
data/lib/boxen/puppeteer.rb
DELETED
@@ -1,121 +0,0 @@
|
|
1
|
-
require "fileutils"
|
2
|
-
require "boxen/util"
|
3
|
-
|
4
|
-
module Boxen
|
5
|
-
|
6
|
-
# Manages an invocation of puppet.
|
7
|
-
|
8
|
-
class Puppeteer
|
9
|
-
|
10
|
-
class Status < Struct.new(:code)
|
11
|
-
# Puppet's detailed exit codes reserves 2 for a successful run with changes
|
12
|
-
def success?
|
13
|
-
[0,2].include?(code)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
attr_reader :config
|
18
|
-
|
19
|
-
def initialize(config)
|
20
|
-
@config = config
|
21
|
-
end
|
22
|
-
|
23
|
-
def command
|
24
|
-
manifestdir = "#{config.repodir}/manifests"
|
25
|
-
puppet = "#{config.repodir}/bin/puppet"
|
26
|
-
|
27
|
-
[puppet, "apply", flags, manifestdir].flatten
|
28
|
-
end
|
29
|
-
|
30
|
-
def hiera_config
|
31
|
-
if File.exist? "#{config.repodir}/config/hiera.yaml"
|
32
|
-
"#{config.repodir}/config/hiera.yaml"
|
33
|
-
else
|
34
|
-
"/dev/null"
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def flags
|
39
|
-
flags = []
|
40
|
-
root = File.expand_path "../../..", __FILE__
|
41
|
-
|
42
|
-
flags << ["--group", "admin"]
|
43
|
-
flags << ["--confdir", "#{config.puppetdir}/conf"]
|
44
|
-
flags << ["--vardir", "#{config.puppetdir}/var"]
|
45
|
-
flags << ["--libdir", "#{config.repodir}/lib"]#:#{root}/lib"]
|
46
|
-
flags << ["--libdir", "#{root}/lib"]
|
47
|
-
flags << ["--modulepath", "#{config.repodir}/modules:#{config.repodir}/shared"]
|
48
|
-
|
49
|
-
# Don't ever complain about Hiera to me
|
50
|
-
flags << ["--hiera_config", hiera_config]
|
51
|
-
|
52
|
-
# Log to both the console and a file.
|
53
|
-
|
54
|
-
flags << ["--logdest", config.logfile]
|
55
|
-
flags << ["--logdest", "console"]
|
56
|
-
|
57
|
-
# For some reason Puppet tries to set up a bunch of rrd stuff
|
58
|
-
# (user, group) unless reports are completely disabled.
|
59
|
-
|
60
|
-
flags << "--no-report" unless config.report?
|
61
|
-
flags << "--detailed-exitcodes"
|
62
|
-
|
63
|
-
flags << "--graph" if config.graph?
|
64
|
-
|
65
|
-
flags << "--show_diff"
|
66
|
-
|
67
|
-
if config.profile?
|
68
|
-
flags << "--evaltrace"
|
69
|
-
flags << "--summarize"
|
70
|
-
end
|
71
|
-
|
72
|
-
if config.future_parser?
|
73
|
-
flags << "--parser=future"
|
74
|
-
end
|
75
|
-
|
76
|
-
flags << "--debug" if config.debug?
|
77
|
-
flags << "--noop" if config.pretend?
|
78
|
-
|
79
|
-
flags << "--color=false" unless config.color?
|
80
|
-
|
81
|
-
flags.flatten
|
82
|
-
end
|
83
|
-
|
84
|
-
def run
|
85
|
-
FileUtils.mkdir_p config.puppetdir
|
86
|
-
|
87
|
-
FileUtils.rm_f config.logfile
|
88
|
-
|
89
|
-
FileUtils.rm_rf "#{config.puppetdir}/var/reports" if config.report?
|
90
|
-
|
91
|
-
FileUtils.rm_rf "#{config.puppetdir}/var/state/graphs" if config.graph?
|
92
|
-
|
93
|
-
FileUtils.mkdir_p File.dirname config.logfile
|
94
|
-
FileUtils.touch config.logfile
|
95
|
-
|
96
|
-
if File.file? "Puppetfile"
|
97
|
-
librarian = "#{config.repodir}/bin/librarian-puppet"
|
98
|
-
|
99
|
-
unless config.enterprise?
|
100
|
-
# Set an environment variable for librarian-puppet's
|
101
|
-
# github_tarball source strategy.
|
102
|
-
ENV["GITHUB_API_TOKEN"] = config.token
|
103
|
-
end
|
104
|
-
|
105
|
-
librarian_command = [librarian, "install", "--path=#{config.repodir}/shared"]
|
106
|
-
librarian_command << "--verbose" if config.debug?
|
107
|
-
|
108
|
-
warn librarian_command.join(" ") if config.debug?
|
109
|
-
unless system *librarian_command
|
110
|
-
abort "Can't run Puppet, fetching dependencies with librarian failed."
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
warn command.join(" ") if config.debug?
|
115
|
-
|
116
|
-
Boxen::Util.sudo *command
|
117
|
-
|
118
|
-
Status.new($?.exitstatus)
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
data/lib/boxen/runner.rb
DELETED
@@ -1,149 +0,0 @@
|
|
1
|
-
require "boxen/checkout"
|
2
|
-
require "boxen/config"
|
3
|
-
require "boxen/hook"
|
4
|
-
require "boxen/flags"
|
5
|
-
require "boxen/puppeteer"
|
6
|
-
require "boxen/service"
|
7
|
-
require "boxen/util"
|
8
|
-
require "facter"
|
9
|
-
|
10
|
-
module Boxen
|
11
|
-
class Runner
|
12
|
-
attr_reader :config
|
13
|
-
attr_reader :flags
|
14
|
-
attr_reader :puppet
|
15
|
-
attr_reader :checkout
|
16
|
-
attr_reader :hooks
|
17
|
-
|
18
|
-
def initialize(config, flags)
|
19
|
-
@config = config
|
20
|
-
@flags = flags
|
21
|
-
@puppet = Boxen::Puppeteer.new(@config)
|
22
|
-
@checkout = Boxen::Checkout.new(@config)
|
23
|
-
@hooks = Boxen::Hook.all
|
24
|
-
end
|
25
|
-
|
26
|
-
def process
|
27
|
-
# --env prints out the current BOXEN_ env vars.
|
28
|
-
|
29
|
-
exec "env | grep ^BOXEN_ | sort" if flags.env?
|
30
|
-
|
31
|
-
process_flags
|
32
|
-
|
33
|
-
process_args
|
34
|
-
|
35
|
-
# Actually run Puppet and return its result
|
36
|
-
|
37
|
-
puppet.run
|
38
|
-
end
|
39
|
-
|
40
|
-
def run
|
41
|
-
report(process)
|
42
|
-
end
|
43
|
-
|
44
|
-
def report(result)
|
45
|
-
hooks.each { |hook| hook.new(config, checkout, puppet, result).run }
|
46
|
-
|
47
|
-
result
|
48
|
-
end
|
49
|
-
|
50
|
-
def process_flags
|
51
|
-
|
52
|
-
# --projects prints a list of available projects and exits.
|
53
|
-
|
54
|
-
if flags.projects?
|
55
|
-
puts "You can install any of these projects with `#{$0} <project-name>`:\n"
|
56
|
-
|
57
|
-
config.projects.each do |project|
|
58
|
-
puts " #{project.name}"
|
59
|
-
end
|
60
|
-
|
61
|
-
exit
|
62
|
-
end
|
63
|
-
|
64
|
-
# --disable-services stops all services
|
65
|
-
|
66
|
-
if flags.disable_services?
|
67
|
-
Boxen::Service.list.each do |service|
|
68
|
-
puts "Disabling #{service}..."
|
69
|
-
service.disable
|
70
|
-
end
|
71
|
-
|
72
|
-
exit
|
73
|
-
end
|
74
|
-
|
75
|
-
# --enable-services starts all services
|
76
|
-
|
77
|
-
if flags.enable_services?
|
78
|
-
Boxen::Service.list.each do |service|
|
79
|
-
puts "Enabling #{service}..."
|
80
|
-
service.enable
|
81
|
-
end
|
82
|
-
|
83
|
-
exit
|
84
|
-
end
|
85
|
-
|
86
|
-
# --disable-service [name] stops a service
|
87
|
-
|
88
|
-
if flags.disable_service?
|
89
|
-
service = Boxen::Service.new(flags.disable_service)
|
90
|
-
puts "Disabling #{service}..."
|
91
|
-
service.disable
|
92
|
-
|
93
|
-
exit
|
94
|
-
end
|
95
|
-
|
96
|
-
# --enable-service [name] starts a service
|
97
|
-
|
98
|
-
if flags.enable_service?
|
99
|
-
service = Boxen::Service.new(flags.enable_service)
|
100
|
-
puts "Enabling #{service}..."
|
101
|
-
service.enable
|
102
|
-
|
103
|
-
exit
|
104
|
-
end
|
105
|
-
|
106
|
-
# --restart-service [name] starts a service
|
107
|
-
|
108
|
-
if flags.restart_service?
|
109
|
-
service = Boxen::Service.new(flags.restart_service)
|
110
|
-
puts "Restarting #{service}..."
|
111
|
-
service.disable
|
112
|
-
service.enable
|
113
|
-
|
114
|
-
exit
|
115
|
-
end
|
116
|
-
|
117
|
-
# --list-services lists all services
|
118
|
-
|
119
|
-
if flags.list_services?
|
120
|
-
Boxen::Service.list.each do |service|
|
121
|
-
puts service
|
122
|
-
end
|
123
|
-
|
124
|
-
exit
|
125
|
-
end
|
126
|
-
|
127
|
-
# --restart-services restarts all services
|
128
|
-
|
129
|
-
if flags.restart_services?
|
130
|
-
Boxen::Service.list_enabled.each do |service|
|
131
|
-
puts "Restarting #{service}..."
|
132
|
-
service.disable
|
133
|
-
service.enable
|
134
|
-
end
|
135
|
-
|
136
|
-
exit
|
137
|
-
end
|
138
|
-
|
139
|
-
end
|
140
|
-
|
141
|
-
def process_args
|
142
|
-
projects = flags.args.join(',')
|
143
|
-
File.open("#{config.repodir}/.projects", "w+") do |f|
|
144
|
-
f.truncate 0
|
145
|
-
f.write projects
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
149
|
-
end
|
data/test/boxen_check_test.rb
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
require "boxen/test"
|
2
|
-
require "boxen/check"
|
3
|
-
|
4
|
-
class BoxenCheckTest < Boxen::Test
|
5
|
-
def test_initialize
|
6
|
-
check = Boxen::Check.new :config
|
7
|
-
assert_equal :config, check.config
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_ok?
|
11
|
-
ex = assert_raises RuntimeError do
|
12
|
-
Boxen::Check.new(:config).ok?
|
13
|
-
end
|
14
|
-
|
15
|
-
assert_match "must implement", ex.message
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_run
|
19
|
-
ex = assert_raises RuntimeError do
|
20
|
-
Boxen::Check.new(:config).run
|
21
|
-
end
|
22
|
-
|
23
|
-
assert_match "must implement", ex.message
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_self_checks
|
27
|
-
subclass = Class.new Boxen::Check
|
28
|
-
Boxen::Check.const_set :TestCheck, subclass
|
29
|
-
|
30
|
-
assert Boxen::Check.checks(:config).any? { |c| subclass === c },
|
31
|
-
"an instance of TestCheck exists in checks"
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_self_checks_subclasses
|
35
|
-
klass = Struct.new :config
|
36
|
-
Boxen::Check.const_set :TestBadCheck, klass
|
37
|
-
|
38
|
-
refute Boxen::Check.checks(:config).any? { |c| klass === c },
|
39
|
-
"checks are subclasses of Boxen::Check"
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_self_run
|
43
|
-
willrun = mock do
|
44
|
-
expects(:ok?).returns false
|
45
|
-
expects(:run)
|
46
|
-
end
|
47
|
-
|
48
|
-
wontrun = mock do
|
49
|
-
expects(:ok?).returns true
|
50
|
-
end
|
51
|
-
|
52
|
-
Boxen::Check.expects(:checks).with(:config).returns [willrun, wontrun]
|
53
|
-
Boxen::Check.run :config
|
54
|
-
end
|
55
|
-
end
|
data/test/boxen_flags_test.rb
DELETED
@@ -1,217 +0,0 @@
|
|
1
|
-
require "boxen/test"
|
2
|
-
require "boxen/flags"
|
3
|
-
|
4
|
-
class BoxenFlagsTest < Boxen::Test
|
5
|
-
def test_apply
|
6
|
-
config = mock do
|
7
|
-
expects(:debug=).with true
|
8
|
-
|
9
|
-
stubs(:fde?).returns true
|
10
|
-
expects(:fde=).with false
|
11
|
-
|
12
|
-
expects(:homedir=).with "homedir"
|
13
|
-
expects(:logfile=).with "logfile"
|
14
|
-
expects(:login=).with "login"
|
15
|
-
expects(:token=).with "token"
|
16
|
-
expects(:pretend=).with true
|
17
|
-
expects(:profile=).with true
|
18
|
-
expects(:future_parser=).with true
|
19
|
-
expects(:report=).with true
|
20
|
-
expects(:graph=).with true
|
21
|
-
expects(:srcdir=).with "srcdir"
|
22
|
-
expects(:stealth=).with true
|
23
|
-
expects(:user=).with "user"
|
24
|
-
expects(:color=).with true
|
25
|
-
end
|
26
|
-
|
27
|
-
# Do our best to frob every switch.
|
28
|
-
|
29
|
-
flags = Boxen::Flags.new "--debug", "--help", "--login", "login",
|
30
|
-
"--no-fde", "--no-pull", "--no-issue", "--noop",
|
31
|
-
"--pretend", "--profile", "--future-parser", "--report", "--graph", "--projects",
|
32
|
-
"--user", "user", "--homedir", "homedir", "--srcdir", "srcdir",
|
33
|
-
"--logfile", "logfile", "--token", "token"
|
34
|
-
|
35
|
-
assert_same config, flags.apply(config)
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_args
|
39
|
-
config = flags "--debug", "foo"
|
40
|
-
assert_equal %w(foo), config.args
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_debug
|
44
|
-
refute flags.debug?
|
45
|
-
assert flags("--debug").debug?
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_env?
|
49
|
-
refute flags.env?
|
50
|
-
assert flags("--env").env?
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_help
|
54
|
-
refute flags.help?
|
55
|
-
|
56
|
-
%w(--help -h -?).each do |flag|
|
57
|
-
assert flags(flag).help?
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_disable_services?
|
62
|
-
refute flags.disable_services?
|
63
|
-
assert flags("--disable-services").disable_services?
|
64
|
-
end
|
65
|
-
|
66
|
-
def test_enable_services?
|
67
|
-
refute flags.enable_services?
|
68
|
-
assert flags("--enable-services").enable_services?
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_list_services?
|
72
|
-
refute flags.list_services?
|
73
|
-
assert flags("--list-services").list_services?
|
74
|
-
end
|
75
|
-
|
76
|
-
def test_homedir
|
77
|
-
assert_nil flags.homedir
|
78
|
-
assert_equal "foo", flags("--homedir", "foo").homedir
|
79
|
-
end
|
80
|
-
|
81
|
-
def test_initialize_bad_option
|
82
|
-
ex = assert_raises Boxen::Error do
|
83
|
-
flags "--bad-option"
|
84
|
-
end
|
85
|
-
|
86
|
-
assert_match "invalid option", ex.message
|
87
|
-
assert_match "--bad-option", ex.message
|
88
|
-
end
|
89
|
-
|
90
|
-
def test_initialize_dups
|
91
|
-
args = %w(foo)
|
92
|
-
config = flags args
|
93
|
-
|
94
|
-
assert_equal args, config.args
|
95
|
-
refute_same args, config.args
|
96
|
-
end
|
97
|
-
|
98
|
-
def test_initialize_empty
|
99
|
-
config = flags
|
100
|
-
assert_equal [], config.args
|
101
|
-
end
|
102
|
-
|
103
|
-
def test_initialize_flattens
|
104
|
-
config = flags "foo", ["bar"]
|
105
|
-
assert_equal %w(foo bar), config.args
|
106
|
-
end
|
107
|
-
|
108
|
-
def test_initialize_nils
|
109
|
-
config = flags "foo", nil, "bar"
|
110
|
-
assert_equal %w(foo bar), config.args
|
111
|
-
end
|
112
|
-
|
113
|
-
def test_initialize_strings
|
114
|
-
config = flags :foo, [:bar]
|
115
|
-
assert_equal %w(foo bar), config.args
|
116
|
-
end
|
117
|
-
|
118
|
-
def test_logfile
|
119
|
-
assert_nil flags.logfile
|
120
|
-
assert_equal "foo", flags("--logfile", "foo").logfile
|
121
|
-
end
|
122
|
-
|
123
|
-
def test_login
|
124
|
-
assert_nil flags.login
|
125
|
-
assert_equal "jbarnette", flags("--login", "jbarnette").login
|
126
|
-
end
|
127
|
-
|
128
|
-
def test_no_fde
|
129
|
-
assert flags.fde?
|
130
|
-
refute flags("--no-fde").fde?
|
131
|
-
end
|
132
|
-
|
133
|
-
def test_no_pull_is_a_noop
|
134
|
-
flags "--no-pull"
|
135
|
-
end
|
136
|
-
|
137
|
-
def test_parse
|
138
|
-
config = flags
|
139
|
-
config.parse "--debug", "foo"
|
140
|
-
|
141
|
-
assert config.debug?
|
142
|
-
assert_equal %w(foo), config.args
|
143
|
-
end
|
144
|
-
|
145
|
-
def test_token
|
146
|
-
assert_nil flags.token
|
147
|
-
assert_equal "foo", flags("--token", "foo").token
|
148
|
-
end
|
149
|
-
|
150
|
-
def test_token_missing_value
|
151
|
-
ex = assert_raises Boxen::Error do
|
152
|
-
flags "--token"
|
153
|
-
end
|
154
|
-
|
155
|
-
assert_match "missing argument", ex.message
|
156
|
-
end
|
157
|
-
|
158
|
-
def test_pretend
|
159
|
-
refute flags.pretend?
|
160
|
-
assert flags("--noop").pretend?
|
161
|
-
assert flags("--pretend").pretend?
|
162
|
-
end
|
163
|
-
|
164
|
-
def test_profile
|
165
|
-
refute flags.profile?
|
166
|
-
assert flags("--profile").profile?
|
167
|
-
end
|
168
|
-
|
169
|
-
def test_future_parser
|
170
|
-
refute flags.future_parser?
|
171
|
-
assert flags("--future-parser").future_parser?
|
172
|
-
end
|
173
|
-
|
174
|
-
def test_report
|
175
|
-
refute flags.report?
|
176
|
-
assert flags("--report").report?
|
177
|
-
end
|
178
|
-
|
179
|
-
def test_graph
|
180
|
-
refute flags.graph?
|
181
|
-
assert flags("--graph").graph?
|
182
|
-
end
|
183
|
-
|
184
|
-
def test_projects
|
185
|
-
refute flags.projects?
|
186
|
-
assert flags("--projects").projects?
|
187
|
-
end
|
188
|
-
|
189
|
-
def test_srcdir
|
190
|
-
assert_nil flags.srcdir
|
191
|
-
assert_equal "foo", flags("--srcdir", "foo").srcdir
|
192
|
-
end
|
193
|
-
|
194
|
-
def test_stealth
|
195
|
-
refute flags.stealth?
|
196
|
-
assert flags("--no-issue").stealth?
|
197
|
-
assert flags("--stealth").stealth?
|
198
|
-
end
|
199
|
-
|
200
|
-
def test_user
|
201
|
-
assert_equal "jbarnette", flags("--user", "jbarnette").user
|
202
|
-
end
|
203
|
-
|
204
|
-
def test_user_missing_value
|
205
|
-
ex = assert_raises Boxen::Error do
|
206
|
-
flags "--user"
|
207
|
-
end
|
208
|
-
|
209
|
-
assert_match "missing argument", ex.message
|
210
|
-
end
|
211
|
-
|
212
|
-
# Create an instance of Boxen::Flags with optional `args`.
|
213
|
-
|
214
|
-
def flags(*args)
|
215
|
-
Boxen::Flags.new *args
|
216
|
-
end
|
217
|
-
end
|