xcjobs 0.1.1 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40155f85779e92f784c2ffcbe0a8d17b01b784d4
4
- data.tar.gz: 1dd86f58891dd1deb0a70d38a66eb1aebe675159
3
+ metadata.gz: 77fa2599099b33acbf2d9810c44d794383bb6704
4
+ data.tar.gz: 66592101cff663dd0ad07d5adf8b0780b6da2b35
5
5
  SHA512:
6
- metadata.gz: 124d06f73c3c55a092bd9e70e247f0499814e8f980a2b2187c1f35e7fcdf819ba244110a6213c6dbcca3905d3317a8213b89e13c04b3a4d185dc08c225ecc861
7
- data.tar.gz: 6e5370b62f0a18743e4e9ebfe236aafc91f354dc7031045620ee3b66bc7a320017002e717d2f1264967fecd67714d6511c7192c85f48b671b8cd575c7d21974f
6
+ metadata.gz: 9cbc57bd73906258ce007277f0cf9db4656172ce261240ddab7dddb913e19b88874652d7a22ee1a55bba51c6f842e6350584ffe2c8260ce87aaeac3252f72ca8
7
+ data.tar.gz: 76debdf38cdadc9f6a9c72be8672797316e0d7bb5ba9bcfab51f15e4206ababdc7bfbad26220d658d7b922484c44d32a3706fe89b0473565d6991d9c5e9f531f
@@ -3,6 +3,7 @@ require 'json'
3
3
  require 'pathname'
4
4
  require 'tempfile'
5
5
  require 'open3'
6
+ require 'digest/md5'
6
7
 
7
8
  module XCJobs
8
9
  module Coverage
@@ -90,7 +91,7 @@ module XCJobs
90
91
  File.open(file, "r") do |handle|
91
92
  source_file = {}
92
93
  name = ''
93
- source = ''
94
+ source_digest = nil
94
95
  coverage = []
95
96
 
96
97
  handle.each_line do |line|
@@ -102,9 +103,11 @@ module XCJobs
102
103
  key, val = /([^:]+):(.*)$/.match(text).to_a[1..2]
103
104
  if key == 'Source'
104
105
  name = Pathname(val).relative_path_from(Pathname(base_dir)).to_s
106
+ if File.exist?(val)
107
+ source_digest = Digest::MD5.file(val).to_s
108
+ end
105
109
  end
106
110
  else
107
- source << text + '\n'
108
111
  coverage[number.to_i - 1] = case count.strip
109
112
  when "-"
110
113
  nil
@@ -119,9 +122,9 @@ module XCJobs
119
122
  end
120
123
  end
121
124
 
122
- if !is_excluded_path(name)
125
+ if !is_excluded_path(name) && !source_digest.nil?
123
126
  source_file['name'] = name
124
- source_file['source'] = source
127
+ source_file['source_digest'] = source_digest
125
128
  source_file['coverage'] = coverage
126
129
 
127
130
  report['source_files'] << source_file
@@ -129,6 +132,18 @@ module XCJobs
129
132
  end
130
133
  end
131
134
 
135
+ remotes = %x[git remote -v].rstrip.split(/\r?\n/).map {|line| line.chomp }.select { |line| line.include? 'fetch'}.first.split(' ')
136
+ report['git'] = {
137
+ 'head' => {
138
+ 'id' => %x[git --no-pager log -1 --pretty=format:%H],
139
+ 'author_name' => %x[git --no-pager log -1 --pretty=format:%aN],
140
+ 'author_email' => %x[git --no-pager log -1 --pretty=format:%ae],
141
+ 'committer_name' => %x[git --no-pager log -1 --pretty=format:%cN],
142
+ 'committer_email' => %x[git --no-pager log -1 --pretty=format:%ce],
143
+ 'message' => %x[git --no-pager log -1 --pretty=format:%s] },
144
+ 'branch' => %x[git rev-parse --abbrev-ref HEAD].strip,
145
+ 'remotes' => {'name' => remotes[0], 'remote' => remotes[1]} }
146
+
132
147
  report
133
148
  end
134
149
 
@@ -159,10 +174,12 @@ module XCJobs
159
174
  end
160
175
 
161
176
  def write_report(report)
162
- temp = Tempfile.new('coveralls')
163
- temp.puts(report.to_json)
164
- temp.flush
165
- temp.path
177
+ tempdir = Pathname.new(Dir.tmpdir).join(SecureRandom.hex)
178
+ FileUtils.mkdir_p(tempdir)
179
+ tempfile = File::open(tempdir.join('coveralls.json'), "w")
180
+ tempfile.puts(report.to_json)
181
+ tempfile.flush
182
+ tempfile.path
166
183
  end
167
184
 
168
185
  def upload(json_file)
@@ -1,3 +1,3 @@
1
1
  module XCJobs
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcjobs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - kishikawa katsumi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-23 00:00:00.000000000 Z
11
+ date: 2015-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler