shipt 0.0.6 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (8) hide show
  1. data/Gemfile +1 -1
  2. data/Gemfile.lock +12 -14
  3. data/Rakefile +2 -2
  4. data/VERSION +1 -1
  5. data/bin/shipt +2 -2
  6. data/lib/shipt.rb +8 -5
  7. data/shipt.gemspec +8 -8
  8. metadata +9 -18
data/Gemfile CHANGED
@@ -5,6 +5,6 @@ gem 'trollop'
5
5
 
6
6
  group :test do
7
7
  gem 'autotest'
8
- gem 'rspec', '~> 2.0.0.beta.22'
8
+ gem 'rspec', '~> 2.0.0.beta.18'
9
9
  gem 'yard'
10
10
  end
data/Gemfile.lock CHANGED
@@ -4,8 +4,8 @@ GEM
4
4
  autotest (4.3.2)
5
5
  builder (2.1.2)
6
6
  diff-lcs (1.1.2)
7
- excon (0.2.2)
8
- fog (0.2.30)
7
+ excon (0.2.0)
8
+ fog (0.2.22)
9
9
  builder
10
10
  excon (>= 0.2.0)
11
11
  formatador (>= 0.0.15)
@@ -15,23 +15,21 @@ GEM
15
15
  nokogiri (>= 1.4.3.1)
16
16
  ruby-hmac
17
17
  formatador (0.0.15)
18
- json (1.4.6)
18
+ json (1.4.4)
19
19
  mime-types (1.16)
20
20
  net-ssh (2.0.23)
21
21
  nokogiri (1.4.3.1)
22
- rspec (2.0.0.beta.22)
23
- rspec-core (= 2.0.0.beta.22)
24
- rspec-expectations (= 2.0.0.beta.22)
25
- rspec-mocks (= 2.0.0.beta.22)
26
- rspec-core (2.0.0.beta.22)
27
- rspec-expectations (2.0.0.beta.22)
22
+ rspec (2.0.0.beta.19)
23
+ rspec-core (= 2.0.0.beta.19)
24
+ rspec-expectations (= 2.0.0.beta.19)
25
+ rspec-mocks (= 2.0.0.beta.19)
26
+ rspec-core (2.0.0.beta.19)
27
+ rspec-expectations (2.0.0.beta.19)
28
28
  diff-lcs (>= 1.1.2)
29
- rspec-mocks (2.0.0.beta.22)
30
- rspec-core (= 2.0.0.beta.22)
31
- rspec-expectations (= 2.0.0.beta.22)
29
+ rspec-mocks (2.0.0.beta.19)
32
30
  ruby-hmac (0.4.0)
33
31
  trollop (1.16.2)
34
- yard (0.6.1)
32
+ yard (0.5.8)
35
33
 
36
34
  PLATFORMS
37
35
  ruby
@@ -39,6 +37,6 @@ PLATFORMS
39
37
  DEPENDENCIES
40
38
  autotest
41
39
  fog
42
- rspec (~> 2.0.0.beta.22)
40
+ rspec (~> 2.0.0.beta.18)
43
41
  trollop
44
42
  yard
data/Rakefile CHANGED
@@ -10,9 +10,9 @@ begin
10
10
  gem.email = "justin.smestad@gmail.com"
11
11
  gem.homepage = "http://github.com/jsmestad/shipt"
12
12
  gem.authors = ["Justin Smestad"]
13
- gem.add_dependency "fog", '~> 0.2.30'
13
+ gem.add_dependency "fog", '~> 0.2.22'
14
14
  gem.add_dependency "trollop", '~> 1.16.2'
15
- gem.add_development_dependency "rspec", ">= 2.0.0.beta.22"
15
+ gem.add_development_dependency "rspec", ">= 1.2.9"
16
16
  gem.add_development_dependency "yard", ">= 0"
17
17
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
18
18
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.6
1
+ 0.1.2
data/bin/shipt CHANGED
@@ -16,11 +16,11 @@ opts = Trollop::options do
16
16
  EOS
17
17
 
18
18
  opt :namespace, "Namespace for buckets", :type => :string, :default => ENV['AWS_BUCKET_NAMESPACE']
19
- opt :description, "Additional descriptor tag", :type => :string, :default => nil
20
19
  opt :bucket, "Bucket name, should be server name", :type => :string, :default => ENV['AWS_BUCKET_NAME']
20
+ opt :descriptor, "Additional description", :type => :string, :default => ''
21
21
  opt :access_key, "Amazon Access Key", :type => :string, :default => ENV['AWS_ACCESS_KEY']
22
22
  opt :secret_key, "Amazon Secret Access Key", :type => :string, :default => ENV['AWS_SECRET_KEY']
23
- opt :cleanup, "Cleanup the file after completion?", :default => false, :default => ENV['SHIPT_CLEANUP']
23
+ opt :cleanup, "Cleanup the file after completion?", :type => :boolean, :default => false
24
24
  end
25
25
 
26
26
  s = Shipt.new(opts[:bucket], opts)
data/lib/shipt.rb CHANGED
@@ -1,14 +1,14 @@
1
1
  require 'fog'
2
2
  require 'logger'
3
+ require 'time'
3
4
 
4
5
  class Shipt
5
6
 
6
7
  def initialize(bucket_key, options={})
7
8
  raise RuntimeError unless options[:access_key] && options[:secret_key]
8
9
 
