menu-cli 0.1 → 0.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 +4 -4
- data/README.md +26 -0
- data/lib/menu/release.rb +18 -6
- data/lib/menu/runner.rb +3 -1
- data/lib/menu/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 152287c48de805e95789c0815aff76ac5b80743b
|
4
|
+
data.tar.gz: fb285d2c24de6374012a5774ac153e460a286a12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2162538851fed737da396d9c80c36cdd3f0d03e270e365e140cceae50acf0da9dd17f164f9c501181ab76043e7497bb1d9daa0cc665eb22e13dc4f764a31c39a
|
7
|
+
data.tar.gz: 134f756cad85e7503b3c6f66cdda6d7119cbd201877fe8300584d34ba6573ebc7fc86ade2d2c47a94b82887a256f498f58a5cf2baa7efa476d37ee46e48e7672
|
data/README.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# Menu-CLI
|
2
|
+
[](http://travis-ci.org/kurtisnelson/menu-cli)
|
3
|
+
[](http://badge.fury.io/rb/menu-cli)
|
4
|
+
[](https://codeclimate.com/github/kurtisnelson/menu-cli)
|
5
|
+
[](https://coveralls.io/r/kurtisnelson/menu-cli)
|
6
|
+
[](https://gemnasium.com/kurtisnelson/menu-cli)
|
7
|
+
[Documentation](http://rubydoc.info/gems/menu-cli/)
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
`gem install menu-cli`
|
12
|
+
|
13
|
+
Make sure you have the following in your environment:
|
14
|
+
|
15
|
+
```bash
|
16
|
+
AWS_ID="AWS ID per AWS-SDK docs"
|
17
|
+
AWS_SECRET="AWS Secret per AWS-SDK docs"
|
18
|
+
MENU_URL="Raw bucket URL, of the format http://bucket-name.regionstuff.s3.amazon.com"
|
19
|
+
MENU_SSL_URL="URL to be used to fetch assets, should be https://menu.yourdomain.com"
|
20
|
+
MENU_BUCKET="Name of bucket to store artifacts"
|
21
|
+
```
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
`menu -c COMPONENT payload` to deploy
|
26
|
+
`menu -h` for help.
|
data/lib/menu/release.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'aws-sdk'
|
2
|
+
require 'digest'
|
2
3
|
module Menu
|
3
4
|
class Release < OpenStruct
|
4
5
|
def <=> o
|
@@ -6,28 +7,39 @@ module Menu
|
|
6
7
|
end
|
7
8
|
|
8
9
|
def upload_payload options
|
9
|
-
unless File.exists? payload_file
|
10
|
+
unless File.exists? @payload_file
|
10
11
|
puts "Could not open payload"
|
11
12
|
exit 1
|
12
13
|
end
|
13
14
|
s3 = Aws::S3::Client.new(region: 'us-east-1')
|
14
|
-
key = "#{options.component}/v#{self.version}#{File.extname(payload_file)}"
|
15
|
+
key = "#{options.component}/v#{self.version}-#{checksum}#{File.extname(@payload_file)}"
|
15
16
|
puts "Uploading payload (#{key}) to S3..." if options.verbose
|
16
17
|
s3.put_object(
|
17
18
|
acl: "public-read",
|
18
|
-
body: File.open(payload_file),
|
19
|
+
body: File.open(@payload_file),
|
19
20
|
bucket: options.bucket,
|
20
21
|
key: key
|
21
22
|
)
|
22
23
|
puts "Upload complete." if options.verbose
|
23
|
-
self.payload = ENV['MENU_SSL_URL'] + key
|
24
|
+
self.payload = ENV['MENU_SSL_URL'] + '/' + key
|
25
|
+
end
|
26
|
+
|
27
|
+
def payload_file= file
|
28
|
+
@payload_file = file
|
29
|
+
@checksum = Digest::MD5.file(file).hexdigest
|
30
|
+
end
|
31
|
+
|
32
|
+
def checksum
|
33
|
+
raise "No payload" unless @checksum
|
34
|
+
@checksum
|
24
35
|
end
|
25
36
|
|
26
37
|
def to_json s
|
27
38
|
{
|
28
|
-
beta: beta,
|
29
39
|
version: version,
|
30
|
-
|
40
|
+
beta: beta,
|
41
|
+
payload: payload,
|
42
|
+
md5: checksum
|
31
43
|
}.to_json
|
32
44
|
end
|
33
45
|
end
|
data/lib/menu/runner.rb
CHANGED
@@ -14,6 +14,7 @@ module Menu
|
|
14
14
|
exit 1 unless gets.chomp == 'y'
|
15
15
|
end
|
16
16
|
version = @options.release if @options.release
|
17
|
+
releases.delete_if {|r| r.version == version }
|
17
18
|
|
18
19
|
log "Release ##{version} for #{@options.component}..."
|
19
20
|
log "Beta release" if @options.beta
|
@@ -34,7 +35,8 @@ module Menu
|
|
34
35
|
body: releases.to_json,
|
35
36
|
bucket: @options.bucket,
|
36
37
|
key: "#{@options.component}.json",
|
37
|
-
content_type: "application/json"
|
38
|
+
content_type: "application/json",
|
39
|
+
cache_control: "max-age = 7200"
|
38
40
|
)
|
39
41
|
log "JSON uploaded"
|
40
42
|
end
|
data/lib/menu/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: menu-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kurt Nelson
|
@@ -180,6 +180,7 @@ files:
|
|
180
180
|
- Gemfile
|
181
181
|
- LICENSE
|
182
182
|
- LICENSE.txt
|
183
|
+
- README.md
|
183
184
|
- Rakefile
|
184
185
|
- bin/menu
|
185
186
|
- lib/menu.rb
|