rhodes-framework 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +3 -0
- data/Manifest.txt +8 -2
- data/README.txt +1 -0
- data/Rakefile +6 -30
- data/lib/builtinME.rb +67 -5
- data/lib/date.rb +121 -80
- data/lib/date/format.rb +44 -42
- data/lib/dateME.rb +2 -1
- data/lib/erb.rb +278 -238
- data/lib/rational.rb +2 -2
- data/lib/rho/rho.rb +59 -24
- data/lib/rho/rhoapplication.rb +13 -4
- data/lib/rho/rhocontroller.rb +7 -3
- data/lib/rho/rhoerror.rb +33 -0
- data/lib/rho/rhoutils.rb +5 -2
- data/lib/rhodes.rb +2 -2
- data/lib/rhom/rhom.rb +24 -11
- data/lib/rhom/rhom_db_adapter.rb +56 -23
- data/lib/rhom/rhom_object.rb +3 -32
- data/lib/rhom/rhom_object_factory.rb +154 -154
- data/lib/rhom/rhom_source.rb +9 -9
- data/lib/singleton.rb +3 -3
- data/lib/time.rb +20 -2
- data/lib/version.rb +2 -2
- data/spec/app/mspec/matchers/raise_error.rb +2 -1
- data/spec/app/spec/fixtures/object_values.txt +2 -2
- data/spec/app/spec/pagination/fixtures/object_values.txt +91 -0
- data/spec/app/spec/rho_controller_spec.rb +2 -2
- data/spec/app/spec/rho_spec.rb +8 -3
- data/spec/app/spec/rhom_db_adapter_spec.rb +27 -0
- data/spec/app/spec/{rhom_object_factory_spec.rb → rhom_object_spec.rb} +125 -10
- data/spec/app/spec/rhom_spec.rb +19 -8
- data/spec/app/spec/rhoruby_spec.rb +31 -0
- data/spec/app/spec/spec_helper.rb +2 -1
- data/spec/app/spec/syncengine_spec.rb +30 -0
- data/spec/app/spec_runner.rb +9 -5
- data/spec/build.yml +3 -2
- data/spec/rhoconfig.txt +2 -0
- metadata +19 -83
- data/lib/rhom/rhom_db_adapterME.rb +0 -92
data/spec/app/spec/rhom_spec.rb
CHANGED
@@ -20,30 +20,41 @@
|
|
20
20
|
require 'spec/spec_helper'
|
21
21
|
|
22
22
|
describe "Rhom" do
|
23
|
+
|
24
|
+
CLIENT_ID = '67320d31-e42e-4156-af91-5d9bd7175b08'
|
23
25
|
|
24
26
|
it_should_behave_like "rhom initializer"
|
25
27
|
|
26
28
|
it "should get client_id" do
|
27
|
-
Rhom::Rhom::client_id.should ==
|
29
|
+
Rhom::Rhom::client_id.should == CLIENT_ID
|
28
30
|
end
|
29
31
|
|
30
32
|
it "should perform full reset of database" do
|
31
33
|
Rhom::Rhom::database_full_reset
|
32
|
-
|
33
|
-
Rhom::RhomDbAdapter::select_from_table('client_info','*').length.should == 0
|
34
|
-
Rhom::Rhom::client_id.should be_nil
|
34
|
+
verify_reset
|
35
35
|
end
|
36
36
|
|
37
37
|
it "should perform full database reset and logout" do
|
38
38
|
Rhom::Rhom::database_full_reset_and_logout
|
39
|
-
|
40
|
-
Rhom::RhomDbAdapter::select_from_table('client_info','*').length.should == 0
|
41
|
-
Rhom::Rhom::client_id.should be_nil
|
39
|
+
verify_reset
|
42
40
|
end
|
43
41
|
|
44
42
|
it "should call select_from_table with select array" do
|
45
43
|
sel_arr = ['name','industry']
|
46
|
-
@res = Rhom::RhomDbAdapter::select_from_table(
|
44
|
+
@res = Rhom::RhomDbAdapter::select_from_table('object_values', '*', {'object' => '44e804f2-4933-4e20-271c-48fcecd9450d'}, nil, sel_arr)
|
47
45
|
@res.length.should == 2
|
48
46
|
end
|
47
|
+
|
48
|
+
def verify_reset
|
49
|
+
Rhom::RhomDbAdapter::select_from_table('object_values','*').length.should == 0
|
50
|
+
res = Rhom::RhomDbAdapter::select_from_table('client_info','*')
|
51
|
+
res.length.should == 1
|
52
|
+
res[0]['reset'].should == 1
|
53
|
+
res[0]['client_id'].should == CLIENT_ID
|
54
|
+
|
55
|
+
Rhom::RhomDbAdapter::select_from_table('sources','*').each do |source|
|
56
|
+
source['token'].should == 0
|
57
|
+
end
|
58
|
+
Rhom::Rhom::client_id.should == CLIENT_ID
|
59
|
+
end
|
49
60
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#
|
2
|
+
# rhoruby_spec.rb
|
3
|
+
# rhodes
|
4
|
+
#
|
5
|
+
# Copyright (C) 2008 Rhomobile, Inc. All rights reserved.
|
6
|
+
#
|
7
|
+
# This program is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# This program is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
#
|
20
|
+
require 'spec/spec_helper'
|
21
|
+
|
22
|
+
describe "RhoRuby" do
|
23
|
+
|
24
|
+
it "should compute string to_f to test flt_rounds" do
|
25
|
+
"100.250".to_f.should == 100.25
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should compute == on float to test flt_rounds" do
|
29
|
+
1.0.should == 1
|
30
|
+
end
|
31
|
+
end
|
@@ -8,8 +8,9 @@ describe "rhom initializer", :shared => true do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
after(:each) do
|
11
|
+
Rhom::RhomDbAdapter.start_transaction
|
11
12
|
Rhom::RhomDbAdapter.delete_all_from_table('client_info')
|
12
13
|
Rhom::RhomDbAdapter.delete_all_from_table('object_values')
|
13
|
-
|
14
|
+
Rhom::RhomDbAdapter.commit
|
14
15
|
end
|
15
16
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#
|
2
|
+
# syncengine_spec.rb
|
3
|
+
# rhodes
|
4
|
+
#
|
5
|
+
# Copyright (C) 2008 Rhomobile, Inc. All rights reserved.
|
6
|
+
#
|
7
|
+
# This program is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# This program is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
#
|
20
|
+
require 'spec/spec_helper'
|
21
|
+
require 'rho/rho'
|
22
|
+
|
23
|
+
describe "SyncEngine" do
|
24
|
+
|
25
|
+
it "should update syncserver at runtime" do
|
26
|
+
SyncEngine.set_syncserver('http://example.com/sources/')
|
27
|
+
@rho = Rho::RHO.new
|
28
|
+
Rho::RhoConfig.syncserver.should == 'http://example.com/sources/'
|
29
|
+
end
|
30
|
+
end
|
data/spec/app/spec_runner.rb
CHANGED
@@ -10,11 +10,15 @@ class SpecRunner < MSpecScript
|
|
10
10
|
# turn on exception backtrace
|
11
11
|
MSpec.backtrace = true
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
config[:files] << 'spec/rhom_spec'
|
14
|
+
config[:files] << 'spec/rhoruby_spec'
|
15
|
+
config[:files] << 'spec/rho_controller_spec'
|
16
|
+
config[:files] << 'spec/rhom_object_spec'
|
17
|
+
config[:files] << 'spec/rho_spec'
|
18
|
+
config[:files] << 'spec/spec_helper'
|
19
|
+
config[:files] << 'spec/webview_spec'
|
20
|
+
config[:files] << 'spec/syncengine_spec'
|
21
|
+
config[:files] << 'spec/rhom_db_adapter_spec'
|
18
22
|
end
|
19
23
|
|
20
24
|
def run
|
data/spec/build.yml
CHANGED
@@ -10,14 +10,15 @@ env:
|
|
10
10
|
selfsignname: "CN=Anton OU=Development OR=RhoMobile CO=RU EM=anton@rhomobile.com"
|
11
11
|
selfsignpwd: "1234"
|
12
12
|
paths:
|
13
|
+
java: C:/Program Files/Java/jdk1.6.0_11/bin
|
14
|
+
android: C:/android-sdk-windows-1.5_r2
|
15
|
+
|
13
16
|
4.6:
|
14
17
|
jde: C:/Program Files/Research In Motion/BlackBerry JDE 4.6.0
|
15
|
-
java: C:/Program Files/Java/jdk1.6.0_11/bin
|
16
18
|
mds: C:/Program Files/Research In Motion/BlackBerry JDE 4.6.0/MDS
|
17
19
|
sim: 9000
|
18
20
|
4.2:
|
19
21
|
jde: C:/Program Files/Research In Motion/BlackBerry JDE 4.2.0
|
20
|
-
java: C:/Install/Java/jdk1.6.0_11/bin
|
21
22
|
mds: C:/Program Files/Research In Motion/BlackBerry Email and MDS Services Simulators 4.1.2/MDS
|
22
23
|
sim: 8100
|
23
24
|
cabwiz: C:/Program Files/Windows Mobile 6 SDK/Tools/CabWiz/cabwiz.exe
|
data/spec/rhoconfig.txt
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rhodes-framework
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rhomobile Dev
|
@@ -9,79 +9,9 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-08-05 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
|
-
- !ruby/object:Gem::Dependency
|
16
|
-
name: sqlite3-ruby
|
17
|
-
type: :runtime
|
18
|
-
version_requirement:
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
20
|
-
requirements:
|
21
|
-
- - "="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 1.2.3
|
24
|
-
version:
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name: rcov
|
27
|
-
type: :runtime
|
28
|
-
version_requirement:
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: "0"
|
34
|
-
version:
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: rspec
|
37
|
-
type: :runtime
|
38
|
-
version_requirement:
|
39
|
-
version_requirements: !ruby/object:Gem::Requirement
|
40
|
-
requirements:
|
41
|
-
- - ">="
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: "0"
|
44
|
-
version:
|
45
|
-
- !ruby/object:Gem::Dependency
|
46
|
-
name: diff-lcs
|
47
|
-
type: :runtime
|
48
|
-
version_requirement:
|
49
|
-
version_requirements: !ruby/object:Gem::Requirement
|
50
|
-
requirements:
|
51
|
-
- - ">="
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: "0"
|
54
|
-
version:
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: extlib
|
57
|
-
type: :runtime
|
58
|
-
version_requirement:
|
59
|
-
version_requirements: !ruby/object:Gem::Requirement
|
60
|
-
requirements:
|
61
|
-
- - ">="
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
version: "0"
|
64
|
-
version:
|
65
|
-
- !ruby/object:Gem::Dependency
|
66
|
-
name: newgem
|
67
|
-
type: :runtime
|
68
|
-
version_requirement:
|
69
|
-
version_requirements: !ruby/object:Gem::Requirement
|
70
|
-
requirements:
|
71
|
-
- - ">="
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
version: "0"
|
74
|
-
version:
|
75
|
-
- !ruby/object:Gem::Dependency
|
76
|
-
name: activesupport
|
77
|
-
type: :runtime
|
78
|
-
version_requirement:
|
79
|
-
version_requirements: !ruby/object:Gem::Requirement
|
80
|
-
requirements:
|
81
|
-
- - ">="
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version: "0"
|
84
|
-
version:
|
85
15
|
- !ruby/object:Gem::Dependency
|
86
16
|
name: hoe
|
87
17
|
type: :development
|
@@ -90,9 +20,9 @@ dependencies:
|
|
90
20
|
requirements:
|
91
21
|
- - ">="
|
92
22
|
- !ruby/object:Gem::Version
|
93
|
-
version:
|
23
|
+
version: 2.3.2
|
94
24
|
version:
|
95
|
-
description:
|
25
|
+
description: ""
|
96
26
|
email:
|
97
27
|
- dev@rhomobile.com
|
98
28
|
executables: []
|
@@ -100,14 +30,14 @@ executables: []
|
|
100
30
|
extensions: []
|
101
31
|
|
102
32
|
extra_rdoc_files:
|
33
|
+
- History.txt
|
103
34
|
- Manifest.txt
|
104
|
-
-
|
105
|
-
- spec/app/spec/fixtures/object_values.txt
|
106
|
-
- spec/public/images/IUI_LICENSE.txt
|
107
|
-
- spec/rhoconfig.txt
|
35
|
+
- README.txt
|
108
36
|
files:
|
109
37
|
- .gitignore
|
38
|
+
- History.txt
|
110
39
|
- Manifest.txt
|
40
|
+
- README.txt
|
111
41
|
- Rakefile
|
112
42
|
- lib/ServeME.rb
|
113
43
|
- lib/bsearch.rb
|
@@ -125,6 +55,7 @@ files:
|
|
125
55
|
- lib/rho/rhoapplication.rb
|
126
56
|
- lib/rho/rhocontact.rb
|
127
57
|
- lib/rho/rhocontroller.rb
|
58
|
+
- lib/rho/rhoerror.rb
|
128
59
|
- lib/rho/rhofsconnector.rb
|
129
60
|
- lib/rho/rhosupport.rb
|
130
61
|
- lib/rho/rhoutils.rb
|
@@ -136,7 +67,6 @@ files:
|
|
136
67
|
- lib/rhom.rb
|
137
68
|
- lib/rhom/rhom.rb
|
138
69
|
- lib/rhom/rhom_db_adapter.rb
|
139
|
-
- lib/rhom/rhom_db_adapterME.rb
|
140
70
|
- lib/rhom/rhom_object.rb
|
141
71
|
- lib/rhom/rhom_object_factory.rb
|
142
72
|
- lib/rhom/rhom_source.rb
|
@@ -263,11 +193,15 @@ files:
|
|
263
193
|
- spec/app/mspec/version.rb
|
264
194
|
- spec/app/spec/fixtures/client_info.txt
|
265
195
|
- spec/app/spec/fixtures/object_values.txt
|
196
|
+
- spec/app/spec/pagination/fixtures/object_values.txt
|
266
197
|
- spec/app/spec/rho_controller_spec.rb
|
267
198
|
- spec/app/spec/rho_spec.rb
|
268
|
-
- spec/app/spec/
|
199
|
+
- spec/app/spec/rhom_db_adapter_spec.rb
|
200
|
+
- spec/app/spec/rhom_object_spec.rb
|
269
201
|
- spec/app/spec/rhom_spec.rb
|
202
|
+
- spec/app/spec/rhoruby_spec.rb
|
270
203
|
- spec/app/spec/spec_helper.rb
|
204
|
+
- spec/app/spec/syncengine_spec.rb
|
271
205
|
- spec/app/spec/webview_spec.rb
|
272
206
|
- spec/app/spec_runner.rb
|
273
207
|
- spec/build.yml
|
@@ -304,6 +238,8 @@ files:
|
|
304
238
|
- spec/rhoconfig.txt
|
305
239
|
has_rdoc: true
|
306
240
|
homepage:
|
241
|
+
licenses: []
|
242
|
+
|
307
243
|
post_install_message:
|
308
244
|
rdoc_options:
|
309
245
|
- --main
|
@@ -325,9 +261,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
325
261
|
requirements: []
|
326
262
|
|
327
263
|
rubyforge_project: rhodes-framework
|
328
|
-
rubygems_version: 1.3.
|
264
|
+
rubygems_version: 1.3.5
|
329
265
|
signing_key:
|
330
|
-
specification_version:
|
331
|
-
summary:
|
266
|
+
specification_version: 3
|
267
|
+
summary: ""
|
332
268
|
test_files: []
|
333
269
|
|
@@ -1,92 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# rhom_db_adapter.rb
|
3
|
-
# rhodes
|
4
|
-
#
|
5
|
-
# Copyright (C) 2008 Rhomobile, Inc. All rights reserved.
|
6
|
-
#
|
7
|
-
# This program is free software: you can redistribute it and/or modify
|
8
|
-
# it under the terms of the GNU General Public License as published by
|
9
|
-
# the Free Software Foundation, either version 3 of the License, or
|
10
|
-
# (at your option) any later version.
|
11
|
-
#
|
12
|
-
# This program is distributed in the hope that it will be useful,
|
13
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
-
# GNU General Public License for more details.
|
16
|
-
#
|
17
|
-
# You should have received a copy of the GNU General Public License
|
18
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
|
-
#
|
20
|
-
require 'rhodes'
|
21
|
-
|
22
|
-
module Rhom
|
23
|
-
class RhomDbAdapter
|
24
|
-
|
25
|
-
@@database = nil
|
26
|
-
|
27
|
-
class << self
|
28
|
-
def open(dbfile=nil)
|
29
|
-
puts "DB name = " + dbfile.inspect
|
30
|
-
unless @@database or dbfile.nil?
|
31
|
-
db = DbAdapter.new(Rhodes::DBVERSION)
|
32
|
-
@@database = db
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def close
|
37
|
-
if @@database and not @@database.closed?
|
38
|
-
@@database.close
|
39
|
-
@@database = nil
|
40
|
-
else
|
41
|
-
return false
|
42
|
-
end
|
43
|
-
return true
|
44
|
-
end
|
45
|
-
|
46
|
-
# execute a sql statement
|
47
|
-
# optionally, disable the factory processing
|
48
|
-
# which returns the result array directly
|
49
|
-
def execute_sql
|
50
|
-
result = []
|
51
|
-
# Make sure we lock the sync engine's mutex
|
52
|
-
# before we perform a database transaction.
|
53
|
-
# This prevents concurrency issues.
|
54
|
-
begin
|
55
|
-
SyncEngine::lock_sync_mutex
|
56
|
-
result = yield
|
57
|
-
SyncEngine::unlock_sync_mutex
|
58
|
-
rescue Exception => e
|
59
|
-
puts "exception when running query: #{e}"
|
60
|
-
# make sure we unlock even if there's an error!
|
61
|
-
SyncEngine::unlock_sync_mutex
|
62
|
-
end
|
63
|
-
puts "returned #{result.length.to_s} records..."
|
64
|
-
result
|
65
|
-
end
|
66
|
-
|
67
|
-
def select_from_table(table=nil,columns=nil,condition=nil,params=nil)
|
68
|
-
execute_sql { @@database.selectFromTable(table, columns, condition, params) }
|
69
|
-
end
|
70
|
-
|
71
|
-
def insert_into_table(table=nil,values=nil)
|
72
|
-
execute_sql { @@database.insertIntoTable(table, values) }
|
73
|
-
end
|
74
|
-
|
75
|
-
def delete_from_table(table=nil,condition=nil)
|
76
|
-
execute_sql { @@database.deleteFromTable(table, condition) }
|
77
|
-
end
|
78
|
-
|
79
|
-
def delete_all_from_table(table=nil)
|
80
|
-
execute_sql { @@database.deleteAllFromTable(table) }
|
81
|
-
end
|
82
|
-
|
83
|
-
def update_into_table(table=nil,values=nil,condition=nil)
|
84
|
-
execute_sql { @@database.updateIntoTable(table, values, condition) }
|
85
|
-
end
|
86
|
-
end # class methods
|
87
|
-
end # RhomDbAdapter
|
88
|
-
end # Rhom
|
89
|
-
|
90
|
-
at_exit do
|
91
|
-
Rhom::RhomDbAdapter::close
|
92
|
-
end
|