ruby_osx_app 0.1.0 → 0.1.1

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: 1c2f7c600d3aab60478a94143839955d3f996fa6
4
- data.tar.gz: 9001feb8782dbbd8a28aee6f2df7ffc0833bb0dd
3
+ metadata.gz: fa15746568a61564618d9a73e15b79ea42bedae6
4
+ data.tar.gz: ee16ce25b3f7ef072f4185840ec581b4a03d6a9b
5
5
  SHA512:
6
- metadata.gz: 694edbc6bb393cb61fa732f3383112ed1381b3107068a080031e9c547a60dfabb548c2f63f278e8b57b57d7526b51b452eca6104fc7492dc3398634e97d962be
7
- data.tar.gz: b2c2f95d4db0889f55ceb18b36c0daa0a28a6b52a238d994fc65cb9e6f83a6dcaaf23e31913c91a9eea7256fa95430644e904b14422ce095b57bd5f3642f83f2
6
+ metadata.gz: 35f1aa7aa1da1e71e225796b3793686e1203a61a0d76d7de7ed56f4cd407a4c9bfc7cce0384c092943338579819404196215eaf394ede0b28e957df4153728ae
7
+ data.tar.gz: 5ff8279574b16aeabcf221ce97d080d05e85189d8e36b715df2ae4c2ef28fc3028a0e47b4bf2e8ed6f80479ec60489e27cd54fad4d0d0606ffdaf3dc25208d7f
data/README.md CHANGED
@@ -17,8 +17,9 @@ Get version from app:
17
17
  ```ruby
18
18
  require 'osx_app'
19
19
  osx_app = OsxApp.new('/Applications/1Password.app')
20
- osx_app.version # => 4.0.3
21
- osx_app.version_major # => 4
20
+ osx_app.version # => '4.0.3'
21
+ osx_app.version_major # => '4'
22
+ osx_app.minimum_osx # => '10.8.4'
22
23
  ```
23
24
 
24
25
  You can initialize simpler:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
data/lib/osx_app.rb CHANGED
@@ -19,13 +19,17 @@ class OsxApp
19
19
  end
20
20
 
21
21
  def version
22
- `defaults read #{info_plist} CFBundleShortVersionString`.strip
22
+ @version ||= read_defaults('CFBundleShortVersionString')
23
23
  end
24
24
 
25
25
  def version_major
26
26
  version.split('.').first
27
27
  end
28
28
 
29
+ def minimum_osx
30
+ @minimum_osx ||= read_defaults('LSMinimumSystemVersion')
31
+ end
32
+
29
33
  private
30
34
 
31
35
  def validate!
@@ -35,4 +39,8 @@ class OsxApp
35
39
  def info_plist
36
40
  "#{path}/Contents/Info.plist"
37
41
  end
42
+
43
+ def read_defaults(string)
44
+ `defaults read #{info_plist} #{string}`.strip
45
+ end
38
46
  end
data/ruby_osx_app.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: ruby_osx_app 0.1.0 ruby lib
5
+ # stub: ruby_osx_app 0.1.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "ruby_osx_app"
9
- s.version = "0.1.0"
9
+ s.version = "0.1.1"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.authors = ["Marcin Nowicki"]
data/spec/osx_app_spec.rb CHANGED
@@ -15,6 +15,8 @@ describe OsxApp do
15
15
  its(:version) { should == expected_automator_version }
16
16
 
17
17
  its(:version_major) { should == expected_automator_version_major }
18
+
19
+ its(:minimum_osx) { should == expected_automator_minimum_osx }
18
20
  end
19
21
 
20
22
  context 'with app suffix and app exist by default' do
@@ -27,6 +29,8 @@ describe OsxApp do
27
29
  its(:version) { should == expected_automator_version }
28
30
 
29
31
  its(:version_major) { should == expected_automator_version_major }
32
+
33
+ its(:minimum_osx) { should == expected_automator_minimum_osx }
30
34
  end
31
35
 
32
36
  context 'and app does not exist' do
@@ -53,6 +57,8 @@ describe OsxApp do
53
57
  its(:version) { should == expected_automator_version }
54
58
 
55
59
  its(:version_major) { should == expected_automator_version_major }
60
+
61
+ its(:minimum_osx) { should == expected_automator_minimum_osx }
56
62
  end
57
63
 
58
64
  context 'and app not exist' do
@@ -70,13 +76,23 @@ describe OsxApp do
70
76
  end
71
77
  end
72
78
 
79
+ def osx_version
80
+ @osx_version ||= `sw_vers -productVersion`.strip
81
+ end
82
+
73
83
  def expected_automator_version
74
84
  {
75
85
  '10.8.5' => '2.3'
76
- }[`sw_vers -productVersion`.strip]
86
+ }[osx_version]
77
87
  end
78
88
 
79
89
  def expected_automator_version_major
80
90
  expected_automator_version.split('.').first
81
91
  end
92
+
93
+ def expected_automator_minimum_osx
94
+ {
95
+ '10.8.5' => '10.7'
96
+ }[osx_version]
97
+ end
82
98
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_osx_app
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcin Nowicki