spiderfw 0.6.20 → 0.6.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. data/CHANGELOG +13 -0
  2. data/README.rdoc +8 -2
  3. data/Rakefile +49 -24
  4. data/VERSION +1 -1
  5. data/apps/app_server/controllers/app_server_controller.rb +3 -2
  6. data/apps/app_server/lib/git_app.rb +11 -2
  7. data/apps/config_editor/_init.rb +2 -1
  8. data/apps/config_editor/controllers/config_editor_controller.rb +7 -1
  9. data/apps/drb_server/script/start_server.rb +1 -1
  10. data/apps/servant/bin/spider-servant.rb +1 -1
  11. data/blueprints/home/{spider.gemfile → Gemfile} +18 -3
  12. data/blueprints/install/config.ru +1 -1
  13. data/lib/spiderfw/app.rb +7 -0
  14. data/lib/spiderfw/cmd/cmd.rb +1 -1
  15. data/lib/spiderfw/cmd/commands/app.rb +6 -2
  16. data/lib/spiderfw/cmd/commands/cert.rb +1 -0
  17. data/lib/spiderfw/cmd/commands/console.rb +1 -1
  18. data/lib/spiderfw/cmd/commands/content.rb +2 -2
  19. data/lib/spiderfw/cmd/commands/create.rb +1 -1
  20. data/lib/spiderfw/cmd/commands/model.rb +2 -2
  21. data/lib/spiderfw/cmd/commands/setup.rb +1 -1
  22. data/lib/spiderfw/cmd/commands/test.rb +1 -1
  23. data/lib/spiderfw/config/options/spider.rb +2 -1
  24. data/lib/spiderfw/controller/controller.rb +15 -4
  25. data/lib/spiderfw/controller/mixins/visual.rb +2 -0
  26. data/lib/spiderfw/http/adapters/cgi.rb +3 -3
  27. data/lib/spiderfw/http/adapters/mongrel.rb +2 -2
  28. data/lib/spiderfw/http/adapters/rack.rb +2 -2
  29. data/lib/spiderfw/http/adapters/webrick.rb +2 -2
  30. data/lib/spiderfw/http/server.rb +26 -11
  31. data/lib/spiderfw/i18n/cldr.rb +8 -6
  32. data/lib/spiderfw/i18n/javascript_parser.rb +1 -0
  33. data/lib/spiderfw/init.rb +2 -0
  34. data/lib/spiderfw/model/base_model.rb +13 -3
  35. data/lib/spiderfw/model/condition.rb +4 -0
  36. data/lib/spiderfw/model/mappers/db_mapper.rb +9 -8
  37. data/lib/spiderfw/model/mappers/mapper.rb +18 -10
  38. data/lib/spiderfw/model/migrations/drop_table.rb +20 -0
  39. data/lib/spiderfw/model/migrations/replace.rb +18 -13
  40. data/lib/spiderfw/model/migrations.rb +5 -0
  41. data/lib/spiderfw/model/mixins/tree.rb +1 -1
  42. data/lib/spiderfw/model/model.rb +3 -0
  43. data/lib/spiderfw/model/storage/db/adapters/oracle.rb +1 -1
  44. data/lib/spiderfw/model/storage/db/adapters/sqlite.rb +1 -1
  45. data/lib/spiderfw/model/storage/db/connectors/jdbc_oracle.rb +1 -1
  46. data/lib/spiderfw/model/storage/db/connectors/oci8.rb +1 -1
  47. data/lib/spiderfw/model/storage/db/db_schema.rb +4 -1
  48. data/lib/spiderfw/model/storage/db/dialects/no_total_rows.rb +1 -1
  49. data/lib/spiderfw/setup/app_manager.rb +11 -3
  50. data/lib/spiderfw/setup/app_server_client.rb +13 -7
  51. data/lib/spiderfw/setup/setup_task.rb +43 -0
  52. data/lib/spiderfw/setup/spider_setup_wizard.rb +1 -1
  53. data/lib/spiderfw/spider.rb +16 -3
  54. data/lib/spiderfw/templates/blocks/html.rb +2 -0
  55. data/lib/spiderfw/templates/layout.rb +10 -5
  56. data/lib/spiderfw/templates/resources/less.rb +11 -8
  57. data/lib/spiderfw/templates/template_blocks.rb +1 -1
  58. data/lib/spiderfw/test/capybara.rb +2 -1
  59. data/lib/spiderfw/test.rb +2 -1
  60. data/lib/spiderfw.rb +1 -4
  61. data/spider.gemspec +5 -2
  62. metadata +47 -18
  63. data/blueprints/home/Gemfile.disabled +0 -3
