unienv 0.0.5 → 0.0.6

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: cfcd9ac4060bffa0bfbcaa0694f0043de3607aba
4
- data.tar.gz: a2f09bea74b9c0456b6d61c491ccce199978a6b1
3
+ metadata.gz: 301e510c88269c6ed6f5fcfceedaf54c97993604
4
+ data.tar.gz: c8ebf9a352222ca4dd04271f2c6920d50b3bc594
5
5
  SHA512:
6
- metadata.gz: d8f88784805f473a564bbe887d2116586c526d1a43a05fba71ff1e3f79492f43ab558d18d48aee08f800ed5a4a6a850d76f1790b1c01b8a44a9612dd03f07010
7
- data.tar.gz: 964bc28dc2b52593f53e6162b68bde95624e5fe8b9b445a76774d8b2bea99c04928a15ed46d2e9c5ab426d809d3269f3f2cbb87ffceb0d2f7b4273eb356d27c0
6
+ metadata.gz: 9961da344a45f695500b06e3cb3031c0a5d774a30a6fee4a720c85db36c99983466233a490922ae3777c30f0a8d61d211d80d32b7b6bb56d1faeba54fb540259
7
+ data.tar.gz: bae9bf121c899fd5f40b9534a29cd68580cc9cdfb839db2ed080982e3fdd66a05f401d5b25b8a67587cd48e27c836357ba5edee72c063a68fb43515c8234c8c4
data/README.md CHANGED
@@ -52,8 +52,8 @@ $ unienv list
52
52
  Install Unity Editor to local that specified version.
53
53
 
54
54
  ```
55
- $ unienv install 5.2
56
- $ unienv install 5.1.3p2
55
+ $ sudo unienv install 5.2
56
+ $ sudo unienv install 5.1.3p2
57
57
  ```
58
58
 
59
59
 
data/bin/unienv CHANGED
@@ -16,6 +16,7 @@ program :description, 'Unity Environment Helper'
16
16
  program :help_formatter, :compact
17
17
 
18
18
  global_option('--verbose', 'VERBOSE') { $verbose = true }
19
+ global_option('--clean', 'CLEAN CACHE') { UniEnv.clean_tmpdir }
19
20
  #global_option('-p', '--project PATH', 'specify Unity project path') { |path| $project_path = path }
20
21
  #global_option('-u', '--unity PATH', 'specify Unity application path') { |path| $unity_app_path = path }
21
22
 
@@ -23,7 +24,7 @@ global_option('--verbose', 'VERBOSE') { $verbose = true }
23
24
  #p LIB_PATH
24
25
  #p ASSETS_PATH
25
26
  #app = UniEnv::App.new
26
- UniEnv.clean_tmpdir
27
+ #UniEnv.clean_tmpdir
27
28
 
28
29
  default_command :help
29
30
 
@@ -1,3 +1,3 @@
1
1
  module UniEnv
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/lib/unienv.rb CHANGED
@@ -2,6 +2,7 @@ require "unienv/version"
2
2
  require "yaml"
3
3
  require "tmpdir"
4
4
  require "open-uri"
5
+ require "httpclient"
5
6
  require "rexml/document"
6
7
  require "unienv/rss"
7
8
 
@@ -110,6 +111,7 @@ module UniEnv
110
111
  totalsize = nil
111
112
  size = 0
112
113
  progress = 0
114
+ print "download: #{uri}\n"
113
115
  OpenURI.open_uri(
114
116
  uri,
115
117
  {
@@ -131,9 +133,32 @@ module UniEnv
131
133
  )
132
134
  end
133
135
  def self.download(uri, path)
134
- File.open(path, "w+") do |f|
136
+ =begin
137
+ File.open(path, 'w') do |f|
135
138
  f.write(download_to_s(uri).read)
136
139
  end
140
+ =end
141
+ http_client = HTTPClient.new
142
+ uri = URI.parse(URI.encode(uri))
143
+ header = http_client.head(uri, nil, nil)
144
+ #p header
145
+ #p header.headers
146
+ totalsize = header.nil? ? 0 : header.headers["Content-Length"].to_i
147
+ http_client.receive_timeout = 60 * 120
148
+ size = 0
149
+ readblock = 0
150
+ File.open(path, 'w') do |file|
151
+ http_client.get_content(uri, nil, nil) do |chunk|
152
+ size += chunk.size
153
+ file.write chunk
154
+ blk = size / (100 * 1024 * 1024)
155
+ if readblock < blk
156
+ printf("Recv: %dMB\n", size / (1024 * 1024))
157
+ readblock = blk
158
+ end
159
+ end
160
+ end
161
+ printf("Recv: %dMB\n", size / (1024 * 1024))
137
162
  end
138
163
 
139
164
 
data/unienv.gemspec CHANGED
@@ -21,5 +21,6 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "bundler", "~> 1.7"
22
22
  spec.add_development_dependency "rake", "~> 10.0"
23
23
  spec.add_development_dependency "rspec"
24
- spec.add_dependency "commander", "~> 4.3"
24
+ spec.add_dependency "commander"
25
+ spec.add_dependency "httpclient"
25
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unienv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - fum1h1ro
@@ -56,16 +56,30 @@ dependencies:
56
56
  name: commander
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '4.3'
61
+ version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '4.3'
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: httpclient
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description: Unity Editor installer
70
84
  email:
71
85
  - fumihiro@gmail.com