carthage_remote_cache 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/lib/version_file.rb CHANGED
@@ -4,87 +4,85 @@ require 'fileutils'
4
4
  # .version file representation, see Carthage documentation on them:
5
5
  # https://github.com/Carthage/Carthage/blob/master/Documentation/VersionFile.md
6
6
  class VersionFile
7
-
8
- attr_reader :path, :version, :frameworks_by_platform
9
-
10
- def initialize(path)
11
- @path = path
12
- parse
13
- end
14
-
15
- # Returns a Hash, e.g.
16
- # ```
17
- # {
18
- # "CocoaLumberjack" => [:iOS, :watchOS],
19
- # "Lottie" => [:iOS],
20
- # }
21
- # ```
22
- def platforms_by_framework
23
- result = Hash.new { |h, k| h[k] = [] }
24
- for framework_name in framework_names do
25
- @frameworks_by_platform.each do |platform, framework_names_in_platform|
26
- if framework_names_in_platform.include?(framework_name)
27
- result[framework_name] << platform
28
- end
29
- end
7
+ attr_reader :path, :version, :frameworks_by_platform
8
+
9
+ def initialize(path)
10
+ @path = path
11
+ parse
12
+ end
13
+
14
+ # Returns a Hash, e.g.
15
+ # ```
16
+ # {
17
+ # "CocoaLumberjack" => [:iOS, :watchOS],
18
+ # "Lottie" => [:iOS],
19
+ # }
20
+ # ```
21
+ def platforms_by_framework
22
+ result = Hash.new { |h, k| h[k] = [] }
23
+ for framework_name in framework_names
24
+ @frameworks_by_platform.each do |platform, framework_names_in_platform|
25
+ if framework_names_in_platform.include?(framework_name)
26
+ result[framework_name] << platform
30
27
  end
31
- result
28
+ end
32
29
  end
33
-
34
- # Unique array of framework names.
35
- def framework_names
36
- @frameworks_by_platform.values.flatten.uniq.sort
30
+ result
31
+ end
32
+
33
+ # Unique array of framework names.
34
+ def framework_names
35
+ @frameworks_by_platform.values.flatten.uniq.sort
36
+ end
37
+
38
+ # Total number of frameworks accross all platforms.
39
+ def number_of_frameworks
40
+ @frameworks_by_platform.values.flatten.count
41
+ end
42
+
43
+ def move_to_build_dir
44
+ basename = File.basename(@path)
45
+ target_path = File.join(CARTHAGE_BUILD_DIR, basename)
46
+ FileUtils.mv(@path, target_path)
47
+ @path = target_path
48
+ end
49
+
50
+ def remove
51
+ FileUtils.rm(@path)
52
+ end
53
+
54
+ def same_content?(other_version_file)
55
+ if other_version_file.nil?
56
+ false
57
+ else
58
+ FileUtils.compare_file(@path, other_version_file.path)
37
59
  end
60
+ end
38
61
 
39
- # Total number of frameworks accross all platforms.
40
- def number_of_frameworks
41
- @frameworks_by_platform.values.flatten.count
42
- end
62
+ private
43
63
 
44
- def move_to_build_dir
45
- basename = File.basename(@path)
46
- target_path = File.join(CARTHAGE_BUILD_DIR, basename)
47
- FileUtils.mv(@path, target_path)
48
- @path = target_path
49
- end
64
+ def parse
65
+ raise AppError.new, "File #{path} doesn't exist, has carthage been bootstrapped?" unless File.exist?(@path)
50
66
 
51
- def remove
52
- FileUtils.rm(@path)
53
- end
67
+ file = File.read(@path)
68
+ json = JSON.parse(file)
54
69
 
55
- def same_content?(other_version_file)
56
- if other_version_file.nil?
57
- false
58
- else
59
- FileUtils.compare_file(@path, other_version_file.path)
60
- end
61
- end
62
-
63
- private
64
-
65
- def parse
66
- raise AppError.new, "File #{path} doesn't exist, has carthage been bootstrapped?" unless File.exist?(@path)
67
-
68
- file = File.read(@path)
69
- json = JSON.parse(file)
70
+ @version = json['commitish']
71
+ raise AppError.new, "Version is missing in #{@path}" if @version.nil? || @version.empty?
70
72
 
71
- @version = json['commitish']
72
- raise AppError.new, "Version is missing in #{@path}" if @version.nil? || @version.empty?
73
+ @frameworks_by_platform = {
74
+ :iOS => parse_platform_array(json['iOS']),
75
+ :macOS => parse_platform_array(json['Mac']),
76
+ :tvOS => parse_platform_array(json['tvOS']),
77
+ :watchOS => parse_platform_array(json['watchOS']),
78
+ }
79
+ end
73
80
 
74
- @frameworks_by_platform = {
75
- :iOS => parse_platform_array(json['iOS']),
76
- :macOS => parse_platform_array(json['Mac']),
77
- :tvOS => parse_platform_array(json['tvOS']),
78
- :watchOS => parse_platform_array(json['watchOS']),
79
- }
81
+ def parse_platform_array(array)
82
+ if array.kind_of?(Array)
83
+ array.map { |entry| entry['name'] }
84
+ else
85
+ []
80
86
  end
81
-
82
- def parse_platform_array(array)
83
- if array.kind_of?(Array)
84
- array.map { |entry| entry['name'] }
85
- else
86
- []
87
- end
88
- end
89
-
87
+ end
90
88
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carthage_remote_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juraj Blahunka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-06 00:00:00.000000000 Z
11
+ date: 2018-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -24,6 +24,48 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: guard
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 2.14.2
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 2.14.2
41
+ - !ruby/object:Gem::Dependency
42
+ name: guard-test
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 2.0.8
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 2.0.8
55
+ - !ruby/object:Gem::Dependency
56
+ name: mocha
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 1.3.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 1.3.0
27
69
  - !ruby/object:Gem::Dependency
28
70
  name: rake
29
71
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +94,34 @@ dependencies:
52
94
  - - ">="
53
95
  - !ruby/object:Gem::Version
54
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rufo
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: test-unit
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 3.2.7
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 3.2.7
55
125
  - !ruby/object:Gem::Dependency
56
126
  name: concurrent-ruby
57
127
  requirement: !ruby/object:Gem::Requirement
@@ -118,8 +188,10 @@ extensions: []
118
188
  extra_rdoc_files: []
119
189
  files:
120
190
  - ".gitignore"
191
+ - ".travis.yml"
121
192
  - Gemfile
122
193
  - Gemfile.lock
194
+ - Guardfile
123
195
  - LICENSE
124
196
  - README.md
125
197
  - Rakefile
@@ -145,7 +217,9 @@ files:
145
217
  - lib/networking.rb
146
218
  - lib/server/config.ru
147
219
  - lib/server/server_app.rb
220
+ - lib/shell_wrapper.rb
148
221
  - lib/utils.rb
222
+ - lib/version.rb
149
223
  - lib/version_file.rb
150
224
  homepage: https://github.com/kayak/carthage_remote_cache
151
225
  licenses:
@@ -167,7 +241,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
241
  version: '0'
168
242
  requirements: []
169
243
  rubyforge_project:
170
- rubygems_version: 2.5.2
244
+ rubygems_version: 2.7.4
171
245
  signing_key:
172
246
  specification_version: 4
173
247
  summary: Centralized cache to serve carthage frameworks. Useful for distributed CI