uki 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (235) hide show
  1. data/.gitignore +7 -0
  2. data/.gitmodules +3 -0
  3. data/LICENSE +20 -0
  4. data/Rakefile +23 -0
  5. data/Readme.rdoc +9 -0
  6. data/VERSION +1 -0
  7. data/bin/uki +102 -0
  8. data/frameworks/jspec/lib/images/bg.png +0 -0
  9. data/frameworks/jspec/lib/images/hr.png +0 -0
  10. data/frameworks/jspec/lib/images/loading.gif +0 -0
  11. data/frameworks/jspec/lib/images/sprites.bg.png +0 -0
  12. data/frameworks/jspec/lib/images/sprites.png +0 -0
  13. data/frameworks/jspec/lib/images/vr.png +0 -0
  14. data/frameworks/jspec/lib/jspec.css +149 -0
  15. data/frameworks/jspec/lib/jspec.growl.js +115 -0
  16. data/frameworks/jspec/lib/jspec.jquery.js +72 -0
  17. data/frameworks/jspec/lib/jspec.js +1756 -0
  18. data/frameworks/jspec/lib/jspec.shell.js +39 -0
  19. data/frameworks/jspec/lib/jspec.timers.js +90 -0
  20. data/frameworks/jspec/lib/jspec.xhr.js +195 -0
  21. data/frameworks/uki/README.rdoc +179 -0
  22. data/frameworks/uki/compiler.jar +0 -0
  23. data/frameworks/uki/run.rb +2 -0
  24. data/frameworks/uki/spec/commands/example_command.rb +19 -0
  25. data/frameworks/uki/spec/dom.html +39 -0
  26. data/frameworks/uki/spec/support/images/bg.png +0 -0
  27. data/frameworks/uki/spec/support/images/hr.png +0 -0
  28. data/frameworks/uki/spec/support/images/loading.gif +0 -0
  29. data/frameworks/uki/spec/support/images/sprites.bg.png +0 -0
  30. data/frameworks/uki/spec/support/images/sprites.png +0 -0
  31. data/frameworks/uki/spec/support/images/vr.png +0 -0
  32. data/frameworks/uki/spec/support/jspec.css +149 -0
  33. data/frameworks/uki/spec/support/jspec.js +1773 -0
  34. data/frameworks/uki/spec/support/jspec.xhr.js +193 -0
  35. data/frameworks/uki/spec/support/spec.helper.js +1 -0
  36. data/frameworks/uki/spec/unit/background.spec.js +29 -0
  37. data/frameworks/uki/spec/unit/builder.spec.js +51 -0
  38. data/frameworks/uki/spec/unit/data/model.spec.js +29 -0
  39. data/frameworks/uki/spec/unit/dom/dnd.spec.js +71 -0
  40. data/frameworks/uki/spec/unit/dom/event.spec.js +78 -0
  41. data/frameworks/uki/spec/unit/dom.spec.js +28 -0
  42. data/frameworks/uki/spec/unit/geometry.spec.js +79 -0
  43. data/frameworks/uki/spec/unit/selector.spec.js +140 -0
  44. data/frameworks/uki/spec/unit/theme/template.spec.js +31 -0
  45. data/frameworks/uki/spec/unit/utils.spec.js +176 -0
  46. data/frameworks/uki/spec/unit/view/base.spec.js +86 -0
  47. data/frameworks/uki/spec/unit/view/container.spec.js +73 -0
  48. data/frameworks/uki/spec/unit/view.spec.js +13 -0
  49. data/frameworks/uki/src/airport.js +1 -0
  50. data/frameworks/uki/src/uki-core/attachment.js +175 -0
  51. data/frameworks/uki/src/uki-core/background/css.js +37 -0
  52. data/frameworks/uki/src/uki-core/background/cssBox.js +73 -0
  53. data/frameworks/uki/src/uki-core/background/multi.js +20 -0
  54. data/frameworks/uki/src/uki-core/background/null.js +10 -0
  55. data/frameworks/uki/src/uki-core/background/rows.js +77 -0
  56. data/frameworks/uki/src/uki-core/background/sliced9.js +206 -0
  57. data/frameworks/uki/src/uki-core/background.js +35 -0
  58. data/frameworks/uki/src/uki-core/builder.js +68 -0
  59. data/frameworks/uki/src/uki-core/collection.js +278 -0
  60. data/frameworks/uki/src/uki-core/const.js +17 -0
  61. data/frameworks/uki/src/uki-core/dom/dnd.js +93 -0
  62. data/frameworks/uki/src/uki-core/dom/event.js +194 -0
  63. data/frameworks/uki/src/uki-core/dom/nativeLayout.js +18 -0
  64. data/frameworks/uki/src/uki-core/dom/offset.js +130 -0
  65. data/frameworks/uki/src/uki-core/dom/w3cdnd.js +333 -0
  66. data/frameworks/uki/src/uki-core/dom.js +109 -0
  67. data/frameworks/uki/src/uki-core/geometry.js +658 -0
  68. data/frameworks/uki/src/uki-core/image.js +90 -0
  69. data/frameworks/uki/src/uki-core/selector.js +201 -0
  70. data/frameworks/uki/src/uki-core/theme/base.js +39 -0
  71. data/frameworks/uki/src/uki-core/theme/template.js +26 -0
  72. data/frameworks/uki/src/uki-core/theme.js +45 -0
  73. data/frameworks/uki/src/uki-core/uki.js +45 -0
  74. data/frameworks/uki/src/uki-core/utils.js +399 -0
  75. data/frameworks/uki/src/uki-core/view/base.js +480 -0
  76. data/frameworks/uki/src/uki-core/view/container.js +155 -0
  77. data/frameworks/uki/src/uki-core/view/focusable.js +93 -0
  78. data/frameworks/uki/src/uki-core/view/observable.js +66 -0
  79. data/frameworks/uki/src/uki-core/view/styleable.js +70 -0
  80. data/frameworks/uki/src/uki-core/view/utils.js +66 -0
  81. data/frameworks/uki/src/uki-core/view.js +21 -0
  82. data/frameworks/uki/src/uki-core.js +36 -0
  83. data/frameworks/uki/src/uki-data/data.js +1 -0
  84. data/frameworks/uki/src/uki-data/model.js +28 -0
  85. data/frameworks/uki/src/uki-data/observable.js +34 -0
  86. data/frameworks/uki/src/uki-data.js +1 -0
  87. data/frameworks/uki/src/uki-more/more/utils.js +20 -0
  88. data/frameworks/uki/src/uki-more/more/view/listContainer.js +4 -0
  89. data/frameworks/uki/src/uki-more/more/view/multiselectList.js +196 -0
  90. data/frameworks/uki/src/uki-more/more/view/radioButton.js +27 -0
  91. data/frameworks/uki/src/uki-more/more/view/splitTable.js +79 -0
  92. data/frameworks/uki/src/uki-more/more/view/toggleButton.js +24 -0
  93. data/frameworks/uki/src/uki-more/more/view/treeList/render.js +53 -0
  94. data/frameworks/uki/src/uki-more/more/view/treeList.js +110 -0
  95. data/frameworks/uki/src/uki-more/more/view.js +2 -0
  96. data/frameworks/uki/src/uki-more/more.js +1 -0
  97. data/frameworks/uki/src/uki-more.js +4 -0
  98. data/frameworks/uki/src/uki-theamless.js +15 -0
  99. data/frameworks/uki/src/uki-theme/airport/i/button/down-c.gif +0 -0
  100. data/frameworks/uki/src/uki-theme/airport/i/button/down-c.png +0 -0
  101. data/frameworks/uki/src/uki-theme/airport/i/button/down-h.gif +0 -0
  102. data/frameworks/uki/src/uki-theme/airport/i/button/down-h.png +0 -0
  103. data/frameworks/uki/src/uki-theme/airport/i/button/down-m.png +0 -0
  104. data/frameworks/uki/src/uki-theme/airport/i/button/down-v.png +0 -0
  105. data/frameworks/uki/src/uki-theme/airport/i/button/focusRing-c.png +0 -0
  106. data/frameworks/uki/src/uki-theme/airport/i/button/focusRing-h.png +0 -0
  107. data/frameworks/uki/src/uki-theme/airport/i/button/focusRing-m.png +0 -0
  108. data/frameworks/uki/src/uki-theme/airport/i/button/focusRing-v.png +0 -0
  109. data/frameworks/uki/src/uki-theme/airport/i/button/focusRing.png +0 -0
  110. data/frameworks/uki/src/uki-theme/airport/i/button/hover-c.gif +0 -0
  111. data/frameworks/uki/src/uki-theme/airport/i/button/hover-c.png +0 -0
  112. data/frameworks/uki/src/uki-theme/airport/i/button/hover-h.gif +0 -0
  113. data/frameworks/uki/src/uki-theme/airport/i/button/hover-h.png +0 -0
  114. data/frameworks/uki/src/uki-theme/airport/i/button/hover-m.png +0 -0
  115. data/frameworks/uki/src/uki-theme/airport/i/button/hover-v.png +0 -0
  116. data/frameworks/uki/src/uki-theme/airport/i/button/hover.png +0 -0
  117. data/frameworks/uki/src/uki-theme/airport/i/button/normal-c.gif +0 -0
  118. data/frameworks/uki/src/uki-theme/airport/i/button/normal-c.png +0 -0
  119. data/frameworks/uki/src/uki-theme/airport/i/button/normal-h.gif +0 -0
  120. data/frameworks/uki/src/uki-theme/airport/i/button/normal-h.png +0 -0
  121. data/frameworks/uki/src/uki-theme/airport/i/button/normal-m.png +0 -0
  122. data/frameworks/uki/src/uki-theme/airport/i/button/normal-v.png +0 -0
  123. data/frameworks/uki/src/uki-theme/airport/i/button/normal.png +0 -0
  124. data/frameworks/uki/src/uki-theme/airport/i/checkbox/checkbox.png +0 -0
  125. data/frameworks/uki/src/uki-theme/airport/i/checkbox/focus.png +0 -0
  126. data/frameworks/uki/src/uki-theme/airport/i/checkbox/normal.gif +0 -0
  127. data/frameworks/uki/src/uki-theme/airport/i/checkbox/normal.png +0 -0
  128. data/frameworks/uki/src/uki-theme/airport/i/panel/dark-h.gif +0 -0
  129. data/frameworks/uki/src/uki-theme/airport/i/panel/dark-h.png +0 -0
  130. data/frameworks/uki/src/uki-theme/airport/i/panel/dark-m.png +0 -0
  131. data/frameworks/uki/src/uki-theme/airport/i/panel/dark.png +0 -0
  132. data/frameworks/uki/src/uki-theme/airport/i/popup/normal.png +0 -0
  133. data/frameworks/uki/src/uki-theme/airport/i/radio/focus.png +0 -0
  134. data/frameworks/uki/src/uki-theme/airport/i/radio/normal.gif +0 -0
  135. data/frameworks/uki/src/uki-theme/airport/i/radio/normal.png +0 -0
  136. data/frameworks/uki/src/uki-theme/airport/i/radio/radio.png +0 -0
  137. data/frameworks/uki/src/uki-theme/airport/i/shadow/large-c.png +0 -0
  138. data/frameworks/uki/src/uki-theme/airport/i/shadow/large-h.png +0 -0
  139. data/frameworks/uki/src/uki-theme/airport/i/shadow/large-m.png +0 -0
  140. data/frameworks/uki/src/uki-theme/airport/i/shadow/large-v.png +0 -0
  141. data/frameworks/uki/src/uki-theme/airport/i/shadow/large.png +0 -0
  142. data/frameworks/uki/src/uki-theme/airport/i/slider/bar-m.gif +0 -0
  143. data/frameworks/uki/src/uki-theme/airport/i/slider/bar-m.png +0 -0
  144. data/frameworks/uki/src/uki-theme/airport/i/slider/bar-v.gif +0 -0
  145. data/frameworks/uki/src/uki-theme/airport/i/slider/bar-v.png +0 -0
  146. data/frameworks/uki/src/uki-theme/airport/i/slider/bar.png +0 -0
  147. data/frameworks/uki/src/uki-theme/airport/i/slider/focus.png +0 -0
  148. data/frameworks/uki/src/uki-theme/airport/i/slider/handle.gif +0 -0
  149. data/frameworks/uki/src/uki-theme/airport/i/splitPane/horizontal.gif +0 -0
  150. data/frameworks/uki/src/uki-theme/airport/i/splitPane/horizontal.png +0 -0
  151. data/frameworks/uki/src/uki-theme/airport/i/splitPane/vertical.gif +0 -0
  152. data/frameworks/uki/src/uki-theme/airport/i/x.gif +0 -0
  153. data/frameworks/uki/src/uki-theme/airport.js +322 -0
  154. data/frameworks/uki/src/uki-theme/aristo/i/button/down-c.gif +0 -0
  155. data/frameworks/uki/src/uki-theme/aristo/i/button/down-c.png +0 -0
  156. data/frameworks/uki/src/uki-theme/aristo/i/button/down-h.png +0 -0
  157. data/frameworks/uki/src/uki-theme/aristo/i/button/down-m.png +0 -0
  158. data/frameworks/uki/src/uki-theme/aristo/i/button/down-v.png +0 -0
  159. data/frameworks/uki/src/uki-theme/aristo/i/button/down.png +0 -0
  160. data/frameworks/uki/src/uki-theme/aristo/i/button/focusRing-c.png +0 -0
  161. data/frameworks/uki/src/uki-theme/aristo/i/button/focusRing-h.png +0 -0
  162. data/frameworks/uki/src/uki-theme/aristo/i/button/focusRing-m.png +0 -0
  163. data/frameworks/uki/src/uki-theme/aristo/i/button/focusRing-v.png +0 -0
  164. data/frameworks/uki/src/uki-theme/aristo/i/button/focusRing.png +0 -0
  165. data/frameworks/uki/src/uki-theme/aristo/i/button/normal-c.gif +0 -0
  166. data/frameworks/uki/src/uki-theme/aristo/i/button/normal-c.png +0 -0
  167. data/frameworks/uki/src/uki-theme/aristo/i/button/normal-h.png +0 -0
  168. data/frameworks/uki/src/uki-theme/aristo/i/button/normal-m.png +0 -0
  169. data/frameworks/uki/src/uki-theme/aristo/i/button/normal-v.png +0 -0
  170. data/frameworks/uki/src/uki-theme/aristo/i/button/normal.png +0 -0
  171. data/frameworks/uki/src/uki-theme/aristo/i/checkbox/focus.png +0 -0
  172. data/frameworks/uki/src/uki-theme/aristo/i/checkbox/normal.gif +0 -0
  173. data/frameworks/uki/src/uki-theme/aristo/i/checkbox/normal.png +0 -0
  174. data/frameworks/uki/src/uki-theme/aristo/i/panel/normal-h.png +0 -0
  175. data/frameworks/uki/src/uki-theme/aristo/i/panel/normal-m.png +0 -0
  176. data/frameworks/uki/src/uki-theme/aristo/i/panel/normal.png +0 -0
  177. data/frameworks/uki/src/uki-theme/aristo/i/popup/normal.png +0 -0
  178. data/frameworks/uki/src/uki-theme/aristo/i/radio/focus.png +0 -0
  179. data/frameworks/uki/src/uki-theme/aristo/i/radio/normal.gif +0 -0
  180. data/frameworks/uki/src/uki-theme/aristo/i/radio/normal.png +0 -0
  181. data/frameworks/uki/src/uki-theme/aristo/i/shadow/large-c.png +0 -0
  182. data/frameworks/uki/src/uki-theme/aristo/i/shadow/large-h.png +0 -0
  183. data/frameworks/uki/src/uki-theme/aristo/i/shadow/large-m.png +0 -0
  184. data/frameworks/uki/src/uki-theme/aristo/i/shadow/large-v.png +0 -0
  185. data/frameworks/uki/src/uki-theme/aristo/i/shadow/large.png +0 -0
  186. data/frameworks/uki/src/uki-theme/aristo/i/slider/bar-m.gif +0 -0
  187. data/frameworks/uki/src/uki-theme/aristo/i/slider/bar-m.png +0 -0
  188. data/frameworks/uki/src/uki-theme/aristo/i/slider/bar-v.gif +0 -0
  189. data/frameworks/uki/src/uki-theme/aristo/i/slider/bar-v.png +0 -0
  190. data/frameworks/uki/src/uki-theme/aristo/i/slider/bar.png +0 -0
  191. data/frameworks/uki/src/uki-theme/aristo/i/slider/handle.gif +0 -0
  192. data/frameworks/uki/src/uki-theme/aristo/i/slider/handle.png +0 -0
  193. data/frameworks/uki/src/uki-theme/aristo/i/splitPane/horizontal.gif +0 -0
  194. data/frameworks/uki/src/uki-theme/aristo/i/splitPane/horizontal.png +0 -0
  195. data/frameworks/uki/src/uki-theme/aristo/i/splitPane/vertical.gif +0 -0
  196. data/frameworks/uki/src/uki-theme/aristo/i/x.gif +0 -0
  197. data/frameworks/uki/src/uki-theme/aristo.js +217 -0
  198. data/frameworks/uki/src/uki-view/view/box.js +1 -0
  199. data/frameworks/uki/src/uki-view/view/button.js +126 -0
  200. data/frameworks/uki/src/uki-view/view/checkbox.js +36 -0
  201. data/frameworks/uki/src/uki-view/view/flow.js +48 -0
  202. data/frameworks/uki/src/uki-view/view/image.js +9 -0
  203. data/frameworks/uki/src/uki-view/view/label.js +123 -0
  204. data/frameworks/uki/src/uki-view/view/list/render.js +23 -0
  205. data/frameworks/uki/src/uki-view/view/list.js +442 -0
  206. data/frameworks/uki/src/uki-view/view/popup.js +113 -0
  207. data/frameworks/uki/src/uki-view/view/radio.js +57 -0
  208. data/frameworks/uki/src/uki-view/view/scrollPane.js +139 -0
  209. data/frameworks/uki/src/uki-view/view/slider.js +154 -0
  210. data/frameworks/uki/src/uki-view/view/splitPane.js +213 -0
  211. data/frameworks/uki/src/uki-view/view/table/column.js +96 -0
  212. data/frameworks/uki/src/uki-view/view/table/header.js +53 -0
  213. data/frameworks/uki/src/uki-view/view/table/render.js +25 -0
  214. data/frameworks/uki/src/uki-view/view/table.js +71 -0
  215. data/frameworks/uki/src/uki-view/view/textField.js +145 -0
  216. data/frameworks/uki/src/uki-view/view/toolbar.js +93 -0
  217. data/frameworks/uki/src/uki-view.js +15 -0
  218. data/frameworks/uki/src/uki.js +2 -0
  219. data/frameworks/uki/thin.yaml +11 -0
  220. data/frameworks/uki/uki.rb +38 -0
  221. data/frameworks/uki/uki.ru +2 -0
  222. data/lib/uki/include_js.rb +50 -0
  223. data/lib/uki/project.rb +207 -0
  224. data/lib/uki/routes.rb +20 -0
  225. data/lib/uki/server.rb +42 -0
  226. data/lib/uki.rb +9 -0
  227. data/templates/index.html.erb +10 -0
  228. data/templates/model.js.erb +5 -0
  229. data/templates/myapp.js.erb +44 -0
  230. data/templates/package.js.erb +3 -0
  231. data/templates/spec.html.erb +23 -0
  232. data/templates/spec.js.erb +6 -0
  233. data/templates/view.js.erb +10 -0
  234. data/uki.gemspec +281 -0
  235. metadata +317 -0
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ *.log
2
+ *.pid
3
+ tmp*
4
+ .DS_Store
5
+ *~
6
+ pkg/
7
+ *.swp
data/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "frameworks/uki"]
2
+ path = frameworks/uki
3
+ url = git://github.com/voloko/uki.git
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Vladimir Kolesnikov
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "uki"
8
+ gem.summary = %Q{uki development tools}
9
+ gem.description = %Q{Project creation, dev server, testing, building for uki apps}
10
+ gem.email = "voloko@gmail.com"
11
+ gem.homepage = "http://github.com/voloko/uki"
12
+ gem.authors = ["Vladimir Kolesnikov"]
13
+
14
+ gem.files.include 'frameworks/**/*.*'
15
+
16
+ gem.add_runtime_dependency(%q<sinatra>, [">= 0"])
17
+ gem.add_runtime_dependency(%q<commander>, [">= 4.0.1"])
18
+ gem.add_runtime_dependency(%q<jspec>, [">= 3.3.2"])
19
+ end
20
+ Jeweler::GemcutterTasks.new
21
+ rescue LoadError
22
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
23
+ end
data/Readme.rdoc ADDED
@@ -0,0 +1,9 @@
1
+ = uki tools
2
+
3
+ Project creation, dev server, testing, building for uki apps
4
+
5
+ == Get started
6
+ [sudo] gem install uki
7
+ uki new project myapp +jspec
8
+ cd myapp
9
+ uki runserver
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0
data/bin/uki ADDED
@@ -0,0 +1,102 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ UKI_ROOT = File.expand_path File.join(File.dirname(__FILE__), '..')
4
+
5
+ require 'rubygems'
6
+ require 'commander/import'
7
+ require File.join(UKI_ROOT, 'lib', 'uki')
8
+
9
+ program :name, 'uki tools'
10
+ program :version, '1.0.0'
11
+ program :description, 'uki development tools'
12
+
13
+
14
+ command :"new project" do |c|
15
+ c.syntax = 'uki new project <dest>'
16
+ c.summary = 'Create uki project'
17
+ c.description = 'Create uki project template within <dest> folder.
18
+ The template includes uki framework, cotainer html, project files
19
+ and directrories.
20
+
21
+ Additionaly JSpec will be installed. You can prevent that with --nojspec option'
22
+ c.option '-J', '--nojspec', 'Install JSpec into the project template'
23
+
24
+ c.when_called do |args, options|
25
+ dest = args.shift or raise 'Project name required'
26
+ project = Uki::Project.new(dest)
27
+ project.create :jspec => !options.nojspec
28
+ say "Uki project crated at `#{dest}'"
29
+ end
30
+ end
31
+
32
+ command :'new view' do |c|
33
+ c.syntax = 'uki new view <name>'
34
+ c.summary = 'Create uki view'
35
+ c.description = "Create template for uki view with given <name>
36
+ and add include to the project file"
37
+ c.example "Create myapp.view.MyView", "uki new view MyView"
38
+ c.example "Create view in arbitary package", "uki new view mypackage.MyView"
39
+
40
+ c.when_called do |args, options|
41
+ path = args.shift or raise 'View name required'
42
+ project = Uki::Project.new('.')
43
+ path = "#{project.name}.view.#{path}"
44
+ project.create_class 'view.js', path
45
+ say "View #{path} created"
46
+ end
47
+ end
48
+
49
+ command :'new model' do |c|
50
+ c.syntax = 'uki new view <name>'
51
+ c.summary = 'Create uki model'
52
+ c.description = "Create template for uki model with given <name>
53
+ and add include to the project file"
54
+ c.example "Create myapp.model.MyModel", "uki new model MyModel"
55
+ c.example "Create view in arbitary package", "uki new model mypackage.MyModel"
56
+
57
+ c.when_called do |args, options|
58
+ path = args.shift or raise 'Model name required'
59
+ project = Uki::Project.new('.')
60
+ path = "#{project.name}.model.#{path}"
61
+ project.create_class 'model.js', path
62
+ say "Model #{path} created"
63
+ end
64
+ end
65
+
66
+ command :run do |c|
67
+ c.syntax = 'uki run [host[:port]]'
68
+ c.summary = 'Run development server'
69
+ c.description = 'Run development server on [host]:[port].
70
+ Server can process .cjs calls to merge javascript files.
71
+
72
+ You can add aditional processing to the server by creating server.rb
73
+ in your project root. Then use sinatra (http://sinatrarb.com) routes'
74
+
75
+ c.when_called do |args, options|
76
+ require 'uki/server.rb'
77
+ server = Uki::Server.new(args.shift)
78
+ require 'server.rb' if File.exists? 'server.rb'
79
+ server.start!
80
+ end
81
+ end
82
+
83
+ command :build do |c|
84
+ c.syntax = 'uki build [target]'
85
+ c.summary = 'Build current project'
86
+ c.description = 'Process all javascripts included in the index.html file.
87
+ Merges all include() in them and then runs them through
88
+ Google Closure Compiler.
89
+
90
+ You can disable the Compiler with --nocompiler option.
91
+
92
+ By default resulting files will be put into build directory. You may
93
+ override it with [target] option'
94
+ c.option '-C', '--nocompiler', 'Disable Google Closure Compiler'
95
+ c.when_called do |args, option|
96
+ target = args.shift || 'build'
97
+ project = Uki::Project.new('.')
98
+ project.build target, :compile => !option.nocompiler
99
+ say "Build complete at `#{target}'"
100
+ end
101
+ end
102
+
Binary file
Binary file
Binary file
@@ -0,0 +1,149 @@
1
+ body.jspec {
2
+ margin: 45px 0;
3
+ font: 12px "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif;
4
+ background: #efefef url(images/bg.png) top left repeat-x;
5
+ text-align: center;
6
+ }
7
+ #jspec {
8
+ margin: 0 auto;
9
+ padding-top: 30px;
10
+ width: 1008px;
11
+ background: url(images/vr.png) top left repeat-y;
12
+ text-align: left;
13
+ }
14
+ #jspec-top {
15
+ position: relative;
16
+ margin: 0 auto;
17
+ width: 1008px;
18
+ height: 40px;
19
+ background: url(images/sprites.bg.png) top left no-repeat;
20
+ }
21
+ #jspec-bottom {
22
+ margin: 0 auto;
23
+ width: 1008px;
24
+ height: 15px;
25
+ background: url(images/sprites.bg.png) bottom left no-repeat;
26
+ }
27
+ #jspec .loading {
28
+ margin-top: -45px;
29
+ width: 1008px;
30
+ height: 80px;
31
+ background: url(images/loading.gif) 50% 50% no-repeat;
32
+ }
33
+ #jspec-title {
34
+ position: absolute;
35
+ top: 15px;
36
+ left: 20px;
37
+ width: 160px;
38
+ font-size: 22px;
39
+ font-weight: normal;
40
+ background: url(images/sprites.png) 0 -126px no-repeat;
41
+ text-align: center;
42
+ }
43
+ #jspec-title em {
44
+ font-size: 10px;
45
+ font-style: normal;
46
+ color: #BCC8D1;
47
+ }
48
+ #jspec-report * {
49
+ margin: 0;
50
+ padding: 0;
51
+ background: none;
52
+ border: none;
53
+ }
54
+ #jspec-report {
55
+ padding: 15px 40px;
56
+ font: 11px "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif;
57
+ color: #7B8D9B;
58
+ }
59
+ #jspec-report.has-failures {
60
+ padding-bottom: 30px;
61
+ }
62
+ #jspec-report .hidden {
63
+ display: none;
64
+ }
65
+ #jspec-report .heading {
66
+ margin-bottom: 15px;
67
+ }
68
+ #jspec-report .heading span {
69
+ padding-right: 10px;
70
+ }
71
+ #jspec-report .heading .passes em {
72
+ color: #0ea0eb;
73
+ }
74
+ #jspec-report .heading .failures em {
75
+ color: #FA1616;
76
+ }
77
+ #jspec-report table {
78
+ font-size: 11px;
79
+ border-collapse: collapse;
80
+ }
81
+ #jspec-report td {
82
+ padding: 8px;
83
+ text-indent: 30px;
84
+ color: #7B8D9B;
85
+ }
86
+ #jspec-report tr.body {
87
+ display: none;
88
+ }
89
+ #jspec-report tr.body pre {
90
+ margin: 0;
91
+ padding: 0 0 5px 25px;
92
+ }
93
+ #jspec-report tr.even:hover + tr.body,
94
+ #jspec-report tr.odd:hover + tr.body {
95
+ display: block;
96
+ }
97
+ #jspec-report tr td:first-child em {
98
+ display: block;
99
+ clear: both;
100
+ font-style: normal;
101
+ font-weight: normal;
102
+ color: #7B8D9B;
103
+ }
104
+ #jspec-report tr.even:hover,
105
+ #jspec-report tr.odd:hover {
106
+ text-shadow: 1px 1px 1px #fff;
107
+ background: #F2F5F7;
108
+ }
109
+ #jspec-report td + td {
110
+ padding-right: 0;
111
+ width: 15px;
112
+ }
113
+ #jspec-report td.pass {
114
+ background: url(images/sprites.png) 3px -7px no-repeat;
115
+ }
116
+ #jspec-report td.fail {
117
+ background: url(images/sprites.png) 3px -158px no-repeat;
118
+ font-weight: bold;
119
+ color: #FC0D0D;
120
+ }
121
+ #jspec-report td.requires-implementation {
122
+ background: url(images/sprites.png) 3px -333px no-repeat;
123
+ }
124
+ #jspec-report tr.description td {
125
+ margin-top: 25px;
126
+ padding-top: 25px;
127
+ font-size: 12px;
128
+ font-weight: bold;
129
+ text-indent: 0;
130
+ color: #1a1a1a;
131
+ }
132
+ #jspec-report tr.description:first-child td {
133
+ border-top: none;
134
+ }
135
+ #jspec-report .assertion {
136
+ display: block;
137
+ float: left;
138
+ margin: 0 0 0 1px;
139
+ padding: 0;
140
+ width: 1px;
141
+ height: 5px;
142
+ background: #7B8D9B;
143
+ }
144
+ #jspec-report .assertion.failed {
145
+ background: red;
146
+ }
147
+ .jspec-sandbox {
148
+ display: none;
149
+ }
@@ -0,0 +1,115 @@
1
+
2
+ // JSpec - Growl - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed)
3
+
4
+ ;(function(){
5
+
6
+ Growl = {
7
+
8
+ // --- Version
9
+
10
+ version: '1.0.0',
11
+
12
+ /**
13
+ * Execute the given _cmd_, returning an array of lines from stdout.
14
+ *
15
+ * Examples:
16
+ *
17
+ * Growl.exec('growlnotify', '-m', msg)
18
+ *
19
+ * @param {string ...} cmd
20
+ * @return {array}
21
+ * @api public
22
+ */
23
+
24
+ exec: function(cmd) {
25
+ var lines = [], line
26
+ with (JavaImporter(java.lang, java.io)) {
27
+ var proccess = Runtime.getRuntime().exec(Array.prototype.slice.call(arguments))
28
+ var stream = new DataInputStream(proccess.getInputStream())
29
+ while (line = stream.readLine())
30
+ lines.push(line + '')
31
+ stream.close()
32
+ }
33
+ return lines
34
+ },
35
+
36
+ /**
37
+ * Return the extension of the given _path_ or null.
38
+ *
39
+ * @param {string} path
40
+ * @return {string}
41
+ * @api private
42
+ */
43
+
44
+ extname: function(path) {
45
+ return path.lastIndexOf('.') != -1 ?
46
+ path.slice(path.lastIndexOf('.') + 1, path.length) :
47
+ null
48
+ },
49
+
50
+ /**
51
+ * Version of the 'growlnotify' binary.
52
+ *
53
+ * @return {string}
54
+ * @api private
55
+ */
56
+
57
+ binVersion: function() {
58
+ try { return this.exec('growlnotify', '-v')[0].split(' ')[1] } catch (e) {}
59
+ },
60
+
61
+ /**
62
+ * Send growl notification _msg_ with _options_.
63
+ *
64
+ * Options:
65
+ *
66
+ * - title Notification title
67
+ * - sticky Make the notification stick (defaults to false)
68
+ * - name Application name (defaults to growlnotify)
69
+ * - image
70
+ * - path to an icon sets --iconpath
71
+ * - path to an image sets --image
72
+ * - capitalized word sets --appIcon
73
+ * - filename uses extname as --icon
74
+ * - otherwise treated as --icon
75
+ *
76
+ * Examples:
77
+ *
78
+ * Growl.notify('New email')
79
+ * Growl.notify('5 new emails', { title: 'Thunderbird' })
80
+ *
81
+ * @param {string} msg
82
+ * @param {options} hash
83
+ * @api public
84
+ */
85
+
86
+ notify: function(msg, options) {
87
+ options = options || {}
88
+ var args = ['growlnotify', '-m', msg]
89
+ if (!this.binVersion()) throw new Error('growlnotify executable is required')
90
+ if (image = options.image) {
91
+ var flag, ext = this.extname(image)
92
+ flag = flag || ext == 'icns' && 'iconpath'
93
+ flag = flag || /^[A-Z]/.test(image) && 'appIcon'
94
+ flag = flag || /^png|gif|jpe?g$/.test(ext) && 'image'
95
+ flag = flag || ext && (image = ext) && 'icon'
96
+ flag = flag || 'icon'
97
+ args.push('--' + flag, image)
98
+ }
99
+ if (options.sticky) args.push('--sticky')
100
+ if (options.name) args.push('--name', options.name)
101
+ if (options.title) args.push(options.title)
102
+ this.exec.apply(this, args)
103
+ }
104
+ }
105
+
106
+ JSpec.include({
107
+ name: 'Growl',
108
+ reporting: function(options){
109
+ var stats = JSpec.stats
110
+ if (stats.failures) Growl.notify('failed ' + stats.failures + ' assertions', { title: 'JSpec'})
111
+ else Growl.notify('passed ' + stats.passes + ' assertions', { title: 'JSpec' })
112
+ }
113
+ })
114
+
115
+ })()
@@ -0,0 +1,72 @@
1
+
2
+ // JSpec - jQuery - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed)
3
+
4
+ JSpec
5
+ .requires('jQuery', 'when using jspec.jquery.js')
6
+ .include({
7
+ name: 'jQuery',
8
+
9
+ // --- Initialize
10
+
11
+ init : function() {
12
+ jQuery.ajaxSetup({ async: false })
13
+ },
14
+
15
+ // --- Utilities
16
+
17
+ utilities : {
18
+ element: jQuery,
19
+ elements: jQuery,
20
+ sandbox : function() {
21
+ return jQuery('<div class="sandbox"></div>')
22
+ }
23
+ },
24
+
25
+ // --- Matchers
26
+
27
+ matchers : {
28
+ have_tag : "jQuery(expected, actual).length === 1",
29
+ have_one : "alias have_tag",
30
+ have_tags : "jQuery(expected, actual).length > 1",
31
+ have_many : "alias have_tags",
32
+ have_any : "alias have_tags",
33
+ have_child : "jQuery(actual).children(expected).length === 1",
34
+ have_children : "jQuery(actual).children(expected).length > 1",
35
+ have_text : "jQuery(actual).text() === expected",
36
+ have_value : "jQuery(actual).val() === expected",
37
+ be_enabled : "!jQuery(actual).attr('disabled')",
38
+ have_class : "jQuery(actual).hasClass(expected)",
39
+
40
+ be_visible : function(actual) {
41
+ return jQuery(actual).css('display') != 'none' &&
42
+ jQuery(actual).css('visibility') != 'hidden' &&
43
+ jQuery(actual).attr('type') != 'hidden'
44
+ },
45
+
46
+ be_hidden : function(actual) {
47
+ return !JSpec.does(actual, 'be_visible')
48
+ },
49
+
50
+ have_classes : function(actual) {
51
+ return !JSpec.any(JSpec.toArray(arguments, 1), function(arg){
52
+ return !JSpec.does(actual, 'have_class', arg)
53
+ })
54
+ },
55
+
56
+ have_attr : function(actual, attr, value) {
57
+ return value ? jQuery(actual).attr(attr) == value:
58
+ jQuery(actual).attr(attr)
59
+ },
60
+
61
+ 'be disabled selected checked' : function(attr) {
62
+ return 'jQuery(actual).attr("' + attr + '")'
63
+ },
64
+
65
+ 'have type id title alt href src sel rev name target' : function(attr) {
66
+ return function(actual, value) {
67
+ return JSpec.does(actual, 'have_attr', attr, value)
68
+ }
69
+ }
70
+ }
71
+ })
72
+