bone 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +23 -0
- data/LICENSE.txt +19 -0
- data/README.md +62 -0
- data/Rakefile +55 -0
- data/Rudyfile +227 -0
- data/bin/bone +89 -0
- data/bone.gemspec +48 -0
- data/lib/bone.rb +150 -0
- data/lib/bone/cli.rb +69 -0
- data/try/bone.rb +9 -0
- data/vendor/drydock-0.6.8/CHANGES.txt +159 -0
- data/vendor/drydock-0.6.8/LICENSE.txt +22 -0
- data/vendor/drydock-0.6.8/README.rdoc +92 -0
- data/vendor/drydock-0.6.8/Rakefile +74 -0
- data/vendor/drydock-0.6.8/bin/example +210 -0
- data/vendor/drydock-0.6.8/drydock.gemspec +38 -0
- data/vendor/drydock-0.6.8/lib/drydock.rb +961 -0
- data/vendor/drydock-0.6.8/lib/drydock/console.rb +313 -0
- data/vendor/drydock-0.6.8/lib/drydock/mixins.rb +4 -0
- data/vendor/drydock-0.6.8/lib/drydock/mixins/object.rb +23 -0
- data/vendor/drydock-0.6.8/lib/drydock/mixins/string.rb +66 -0
- data/vendor/drydock-0.6.8/lib/drydock/screen.rb +33 -0
- metadata +91 -0
data/CHANGES.txt
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
BONE, CHANGES
|
2
|
+
|
3
|
+
#### 0.2.1 (2009-12-13) ###############################
|
4
|
+
|
5
|
+
* FIXED: Force token generate now works
|
6
|
+
* ADDED: Friendly message when no keys
|
7
|
+
* ADDED: Quiet mode
|
8
|
+
* ADDED: Support for deleting keys
|
9
|
+
|
10
|
+
|
11
|
+
#### 0.2.0 (2009-12-13) ###############################
|
12
|
+
|
13
|
+
* CHANGE: Use POST for set command
|
14
|
+
* CHANGE: Set command returns key name instead of value
|
15
|
+
* ADDED: Better error handling
|
16
|
+
* ADDED: Friendly message when no token available.
|
17
|
+
* ADDED: bone token command
|
18
|
+
* ADDED: Bone.digest for generating valid tokens
|
19
|
+
|
20
|
+
|
21
|
+
#### 0.1.0 (2009-12-12) ###############################
|
22
|
+
|
23
|
+
Initial release
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,19 @@
|
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
## Bone - 0.2 ##
|
2
|
+
|
3
|
+
**Bones it!**
|
4
|
+
|
5
|
+
== Features
|
6
|
+
|
7
|
+
* Store variables and files remotely
|
8
|
+
* Simple interface
|
9
|
+
|
10
|
+
== CLI Example
|
11
|
+
|
12
|
+
# Specify arbitrary keys and values.
|
13
|
+
$ bone set cust_id c397d204aa4e94f566d7f78c
|
14
|
+
$ bone cust_id
|
15
|
+
c397d204aa4e94f566d7f78c
|
16
|
+
|
17
|
+
# File contents are read automatically...
|
18
|
+
$ bone set redis_conf config/redis-server.conf
|
19
|
+
$ bone redis_conf
|
20
|
+
# Redis configuration file example
|
21
|
+
...
|
22
|
+
|
23
|
+
# unless you specify -s
|
24
|
+
$ bone set -s redis_conf config/redis-server.conf
|
25
|
+
$ bone redis_conf
|
26
|
+
config/redis-server.conf
|
27
|
+
|
28
|
+
# Show all available keys
|
29
|
+
$ bone keys
|
30
|
+
|
31
|
+
|
32
|
+
== Ruby Example
|
33
|
+
|
34
|
+
require 'bone'
|
35
|
+
|
36
|
+
ENV['BONE_TOKEN'] = Bone.generate_token
|
37
|
+
|
38
|
+
Bone[:cust_id] = 'c397d204aa4e94f566d7f78c'
|
39
|
+
Bone[:redis_conf] = File.read('config/redis-server.conf')
|
40
|
+
|
41
|
+
|
42
|
+
== Installation
|
43
|
+
|
44
|
+
$ sudo gem install bone
|
45
|
+
|
46
|
+
|
47
|
+
== More Information
|
48
|
+
|
49
|
+
|
50
|
+
== Credits
|
51
|
+
|
52
|
+
* Delano Mandelbaum (http://solutious.com)
|
53
|
+
|
54
|
+
|
55
|
+
== Thanks
|
56
|
+
|
57
|
+
* Kalin Harvey for the early feedback.
|
58
|
+
|
59
|
+
|
60
|
+
== License
|
61
|
+
|
62
|
+
See LICENSE.txt
|
data/Rakefile
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
|
2
|
+
require 'rake/clean'
|
3
|
+
require 'rake/gempackagetask'
|
4
|
+
require 'hanna/rdoctask'
|
5
|
+
require 'rake/testtask'
|
6
|
+
require 'shoulda/tasks'
|
7
|
+
require 'rake/runtest'
|
8
|
+
require 'fileutils'
|
9
|
+
include FileUtils
|
10
|
+
|
11
|
+
task :default => :test
|
12
|
+
|
13
|
+
|
14
|
+
# PACKAGE =============================================================
|
15
|
+
|
16
|
+
name = "bone"
|
17
|
+
load "#{name}.gemspec"
|
18
|
+
|
19
|
+
version = @spec.version
|
20
|
+
|
21
|
+
Rake::GemPackageTask.new(@spec) do |p|
|
22
|
+
p.need_tar = true if RUBY_PLATFORM !~ /mswin/
|
23
|
+
end
|
24
|
+
|
25
|
+
task :test do
|
26
|
+
puts "Success!"
|
27
|
+
end
|
28
|
+
|
29
|
+
task :install => [ :rdoc, :package ] do
|
30
|
+
sh %{sudo gem install pkg/#{name}-#{version}.gem}
|
31
|
+
end
|
32
|
+
|
33
|
+
task :uninstall => [ :clean ] do
|
34
|
+
sh %{sudo gem uninstall #{name}}
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
Rake::RDocTask.new do |t|
|
40
|
+
t.rdoc_dir = 'doc'
|
41
|
+
t.title = @spec.summary
|
42
|
+
t.options << '--line-numbers' << '-A cattr_accessor=object'
|
43
|
+
t.options << '--charset' << 'utf-8'
|
44
|
+
t.rdoc_files.include('LICENSE.txt')
|
45
|
+
t.rdoc_files.include('README.md')
|
46
|
+
t.rdoc_files.include('CHANGES.txt')
|
47
|
+
#t.rdoc_files.include('Rudyfile') # why is the formatting f'd?
|
48
|
+
t.rdoc_files.include('bin/*')
|
49
|
+
t.rdoc_files.include('lib/**/*.rb')
|
50
|
+
end
|
51
|
+
|
52
|
+
CLEAN.include [ 'pkg', '*.gem', '.config', 'doc', 'coverage*' ]
|
53
|
+
|
54
|
+
|
55
|
+
|
data/Rudyfile
ADDED
@@ -0,0 +1,227 @@
|
|
1
|
+
require 'stella'
|
2
|
+
|
3
|
+
machines do
|
4
|
+
|
5
|
+
region :'us-east-1' do
|
6
|
+
ami 'ami-212ccf48' # Stella Debian 5.0, 32-bit (US)
|
7
|
+
end
|
8
|
+
region :'eu-west-1' do
|
9
|
+
ami 'ami-6ecde51a' # Alestic Debian 5.0, 32-bit (EU)
|
10
|
+
end
|
11
|
+
|
12
|
+
env :stage do
|
13
|
+
|
14
|
+
role :app do
|
15
|
+
positions 2
|
16
|
+
user :root
|
17
|
+
size 'm1.small'
|
18
|
+
end
|
19
|
+
|
20
|
+
role :gen do
|
21
|
+
user :root
|
22
|
+
size 'm1.large'
|
23
|
+
ami 'ami-7133d018'
|
24
|
+
end
|
25
|
+
|
26
|
+
role :demo do
|
27
|
+
user :root
|
28
|
+
size 'm1.small'
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
commands do
|
39
|
+
allow :apt_get, "apt-get", :y, :q
|
40
|
+
allow :gem_install, "/usr/bin/gem", "install", :n, '/usr/bin', :y, :V, "--no-rdoc", "--no-ri"
|
41
|
+
allow :gem_sources, "/usr/bin/gem", "sources"
|
42
|
+
allow :gem_uninstall, "/usr/bin/gem", "uninstall", :V
|
43
|
+
allow :update_rubygems
|
44
|
+
allow :rake
|
45
|
+
allow :thin
|
46
|
+
allow :stella
|
47
|
+
allow :rm
|
48
|
+
allow :ulimit
|
49
|
+
allow :ruby19, "/usr/local/bin/ruby"
|
50
|
+
allow :gem19_install, "/usr/local/bin/gem", "install"
|
51
|
+
allow :rackup_path do
|
52
|
+
v = [Stella::VERSION::MAJOR, Stella::VERSION::MINOR, Stella::VERSION::TINY].join('.')
|
53
|
+
"/usr/lib/ruby/gems/1.8/gems/stella-#{v}/support/sample_webapp/config.ru"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
routines do
|
58
|
+
|
59
|
+
role :app do
|
60
|
+
|
61
|
+
# rudy -r app -v start
|
62
|
+
start do
|
63
|
+
remote do
|
64
|
+
#ulimit :n, '30000'
|
65
|
+
#ulimit :n
|
66
|
+
rm :f, 'thin.log'
|
67
|
+
mkdir :p, 'stats'
|
68
|
+
thin :d, :l, 'thin.log', :p, 3114, :R, rackup_path, '--stats', './stats', '--max-conns', 8192, 'start'
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# rudy -r app -v stop
|
73
|
+
stop do
|
74
|
+
remote do
|
75
|
+
thin :R, rackup_path, 'stop'
|
76
|
+
sleep 1
|
77
|
+
ps 'ux'
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
|
83
|
+
|
84
|
+
# rudy -v -r gen verify ip-10-251-27-245.ec2.internal:3114
|
85
|
+
verify do
|
86
|
+
remote do |arg|
|
87
|
+
file_upload 'examples/essentials/plan.rb'
|
88
|
+
file_upload 'examples/essentials/search_terms.txt'
|
89
|
+
file_upload 'examples/essentials/logo.png'
|
90
|
+
stella :v, 'verify', :p, 'plan.rb', "#{arg.first}"
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
# rudy -v -r gen generate ip-10-251-27-245.ec2.internal:3114
|
95
|
+
generate do
|
96
|
+
remote do |arg|
|
97
|
+
file_upload 'examples/essentials/plan.rb'
|
98
|
+
file_upload 'examples/essentials/search_terms.txt'
|
99
|
+
file_upload 'examples/essentials/logo.png'
|
100
|
+
stella :v, 'generate', :p, 'plan.rb', :c, 1, :d, '1m', :W, "#{arg.first}"
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
|
105
|
+
setup do
|
106
|
+
after :sysupdate, :installdeps, :install_ruby19
|
107
|
+
end
|
108
|
+
|
109
|
+
shutdown do
|
110
|
+
end
|
111
|
+
|
112
|
+
reboot do
|
113
|
+
end
|
114
|
+
|
115
|
+
install_netperf do
|
116
|
+
#ftp://ftp.netperf.org/netperf/netperf-2.4.5.tar.bz2
|
117
|
+
end
|
118
|
+
|
119
|
+
install_rubyforge do
|
120
|
+
remote :root do
|
121
|
+
gem19_install 'stella', :V
|
122
|
+
gem_install 'stella', :V
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
install_github do
|
127
|
+
remote :root do
|
128
|
+
gem_sources :a, "http://gems.github.com"
|
129
|
+
gem_install 'solutious-stella'
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
package_gem do
|
134
|
+
local do
|
135
|
+
rm :r, :f, 'pkg'
|
136
|
+
rake 'package'
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
remove_rudy do
|
141
|
+
remote :root do
|
142
|
+
gem_uninstall 'stella'
|
143
|
+
rm :r, :f, '.stella'
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
install_gem do
|
148
|
+
before :package_gem
|
149
|
+
remote :root do
|
150
|
+
file_upload "pkg/stella-#{Stella::VERSION}.gem", "/tmp/"
|
151
|
+
gem_install "/tmp/stella-#{Stella::VERSION}.gem"
|
152
|
+
end
|
153
|
+
|
154
|
+
end
|
155
|
+
|
156
|
+
install_zlib do
|
157
|
+
remote do
|
158
|
+
wget "http://www.zlib.net/zlib-1.2.3.tar.gz"
|
159
|
+
tar :x, :z, :f, "zlib-1.2.3.tar.gz"
|
160
|
+
cd "zlib-1.2.3"
|
161
|
+
configure '--prefix=/usr/local'
|
162
|
+
make
|
163
|
+
make "install"
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
installdeps do
|
168
|
+
remote :root do
|
169
|
+
gem_install "test-spec", "rspec", "camping", "fcgi", "memcache-client"
|
170
|
+
gem_install "mongrel"
|
171
|
+
gem_install "ruby-openid", :v, "2.0.4" # thin requires 2.0.x
|
172
|
+
gem_install "rack", "thin", "sinatra"
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
install_jruby do
|
177
|
+
remote do
|
178
|
+
wget 'http://jruby.kenai.com/downloads/1.4.0RC2/jruby-bin-1.4.0RC2.tar.gz'
|
179
|
+
tar :x, :z, :f, 'jruby-bin-1.4.0RC2.tar.gz'
|
180
|
+
mv 'jruby-1.4.0RC2', '/usr/jruby'
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
install_ruby19 do
|
185
|
+
before :install_zlib
|
186
|
+
remote do
|
187
|
+
apt_get "install", "libssl-dev", "libreadline5-dev", "zlib1g-dev"
|
188
|
+
#wget 'ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p243.tar.bz2'
|
189
|
+
rm :r, :f, 'ruby-1.9.1-p243'
|
190
|
+
tar :x, :j, :v, :f, 'ruby-1.9.1-p243.tar.bz2'
|
191
|
+
cd 'ruby-1.9.1-p243'
|
192
|
+
configure '--prefix=/usr/local'
|
193
|
+
make
|
194
|
+
make 'install'
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
sysupdate {
|
199
|
+
remote {
|
200
|
+
apt_get "update"
|
201
|
+
apt_get "install", "libxml2-dev", "libxslt-dev"
|
202
|
+
apt_get "install", "build-essential", "git-core"
|
203
|
+
apt_get "install", "ruby1.8-dev", "rdoc", "libzlib-ruby", "rubygems"
|
204
|
+
apt_get "install", "libfcgi-dev", "libfcgi-ruby1.8"
|
205
|
+
apt_get "install", "joe", "siege", "httperf"
|
206
|
+
gem_sources :a, "http://gems.github.com"
|
207
|
+
mkdir :p, "/var/lib/gems/1.8/bin" # Doesn't get created, but causes Rubygems to fail
|
208
|
+
gem_install "builder", "session"
|
209
|
+
gem_install 'hoe-seattlerb'
|
210
|
+
gem_install 'rubygems-update', "-v=1.3.4"
|
211
|
+
update_rubygems
|
212
|
+
gem_install 'hoe'
|
213
|
+
}
|
214
|
+
}
|
215
|
+
|
216
|
+
|
217
|
+
end
|
218
|
+
|
219
|
+
|
220
|
+
defaults do
|
221
|
+
zone :'us-east-1a'
|
222
|
+
environment :stage
|
223
|
+
role :app
|
224
|
+
color true
|
225
|
+
user :root
|
226
|
+
end
|
227
|
+
|
data/bin/bone
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
# Put our local lib in first place
|
4
|
+
BASE_PATH = File.expand_path File.join(File.dirname(__FILE__), '..')
|
5
|
+
lib_dir = File.join(BASE_PATH, 'lib')
|
6
|
+
$:.unshift lib_dir
|
7
|
+
|
8
|
+
require 'bone'
|
9
|
+
|
10
|
+
Bone.require_vendor 'drydock', '0.6.8'
|
11
|
+
|
12
|
+
require 'bone/cli'
|
13
|
+
|
14
|
+
# Command-line interface for bin/stella
|
15
|
+
class Bone::CLI::Definition
|
16
|
+
extend Drydock
|
17
|
+
|
18
|
+
default :keys
|
19
|
+
trawler :get
|
20
|
+
|
21
|
+
global :t, :token, String, "Specify a bone token (override BONE_TOKEN environment variable)"
|
22
|
+
global :q, :quiet, "Less output"
|
23
|
+
|
24
|
+
global :v, :version, "Display version" do
|
25
|
+
puts "Bone: #{Bone::VERSION} (api: #{Bone::APIVERSION})"
|
26
|
+
exit
|
27
|
+
end
|
28
|
+
|
29
|
+
global :D, :debug, "Enable debug mode" do
|
30
|
+
Drydock.debug true
|
31
|
+
Bone.enable_debug
|
32
|
+
end
|
33
|
+
|
34
|
+
about "Get a value for the given key"
|
35
|
+
usage "bone get keyname"
|
36
|
+
usage "bone keyname"
|
37
|
+
command :get => Bone::CLI
|
38
|
+
|
39
|
+
about "Set a new key/value pair"
|
40
|
+
usage "bone set keyname keyvalue"
|
41
|
+
usage "bone set keyname=keyvalue"
|
42
|
+
usage "bone set keyname path/2/file"
|
43
|
+
option :s, :string, "Assume value is a string even if file name exists"
|
44
|
+
command :set => Bone::CLI
|
45
|
+
|
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
|
51
|
+
|
52
|
+
about "Display all available keys"
|
53
|
+
usage "bone keys"
|
54
|
+
usage "bone keys keyname"
|
55
|
+
command :keys => Bone::CLI
|
56
|
+
|
57
|
+
about "Display the token or generate a new one"
|
58
|
+
usage "bone token"
|
59
|
+
option :f, :force, "Force generating a new token"
|
60
|
+
command :token => Bone::CLI
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
begin
|
65
|
+
Drydock.run!(ARGV, STDIN) if Drydock.run? && !Drydock.has_run?
|
66
|
+
rescue Bone::BadBone => ex
|
67
|
+
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?
|
70
|
+
exit 1
|
71
|
+
rescue Bone::Problem => ex
|
72
|
+
puts ex.message
|
73
|
+
STDERR.puts ex.backtrace if Bone.debug?
|
74
|
+
exit 1
|
75
|
+
rescue Drydock::ArgError, Drydock::OptError => ex
|
76
|
+
STDERR.puts ex.message
|
77
|
+
STDERR.puts ex.usage
|
78
|
+
rescue Drydock::InvalidArgument => ex
|
79
|
+
STDERR.puts ex.message
|
80
|
+
rescue Drydock::UnknownCommand => ex
|
81
|
+
STDERR.puts "Unknown command: %s" % ex.name
|
82
|
+
rescue Interrupt
|
83
|
+
puts $/, "Exiting... "
|
84
|
+
exit 1
|
85
|
+
rescue => ex
|
86
|
+
STDERR.puts "ERROR (#{ex.class.to_s}): #{ex.message}"
|
87
|
+
STDERR.puts ex.backtrace if Drydock.debug?
|
88
|
+
end
|
89
|
+
|