titanic 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/ship +81 -0
  2. data/lib/titanic/version.rb +1 -1
  3. metadata +5 -3
data/bin/ship ADDED
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # -*- mode: shell -*-
4
+
5
+ require 'titanic'
6
+
7
+ require 'trollop'
8
+
9
+ options = Trollop::options do
10
+ version "titanic #{Titanic::VERSION} (c) 2013 Airbnb"
11
+ banner "Titanic: ship it!"
12
+
13
+ opt('project',
14
+ 'name of the project that you want to ship',
15
+ :type => String,
16
+ :default => ENV['PROJECT']
17
+ )
18
+
19
+ opt('path',
20
+ 'path to an artifact that you want to store',
21
+ :type => String,
22
+ )
23
+
24
+ opt('uuid',
25
+ 'unique name of an artifact',
26
+ :type => String,
27
+ )
28
+
29
+ opt('bucket',
30
+ 'which s3 bucket should builds be put in',
31
+ :type => String,
32
+ :default => ENV['BUCKET'] || 'sssp'
33
+ )
34
+
35
+ opt('prefix',
36
+ 'an optional prefix to prepend to the s3 path',
37
+ :type => String,
38
+ :default => ENV['PREFIX'] || 'titanic/'
39
+ )
40
+
41
+ opt('access_key',
42
+ "aws access key",
43
+ :type => String,
44
+ :default => ENV['AWS_ACCESS_KEY']
45
+ )
46
+
47
+ opt('secret_key',
48
+ "aws secret key",
49
+ :type => String,
50
+ :default => ENV['AWS_SECRET_KEY']
51
+ )
52
+
53
+
54
+ end
55
+
56
+ required_parameters = [
57
+ 'project',
58
+ 'path',
59
+ 'uuid',
60
+ 'bucket',
61
+ 'prefix',
62
+ 'access_key',
63
+ 'secret_key',
64
+ ]
65
+
66
+ required_parameters.each do |arg|
67
+ raise ArgumentError, "--#{arg.gsub('_','-')} needs to be specified on the commandline or set \
68
+ by the #{arg.upcase.gsub('-','_')} environment variable" if
69
+ options[arg].nil? or ! options[arg]
70
+ end
71
+
72
+ puts "options are #{options}"
73
+
74
+ # create titanic object
75
+ titanic = Titanic::Titanic.new(options)
76
+
77
+ raise "the artifact that you specified '#{options['path']}' does not exist" unless
78
+ File.exists? options['path']
79
+
80
+ # put artifact
81
+ titanic.put_build options['uuid'], options['path']
@@ -1,3 +1,3 @@
1
1
  module Titanic
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: titanic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
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: 2013-05-02 00:00:00.000000000 Z
12
+ date: 2013-05-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -62,7 +62,8 @@ dependencies:
62
62
  description: deploys, published, and consumes stuff
63
63
  email:
64
64
  - martin.rhoads@airbnb.com
65
- executables: []
65
+ executables:
66
+ - ship
66
67
  extensions: []
67
68
  extra_rdoc_files: []
68
69
  files:
@@ -71,6 +72,7 @@ files:
71
72
  - LICENSE.txt
72
73
  - README.md
73
74
  - Rakefile
75
+ - bin/ship
74
76
  - lib/titanic.rb
75
77
  - lib/titanic/version.rb
76
78
  - titanic.gemspec