rhodes 5.5.0.3 → 5.5.0.7

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.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +10 -0
  3. data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/notification/NotificationSingleton.java +20 -8
  4. data/lib/commonAPI/coreapi/ext/platform/iphone/cpp_based_impl/SystemImpl.mm +1 -2
  5. data/lib/commonAPI/coreapi/ext/system.xml +1 -1
  6. data/platform/android/build/android.rake +1 -0
  7. data/platform/iphone/Classes/AppManager/AppManager.m +44 -3
  8. data/platform/iphone/Classes/NativeView/RhoNativeViewManager.mm +4 -3
  9. data/platform/iphone/Classes/NativeView/RhoNativeViewManagerOC.h +1 -1
  10. data/platform/iphone/Classes/RhoMainView.h +8 -2
  11. data/platform/iphone/Classes/RhoUIWebView.h +75 -0
  12. data/platform/iphone/Classes/RhoUIWebView.m +142 -0
  13. data/platform/iphone/Classes/RhoWKWebView.h +87 -0
  14. data/platform/iphone/Classes/RhoWKWebView.m +187 -0
  15. data/platform/iphone/Classes/RhoWebView.h +72 -0
  16. data/platform/iphone/Classes/RhoWebViewFabrique.h +35 -0
  17. data/platform/iphone/Classes/RhoWebViewFabrique.m +87 -0
  18. data/platform/iphone/Classes/Rhodes.m +17 -6
  19. data/platform/iphone/Classes/Signature.old/SignatureDelegate.m +11 -4
  20. data/platform/iphone/Classes/Signature/SignatureDelegate.m +3 -4
  21. data/platform/iphone/Classes/SimpleMainView.h +7 -5
  22. data/platform/iphone/Classes/SimpleMainView.m +174 -179
  23. data/platform/iphone/Classes/SplitView/RightViewController.h +2 -2
  24. data/platform/iphone/Classes/SplitView/RightViewController.m +9 -10
  25. data/platform/iphone/Classes/SplitView/SplittedMainView.h +2 -3
  26. data/platform/iphone/Classes/SplitView/SplittedMainView.m +10 -7
  27. data/platform/iphone/Classes/TabbedMainView.h +2 -1
  28. data/platform/iphone/Classes/TabbedMainView.m +13 -10
  29. data/platform/iphone/Classes/URLProtocol/CRhoURLProtocol.m +21 -5
  30. data/platform/iphone/Classes/WebView.m +1 -1
  31. data/platform/iphone/RhoAppBaseLib/RhoAppBaseLib.xcodeproj/project.pbxproj +40 -3
  32. data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +4 -0
  33. data/platform/iphone/rbuild/iphone.rake +51 -0
  34. data/platform/shared/common/RhoNativeViewManager.h +9 -9
  35. data/platform/shared/common/RhodesApp.cpp +13 -1
  36. data/platform/shared/net/HttpServer.cpp +12 -2
  37. data/platform/shared/qt/rhodes/ExternalWebView.ui +11 -2
  38. data/platform/shared/qt/rhodes/QtMainWindow.cpp +9 -7
  39. data/platform/shared/qt/rhodes/QtMainWindow.ui +13 -4
  40. data/platform/shared/qt/rhodes/qkineticscroller.cpp +1245 -0
  41. data/platform/shared/qt/rhodes/qkineticscroller.h +165 -0
  42. data/platform/shared/qt/rhodes/qkineticscroller_p.h +168 -0
  43. data/platform/shared/qt/rhodes/qtflickgesture.cpp +696 -0
  44. data/platform/shared/qt/rhodes/qtflickgesture_p.h +107 -0
  45. data/platform/shared/qt/rhodes/qtscroller.cpp +2080 -0
  46. data/platform/shared/qt/rhodes/qtscroller.h +138 -0
  47. data/platform/shared/qt/rhodes/qtscroller_p.h +205 -0
  48. data/platform/shared/qt/rhodes/qtscrollerfilter.cpp +350 -0
  49. data/platform/shared/qt/rhodes/qtscrollerfilter_p.h +110 -0
  50. data/platform/shared/qt/rhodes/qtscrollerproperties.cpp +412 -0
  51. data/platform/shared/qt/rhodes/qtscrollerproperties.h +135 -0
  52. data/platform/shared/qt/rhodes/qtscrollerproperties_p.h +90 -0
  53. data/platform/shared/qt/rhodes/qtscrollevent.cpp +190 -0
  54. data/platform/shared/qt/rhodes/qtscrollevent.h +100 -0
  55. data/platform/shared/qt/rhodes/qtscrollevent_p.h +33 -0
  56. data/platform/shared/qt/rhodes/qwebviewkineticscroller.cpp +347 -0
  57. data/platform/shared/qt/rhodes/qwebviewkineticscroller.h +90 -0
  58. data/platform/shared/qt/rhodes/qwebviewselectionsuppressor.h +113 -0
  59. data/platform/shared/qt/rhodes/rhodes.pro +19 -0
  60. data/res/generators/rhogen.rb +307 -15
  61. data/res/generators/templates/application/app/Settings/err_sync.erb +12 -6
  62. data/res/generators/templates/application/app/Settings/home.erb +32 -17
  63. data/res/generators/templates/application/app/Settings/index.erb +55 -26
  64. data/res/generators/templates/application/app/Settings/javascript_index.html +111 -0
  65. data/res/generators/templates/application/app/Settings/javascript_login.html +65 -0
  66. data/res/generators/templates/application/app/Settings/login.erb +25 -19
  67. data/res/generators/templates/application/app/Settings/reset.erb +18 -9
  68. data/res/generators/templates/application/app/Settings/wait.erb +10 -7
  69. data/res/generators/templates/application/app/index.erb +32 -20
  70. data/res/generators/templates/application/app/javascript_index.html +66 -0
  71. data/res/generators/templates/application/app/javascript_index.js +250 -0
  72. data/res/generators/templates/application/app/layout.erb +12 -67
  73. data/res/generators/templates/application/javascript_build.yml +41 -0
  74. data/res/generators/templates/application/javascript_rhoconfig.txt +123 -0
  75. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap-theme.css +587 -0
  76. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap-theme.css.map +1 -0
  77. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap-theme.min.css +6 -0
  78. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap-theme.min.css.map +1 -0
  79. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap.css +6757 -0
  80. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap.css.map +1 -0
  81. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap.min.css +6 -0
  82. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap.min.css.map +1 -0
  83. data/res/generators/templates/application/public/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.eot +0 -0
  84. data/res/generators/templates/application/public/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.svg +288 -0
  85. data/res/generators/templates/application/public/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.ttf +0 -0
  86. data/res/generators/templates/application/public/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.woff +0 -0
  87. data/res/generators/templates/application/public/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.woff2 +0 -0
  88. data/res/generators/templates/application/public/bootstrap-3.3.7/js/bootstrap.js +2377 -0
  89. data/res/generators/templates/application/public/bootstrap-3.3.7/js/bootstrap.min.js +7 -0
  90. data/res/generators/templates/application/public/bootstrap-3.3.7/js/npm.js +13 -0
  91. data/res/generators/templates/application/public/css/style.css +3 -0
  92. data/res/generators/templates/application/public/jquery/jquery-3.1.1.min.js +4 -0
  93. data/res/generators/templates/application/public/jquery/jquery-3.1.1.min.map +1 -0
  94. data/res/generators/templates/application/rhoconfig.txt +16 -0
  95. data/res/generators/templates/iphone_project/Bremen7.xcodeproj/project.pbxproj +4 -0
  96. data/res/generators/templates/model/edit.erb +22 -21
  97. data/res/generators/templates/model/index.erb +24 -22
  98. data/res/generators/templates/model/javascript_edit.html +65 -0
  99. data/res/generators/templates/model/javascript_index.html +56 -0
  100. data/res/generators/templates/model/javascript_index.js +83 -0
  101. data/res/generators/templates/model/javascript_model.js +16 -0
  102. data/res/generators/templates/model/javascript_new.html +64 -0
  103. data/res/generators/templates/model/javascript_show.html +66 -0
  104. data/res/generators/templates/model/new.erb +22 -19
  105. data/res/generators/templates/model/show.erb +22 -14
  106. data/res/prebuild_base_app/app/index.erb +31 -18
  107. data/res/prebuild_base_app/app/layout.erb +11 -56
  108. data/version +1 -1
  109. metadata +59 -24
  110. data/res/generators/templates/application/public/css/android.css +0 -418
  111. data/res/generators/templates/application/public/css/iphone.css +0 -378
  112. data/res/generators/templates/application/public/css/jqmobile-patch.css +0 -62
  113. data/res/generators/templates/application/public/css/re_webkit.css +0 -736
  114. data/res/generators/templates/application/public/css/re_webkit_flat.css +0 -753
  115. data/res/generators/templates/application/public/css/windows_mobile.css +0 -327
  116. data/res/generators/templates/application/public/jqmobile/images/ajax-loader.gif +0 -0
  117. data/res/generators/templates/application/public/jqmobile/images/icon-search-black.png +0 -0
  118. data/res/generators/templates/application/public/jqmobile/images/icons-18-black.png +0 -0
  119. data/res/generators/templates/application/public/jqmobile/images/icons-18-white.png +0 -0
  120. data/res/generators/templates/application/public/jqmobile/images/icons-36-black.png +0 -0
  121. data/res/generators/templates/application/public/jqmobile/images/icons-36-white.png +0 -0
  122. data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.4.5.min.css +0 -3
  123. data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.4.5.min.js +0 -10
  124. data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.4.5.min.map +0 -1
  125. data/res/generators/templates/application/public/jqmobile/jquery.mobile.structure-1.4.5.min.css +0 -3
  126. data/res/generators/templates/application/public/jqmobile/jquery.mobile.theme-1.4.5.min.css +0 -3
  127. data/res/generators/templates/application/public/jquery/jquery-1.9.1.min.js +0 -5
  128. data/res/generators/templates/application/public/jquery/jquery-1.9.1.min.map +0 -1
  129. data/res/generators/templates/application/public/js/application.js +0 -1
  130. data/res/generators/templates/application/public/js/jqmobile-patch.js +0 -466
  131. data/res/generators/templates/application/public/js/syncengine.js +0 -504