9
- @server_name = bucket_key
10
- @bucket_key = "#{options[:namespace]}-#{bucket_key}"
11
- @description = options[:description]
10
+ @name = [bucket_key, options[:descriptor]].join('-')
11
+ @bucket_key = [options[:namespace], bucket_key].join('-')
12
12
  @access_key = options[:access_key]
13
13
  @secret_key = options[:secret_key]
14
14
  @logger = Logger.new(options[:logger] || STDOUT)
@@ -16,10 +16,13 @@ class Shipt
16
16
 
17
17
  def upload_file(path)
18
18
  ext = File.extname(path)
19
+
20
+ timestamp = File.basename(path) =~ /\.log\.([\d-]*T[\d-]+)\./ ? $1 : Time.now.utc.strftime("%Y-%m-%dT%H:%M:%S%Z")
21
+
19
22
  key_name = if ext == '.log'
20
- "#{@server_name}-#{@description}-#{Time.now.strftime("%Y%m%d-%H%M%S")}#{ext}"
23
+ "#{@name}-#{timestamp}#{ext}"
21
24
  else
22
- "#{@server_name}-#{@description}-#{Time.now.strftime("%Y%m%d-%H%M%S")}.log#{ext}"
25
+ "#{@name}-#{timestamp}.log#{ext}"
23
26
  end
24
27
 
25
28
  @logger.info "Uploading \"#{path}\" => \"#{key_name}\""
data/shipt.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{shipt}
8
- s.version = "0.0.6"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Justin Smestad"]
12
- s.date = %q{2010-09-18}
12
+ s.date = %q{2011-02-21}
13
13
  s.default_executable = %q{shipt}
14
14
  s.description = %q{longer description of your gem}
15
15
  s.email = %q{justin.smestad@gmail.com}
@@ -52,20 +52,20 @@ Gem::Specification.new do |s|
52
52
  s.specification_version = 3
53
53
 
54
54
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
55
- s.add_runtime_dependency(%q<fog>, ["~> 0.2.30"])
55
+ s.add_runtime_dependency(%q<fog>, ["~> 0.2.22"])
56
56
  s.add_runtime_dependency(%q<trollop>, ["~> 1.16.2"])
57
- s.add_development_dependency(%q<rspec>, [">= 2.0.0.beta.22"])
57
+ s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
58
58
  s.add_development_dependency(%q<yard>, [">= 0"])
59
59
  else
60
- s.add_dependency(%q<fog>, ["~> 0.2.30"])
60
+ s.add_dependency(%q<fog>, ["~> 0.2.22"])
61
61
  s.add_dependency(%q<trollop>, ["~> 1.16.2"])
62
- s.add_dependency(%q<rspec>, [">= 2.0.0.beta.22"])
62
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
63
63
  s.add_dependency(%q<yard>, [">= 0"])
64
64
  end
65
65
  else
66
- s.add_dependency(%q<fog>, ["~> 0.2.30"])
66
+ s.add_dependency(%q<fog>, ["~> 0.2.22"])
67
67
  s.add_dependency(%q<trollop>, ["~> 1.16.2"])
68
- s.add_dependency(%q<rspec>, [">= 2.0.0.beta.22"])
68
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
69
69
  s.add_dependency(%q<yard>, [">= 0"])
70
70
  end
71
71
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shipt
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
- - 0
9
- - 6
10
- version: 0.0.6
7
+ - 1
8
+ - 2
9
+ version: 0.1.2
11
10
  platform: ruby
12
11
  authors:
13
12
  - Justin Smestad
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-09-18 00:00:00 -06:00
17
+ date: 2011-02-21 00:00:00 -07:00
19
18
  default_executable: shipt
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
@@ -26,12 +25,11 @@ dependencies:
26
25
  requirements:
27
26
  - - ~>
28
27
  - !ruby/object:Gem::Version
29
- hash: 43
30
28
  segments:
31
29
  - 0
32
30
  - 2
33
- - 30
34
- version: 0.2.30
31
+ - 22
32
+ version: 0.2.22
35
33
  type: :runtime
36
34
  version_requirements: *id001
37
35
  - !ruby/object:Gem::Dependency
@@ -42,7 +40,6 @@ dependencies:
42
40
  requirements:
43
41
  - - ~>
44
42
  - !ruby/object:Gem::Version
45
- hash: 83
46
43
  segments:
47
44
  - 1
48
45
  - 16
@@ -58,14 +55,11 @@ dependencies:
58
55
  requirements:
59
56
  - - ">="
60
57
  - !ruby/object:Gem::Version
61
- hash: 62196431
62
58
  segments:
59
+ - 1
63
60
  - 2
64
- - 0
65
- - 0
66
- - beta
67
- - 22
68
- version: 2.0.0.beta.22
61
+ - 9
62
+ version: 1.2.9
69
63
  type: :development
70
64
  version_requirements: *id003
71
65
  - !ruby/object:Gem::Dependency
@@ -76,7 +70,6 @@ dependencies:
76
70
  requirements:
77
71
  - - ">="
78
72
  - !ruby/object:Gem::Version
79
- hash: 3
80
73
  segments:
81
74
  - 0
82
75
  version: "0"
@@ -123,7 +116,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
116
  requirements:
124
117
  - - ">="
125
118
  - !ruby/object:Gem::Version
126
- hash: 3
127
119
  segments:
128
120
  - 0
129
121
  version: "0"
@@ -132,7 +124,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
124
  requirements:
133
125
  - - ">="
134
126
  - !ruby/object:Gem::Version
135
- hash: 3
136
127
  segments:
137
128
  - 0
138
129
  version: "0"