xcinvoke 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5801a55bb74f9fc80bc999371bfa4076e9b7cf7b
4
- data.tar.gz: 4d83ebf8936738acf25c676e600ffe234adb85e5
3
+ metadata.gz: 3bae7231afd1f410041f2cd6a06aa33a0649c9e6
4
+ data.tar.gz: 046dd15b60a8aa1ef6caeab70cd9927b6af3596a
5
5
  SHA512:
6
- metadata.gz: b317b87f5b74c579ab3977e5a0b7e6449069a5f59a0a32314cb0040d4f3a5382658a46998e764e3d20d1b27c4380fc3be7fe888612a775b21f0f1e3d01c62219
7
- data.tar.gz: 1d060b6f26b1912d9d16f718297cbe92e6310331cd11653bc1c64f8ec73bce19faf396d2955e796c2e91ff978315ef4e0f608b41be1b6e1db651442da4f04d6b
6
+ metadata.gz: 56b5ab6ed2588eee66f8f3247b890d4ffd1e50bed5e3c94aef841d3be8b7ce6654b16d891b9f5adb89de2c2c4d779cf49ce2e66306bd30222d00024030006a0a
7
+ data.tar.gz: 0bf2bc085ac3f97d0bd51f815627d7a04256809a846cd129388634c10d35f6721d012877339d76f3e7811631040d8227ed02e0f5ff8687e8efbd2b9eb6ac718c
@@ -1,3 +1,17 @@
1
+ ## 0.2.0
2
+
3
+ ##### Enhancements
4
+
5
+ * Return `Xcode#swift_version` as a `Version` object.
6
+ [Samuel Giddins](https://github.com/segiddins)
7
+
8
+ ##### Bug Fixes
9
+
10
+ * The entirety of `DYLD_FRAMEWORK_PATH` and `DYLD_LIBRARY_PATH` are no longer
11
+ overwritten in the generated Xcode environment.
12
+ [Samuel Giddins](https://github.com/segiddins)
13
+
14
+
1
15
  ## 0.1.0
2
16
 
3
17
  ##### Enhancements
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- xcinvoke (0.1.0)
4
+ xcinvoke (0.2.0)
5
5
  liferaft (~> 0.0.4)
6
6
 
7
7
  GEM
@@ -1,3 +1,3 @@
1
1
  module XCInvoke
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -49,12 +49,13 @@ module XCInvoke
49
49
  end
50
50
 
51
51
  def self.find_swift_version(swift_version)
52
+ swift_version = Gem::Version.create(swift_version)
52
53
  select { |xc| xc.swift_version == swift_version }.sort.last
53
54
  end
54
55
 
55
56
  def swift_version
56
57
  info = swift_info
57
- info.first if info
58
+ Gem::Version.new(info.first) if info
58
59
  end
59
60
 
60
61
  def build_number
@@ -63,25 +64,34 @@ module XCInvoke
63
64
  end
64
65
 
65
66
  def version
66
- Liferaft::Version.new(build_number)
67
+ build = build_number
68
+ Liferaft::Version.new(build) if build
67
69
  end
68
70
 
69
71
  def <=>(other)
70
72
  version <=> other.version
71
73
  end
72
74
 
73
- def xcrun(cmd, env: {})
75
+ def xcrun(cmd, env: {}, err: false)
74
76
  env = env.merge(as_env)
75
77
  cmd = %w(xcrun) + cmd
76
- output, = Open3.capture2(env, *cmd, err: '/dev/null')
77
- output
78
+ case err
79
+ when :merge
80
+ oe, = Open3.capture2e(env, *cmd)
81
+ oe
82
+ else
83
+ o, e, = Open3.capture3(env, *cmd)
84
+ err ? [o, e] : o
85
+ end
78
86
  end
79
87
 
80
88
  def as_env
81
89
  {
82
90
  'DEVELOPER_DIR' => developer_dir.to_path,
83
- 'DYLD_FRAMEWORK_PATH' => dyld_framework_path.to_path,
84
- 'DYLD_LIBRARY_PATH' => dyld_library_path.to_path,
91
+ 'DYLD_FRAMEWORK_PATH' =>
92
+ unshift_path(ENV['DYLD_FRAMEWORK_PATH'], dyld_framework_path),
93
+ 'DYLD_LIBRARY_PATH' =>
94
+ unshift_path(ENV['DYLD_LIBRARY_PATH'], dyld_library_path),
85
95
  }
86
96
  end
87
97
 
@@ -106,5 +116,11 @@ module XCInvoke
106
116
  return unless xcrun(%w(swift --version)) =~ swift_info_regex
107
117
  [Regexp.last_match(1), Regexp.last_match(2)]
108
118
  end
119
+
120
+ def unshift_path(paths, path)
121
+ paths = (paths || '').split(File::PATH_SEPARATOR)
122
+ paths.unshift(path.to_s)
123
+ paths.join(File::PATH_SEPARATOR)
124
+ end
109
125
  end
110
126
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcinvoke
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel E. Giddins
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-07-30 00:00:00.000000000 Z
11
+ date: 2015-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: liferaft