@@ -0,0 +1,113 @@
1
+ /****************************************************************************
2
+ **
3
+ ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4
+ ** All rights reserved.
5
+ ** Contact: Nokia Corporation (qt-info@nokia.com)
6
+ **
7
+ ** This file is part of the examples of the Qt Toolkit.
8
+ **
9
+ ** $QT_BEGIN_LICENSE:LGPL$
10
+ ** No Commercial Usage
11
+ ** This file contains pre-release code and may not be distributed.
12
+ ** You may use this file in accordance with the terms and conditions
13
+ ** contained in the Technology Preview License Agreement accompanying
14
+ ** this package.
15
+ **
16
+ ** GNU Lesser General Public License Usage
17
+ ** Alternatively, this file may be used under the terms of the GNU Lesser
18
+ ** General Public License version 2.1 as published by the Free Software
19
+ ** Foundation and appearing in the file LICENSE.LGPL included in the
20
+ ** packaging of this file. Please review the following information to
21
+ ** ensure the GNU Lesser General Public License version 2.1 requirements
22
+ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23
+ **
24
+ ** In addition, as a special exception, Nokia gives you certain additional
25
+ ** rights. These rights are described in the Nokia Qt LGPL Exception
26
+ ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27
+ **
28
+ ** If you have questions regarding the use of this file, please contact
29
+ ** Nokia at qt-info@nokia.com.
30
+ **
31
+ **
32
+ **
33
+ **
34
+ **
35
+ **
36
+ **
37
+ **
38
+ ** $QT_END_LICENSE$
39
+ **
40
+ ****************************************************************************/
41
+
42
+ #ifndef QWEBVIEWSELECTIONSUPPRESSOR_H
43
+ #define QWEBVIEWSELECTIONSUPPRESSOR_H
44
+
45
+ #include <QtWebKitWidgets/qwebview.h>
46
+ #include <QtGui/qevent.h>
47
+ #include <QDebug>
48
+
49
+ class QWebViewSelectionSuppressor : public QObject
50
+ {
51
+ Q_OBJECT
52
+ public:
53
+ QWebViewSelectionSuppressor(QWebView *v)
54
+ : QObject(v), view(v), enabled(false), mousePressed(false)
55
+ {
56
+ Q_ASSERT(view);
57
+ enable();
58
+ }
59
+
60
+ ~QWebViewSelectionSuppressor() {}
61
+
62
+ inline void enable()
63
+ {
64
+ if (enabled)
65
+ return;
66
+ view->installEventFilter(this);
67
+ enabled = true;
68
+ }
69
+
70
+ inline void disable()
71
+ {
72
+ if (!enabled)
73
+ return;
74
+ view->removeEventFilter(this);
75
+ enabled = false;
76
+ }
77
+
78
+ inline bool isEnabled() const
79
+ {
80
+ return enabled;
81
+ }
82
+
83
+ protected:
84
+ inline bool eventFilter(QObject *, QEvent *e);
85
+
86
+ private:
87
+ QWebView *view;
88
+ bool enabled;
89
+ bool mousePressed;
90
+ };
91
+
92
+ bool QWebViewSelectionSuppressor::eventFilter(QObject *, QEvent *e)
93
+ {
94
+ switch (e->type()) {
95
+ case QEvent::MouseButtonPress:
96
+ if (static_cast<QMouseEvent *>(e)->button() == Qt::LeftButton)
97
+ mousePressed = true;
98
+ break;
99
+ case QEvent::MouseButtonRelease:
100
+ if (static_cast<QMouseEvent *>(e)->button() == Qt::LeftButton)
101
+ mousePressed = false;
102
+ break;
103
+ case QEvent::MouseMove:
104
+ if (mousePressed)
105
+ return true;
106
+ break;
107
+ default:
108
+ break;
109
+ }
110
+ return false;
111
+ }
112
+
113
+ #endif
@@ -117,6 +117,18 @@ win32 {
117
117
  HEADERS += ExternalWebView.h\
118
118
  MainWindowCallback.h\
119
119
  QtMainWindow.h\
120
+ qwebviewkineticscroller.h\
121
+ qkineticscroller.h\
122
+ qkineticscroller_p.h\
123
+ qwebviewselectionsuppressor.h\
124
+ qtscroller.h\
125
+ qtscroller_p.h\
126
+ qtscrollerproperties.h\
127
+ qtscrollerproperties_p.h\
128
+ qtflickgesture_p.h\
129
+ qtscrollerfilter_p.h\
130
+ qtscrollevent.h\
131
+ qtscrollevent_p.h\
120
132
  QtNativeTabBar.h\
121
133
  QtWebInspector.h\
122
134
  QtWebPage.h\
@@ -140,6 +152,13 @@ QtMainWindow.cpp\
140
152
  QtNativeTabBar.cpp\
141
153
  QtWebInspector.cpp\
142
154
  QtWebPage.cpp\
155
+ qkineticscroller.cpp\
156
+ qwebviewkineticscroller.cpp\
157
+ qtflickgesture.cpp\
158
+ qtscroller.cpp\
159
+ qtscrollerproperties.cpp\
160
+ qtscrollerfilter.cpp\
161
+ qtscrollevent.cpp\
143
162
  impl/AlertImpl.cpp\
144
163
  impl/BluetoothImpl.cpp\
145
164
  impl/CalendarImpl.cpp\
@@ -60,14 +60,14 @@ module Rhogen
60
60
  alias_method :module_name, :class_name
61
61
  end
62
62
 
63
- class AppGenerator < BaseGenerator
63
+ class RubyAppGenerator < BaseGenerator
64
64
 
65
65
  def self.source_root
66
66
  File.join(File.dirname(__FILE__), 'templates', 'application')
67
67
  end
68
68
 
69
69
  desc <<-DESC
70
- Generates a new rhodes application.
70
+ Generates a new ruby-based rhodes application.
71
71
 
72
72
  Options:
73
73
  --rhoconnect - include rhoconnect-client in application
@@ -286,13 +286,205 @@ module Rhogen
286
286
  end
287
287
  end
288
288
 
289
- class ModelGenerator < BaseGenerator
289
+ class JavascriptAppGenerator < BaseGenerator
290
+
291
+ def self.source_root
292
+ File.join(File.dirname(__FILE__), 'templates', 'application')
293
+ end
294
+
295
+ desc <<-DESC
296
+ Generates a new javascript-based rhodes application.
297
+
298
+ Options:
299
+ --rhoconnect - include rhoconnect-client in application
300
+
301
+ Required:
302
+ name - application name
303
+
304
+ Optional:
305
+ syncserver - url to the rhosync application (i.e. "http://localhost:9292")
306
+ zip_url - optional url to zipfile download of bundle (this can be your RhoHub Bundle URL)
307
+ DESC
308
+
309
+ #option :testing_framework, :desc => 'Specify which testing framework to use (spec, test_unit)'
310
+
311
+ option :rhoconnect, :desc => '', :as => :boolean, :default => false
312
+
313
+ first_argument :name, :required => true, :desc => 'application name'
314
+ second_argument :syncserver, :required => false, :desc => 'url to the source adapter (i.e. "" or "http://rhosync.rhohub.com/apps/myapp/sources/")'
315
+ third_argument :zip_url, :required => false, :desc => 'optional url to zipfile download of bundle'
316
+
317
+ invoke :appResources
318
+
319
+ template :config do |template|
320
+ zip_url ||= ''
321
+ syncserver ||= ''
322
+ template.source = 'javascript_rhoconfig.txt'
323
+ template.destination = "#{name}/rhoconfig.txt"
324
+ end
325
+
326
+ template :buildyml do |template|
327
+ @sdk_path = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
328
+ @sdk_path.gsub!('\\', '/')
329
+ @app_name = name
330
+ @app_name_cleared = name.downcase.split(/[^a-zA-Z0-9\.\-]/).map { |w| w.downcase }.join("")
331
+ puuid = UUID.new
332
+ generated_uuid = puuid.generate
333
+ @productid = generated_uuid
334
+ @uid = '0x'+(0xE0000000 + rand(0xFFFFFFF)).to_s(16)
335
+ @rhoconnectclient_ext = '"rhoconnect-client"' if rhoconnect
336
+ template.source = 'javascript_build.yml'
337
+ template.destination = "#{name}/build.yml"
338
+ end
339
+
340
+ template :gitignore do |template|
341
+ template.source = 'gitignore'
342
+ template.destination = "#{name}/.gitignore"
343
+ end
344
+
345
+ template :rubyversion do |template|
346
+ template.source = 'ruby-version'
347
+ template.destination = "#{name}/.ruby-version"
348
+ end
349
+
350
+ template :gemfile do |template|
351
+ template.source = 'Gemfile'
352
+ template.destination = "#{name}/Gemfile"
353
+ end
354
+
355
+ template :application do |template|
356
+ template.source = 'app/javascript_index.html'
357
+ template.destination = "#{name}/app/index.html"
358
+ end
359
+
360
+ file :applicationScript do |file|
361
+ file.source = 'app/javascript_index.js'
362
+ file.destination = "#{name}/app/index.js"
363
+ end
364
+
365
+ template :options do |template|
366
+ template.source = 'app/Settings/javascript_index.html'
367
+ template.destination = "#{name}/app/Settings/index.html"
368
+ end
369
+
370
+ template :login do |template|
371
+ template.source = 'app/Settings/javascript_login.html'
372
+ template.destination = "#{name}/app/Settings/login.html"
373
+ end
374
+
375
+ template :loading do |template|
376
+ template.source = 'app/loading.html'
377
+ template.destination = "#{name}/app/loading.html"
378
+ end
379
+
380
+ file :loadingpng do |file|
381
+ file.source = 'app/loading.png'
382
+ file.destination = "#{name}/app/loading.png"
383
+ end
384
+
385
+ file :loadingpng5 do |file|
386
+ file.source = 'app/loading-568h@2x.png'
387
+ file.destination = "#{name}/app/loading-568h@2x.png"
388
+ end
389
+
390
+ file :loadingpng51 do |file|
391
+ file.source = 'app/loading-667h@2x.png'
392
+ file.destination = "#{name}/app/loading-667h@2x.png"
393
+ end
394
+
395
+ file :loadingpng52 do |file|
396
+ file.source = 'app/loading-736h@3x.png'
397
+ file.destination = "#{name}/app/loading-736h@3x.png"
398
+ end
399
+
400
+ file :loadingpngl do |file|
401
+ file.source = 'app/loading-Landscape.png'
402
+ file.destination = "#{name}/app/loading-Landscape.png"
403
+ end
404
+
405
+ file :loadingpngll do |file|
406
+ file.source = 'app/loading-LandscapeLeft.png'
407
+ file.destination = "#{name}/app/loading-LandscapeLeft.png"
408
+ end
409
+
410
+ file :loadingpnglr do |file|
411
+ file.source = 'app/loading-LandscapeRight.png'
412
+ file.destination = "#{name}/app/loading-LandscapeRight.png"
413
+ end
414
+
415
+ file :loadingpngp do |file|
416
+ file.source = 'app/loading-Portrait.png'
417
+ file.destination = "#{name}/app/loading-Portrait.png"
418
+ end
419
+
420
+ file :loadingpngpud do |file|
421
+ file.source = 'app/loading-PortraitUpsideDown.png'
422
+ file.destination = "#{name}/app/loading-PortraitUpsideDown.png"
423
+ end
424
+
425
+ file :loadingpngl2 do |file|
426
+ file.source = 'app/loading-Landscape@2x.png'
427
+ file.destination = "#{name}/app/loading-Landscape@2x.png"
428
+ end
429
+
430
+ file :loadingpngll2 do |file|
431
+ file.source = 'app/loading-LandscapeLeft@2x.png'
432
+ file.destination = "#{name}/app/loading-LandscapeLeft@2x.png"
433
+ end
434
+
435
+ file :loadingpnglr2 do |file|
436
+ file.source = 'app/loading-LandscapeRight@2x.png'
437
+ file.destination = "#{name}/app/loading-LandscapeRight@2x.png"
438
+ end
439
+
440
+ file :loadingpngp2 do |file|
441
+ file.source = 'app/loading-Portrait@2x.png'
442
+ file.destination = "#{name}/app/loading-Portrait@2x.png"
443
+ end
444
+
445
+ file :loadingpngpud2 do |file|
446
+ file.source = 'app/loading-PortraitUpsideDown@2x.png'
447
+ file.destination = "#{name}/app/loading-PortraitUpsideDown@2x.png"
448
+ end
449
+
450
+ file :loadingpngx do |file|
451
+ file.source = 'app/loading@2x.png'
452
+ file.destination = "#{name}/app/loading@2x.png"
453
+ end
454
+
455
+ directory :icon do |directory|
456
+ directory.source = 'icon'
457
+ directory.destination = "#{name}/icon"
458
+ end
459
+
460
+ directory :production do |directory|
461
+ directory.source = 'production'
462
+ directory.destination = "#{name}/production"
463
+ end
464
+
465
+ file :androidmanifesterb do |file|
466
+ file.source = 'AndroidManifest.erb'
467
+ file.destination = "#{name}/AndroidManifest.erb"
468
+ end
469
+
470
+ directory :public do |directory|
471
+ directory.source = 'public'
472
+ directory.destination = "#{name}/public/"
473
+ end
474
+
475
+ template :rakefile do |template|
476
+ template.source = 'Rakefile'
477
+ template.destination = "#{name}/Rakefile"
478
+ end
479
+ end
480
+
481
+ class RubyModelGenerator < BaseGenerator
290
482
  def self.source_root
291
483
  File.join(File.dirname(__FILE__), 'templates', 'model')
292
484
  end
293
485
 
294
486
  desc <<-DESC
295
- Generates a new model for a rhodes application.
487
+ Generates a new ruby model for a ruby-based rhodes application.
296
488
 
297
489
  Required:
298
490
  name - model name
@@ -368,6 +560,113 @@ module Rhogen
368
560
  end
369
561
  end
370
562
 
563
+ class JavascriptModelGenerator < BaseGenerator
564
+ def self.source_root
565
+ File.join(File.dirname(__FILE__), 'templates', 'model')
566
+ end
567
+
568
+ desc <<-DESC
569
+ Generates a new javascript model for a javascript-based rhodes application.
570
+
571
+ Required:
572
+ name - model name
573
+ attributes - list of one or more string attributes (i.e. name,industry,progress), NO spaces between attributes
574
+
575
+ Optional:
576
+ priority - sync priority (i.e. 100)
577
+ type - DEPRECATED: type of model (i.e. "ask" for an ask model). This will be removed in 1.5, instead use
578
+ search method.
579
+ DESC
580
+
581
+ #option :testing_framework, :desc => 'Specify which testing framework to use (spec, test_unit)'
582
+
583
+ first_argument :name, :required => true, :desc => 'model name'
584
+ second_argument :attributes, :as => :array, :required => true, :desc => "list of one or more string attributes (i.e. name,industry,progress), NO spaces between attributes"
585
+ third_argument :priority, :required => false, :desc => "optional sync priority (i.e. 100)"
586
+ fourth_argument :type, :required => false, :desc => "optional type (i.e. \"ask\" for an ask model)"
587
+
588
+ template :javascript_index do |template|
589
+ template.source = "javascript_index.html"
590
+ template.destination = "app/#{name.modulize}/index.html"
591
+ end
592
+
593
+ template :javascript_index_script do |template|
594
+ template.source = "javascript_index.js"
595
+ template.destination = "app/#{name.modulize}/index.js"
596
+ end
597
+
598
+ template :javascript_model_script do |template|
599
+ template.source = "javascript_model.js"
600
+ template.destination = "app/#{name.modulize}/model.js"
601
+ end
602
+
603
+ template :javascript_new do |template|
604
+ template.source = "javascript_new.html"
605
+ template.destination = "app/#{name.modulize}/new.html"
606
+ end
607
+
608
+ template :javascript_show do |template|
609
+ template.source = "javascript_show.html"
610
+ template.destination = "app/#{name.modulize}/show.html"
611
+ end
612
+
613
+ template :javascript_edit do |template|
614
+ template.source = "javascript_edit.html"
615
+ template.destination = "app/#{name.modulize}/edit.html"
616
+ end
617
+
618
+
619
+ # template :index do |template|
620
+ # template.source = 'index.erb'
621
+ # template.destination = "app/#{name.modulize}/index.erb"
622
+ # end
623
+ #
624
+ # template :edit do |template|
625
+ # template.source = 'edit.erb'
626
+ # template.destination = "app/#{name.modulize}/edit.erb"
627
+ # end
628
+ #
629
+ # template :new do |template|
630
+ # template.source = 'new.erb'
631
+ # template.destination = "app/#{name.modulize}/new.erb"
632
+ # end
633
+ #
634
+ # template :new do |template|
635
+ # template.source = 'show.erb'
636
+ # template.destination = "app/#{name.modulize}/show.erb"
637
+ # end
638
+ #
639
+ # template :controller do |template|
640
+ # underscore_name = name.modulize.split(/(?=[A-Z])/).map { |w| w.downcase }.join('_')
641
+ # template.source = 'controller.rb'
642
+ # template.destination = "app/#{name.modulize}/#{underscore_name}_controller.rb"
643
+ # end
644
+ #
645
+ # template :model do |template|
646
+ # underscore_name = name.modulize.split(/(?=[A-Z])/).map { |w| w.downcase }.join('_')
647
+ # template.source = 'model.rb'
648
+ # template.destination = "app/#{name.modulize}/#{underscore_name}.rb"
649
+ # end
650
+ #
651
+ # template :spec do |template|
652
+ # underscore_name = name.modulize.split(/(?=[A-Z])/).map { |w| w.downcase }.join('_')
653
+ # template.source = 'spec.rb'
654
+ # template.destination = "app/test/#{underscore_name}_spec.rb"
655
+ # end
656
+
657
+ def attributes?
658
+ self.attributes && !self.attributes.empty?
659
+ end
660
+
661
+ def syncserver_exists?
662
+ found = true
663
+ File.open('rhoconfig.txt').each do |line|
664
+ found = false if line.match("syncserver\ =\ ''") or line.match("syncserver\ =\ \"\"") or line.match("syncserver\ =\ nil")
665
+ end
666
+ found
667
+ end
668
+ end
669
+
371
670
  class SpecGenerator < BaseGenerator
372
671
 
373
672
  def self.source_root
@@ -412,9 +711,6 @@ module Rhogen
412
711
 
413
712
  end
414
713
 
415
-
416
-
417
-
418
714
  class IphoneProjectGenerator < BaseGenerator
419
715
 
420
716
  @@noapp = false
@@ -681,12 +977,6 @@ module Rhogen
681
977
 
682
978
  end
683
979
 
684
-
685
-
686
-
687
-
688
-
689
-
690
980
  class ExtensionGenerator < BaseGenerator
691
981
 
692
982
  @@noapp = false
@@ -1348,8 +1638,10 @@ module Rhogen
1348
1638
  end
1349
1639
 
1350
1640
 
1351
- add :app, AppGenerator
1352
- add :model, ModelGenerator
1641
+ add :app, RubyAppGenerator
1642
+ add :jsapp, JavascriptAppGenerator
1643
+ add :model, RubyModelGenerator
1644
+ add :jsmodel, JavascriptModelGenerator
1353
1645
  add :spec, SpecGenerator
1354
1646
  add :extension, ExtensionGenerator
1355
1647
  add :api, ApiGenerator