bone 0.2.6 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ # http://gembundler.com/man/gemfile.5.html
2
+ source "https://rubygems.org/"
3
+
4
+ gem 'familia', '0.6.0', :git => "git://github.com/delano/familia.git", :branch => '0.6'
5
+
6
+
7
+
8
+
9
+
@@ -0,0 +1,26 @@
1
+ GIT
2
+ remote: git://github.com/delano/familia.git
3
+ revision: df5752a573b7a68d26aa940fad2edf4c25f7018f
4
+ branch: 0.6
5
+ specs:
6
+ familia (0.6.0)
7
+ gibbler (>= 0.8.4)
8
+ redis (>= 2.1.0)
9
+ storable (>= 0.8.3)
10
+ uri-redis (>= 0.4.1)
11
+
12
+ GEM
13
+ remote: https://rubygems.org/
14
+ specs:
15
+ attic (0.5.2)
16
+ gibbler (0.8.4)
17
+ attic (>= 0.4.0)
18
+ redis (2.1.1)
19
+ storable (0.8.3)
20
+ uri-redis (0.4.1)
21
+
22
+ PLATFORMS
23
+ ruby
24
+
25
+ DEPENDENCIES
26
+ familia (= 0.6.0)!
@@ -1,19 +1,60 @@
1
- Copyright (c) 2009 Solutious Inc, Delano Mandelbaum
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in
11
- all copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- THE SOFTWARE.
1
+ Copyright (c) 2009-2011 Delano Mandelbaum, Solutious Inc.
2
+ Distributes under the same terms as Ruby (copied below).
3
+ ---------------------------------------------------------------------------
4
+ Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.co.jp>.
5
+ You can redistribute it and/or modify it under either the terms of the GPL
6
+ (see COPYING.txt file), or the conditions below:
7
+
8
+ 1. You may make and give away verbatim copies of the source form of the
9
+ software without restriction, provided that you duplicate all of the
10
+ original copyright notices and associated disclaimers.
11
+
12
+ 2. You may modify your copy of the software in any way, provided that
13
+ you do at least ONE of the following:
14
+
15
+ a) place your modifications in the Public Domain or otherwise
16
+ make them Freely Available, such as by posting said
17
+ modifications to Usenet or an equivalent medium, or by allowing
18
+ the author to include your modifications in the software.
19
+
20
+ b) use the modified software only within your corporation or
21
+ organization.
22
+
23
+ c) rename any non-standard executables so the names do not conflict
24
+ with standard executables, which must also be provided.
25
+
26
+ d) make other distribution arrangements with the author.
27
+
28
+ 3. You may distribute the software in object code or executable
29
+ form, provided that you do at least ONE of the following:
30
+
31
+ a) distribute the executables and library files of the software,
32
+ together with instructions (in the manual page or equivalent)
33
+ on where to get the original distribution.
34
+
35
+ b) accompany the distribution with the machine-readable source of
36
+ the software.
37
+
38
+ c) give non-standard executables non-standard names, with
39
+ instructions on where to get the original software distribution.
40
+
41
+ d) make other distribution arrangements with the author.
42
+
43
+ 4. You may modify and include the part of the software into any other
44
+ software (possibly commercial). But some files in the distribution
45
+ are not written by the author, so that they are not under this terms.
46
+
47
+ They are gc.c(partly), utils.c(partly), regex.[ch], st.[ch] and some
48
+ files under the ./missing directory. See each file for the copying
49
+ condition.
50
+
51
+ 5. The scripts and library files supplied as input to or produced as
52
+ output from the software do not automatically fall under the
53
+ copyright of the software, but belong to whomever generated them,
54
+ and may be sold commercially, and may be aggregated with this
55
+ software.
56
+
57
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
58
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
59
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
60
+ PURPOSE.
data/README.md CHANGED
@@ -1,70 +1,93 @@
1
- ## Bone - 0.2 ##
1
+ ## Bone - 0.3 ##
2
2
 
3
- **Environment variables in the "visible mass of condensed water vapour floating in the atmosphere, typically high above the ground."**
3
+ **Remote environment variables**
4
4
 
5
5
  ## Features
6
6
 
7
7
  * Store variables and files remotely
