loom 0.0.43 → 0.0.45

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.43
1
+ 0.0.45
data/bin/loom CHANGED
@@ -3,7 +3,7 @@
3
3
  if(ENV['LIB_DIR'])
4
4
  $LOAD_PATH << File.expand_path(ENV['LIB_DIR'])
5
5
  else
6
- $LOAD_PATH << "./lib"
6
+ $LOAD_PATH << "#{File.expand_path(File.dirname(__FILE__))}/../lib"
7
7
  end
8
8
 
9
9
  require 'rubygems'
data/lib/helper.rb CHANGED
@@ -52,6 +52,14 @@ end
52
52
  # into the project
53
53
  def ensure_sdk_imported!
54
54
 
55
+ sdk_version = config["sdk_version"]
56
+
57
+ say "Checking for sdk #{sdk_version}"
58
+ if !sdk_installed? sdk_version
59
+ say "Couldn't find the #{sdk_version} sdk, downloading it'"
60
+ install_remote_sdk sdk_version
61
+ end
62
+
55
63
  # if the sdk artifacts are already here then we don't need to
56
64
  # do anything
57
65
  return if(File.exists?("LoomDemo.app") && File.directory?("bin"))
@@ -109,7 +117,7 @@ def configure_directory(dir)
109
117
  say "Configuring Project..."
110
118
 
111
119
  loom_config = {
112
- :sdk_version => "0.0.1"
120
+ :sdk_version => "cocos"
113
121
  }
114
122
 
115
123
  config_path = ""
@@ -209,10 +217,51 @@ def list_installed_sdks()
209
217
  exit(0)
210
218
  end
211
219
 
220
+ def install_remote_sdk(sdk_version)
221
+ sdk_path = File.join(LOOM_DIR, "sdks", sdk_version)
222
+ say "Downloading remote loom SDK..."
223
+ temp_file = download_sdk(sdk_version)
224
+ say "Installing remote loom SDK..."
225
+ unzip_file(temp_file, sdk_path)
226
+ File.delete(temp_file)
227
+ say_tab 1, "SDK installed. You can type 'loom use #{sdk_version}' in the future to use this SDK."
228
+ end
229
+
230
+ def get_default_sdk
231
+ get_global_config("default_sdk")
232
+ end
233
+
234
+ def set_default_sdk(sdk_version)
235
+ set_global_config("default_sdk", sdk_version)
236
+ say "Default SDK set to #{sdk_version}"
237
+ end
238
+
239
+ def installed_sdks
240
+
241
+ sdks = Array.new
242
+
243
+ Dir.foreach(File.join(LOOM_DIR, "sdks")) do |sdk|
244
+ is_directory = File.directory?(File.join(LOOM_DIR, "sdks", sdk))
245
+
246
+ if is_directory && sdk != "." && sdk != ".."
247
+ sdks << sdk
248
+ end
249
+ end
250
+
251
+ return sdks
252
+ end
253
+
212
254
  def sdk_installed?(version)
213
255
  File.directory?(File.join(LOOM_DIR, "sdks", version))
214
256
  end
215
257
 
258
+ def get_local_config(key)
259
+ ensure_configured!
260
+
261
+ loom_config = Loom::Config.load CONFIG_PATH
262
+ loom_config[key]
263
+ end
264
+
216
265
  def set_local_config(key, value)
217
266
  ensure_configured!
218
267
 
@@ -221,6 +270,11 @@ def set_local_config(key, value)
221
270
  loom_config.save! CONFIG_PATH
222
271
  end
223
272
 
273
+ def get_global_config(key)
274
+ loom_config = Loom::Config.load GLOBAL_CONFIG_PATH
275
+ loom_config[key]
276
+ end
277
+
224
278
  def set_global_config(key, value)
225
279
  loom_config = Loom::Config.load GLOBAL_CONFIG_PATH
226
280
  loom_config[key] = value
data/lib/loom/run.rb CHANGED
@@ -5,8 +5,11 @@ command :run do |c|
5
5
  c.description = ''
6
6
  c.example 'run your loom app', 'loom run'
7
7
 
8
+ setup_env c
9
+
8
10
  c.action do |args, options|
9
11
 
12
+ setup_host options
10
13
  ensure_sdk_imported!
11
14
 
12
15
  loom_config = Loom::Config.load CONFIG_PATH
data/lib/loom/sdk.rb CHANGED
@@ -26,7 +26,7 @@ command :sdk do |c|
26
26
  when "search"
27
27
  search_for_sdk(args, options)
28
28
  when "default"
29
- set_default_sdk(args, options)
29
+ set_default(args, options)
30
30
  when "list", nil
31
31
  list_installed_sdks
32
32
  else
@@ -37,7 +37,7 @@ command :sdk do |c|
37
37
 
38
38
  end
39
39
 
40
- def set_default_sdk(args, options)
40
+ def set_default(args, options)
41
41
 
42
42
  sdk_version = args.shift unless args.nil?
43
43
 
@@ -49,9 +49,7 @@ def set_default_sdk(args, options)
49
49
  exit 1
50
50
  end
51
51
 
52
- set_global_config("default_sdk", sdk_version)
53
-
54
- say "Default SDK set to #{sdk_version}"
52
+ set_default_sdk(sdk_version)
55
53
 
56
54
  end
57
55
 
@@ -81,18 +79,18 @@ def install_sdk(args, options)
81
79
  # if the sdk doesn't already exists
82
80
  if !File.directory?(sdk_path)
83
81
  if options.local.nil?
84
- say "Downloading remote loom SDK..."
85
- temp_file = download_sdk(sdk_version)
86
- say "Installing remote loom SDK..."
87
- unzip_file(temp_file, sdk_path)
88
- File.delete(temp_file)
89
- say_tab 1, "SDK installed. You can type 'loom use #{sdk_version}' in the future to use this SDK."
82
+ install_remote_sdk sdk_version
90
83
  else
91
84
  say "Installing local loom SDK..."
92
85
  unzip_file(options.local, sdk_path)
93
86
  say_tab 1, "SDK installed. You can type 'loom use #{sdk_version}' in the future to use this SDK."
94
87
  end
95
88
  end
89
+
90
+ # if this is the first installed sdk, set it as default
91
+ if get_default_sdk.nil?
92
+ set_default_sdk sdk_version
93
+ end
96
94
  end
97
95
 
98
96
  def uninstall_sdk(args, options)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.43
4
+ version: 0.0.45
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: 2012-09-07 00:00:00.000000000 Z
12
+ date: 2012-09-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: commander
@@ -200,7 +200,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
200
200
  version: '0'
201
201
  segments:
202
202
  - 0
203
- hash: 4584131822068820033
203
+ hash: -3593096211022723736
204
204
  required_rubygems_version: !ruby/object:Gem::Requirement
205
205
  none: false
206
206
  requirements: