targit 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: 3c738362732f5691e47a0a7bbff02c48d86e6a7f
4
- data.tar.gz: 077235b536226b1bc8b8e765decb865f7dd85b46
3
+ metadata.gz: d73b4b327839756bff56561a5dca9631934a341d
4
+ data.tar.gz: b8ab18676ed4acb5513bd0d67fae3c457198eac9
5
5
  SHA512:
6
- metadata.gz: bb0de98183a12cba90a3242e222e30e1d9566533ee801f3b4e12b3df96270b1473c5174bdbca7bc728215e8f0d5d638bf7282ce02e3ebb85675594fe3b41a9bb
7
- data.tar.gz: 9b817e456b1b5f77214946db4ffa238aa4d9826f45cb603b0c6a0c97f27313da1edb1b5dcb148e61df01256a3168c5066464c8ba0f1bed27f5f4142504349228
6
+ metadata.gz: c39be5ff223305ecac657e1f3a0a0e0cf3bb03c39f7529f1cd32d2e37132268e310cf190b6fe57fd5646546ff01f8ccdace5cad8e834f6b7fb40411c0eaf7345
7
+ data.tar.gz: 382f16ef7ea4b9290357b6e350812a2b73be1e34e33819764fbbc58222f1816161b5635ac83f535af9711de3c6e38d15fa23333bc6e80acc11f239880370a960
data/README.md CHANGED
@@ -26,6 +26,12 @@ To create a release that doesn't already exist, add `-c`:
26
26
  targit -c dock0/arch v0.1.75 ./new_tarball.tar.gz
27
27
  ```
28
28
 
29
+ Specify a name for the release, if desired:
30
+
31
+ ```
32
+ targit --create="cool release" dock0/arch v0.1.75 ./new_tarball.tar.gz
33
+ ```
34
+
29
35
  Adding `-f` will replace an existing release/asset, if they exist:
30
36
 
31
37
  ```
data/bin/targit CHANGED
@@ -16,7 +16,7 @@ Mercenary.program(:targit) do |p|
16
16
 
17
17
  # rubocop:disable Style/LineLength
18
18
  p.option :force, '-f', '--force', 'Replace the asset if it already exists'
19
- p.option :create, '-c', '--create', 'Create release if it does not exist'
19
+ p.option :create, '-c=[NAME]', '--create=[NAME]', 'Create release if it does not exist'
20
20
  p.option :prerelease, '-p', '--prerelease', 'With -c, create as a dev release'
21
21
  p.option :authfile, '-a FILE', '--authfile FILE', 'Set the auth file for GitHub credentials'
22
22
  p.option :name, '-n NAME', '--name NAME', 'Set the name for the release asset'
@@ -25,12 +25,14 @@ module Targit
25
25
  end
26
26
 
27
27
  def create
28
- @client.create_release(@repo, @tag)
28
+ @client.create_release(@repo, @tag, @create_options)
29
29
  @data = find
30
30
  end
31
31
 
32
32
  def _create_options
33
- [:prerelease, :target_commitish].each_with_object({}) do |option, hash|
33
+ opts = {}
34
+ opts[:name] = @options[:create] if @options[:create].is_a? String
35
+ [:prerelease, :target_commitish].each_with_object(opts) do |option, hash|
34
36
  hash[option] = @options[option] if @options[option]
35
37
  end
36
38
  end
@@ -1,5 +1,5 @@
1
1
  ##
2
2
  # Set the version (needed for Mercenary -v)
