devstructure 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -95,7 +95,19 @@ class DevStructure::API < Net::HTTP
95
95
  request = Net::HTTP::Post.new(@api.path("blueprints", @username, name))
96
96
  request.set_form_data params
97
97
  @api.headers.each { |key, value| request[key] = value }
98
- @api.request(request)
98
+ response = @api.request(request)
99
+ if Net::HTTPOK === response
100
+ uri = URI.parse("http://s3.amazonaws.com")
101
+ http = Net::HTTP.start(uri.host, uri.port)
102
+ JSON.parse(response.body).each do |filename, headers|
103
+ request = Net::HTTP::Put.new("/blueprint-sources/#{filename}")
104
+ headers.each { |key, value| request[key] = value }
105
+ request["Content-Length"] = File.size(filename)
106
+ request.body_stream = File.open(filename, "r")
107
+ http.request(request)
108
+ end
109
+ end
110
+ response
99
111
  end
100
112
 
101
113
  def delete(name, options={})
@@ -29,6 +29,10 @@ class DevStructure::Blueprint < Hash
29
29
  self[symbol.to_s]
30
30
  end
31
31
 
32
+ def arch
33
+ self["blueprint"]["_arch"]
34
+ end
35
+
32
36
  def files
33
37
  self["blueprint"]["_files"]
34
38
  end
@@ -37,6 +41,10 @@ class DevStructure::Blueprint < Hash
37
41
  self["blueprint"]["_packages"]
38
42
  end
39
43
 
44
+ def sources
45
+ self["blueprint"]["_sources"]
46
+ end
47
+
40
48
  def -(other)
41
49
  b = Marshal.load(Marshal.dump(self))
42
50
 
Binary file
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devstructure
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 4
10
- version: 0.1.4
9
+ - 5
10
+ version: 0.1.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Richard Crowley
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-23 00:00:00 +00:00
18
+ date: 2010-07-27 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency