public
Description: A command-line client for Amazon Web Services
Homepage: http://rubyforge.org/projects/cliaws
Clone URL: git://github.com/francois/cliaws.git
Search Repo:
Initial implementation of S3 client.
francois (author)
Sat Apr 12 04:43:39 -0700 2008
commit  7b5b743bcbbd63b0a060c1025c7e102ad9b10fac
tree    02ba9ad4a8142f5bc7df50957f66e5dd59d287da
...
 
 
...
1
2
0
@@ -0,0 +1,2 @@
0
+*.swp
0
+*.log
...
 
 
 
...
1
2
3
0
@@ -0,0 +1,3 @@
0
+== 1.0.0 2008-04-12
0
+
0
+* Implemented s3 command-line client.
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
0
@@ -0,0 +1,20 @@
0
+Copyright (c) 2008 FIXME full name
0
+
0
+Permission is hereby granted, free of charge, to any person obtaining
0
+a copy of this software and associated documentation files (the
0
+"Software"), to deal in the Software without restriction, including
0
+without limitation the rights to use, copy, modify, merge, publish,
0
+distribute, sublicense, and/or sell copies of the Software, and to
0
+permit persons to whom the Software is furnished to do so, subject to
0
+the following conditions:
0
+
0
+The above copyright notice and this permission notice shall be
0
+included in all copies or substantial portions of the Software.
0
+
0
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
0
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
0
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
0
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
0
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
0
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
0
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0
\ No newline at end of file
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
0
@@ -0,0 +1,74 @@
0
+.git/HEAD
0
+.git/config
0
+.git/description
0
+.git/hooks/applypatch-msg
0
+.git/hooks/commit-msg
0
+.git/hooks/post-commit
0
+.git/hooks/post-receive
0
+.git/hooks/post-update
0
+.git/hooks/pre-applypatch
0
+.git/hooks/pre-commit
0
+.git/hooks/pre-rebase
0
+.git/hooks/update
0
+.git/index
0
+.git/info/exclude
0
+.git/objects/05/f16e5820df4cd04d47f1b6d45775e6d355da8f
0
+.git/objects/10/aab6490174970a2349d1050882c644f8d07006
0
+.git/objects/13/b2cc84b2cf89e4aeb521ae66bd19452dc70c65
0
+.git/objects/13/d5d1ef084e0024f37d64175f398a62ee582b62
0
+.git/objects/2c/84cd00c156ba3b46e733c7e34dd9aea0c4fa75
0
+.git/objects/2e/c70738bfe40e0af8067e1679e9c10f976d5a32
0
+.git/objects/2f/437425b2c085bb529379e409d6b4bc7f9f9fba
0
+.git/objects/35/a04b4611fd28bd42be329ad469a5310272ac67
0
+.git/objects/3d/88d2e2caa6d54eb7774dfc8ea23cb743014b19
0
+.git/objects/42/4a5f37c6fe3a7cac54b0f85688c1cce7da9cdf
0
+.git/objects/50/7969fe515fe7fbfdbcdf258ed18b49202e28ca
0
+.git/objects/51/e42ecca9eba28a16dd46f8fdb4ba0a75220498
0
+.git/objects/69/1ed3b65603a0d0dabfb66720e7163664be78f5
0
+.git/objects/7e/5d40ec56733dca8ff27293ccf12b069b31a2ad
0
+.git/objects/80/eb1fabe09ca71da5f7b42c67ba27266e080ade
0
+.git/objects/92/92b696aba9840c089241c68d4c6ca14be38a64
0
+.git/objects/93/e03faa6906892434fa9f2ad230c4ececc64055
0
+.git/objects/aa/dc556610b82dc2b8ecf0a2d88adb8980698dbb
0
+.git/objects/ae/3115d44494b86cb55ba2184f6cd332f36e1158
0
+.git/objects/af/c3ea327fa220ee42a5ebecfcc7d218be4ea1d9
0
+.git/objects/c2/7f6559350f7adb19d43742b55b2f91d07b6550
0
+.git/objects/cc/f7eb41367f1c943e440649a2d928c768f6de82
0
+.git/objects/da/4f914099ec2007ac0f61b1d8841fbaa325caec
0
+.git/objects/db/e20c21b83f82742b244521c3041fc01dfb62fa
0
+.git/objects/de/88e125f824ff1def1bb2e19c46ef95fe440b64
0
+.git/objects/de/cdd88294b30a450ee4f7a7b0a0b8919cf4288b
0
+.git/objects/e4/69154c2ae4c3c596870a5e920f197b7b5be179
0
+.git/objects/e4/8464df56bf487e96e21ea99487330266dae3c9
0
+.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
0
+.git/objects/e8/517350dbaadcb01282282218638c6022a20091
0
+History.txt
0
+License.txt
0
+Manifest.txt
0
+README.txt
0
+Rakefile
0
+bin/ec2
0
+bin/s3
0
+bin/sdb
0
+bin/sqs
0
+config/hoe.rb
0
+config/requirements.rb
0
+lib/cliaws.rb
0
+lib/cliaws/s3.rb
0
+lib/cliaws/version.rb
0
+log/.gitignore
0
+script/console
0
+script/destroy
0
+script/generate
0
+script/txt2html
0
+setup.rb
0
+tasks/deployment.rake
0
+tasks/environment.rake
0
+tasks/website.rake
0
+test/test_cliaws.rb
0
+test/test_helper.rb
0
+website/index.html
0
+website/index.txt
0
+website/javascripts/rounded_corners_lite.inc.js
0
+website/stylesheets/screen.css
0
+website/template.html.erb
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
0
@@ -0,0 +1,48 @@
0
+= cliaws
0
+
0
+* FIX (url)
0
+
0
+== DESCRIPTION:
0
+
0
+FIX (describe your package)
0
+
0
+== FEATURES/PROBLEMS:
0
+
0
+* FIX (list of features or problems)
0
+
0
+== SYNOPSIS:
0
+
0
+ FIX (code sample of usage)
0
+
0
+== REQUIREMENTS:
0
+
0
+* FIX (list of requirements)
0
+
0
+== INSTALL:
0
+
0
+* FIX (sudo gem install, anything else)
0
+
0
+== LICENSE:
0
+
0
+(The MIT License)
0
+
0
+Copyright (c) 2008 FIX
0
+
0
+Permission is hereby granted, free of charge, to any person obtaining
0
+a copy of this software and associated documentation files (the
0
+'Software'), to deal in the Software without restriction, including
0
+without limitation the rights to use, copy, modify, merge, publish,
0
+distribute, sublicense, and/or sell copies of the Software, and to
0
+permit persons to whom the Software is furnished to do so, subject to
0
+the following conditions:
0
+
0
+The above copyright notice and this permission notice shall be
0
+included in all copies or substantial portions of the Software.
0
+
0
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
0
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
0
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
0
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
0
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
0
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
0
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0
\ No newline at end of file
...
 
 
 
 
0
...
1
2
3
4
5
0
@@ -0,0 +1,4 @@
0
+require 'config/requirements'
0
+require 'config/hoe' # setup Hoe + all gem configuration
0
+
0
+Dir['tasks/**/*.rake'].each { |rake| load rake }
0
\ No newline at end of file
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
0
@@ -0,0 +1,44 @@
0
+#!/usr/bin/env ruby
0
+#
0
+# Created on 2008-4-12.
0
+# Copyright (c) 2008. All rights reserved.
0
+
0
+begin
0
+ require 'rubygems'
0
+rescue LoadError
0
+ # no rubygems to load, so we fail silently
0
+end
0
+
0
+require 'optparse'
0
+
0
+# NOTE: the option -p/--path= is given as an example, and should probably be replaced in your application.
0
+
0
+OPTIONS = {
0
+ :path => '~'
0
+}
0
+MANDATORY_OPTIONS = %w( )
0
+
0
+parser = OptionParser.new do |opts|
0
+ opts.banner = <<BANNER
0
+This application is wonderful because...
0
+
0
+Usage: #{File.basename($0)} [options]
0
+
0
+Options are:
0
+BANNER
0
+ opts.separator ""
0
+ opts.on("-p", "--path=PATH", String,
0
+ "The root path for selecting files",
0
+ "Default: ~") { |OPTIONS[:path]| }
0
+ opts.on("-h", "--help",
0
+ "Show this help message.") { puts opts; exit }
0
+ opts.parse!(ARGV)
0
+
0
+ if MANDATORY_OPTIONS && MANDATORY_OPTIONS.find { |option| OPTIONS[option.to_sym].nil? }
0
+ puts opts; exit
0
+ end
0
+end
0
+
0
+path = OPTIONS[:path]
0
+
0
+# do stuff
0
\ No newline at end of file
0
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
0
@@ -0,0 +1,91 @@
0
+#!/usr/bin/env ruby
0
+#
0
+# Created on 2008-4-12.
0
+# Copyright (c) 2008. All rights reserved.
0
+
0
+begin
0
+ require 'rubygems'
0
+rescue LoadError
0
+ # no rubygems to load, so we fail silently
0
+end
0
+
0
+require "main"
0
+require "cliaws"
0
+
0
+Main {
0
+ argument("s3_object") do
0
+ required
0
+ argument_required
0
+ end
0
+
0
+ mode("list") do
0
+ def run
0
+ puts Cliaws.s3.list(params["s3_object"].value)
0
+ end
0
+ end
0
+
0
+ mode("touch") do
0
+ def run
0
+ Cliaws.s3.put("", params["s3_object"].value)
0
+ end
0
+ end
0
+
0
+ mode("put") do
0
+ argument("local_file") do
0
+ optional
0
+ argument_required
0
+ end
0
+
0
+ option("data") do
0
+ optional
0
+ argument_required
0
+ end
0
+
0
+ def run
0
+ if params["local_file"].given? && params["data"].given? then
0
+ abort "Cannot give both the --data and local_file parameters at the same time"
0
+ elsif !params["local_file"].given? && !params["data"].given? then
0
+ abort "Missing both local_file and --data: what should I push to S3 ?"
0
+ elsif params["local_file"].given? then
0
+ source = File.open(params["local_file"].value, "rb")
0
+ else
0
+ source = params["data"].value
0
+ end
0
+
0
+ Cliaws.s3.put(source, params["s3_object"].value)
0
+ end
0
+ end
0
+
0
+ mode("rm") do
0
+ def run
0
+ Cliaws.s3.rm(params["s3_object"].value)
0
+ end
0
+ end
0
+
0
+ mode("get") do
0
+ argument("local_file") do
0
+ argument_required
0
+ optional
0
+ end
0
+
0
+ def run
0
+ if params["local_file"].given? then
0
+ dest = File.open(params["local_file"].value, "wb")
0
+ else
0
+ dest = STDOUT
0
+ end
0
+
0
+ Cliaws.s3.get(params["s3_object"].value, dest)
0
+ end
0
+ end
0
+
0
+ mode("head") do
0
+ def run
0
+ Cliaws.s3.head(params["s3_object"].value)
0
+ end
0
+ end
0
+
0
+ def run
0
+ abort "Required action argument missing. Run '#{$0} help' for details."
0
+ end
0
+}
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
0
@@ -0,0 +1,44 @@
0
+#!/usr/bin/env ruby
0
+#
0
+# Created on 2008-4-12.
0
+# Copyright (c) 2008. All rights reserved.
0
+
0
+begin
0
+ require 'rubygems'
0
+rescue LoadError
0
+ # no rubygems to load, so we fail silently
0
+end
0
+
0
+require 'optparse'
0
+
0
+# NOTE: the option -p/--path= is given as an example, and should probably be replaced in your application.
0
+
0
+OPTIONS = {
0
+ :path => '~'
0
+}
0
+MANDATORY_OPTIONS = %w( )
0
+
0
+parser = OptionParser.new do |opts|
0
+ opts.banner = <<BANNER
0
+This application is wonderful because...
0
+
0
+Usage: #{File.basename($0)} [options]
0
+
0
+Options are:
0
+BANNER
0
+ opts.separator ""
0
+ opts.on("-p", "--path=PATH", String,
0
+ "The root path for selecting files",
0
+ "Default: ~") { |OPTIONS[:path]| }
0
+ opts.on("-h", "--help",
0
+ "Show this help message.") { puts opts; exit }
0
+ opts.parse!(ARGV)
0
+
0
+ if MANDATORY_OPTIONS && MANDATORY_OPTIONS.find { |option| OPTIONS[option.to_sym].nil? }
0
+ puts opts; exit
0
+ end
0
+end
0
+
0
+path = OPTIONS[:path]
0
+
0
+# do stuff
0
\ No newline at end of file
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
0
@@ -0,0 +1,44 @@
0
+#!/usr/bin/env ruby
0
+#
0
+# Created on 2008-4-12.
0
+# Copyright (c) 2008. All rights reserved.
0
+
0
+begin
0
+ require 'rubygems'
0
+rescue LoadError
0
+ # no rubygems to load, so we fail silently
0
+end
0
+
0
+require 'optparse'
0
+
0
+# NOTE: the option -p/--path= is given as an example, and should probably be replaced in your application.
0
+
0
+OPTIONS = {
0
+ :path => '~'
0
+}
0
+MANDATORY_OPTIONS = %w( )
0
+
0
+parser = OptionParser.new do |opts|
0
+ opts.banner = <<BANNER
0
+This application is wonderful because...
0
+
0
+Usage: #{File.basename($0)} [options]
0
+
0
+Options are:
0
+BANNER
0
+ opts.separator ""
0
+ opts.on("-p", "--path=PATH", String,
0
+ "The root path for selecting files",
0
+ "Default: ~") { |OPTIONS[:path]| }
0
+ opts.on("-h", "--help",
0
+ "Show this help message.") { puts opts; exit }
0
+ opts.parse!(ARGV)
0
+
0
+ if MANDATORY_OPTIONS && MANDATORY_OPTIONS.find { |option| OPTIONS[option.to_sym].nil? }
0
+ puts opts; exit
0
+ end
0
+end
0
+
0
+path = OPTIONS[:path]
0
+
0
+# do stuff
0
\ No newline at end of file
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
0
@@ -0,0 +1,74 @@
0
+require 'cliaws/version'
0
+
0
+AUTHOR = 'François Beausoleil' # can also be an array of Authors
0
+EMAIL = "francois@teksol.info"
0
+DESCRIPTION = "A command-line suite of tools to access Amazon Web Services, using the RightAws gems."
0
+GEM_NAME = 'cliaws' # what ppl will type to install your gem
0
+RUBYFORGE_PROJECT = 'cliaws' # The unix name for your project
0
+HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
0
+DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
0
+
0
+@config_file = "~/.rubyforge/user-config.yml"
0
+@config = nil
0
+RUBYFORGE_USERNAME = "unknown"
0
+def rubyforge_username
0
+ unless @config
0
+ begin
0
+ @config = YAML.load(File.read(File.expand_path(@config_file)))
0
+ rescue
0
+ puts <<-EOS
0
+ERROR: No rubyforge config file found: #{@config_file}
0
+Run 'rubyforge setup' to prepare your env for access to Rubyforge
0
+ - See http://newgem.rubyforge.org/rubyforge.html for more details
0
+ EOS
0
+ exit
0
+ end
0
+ end
0
+ RUBYFORGE_USERNAME.replace @config["username"]
0
+end
0
+
0
+
0
+REV = nil
0
+# UNCOMMENT IF REQUIRED:
0
+# REV = YAML.load(`svn info`)['Revision']
0
+VERS = Cliaws::VERSION::STRING + (REV ? ".#{REV}" : "")
0
+RDOC_OPTS = ['--quiet', '--title', 'cliaws documentation',
0
+ "--opname", "index.html",
0
+ "--line-numbers",
0
+ "--main", "README",
0
+ "--inline-source"]
0
+
0
+class Hoe
0
+ def extra_deps
0
+ @extra_deps.reject! { |x| Array(x).first == 'hoe' }
0
+ @extra_deps
0
+ end
0
+end
0
+
0
+# Generate all the Rake tasks
0
+# Run 'rake -T' to see list of generated tasks (from gem root directory)
0
+$hoe = Hoe.new(GEM_NAME, VERS) do |p|
0
+ p.developer(AUTHOR, EMAIL)
0
+ p.description = DESCRIPTION
0
+ p.summary = DESCRIPTION
0
+ p.url = HOMEPATH
0
+ p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
0
+ p.test_globs = ["test/**/test_*.rb"]
0
+ p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
0
+
0
+ # == Optional
0
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
0
+ p.extra_deps = [
0
+ ["main", "~> 2.8.0"],
0
+ ["right_aws", "~> 1.7.1"],
0
+ ["activesupport", "~> 2.0.2"]
0
+ ]
0
+
0
+ #p.spec_extras = {} # A hash of extra values to set in the gemspec.
0
+
0
+end
0
+
0
+CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
0
+PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
0
+$hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
0
+$hoe.rsync_args = '-av --delete --ignore-errors'
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0
@@ -0,0 +1,15 @@
0
+require 'fileutils'
0
+include FileUtils
0
+
0
+require 'rubygems'
0
+%w[rake hoe newgem rubigen].each do |req_gem|
0
+ begin
0
+ require req_gem
0
+ rescue LoadError
0
+ puts "This Rakefile requires the '#{req_gem}' RubyGem."
0
+ puts "Installation: gem install #{req_gem} -y"
0
+ exit
0
+ end
0
+end
0
+
0
+$:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
0
@@ -0,0 +1,17 @@
0
+$:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
0
+
0
+require "cliaws/s3"
0
+
0
+module Cliaws
0
+ def self.access_key_id
0
+ ENV["AWS_ACCESS_KEY_ID"]
0
+ end
0
+
0
+ def self.secret_access_key
0
+ ENV["AWS_SECRET_ACCESS_KEY"]
0
+ end
0
+
0
+ def self.s3
0
+ @@s3 ||= Cliaws::S3.new(access_key_id, secret_access_key)
0
+ end
0
+end
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
0
@@ -0,0 +1,46 @@
0
+require "right_aws"
0
+require "activesupport"
0
+
0
+module Cliaws
0
+ class S3
0
+ def initialize(access_key_id, secret_access_key)
0
+ @s3 = RightAws::S3.new(access_key_id, secret_access_key, :logger => Logger.new("/dev/null"))
0
+ end
0
+
0
+ def list(glob)
0
+ bucket, path = bucket_and_key_name(glob)
0
+ options = Hash.new
0
+ options["prefix"] = path unless path.blank?
0
+ bucket.keys(options).map(&:full_name)
0
+ end
0
+
0
+ def get(s3_object, dest)
0
+ bucket, keyname = bucket_and_key_name(s3_object)
0
+ dest.write(bucket.get(keyname))
0
+ end
0
+
0
+ def head(s3_object)
0
+ bucket, keyname = bucket_and_key_name(s3_object)
0
+ key = bucket.key(keyname, true)
0
+ headers = key.headers
0
+ puts headers.merge(key.meta_headers).to_yaml
0
+ end
0
+
0
+ def put(source, s3_object)
0
+ bucket, keyname = bucket_and_key_name(s3_object)
0
+ bucket.put(keyname, source)
0
+ end
0
+
0
+ def rm(s3_object)
0
+ bucket, keyname = bucket_and_key_name(s3_object)
0
+ bucket.key(keyname).delete
0
+ end
0
+
0
+ protected
0
+ def bucket_and_key_name(full_name)
0
+ bucket_name, path = full_name.split("/", 2)
0
+ bucket = @s3.bucket(bucket_name, false)
0
+ [bucket, path]
0
+ end
0
+ end
0
+end
...
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
0
@@ -0,0 +1,9 @@
0
+module Cliaws #:nodoc:
0
+ module VERSION #:nodoc:
0
+ MAJOR = 1
0
+ MINOR = 0
0
+ TINY = 0
0
+
0
+ STRING = [MAJOR, MINOR, TINY].join('.')
0
+ end
0
+end
...
 
 
 
 
 
 
 
 
 
 
0
...
1
2
3
4
5
6
7
8
9
10
11
0
@@ -0,0 +1,10 @@
0
+#!/usr/bin/env ruby
0
+# File: script/console
0
+irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
0
+
0
+libs = " -r irb/completion"
0
+# Perhaps use a console_lib to store any extra methods I may want available in the cosole
0
+# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
0
+libs << " -r #{File.dirname(__FILE__) + '/../lib/cliaws.rb'}"
0
+puts "Loading cliaws gem"
0
+exec "#{irb} #{libs} --simple-prompt"
0
\ No newline at end of file
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
0
@@ -0,0 +1,14 @@
0
+#!/usr/bin/env ruby
0
+APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
0
+
0
+begin
0
+ require 'rubigen'
0
+rescue LoadError
0
+ require 'rubygems'
0
+ require 'rubigen'
0
+end
0
+require 'rubigen/scripts/destroy'
0
+
0
+ARGV.shift if ['--help', '-h'].include?(ARGV[0])
0
+RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
0
+RubiGen::Scripts::Destroy.new.run(ARGV)
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
0
@@ -0,0 +1,14 @@
0
+#!/usr/bin/env ruby
0
+APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
0
+
0
+begin
0
+ require 'rubigen'
0
+rescue LoadError
0
+ require 'rubygems'
0
+ require 'rubigen'
0
+end
0
+require 'rubigen/scripts/generate'
0
+
0
+ARGV.shift if ['--help', '-h'].include?(ARGV[0])
0
+RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
0
+RubiGen::Scripts::Generate.new.run(ARGV)
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
0
@@ -0,0 +1,74 @@
0
+#!/usr/bin/env ruby
0
+
0
+require 'rubygems'
0
+begin
0
+ require 'newgem'
0
+rescue LoadError
0
+ puts "\n\nGenerating the website requires the newgem RubyGem"
0
+ puts "Install: gem install newgem\n\n"
0
+ exit(1)
0
+end
0
+require 'redcloth'
0
+require 'syntax/convertors/html'
0
+require 'erb'
0
+require File.dirname(__FILE__) + '/../lib/cliaws/version.rb'
0
+
0
+version = Cliaws::VERSION::STRING
0
+download = 'http://rubyforge.org/projects/cliaws'
0
+
0
+class Fixnum
0
+ def ordinal
0
+ # teens
0
+ return 'th' if (10..19).include?(self % 100)
0
+ # others
0
+ case self % 10
0
+ when 1: return 'st'
0
+ when 2: return 'nd'
0
+ when 3: return 'rd'
0
+ else return 'th'
0
+ end
0
+ end
0
+end
0
+
0
+class Time
0
+ def pretty
0
+ return "#{mday}#{mday.ordinal} #{strftime('%B')} #{year}"
0
+ end
0
+end
0
+
0
+def convert_syntax(syntax, source)
0
+ return Syntax::Convertors::HTML.for_syntax(syntax).convert(source).gsub(%r!^<pre>|</pre>$!,'')
0
+end
0
+
0
+if ARGV.length >= 1
0
+ src, template = ARGV
0
+ template ||= File.join(File.dirname(__FILE__), '/../website/template.html.erb')
0
+
0
+else
0
+ puts("Usage: #{File.split($0).last} source.txt [template.html.erb] > output.html")
0
+ exit!
0
+end
0
+
0
+template = ERB.new(File.open(template).read)
0
+
0
+title = nil
0
+body = nil
0
+File.open(src) do |fsrc|
0
+ title_text = fsrc.readline
0
+ body_text = fsrc.read
0
+ syntax_items = []
0
+ body_text.gsub!(%r!<(pre|code)[^>]*?syntax=['"]([^'"]+)[^>]*>(.*?)</\1>!m){
0
+ ident = syntax_items.length
0
+ element, syntax, source = $1, $2, $3