txgh 5.3.1 → 5.3.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: abd1060ad1469719441e5d7de2be9d985900e5cd
4
- data.tar.gz: c9632ac08de39832a693b155350a7d70c72e5f80
3
+ metadata.gz: 7f831210ee4eadf7ea3dbeec8fca21b3cc457d05
4
+ data.tar.gz: 493c29cf1ddce63e389f5d59b51a5657d5696f16
5
5
  SHA512:
6
- metadata.gz: dd2d247a7be7b05db8cc0b6a388e9f2544b7c09e334eea6daf501ae770d822970ee13e33fab982e4256501153d64d9f7674ff38a192cb43a3b0133034afcbb3d
7
- data.tar.gz: 2fa865241cda905755bb05acfc3a5313251d72018c2d457b3719b325c3fd1abab38f81b910e1bc0f8a610066f90c91004fcf8d350f7d491c39e33c1c0b16fda1
6
+ metadata.gz: 72cfa6423105dd10a4ab7b5fb9ba5914b66a5260e40e69d3a2b4d6a48e12d02265bf7568b0f2deca4984c6690459ef16c9afa1330222bbcf44e0dc3074e9baab
7
+ data.tar.gz: c1c1b3763d4c8567b446432fa366f9915e69fe82410ab04dee0c158749d728b1badacc1832a15d4845081f18cbf2bda0e07d8ea7a1044ac2a9d58c2d51a16e5e
@@ -36,10 +36,14 @@ module Txgh
36
36
  def update_contents(repo, branch, content_map, message)
37
37
  content_map.each do |path, new_contents|
38
38
  branch = Utils.relative_branch(branch)
39
- file = client.contents(repo, { path: path, ref: branch})
40
- current_contents = Base64.decode64(file[:content])
41
- current_sha = file[:sha]
42
39
 
40
+ file = begin
41
+ client.contents(repo, { path: path, ref: branch })
42
+ rescue Octokit::NotFound
43
+ nil
44
+ end
45
+
46
+ current_sha = file ? file[:sha] : '0' * 40
43
47
  new_sha = Utils.git_hash_blob(new_contents)
44
48
  options = { branch: branch }
45
49
 
data/lib/txgh/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Txgh
2
- VERSION = '5.3.1'
2
+ VERSION = '5.3.2'
3
3
  end
@@ -68,6 +68,20 @@ describe GithubApi do
68
68
 
69
69
  api.update_contents(repo, branch, { path => old_contents }, 'message')
70
70
  end
71
+
72
+ it "creates the file if it doesn't already exist" do
73
+ new_contents = 'foobar'
74
+
75
+ # file doesn't exist, raise octokit error
76
+ expect(client).to receive(:contents).and_raise(Octokit::NotFound)
77
+
78
+ expect(client).to(
79
+ receive(:update_contents)
80
+ .with(repo, path, 'message', '0' * 40, new_contents, { branch: branch })
81
+ )
82
+
83
+ api.update_contents(repo, branch, { path => new_contents }, 'message')
84
+ end
71
85
  end
72
86
 
73
87
  describe '#commit' do
data/txgh.gemspec CHANGED
@@ -24,8 +24,6 @@ Gem::Specification.new do |s|
24
24
  s.add_dependency 'sinatra-contrib', '~> 1.4'
25
25
  s.add_dependency 'rubyzip', '>= 1.0', '<= 1.1.2'
26
26
 
27
- s.add_dependency 'dry-types'
28
-
29
27
  s.require_path = 'lib'
30
28
  s.files = Dir['{lib,spec}/**/*', 'README.md', 'txgh.gemspec', 'LICENSE']
31
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: txgh
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.3.1
4
+ version: 5.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Jackowski
@@ -157,20 +157,6 @@ dependencies:
157
157
  - - "<="
158
158
  - !ruby/object:Gem::Version
159
159
  version: 1.1.2
160
- - !ruby/object:Gem::Dependency
161
- name: dry-types
162
- requirement: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - ">="
165
- - !ruby/object:Gem::Version
166
- version: '0'
167
- type: :runtime
168
- prerelease: false
169
- version_requirements: !ruby/object:Gem::Requirement
170
- requirements:
171
- - - ">="
172
- - !ruby/object:Gem::Version
173
- version: '0'
174
160
  description: A server that automatically syncs translation resources between Github
175
161
  and Transifex.
176
162
  email:
@@ -184,8 +170,6 @@ files:
184
170
  - README.md
185
171
  - lib/ext/zipline/output_stream.rb
186
172
  - lib/txgh.rb
187
- - lib/txgh/api/endpoint.rb
188
- - lib/txgh/api/hooks/push.rb
189
173
  - lib/txgh/app.rb
190
174
  - lib/txgh/category_support.rb
191
175
  - lib/txgh/config.rb
@@ -1,12 +0,0 @@
1
- require 'dry-types'
2
- # require 'dry-validations'
3
-
4
- module Txgh
5
- module Api
6
- class Endpoint < Dry::Types::Struct
7
- module Types
8
- include Dry::Types.module
9
- end
10
- end
11
- end
12
- end
@@ -1,9 +0,0 @@
1
- module Txgh
2
- module Api
3
- module Hooks
4
- class Push < Endpoint
5
- attribute :name, 'coercible.string'
6
- end
7
- end
8
- end
9
- end