bone 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES.txt +6 -0
- data/bone.gemspec +2 -2
- data/lib/bone.rb +15 -6
- metadata +3 -3
data/CHANGES.txt
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
BONE, CHANGES
|
2
2
|
|
3
|
+
#### 0.2.4 (2010-01-25) ###############################
|
4
|
+
|
5
|
+
* CHANGE: URI path starts with /bone/v1 instead of just /v1
|
6
|
+
* CHANGE: Depends on Boned 0.2.4
|
7
|
+
|
8
|
+
|
3
9
|
#### 0.2.3 (2010-01-09) ###############################
|
4
10
|
|
5
11
|
* CHANGE: Bone.get and Bone[] no longer raise an exception for unknown keys
|
data/bone.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
@spec = Gem::Specification.new do |s|
|
2
2
|
s.name = "bone"
|
3
3
|
s.rubyforge_project = 'bone'
|
4
|
-
s.version = "0.2.
|
4
|
+
s.version = "0.2.4"
|
5
5
|
s.summary = "Get Bones"
|
6
6
|
s.description = s.summary
|
7
7
|
s.author = "Delano Mandelbaum"
|
@@ -15,7 +15,7 @@
|
|
15
15
|
|
16
16
|
s.executables = %w[bone]
|
17
17
|
|
18
|
-
s.add_dependency 'boned', '= 0.2.
|
18
|
+
s.add_dependency 'boned', '= 0.2.4'
|
19
19
|
|
20
20
|
# = MANIFEST =
|
21
21
|
# git ls-files
|
data/lib/bone.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'uri'
|
2
2
|
require 'net/http'
|
3
|
+
require 'net/https'
|
3
4
|
|
4
5
|
unless defined?(BONE_HOME)
|
5
6
|
BONE_HOME = File.expand_path(File.join(File.dirname(__FILE__), '..') )
|
@@ -7,7 +8,7 @@ end
|
|
7
8
|
|
8
9
|
module Bone
|
9
10
|
extend self
|
10
|
-
VERSION = "0.2.
|
11
|
+
VERSION = "0.2.4"
|
11
12
|
APIVERSION = 'v1'.freeze
|
12
13
|
|
13
14
|
class Problem < RuntimeError; end
|
@@ -27,7 +28,7 @@ module Bone
|
|
27
28
|
end
|
28
29
|
end
|
29
30
|
|
30
|
-
SOURCE = (ENV['BONE_SOURCE'] || "localhost:6043").freeze
|
31
|
+
SOURCE = (ENV['BONE_SOURCE'] || "http://localhost:6043").freeze
|
31
32
|
TOKEN = ENV['BONE_TOKEN'].freeze
|
32
33
|
|
33
34
|
# Get a key from the boned server. Same as `get!`
|
@@ -119,10 +120,16 @@ module Bone
|
|
119
120
|
|
120
121
|
def request(action, token, key, params={})
|
121
122
|
params[:token] = token
|
122
|
-
path = "/#{APIVERSION}/#{action}/#{key}"
|
123
|
-
|
124
|
-
|
123
|
+
path = "/bone/#{APIVERSION}/#{action}/#{key}"
|
124
|
+
source = SOURCE
|
125
|
+
unless source.match(/\Ahttp/)
|
126
|
+
source = ['http:', SOURCE].join('//')
|
127
|
+
end
|
128
|
+
uri = URI.parse source
|
129
|
+
host, port = uri.host, uri.port
|
130
|
+
port ||= (uri.scheme == 'https' ? 443 : 6043)
|
125
131
|
|
132
|
+
Bone.ld "SOURCE: #{uri.to_s}"
|
126
133
|
Bone.ld "URI: #{path}"
|
127
134
|
Bone.ld "PARAMS: " << params.inspect
|
128
135
|
|
@@ -144,7 +151,9 @@ module Bone
|
|
144
151
|
else
|
145
152
|
raise Bone::Problem, "Unknown action: #{action}"
|
146
153
|
end
|
147
|
-
|
154
|
+
http = Net::HTTP.new(host, port)
|
155
|
+
http.use_ssl = true if uri.scheme == 'https'
|
156
|
+
res = http.request(req)
|
148
157
|
case res
|
149
158
|
when Net::HTTPSuccess, Net::HTTPRedirection
|
150
159
|
res.body
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Delano Mandelbaum
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-25 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - "="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0.2.
|
23
|
+
version: 0.2.4
|
24
24
|
version:
|
25
25
|
description: Get Bones
|
26
26
|
email: delano@solutious.com
|