3
3
  module Targit
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
@@ -0,0 +1,208 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.github.com/repos/akerl/targit/releases?per_page=100
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/vnd.github.v3+json
12
+ User-Agent:
13
+ - Octokit Ruby Gem 3.2.0
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - GitHub.com
23
+ Date:
24
+ - Tue, 05 Aug 2014 23:49:28 GMT
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ Status:
28
+ - 200 OK
29
+ X-Ratelimit-Limit:
30
+ - '5000'
31
+ X-Ratelimit-Remaining:
32
+ - '4999'
33
+ X-Ratelimit-Reset:
34
+ - '1407286168'
35
+ Cache-Control:
36
+ - private, max-age=60, s-maxage=60
37
+ X-Oauth-Scopes:
38
+ - public_repo
39
+ X-Accepted-Oauth-Scopes:
40
+ - ''
41
+ Vary:
42
+ - Accept, Authorization, Cookie, X-GitHub-OTP
43
+ - Accept-Encoding
44
+ X-Github-Media-Type:
45
+ - github.v3; format=json
46
+ Link:
47
+ - <https://api.github.com/repositories/21316764/releases?per_page=100&page=0>;
48
+ rel="last"
49
+ X-Xss-Protection:
50
+ - 1; mode=block
51
+ X-Frame-Options:
52
+ - deny
53
+ Content-Security-Policy:
54
+ - default-src 'none'
55
+ Content-Length:
56
+ - '2'
57
+ Access-Control-Allow-Credentials:
58
+ - 'true'
59
+ Access-Control-Expose-Headers:
60
+ - ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
61
+ X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
62
+ Access-Control-Allow-Origin:
63
+ - "*"
64
+ Strict-Transport-Security:
65
+ - max-age=31536000; includeSubdomains
66
+ X-Content-Type-Options:
67
+ - nosniff
68
+ body:
69
+ encoding: UTF-8
70
+ string: "[]"
71
+ http_version:
72
+ recorded_at: Tue, 05 Aug 2014 23:49:27 GMT
73
+ - request:
74
+ method: post
75
+ uri: https://api.github.com/repos/akerl/targit/releases
76
+ body:
77
+ encoding: UTF-8
78
+ string: '{"name":"special","tag_name":"new_release"}'
79
+ headers:
80
+ Accept:
81
+ - application/vnd.github.v3+json
82
+ User-Agent:
83
+ - Octokit Ruby Gem 3.2.0
84
+ Accept-Encoding:
85
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
86
+ response:
87
+ status:
88
+ code: 201
89
+ message: Created
90
+ headers:
91
+ Server:
92
+ - GitHub.com
93
+ Date:
94
+ - Tue, 05 Aug 2014 23:49:28 GMT
95
+ Content-Type:
96
+ - application/json; charset=utf-8
97
+ Status:
98
+ - 201 Created
99
+ X-Ratelimit-Limit:
100
+ - '5000'
101
+ X-Ratelimit-Remaining:
102
+ - '4998'
103
+ X-Ratelimit-Reset:
104
+ - '1407286168'
105
+ Cache-Control:
106
+ - private, max-age=60, s-maxage=60
107
+ X-Oauth-Scopes:
108
+ - public_repo
109
+ X-Accepted-Oauth-Scopes:
110
+ - ''
111
+ Location:
112
+ - https://api.github.com/repos/akerl/targit/releases/473346
113
+ Vary:
114
+ - Accept, Authorization, Cookie, X-GitHub-OTP
115
+ X-Github-Media-Type:
116
+ - github.v3; format=json
117
+ X-Xss-Protection:
118
+ - 1; mode=block
119
+ X-Frame-Options:
120
+ - deny
121
+ Content-Security-Policy:
122
+ - default-src 'none'
123
+ Content-Length:
124
+ - '1553'
125
+ Access-Control-Allow-Credentials:
126
+ - 'true'
127
+ Access-Control-Expose-Headers:
128
+ - ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
129
+ X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
130
+ Access-Control-Allow-Origin:
131
+ - "*"
132
+ Strict-Transport-Security:
133
+ - max-age=31536000; includeSubdomains
134
+ X-Content-Type-Options:
135
+ - nosniff
136
+ body:
137
+ encoding: UTF-8
138
+ string: '{"url":"https://api.github.com/repos/akerl/targit/releases/473346","assets_url":"https://api.github.com/repos/akerl/targit/releases/473346/assets","upload_url":"https://uploads.github.com/repos/akerl/targit/releases/473346/assets{?name}","html_url":"https://github.com/akerl/targit/releases/tag/new_release","id":473346,"tag_name":"new_release","target_commitish":"master","name":"special","draft":false,"author":{"login":"akerl","id":491209,"avatar_url":"https://avatars.githubusercontent.com/u/491209?v=2","gravatar_id":"819691dc5c197c042ccd16b894545673","url":"https://api.github.com/users/akerl","html_url":"https://github.com/akerl","followers_url":"https://api.github.com/users/akerl/followers","following_url":"https://api.github.com/users/akerl/following{/other_user}","gists_url":"https://api.github.com/users/akerl/gists{/gist_id}","starred_url":"https://api.github.com/users/akerl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akerl/subscriptions","organizations_url":"https://api.github.com/users/akerl/orgs","repos_url":"https://api.github.com/users/akerl/repos","events_url":"https://api.github.com/users/akerl/events{/privacy}","received_events_url":"https://api.github.com/users/akerl/received_events","type":"User","site_admin":false},"prerelease":false,"created_at":"2014-07-12T22:40:26Z","published_at":"2014-08-05T23:49:28Z","assets":[],"tarball_url":"https://api.github.com/repos/akerl/targit/tarball/new_release","zipball_url":"https://api.github.com/repos/akerl/targit/zipball/new_release","body":null}'
139
+ http_version:
140
+ recorded_at: Tue, 05 Aug 2014 23:49:27 GMT
141
+ - request:
142
+ method: get
143
+ uri: https://api.github.com/repos/akerl/targit/releases?per_page=100
144
+ body:
145
+ encoding: US-ASCII
146
+ string: ''
147
+ headers:
148
+ Accept:
149
+ - application/vnd.github.v3+json
150
+ User-Agent:
151
+ - Octokit Ruby Gem 3.2.0
152
+ Accept-Encoding:
153
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
154
+ response:
155
+ status:
156
+ code: 200
157
+ message: OK
158
+ headers:
159
+ Server:
160
+ - GitHub.com
161
+ Date:
162
+ - Tue, 05 Aug 2014 23:49:28 GMT
163
+ Content-Type:
164
+ - application/json; charset=utf-8
165
+ Transfer-Encoding:
166
+ - chunked
167
+ Status:
168
+ - 200 OK
169
+ X-Ratelimit-Limit:
170
+ - '5000'
171
+ X-Ratelimit-Remaining:
172
+ - '4997'
173
+ X-Ratelimit-Reset:
174
+ - '1407286168'
175
+ Cache-Control:
176
+ - private, max-age=60, s-maxage=60
177
+ X-Oauth-Scopes:
178
+ - public_repo
179
+ X-Accepted-Oauth-Scopes:
180
+ - ''
181
+ Vary:
182
+ - Accept, Authorization, Cookie, X-GitHub-OTP
183
+ - Accept-Encoding
184
+ X-Github-Media-Type:
185
+ - github.v3; format=json
186
+ X-Xss-Protection:
187
+ - 1; mode=block
188
+ X-Frame-Options:
189
+ - deny
190
+ Content-Security-Policy:
191
+ - default-src 'none'
192
+ Access-Control-Allow-Credentials:
193
+ - 'true'
194
+ Access-Control-Expose-Headers:
195
+ - ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
196
+ X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
197
+ Access-Control-Allow-Origin:
198
+ - "*"
199
+ Strict-Transport-Security:
200
+ - max-age=31536000; includeSubdomains
201
+ X-Content-Type-Options:
202
+ - nosniff
203
+ body:
204
+ encoding: UTF-8
205
+ string: '[{"url":"https://api.github.com/repos/akerl/targit/releases/473346","assets_url":"https://api.github.com/repos/akerl/targit/releases/473346/assets","upload_url":"https://uploads.github.com/repos/akerl/targit/releases/473346/assets{?name}","html_url":"https://github.com/akerl/targit/releases/tag/new_release","id":473346,"tag_name":"new_release","target_commitish":"master","name":"special","draft":false,"author":{"login":"akerl","id":491209,"avatar_url":"https://avatars.githubusercontent.com/u/491209?v=2","gravatar_id":"819691dc5c197c042ccd16b894545673","url":"https://api.github.com/users/akerl","html_url":"https://github.com/akerl","followers_url":"https://api.github.com/users/akerl/followers","following_url":"https://api.github.com/users/akerl/following{/other_user}","gists_url":"https://api.github.com/users/akerl/gists{/gist_id}","starred_url":"https://api.github.com/users/akerl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akerl/subscriptions","organizations_url":"https://api.github.com/users/akerl/orgs","repos_url":"https://api.github.com/users/akerl/repos","events_url":"https://api.github.com/users/akerl/events{/privacy}","received_events_url":"https://api.github.com/users/akerl/received_events","type":"User","site_admin":false},"prerelease":false,"created_at":"2014-07-12T22:40:26Z","published_at":"2014-08-05T23:49:28Z","assets":[],"tarball_url":"https://api.github.com/repos/akerl/targit/tarball/new_release","zipball_url":"https://api.github.com/repos/akerl/targit/zipball/new_release","body":null}]'
206
+ http_version:
207
+ recorded_at: Tue, 05 Aug 2014 23:49:28 GMT
208
+ recorded_with: VCR 2.9.2
@@ -36,5 +36,17 @@ describe Targit do
36
36
  expect(release.repo).to eql 'akerl/targit'
