spiderfw 0.6.13 → 0.6.14
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/VERSION +1 -1
- data/lib/spiderfw/app.rb +13 -8
- data/lib/spiderfw/cmd/commands/app.rb +2 -2
- data/lib/spiderfw/config/configuration.rb +1 -1
- data/lib/spiderfw/setup/app_manager.rb +41 -19
- data/lib/spiderfw/spider.rb +12 -1
- metadata +3 -3
data/CHANGELOG
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.14
|
data/lib/spiderfw/app.rb
CHANGED
@@ -333,12 +333,18 @@ END_OF_EVAL
|
|
333
333
|
end
|
334
334
|
spec
|
335
335
|
end
|
336
|
-
|
337
|
-
def
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
336
|
+
|
337
|
+
def get_runtime_dependencies
|
338
|
+
return self.load_after if @load_after
|
339
|
+
return self.depends + self.depends_optional
|
340
|
+
end
|
341
|
+
|
342
|
+
def gems_list
|
343
|
+
self.gems.map{ |g| g.is_a?(Array) ? g.first : g }
|
344
|
+
end
|
345
|
+
|
346
|
+
def gems_optional_list
|
347
|
+
self.gems_optional.map{ |g| g.is_a?(Array) ? g.first : g }
|
342
348
|
end
|
343
349
|
|
344
350
|
end
|
@@ -365,8 +371,7 @@ END_OF_EVAL
|
|
365
371
|
|
366
372
|
def tsort_each_child(node, &block)
|
367
373
|
return unless node.is_a?(AppSpec)
|
368
|
-
|
369
|
-
node.load_after.map{ |a| @apps_hash[a] }.each(&block)
|
374
|
+
node.get_runtime_dependencies.map{ |a| @apps_hash[a] }.each(&block)
|
370
375
|
end
|
371
376
|
|
372
377
|
def tsort
|
@@ -111,7 +111,7 @@ class AppCommand < CmdParse::Command
|
|
111
111
|
@no_deps = true
|
112
112
|
}
|
113
113
|
opt.on("--no-gems", _("Don't install ruby gems this app depends on"), "-g"){ |g| @no_gems = true }
|
114
|
-
opt.on("--
|
114
|
+
opt.on("--optional", _("Install optional app dependencies"), "-o"){ |o| @optional = true }
|
115
115
|
opt.on("--no-optional-gems", _("Don't install optional gem dependencies"), "-G"){ |g|
|
116
116
|
@no_optional_gems = true
|
117
117
|
}
|
@@ -125,7 +125,7 @@ class AppCommand < CmdParse::Command
|
|
125
125
|
end
|
126
126
|
require 'spiderfw/setup/app_manager'
|
127
127
|
options = {
|
128
|
-
:git => @git, :all => @all, :no_deps => @no_deps, :
|
128
|
+
:git => @git, :all => @all, :no_deps => @no_deps, :optional => @optional,
|
129
129
|
:no_gems => @no_gems, :no_optional_gems => @no_optional_gems, :no_activate => @no_activate
|
130
130
|
}
|
131
131
|
options[:url] = @server_url if @server_url
|
@@ -36,7 +36,7 @@ module Spider
|
|
36
36
|
begin
|
37
37
|
require 'git'
|
38
38
|
use_git = true
|
39
|
-
rescue => exc
|
39
|
+
rescue LoadError => exc
|
40
40
|
Spider.output exc.message, :ERROR
|
41
41
|
Spider.output "git gem not available; install git gem for Git support", :ERROR
|
42
42
|
end
|
@@ -61,7 +61,7 @@ module Spider
|
|
61
61
|
if options[:no_deps]
|
62
62
|
specs = client.get_specs(apps)
|
63
63
|
else
|
64
|
-
specs = client.get_deps(apps, :no_optional => options[:
|
64
|
+
specs = client.get_deps(apps, :no_optional => !options[:optional])
|
65
65
|
end
|
66
66
|
deps = specs.map{ |s| s.app_id }
|
67
67
|
unless (deps - apps).empty?
|
@@ -90,15 +90,6 @@ module Spider
|
|
90
90
|
require 'spiderfw/setup/app_server_client'
|
91
91
|
Spider.init_base
|
92
92
|
url = options[:url] || Spider.conf.get('app_server.url')
|
93
|
-
use_git = false
|
94
|
-
unless options[:no_git]
|
95
|
-
begin
|
96
|
-
require 'git'
|
97
|
-
use_git = true
|
98
|
-
rescue
|
99
|
-
Spider.output "git gem not available; install git gem for Git support"
|
100
|
-
end
|
101
|
-
end
|
102
93
|
if options[:all]
|
103
94
|
require 'spiderfw/home'
|
104
95
|
home = Spider::Home.new(Dir.pwd)
|
@@ -121,7 +112,7 @@ module Spider
|
|
121
112
|
Spider.output((deps - apps).inspect)
|
122
113
|
end
|
123
114
|
Spider::AppManager.update(specs, Dir.pwd, {
|
124
|
-
:use_git =>
|
115
|
+
:use_git => !options[:no_git],
|
125
116
|
:no_gems => options[:no_gems],
|
126
117
|
:no_optional_gems => options[:no_optional_gems]
|
127
118
|
})
|
@@ -190,10 +181,13 @@ module Spider
|
|
190
181
|
if File.directory?(File.join(home_path, '.git'))
|
191
182
|
begin
|
192
183
|
require 'git'
|
184
|
+
rescue LoadError
|
185
|
+
end
|
186
|
+
begin
|
193
187
|
repo = Git.open(home_path)
|
194
188
|
repo.add("apps/#{spec.id}")
|
195
189
|
repo.commit(_("Added app %s") % spec.id)
|
196
|
-
rescue
|
190
|
+
rescue => exc
|
197
191
|
end
|
198
192
|
end
|
199
193
|
end
|
@@ -203,10 +197,7 @@ module Spider
|
|
203
197
|
require 'rubygems/command.rb'
|
204
198
|
require 'rubygems/dependency_installer.rb'
|
205
199
|
unless options[:no_gems]
|
206
|
-
gems = specs.map{ |s| s.
|
207
|
-
# unless options[:no_optional_gems]
|
208
|
-
# gems += specs.map{ |s| s.gems_optional }
|
209
|
-
# end
|
200
|
+
gems = specs.map{ |s| s.gems_list }
|
210
201
|
gems = gems.flatten.uniq
|
211
202
|
gems.reject!{ |g| Spider.gem_available?(g) }
|
212
203
|
unless gems.empty?
|
@@ -217,6 +208,24 @@ module Spider
|
|
217
208
|
inst.install g
|
218
209
|
end
|
219
210
|
end
|
211
|
+
unless options[:no_optional_gems]
|
212
|
+
gems = specs.map{ |s| s.gems_optional_list }
|
213
|
+
gems = gems.flatten.uniq
|
214
|
+
gems.reject!{ |g| Spider.gem_available?(g) }
|
215
|
+
unless gems.empty?
|
216
|
+
Spider.output _("Installing the following optional gems:")
|
217
|
+
Spider.output gems.inspect
|
218
|
+
inst = Gem::DependencyInstaller.new
|
219
|
+
gems.each do |g|
|
220
|
+
begin
|
221
|
+
inst.install g
|
222
|
+
rescue => exc
|
223
|
+
Spider.output _("Unable to install optional gem %s:") % g
|
224
|
+
Spider.output exc, :ERROR
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
220
229
|
# unless Spider.gem_available?('bundler')
|
221
230
|
# puts _("Installing bundler gem")
|
222
231
|
# inst = Gem::DependencyInstaller.new
|
@@ -237,12 +246,23 @@ module Spider
|
|
237
246
|
specs = [specs] unless specs.is_a?(Array)
|
238
247
|
pre_setup(specs, options)
|
239
248
|
pre_update(specs, options)
|
249
|
+
git_available = nil
|
240
250
|
specs.each do |spec|
|
241
251
|
use_git = false
|
242
252
|
if spec.git_repo && options[:use_git]
|
243
253
|
app_path = File.join(home_path, "apps/#{spec.id}")
|
244
254
|
use_git = true if File.directory?(File.join(app_path, '.git'))
|
245
255
|
end
|
256
|
+
use_git = false if git_available == false
|
257
|
+
if use_git && git_available.nil?
|
258
|
+
begin
|
259
|
+
require 'git'
|
260
|
+
use_git = true
|
261
|
+
rescue LoadError => exc
|
262
|
+
Spider.output "git gem not available; install git gem for Git support"
|
263
|
+
use_git = false
|
264
|
+
end
|
265
|
+
end
|
246
266
|
if use_git
|
247
267
|
git_update(spec, home_path, options)
|
248
268
|
else
|
@@ -288,9 +308,11 @@ module Spider
|
|
288
308
|
FileUtils.mv(app_path, tmp_app_path)
|
289
309
|
begin
|
290
310
|
pack_install(spec, home_path)
|
291
|
-
FileUtils.
|
292
|
-
rescue
|
311
|
+
FileUtils.rm_rf(tmp_app_path)
|
312
|
+
rescue => exc
|
293
313
|
Spider.output _("Update of %s failed") % spec.id, :ERROR
|
314
|
+
Spider.output exc, :ERROR
|
315
|
+
FileUtils.rm_rf(app_path)
|
294
316
|
FileUtils.mv(tmp_app_path, app_path)
|
295
317
|
end
|
296
318
|
end
|
data/lib/spiderfw/spider.rb
CHANGED
@@ -98,6 +98,9 @@ module Spider
|
|
98
98
|
end
|
99
99
|
|
100
100
|
def init_base(force=false)
|
101
|
+
l = Spider.locale.to_s
|
102
|
+
l = $1 if l =~ /(\w\w)_+/
|
103
|
+
FastGettext.locale = l
|
101
104
|
return if @init_base_done && !force
|
102
105
|
|
103
106
|
@apps_to_load = []
|
@@ -774,7 +777,15 @@ module Spider
|
|
774
777
|
end
|
775
778
|
|
776
779
|
def locale
|
777
|
-
|
780
|
+
c_l = Spider.conf.get('locale')
|
781
|
+
return c_l if c_l
|
782
|
+
begin
|
783
|
+
@current_locale = Locale.current[0]
|
784
|
+
rescue
|
785
|
+
# There are problems with subsequent requests on Windows,
|
786
|
+
# so use cached locale if Locale.current fails
|
787
|
+
@current_locale || 'en'
|
788
|
+
end
|
778
789
|
end
|
779
790
|
|
780
791
|
def i18n(l = self.locale)
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 6
|
8
|
-
-
|
9
|
-
version: 0.6.
|
8
|
+
- 14
|
9
|
+
version: 0.6.14
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Ivan Pirlik
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-08-
|
17
|
+
date: 2011-08-04 00:00:00 +02:00
|
18
18
|
default_executable: spider
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|