droiuby 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/drby +6 -10
  2. data/lib/droiuby/project.rb +35 -1
  3. metadata +1 -1
data/bin/drby CHANGED
@@ -19,7 +19,8 @@ options = OptionParser.new do |o|
19
19
  drby live [PROJECT_NAME] [options] # runs a web instance of the app and tells Droiuby to load it.
20
20
  drby new PROJECT_NAME [options] # Create a new project
21
21
  drby pack [PROJECT_NAME] [options] # zips and packages an app
22
- drby switch INSTANCE_NAME [options] # Switch to the specified instance\n"
22
+ drby switch INSTANCE_NAME [options] # Switch to the specified instance
23
+ drby bundle # unzips all gems in vendor/cache for deployment to droiuby\n"
23
24
 
24
25
  o.separator ""
25
26
  o.separator "options:"
@@ -39,6 +40,8 @@ def valid_statement?(stmt)
39
40
  return true
40
41
  end
41
42
 
43
+ project = Project.new
44
+
42
45
  case command
43
46
  when 'new'
44
47
  project_name = ARGV[1]
@@ -48,13 +51,9 @@ case command
48
51
  puts "Usage: drby new PROJECT_NAME [options]"
49
52
  exit(1)
50
53
  end
51
-
52
- project = Project.new
53
54
  project.create(project_name,'')
54
55
  when 'console'
55
56
  puts "droiuby console"
56
- project = Project.new
57
-
58
57
  while buf = Readline.readline("droiuby > ", true)
59
58
 
60
59
  if buf=='refresh!'
@@ -90,7 +89,6 @@ case command
90
89
  puts "Usage: drby switch INSTANCE_NAME"
91
90
  exit(1)
92
91
  end
93
- project = Project.new
94
92
  project.switch(instance_name, $device_ip)
95
93
  when 'autostart'
96
94
  switch = ARGV[1]
@@ -98,7 +96,6 @@ case command
98
96
  puts "Usage: drby autostart true|false [NAMESPACE] [options]"
99
97
  exit(1)
100
98
  end
101
- project = Project.new
102
99
  project.autostart(switch, ARGV[2], $device_ip)
103
100
  when 'pack'
104
101
  project_name = nil
@@ -110,7 +107,6 @@ case command
110
107
  exit(1)
111
108
  end
112
109
  end
113
- project = Project.new
114
110
  project.package(project_name)
115
111
  when 'framework'
116
112
  if ARGV[1] == 'update'
@@ -125,8 +121,9 @@ case command
125
121
  project_name = ARGV[1]
126
122
  end
127
123
 
128
- project = Project.new
129
124
  project.execute(project_name, $device_ip, $droiuby_host)
125
+ when 'bundle'
126
+ project.bundle
130
127
  when 'live'
131
128
  project_name = nil
132
129
 
@@ -134,7 +131,6 @@ case command
134
131
  project_name = ARGV[1]
135
132
  end
136
133
 
137
- project = Project.new
138
134
  project.live(project_name, $device_ip, $droiuby_host, '')
139
135
  else
140
136
  puts options
@@ -28,6 +28,17 @@ class Project < Thor
28
28
  end
29
29
  }
30
30
 
31
+
32
+ desc "proximity [device_ip] [true|false]", "enable/disable proximity refresh"
33
+ def proximity(device_ip, proximity = 'false')
34
+ device_ip = map_device_ip(device_ip)
35
+ url_str = "http://#{device_ip}:4000/control?cmd=proximity&switch=#{proximity}"
36
+ uri = URI.parse(url_str)
37
+ # Shortcut
38
+ response = Net::HTTP.get_response(uri)
39
+ response.body
40
+ end
41
+
31
42
  desc "launch device IP [URL]","Tell droiuby to connect to app hosted at URL"
32
43
  def launch(device_ip, url)
33
44
 
@@ -260,6 +271,29 @@ class Project < Thor
260
271
  upload name, device_ip, source_dir
261
272
  end
262
273
 
274
+ desc "bundle", "unpack all cached gems"
275
+
276
+ def bundle
277
+ cache_dir = File.join('vendor','cache')
278
+
279
+ unless Dir.exists?(cache_dir)
280
+ puts `bundle package --all`
281
+ end
282
+
283
+ if Dir.exists?(cache_dir)
284
+ path = cache_dir
285
+ puts 'watch out for exploding gems'
286
+ Dir["#{path}/*.gem"].each do |file|
287
+ say_status 'unpack', file
288
+ `gem unpack #{file} --target ./vendor`
289
+ end
290
+ else
291
+ say_status 'error', "can't find cache directory /vendor/cache"
292
+ end
293
+
294
+
295
+ end
296
+
263
297
  private
264
298
 
265
299
  def compress(path, force = "false", archive_name = nil)
@@ -286,4 +320,4 @@ class Project < Thor
286
320
  say_status 'create', archive
287
321
  end
288
322
  end
289
- end
323
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: droiuby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: