s3stream 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ coverage/*
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm 1.9.3@s3stream --create
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in s3stream.gemspec
4
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,14 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard 'bundler' do
5
+ watch('Gemfile')
6
+ watch(/^.+\.gemspec/)
7
+ end
8
+
9
+ guard 'rspec', :cli => '-c --format documentation -r ./spec/spec_helper.rb',
10
+ :version => 2 do
11
+ watch(%r{^spec/.+_spec\.rb})
12
+ watch(%r{^lib/(.+)\.rb}) { |m| "spec/lib/#{m[1]}_spec.rb" }
13
+ watch('spec/spec_helper.rb') { "spec" }
14
+ end
data/README ADDED
@@ -0,0 +1,28 @@
1
+ Installation
2
+ ============
3
+
4
+ gem install s3stream
5
+
6
+ Configuration
7
+ =============
8
+
9
+ export AMAZON_ACCESS_KEY_ID='abcdefghijklmnop'
10
+ export AMAZON_SECRET_ACCESS_KEY='1234567891012345'
11
+
12
+ Usage
13
+ =====
14
+ From the command line:
15
+
16
+ % s3stream fetch mybucket myfile.dat > /tmp/myfile.dat
17
+ % s3stream store mybucket myfile.dat < /tmp/myfile.dat
18
+
19
+ And if you want to get fancy:
20
+
21
+ % cat <(s3stream fetch mybucket log0.log.gz | gunzip) <(s3stream fetch mybucket log1.log.gz | gunzip) | gzip > s3stream store mybucket combined.log.gz
22
+
23
+
24
+ Development
25
+ ===========
26
+ gem install bundler
27
+ bundle install
28
+ guard
data/Rakefile ADDED
@@ -0,0 +1,24 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ desc "Run all specs"
5
+ RSpec::Core::RakeTask.new(:spec) do |t|
6
+ t.rspec_opts = [
7
+ '-c',
8
+ '--format documentation',
9
+ '-r ./spec/spec_helper.rb'
10
+ ]
11
+ t.pattern = 'spec/**/*_spec.rb'
12
+ end
13
+
14
+ desc "open coverage report"
15
+ task :coverage do
16
+ system 'rake spec'
17
+ system 'open coverage/index.html'
18
+ end
19
+
20
+ desc "Open development console"
21
+ task :console do
22
+ puts "Loading development console..."
23
+ system "irb -I #{File.join('.', 'lib')} -r #{File.join('.', 'lib', 's3stream')}"
24
+ end
data/bin/s3stream ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "s3stream"
4
+ S3Stream::Main.start
@@ -0,0 +1,3 @@
1
+ module S3Stream
2
+ VERSION = "0.0.1"
3
+ end
data/lib/s3stream.rb ADDED
@@ -0,0 +1,19 @@
1
+ require "s3stream/version"
2
+ require "thor"
3
+ require "aws/s3"
4
+
5
+ module S3Stream
6
+ class Main < Thor
7
+ desc "fetch bucket filename", "download/stream the file from S3 to stdout"
8
+ def fetch(bucket, filename)
9
+ AWS::S3::S3Object.stream(filename, bucket) do |chunk|
10
+ $stdout.write chunk
11
+ end
12
+ end
13
+
14
+ desc "store bucket filename", "upload/stream the file from stdin to S3"
15
+ def store(bucket, filename)
16
+ AWS::S3::S3Object.store(filename, ARGF, bucket)
17
+ end
18
+ end
19
+ end
data/s3stream.gemspec ADDED
@@ -0,0 +1,29 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "s3stream/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "s3stream"
7
+ s.version = S3Stream::VERSION
8
+ s.authors = ["Chris Johnson"]
9
+ s.email = ["chris@kindkid.com"]
10
+ s.homepage = ""
11
+ s.summary = "Stream files on S3 to stdout or from stdin"
12
+ s.description = s.summary
13
+
14
+ s.rubyforge_project = "s3stream"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_runtime_dependency "aws-s3", "~> 0.6.2"
22
+ s.add_runtime_dependency "thor", "~> 0.14.6"
23
+ s.add_development_dependency "rspec", "~> 2.6"
24
+ s.add_development_dependency "simplecov", "~> 0.4"
25
+ s.add_development_dependency("rb-fsevent", "~> 0.4") if RUBY_PLATFORM =~ /darwin/i
26
+ s.add_development_dependency "guard", "~> 0.5"
27
+ s.add_development_dependency "guard-bundler", "~> 0.1"
28
+ s.add_development_dependency "guard-rspec", "~> 0.4"
29
+ end
@@ -0,0 +1,3 @@
1
+ describe S3Stream do
2
+ it "should have specs"
3
+ end
@@ -0,0 +1,7 @@
1
+ require 'simplecov'
2
+ SimpleCov.start
3
+
4
+ require 'rubygems'
5
+ require 'bundler'
6
+
7
+ Bundler.require(:default, :test, :development)
metadata ADDED
@@ -0,0 +1,148 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: s3stream
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Chris Johnson
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-02-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: aws-s3
16
+ requirement: &70202792479320 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 0.6.2
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70202792479320
25
+ - !ruby/object:Gem::Dependency
26
+ name: thor
27
+ requirement: &70202792477020 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 0.14.6
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70202792477020
36
+ - !ruby/object:Gem::Dependency
37
+ name: rspec
38
+ requirement: &70202792476260 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: '2.6'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70202792476260
47
+ - !ruby/object:Gem::Dependency
48
+ name: simplecov
49
+ requirement: &70202792475440 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '0.4'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *70202792475440
58
+ - !ruby/object:Gem::Dependency
59
+ name: rb-fsevent
60
+ requirement: &70202792474420 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: '0.4'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *70202792474420
69
+ - !ruby/object:Gem::Dependency
70
+ name: guard
71
+ requirement: &70202792473580 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ version: '0.5'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *70202792473580
80
+ - !ruby/object:Gem::Dependency
81
+ name: guard-bundler
82
+ requirement: &70202792472000 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ~>
86
+ - !ruby/object:Gem::Version
87
+ version: '0.1'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *70202792472000
91
+ - !ruby/object:Gem::Dependency
92
+ name: guard-rspec
93
+ requirement: &70202792470520 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ~>
97
+ - !ruby/object:Gem::Version
98
+ version: '0.4'
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: *70202792470520
102
+ description: Stream files on S3 to stdout or from stdin
103
+ email:
104
+ - chris@kindkid.com
105
+ executables:
106
+ - s3stream
107
+ extensions: []
108
+ extra_rdoc_files: []
109
+ files:
110
+ - .gitignore
111
+ - .rvmrc
112
+ - Gemfile
113
+ - Guardfile
114
+ - README
115
+ - Rakefile
116
+ - bin/s3stream
117
+ - lib/s3stream.rb
118
+ - lib/s3stream/version.rb
119
+ - s3stream.gemspec
120
+ - spec/lib/s3stream_spec.rb
121
+ - spec/spec_helper.rb
122
+ homepage: ''
123
+ licenses: []
124
+ post_install_message:
125
+ rdoc_options: []
126
+ require_paths:
127
+ - lib
128
+ required_ruby_version: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
+ none: false
136
+ requirements:
137
+ - - ! '>='
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ requirements: []
141
+ rubyforge_project: s3stream
142
+ rubygems_version: 1.8.10
143
+ signing_key:
144
+ specification_version: 3
145
+ summary: Stream files on S3 to stdout or from stdin
146
+ test_files:
147
+ - spec/lib/s3stream_spec.rb
148
+ - spec/spec_helper.rb