rhodes-framework 1.0.10 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +159 -30
- data/Rakefile +3 -19
- data/lib/erb.rb +1 -1
- data/lib/rho/rho.rb +94 -107
- data/lib/rho/rhofsconnector.rb +4 -0
- data/lib/rho/rhoutils.rb +26 -0
- data/lib/rho/rhoviewhelpers.rb +1 -1
- data/lib/rhodes.rb +2 -2
- data/lib/rhoframework.rb +9 -9
- data/lib/rhom/rhom.rb +1 -1
- data/lib/rhom/rhom_db_adapter.rb +36 -15
- data/lib/rhom/rhom_db_adapterME.rb +2 -3
- data/lib/rhom/rhom_object.rb +14 -2
- data/lib/rhom/rhom_object_factory.rb +42 -11
- data/lib/version.rb +2 -2
- data/spec/README +1 -0
- data/spec/Rakefile +1 -0
- data/spec/{configs/account.rb → app/Account/config.rb} +0 -0
- data/spec/{configs/case.rb → app/Case/config.rb} +0 -0
- data/spec/app/Question/config.rb +3 -0
- data/spec/app/Settings/controller.rb +10 -0
- data/spec/app/Settings/index.erb +11 -0
- data/spec/app/SpecRunner/controller.rb +15 -0
- data/spec/app/SpecRunner/index.erb +14 -0
- data/spec/app/application.rb +4 -0
- data/spec/app/index.erb +17 -0
- data/spec/app/layout.erb +27 -0
- data/spec/app/loading.html +11 -0
- data/spec/app/mspec.rb +11 -0
- data/spec/app/mspec/expectations.rb +2 -0
- data/spec/app/mspec/expectations/expectations.rb +17 -0
- data/spec/app/mspec/expectations/should.rb +25 -0
- data/spec/app/mspec/fileutils.rb +1590 -0
- data/spec/app/mspec/guards.rb +16 -0
- data/spec/app/mspec/guards/background.rb +21 -0
- data/spec/app/mspec/guards/bug.rb +24 -0
- data/spec/app/mspec/guards/compliance.rb +37 -0
- data/spec/app/mspec/guards/conflict.rb +18 -0
- data/spec/app/mspec/guards/endian.rb +44 -0
- data/spec/app/mspec/guards/extensions.rb +20 -0
- data/spec/app/mspec/guards/guard.rb +166 -0
- data/spec/app/mspec/guards/noncompliance.rb +20 -0
- data/spec/app/mspec/guards/platform.rb +43 -0
- data/spec/app/mspec/guards/quarantine.rb +17 -0
- data/spec/app/mspec/guards/runner.rb +34 -0
- data/spec/app/mspec/guards/superuser.rb +17 -0
- data/spec/app/mspec/guards/support.rb +20 -0
- data/spec/app/mspec/guards/tty.rb +20 -0
- data/spec/app/mspec/guards/version.rb +38 -0
- data/spec/app/mspec/helpers.rb +11 -0
- data/spec/app/mspec/helpers/argv.rb +43 -0
- data/spec/app/mspec/helpers/bignum.rb +5 -0
- data/spec/app/mspec/helpers/const_lookup.rb +9 -0
- data/spec/app/mspec/helpers/environment.rb +23 -0
- data/spec/app/mspec/helpers/fixture.rb +20 -0
- data/spec/app/mspec/helpers/flunk.rb +5 -0
- data/spec/app/mspec/helpers/io.rb +17 -0
- data/spec/app/mspec/helpers/language_version.rb +20 -0
- data/spec/app/mspec/helpers/ruby_exe.rb +123 -0
- data/spec/app/mspec/helpers/scratch.rb +17 -0
- data/spec/app/mspec/helpers/tmp.rb +32 -0
- data/spec/app/mspec/matchers.rb +23 -0
- data/spec/app/mspec/matchers/base.rb +95 -0
- data/spec/app/mspec/matchers/be_an_instance_of.rb +26 -0
- data/spec/app/mspec/matchers/be_ancestor_of.rb +24 -0
- data/spec/app/mspec/matchers/be_close.rb +27 -0
- data/spec/app/mspec/matchers/be_empty.rb +20 -0
- data/spec/app/mspec/matchers/be_false.rb +20 -0
- data/spec/app/mspec/matchers/be_kind_of.rb +24 -0
- data/spec/app/mspec/matchers/be_nil.rb +20 -0
- data/spec/app/mspec/matchers/be_true.rb +20 -0
- data/spec/app/mspec/matchers/complain.rb +56 -0
- data/spec/app/mspec/matchers/eql.rb +26 -0
- data/spec/app/mspec/matchers/equal.rb +26 -0
- data/spec/app/mspec/matchers/equal_element.rb +78 -0
- data/spec/app/mspec/matchers/equal_utf16.rb +34 -0
- data/spec/app/mspec/matchers/have_constant.rb +30 -0
- data/spec/app/mspec/matchers/have_instance_method.rb +24 -0
- data/spec/app/mspec/matchers/have_method.rb +24 -0
- data/spec/app/mspec/matchers/have_private_instance_method.rb +24 -0
- data/spec/app/mspec/matchers/include.rb +32 -0
- data/spec/app/mspec/matchers/match_yaml.rb +47 -0
- data/spec/app/mspec/matchers/method.rb +14 -0
- data/spec/app/mspec/matchers/output.rb +67 -0
- data/spec/app/mspec/matchers/output_to_fd.rb +71 -0
- data/spec/app/mspec/matchers/raise_error.rb +48 -0
- data/spec/app/mspec/matchers/respond_to.rb +24 -0
- data/spec/app/mspec/matchers/stringsymboladapter.rb +8 -0
- data/spec/app/mspec/mocks.rb +3 -0
- data/spec/app/mspec/mocks/mock.rb +159 -0
- data/spec/app/mspec/mocks/object.rb +20 -0
- data/spec/app/mspec/mocks/proxy.rb +136 -0
- data/spec/app/mspec/pp.rb +893 -0
- data/spec/app/mspec/runner.rb +15 -0
- data/spec/app/mspec/runner/actions.rb +8 -0
- data/spec/app/mspec/runner/actions/debug.rb +17 -0
- data/spec/app/mspec/runner/actions/filter.rb +40 -0
- data/spec/app/mspec/runner/actions/gdb.rb +17 -0
- data/spec/app/mspec/runner/actions/tag.rb +133 -0
- data/spec/app/mspec/runner/actions/taglist.rb +56 -0
- data/spec/app/mspec/runner/actions/tagpurge.rb +56 -0
- data/spec/app/mspec/runner/actions/tally.rb +116 -0
- data/spec/app/mspec/runner/actions/timer.rb +22 -0
- data/spec/app/mspec/runner/context.rb +188 -0
- data/spec/app/mspec/runner/example.rb +34 -0
- data/spec/app/mspec/runner/exception.rb +43 -0
- data/spec/app/mspec/runner/filters.rb +4 -0
- data/spec/app/mspec/runner/filters/match.rb +22 -0
- data/spec/app/mspec/runner/filters/profile.rb +54 -0
- data/spec/app/mspec/runner/filters/regexp.rb +7 -0
- data/spec/app/mspec/runner/filters/tag.rb +29 -0
- data/spec/app/mspec/runner/formatters.rb +10 -0
- data/spec/app/mspec/runner/formatters/describe.rb +24 -0
- data/spec/app/mspec/runner/formatters/dotted.rb +98 -0
- data/spec/app/mspec/runner/formatters/file.rb +19 -0
- data/spec/app/mspec/runner/formatters/html.rb +81 -0
- data/spec/app/mspec/runner/formatters/method.rb +93 -0
- data/spec/app/mspec/runner/formatters/specdoc.rb +41 -0
- data/spec/app/mspec/runner/formatters/spinner.rb +99 -0
- data/spec/app/mspec/runner/formatters/summary.rb +11 -0
- data/spec/app/mspec/runner/formatters/unit.rb +21 -0
- data/spec/app/mspec/runner/formatters/yaml.rb +44 -0
- data/spec/app/mspec/runner/mspec.rb +361 -0
- data/spec/app/mspec/runner/object.rb +24 -0
- data/spec/app/mspec/runner/shared.rb +12 -0
- data/spec/app/mspec/runner/tag.rb +32 -0
- data/spec/app/mspec/utils/name_map.rb +129 -0
- data/spec/app/mspec/utils/options.rb +441 -0
- data/spec/app/mspec/utils/ruby_name.rb +8 -0
- data/spec/app/mspec/utils/script.rb +220 -0
- data/spec/app/mspec/utils/version.rb +53 -0
- data/spec/app/mspec/version.rb +5 -0
- data/spec/app/spec/fixtures/client_info.txt +2 -0
- data/spec/app/spec/fixtures/object_values.txt +90 -0
- data/spec/{rho_controller_spec.rb → app/spec/rho_controller_spec.rb} +4 -7
- data/spec/{rho_spec.rb → app/spec/rho_spec.rb} +15 -36
- data/spec/{rhom_object_factory_spec.rb → app/spec/rhom_object_factory_spec.rb} +108 -72
- data/spec/{rhom_spec.rb → app/spec/rhom_spec.rb} +8 -4
- data/spec/app/spec/spec_helper.rb +15 -0
- data/spec/app/spec/webview_spec.rb +27 -0
- data/spec/app/spec_runner.rb +26 -0
- data/spec/build.yml +28 -0
- data/spec/public/css/base.css +39 -0
- data/spec/public/css/blackberry.css +99 -0
- data/spec/public/css/iphone.css +392 -0
- data/spec/public/css/rho.css +3 -0
- data/spec/public/css/xhtml.css +114 -0
- data/spec/public/images/IUI_LICENSE.txt +21 -0
- data/spec/public/images/backButton.png +0 -0
- data/spec/public/images/blueButton.png +0 -0
- data/spec/public/images/cancel.png +0 -0
- data/spec/public/images/grayButton.png +0 -0
- data/spec/public/images/iui-logo-touch-icon.png +0 -0
- data/spec/public/images/listArrow.png +0 -0
- data/spec/public/images/listArrowSel.png +0 -0
- data/spec/public/images/listGroup.png +0 -0
- data/spec/public/images/loading.gif +0 -0
- data/spec/public/images/pinstripes.png +0 -0
- data/spec/public/images/right_button.png +0 -0
- data/spec/public/images/selection.png +0 -0
- data/spec/public/images/thumb.png +0 -0
- data/spec/public/images/toggle.png +0 -0
- data/spec/public/images/toggleOn.png +0 -0
- data/spec/public/images/toolButton.png +0 -0
- data/spec/public/images/toolButton_new.png +0 -0
- data/spec/public/images/toolbar.png +0 -0
- data/spec/public/images/whiteButton.png +0 -0
- data/spec/public/js/application.js +1 -0
- data/spec/public/js/jquery-1.2.6.min.js +32 -0
- data/spec/public/js/rho.js +4 -0
- data/spec/public/js/rhogeolocation-wm.js +59 -0
- data/spec/public/js/rhogeolocation.js +11 -0
- data/spec/rhoconfig.txt +19 -0
- metadata +169 -39
- data/History.txt +0 -37
- data/README.rdoc +0 -2
- data/lib/TestServe.rb +0 -9
- data/res/sqlite3/constants.rb +0 -49
- data/res/sqlite3/database.rb +0 -715
- data/res/sqlite3/driver/dl/api.rb +0 -154
- data/res/sqlite3/driver/dl/driver.rb +0 -307
- data/res/sqlite3/driver/native/driver.rb +0 -257
- data/res/sqlite3/errors.rb +0 -68
- data/res/sqlite3/pragmas.rb +0 -271
- data/res/sqlite3/resultset.rb +0 -176
- data/res/sqlite3/sqlite3_api.rb +0 -0
- data/res/sqlite3/statement.rb +0 -230
- data/res/sqlite3/translator.rb +0 -109
- data/res/sqlite3/value.rb +0 -57
- data/res/sqlite3/version.rb +0 -14
- data/rhodes.gemspec +0 -18
- data/spec/app_manifest.txt +0 -4
- data/spec/configs/contact.rb +0 -3
- data/spec/configs/employee.rb +0 -3
- data/spec/spec.opts +0 -1
- data/spec/spec_helper.rb +0 -49
- data/spec/stubs.rb +0 -39
- data/spec/syncdbtest.sqlite +0 -0
data/lib/rho/rhofsconnector.rb
CHANGED
@@ -15,6 +15,10 @@ module Rho
|
|
15
15
|
def get_app_manifest_filename
|
16
16
|
File.join(__rhoGetCurrentDir(), 'apps/app_manifest.txt')
|
17
17
|
end
|
18
|
+
|
19
|
+
def get_rhoconfig_filename
|
20
|
+
File.join(__rhoGetCurrentDir(), 'apps/rhoconfig.txt')
|
21
|
+
end
|
18
22
|
|
19
23
|
def get_model_path(appname, modelname)
|
20
24
|
File.join(__rhoGetCurrentDir(), 'apps/'+appname+'/'+modelname+'/')
|
data/lib/rho/rhoutils.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
module Rho
|
2
|
+
class RhoUtils
|
3
|
+
def self.load_offline_data(tables=[], dir_prefix=nil)
|
4
|
+
first_row=true
|
5
|
+
columns = []
|
6
|
+
tables.each do |filename|
|
7
|
+
Rhom::RhomDbAdapter.delete_all_from_table(filename)
|
8
|
+
prefix = dir_prefix.nil? ? "" : dir_prefix
|
9
|
+
File.open(File.join(Rho::RhoFSConnector.get_base_app_path,'app',prefix,'fixtures',filename+'.txt')).each do |line|
|
10
|
+
if first_row
|
11
|
+
columns = line.chomp.split('|'); first_row = false; next;
|
12
|
+
end
|
13
|
+
parts = line.chomp.split('|')
|
14
|
+
|
15
|
+
row = {}
|
16
|
+
columns.each_with_index do |col,idx|
|
17
|
+
row[col] = parts[idx]
|
18
|
+
end
|
19
|
+
Rhom::RhomDbAdapter.insert_into_table(filename,row)
|
20
|
+
end
|
21
|
+
columns = []
|
22
|
+
first_row = true
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/rho/rhoviewhelpers.rb
CHANGED
@@ -47,7 +47,7 @@ module Rho
|
|
47
47
|
#
|
48
48
|
def link_to(name,url_params = {},html_options = "",confirm = nil)
|
49
49
|
url = url_for(url_params)
|
50
|
-
if (url_params[:action].to_s != 'delete')
|
50
|
+
if (url_params.is_a?(String) || url_params[:action].to_s != 'delete')
|
51
51
|
"<a href=\"#{url}\" #{html_options}>#{name || url}</a>"
|
52
52
|
else
|
53
53
|
"<a href=\"#{url}\" #{html_options} onclick=\""+ #if (confirm('#{confirm}')) {
|
data/lib/rhodes.rb
CHANGED
data/lib/rhoframework.rb
CHANGED
@@ -3,19 +3,19 @@ begin
|
|
3
3
|
require 'date/format'
|
4
4
|
require 'time'
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
# require 'sqlite3/constants'
|
7
|
+
# require 'sqlite3/errors'
|
8
|
+
# require 'sqlite3/pragmas'
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
# require 'sqlite3/resultset'
|
11
|
+
# require 'sqlite3/statement'
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
# require 'date'
|
14
|
+
# require 'sqlite3/translator'
|
15
15
|
|
16
|
-
|
16
|
+
# require 'sqlite3/value'
|
17
17
|
|
18
|
-
|
18
|
+
# require 'sqlite3/database'
|
19
19
|
require 'rhom/rhom_db_adapter'
|
20
20
|
|
21
21
|
require 'rhom/rhom_object'
|
data/lib/rhom/rhom.rb
CHANGED
data/lib/rhom/rhom_db_adapter.rb
CHANGED
@@ -18,7 +18,8 @@
|
|
18
18
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
19
|
#
|
20
20
|
#$:.unshift(File.join(File.dirname(__FILE__), '../../'))
|
21
|
-
require 'sqlite3/database'
|
21
|
+
# require 'sqlite3/database'
|
22
|
+
require 'rhodes'
|
22
23
|
|
23
24
|
module Rhom
|
24
25
|
class RhomDbAdapter
|
@@ -37,7 +38,7 @@ module Rhom
|
|
37
38
|
|
38
39
|
# closes the database if and only if it is open
|
39
40
|
def close
|
40
|
-
if @@database and not @@database.closed?
|
41
|
+
if @@database #and not @@database.closed?
|
41
42
|
@@database.close
|
42
43
|
@@database = nil
|
43
44
|
else
|
@@ -60,10 +61,10 @@ module Rhom
|
|
60
61
|
SyncEngine::lock_sync_mutex
|
61
62
|
# execute sql statement inside of transaction
|
62
63
|
# result is returned as an array of hashes
|
63
|
-
@@database.transaction unless @@database.transaction_active?
|
64
|
-
@@database.results_as_hash = true
|
64
|
+
# @@database.transaction unless @@database.transaction_active?
|
65
|
+
# @@database.results_as_hash = true
|
65
66
|
result = @@database.execute sql
|
66
|
-
@@database.commit
|
67
|
+
# @@database.commit
|
67
68
|
SyncEngine::unlock_sync_mutex
|
68
69
|
rescue Exception => e
|
69
70
|
puts "exception when running query: #{e}"
|
@@ -76,9 +77,26 @@ module Rhom
|
|
76
77
|
end
|
77
78
|
|
78
79
|
# generates where clause based on hash
|
79
|
-
def where_str(condition)
|
80
|
-
|
81
|
-
|
80
|
+
def where_str(condition,select_arr=nil)
|
81
|
+
where_str = ""
|
82
|
+
if condition
|
83
|
+
where_str += string_from_key_vals(condition,"and")
|
84
|
+
where_str = where_str[0..where_str.length - 5]
|
85
|
+
end
|
86
|
+
|
87
|
+
if select_arr and select_arr.length > 0
|
88
|
+
where_str += " and attrib in (#{select_str(select_arr)})"
|
89
|
+
end
|
90
|
+
#puts "where_str: #{where_str}" if where_str
|
91
|
+
where_str
|
92
|
+
end
|
93
|
+
|
94
|
+
def select_str(select_arr)
|
95
|
+
select_str = ""
|
96
|
+
select_arr.each do |attrib|
|
97
|
+
select_str << "'#{attrib}'" + ","
|
98
|
+
end
|
99
|
+
select_str.length > 2 ? select_str[0..select_str.length-2] : select_str
|
82
100
|
end
|
83
101
|
|
84
102
|
# generates value clause based on hash
|
@@ -91,7 +109,7 @@ module Rhom
|
|
91
109
|
def string_from_key_vals(values, delim)
|
92
110
|
vals = ""
|
93
111
|
values.each do |key,value|
|
94
|
-
vals << " #{key} = #{get_value_for_sql_stmt(value)}#{delim}"
|
112
|
+
vals << " #{key} = #{get_value_for_sql_stmt(value)} #{delim}"
|
95
113
|
end
|
96
114
|
vals
|
97
115
|
end
|
@@ -115,16 +133,15 @@ module Rhom
|
|
115
133
|
# {"order by"=>'object'})
|
116
134
|
# this would return all columns where source_id = 2 and update_type = 'query' ordered
|
117
135
|
# by the "object" column
|
118
|
-
def select_from_table(table=nil,columns=nil,condition=nil,params=nil)
|
136
|
+
def select_from_table(table=nil,columns=nil,condition=nil,params=nil,select_arr=nil)
|
119
137
|
query = nil
|
120
138
|
if table and columns and condition
|
121
139
|
if params and params['distinct']
|
122
|
-
query = "select distinct #{columns} from #{table} where #{where_str(condition)}"
|
140
|
+
query = "select distinct #{columns} from #{table} where #{where_str(condition,select_arr)}"
|
123
141
|
elsif params and params['order by']
|
124
|
-
query = "select #{columns} from #{table} where #{where_str(condition)}
|
125
|
-
order by #{params['order by']}"
|
142
|
+
query = "select #{columns} from #{table} where #{where_str(condition,select_arr)} order by #{params['order by']}"
|
126
143
|
else
|
127
|
-
query = "select #{columns} from #{table} where #{where_str(condition)}"
|
144
|
+
query = "select #{columns} from #{table} where #{where_str(condition,select_arr)}"
|
128
145
|
end
|
129
146
|
elsif table and columns
|
130
147
|
query = "select #{columns} from #{table}"
|
@@ -192,4 +209,8 @@ module Rhom
|
|
192
209
|
end
|
193
210
|
end # class methods
|
194
211
|
end # RhomDbAdapter
|
195
|
-
end # Rhom
|
212
|
+
end # Rhom
|
213
|
+
|
214
|
+
at_exit do
|
215
|
+
Rhom::RhomDbAdapter::close
|
216
|
+
end
|
@@ -28,10 +28,9 @@ module Rhom
|
|
28
28
|
def open(dbfile=nil)
|
29
29
|
puts "DB name = " + dbfile.inspect
|
30
30
|
unless @@database or dbfile.nil?
|
31
|
-
|
32
|
-
|
31
|
+
db = DbAdapter.new(Rhodes::DBVERSION)
|
32
|
+
@@database = db
|
33
33
|
end
|
34
|
-
|
35
34
|
end
|
36
35
|
|
37
36
|
def close
|
data/lib/rhom/rhom_object.rb
CHANGED
@@ -62,8 +62,20 @@ module Rhom
|
|
62
62
|
arr.last.is_a?(::Hash) ? arr.pop : {}
|
63
63
|
end
|
64
64
|
|
65
|
+
@@reserved_names = {"object" => "1",
|
66
|
+
"source_id" => "1",
|
67
|
+
"update_type" => "1",
|
68
|
+
"attrib_type" => "1",
|
69
|
+
"type" => "1",
|
70
|
+
"set_notification" => "1",
|
71
|
+
"clear_notification" => "1" }
|
72
|
+
|
73
|
+
|
65
74
|
def method_name_reserved?(method)
|
66
|
-
method
|
67
|
-
end
|
75
|
+
@@reserved_names.has_key?(method)
|
76
|
+
end
|
77
|
+
#def method_name_reserved?(method)
|
78
|
+
# method =~ /\bobject\b|\bsource_id\b|\bupdate_type\b|\battrib_type\b|\btype\b|\bset_notification\b|\bclear_notification\b/
|
79
|
+
#end
|
68
80
|
end # RhomObject
|
69
81
|
end # Rhom
|
@@ -41,7 +41,7 @@ module Rhom
|
|
41
41
|
extend ::Rhom::RhomObject
|
42
42
|
|
43
43
|
def initialize(obj=nil)
|
44
|
-
self.send("object=".to_sym(), "#{Time.now.to_i}")
|
44
|
+
self.send("object=".to_sym(), "#{((Time.now.to_f - Time.mktime(2009,"jan",1,0,0,0,0).to_f) * 10**6).to_i}")
|
45
45
|
if obj
|
46
46
|
self.send("source_id=".to_sym(), obj['source_id'].to_s)
|
47
47
|
self.send("update_type=".to_sym(), 'create')
|
@@ -83,39 +83,70 @@ module Rhom
|
|
83
83
|
# do we have conditions?
|
84
84
|
# if so, add them to the query
|
85
85
|
condition_hash = {}
|
86
|
-
|
87
|
-
|
86
|
+
select_arr = nil
|
87
|
+
if args[1]
|
88
|
+
condition_hash = get_conditions_hash(args[1][:conditions]) if args[1] and args[1][:conditions] and args[1][:conditions].is_a?(Hash)
|
89
|
+
conditions.merge!(condition_hash)
|
90
|
+
|
91
|
+
select_arr = args[1][:select] if args[1][:select]
|
92
|
+
end
|
88
93
|
|
89
94
|
# process query, create, and update lists in order
|
95
|
+
sql_attrs = 'object,attrib,value'
|
90
96
|
["query", "create", "update"].each do |update_type|
|
91
97
|
conditions.merge!({"update_type"=>update_type})
|
92
|
-
objs = ::Rhom::RhomDbAdapter::select_from_table(::Rhom::TABLE_NAME,
|
98
|
+
objs = ::Rhom::RhomDbAdapter::select_from_table(::Rhom::TABLE_NAME, sql_attrs, conditions, {"order by"=>'object'},select_arr)
|
93
99
|
|
94
100
|
# fetch the rest of the attributes if we're searching by specific attrib value
|
95
|
-
if
|
101
|
+
#if conditions and conditions.size > 0
|
102
|
+
if args[1] and args[1][:conditions] and args[1][:conditions].is_a?(Hash)
|
96
103
|
full_objects = []
|
97
104
|
objs.each do |obj|
|
98
|
-
|
105
|
+
if not select_arr
|
106
|
+
full_objects += ::Rhom::RhomDbAdapter::select_from_table(::Rhom::TABLE_NAME, sql_attrs, {'object' => obj['object'].to_s})
|
107
|
+
elsif select_arr and conditions
|
108
|
+
full_objects += ::Rhom::RhomDbAdapter::select_from_table(::Rhom::TABLE_NAME, sql_attrs, {'object' => obj['object'].to_s}, nil, select_arr)
|
109
|
+
end
|
99
110
|
end
|
100
111
|
objs = full_objects
|
101
112
|
end
|
102
113
|
|
103
114
|
# build up the object array where each
|
104
115
|
# row in this array is a rhom_object
|
105
|
-
|
116
|
+
#index = -1
|
117
|
+
#hash_objects = {}
|
118
|
+
|
119
|
+
objs.each do |obj|
|
106
120
|
object = obj['object']
|
107
121
|
attrib = obj['attrib']
|
108
122
|
value = obj['value']
|
123
|
+
|
124
|
+
#if not hash_objects[object]
|
125
|
+
# list.push get_new_obj(obj)
|
126
|
+
# index += 1
|
127
|
+
# hash_objects[object] = index
|
128
|
+
#elsif
|
129
|
+
# index = hash_objects[object]
|
130
|
+
#end
|
131
|
+
#isReserved = method_name_reserved?(attrib)
|
132
|
+
#This is required because update should override query
|
133
|
+
#if not isReserved and list[index].send(attrib.to_sym)
|
134
|
+
# list[index].remove_var(attrib)
|
135
|
+
#end
|
136
|
+
#list[index].send("#{attrib}=".to_sym(), value) if not isReserved
|
137
|
+
|
138
|
+
isReserved = method_name_reserved?(attrib)
|
109
139
|
hash_list[object] = get_new_obj(obj) if not hash_list[object]
|
110
|
-
if not
|
140
|
+
if not isReserved and hash_list[object].send(attrib.to_sym)
|
111
141
|
hash_list[object].remove_var(attrib)
|
112
142
|
end
|
113
|
-
hash_list[object].send("#{attrib}=".to_sym(), value) if not
|
114
|
-
nil # remove the element from the array
|
143
|
+
hash_list[object].send("#{attrib}=".to_sym(), value) if not isReserved
|
144
|
+
#nil # remove the element from the array
|
115
145
|
end
|
116
146
|
|
117
147
|
end
|
118
|
-
|
148
|
+
#hash_objects = nil
|
149
|
+
|
119
150
|
# convert hash to array
|
120
151
|
list = hash_list.values
|
121
152
|
hash_list = nil
|
data/lib/version.rb
CHANGED
data/spec/README
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
This folder contains the specs application for the rhodes-framework. It should be run as a normal rhodes application.
|
data/spec/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'rhodes-build'
|
File without changes
|
File without changes
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<div class="toolbar">
|
2
|
+
<h1 id="pageTitle">
|
3
|
+
Settings
|
4
|
+
</h1>
|
5
|
+
</div>
|
6
|
+
|
7
|
+
<ul id="settings" selected="true" title="Settings">
|
8
|
+
<% if @msg %><li style="color:#ff0000" align="center"><%=@msg%></li><% end %>
|
9
|
+
<li>Client ID: <br/><span style="font-size: 60%"><%=Rhom::Rhom::client_id%></span></li>
|
10
|
+
<li><%=link_to "Reset Database", :action => :reset%></li>
|
11
|
+
</ul>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rho/rhocontroller'
|
2
|
+
require 'spec_runner'
|
3
|
+
|
4
|
+
class SpecRunnerController < Rho::RhoController
|
5
|
+
|
6
|
+
#GET /SpecRunner
|
7
|
+
def index
|
8
|
+
@msg = 'MSpec version: '+MSpec::VERSION
|
9
|
+
@runner = SpecRunner.new
|
10
|
+
@code = @runner.run
|
11
|
+
@exc_count = MSpec.exc_count
|
12
|
+
@count = MSpec.count
|
13
|
+
render
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<div class="toolbar">
|
2
|
+
<h1 id="pageTitle">
|
3
|
+
SpecRunner
|
4
|
+
</h1>
|
5
|
+
</div>
|
6
|
+
|
7
|
+
<%@color = @code == 0 ? "#00ff00" : "#ff0000"%>
|
8
|
+
|
9
|
+
<ul id="specrunner" title="SpecRunner" selected="true">
|
10
|
+
<% if @msg %><li style="color:<%=@color%>" align="center"><%=@msg%></li><% end %>
|
11
|
+
<li style="color:<%=@color%>">Total: <%=@count%></li>
|
12
|
+
<li style="color:<%=@color%>">Passed: <%=@count - @exc_count%></li>
|
13
|
+
<li style="color:<%=@color%>">Failed: <%=@exc_count%></li>
|
14
|
+
</ul>
|
data/spec/app/index.erb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
<script language="JavaScript">
|
2
|
+
|
3
|
+
if (location.search =='?settings=true') {
|
4
|
+
window.location ='/app/Settings';
|
5
|
+
}
|
6
|
+
|
7
|
+
</script>
|
8
|
+
|
9
|
+
<div class="toolbar">
|
10
|
+
<h1 id="pageTitle">
|
11
|
+
RhodesTest
|
12
|
+
</h1>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<ul id="home" selected="true" title="RhodesSpecs">
|
16
|
+
<li><a href="SpecRunner">Run Specs!</a></li>
|
17
|
+
</ul>
|
data/spec/app/layout.erb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
4
|
+
<head>
|
5
|
+
<title>RhodesTest</title>
|
6
|
+
<link href="/public/css/base.css" type="text/css" rel="stylesheet"/>
|
7
|
+
|
8
|
+
<% if System::get_property('platform') == 'APPLE' %>
|
9
|
+
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
|
10
|
+
|
11
|
+
<script src="/public/js/jquery-1.2.6.min.js"></script>
|
12
|
+
<script src="/public/js/rho.js"></script>
|
13
|
+
<script src="/public/js/application.js"></script>
|
14
|
+
<link href="/public/css/iphone.css" type="text/css" rel="stylesheet"/>
|
15
|
+
<% else %>
|
16
|
+
<% if System::get_property('platform') == 'Blackberry' %>
|
17
|
+
<link href="/public/css/blackberry.css" type="text/css" rel="stylesheet"/>
|
18
|
+
<% else %>
|
19
|
+
<link href="/public/css/xhtml.css" type="text/css" rel="stylesheet"/>
|
20
|
+
<% end %>
|
21
|
+
<% end %>
|
22
|
+
|
23
|
+
</head>
|
24
|
+
<body>
|
25
|
+
<%= @content %>
|
26
|
+
</body>
|
27
|
+
</html>
|