@@ -74,6 +74,41 @@ module Spider
74
74
  m.mapper.sync_schema(false, options)
75
75
  end
76
76
  end
77
+
78
+ def confirm(msg, default=nil)
79
+ yes = _("yes")
80
+ no = _("no")
81
+ y = yes[0].chr
82
+ n = no[0].chr
83
+ if default == true
84
+ y = y.upcase
85
+ elsif default == false
86
+ n = n.upcase
87
+ end
88
+
89
+ good = false
90
+
91
+ while !good
92
+ print "#{msg} #{y}/#{n}]: "
93
+ res = $stdin.gets.strip
94
+
95
+ good = true
96
+ if res == yes || res == y
97
+ res = true
98
+ elsif res == no || res == n
99
+ res = false
100
+ elsif res.blank? && !default.nil?
101
+ res = default
102
+ else
103
+ good = false
104
+ end
105
+
106
+ end
107
+
108
+ return res
109
+
110
+
111
+ end
77
112
 
78
113
  # def no_sync_schema
79
114
  # @no_sync = true
@@ -145,6 +180,14 @@ module Spider
145
180
  @cleanup = proc if proc
146
181
  @cleanup
147
182
  end
183
+
184
+ def self.interactive!
185
+ @interactive = true
186
+ end
187
+
188
+ def self.interactive?
189
+ !!@interactive
190
+ end
148
191
 
149
192
  end
150
193
 
@@ -77,7 +77,7 @@ module Spider
77
77
  res = true
78
78
  elsif res == no || res == n
79
79
  res = false
80
- elsif options[:default]
80
+ elsif res.blank? && options[:default]
81
81
  res = options[:default]
82
82
  else
83
83
  good = false
@@ -73,7 +73,9 @@ module Spider
73
73
  end
74
74
  init_file = File.join($SPIDER_RUN_PATH, 'init.rb')
75
75
  ENV['BUNDLE_GEMFILE'] ||= File.join($SPIDER_RUN_PATH, 'Gemfile')
76
- require 'bundler/setup' if File.exists? ENV['BUNDLE_GEMFILE']
76
+ if File.exists?(ENV['BUNDLE_GEMFILE']) && File.exists?(File.join($SPIDER_RUN_PATH, 'Gemfile.lock'))
77
+ require 'bundler/setup'
78
+ end
77
79
 
78
80
  if File.exist?(init_file)
79
81
  @home.instance_eval(File.read(init_file), init_file)
@@ -85,8 +87,17 @@ module Spider
85
87
 
86
88
  def init_apps
87
89
  @apps.each do |name, mod|
90
+ repos = []
88
91
  if File.directory?(File.join(mod.path, 'po'))
89
- FastGettext.add_text_domain(mod.short_name, :path => File.join(mod.path, 'data', 'locale'))
92
+ repos << FastGettext::TranslationRepository.build(mod.short_name, :path => File.join(mod.path, 'data', 'locale'))
93
+ end
94
+ home_pot = File.join(Spider.paths[:root], 'po', "#{mod.short_name}.pot")
95
+ home_locale = File.join(Spider.paths[:root], 'data', 'locale')
96
+ if File.file?(home_pot) && File.directory?(home_locale)
97
+ repos << FastGettext::TranslationRepository.build(mod.short_name, :path => home_locale)
98
+ end
99
+ unless repos.empty?
100
+ FastGettext.add_text_domain(mod.short_name, :type => :chain, :chain => repos)
90
101
  end
