menu-cli 0.3 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8e48681dfd5a0a07bec9fbd094270b0fe9a2cf3c
4
- data.tar.gz: ebacda6d30537f925eaa5bb49de40b66800f6866
3
+ metadata.gz: 11ebfed52f241e9d4ba3b890e5bb1e09af66fd33
4
+ data.tar.gz: 40c5fa4cf017e73812854572cf793a1050c08d66
5
5
  SHA512:
6
- metadata.gz: 6fee97bb7d388704adcf932bb07e7ddb0121c0c06fb4ee24f09b5a26d0aa8cebd36185387e626e2fe2d748f6c0acfd63dc87fe04afdac00f07d51ab310993ac7
7
- data.tar.gz: 4388708385f4134e054f821a1bdea62bcd987771724abbab92c39d2e6a5df67d1618d2828abfce2393e02ac532d8a5394e7fff4002c4509cf23e04b8ac64c4de
6
+ metadata.gz: 8af7884cd085bc0cdafd1e2be084114f851863b8aa5dd190369cf63da3c2d8415b00e3829c2a90aa583d63764add9653b23d4dca21310d9045a2b621272e423d
7
+ data.tar.gz: 3dccdc5f667f7c8e0445042bce56a8dac95bee4088027de0bbd182ab30d8dac3111ea72d0f879463029039441fa216e0758ef9f2773e05fecee56204e85ee5ac
@@ -2,36 +2,35 @@ require 'aws-sdk'
2
2
  require 'digest'
3
3
  module Menu
4
4
  class Release < OpenStruct
5
+ attr_accessor :options
6
+
5
7
  def <=> o
6
8
  version <=> o.version
7
9
  end
8
10
 
9
- def upload_payload options
11
+ def upload_payload
10
12
  unless File.exists? @payload_file
11
13
  puts "Could not open payload"
12
14
  exit 1
13
15
  end
14
16
  s3 = Aws::S3::Client.new(region: 'us-east-1')
15
- key = "#{options.component}/v#{self.version}-#{checksum}#{File.extname(@payload_file)}"
16
- puts "Uploading payload (#{key}) to S3..." if options.verbose
17
+ key = "#{options.component}/v#{self.version}-#{@checksum}#{File.extname(@payload_file)}"
18
+ puts "Uploading payload (#{key}) to S3..." if @options.verbose
17
19
  s3.put_object(
18
20
  acl: "public-read",
19
21
  body: File.open(@payload_file),
20
- bucket: options.bucket,
22
+ bucket: @options.bucket,
21
23
  key: key
22
24
  )
23
- puts "Upload complete." if options.verbose
25
+ puts "Upload complete." if @options.verbose
24
26
  self.payload = ENV['MENU_SSL_URL'] + '/' + key
25
27
  end
26
28
 
27
29
  def payload_file= file
28
30
  @payload_file = file
31
+ puts "Calcuating checksum..." if @options.verbose
29
32
  @checksum = Digest::MD5.file(file).hexdigest
30
- end
31
-
32
- def checksum
33
- raise "No payload" unless @checksum
34
- @checksum
33
+ puts "Checksum: "+ @checksum
35
34
  end
36
35
 
37
36
  def to_json s
@@ -39,7 +38,7 @@ module Menu
39
38
  version: version,
40
39
  beta: beta,
41
40
  payload: payload,
42
- md5: checksum
41
+ md5: @checksum
43
42
  }.to_json
44
43
  end
45
44
  end
@@ -8,6 +8,7 @@ module Menu
8
8
  if response.success?
9
9
  Releases.from_array response.body['releases']
10
10
  else
11
+ puts "New component, creating empty list"
11
12
  Releases.new
12
13
  end
13
14
  end
@@ -19,10 +19,11 @@ module Menu
19
19
  log "Beta release" if @options.beta
20
20
 
21
21
  r = Release.new
22
+ r.options = @options
22
23
  r.version = version
23
24
  r.payload_file = @options.payload
24
25
  r.beta = @options.beta
25
- r.upload_payload @options
26
+ r.upload_payload
26
27
 
27
28
  releases << r
28
29
 
@@ -1,3 +1,3 @@
1
1
  module Menu
2
- VERSION = "0.3"
2
+ VERSION = "0.3.1"
3
3
  end
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.3'
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kurt Nelson