unienv 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8716cd2cb5b448d73991a6e47ea5a90a2ca1552e
4
- data.tar.gz: ff7601b27d3b176890f198986b01c46d629e18ad
3
+ metadata.gz: 7fbf206ad83f702c07d73b7d3ef8ba5a05d8cfc6
4
+ data.tar.gz: b006bcc0ab272d93e4c3bf4329cd5a0e006a53b9
5
5
  SHA512:
6
- metadata.gz: f2e331f5503e016f33f72c81c8acc1e249aca579020683ee937d2a592494b24e111b6f6277012543e7cefb1ba8ece2d23ef781deb123c3440742540c81644a4b
7
- data.tar.gz: ad0250095ed3ff380b7d4a14d5ec206a9407641de979c949f94876191ce3b25fc6a1fa4c1e5d29a417f56e106c171ef196fae3dccb1aa0c9907151aaa4ee73bf
6
+ metadata.gz: 116c9709f29771c9891b2a0c31382a02c1eacc273ae9da236d450b6486a1c5c213ab4ec2408860e7724af7e0c91c60ce84e3f9638c1b4f396ab56f9f1caa6e14
7
+ data.tar.gz: 7c9cbf1c4bcd4b0e87b51517c2ccff457edd3403ef8e52139c9c33319836e43cf67c32c66f1a010d70dd8de515501ed068695663bb24f91401a97c47f3bca8fb
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Ubb
1
+ # unienv
2
2
 
3
3
  Helper for selecting Unity version.
4
4
 
@@ -1,4 +1,10 @@
1
1
  version:
2
+ 5.2.1f1:
3
+ editor: http://netstorage.unity3d.com/unity/44735ea161b3/MacEditorInstaller/Unity-5.2.1f1.pkg
4
+ standard_assets: http://netstorage.unity3d.com/unity/44735ea161b3/MacStandardAssetsInstaller/StandardAssets-5.2.1f1.pkg
5
+ 5.2.0p1:
6
+ editor: http://beta.unity3d.com/download/cd0778e591b3/MacEditorInstaller/Unity-5.2.0p1.pkg
7
+ standard_assets: http://beta.unity3d.com/download/cd0778e591b3/MacStandardAssetsInstaller/StandardAssets-5.2.0p1.pkg
2
8
  5.2.0f3:
3
9
  editor: http://netstorage.unity3d.com/unity/e7947df39b5c/MacEditorInstaller/Unity-5.2.0f3.pkg
4
10
  standard_assets: http://netstorage.unity3d.com/unity/e7947df39b5c/MacStandardAssetsInstaller/StandardAssets-5.2.0f3.pkg
data/lib/unienv/rss.rb ADDED
@@ -0,0 +1,23 @@
1
+ require "rexml/document"
2
+ require "cgi"
3
+
4
+
5
+ module Rss
6
+ def self.fetch_rss(uri)
7
+ s = UniEnv.download_to_s(uri).read
8
+ #s.gsub!(/&lt;/, '<')
9
+ #s.gsub!(/&gt;/, '>')
10
+ doc = REXML::Document.new(s)
11
+ versions = {}
12
+ doc.elements.each('rss/channel/item') do |e|
13
+ ver = (e.elements['title'].text.strip =~ /\APatch\s+(.+)\Z/)? $1 : ''
14
+ next if ver.empty? or ver[0] == '4'
15
+ desc = CGI.unescapeHTML(e.elements['description'].text)
16
+ editor = (desc =~ /Unity-#{ver}.pkg/)? $& : ''
17
+ assets = (desc =~ /StandardAssets-#{ver}.pkg/)? $& : ''
18
+ next if editor.empty? or assets.empty?
19
+ versions[ver] = [editor, assets]
20
+ end
21
+ versions
22
+ end
23
+ end
@@ -1,3 +1,3 @@
1
1
  module UniEnv
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/unienv.rb CHANGED
@@ -2,7 +2,8 @@ require "unienv/version"
2
2
  require "yaml"
3
3
  require "tmpdir"
4
4
  require "open-uri"
5
-
5
+ require "rexml/document"
6
+ require "unienv/rss"
6
7
 
7
8
  module UniEnv
8
9
  def self.sh(cmd)
@@ -105,32 +106,33 @@ module UniEnv
105
106
  find_cache("StandardAssets", version)
106
107
  end
107
108
 
108
- def self.download(uri, path)
109
+ def self.download_to_s(uri)
109
110
  totalsize = nil
110
111
  size = 0
111
112
  progress = 0
112
- sio =
113
- OpenURI.open_uri(
114
- uri,
115
- {
116
- :content_length_proc => lambda { |sz|
117
- totalsize = sz
118
- print "total: #{sz / 1024}KB\n"
119
- },
120
- :progress_proc => lambda { |sz|
121
- unless totalsize.nil?
122
- size = sz
123
- rate = ((size.to_f / totalsize.to_f) * 10).to_i
124
- if rate > progress
125
- print ". #{sz / 1024}KB\n"
126
- progress = rate
127
- end
113
+ OpenURI.open_uri(
114
+ uri,
115
+ {
116
+ :content_length_proc => lambda { |sz|
117
+ totalsize = sz
118
+ print "total: #{sz / 1024}KB\n"
119
+ },
120
+ :progress_proc => lambda { |sz|
121
+ unless totalsize.nil?
122
+ size = sz
123
+ rate = ((size.to_f / totalsize.to_f) * 10).to_i
124
+ if rate > progress
125
+ print ". #{sz / 1024}KB\n"
126
+ progress = rate
128
127
  end
129
- },
130
- }
131
- )
128
+ end
129
+ },
130
+ }
131
+ )
132
+ end
133
+ def self.download(uri, path)
132
134
  File.open(path, "w+") do |f|
133
- f.write(sio.read)
135
+ f.write(download_to_s(uri).read)
134
136
  end
135
137
  end
136
138
 
@@ -216,10 +218,49 @@ end
216
218
 
217
219
 
218
220
 
221
+ command :fetch do |c|
222
+
223
+ c.action do |args, options|
224
+ Rss.fetch_rss("http://unity3d.com/unity/qa/patch-releases/latest.xml")
225
+
226
+
227
+ #s = UniEnv.download_to_s("http://unity3d.com/unity/qa/patch-releases/latest.xml").read
228
+ #s.gsub!(/&lt;/, '<')
229
+ #s.gsub!(/&gt;/, '>')
230
+ #doc = REXML::Document.new(s)
231
+ #doc.elements.each('rss/channel/item') do |e|
232
+ # e.elements.each('title') do |t|
233
+ # p t.text
234
+ # end
235
+ # #p e['title']
236
+ #end
237
+
238
+
239
+
240
+
241
+
242
+
219
243
 
220
244
 
221
245
 
222
246
 
247
+ #sio = StringIO.new
248
+ #REXML::Formatters::Pretty.new.write(doc, sio)
249
+ #puts sio.string
250
+
251
+ #puts doc
252
+
253
+
254
+
255
+ end
256
+
257
+
258
+
259
+
260
+
261
+ end
262
+
263
+
223
264
 
224
265
 
225
266
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unienv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - fum1h1ro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-18 00:00:00.000000000 Z
11
+ date: 2015-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -82,6 +82,7 @@ files:
82
82
  - bin/unienv
83
83
  - lib/assets/unity_versions.yml
84
84
  - lib/unienv.rb
85
+ - lib/unienv/rss.rb
85
86
  - lib/unienv/version.rb
86
87
  - spec/spec_helper.rb
87
88
  - spec/unienv_spec.rb