factor 0.1.05 → 0.1.06
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/lib/client/client.rb +26 -30
- metadata +2 -2
data/lib/client/client.rb
CHANGED
@@ -12,12 +12,6 @@ module Factor
|
|
12
12
|
|
13
13
|
def initialize(host="http://factor.io")
|
14
14
|
@host=host
|
15
|
-
|
16
|
-
if ENV["FACTOR_HOST"]
|
17
|
-
@host=ENV['FACTOR_HOST']
|
18
|
-
code.call("Using #{@host} as host address")
|
19
|
-
end
|
20
|
-
|
21
15
|
end
|
22
16
|
|
23
17
|
def register(email,password)
|
@@ -62,31 +56,33 @@ module Factor
|
|
62
56
|
|
63
57
|
#load each channel
|
64
58
|
channels.each do |channel|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
# temp directory where zip will be decompressed
|
74
|
-
unzip_dir=temp_file.path[0..-5]
|
75
|
-
|
76
|
-
# download
|
77
|
-
open(uri.to_s,"rb") do |bin|
|
78
|
-
temp_file.print bin.read
|
79
|
-
end
|
80
|
-
temp_file.close
|
81
|
-
|
82
|
-
code.call("unzipping '#{channel['name']}'")
|
83
|
-
# unzip download zip into unzipped directory
|
84
|
-
unzip(temp_file.path,unzip_dir)
|
85
|
-
|
86
|
-
filename = unzip_dir + "/" + channel['module_name'].split(/(?=[A-Z])/).map{ |x| x.downcase }.join('_') + ".rb"
|
59
|
+
if !channel['zip_url'].empty?
|
60
|
+
code.call("downloading '#{channel['zip_url']}'")
|
61
|
+
# URI of the zip file containing the module
|
62
|
+
uri = URI.parse(channel['zip_url'])
|
63
|
+
|
64
|
+
# temp file to store the zip for download
|
65
|
+
#temp_file = Tempfile.new([uri.path.gsub(/\W+/,'-'), '.zip'], :encoding => 'ascii-8bit')
|
66
|
+
temp_file = Tempfile.new([uri.to_s.gsub(/\W+/,'-'), '.zip'])
|
87
67
|
|
88
|
-
|
89
|
-
|
68
|
+
# temp directory where zip will be decompressed
|
69
|
+
unzip_dir=temp_file.path[0..-5]
|
70
|
+
|
71
|
+
# download
|
72
|
+
open(uri.to_s,"rb") do |bin|
|
73
|
+
temp_file.print bin.read
|
74
|
+
end
|
75
|
+
temp_file.close
|
76
|
+
|
77
|
+
code.call("unzipping '#{channel['name']}'")
|
78
|
+
# unzip download zip into unzipped directory
|
79
|
+
unzip(temp_file.path,unzip_dir)
|
80
|
+
|
81
|
+
filename = unzip_dir + "/" + channel['module_name'].split(/(?=[A-Z])/).map{ |x| x.downcase }.join('_') + ".rb"
|
82
|
+
|
83
|
+
code.call("loading '#{channel["name"]}' into engine")
|
84
|
+
engine.load_channel(filename, channel)
|
85
|
+
end
|
90
86
|
end
|
91
87
|
|
92
88
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: factor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.06
|
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-02-
|
12
|
+
date: 2013-02-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|