91
102
  end
92
103
  @apps.each do |name, mod|
@@ -99,10 +110,10 @@ module Spider
99
110
  end
100
111
 
101
112
  def init_base(force=false)
113
+ return if @init_base_done && !force
102
114
  l = Spider.locale.to_s
103
115
  l = $1 if l =~ /(\w\w)_+/
104
116
  FastGettext.locale = l
105
- return if @init_base_done && !force
106
117
 
107
118
  @apps_to_load = []
108
119
  @root = $SPIDER_RUN_PATH
@@ -146,6 +157,7 @@ module Spider
146
157
 
147
158
  # Invoked before a long running service started. Apps may implement the app_startup method, that will be called.
148
159
  def startup
160
+ init
149
161
  setup_env
150
162
  if Spider.conf.get('template.cache.reload_on_restart')
151
163
  FileUtils.touch("#{Spider.paths[:tmp]}/templates_reload.txt")
@@ -314,6 +326,7 @@ module Spider
314
326
 
315
327
  # Closes any open loggers, and opens new ones based on configured settings.
316
328
  def start_loggers(force=false)
329
+ init_base
317
330
  return if @logger_started && !force
318
331
  @logger.close_all
319
332
  @logger.open(STDERR, Spider.conf.get('log.console')) if Spider.conf.get('log.console')
@@ -30,7 +30,9 @@ module Spider; module TemplateBlocks
30
30
  if @el.has_attribute?('id')
31
31
  cl += ' ' unless cl.empty?
32
32
  cl += "id-#{@el.get_attribute('id')}"
33
+ our_id = @el.get_attribute('id')
33
34
  @el.remove_attribute('id')
35
+ @el.set_attribute('id', "{ @widget[:full_id] }-#{our_id}")
34
36
  end
35
37
  if (options[:root])
36
38
  cl += " widget"
@@ -193,16 +193,21 @@ module Spider
193
193
  return ass unless ass[:src]
194
194
  if ass[:type] == :css
195
195
  ext = File.extname(ass[:path])
196
- if ['.scss', '.sass'].include?(ext)
196
+ compile_exts = ['.scss', '.sass', '.less']
197
+ if compile_exts.include?(ext)
197
198
  dir = File.dirname(ass[:path])
198
199
  base = File.basename(ass[:path], ext)
199
200
  newname = "#{base}.css"
200
201
  tmpdestdir = File.join(dir, 'stylesheets')
201
-
202
202
  dest = File.join(tmpdestdir, newname)
203
- require 'spiderfw/templates/resources/sass'
204
-
205
- Spider::SassCompiler.compile(ass[:path], dest)
203
+ compiler = if ['.scss', '.sass'].include?(ext)
204
+ require 'spiderfw/templates/resources/sass'
205
+ Spider::SassCompiler
206
+ elsif ext == '.less'
207
+ require 'spiderfw/templates/resources/less'
208
+ Spider::LessCompiler
209
+ end
210
+ compiler.compile(ass[:path], dest)
206
211
  ass[:path] = dest
207
212
  ass[:src] = File.join(File.dirname(ass[:src]), newname)
208
213
  end
@@ -1,14 +1,17 @@
1
- module Spider; module TemplateResources
1
+ require 'less-js'
2
+
3
+ module Spider
2
4
 
3
- module Less
5
+ module LessCompiler
4
6
 
5
- def self.process
6
-
7
-
8
-
7
+ def self.compile(src, dest)
8
+ output = LessJs.compile File.read(src)
9
+ File.open(dest, 'w') do |f|
10
+ f.write "/* This file is autogenerated; do not edit directly (edit #{src} instead) */\n\n"
11
+ f.write output
12
+ end
9
13
  end
10
14
 
11
15
  end
12
16
 
13
-
14
- end; end
17
+ end
@@ -141,7 +141,7 @@ module Spider
141
141
  when :plain
