wrapp 0.2.1 → 0.2.2

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/README.md CHANGED
@@ -53,6 +53,7 @@ the given App. (the filename automatically includes the name and version).
53
53
 
54
54
  Thats it.
55
55
 
56
+ (NOTE: On authorization errors try prefixing the command with `sudo`!)
56
57
 
57
58
  ## Contributing
58
59
 
@@ -70,3 +70,8 @@ Then(/^the App should be wrapped including the parent directory$/) do
70
70
  attached_app_path = File.join(volumes_dir, @app.prefix)
71
71
  check_directory_presence([attached_app_path], true)
72
72
  end
73
+
74
+ Then(/^I should see usage instructions$/) do
75
+ expected = "Usage: wrapp [options] APP_PATH"
76
+ assert_partial_output(expected, all_output)
77
+ end
@@ -13,3 +13,7 @@ Feature: Wrap App
13
13
  Given an App in a directory
14
14
  When I wrap the App including the parent directory
15
15
  Then the App should be wrapped including the parent directory
16
+
17
+ Scenario: Display usage
18
+ When I run `wrapp`
19
+ Then I should see usage instructions
data/lib/wrapp/cli.rb CHANGED
@@ -18,7 +18,13 @@ module Wrapp
18
18
 
19
19
  def run(argv)
20
20
  app_path = parse_options(argv).first
21
- wrapp(app_path, config)
21
+ if app_path
22
+ wrapp(app_path, config)
23
+ else
24
+ warn 'ERROR: App path is missing!'
25
+ puts opt_parser
26
+ exit 2
27
+ end
22
28
  end
23
29
 
24
30
  def wrapp(*opts)
data/lib/wrapp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Wrapp
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
@@ -5,12 +5,42 @@ module Wrapp
5
5
  let(:cli) { CLI.new }
6
6
  let(:app_path) { '/Applications/Chunky Bacon.app' }
7
7
 
8
+ it 'include usage instructions in the banner' do
9
+ expect(CLI.banner).to match(/^usage: \w+ \[options\] \w+$/i)
10
+ end
11
+
8
12
  describe '.run' do
9
13
  it 'runs an instance with ARGV' do
10
14
  cli.should_receive(:run).with(ARGV)
11
15
  CLI.stub(:new).and_return(cli)
12
16
  CLI.run
13
17
  end
18
+
19
+ context 'without arguments' do
20
+ let(:argv) { [] }
21
+
22
+ before do
23
+ cli.stub(:warn)
24
+ cli.stub(:puts)
25
+ cli.stub(:exit)
26
+ end
27
+
28
+ it 'exits non-zero' do
29
+ cli.should_receive(:exit).with(2)
30
+ cli.run(argv)
31
+ end
32
+
33
+ it 'displays usage on stdout' do
34
+ cli.should_receive(:opt_parser).and_return('usage')
35
+ cli.should_receive(:puts).with('usage')
36
+ cli.run(argv)
37
+ end
38
+
39
+ it 'displays what is missing on stderr' do
40
+ cli.should_receive(:warn).with('ERROR: App path is missing!')
41
+ cli.run(argv)
42
+ end
43
+ end
14
44
  end
15
45
 
16
46
  describe '#run' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wrapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -183,7 +183,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
183
183
  version: '0'
184
184
  segments:
185
185
  - 0
186
- hash: -527064214639857781
186
+ hash: 490571108544621046
187
187
  required_rubygems_version: !ruby/object:Gem::Requirement
188
188
  none: false
189
189
  requirements:
@@ -192,13 +192,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
192
192
  version: '0'
193
193
  segments:
194
194
  - 0
195
- hash: -527064214639857781
195
+ hash: 490571108544621046
196
196
  requirements: []
197
197
  rubyforge_project:
198
198
  rubygems_version: 1.8.23
199
199
  signing_key:
200
200
  specification_version: 3
201
- summary: wrapp-0.2.1
201
+ summary: wrapp-0.2.2
202
202
  test_files:
203
203
  - features/step_definitions/wrapp_steps.rb
204
204
  - features/support/app.rb