rhodes-framework 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. data/.gitignore +2 -0
  2. data/History.txt +37 -0
  3. data/Manifest.txt +66 -0
  4. data/README.rdoc +2 -0
  5. data/Rakefile +50 -0
  6. data/lib/ServeME.rb +7 -0
  7. data/lib/TestServe.rb +9 -0
  8. data/lib/bsearch.rb +120 -0
  9. data/lib/builtinME.rb +626 -0
  10. data/lib/date/format.rb +1339 -0
  11. data/lib/date.rb +1792 -0
  12. data/lib/dateME.rb +24 -0
  13. data/lib/erb.rb +896 -0
  14. data/lib/find.rb +81 -0
  15. data/lib/rational.rb +19 -0
  16. data/lib/rationalME.rb +530 -0
  17. data/lib/rho/render.rb +51 -0
  18. data/lib/rho/rho.rb +255 -0
  19. data/lib/rho/rhoapplication.rb +36 -0
  20. data/lib/rho/rhocontact.rb +110 -0
  21. data/lib/rho/rhocontroller.rb +35 -0
  22. data/lib/rho/rhofsconnector.rb +32 -0
  23. data/lib/rho/rhosupport.rb +146 -0
  24. data/lib/rho/rhoviewhelpers.rb +130 -0
  25. data/lib/rho.rb +1 -0
  26. data/lib/rhodes-framework.rb +2 -0
  27. data/lib/rhodes.rb +9 -0
  28. data/lib/rhoframework.rb +38 -0
  29. data/lib/rhofsconnector.rb +1 -0
  30. data/lib/rhom/rhom.rb +58 -0
  31. data/lib/rhom/rhom_db_adapter.rb +185 -0
  32. data/lib/rhom/rhom_db_adapterME.rb +93 -0
  33. data/lib/rhom/rhom_object.rb +69 -0
  34. data/lib/rhom/rhom_object_factory.rb +309 -0
  35. data/lib/rhom/rhom_source.rb +60 -0
  36. data/lib/rhom.rb +1 -0
  37. data/lib/singleton.rb +137 -0
  38. data/lib/time.rb +489 -0
  39. data/lib/version.rb +8 -0
  40. data/res/sqlite3/constants.rb +49 -0
  41. data/res/sqlite3/database.rb +715 -0
  42. data/res/sqlite3/driver/dl/api.rb +154 -0
  43. data/res/sqlite3/driver/dl/driver.rb +307 -0
  44. data/res/sqlite3/driver/native/driver.rb +257 -0
  45. data/res/sqlite3/errors.rb +68 -0
  46. data/res/sqlite3/pragmas.rb +271 -0
  47. data/res/sqlite3/resultset.rb +176 -0
  48. data/res/sqlite3/sqlite3_api.rb +0 -0
  49. data/res/sqlite3/statement.rb +230 -0
  50. data/res/sqlite3/translator.rb +109 -0
  51. data/res/sqlite3/value.rb +57 -0
  52. data/res/sqlite3/version.rb +14 -0
  53. data/rhodes-framework.gemspec +18 -0
  54. data/rhodes.gemspec +18 -0
  55. data/spec/app_manifest.txt +4 -0
  56. data/spec/configs/account.rb +3 -0
  57. data/spec/configs/case.rb +3 -0
  58. data/spec/configs/employee.rb +3 -0
  59. data/spec/rho_controller_spec.rb +144 -0
  60. data/spec/rho_spec.rb +75 -0
  61. data/spec/rhom_object_factory_spec.rb +372 -0
  62. data/spec/rhom_spec.rb +45 -0
  63. data/spec/spec.opts +1 -0
  64. data/spec/spec_helper.rb +49 -0
  65. data/spec/stubs.rb +39 -0
  66. data/spec/syncdbtest.sqlite +0 -0
  67. metadata +202 -0
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ pkg
2
+ doc
data/History.txt ADDED
@@ -0,0 +1,37 @@
1
+ == 0.2.6 2009-01-29
2
+ * changed signature of url_for, link_to, and redirect
3
+
4
+ == 0.2.5 2009-01-28
5
+ * erb labels are now humanized
6
+
7
+ == 0.2.4 2009-01-27
8
+ * added show.erb to model generator [#164]
9
+ * base source_adapter should include user_id on sync
10
+
11
+ == 0.2.3 2009-01-26
12
+ * added newgem dependency
13
+
14
+ == 0.2.2 2009-01-23
15
+ * fixed bug in layout.erb template
16
+
17
+ == 0.2.1 2009-01-20
18
+ * adding new layout framework to generator [#45]
19
+
20
+ == 0.2.0 2009-01-07
21
+ * releasing 0.2 version of gem
22
+ * fixed sqlite3-ruby 1.2.4 dependency [#147]
23
+ * fixed broken rspec tests [#148]
24
+
25
+ == 0.1.3 2008-12-11
26
+ * Updated source_adapter generator to have base class
27
+ * fixed #50, removed dependency on Find library
28
+
29
+ == 0.1.2 2008-12-09
30
+ * Added rhogen source <MySourceAdapter>
31
+
32
+ == 0.1.1 2008-11-18
33
+ * Fixed template application name
34
+
35
+ == 0.1.0 2008-11-18
36
+ * 1 major enhancement:
37
+ * Initial release
data/Manifest.txt ADDED
@@ -0,0 +1,66 @@
1
+ .gitignore
2
+ History.txt
3
+ Manifest.txt
4
+ README.rdoc
5
+ Rakefile
6
+ lib/ServeME.rb
7
+ lib/TestServe.rb
8
+ lib/bsearch.rb
9
+ lib/builtinME.rb
10
+ lib/date.rb
11
+ lib/date/format.rb
12
+ lib/dateME.rb
13
+ lib/erb.rb
14
+ lib/find.rb
15
+ lib/rational.rb
16
+ lib/rationalME.rb
17
+ lib/rho.rb
18
+ lib/rho/render.rb
19
+ lib/rho/rho.rb
20
+ lib/rho/rhoapplication.rb
21
+ lib/rho/rhocontact.rb
22
+ lib/rho/rhocontroller.rb
23
+ lib/rho/rhofsconnector.rb
24
+ lib/rho/rhosupport.rb
25
+ lib/rho/rhoviewhelpers.rb
26
+ lib/rhodes-framework.rb
27
+ lib/rhodes.rb
28
+ lib/rhoframework.rb
29
+ lib/rhofsconnector.rb
30
+ lib/rhom.rb
31
+ lib/rhom/rhom.rb
32
+ lib/rhom/rhom_db_adapter.rb
33
+ lib/rhom/rhom_db_adapterME.rb
34
+ lib/rhom/rhom_object.rb
35
+ lib/rhom/rhom_object_factory.rb
36
+ lib/rhom/rhom_source.rb
37
+ lib/singleton.rb
38
+ lib/time.rb
39
+ lib/version.rb
40
+ res/sqlite3/constants.rb
41
+ res/sqlite3/database.rb
42
+ res/sqlite3/driver/dl/api.rb
43
+ res/sqlite3/driver/dl/driver.rb
44
+ res/sqlite3/driver/native/driver.rb
45
+ res/sqlite3/errors.rb
46
+ res/sqlite3/pragmas.rb
47
+ res/sqlite3/resultset.rb
48
+ res/sqlite3/sqlite3_api.rb
49
+ res/sqlite3/statement.rb
50
+ res/sqlite3/translator.rb
51
+ res/sqlite3/value.rb
52
+ res/sqlite3/version.rb
53
+ rhodes-framework.gemspec
54
+ rhodes.gemspec
55
+ spec/app_manifest.txt
56
+ spec/configs/account.rb
57
+ spec/configs/case.rb
58
+ spec/configs/employee.rb
59
+ spec/rho_controller_spec.rb
60
+ spec/rho_spec.rb
61
+ spec/rhom_object_factory_spec.rb
62
+ spec/rhom_spec.rb
63
+ spec/spec.opts
64
+ spec/spec_helper.rb
65
+ spec/stubs.rb
66
+ spec/syncdbtest.sqlite
data/README.rdoc ADDED
@@ -0,0 +1,2 @@
1
+ = rhodes framework
2
+ * See rhodes/README.rdoc for more information
data/Rakefile ADDED
@@ -0,0 +1,50 @@
1
+ %w[rubygems rake rake/clean fileutils newgem].each { |f| require f }
2
+ $:.unshift(File.join(File.dirname(__FILE__), 'lib'))
3
+ require 'lib/version.rb'
4
+ require 'rhodes-build'
5
+
6
+ task :default => [:spec]
7
+
8
+ # Generate all the Rake tasks
9
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
10
+ $hoe = Hoe.new('rhodes-framework', RhodesFramework::VERSION) do |p|
11
+ p.developer('Rhomobile Dev', 'dev@rhomobile.com')
12
+ p.changes = p.paragraphs_of("../History.txt", 0..1).join("\n\n") if File.exists? "../History.txt"
13
+ #p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
14
+ p.rubyforge_name = p.name # TODO this is default value
15
+ p.extra_deps = [
16
+ ['sqlite3-ruby','= 1.2.3'],
17
+ ['rcov'],
18
+ ['rspec'],
19
+ ['diff-lcs'],
20
+ ['extlib'],
21
+ ['newgem'],
22
+ ['activesupport']
23
+ ]
24
+
25
+ p.clean_globs |= %w[**/.DS_Store tmp *.log]
26
+ path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
27
+ p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
28
+ p.rsync_args = '-av --delete --ignore-errors'
29
+ p.test_globs = ''
30
+ p.summary = "rhodes-framework #{RhodesFramework::VERSION}"
31
+
32
+ end
33
+
34
+ require 'newgem/tasks' # load /tasks/*.rake
35
+ # remove test task TODO: why does this run anyway?
36
+ Rake.application.remove_task(:test)
37
+ Dir['tasks/**/*.rake'].each { |t| load t }
38
+
39
+ desc "Run the specs under spec"
40
+ Spec::Rake::SpecTask.new do |t|
41
+ t.spec_opts = ['--options', "spec/spec.opts"]
42
+ t.spec_files = FileList['spec/**/*_spec.rb']
43
+ t.rcov = true
44
+ t.rcov_opts = ['--include',
45
+ '"lib/rhom/*,lib/rho/*"',
46
+ '-x',
47
+ 'spec,gems,sqlite3/*,lib/date.rb,lib/rational.rb,lib/time.rb,lib/find.rb,config.rb,lib/erb.rb,lib/singleton.rb,lib/pairparser.rb',
48
+ '--text-report',
49
+ '--html']
50
+ end
data/lib/ServeME.rb ADDED
@@ -0,0 +1,7 @@
1
+ begin
2
+ require 'rho'
3
+ puts 'RHO loaded'
4
+ Rho::RHO.new
5
+ rescue Exception => e
6
+ puts e.message
7
+ end
data/lib/TestServe.rb ADDED
@@ -0,0 +1,9 @@
1
+ require 'rho'
2
+ puts 'RHO loaded'
3
+ r = Rho::RHO.new
4
+ req = Hash.new
5
+ req['application']="Rhosugar"
6
+ req['model'] = 'Account'
7
+ req['request-method']='GET'
8
+ puts r.serve(req)
9
+
data/lib/bsearch.rb ADDED
@@ -0,0 +1,120 @@
1
+ #
2
+ # Ruby/Bsearch - a binary search library for Ruby.
3
+ #
4
+ # Copyright (C) 2001 Satoru Takabayashi <satoru@namazu.org>
5
+ # All rights reserved.
6
+ # This is free software with ABSOLUTELY NO WARRANTY.
7
+ #
8
+ # You can redistribute it and/or modify it under the terms of
9
+ # the Ruby's licence.
10
+ #
11
+ # Example:
12
+ #
13
+ # % irb -r ./bsearch.rb
14
+ # >> %w(a b c c c d e f).bsearch_first {|x| x <=> "c"}
15
+ # => 2
16
+ # >> %w(a b c c c d e f).bsearch_last {|x| x <=> "c"}
17
+ # => 4
18
+ # >> %w(a b c e f).bsearch_first {|x| x <=> "c"}
19
+ # => 2
20
+ # >> %w(a b e f).bsearch_first {|x| x <=> "c"}
21
+ # => nil
22
+ # >> %w(a b e f).bsearch_last {|x| x <=> "c"}
23
+ # => nil
24
+ # >> %w(a b e f).bsearch_lower_boundary {|x| x <=> "c"}
25
+ # => 2
26
+ # >> %w(a b e f).bsearch_upper_boundary {|x| x <=> "c"}
27
+ # => 2
28
+ # >> %w(a b c c c d e f).bsearch_range {|x| x <=> "c"}
29
+ # => 2...5
30
+ # >> %w(a b c d e f).bsearch_range {|x| x <=> "c"}
31
+ # => 2...3
32
+ # >> %w(a b d e f).bsearch_range {|x| x <=> "c"}
33
+ # => 2...2
34
+
35
+ module Bsearch
36
+ VERSION = '1.5'
37
+ end
38
+
39
+ class Array
40
+ #
41
+ # The binary search algorithm is extracted from Jon Bentley's
42
+ # Programming Pearls 2nd ed. p.93
43
+ #
44
+
45
+ #
46
+ # Return the lower boundary. (inside)
47
+ #
48
+ def bsearch_lower_boundary (range = 0 ... self.length, &block)
49
+ lower = range.first() -1
50
+ upper = if range.exclude_end? then range.last else range.last + 1 end
51
+ while lower + 1 != upper
52
+ mid = ((lower + upper) / 2).to_i # for working with mathn.rb (Rational)
53
+ if yield(self[mid]) < 0
54
+ lower = mid
55
+ else
56
+ upper = mid
57
+ end
58
+ end
59
+ return upper
60
+ end
61
+
62
+ #
63
+ # This method searches the FIRST occurrence which satisfies a
64
+ # condition given by a block in binary fashion and return the
65
+ # index of the first occurrence. Return nil if not found.
66
+ #
67
+ def bsearch_first (range = 0 ... self.length, &block)
68
+ boundary = bsearch_lower_boundary(range, &block)
69
+ if boundary >= self.length || yield(self[boundary]) != 0
70
+ return nil
71
+ else
72
+ return boundary
73
+ end
74
+ end
75
+
76
+ alias bsearch bsearch_first
77
+
78
+ #
79
+ # Return the upper boundary. (outside)
80
+ #
81
+ def bsearch_upper_boundary (range = 0 ... self.length, &block)
82
+ lower = range.first() -1
83
+ upper = if range.exclude_end? then range.last else range.last + 1 end
84
+ while lower + 1 != upper
85
+ mid = ((lower + upper) / 2).to_i # for working with mathn.rb (Rational)
86
+ if yield(self[mid]) <= 0
87
+ lower = mid
88
+ else
89
+ upper = mid
90
+ end
91
+ end
92
+ return lower + 1 # outside of the matching range.
93
+ end
94
+
95
+ #
96
+ # This method searches the LAST occurrence which satisfies a
97
+ # condition given by a block in binary fashion and return the
98
+ # index of the last occurrence. Return nil if not found.
99
+ #
100
+ def bsearch_last (range = 0 ... self.length, &block)
101
+ # `- 1' for canceling `lower + 1' in bsearch_upper_boundary.
102
+ boundary = bsearch_upper_boundary(range, &block) - 1
103
+
104
+ if (boundary <= -1 || yield(self[boundary]) != 0)
105
+ return nil
106
+ else
107
+ return boundary
108
+ end
109
+ end
110
+
111
+ #
112
+ # Return the search result as a Range object.
113
+ #
114
+ def bsearch_range (range = 0 ... self.length, &block)
115
+ lower = bsearch_lower_boundary(range, &block)
116
+ upper = bsearch_upper_boundary(range, &block)
117
+ return lower ... upper
118
+ end
119
+ end
120
+