37
37
  end
38
38
  end
39
+
40
+ it 'uses the provided release name if given' do
41
+ VCR.use_cassette('create_named_release') do
42
+ release = Targit::Release.new(
43
+ 'akerl/targit',
44
+ 'new_release',
45
+ create: 'special',
46
+ authfile: 'spec/.creds'
47
+ )
48
+ expect(release.data[:name]).to eql 'special'
49
+ end
50
+ end
39
51
  end
40
52
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: targit
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
  - Les Aker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-12 00:00:00.000000000 Z
11
+ date: 2014-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit
@@ -196,6 +196,7 @@ files:
196
196
  - spec/fixtures/cassettes/asset_url_present.yml
197
197
  - spec/fixtures/cassettes/asset_without_release.yml
198
198
  - spec/fixtures/cassettes/block_existing_asset.yml
199
+ - spec/fixtures/cassettes/create_named_release.yml
199
200
  - spec/fixtures/cassettes/create_new_asset.yml
200
201
  - spec/fixtures/cassettes/create_new_release.yml
201
202
  - spec/fixtures/cassettes/current_asset.yml
@@ -247,6 +248,7 @@ test_files:
247
248
  - spec/fixtures/cassettes/asset_url_present.yml
248
249
  - spec/fixtures/cassettes/asset_without_release.yml
249
250
  - spec/fixtures/cassettes/block_existing_asset.yml
251
+ - spec/fixtures/cassettes/create_named_release.yml
250
252
  - spec/fixtures/cassettes/create_new_asset.yml
251
253
  - spec/fixtures/cassettes/create_new_release.yml
252
254
  - spec/fixtures/cassettes/current_asset.yml