titanic 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/titanic.rb +8 -12
  2. data/lib/titanic/version.rb +1 -1
  3. metadata +2 -2
data/lib/titanic.rb CHANGED
@@ -2,7 +2,7 @@ require "titanic/version"
2
2
  require 'logger'
3
3
  require 'aws-sdk'
4
4
  require 'fileutils'
5
- require 'net/http'
5
+ require 'open-uri'
6
6
  require 'json'
7
7
 
8
8
  module Titanic
@@ -66,18 +66,14 @@ module Titanic
66
66
  def get_deploy_from_http()
67
67
  proper_path = deploy_path
68
68
  proper_path = "/#{proper_path}" unless proper_path[0] == '/'
69
+ full_path = File.join(@url,proper_path)
69
70
  begin
70
- log.debug "trying to get #{proper_path} from #{@url}"
71
- uri = URI.parse File.join(@url,proper_path)
72
- http = Net::HTTP.new(uri.host, uri.port)
73
- request = Net::HTTP::Get.new(uri.request_uri)
74
- response = http.request(request)
75
- log.debug "response code is #{response.code}"
76
- raise "file does not exist" unless (response.code.to_i >= 200 && response.code.to_i < 300)
77
- return JSON.parse(response.body)
78
- rescue
79
- log.error "could not get deploy #{proper_path} from #{@url}. raising error"
80
- raise "could not get deploy #{proper_path} from #{@url}"
71
+ log.debug "trying to get #{full_path}"
72
+ body = URI.parse(full_path).read
73
+ return JSON.parse(body)
74
+ rescue Object => e
75
+ log.error "could not get deploy #{proper_path} from #{@url} because of #{e.inspect}"
76
+ raise e, "could not get deploy #{proper_path} from #{@url}"
81
77
  end
82
78
  end
83
79
 
@@ -1,3 +1,3 @@
1
1
  module Titanic
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: titanic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-18 00:00:00.000000000 Z
12
+ date: 2013-10-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler