bone 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/CHANGES.txt +6 -0
  2. data/bone.gemspec +2 -2
  3. data/lib/bone.rb +15 -6
  4. metadata +3 -3
@@ -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
@@ -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.3"
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.0'
18
+ s.add_dependency 'boned', '= 0.2.4'
19
19
 
20
20
  # = MANIFEST =
21
21
  # git ls-files
@@ -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.3"
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
- host, port = *SOURCE.split(':')
124
- port ||= 6043
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
- res = Net::HTTP.start(host, port) {|http| http.request(req) }
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.3
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-10 00:00:00 -05:00
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.0
23
+ version: 0.2.4
24
24
  version:
25
25
  description: Get Bones
26
26
  email: delano@solutious.com