biosphere 0.0.1 → 0.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7db29e14878fca926e12f7a6f393b1b9a469fb10
4
- data.tar.gz: 77bd008db21e926a6e8fa2d9038a0bccc0f6931d
3
+ metadata.gz: 940f2005624495fc81086e626786d411b3543065
4
+ data.tar.gz: eac7ef128ee3aa3ec68442b7ba3754d98eb0da96
5
5
  SHA512:
6
- metadata.gz: 3718f49c615032c74a2803843096660bc9e2c1bf9c9e6d1f793f0a289f698917a4ef40c631119242c3afeeca4372df8dbb3c1a2ec83de669f13db7bde585a565
7
- data.tar.gz: 69ca441a4659994b292630eef52e73bc827a65e9507419e2da8d742dd3041f62d88d1de9f685dd938a1e0c5765181c414176372fce2a0879ca072adf88ce6824
6
+ metadata.gz: fa9042cc9931f1f2db0c27cf98ca672f803ce9146bff94f151562903812ccc987174a30ae594d17eca6d2d0444985258c745ec13b73ff4fe0fe5f1e76d03c450
7
+ data.tar.gz: 3c6a5a5096772ea19571ca3d965212e3cdd1f7f40d7f39fbac71e41212179d6e524e5ecb6276cf176d1f7d35e48f6790df9170f269d5dc608370bc25e1577758
@@ -1,6 +1,8 @@
1
1
  require 'biosphere/mixing/from_file.rb'
2
2
  require 'json'
3
3
  require 'pathname'
4
+ require 'base64'
5
+ require 'zlib'
4
6
 
5
7
  class Biosphere
6
8
  class ActionContext
@@ -19,10 +21,10 @@ class Biosphere
19
21
  end
20
22
  end
21
23
 
22
-
24
+
23
25
  end
24
26
 
25
-
27
+
26
28
  class PlanProxy
27
29
  attr_accessor :node
28
30
  def initialize()
@@ -68,6 +70,11 @@ class Biosphere
68
70
  else
69
71
  @output[symbol] = args[0]
70
72
  end
73
+
74
+ # We need to first gzip and then base64-encode the user_data string to work around the 16kb size limitation in AWS
75
+ if symbol === :user_data
76
+ @output[symbol] = Base64.strict_encode64(Zlib::Deflate.new(nil, 31).deflate(args[0], Zlib::FINISH))
77
+ end
71
78
  end
72
79
  end
73
80
 
@@ -113,7 +120,7 @@ class Biosphere
113
120
  src_path = Pathname.new(@src_path.last + "/" + File.dirname(filename)).cleanpath.to_s
114
121
  # Push current src_path and overwrite @src_path so that it tracks recursive loads
115
122
  @src_path << src_path
116
-
123
+
117
124
  #puts "Trying to open file: " + src_path + "/" + File.basename(filename)
118
125
  if File.exists?(src_path + "/" + File.basename(filename))
119
126
  self.from_file(src_path + "/" + File.basename(filename))
@@ -166,13 +173,13 @@ class Biosphere
166
173
 
167
174
  def node
168
175
  return @plan_proxy.node
169
- end
170
-
176
+ end
177
+
171
178
  def evaluate_plans()
172
179
  @plans.each do |resource|
173
180
  @plan_proxy.instance_eval(&resource[:block])
174
181
  end
175
-
182
+
176
183
  end
177
184
 
178
185
  def call_action(name, context)
@@ -197,10 +204,10 @@ class Biosphere
197
204
  if block_given?
198
205
  resource[:block] = block
199
206
  else
200
- STDERR.puts("WARNING: No block set for resource call '#{type}', '#{name}' at #{caller[0]}")
207
+ STDERR.puts("WARNING: No block set for resource call '#{type}', '#{name}' at #{caller[0]}")
201
208
  end
202
209
 
203
-
210
+
204
211
 
205
212
  @resources << resource
206
213
 
@@ -1,3 +1,3 @@
1
1
  class Biosphere
2
- Version = "0.0.1"
2
+ Version = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: biosphere
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juho Mäkinen