travis-artifacts 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- travis-artifacts (0.0.1)
4
+ travis-artifacts (0.0.2)
5
5
  faraday
6
6
  faraday_middleware
7
7
  fog
@@ -11,12 +11,12 @@ GEM
11
11
  specs:
12
12
  builder (3.1.4)
13
13
  diff-lcs (1.1.3)
14
- excon (0.16.8)
14
+ excon (0.16.10)
15
15
  faraday (0.8.4)
16
16
  multipart-post (~> 1.1)
17
17
  faraday_middleware (0.9.0)
18
18
  faraday (>= 0.7.4, < 0.9)
19
- fog (1.7.0)
19
+ fog (1.8.0)
20
20
  builder
21
21
  excon (~> 0.14)
22
22
  formatador (~> 0.2.0)
@@ -28,12 +28,12 @@ GEM
28
28
  ruby-hmac
29
29
  formatador (0.2.4)
30
30
  mime-types (1.19)
31
- multi_json (1.3.7)
31
+ multi_json (1.5.0)
32
32
  multipart-post (1.1.5)
33
33
  net-scp (1.0.4)
34
34
  net-ssh (>= 1.99.1)
35
- net-ssh (2.6.1)
36
- nokogiri (1.5.5)
35
+ net-ssh (2.6.2)
36
+ nokogiri (1.5.6)
37
37
  rspec (2.12.0)
38
38
  rspec-core (~> 2.12.0)
39
39
  rspec-expectations (~> 2.12.0)
data/bin/travis-artifacts CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  $: << File.expand_path('../../lib', __FILE__)
4
4
 
5
- require 'bundler/setup'
6
5
  require 'travis/artifacts'
7
6
 
8
7
  Travis::Artifacts::Cli.new(ARGV).start
@@ -9,7 +9,7 @@ module Travis::Artifacts
9
9
 
10
10
  def initialize(argv = nil)
11
11
  @argv = argv || ARGV
12
- @options = { :paths => [] }
12
+ @options = { :paths => [], :private => false }
13
13
  @paths = []
14
14
  @client = Travis::Client.new
15
15
  end
@@ -29,7 +29,7 @@ module Travis::Artifacts
29
29
  end
30
30
 
31
31
  def upload
32
- Uploader.new(paths, options[:target_path]).upload
32
+ Uploader.new(paths, options).upload
33
33
  end
34
34
 
35
35
  private
@@ -83,6 +83,10 @@ module Travis::Artifacts
83
83
  options[:root] = root
84
84
  end
85
85
 
86
+ opt.on('--private', 'make artifacts non-public') do |root|
87
+ options[:private] = true
88
+ end
89
+
86
90
  opt.on('-h','--help','help') do
87
91
  puts @opt_parser
88
92
  end
@@ -7,10 +7,11 @@ module Travis::Artifacts
7
7
 
8
8
  attr_reader :paths, :target_path
9
9
 
10
- def initialize(paths, target_path = nil)
10
+ def initialize(paths, options = {})
11
11
  @paths = paths
12
12
  @test = Test.new
13
- @target_path = target_path || "artifacts/#{@test.build_number}/#{@test.job_number}"
13
+ @public = ! (options[:private]||false)
14
+ @target_path = options[:target_path] || "artifacts/#{@test.build_number}/#{@test.job_number}"
14
15
  end
15
16
 
16
17
  def upload
@@ -77,11 +78,11 @@ module Travis::Artifacts
77
78
  def _upload(file)
78
79
  destination = File.join(target_path, file.destination)
79
80
 
80
- logger.info "Uploading file #{file.source} to #{destination}"
81
+ logger.info "Uploading file #{file.source} to #{destination}, public: #{@public}"
81
82
 
82
83
  bucket.files.create({
83
84
  :key => destination,
84
- :public => true,
85
+ :public => @public,
85
86
  :body => file.read,
86
87
  :content_type => file.content_type,
87
88
  :metadata => { "Cache-Control" => 'public, max-age=315360000'}
@@ -24,7 +24,9 @@ module Travis::Artifacts
24
24
  let(:argv) { ['upload', '--path', 'foo', '--target-path', 'bar'] }
25
25
  it 'calls Uploader with given paths and target_path' do
26
26
  uploader = mock('uploader')
27
- Uploader.should_receive(:new).with([Path.new('foo', nil, Dir.pwd)], 'bar').and_return(uploader)
27
+ Uploader.should_receive(:new).with([Path.new('foo', nil, Dir.pwd)], \
28
+ {:paths=>["foo"], :private=>false, :target_path=>"bar"}\
29
+ ).and_return(uploader)
28
30
  uploader.should_receive(:upload)
29
31
 
30
32
  cli.start
@@ -2,11 +2,11 @@ require 'spec_helper'
2
2
 
3
3
  module Travis::Artifacts
4
4
  describe Uploader do
5
- let(:uploader) { Uploader.new(paths, 'artifacts/1') }
5
+ let(:uploader) { Uploader.new(paths, {:target_path =>'artifacts/1'}) }
6
6
  let(:paths) { [] }
7
7
 
8
8
  context 'without given target_path' do
9
- let(:uploader) { Uploader.new(paths, nil) }
9
+ let(:uploader) { Uploader.new(paths) }
10
10
 
11
11
  it 'sets a default' do
12
12
  test = mock('test', :job_number => "10.1", :build_number => "10")
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'travis-artifacts'
3
- s.version = '0.0.2'
3
+ s.version = '0.0.3'
4
4
 
5
5
  s.description = 'Travis build artifacts tools'
6
6
  s.summary = s.description
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: travis-artifacts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-18 00:00:00.000000000 Z
12
+ date: 2013-01-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fog