142
142
  res += escape_text(val)
143
143
  when :escaped_expr
144
- res += "{ #{val} }"
144
+ res += "{ #{escape_text(val)} }"
145
145
  when :expr
146
146
  res += "'+("+vars_to_scene(val)+").to_s+'"
147
147
  when :gettext
@@ -4,4 +4,5 @@ require 'capybara/cucumber'
4
4
  require 'culerity'
5
5
 
6
6
  Capybara.app = Spider::HTTP::RackApplication.new
7
- Capybara.default_host = 'localhost'
7
+ Capybara.default_host = 'localhost'
8
+ Capybara.app_host = 'http://localhost'
data/lib/spiderfw/test.rb CHANGED
@@ -62,8 +62,9 @@ module Spider; module Test
62
62
 
63
63
  def self.load_fixtures(app, truncate=false)
64
64
  path = File.join(app.path, 'test', 'fixtures')
65
+ loaded = []
65
66
  Dir.glob(File.join(path, '*.yml')).each do |yml|
66
- Spider::Model.load_fixtures(yml, truncate)
67
+ loaded += Spider::Model.load_fixtures(yml, truncate)
67
68
  end
68
69
  end
69
70
 
data/lib/spiderfw.rb CHANGED
@@ -1,4 +1 @@
1
- require 'spiderfw/spider'
2
-
3
-
4
- Spider::init()
1
+ require 'spiderfw/spider'
data/spider.gemspec CHANGED
@@ -38,9 +38,12 @@ Gem::Specification.new do |s|
38
38
  s.add_dependency("builder", ["> 2.1"])
39
39
  s.add_dependency("macaddr", [">= 1.0.0"])
40
40
  s.add_dependency("bundler")
41
+ s.add_dependency("mail")
41
42
  s.add_development_dependency("rake", ["> 0.7.3"])
42
- s.add_development_dependency("ruby-debug", ["> 0.9.3"])
43
- s.requirements << "Optional dependencies: ripl, ripl-irb, ripl-multi_line, json, openssl, sqlite3, webrick, mongrel, ruby-oci8 >2.0, mysql, yui-compressor, home_run, cldr"
43
+ s.add_development_dependency("gettext", ['>= 2.1.0'])
44
+ s.add_development_dependency("fssm")
45
+
46
+ s.requirements << "Optional dependencies: ripl, ripl-irb, ripl-multi_line, json, openssl, sqlite3, mongrel, ruby-oci8 >2.0, mysql, yui-compressor, cldr"
44
47
  # optional dependencies
45
48
  #
46
49
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spiderfw
3
3
  version: !ruby/object:Gem::Version
4
- hash: 47
4
+ hash: 45
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 20
10
- version: 0.6.20
9
+ - 21
10
+ version: 0.6.21
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ivan Pirlik
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-05 00:00:00 +02:00
18
+ date: 2011-11-03 00:00:00 +01:00
19
19
  default_executable: spider
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -186,9 +186,23 @@ dependencies:
186
186
  type: :runtime
187
187
  version_requirements: *id011
188
188
  - !ruby/object:Gem::Dependency
189
- name: rake
189
+ name: mail
190
190
  prerelease: false
191
191
  requirement: &id012 !ruby/object:Gem::Requirement
192
+ none: false
193
+ requirements:
194
+ - - ">="
195
+ - !ruby/object:Gem::Version
196
+ hash: 3
197
+ segments:
198
+ - 0
199
+ version: "0"
200
+ type: :runtime
201
+ version_requirements: *id012
202
+ - !ruby/object:Gem::Dependency
203
+ name: rake
204
+ prerelease: false
205
+ requirement: &id013 !ruby/object:Gem::Requirement
192
206
  none: false
193
207
  requirements:
194
208
  - - ">"
@@ -200,23 +214,37 @@ dependencies:
200
214
  - 3
201
215
  version: 0.7.3
202
216
  type: :development
203
- version_requirements: *id012
217
+ version_requirements: *id013
204
218
  - !ruby/object:Gem::Dependency
