samus 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/commands/publish/github-release +82 -0
- data/commands/publish/github-release.help.md +11 -0
- data/lib/samus/version.rb +1 -1
- data/samus.json +17 -6
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e54825002248c11f8cef0169d001d109cb192d5c
|
4
|
+
data.tar.gz: 61d76cfcca24f5ac7daa3e4aaeb0aa396ada048a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1431b685cee99fc653737b73a5ddb58eda63b85589439788141a36a4de0902759fcbf8e9ae544fd4b714ee6c709e5d18d8ec92b08b5bcab5e097c9de1a0af669
|
7
|
+
data.tar.gz: f9bb16e41be1c35acb6c93750c146a520999c4f0a9ba56dd8aba63d6693eee35bf9ea2598aa496ac4485101b04feef91a945f0d9f406d6a375ea51eb1c63b3a2
|
@@ -0,0 +1,82 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require "date"
|
5
|
+
require "net/https"
|
6
|
+
require "uri"
|
7
|
+
|
8
|
+
def fail(msg, code = 1)
|
9
|
+
$stderr.puts msg
|
10
|
+
exit code
|
11
|
+
end
|
12
|
+
|
13
|
+
def https_request(opts = {})
|
14
|
+
uri = URI.parse(opts[:uri])
|
15
|
+
key, body = opts[:key], opts[:body]
|
16
|
+
content_type = opts[:content_type] || "application/json"
|
17
|
+
method = opts[:method] || :Post
|
18
|
+
|
19
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
20
|
+
http.use_ssl = true
|
21
|
+
request = Net::HTTP.const_get(method).new(uri.request_uri)
|
22
|
+
request["content-type"] = "application/json"
|
23
|
+
request["authorization"] = "token #{key}"
|
24
|
+
|
25
|
+
if content_type == "application/json"
|
26
|
+
request.body = body
|
27
|
+
else
|
28
|
+
request.body_stream = body
|
29
|
+
request.content_length = body.size
|
30
|
+
end
|
31
|
+
|
32
|
+
response = http.request(request)
|
33
|
+
if response.code[0] != "2"
|
34
|
+
raise RuntimeError, response.code + " " + response.message
|
35
|
+
else
|
36
|
+
response
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
key = ENV["__creds_secret"]
|
41
|
+
repository = ENV["_repository"]
|
42
|
+
tag = ENV["_tag"]
|
43
|
+
changelog = ENV["_changelog"]
|
44
|
+
title = ENV["_title"] || "Release #{tag} - #{Time.now.to_date.to_s}"
|
45
|
+
out_file = ENV["_out_file"]
|
46
|
+
assets = ARGV
|
47
|
+
|
48
|
+
fail "Missing `repository`" unless repository
|
49
|
+
fail "Missing `tag`" unless tag
|
50
|
+
|
51
|
+
begin
|
52
|
+
uri = "https://api.github.com/repos/#{repository}/releases"
|
53
|
+
body = JSON.generate({
|
54
|
+
"body" => changelog ? File.read(changelog) : "",
|
55
|
+
"name" => title,
|
56
|
+
"tag_name" => tag,
|
57
|
+
})
|
58
|
+
response = https_request uri: uri, key: key, body: body
|
59
|
+
json = JSON.parse(response.body)
|
60
|
+
|
61
|
+
assets.each do |asset|
|
62
|
+
local_name, remote_name = *asset.split(':', 2)
|
63
|
+
remote_name ||= local_name
|
64
|
+
uri = json["upload_url"].sub(/\{\?name\}$/, "?name=#{remote_name}")
|
65
|
+
File.open(local_name, "r") do |file|
|
66
|
+
begin
|
67
|
+
https_request uri: uri, key: key,
|
68
|
+
body: file, content_type: "application/octet-stream"
|
69
|
+
rescue => e
|
70
|
+
puts "Failed to upload release asset #{local_name} as #{remote_name}."
|
71
|
+
https_request uri: json["url"], key: key, method: :Delete, body: ""
|
72
|
+
raise
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
File.open(out_file, "w") {|f| f.write(json["url"]) } if out_file
|
78
|
+
puts "Created GitHub release of #{repository}@#{tag}"
|
79
|
+
puts "URL: #{json["url"]}"
|
80
|
+
rescue => e
|
81
|
+
fail "Failed to create GitHub release of #{repository}@#{tag}: #{e.message}"
|
82
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Creates a GitHub release from a given tag.
|
2
|
+
|
3
|
+
Files:
|
4
|
+
* An optional list of assets to upload with the release.
|
5
|
+
|
6
|
+
Arguments:
|
7
|
+
* repository: the fully qualified repository name (user/repo).
|
8
|
+
* tag: the tag name to create the release for.
|
9
|
+
* title: an optional title for the release.
|
10
|
+
* changelog: an optional filename containing changelog data.
|
11
|
+
* out_file: an optional filename to write the resulting release URL to.
|
data/lib/samus/version.rb
CHANGED
data/samus.json
CHANGED
@@ -21,13 +21,24 @@
|
|
21
21
|
{
|
22
22
|
"action": "git-clone",
|
23
23
|
"files": ["git-repo"],
|
24
|
-
"publish": [
|
25
|
-
|
26
|
-
|
27
|
-
"
|
28
|
-
|
24
|
+
"publish": [
|
25
|
+
{
|
26
|
+
"action": "git-push",
|
27
|
+
"arguments": {
|
28
|
+
"remotes": "origin",
|
29
|
+
"refs": "master v$version"
|
30
|
+
}
|
31
|
+
},
|
32
|
+
{
|
33
|
+
"action": "github-release",
|
34
|
+
"credentials": "lsegal.github",
|
35
|
+
"files": [],
|
36
|
+
"arguments": {
|
37
|
+
"repository": "lsegal/samus",
|
38
|
+
"tag": "v$version"
|
39
|
+
}
|
29
40
|
}
|
30
|
-
|
41
|
+
]
|
31
42
|
},
|
32
43
|
{
|
33
44
|
"action": "gem-build",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: samus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Loren Segal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: lsegal@soen.ca
|
@@ -61,6 +61,8 @@ files:
|
|
61
61
|
- commands/publish/gem-push.help.md
|
62
62
|
- commands/publish/git-push
|
63
63
|
- commands/publish/git-push.help.md
|
64
|
+
- commands/publish/github-release
|
65
|
+
- commands/publish/github-release.help.md
|
64
66
|
- commands/publish/npm-publish
|
65
67
|
- commands/publish/npm-publish.help.md
|
66
68
|
- commands/publish/s3-put
|
@@ -98,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
100
|
version: '0'
|
99
101
|
requirements: []
|
100
102
|
rubyforge_project:
|
101
|
-
rubygems_version: 2.
|
103
|
+
rubygems_version: 2.4.1
|
102
104
|
signing_key:
|
103
105
|
specification_version: 4
|
104
106
|
summary: Samus helps you release Open Source Software.
|