8
- * Simple interface
8
+ * A command-line and ruby interface
9
+ * Secure REST API (based on AWS sig)
10
+ * Also supports direct [Redis](http://code.google.com/p/redis/) access.
9
11
 
10
12
  ## CLI Example
11
-
13
+
12
14
  # Specify arbitrary keys and values.
13
15
  $ bone set cust_id c397d204aa4e94f566d7f78c
14
16
  $ bone cust_id
15
17
  c397d204aa4e94f566d7f78c
16
18
 
17
- # File contents are read automatically...
18
- $ bone set redis_conf config/redis-server.conf
19
+ # Set values from STDIN
20
+ $ >config/redis-server.conf bone set redis_conf
19
21
  $ bone redis_conf
20
- # Redis configuration file example
21
- ...
22
+ [content of redis-server.conf]
22
23
 
23
- # unless you specify -s
24
- $ bone set -s redis_conf config/redis-server.conf
25
- $ bone redis_conf
26
- config/redis-server.conf
24
+ # The data doesn't have to be text
25
+ $ >path/2/dog.jpg bone set dog_picture
26
+ $ bone dog_picture > dog.jpg
27
+ $ open dog.jpg
27
28
 
28
29
  # Show all available keys
29
30
  $ bone keys
30
31
  cust_id
31
32
  redis_conf
33
+ dog_picture
32
34
 
33
35
  ## Ruby Example
34
36
 
35
37
  require 'bone'
36
38
 
37
- ENV['BONE_TOKEN'] ||= Bone.generate_token
38
-
39
39
  Bone[:cust_id] = 'c397d204aa4e94f566d7f78c'
40
40
  Bone[:redis_conf] = File.read('config/redis-server.conf')
41
41
 
42
42
  Bone[:cust_id] # => "c397d204aa4e94f566d7f78c"
43
- Bone[:redis_conf] # => "# Redis configuration file example..."
43
+ Bone[:redis_conf] # => "[content of redis-server.conf]"
44
44
 
45
+ # OR
45
46
 
47
+ bone = Bone.new
48
+ bone[:latest_backup] = 'redis.rdb-2011-01-01'
49
+ bone.keys # => ['cust_id', 'latest_backup', 'redis_conf']
50
+
51
+ ## Setting BONE_SOURCE ##
52
+
53
+ Bone can store data via a REST API or directly to Redis. The default source is redis://127.0.0.1:6379.
54
+
55
+ ### Redis ###
56
+
57
+ If you are running [Redis](http://code.google.com/p/redis/) at a different address or port, you can change it by setting the BONE_SOURCE environment variable or by explicitly setting in Ruby with `Bone.source='redis://anotherhost:6379'`.
58
+
59
+ ### HTTP ###
60
+
61
+ If you want to use the REST API, you need to run an instance of [boned](http://github.com/solutious/boned) (the bone daemon).You'd then set your bone source to something like `https://somehost:3073`. **Note: unless your bone client and server are on a private network, it is highly recommended to use HTTPS.**
62
+
63
+
46
64
  ## Installation
47
65
 
48
66
  $ sudo gem install bone
49
- $ bone token
50
- $ export BONE_TOKEN=YOURTOKEN
51
67
 
52
- You also need to running instance of [boned](http://github.com/solutious/boned) (the bone daemon).
53
-
68
+ $ bone generate
69
+ # Your token for http://localhost:3073
70
+ BONE_TOKEN=LBL6PEGVWLFR3PJIOFQG01GN
71
+ BONE_SECRET=tXvhnban0HD.Aqj$goK9a2oW$T/L8le9460cfXR1t^RfMXq.5vQ2^lHd-c.WND6V
72
+
73
+ [Add BONE_TOKEN and BONE_SECRET to your .bashrc or equivalent]
54
74
 
55
- ## More Information
75
+ $ bone
56
76
 
57
77
 
58
78
  ## Credits
59
79
 
60
80
  * Delano Mandelbaum (http://solutious.com)
81
+ * Query signatures for the HTTP API are based on / stolen from: https://github.com/grempe/amazon-ec2/blob/master/lib/AWS.rb
61
82
 
62
83
 
63
84
  ## Thanks
64
85
 
65
- * Kalin Harvey for the early feedback.
86
+ * Kalin Harvey and Marc-André Cournoyer for the early feedback.
66
87
 
67
88
 
68
89
  ## License
69
90
 
70
- See LICENSE.txt
91
+ Copyright (c) 2009-2011 Delano Mandelbaum, Solutious Inc.
92
+
93
+ Distributes under the same terms as Ruby
data/Rakefile CHANGED
@@ -1,60 +1,65 @@
1
-
2
- require 'rake/clean'
3
- require 'rake/gempackagetask'
4
- require 'rake/testtask'
5
- require 'rake/runtest'
6
- require 'fileutils'
7
- include FileUtils
1
+ require "rubygems"
2
+ require "rake"
3
+ require "rake/clean"
4
+ require 'yaml'
8
5
 
9
6
  begin
10
7
  require 'hanna/rdoctask'
11
8
  rescue LoadError
12
9
  require 'rake/rdoctask'
13
10
  end
14
-
15
-
16
- task :default => :test
17
-
18
-
19
- # PACKAGE =============================================================
20
-
11
+
12
+ config = YAML.load_file("VERSION.yml")
13
+ task :default => ["build"]
14
+ CLEAN.include [ 'pkg', 'doc' ]
21
15
  name = "bone"
22
- load "#{name}.gemspec"
23
16
 
24
- version = @spec.version
25
-
26
- Rake::GemPackageTask.new(@spec) do |p|
27
- p.need_tar = true if RUBY_PLATFORM !~ /mswin/
17
+ begin
18
+ require "jeweler"
19
+ Jeweler::Tasks.new do |gem|
20
+ gem.version = "#{config[:MAJOR]}.#{config[:MINOR]}.#{config[:PATCH]}"
21
+ gem.name = name
22
+ gem.rubyforge_project = gem.name
23
+ gem.summary = "A simple store for remote environment variables"
24
+ gem.description = gem.summary
25
+ gem.email = "delano@solutious.com"
26
+ gem.homepage = "https://github.com/solutious/bone"
27
+ gem.authors = ["Delano Mandelbaum"]
28
+ gem.add_dependency("familia", ">= 0.6.0")
29
+ gem.add_dependency("em-http-request")
30
+ end
31
+ Jeweler::GemcutterTasks.new
32
+ rescue LoadError
33
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
28
34
  end
29
35
 
30
- task :test do
31
- puts "Success!"
32
- end
33
36
 
34
- task :install => [ :rdoc, :package ] do
35
- sh %{sudo gem install pkg/#{name}-#{version}.gem}
37
+ Rake::RDocTask.new do |rdoc|
38
+ version = "#{config[:MAJOR]}.#{config[:MINOR]}.#{config[:PATCH]}.#{config[:BUILD]}"
39
+ rdoc.rdoc_dir = "doc"
40
+ rdoc.title = "#{name} #{version}"
41
+ rdoc.rdoc_files.include("README*")
42
+ rdoc.rdoc_files.include("LICENSE.txt")
43
+ rdoc.rdoc_files.include("bin/*.rb")
44
+ rdoc.rdoc_files.include("lib/**/*.rb")
36
45
  end
37
46
 
38
- task :uninstall => [ :clean ] do
39
- sh %{sudo gem uninstall #{name}}
40
- end
41
47
 
48
+ # Rubyforge Release / Publish Tasks ==================================
42
49
 
50
+ #about 'Publish website to rubyforge'
51
+ task 'publish:rdoc' => 'doc/index.html' do
52
+ #sh "scp -rp doc/* rubyforge.org:/var/www/gforge-projects/#{name}/"
53
+ end
43
54
 
44
- Rake::RDocTask.new do |t|
45
- t.rdoc_dir = 'doc'
46
- t.title = @spec.summary
47
- t.options << '--line-numbers' << '-A cattr_accessor=object'
48
- t.options << '--charset' << 'utf-8'
49
- t.rdoc_files.include('LICENSE.txt')
50
- t.rdoc_files.include('README.md')
51
- t.rdoc_files.include('CHANGES.txt')
52
- #t.rdoc_files.include('Rudyfile') # why is the formatting f'd?
53
- t.rdoc_files.include('bin/*')
54
- t.rdoc_files.include('lib/**/*.rb')
55
+ #about 'Public release to rubyforge'
56
+ task 'publish:gem' => [:package] do |t|
57
+ sh <<-end
58
+ rubyforge add_release -o Any -a CHANGES.txt -f -n README.md #{name} #{name} #{@spec.version} pkg/#{name}-#{@spec.version}.gem &&
59
+ rubyforge add_file -o Any -a CHANGES.txt -f -n README.md #{name} #{name} #{@spec.version} pkg/#{name}-#{@spec.version}.tgz
60
+ end
55
61
  end
56
62
 
57
- CLEAN.include [ 'pkg', '*.gem', '.config', 'doc', 'coverage*' ]
58
63
 
59
64
 
60
65
 
@@ -0,0 +1,4 @@
1
+ ---
2
+ :MAJOR: 0
3
+ :MINOR: 3
4
+ :PATCH: 0
data/bin/bone CHANGED
@@ -28,7 +28,7 @@ class Bone::CLI::Definition
28
28
 
29
29
  global :D, :debug, "Enable debug mode" do
30
30
  Drydock.debug true
31
- Bone.enable_debug
31
+ Bone.debug = true
32
32
  end
33
33
 
34
34
  about "Get a value for the given key"
@@ -40,37 +40,45 @@ class Bone::CLI::Definition
40
40
  usage "bone set keyname keyvalue"
41
41
  usage "bone set keyname=keyvalue"
42
42
  usage "bone set keyname path/2/file"
43
- option :s, :string, "Assume value is a string even if file name exists"
44
43
  command :set => Bone::CLI
45
44
 
46
- about "Delete a key/value pair"
47
- usage "bone del keyname"
48
- command :del => Bone::CLI
49
- command_alias :del, :rem
50
- command_alias :del, :delete
45
+ #about "Delete a key/value pair"
46
+ #usage "bone del keyname"
47
+ #command :del => Bone::CLI
48
+ #command_alias :del, :rem
49
+ #command_alias :del, :delete
51
50
 
52
51
  about "Display all available keys"
53
52
  usage "bone keys"
54
53
  usage "bone keys keyname"
55
54
  command :keys => Bone::CLI
56
55
 
57
- about "Display the token or generate a new one"
56
+ about "Display the current token"
58
57
  usage "bone token"
59
- option :f, :force, "Force generating a new token"
60
58
  command :token => Bone::CLI
59
+
60
+ about "Display the current secret"
61
+ usage "bone token"
62
+ command :secret => Bone::CLI
63
+
64
+ about "Generate a new token"
65
+ usage "bone generate"
66
+ command :generate => Bone::CLI
61
67
 
62
68
  end
63
69
 
64
70
  begin
65
71
  Drydock.run!(ARGV, STDIN) if Drydock.run? && !Drydock.has_run?
66
- rescue Bone::BadBone => ex
72
+ rescue Bone::NoToken => ex
67
73
  puts "Invalid token: #{ex.message}"
68
- puts "Run the following command to generate a new one:", "$ #{$0} token"
69
- STDERR.puts ex.backtrace if Bone.debug?
74
+ puts "Create a token with one of the following commands:",
75
+ "bone generate",
76
+ "bone register TOKEN SECRET"
77
+ STDERR.puts ex.backtrace if Bone.debug
70
78
  exit 1
71
79
  rescue Bone::Problem => ex
72
80
  puts ex.message
73
- STDERR.puts ex.backtrace if Bone.debug?
81
+ STDERR.puts ex.backtrace if Bone.debug
74
82
  exit 1
75
83
  rescue Drydock::ArgError, Drydock::OptError => ex
76
84
  STDERR.puts ex.message
@@ -84,6 +92,6 @@ rescue Interrupt
84
92
  exit 1
85
93
  rescue => ex
86
94
  STDERR.puts "ERROR (#{ex.class.to_s}): #{ex.message}"
87
- STDERR.puts ex.backtrace if Drydock.debug?
95
+ STDERR.puts ex.backtrace if Drydock.debug
88
96
  end
89
97
 
@@ -1,46 +1,80 @@
1
- @spec = Gem::Specification.new do |s|
2
- s.name = "bone"
3
- s.rubyforge_project = 'bone'
4
- s.version = "0.2.6"
5
- s.summary = "Get Bones"
6
- s.description = s.summary
7
- s.author = "Delano Mandelbaum"
8
- s.email = "delano@solutious.com"
9
- s.homepage = "http://github.com/solutious/bone"
10
-
11
- s.extra_rdoc_files = %w[README.md LICENSE.txt CHANGES.txt]
12
- s.has_rdoc = true
13
- s.rdoc_options = ["--line-numbers", "--title", s.summary, "--main", "README.md"]
14
- s.require_paths = %w[lib]
15
-
16
- s.executables = %w[bone]
17
-
18
- # = MANIFEST =
19
- # git ls-files
20
- s.files = %w(
21
- CHANGES.txt
22
- LICENSE.txt
23
- README.md
24
- Rakefile
25
- Rudyfile
26
- bin/bone
27
- bone.gemspec
28
- lib/bone.rb
29
- lib/bone/cli.rb
30
- try/bone.rb
31
- vendor/drydock-0.6.8/CHANGES.txt
32
- vendor/drydock-0.6.8/LICENSE.txt
33
- vendor/drydock-0.6.8/README.rdoc
34
- vendor/drydock-0.6.8/Rakefile
35
- vendor/drydock-0.6.8/bin/example
36
- vendor/drydock-0.6.8/drydock.gemspec
37
- vendor/drydock-0.6.8/lib/drydock.rb
38
- vendor/drydock-0.6.8/lib/drydock/console.rb
39
- vendor/drydock-0.6.8/lib/drydock/mixins.rb
40
- vendor/drydock-0.6.8/lib/drydock/mixins/object.rb
41
- vendor/drydock-0.6.8/lib/drydock/mixins/string.rb
42
- vendor/drydock-0.6.8/lib/drydock/screen.rb
43
- )
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
44
5
 
45
-
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{bone}
8
+ s.version = "0.3.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Delano Mandelbaum"]
12
+ s.date = %q{2010-12-17}
13
+ s.default_executable = %q{bone}
14
+ s.description = %q{A simple store for remote environment variables}
15
+ s.email = %q{delano@solutious.com}
16
+ s.executables = ["bone"]
17
+ s.extra_rdoc_files = [
18
+ "LICENSE.txt",
19
+ "README.md"
20
+ ]
21
+ s.files = [
22
+ "CHANGES.txt",
23
+ "Gemfile",
24
+ "Gemfile.lock",
25
+ "LICENSE.txt",
26
+ "README.md",
27
+ "Rakefile",
28
+ "Rudyfile",
29
+ "VERSION.yml",
30
+ "bin/bone",
31
+ "bone.gemspec",
32
+ "config/redis-server.conf",
33
+ "lib/bone.rb",
34
+ "lib/bone/api.rb",
35
+ "lib/bone/cli.rb",
36
+ "try/10_generate_try.rb",
37
+ "try/16_http_try.rb",
38
+ "try/20_instance_try.rb",
39
+ "try/25_key_token_object_try.rb",
40
+ "try/30_api_memory_try.rb",
41
+ "try/31_api_redis_try.rb",
42
+ "try/32_api_http_try.rb",
43
+ "try/manual_cli.rb",
44
+ "vendor/drydock-0.6.8/CHANGES.txt",
45
+ "vendor/drydock-0.6.8/LICENSE.txt",
46
+ "vendor/drydock-0.6.8/README.rdoc",
47
+ "vendor/drydock-0.6.8/Rakefile",
48
+ "vendor/drydock-0.6.8/bin/example",
49
+ "vendor/drydock-0.6.8/drydock.gemspec",
50
+ "vendor/drydock-0.6.8/lib/drydock.rb",
51
+ "vendor/drydock-0.6.8/lib/drydock/console.rb",
52
+ "vendor/drydock-0.6.8/lib/drydock/mixins.rb",
53
+ "vendor/drydock-0.6.8/lib/drydock/mixins/object.rb",
54
+ "vendor/drydock-0.6.8/lib/drydock/mixins/string.rb",
55
+ "vendor/drydock-0.6.8/lib/drydock/screen.rb"
56
+ ]
57
+ s.homepage = %q{https://github.com/solutious/bone}
58
+ s.rdoc_options = ["--charset=UTF-8"]
59
+ s.require_paths = ["lib"]
60
+ s.rubyforge_project = %q{bone}
61
+ s.rubygems_version = %q{1.3.7}
62
+ s.summary = %q{A simple store for remote environment variables}
63
+
64
+ if s.respond_to? :specification_version then
65
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
66
+ s.specification_version = 3
67
+
68
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
69
+ s.add_runtime_dependency(%q<familia>, [">= 0.6.0"])
70
+ s.add_runtime_dependency(%q<em-http-request>, [">= 0"])
71
+ else
72
+ s.add_dependency(%q<familia>, [">= 0.6.0"])
73
+ s.add_dependency(%q<em-http-request>, [">= 0"])
74
+ end
75
+ else
76
+ s.add_dependency(%q<familia>, [">= 0.6.0"])
77
+ s.add_dependency(%q<em-http-request>, [">= 0"])
78
+ end
46
79
  end
80
+