205
- name: ruby-debug
219
+ name: gettext
206
220
  prerelease: false
207
- requirement: &id013 !ruby/object:Gem::Requirement
221
+ requirement: &id014 !ruby/object:Gem::Requirement
208
222
  none: false
209
223
  requirements:
210
- - - ">"
224
+ - - ">="
211
225
  - !ruby/object:Gem::Version
212
- hash: 61
226
+ hash: 11
213
227
  segments:
228
+ - 2
229
+ - 1
214
230
  - 0
215
- - 9
216
- - 3
217
- version: 0.9.3
231
+ version: 2.1.0
218
232
  type: :development
219
- version_requirements: *id013
233
+ version_requirements: *id014
234
+ - !ruby/object:Gem::Dependency
235
+ name: fssm
236
+ prerelease: false
237
+ requirement: &id015 !ruby/object:Gem::Requirement
238
+ none: false
239
+ requirements:
240
+ - - ">="
241
+ - !ruby/object:Gem::Version
242
+ hash: 3
243
+ segments:
244
+ - 0
245
+ version: "0"
246
+ type: :development
247
+ version_requirements: *id015
220
248
  description: Spider is yet another Ruby framework.
221
249
  email: abmajor7@gmail.com
222
250
  executables:
@@ -984,10 +1012,9 @@ files:
984
1012
  - blueprints/home/.gitignore
985
1013
  - blueprints/home/apps/.gitignore
986
1014
  - blueprints/home/config/config.yml
987
- - blueprints/home/Gemfile.disabled
1015
+ - blueprints/home/Gemfile
988
1016
  - blueprints/home/init.rb
989
1017
  - blueprints/home/public/.gitignore
990
- - blueprints/home/spider.gemfile
991
1018
  - blueprints/home/tmp/.gitignore
992
1019
  - blueprints/home/var/.gitignore
993
1020
  - blueprints/home/var/cache/.gitignore
@@ -1065,6 +1092,7 @@ files:
1065
1092
  - lib/spiderfw/i18n/provider.rb
1066
1093
  - lib/spiderfw/i18n/rails.rb
1067
1094
  - lib/spiderfw/i18n/shtml_parser.rb
1095
+ - lib/spiderfw/init.rb
1068
1096
  - lib/spiderfw/model/active_record.rb
1069
1097
  - lib/spiderfw/model/base_model.rb
1070
1098
  - lib/spiderfw/model/condition.rb
@@ -1095,6 +1123,7 @@ files:
1095
1123
  - lib/spiderfw/model/mappers/proxy_mapper.rb
1096
1124
  - lib/spiderfw/model/mappers/vfs/flat_file.rb
1097
1125
  - lib/spiderfw/model/migrations/drop_element.rb
1126
+ - lib/spiderfw/model/migrations/drop_table.rb
1098
1127
  - lib/spiderfw/model/migrations/irreversible_migration.rb
1099
1128
  - lib/spiderfw/model/migrations/migration.rb
1100
1129
  - lib/spiderfw/model/migrations/replace.rb
@@ -1256,9 +1285,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1256
1285
  - 0
1257
1286
  version: "0"
1258
1287
  requirements:
1259
- - "Optional dependencies: ripl, ripl-irb, ripl-multi_line, json, openssl, sqlite3, webrick, mongrel, ruby-oci8 >2.0, mysql, yui-compressor, home_run, cldr"
1288
+ - "Optional dependencies: ripl, ripl-irb, ripl-multi_line, json, openssl, sqlite3, mongrel, ruby-oci8 >2.0, mysql, yui-compressor, cldr"
1260
1289
  rubyforge_project:
1261
- rubygems_version: 1.4.2
1290
+ rubygems_version: 1.6.2
1262
1291
  signing_key:
1263
1292
  specification_version: 3
1264
1293
  summary: A (web) framework
@@ -1,3 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- self.instance_eval(Bundler.read_file('spider.gemfile'), 'spider.gemfile', 1) if File.exist?('spider.gemfile')