wrapp 0.3.0 → 0.4.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40c93543e0cd77a1baa9df614d75db5ea48377cf
4
- data.tar.gz: d23d98c547556f4eb3b3c5c6a5745f6fe6a96109
3
+ metadata.gz: caa2b48e6568ce9e7fe82e2dadb45ab812d9e841
4
+ data.tar.gz: 8ec780d1e205d15cbba9e058a597e40a29b0e830
5
5
  SHA512:
6
- metadata.gz: cda2fcf14485ab0aef3587f9b546f405e2d100fa28fdfc3b22453753ce980e4a5d96bdf59ad5095e3a3940d647b19ab6eb242c81a57eef9c5587b0c8c7966879
7
- data.tar.gz: 3e6c45c4b97368ca26ab1dfc074f6c515ec3afd3eee394bef687a1ce4bcb80e24e00e7d88df239ee53b25ed40d2957b4ed1691f5522e9bccb2232fd2bd7cc714
6
+ metadata.gz: 2988f61ddf590819b523e552130d9acb2b16bf33835581cae379ab9e65b332c2b694d031e78c0cab1629464c7f7ab43508704a898d8d42927267070f0bea0486
7
+ data.tar.gz: b5e890e913b625d6e2739c8f63ea4c68dcbfffb66185ee2c84353549bc99311aad78c4f899a6d030e2360475893866bac81be8be1e23ca4b055c8bb23a900236
@@ -20,15 +20,9 @@ module Wrapp
20
20
  end
21
21
 
22
22
  def get_property(property)
23
- raise "No property found: #{property}" unless
24
- properties.has_key?(property)
25
- properties[property].strip
26
- end
27
-
28
- private
29
-
30
- def properties
31
- Plist4r.open plist
23
+ command_line = Cocaine::CommandLine.new('/usr/libexec/PlistBuddy',
24
+ '-c :cmd :plist')
25
+ command_line.run(:cmd => "Print #{property}", :plist => plist).strip
32
26
  end
33
27
  end
34
28
  end
data/lib/wrapp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Wrapp
2
- VERSION = '0.3.0'
2
+ VERSION = '0.4.0'
3
3
  end
data/lib/wrapp.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'mixlib/cli'
2
- require 'plist4r'
2
+ require 'cocaine'
3
3
  require 'wrapp/version'
4
4
  require 'wrapp/app_info'
5
5
  require 'wrapp/dmg_builder'
@@ -4,6 +4,10 @@ module Wrapp
4
4
  describe AppInfo do
5
5
  let(:app) { AppInfo.new('Info.plist') }
6
6
 
7
+ before do
8
+ AppInfo.any_instance.stub(:`)
9
+ end
10
+
7
11
  describe '#full_name' do
8
12
  it 'includes the downcased name and version without spaces' do
9
13
  app.stub(:name).and_return("Chunky\t Bacon")
@@ -30,29 +34,30 @@ module Wrapp
30
34
  end
31
35
  end
32
36
 
33
- describe '#properties' do
34
- it 'returns the app properties as hash' do
35
- Plist4r.should_receive(:open).with('Info.plist').
36
- and_return(:plist_as_hash)
37
- expect(app.send(:properties)).to eq(:plist_as_hash)
37
+ describe '#get_property' do
38
+ let(:command_line) { double('command_line', :run => '') }
39
+
40
+ before do
41
+ Cocaine::CommandLine.stub(:new).and_return(command_line)
38
42
  end
39
- end
40
43
 
41
- describe '#get_property' do
42
- context 'with existing property' do
43
- it 'returns the striped property' do
44
- app.stub(:properties).and_return({})
45
- expect {
46
- app.get_property('Chunky')
47
- }.to raise_error(/no property found: chunky/i)
48
- end
44
+ it 'builds a new command line object' do
45
+ Cocaine::CommandLine.should_receive(:new).
46
+ with('/usr/libexec/PlistBuddy', '-c :cmd :plist').
47
+ and_return(command_line)
48
+ app.get_property('Foo')
49
+ end
50
+
51
+ it 'runs the command line with the property' do
52
+ command_line.should_receive(:run).
53
+ with(:cmd => 'Print Foo', :plist => 'Info.plist').
54
+ and_return('')
55
+ app.get_property('Foo')
49
56
  end
50
57
 
51
- context 'with missing property' do
52
- it 'raises an error' do
53
- app.stub(:properties).and_return({ 'Chunky' => ' Bacon ' })
54
- expect(app.get_property('Chunky')).to eq('Bacon')
55
- end
58
+ it 'strips the output' do
59
+ command_line.stub(:run).and_return("Chunky\n")
60
+ expect(app.get_property('')).to eq('Chunky')
56
61
  end
57
62
  end
58
63
  end
data/wrapp.gemspec CHANGED
@@ -18,8 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_dependency 'plist4r', '~> 1.2'
22
21
  spec.add_dependency 'mixlib-cli', '~> 1.3'
22
+ spec.add_dependency 'cocaine', '~> 0.5'
23
23
 
24
24
  spec.add_development_dependency 'bundler', '~> 1.3'
25
25
  spec.add_development_dependency 'rake'
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wrapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Björn Albers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-17 00:00:00.000000000 Z
11
+ date: 2014-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: plist4r
14
+ name: mixlib-cli
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: '1.2'
19
+ version: '1.3'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: '1.2'
26
+ version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
- name: mixlib-cli
28
+ name: cocaine
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: '1.3'
33
+ version: '0.5'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: '1.3'
40
+ version: '0.5'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -174,7 +174,7 @@ rubyforge_project:
174
174
  rubygems_version: 2.0.3
175
175
  signing_key:
176
176
  specification_version: 4
177
- summary: wrapp-0.3.0
177
+ summary: wrapp-0.4.0
178
178
  test_files:
179
179
  - features/step_definitions/wrapp_steps.rb
180
180
  - features/support/app.rb