compass-jquery-plugin 0.3.0.beta.21 → 0.3.0.beta.22

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. data/README.textile +212 -211
  2. data/VERSION.yml +5 -5
  3. data/compass-jquery-plugin.gemspec +25 -2
  4. data/gem_tasks/jqtouch.rake +221 -201
  5. data/gem_tasks/jrails.rake +322 -311
  6. data/lib/compiler.jar +0 -0
  7. data/lib/jquery/flash_messages.rb +45 -45
  8. data/lib/jquery/gridify/grid.rb +147 -147
  9. data/lib/jquery/gridify/grid_column.rb +134 -134
  10. data/lib/jquery/gridify/grid_finder.rb +223 -211
  11. data/lib/jquery/gridify/grid_options.rb +279 -279
  12. data/lib/jquery/gridify/grid_view.rb +435 -436
  13. data/lib/jquery/gridify.rb +42 -42
  14. data/templates/dynatree/jquery.dynatree.min.js +1 -1
  15. data/templates/jqgrid/i18n/jqgrid/locale-bg.min.js +6 -15
  16. data/templates/jqgrid/i18n/jqgrid/locale-bg1251.min.js +6 -15
  17. data/templates/jqgrid/i18n/jqgrid/locale-cat.min.js +5 -6
  18. data/templates/jqgrid/i18n/jqgrid/locale-cn.min.js +5 -8
  19. data/templates/jqgrid/i18n/jqgrid/locale-cs.min.js +6 -8
  20. data/templates/jqgrid/i18n/jqgrid/locale-da.min.js +6 -6
  21. data/templates/jqgrid/i18n/jqgrid/locale-de.min.js +7 -7
  22. data/templates/jqgrid/i18n/jqgrid/locale-el.min.js +7 -13
  23. data/templates/jqgrid/i18n/jqgrid/locale-es.min.js +7 -7
  24. data/templates/jqgrid/i18n/jqgrid/locale-fa.min.js +6 -12
  25. data/templates/jqgrid/i18n/jqgrid/locale-fr.min.js +7 -7
  26. data/templates/jqgrid/i18n/jqgrid/locale-gl.min.js +7 -7
  27. data/templates/jqgrid/i18n/jqgrid/locale-he.min.js +6 -13
  28. data/templates/jqgrid/i18n/jqgrid/locale-hu.min.js +6 -8
  29. data/templates/jqgrid/i18n/jqgrid/locale-is.min.js +6 -7
  30. data/templates/jqgrid/i18n/jqgrid/locale-it.min.js +4 -4
  31. data/templates/jqgrid/i18n/jqgrid/locale-ja.min.js +5 -10
  32. data/templates/jqgrid/i18n/jqgrid/locale-no.min.js +6 -6
  33. data/templates/jqgrid/i18n/jqgrid/locale-pl.min.js +6 -7
  34. data/templates/jqgrid/i18n/jqgrid/locale-pt-br.min.js +6 -7
  35. data/templates/jqgrid/i18n/jqgrid/locale-pt.min.js +4 -5
  36. data/templates/jqgrid/i18n/jqgrid/locale-ro.min.js +7 -8
  37. data/templates/jqgrid/i18n/jqgrid/locale-ru.min.js +7 -16
  38. data/templates/jqgrid/i18n/jqgrid/locale-sk.min.js +6 -8
  39. data/templates/jqgrid/i18n/jqgrid/locale-sv.min.js +6 -7
  40. data/templates/jqgrid/i18n/jqgrid/locale-tr.min.js +6 -7
  41. data/templates/jqgrid/i18n/jqgrid/locale-ua.min.js +7 -16
  42. data/templates/jqgrid/jquery.jqGrid.js +11567 -11565
  43. data/templates/jqgrid/jquery.jqGrid.min.js +472 -472
  44. data/templates/jqical/jquery.jqical.js +5 -9
  45. data/templates/jqical/jquery.jqical.min.js +44 -44
  46. data/templates/jqical/jquery.ui/jqical.scss +1 -1
  47. data/templates/jqtouch/config/initializers/jqtouch.rb +5 -4
  48. data/templates/jqtouch/jqtouch/apple/activeButton.png +0 -0
  49. data/templates/jqtouch/jqtouch/default/backButton.png +0 -0
  50. data/templates/jqtouch/jqtouch/default/backButtonActive.png +0 -0
  51. data/templates/jqtouch/jqtouch/default/bigButton.png +0 -0
  52. data/templates/jqtouch/jqtouch/default/bigButtonActive.png +0 -0
  53. data/templates/jqtouch/jqtouch/default/button.png +0 -0
  54. data/templates/jqtouch/jqtouch/default/buttonActive.png +0 -0
  55. data/templates/jqtouch/jqtouch/default/chevron.png +0 -0
  56. data/templates/jqtouch/jqtouch/default/chevronActive.png +0 -0
  57. data/templates/jqtouch/jqtouch/default/chevronCircle.png +0 -0
  58. data/templates/jqtouch/jqtouch/default/chevronCircleActive.png +0 -0
  59. data/templates/jqtouch/jqtouch/default/loading.gif +0 -0
  60. data/templates/jqtouch/jqtouch/default/toggleSwitch.png +0 -0
  61. data/templates/jqtouch/jqtouch/default/toolbarBackground.png +0 -0
  62. data/templates/jqtouch/jqtouch/jqt/back_button_clicked.png +0 -0
  63. data/templates/jqtouch/jqtouch/jqt.apple.scss +24 -11
  64. data/templates/jqtouch/jqtouch/jqt.default.scss +537 -0
  65. data/templates/jqtouch/jqtouch/jqt.jqt.scss +20 -6
  66. data/templates/jqtouch/jqtouch/jqtouch.scss +173 -1
  67. data/templates/jqtouch/jqtouch/photo/btnBack.png +0 -0
  68. data/templates/jqtouch/jqtouch/photo/loading.gif +0 -0
  69. data/templates/jqtouch/jqtouch/photo/navNext.png +0 -0
  70. data/templates/jqtouch/jqtouch/photo/navPause.png +0 -0
  71. data/templates/jqtouch/jqtouch/photo/navPlay.png +0 -0
  72. data/templates/jqtouch/jqtouch/photo/navPrev.png +0 -0
  73. data/templates/jqtouch/jqtouch/photo/toolbar.png +0 -0
  74. data/templates/jqtouch/jquery.jqtouch.js +8219 -632
  75. data/templates/jqtouch/jquery.jqtouch.min.js +60 -1
  76. data/templates/jqtouch/manifest.rb +21 -0
  77. data/templates/jrails/config/initializers/jrails.rb +1 -0
  78. data/templates/jrails/haml.js +2 -2
  79. data/templates/jrails/i18n/jquery.ui/datepicker-ar.min.js +2 -4
  80. data/templates/jrails/i18n/jquery.ui/datepicker-az.min.js +2 -2
  81. data/templates/jrails/i18n/jquery.ui/datepicker-bg.min.js +2 -4
  82. data/templates/jrails/i18n/jquery.ui/datepicker-bs.min.js +2 -2
  83. data/templates/jrails/i18n/jquery.ui/datepicker-cs.min.js +2 -2
  84. data/templates/jrails/i18n/jquery.ui/datepicker-da.min.js +2 -2
  85. data/templates/jrails/i18n/jquery.ui/datepicker-de.min.js +2 -2
  86. data/templates/jrails/i18n/jquery.ui/datepicker-el.min.js +2 -4
  87. data/templates/jrails/i18n/jquery.ui/datepicker-eo.min.js +2 -2
  88. data/templates/jrails/i18n/jquery.ui/datepicker-et.min.js +2 -2
  89. data/templates/jrails/i18n/jquery.ui/datepicker-fa.min.js +2 -3
  90. data/templates/jrails/i18n/jquery.ui/datepicker-fo.min.js +2 -2
  91. data/templates/jrails/i18n/jquery.ui/datepicker-fr-CH.min.js +2 -2
  92. data/templates/jrails/i18n/jquery.ui/datepicker-fr.min.js +2 -2
  93. data/templates/jrails/i18n/jquery.ui/datepicker-he.min.js +2 -3
  94. data/templates/jrails/i18n/jquery.ui/datepicker-hr.min.js +2 -2
  95. data/templates/jrails/i18n/jquery.ui/datepicker-hu.min.js +2 -2
  96. data/templates/jrails/i18n/jquery.ui/datepicker-hy.min.js +2 -4
  97. data/templates/jrails/i18n/jquery.ui/datepicker-ja.min.js +2 -2
  98. data/templates/jrails/i18n/jquery.ui/datepicker-ko.min.js +2 -2
  99. data/templates/jrails/i18n/jquery.ui/datepicker-kz.min.js +2 -4
  100. data/templates/jrails/i18n/jquery.ui/datepicker-lt.min.js +2 -2
  101. data/templates/jrails/i18n/jquery.ui/datepicker-lv.min.js +2 -2
  102. data/templates/jrails/i18n/jquery.ui/datepicker-nl.min.js +2 -2
  103. data/templates/jrails/i18n/jquery.ui/datepicker-no.min.js +2 -2
  104. data/templates/jrails/i18n/jquery.ui/datepicker-pl.min.js +2 -2
  105. data/templates/jrails/i18n/jquery.ui/datepicker-ro.min.js +2 -2
  106. data/templates/jrails/i18n/jquery.ui/datepicker-ru.min.js +2 -4
  107. data/templates/jrails/i18n/jquery.ui/datepicker-sk.min.js +2 -2
  108. data/templates/jrails/i18n/jquery.ui/datepicker-sq.min.js +2 -2
  109. data/templates/jrails/i18n/jquery.ui/datepicker-sr-SR.min.js +2 -2
  110. data/templates/jrails/i18n/jquery.ui/datepicker-sr.min.js +2 -4
  111. data/templates/jrails/i18n/jquery.ui/datepicker-sv.min.js +2 -2
  112. data/templates/jrails/i18n/jquery.ui/datepicker-ta.min.js +2 -4
  113. data/templates/jrails/i18n/jquery.ui/datepicker-th.min.js +2 -4
  114. data/templates/jrails/i18n/jquery.ui/datepicker-tr.min.js +2 -2
  115. data/templates/jrails/i18n/jquery.ui/datepicker-uk.min.js +2 -4
  116. data/templates/jrails/i18n/jquery.ui/datepicker-vi.min.js +2 -2
  117. data/templates/jrails/i18n/jquery.ui/datepicker-zh-CN.min.js +2 -2
  118. data/templates/jrails/i18n/jquery.ui/datepicker-zh-HK.min.js +2 -2
  119. data/templates/jrails/i18n/jquery.ui/datepicker-zh-TW.min.js +2 -2
  120. data/templates/jrails/jquery-1.4.2.min.js +156 -156
  121. data/templates/jrails/jquery-ui-1.8.5.js +23753 -23341
  122. data/templates/jrails/jquery-ui-1.8.5.min.js +823 -808
  123. data/templates/jrails/jquery.contextMenu.min.js +1 -1
  124. data/templates/jrails/jquery.sparkline.js +1050 -0
  125. data/templates/jrails/jquery.sparkline.min.js +31 -0
  126. data/templates/jrails/jquery.ui/_theme.scss +1699 -1634
  127. data/templates/jrails/manifest.rb +13 -11
  128. data/templates/jstree/jquery.jstree.min.js +10 -10
  129. data/templates/ribbon/jquery.ribbon.min.js +6 -6
  130. metadata +27 -4
@@ -1,312 +1,323 @@
1
- require 'fileutils'
2
- require 'lib/handle_js_files'
3
- require 'lib/jquery.ui'
4
-
5
- # Compass generator for jrails 0.1+
6
- JRAILS_SRC = File.join(GEM_ROOT, 'src', 'jrails', 'jrails.1.4.2')
7
- JRAILS_SRC_SCRIPTS = JRAILS_SRC + "/*.js"
8
-
9
- JHAML_SRC_SCRIPTS = File.join(GEM_ROOT, 'src', 'jrails', 'jquery-haml') + "/*.js"
10
- HAML_JS_SRC_SCRIPTS = File.join(GEM_ROOT, 'src', 'jrails', 'haml-js') + "/*.js"
11
-
12
- FLASH_SRC = File.join(GEM_ROOT, 'src', 'jrails', 'flash_messages')
13
- FLASH_SRC_IMAGES = File.join(FLASH_SRC, 'images')
14
-
15
- JQUERY_SRC = File.join(GEM_ROOT, 'src', 'jrails', 'jquery.1.4.2')
16
- JQUERY_SRC_SCRIPTS = JQUERY_SRC + "/*.js"
17
-
18
- JQUERY_UI_18_SRC = File.join(GEM_ROOT, 'src', 'jrails', 'jquery.ui.1.8.5')
19
- JQUERY_UI_18_SRC_SCRIPTS = File.join(JQUERY_UI_18_SRC, 'js') + "/*.js"
20
- JQUERY_UI_18_SRC_THEMES = File.join(JQUERY_UI_18_SRC, 'themes')
21
- JQUERY_UI_18_SRC_TRANSLATIONS = File.join(JQUERY_UI_18_SRC, 'js', 'i18n') #+ "/*.js"
22
-
23
- JRAILS_DEST_TEMPLATES = File.join(GEM_ROOT, 'templates', 'jrails')
24
- JRAILS_DEST_TRANSLATIONS = File.join(JRAILS_DEST_TEMPLATES, 'i18n', 'jquery.ui')
25
- JRAILS_DEST_THEMES = File.join(JRAILS_DEST_TEMPLATES, 'jquery.ui')
26
- JRAILS_DEST_IMAGES = File.join(JRAILS_DEST_TEMPLATES, 'jquery.ui')
27
- FLASH_DEST_STYLESHEETS = File.join(JRAILS_DEST_TEMPLATES, 'partials')
28
- FLASH_DEST_IMAGES = File.join(JRAILS_DEST_IMAGES, 'flash_messages')
29
-
30
- namespace :build do
31
- desc 'Build the stylesheets and templates for jRails.'
32
- task :jrails do
33
-
34
- FileUtils.remove_dir JRAILS_DEST_TEMPLATES if File.exists? JRAILS_DEST_TEMPLATES
35
- FileUtils.mkdir_p(File.join(JRAILS_DEST_TEMPLATES, 'config', 'initializers'))
36
- FileUtils.mkdir_p(File.join(JRAILS_DEST_THEMES))
37
-
38
- open File.join(JRAILS_DEST_TEMPLATES, 'manifest.rb'), 'w' do |manifest|
39
-
40
- # jRails
41
-
42
- manifest.print JRAILS_MESSAGE1
43
-
44
- open File.join(JRAILS_DEST_TEMPLATES, 'config', 'initializers', 'jrails.rb'), 'w' do |f|
45
- f.print(File.read(File.join(JRAILS_SRC, 'config', 'initializers', 'jrails.rb')))
46
- end
47
- manifest.print "file 'config/initializers/jrails.rb'\n"
48
-
49
- open File.join(JRAILS_DEST_TEMPLATES, 'jrails.js'), 'w' do |f|
50
- f.print concat_files(all_files(JRAILS_SRC_SCRIPTS))
51
- end
52
- manifest.print "javascript 'jrails.js'\n"
53
-
54
- open File.join(JRAILS_DEST_TEMPLATES, 'jrails.min.js'), 'w' do |f|
55
- f.print compress_js(all_files(JRAILS_SRC_SCRIPTS), "google")
56
- end
57
- manifest.print "javascript 'jrails.min.js'\n"
58
-
59
- #Flash Messages
60
- FileUtils.mkdir_p(File.join(FLASH_DEST_STYLESHEETS))
61
- css = File.read File.join(FLASH_SRC, 'flash_messages.css')
62
- sass = ''
63
- IO.popen("sass-convert -F css -T scss", 'r+') { |f| f.print(css); f.close_write; sass = f.read }
64
- open File.join(FLASH_DEST_STYLESHEETS, '_flash_messages.scss'), 'w' do |f|
65
- f.write sass
66
- end
67
- manifest.print "stylesheet 'partials/_flash_messages.scss', :media => 'screen, projection'\n"
68
-
69
- # Copy the images directory
70
- FileUtils.mkdir_p File.join(FLASH_DEST_IMAGES)
71
- src_dir = FLASH_SRC_IMAGES
72
- dest_dir = FLASH_DEST_IMAGES
73
-
74
- Dir.foreach(src_dir) do |image|
75
- next unless /\.png$/ =~ image
76
- FileUtils.cp(File.join(src_dir, image), dest_dir)
77
- manifest.print "image 'jquery.ui/flash_messages/#{image}'\n"
78
- end
79
-
80
- # jQuery haml
81
-
82
- open File.join(JRAILS_DEST_TEMPLATES, 'jquery.haml.js'), 'w' do |f|
83
- f.print concat_files(all_files(JHAML_SRC_SCRIPTS))
84
- end
85
- manifest.print "javascript 'jquery.haml.js'\n"
86
-
87
- open File.join(JRAILS_DEST_TEMPLATES, 'jquery.haml.min.js'), 'w' do |f|
88
- f.print compress_js(all_files(JHAML_SRC_SCRIPTS), "google")
89
- end
90
- manifest.print "javascript 'jquery.haml.min.js'\n"
91
-
92
- # HAML Js
93
-
94
- open File.join(JRAILS_DEST_TEMPLATES, 'haml.js'), 'w' do |f|
95
- f.print concat_files(all_files(HAML_JS_SRC_SCRIPTS))
96
- end
97
- manifest.print "javascript 'haml.js'\n"
98
-
99
- open File.join(JRAILS_DEST_TEMPLATES, 'haml.min.js'), 'w' do |f|
100
- f.print compress_js(all_files(JHAML_SRC_SCRIPTS), "google")
101
- end
102
- manifest.print "javascript 'haml.min.js'\n"
103
-
104
- # jQuery 1.4
105
-
106
- open File.join(JRAILS_DEST_TEMPLATES, 'jquery-1.4.2.js'), 'w' do |f|
107
- f.print concat_files(all_files(JQUERY_SRC_SCRIPTS))
108
- end
109
- manifest.print "javascript 'jquery-1.4.2.js'\n"
110
-
111
- open File.join(JRAILS_DEST_TEMPLATES, 'jquery-1.4.2.min.js'), 'w' do |f|
112
- f.print compress_js(all_files(JQUERY_SRC_SCRIPTS), "google")
113
- end
114
- manifest.print "javascript 'jquery-1.4.2.min.js'\n"
115
-
116
- # jQuery 1.4 Compat 1.3
117
-
118
- ['compat-1.3'].each do |path|
119
- Dir.foreach File.join(JQUERY_SRC, path) do |file|
120
- next unless /\.js$/ =~ file
121
- js = File.read File.join(JQUERY_SRC, path, file)
122
- manifest.print "javascript '#{file}'\n"
123
- open File.join(JRAILS_DEST_TEMPLATES, file), 'w' do |f|
124
- f.write js
125
- end
126
- file.gsub!(/\.js$/, '.min.js')
127
- manifest.print "javascript '#{file}'\n"
128
- open File.join(JRAILS_DEST_TEMPLATES, file), 'w' do |f|
129
- f.write compress_js(js, "google")
130
- end
131
- end
132
- end
133
-
134
- # jQuery 1.4 Plugins
135
-
136
- ['plugins'].each do |path|
137
- Dir.foreach File.join(JQUERY_SRC, path) do |file|
138
-
139
- if /\.css$/ =~ file
140
- css = File.read File.join(JQUERY_SRC, path, file)
141
- sass = ''
142
- IO.popen("sass-convert -F css -T scss", 'r+') { |f| f.print(css); f.close_write; sass = f.read }
143
- file.gsub!(/^jquery\./,'').gsub!(/\.css$/, '.scss')
144
- open File.join(JRAILS_DEST_THEMES, file), 'w' do |f|
145
- f.write sass
146
- end
147
- manifest.print "stylesheet 'jquery.ui/#{file}', :media => 'screen, projection'\n"
148
- end
149
-
150
- next unless /\.js$/ =~ file
151
- js = File.read File.join(JQUERY_SRC, path, file)
152
- manifest.print "javascript '#{file}'\n"
153
- open File.join(JRAILS_DEST_TEMPLATES, file), 'w' do |f|
154
- f.write js
155
- end
156
- file.gsub!(/\.js$/, '.min.js')
157
- manifest.print "javascript '#{file}'\n"
158
- open File.join(JRAILS_DEST_TEMPLATES, file), 'w' do |f|
159
- f.write compress_js(js, "google")
160
- end
161
- end
162
- end
163
-
164
- Dir.foreach File.join(JQUERY_SRC, 'plugins', 'images') do |plugin|
165
- next if /^\./ =~ plugin
166
-
167
- # Copy the theme images directory
168
- src_dir = File.join(JQUERY_SRC, 'plugins', 'images', plugin)
169
- dest_dir = File.join(JRAILS_DEST_IMAGES, plugin)
170
- FileUtils.mkdir_p dest_dir
171
-
172
- Dir.foreach(src_dir) do |image|
173
- next if /^\./ =~ image
174
- FileUtils.cp(File.join(src_dir, image), dest_dir)
175
- manifest.print "image 'jquery.ui/#{plugin}/#{image}'\n"
176
- end
177
- end
178
-
179
- # jQuery.UI 1.8.5
180
-
181
- # Scripts
182
-
183
- all_jquery_ui_scripts = [
184
- 'jquery-ui.js',
185
- 'jquery.effects.blind.js',
186
- 'jquery.effects.bounce.js',
187
- 'jquery.effects.clip.js',
188
- 'jquery.effects.core.js',
189
- 'jquery.effects.drop.js',
190
- 'jquery.effects.explode.js',
191
- 'jquery.effects.fade.js',
192
- 'jquery.effects.fold.js',
193
- 'jquery.effects.highlight.js',
194
- 'jquery.effects.pulsate.js',
195
- 'jquery.effects.scale.js',
196
- 'jquery.effects.shake.js',
197
- 'jquery.effects.slide.js',
198
- 'jquery.effects.transfer.js',
199
- 'jquery.ui.accordion.js',
200
- 'jquery.ui.autocomplete.js',
201
- 'jquery.ui.button.js',
202
- 'jquery.ui.core.js',
203
- 'jquery.ui.datepicker.js',
204
- 'jquery.ui.dialog.js',
205
- 'jquery.ui.draggable.js',
206
- 'jquery.ui.droppable.js',
207
- 'jquery.ui.mouse.js',
208
- 'jquery.ui.position.js',
209
- 'jquery.ui.progressbar.js',
210
- 'jquery.ui.resizable.js',
211
- 'jquery.ui.selectable.js',
212
- 'jquery.ui.selectmenu.js',
213
- 'jquery.ui.slider.js',
214
- 'jquery.ui.sortable.js',
215
- 'jquery.ui.tabs.js',
216
- 'jquery.ui.widget.js'
217
- ].collect {|filename| File.read(File.join(JQUERY_UI_18_SRC, 'js', filename))}.join "\n\n"
218
-
219
- open File.join(JRAILS_DEST_TEMPLATES, 'jquery-ui-1.8.5.js'), 'w' do |f|
220
- f.print concat_files(all_jquery_ui_scripts)
221
- end
222
- manifest.print "javascript 'jquery-ui-1.8.5.js'\n"
223
-
224
- open File.join(JRAILS_DEST_TEMPLATES, 'jquery-ui-1.8.5.min.js'), 'w' do |f|
225
- f.print compress_js(all_jquery_ui_scripts, "google")
226
- end
227
- manifest.print "javascript 'jquery-ui-1.8.5.min.js'\n"
228
-
229
- # jQuery UI locales
230
-
231
- ['i18n'].each do |path|
232
- FileUtils.mkdir_p(JRAILS_DEST_TRANSLATIONS)
233
- Dir.foreach JQUERY_UI_18_SRC_TRANSLATIONS do |file|
234
- next unless /^jquery.ui\.datepicker-(.+)\.js$/ =~ file
235
- lang = file
236
- js = File.read File.join(JQUERY_UI_18_SRC_TRANSLATIONS, file)
237
- file.gsub!(/^jquery.ui\./,'')
238
- manifest.print "javascript '#{File.join(path, 'jquery.ui', file)}'\n"
239
- open File.join(JRAILS_DEST_TRANSLATIONS, file), 'w' do |f|
240
- f.write js
241
- end
242
- file.gsub!(/\.js$/, '.min.js')
243
- manifest.print "javascript '#{File.join(path, 'jquery.ui', file)}'\n"
244
- open File.join(JRAILS_DEST_TRANSLATIONS, file), 'w' do |f|
245
- f.write compress_js(js, "google")
246
- end
247
- end
248
- end
249
-
250
- # jQuery UI Themes
251
-
252
- ui = JqueryUiTheme.new(File.join(JQUERY_UI_18_SRC_THEMES, 'base'))
253
- ui.convert_css(File.join(JRAILS_DEST_THEMES, '_partials'))
254
-
255
- all_jquery_ui_stylesheets = [
256
- '_core.scss',
257
- '_accordion.scss',
258
- '_autocomplete.scss',
259
- '_button.scss',
260
- '_datepicker.scss',
261
- '_dialog.scss',
262
- '_progressbar.scss',
263
- '_resizable.scss',
264
- '_selectable.scss',
265
- '_selectmenu.scss',
266
- '_slider.scss',
267
- '_tabs.scss',
268
- '_theme.scss'
269
- ].collect {|filename| File.read(File.join(JRAILS_DEST_THEMES, '_partials', filename))}.join "\n\n"
270
-
271
- open File.join(JRAILS_DEST_THEMES, '_theme.scss'), 'w' do |f|
272
- sass = JRAILS_MESSAGE2
273
- f.print(all_jquery_ui_stylesheets)
274
- f.print sass
275
- FileUtils.rm_r(File.join(JRAILS_DEST_THEMES, '_partials'))
276
- end
277
-
278
- manifest.print "stylesheet 'jquery.ui/_theme.scss', :media => 'screen, projection'\n"
279
-
280
- Dir.foreach JQUERY_UI_18_SRC_THEMES do |theme|
281
- next if /^\./ =~ theme
282
-
283
- # Convert the stylesheet
284
- manifest.print "stylesheet 'jquery.ui/#{theme}.scss', :media => 'screen, projection'\n"
285
- ui.convert_theme(theme, File.join(JQUERY_UI_18_SRC_THEMES, theme), File.join(JRAILS_DEST_THEMES))
286
-
287
- # Copy the theme images directory
288
- src_dir = File.join(JQUERY_UI_18_SRC_THEMES, theme, 'images')
289
- dest_dir = File.join(JRAILS_DEST_IMAGES, theme)
290
- FileUtils.mkdir_p dest_dir
291
-
292
- Dir.foreach(src_dir) do |image|
293
- next if /^\./ =~ image
294
- FileUtils.cp(File.join(src_dir, image), dest_dir)
295
- manifest.print "image 'jquery.ui/#{theme}/#{image}'\n"
296
- end
297
- end
298
- end
299
- end
300
- end
301
-
302
- namespace :jrails do
303
- desc 'Remove the prototype / script.aculo.us javascript files'
304
- task :scrub_default_js do
305
- files = %W[controls.js dragdrop.js effects.js prototype.js]
306
- project_dir = File.join(RAILS_ROOT, 'public', 'javascripts')
307
- files.each do |fname|
308
- FileUtils.rm File.join(project_dir, fname)
309
- end
310
- end
311
- end
1
+ require 'fileutils'
2
+ require 'lib/handle_js_files'
3
+ require 'lib/jquery.ui'
4
+
5
+ # Compass generator for jrails 0.1+
6
+ SRC_JRAILS = File.join(GEM_ROOT, 'src', 'jrails', 'jrails.1.4.2')
7
+ SRC_JRAILS_SCRIPTS = SRC_JRAILS + "/*.js"
8
+ SRC_JQUERY = File.join(GEM_ROOT, 'src', 'jrails', 'jquery.1.4.2')
9
+ SRC_JQUERY_SCRIPTS = SRC_JQUERY + "/*.js"
10
+ SRC_JQUERY_UI = File.join(GEM_ROOT, 'src', 'jrails', 'jquery.ui.1.8.5')
11
+ SRC_JQUERY_UI_SCRIPTS = File.join(SRC_JQUERY_UI, 'js') + "/*.js"
12
+ SRC_JQUERY_UI_THEMES = File.join(SRC_JQUERY_UI, 'themes')
13
+ SRC_JQUERY_UI_TRANSLATIONS = File.join(SRC_JQUERY_UI, 'js', 'i18n') #+ "/*.js"
14
+ SRC_SPARKLINES_SCRIPTS = File.join(GEM_ROOT, 'src', 'jrails', 'sparklines') + "/*.js"
15
+ SRC_JHAML_SCRIPTS = File.join(GEM_ROOT, 'src', 'jrails', 'jquery-haml') + "/*.js"
16
+ SRC_HAML_JS_SCRIPTS = File.join(GEM_ROOT, 'src', 'jrails', 'haml-js') + "/*.js"
17
+ SRC_FLASH = File.join(GEM_ROOT, 'src', 'jrails', 'flash_messages')
18
+ SRC_FLASH_IMAGES = File.join(SRC_FLASH, 'images')
19
+
20
+ DEST_JRAILS_TEMPLATES = File.join(GEM_ROOT, 'templates', 'jrails')
21
+ DEST_JRAILS_TRANSLATIONS = File.join(DEST_JRAILS_TEMPLATES, 'i18n', 'jquery.ui')
22
+ DEST_JRAILS_THEMES = File.join(DEST_JRAILS_TEMPLATES, 'jquery.ui')
23
+ DEST_JRAILS_IMAGES = File.join(DEST_JRAILS_TEMPLATES, 'jquery.ui')
24
+ DEST_FLASH_STYLESHEETS = File.join(DEST_JRAILS_TEMPLATES, 'partials')
25
+ DEST_FLASH_IMAGES = File.join(DEST_JRAILS_IMAGES, 'flash_messages')
26
+
27
+ namespace :build do
28
+ desc 'Build the stylesheets and templates for jRails.'
29
+ task :jrails do
30
+
31
+ FileUtils.remove_dir DEST_JRAILS_TEMPLATES if File.exists? DEST_JRAILS_TEMPLATES
32
+ FileUtils.mkdir_p(File.join(DEST_JRAILS_TEMPLATES, 'config', 'initializers'))
33
+ FileUtils.mkdir_p(File.join(DEST_JRAILS_THEMES))
34
+
35
+ open File.join(DEST_JRAILS_TEMPLATES, 'manifest.rb'), 'w' do |manifest|
36
+
37
+ # jRails
38
+
39
+ manifest.print JRAILS_MESSAGE1
40
+
41
+ open File.join(DEST_JRAILS_TEMPLATES, 'config', 'initializers', 'jrails.rb'), 'w' do |f|
42
+ f.print(File.read(File.join(SRC_JRAILS, 'config', 'initializers', 'jrails.rb')))
43
+ end
44
+ manifest.print "file 'config/initializers/jrails.rb'\n"
45
+
46
+ open File.join(DEST_JRAILS_TEMPLATES, 'jrails.js'), 'w' do |f|
47
+ f.print concat_files(all_files(SRC_JRAILS_SCRIPTS))
48
+ end
49
+ manifest.print "javascript 'jrails.js'\n"
50
+
51
+ open File.join(DEST_JRAILS_TEMPLATES, 'jrails.min.js'), 'w' do |f|
52
+ f.print compress_js(all_files(SRC_JRAILS_SCRIPTS), "google")
53
+ end
54
+ manifest.print "javascript 'jrails.min.js'\n"
55
+
56
+ # jQuery 1.4
57
+
58
+ open File.join(DEST_JRAILS_TEMPLATES, 'jquery-1.4.2.js'), 'w' do |f|
59
+ f.print concat_files(all_files(SRC_JQUERY_SCRIPTS))
60
+ end
61
+ manifest.print "javascript 'jquery-1.4.2.js'\n"
62
+
63
+ open File.join(DEST_JRAILS_TEMPLATES, 'jquery-1.4.2.min.js'), 'w' do |f|
64
+ f.print compress_js(all_files(SRC_JQUERY_SCRIPTS), "google")
65
+ end
66
+ manifest.print "javascript 'jquery-1.4.2.min.js'\n"
67
+
68
+ # jQuery 1.4 Compat 1.3
69
+
70
+ ['compat-1.3'].each do |path|
71
+ Dir.foreach File.join(SRC_JQUERY, path) do |file|
72
+ next unless /\.js$/ =~ file
73
+ js = File.read File.join(SRC_JQUERY, path, file)
74
+ manifest.print "javascript '#{file}'\n"
75
+ open File.join(DEST_JRAILS_TEMPLATES, file), 'w' do |f|
76
+ f.write js
77
+ end
78
+ file.gsub!(/\.js$/, '.min.js')
79
+ manifest.print "javascript '#{file}'\n"
80
+ open File.join(DEST_JRAILS_TEMPLATES, file), 'w' do |f|
81
+ f.write compress_js(js, "google")
82
+ end
83
+ end
84
+ end
85
+
86
+ # jQuery 1.4 Plugins
87
+
88
+ ['plugins'].each do |path|
89
+ Dir.foreach File.join(SRC_JQUERY, path) do |file|
90
+
91
+ if /\.css$/ =~ file
92
+ css = File.read File.join(SRC_JQUERY, path, file)
93
+ sass = ''
94
+ IO.popen("sass-convert -F css -T scss", 'r+') { |f| f.print(css); f.close_write; sass = f.read }
95
+ file.gsub!(/^jquery\./,'').gsub!(/\.css$/, '.scss')
96
+ open File.join(DEST_JRAILS_THEMES, file), 'w' do |f|
97
+ f.write sass
98
+ end
99
+ manifest.print "stylesheet 'jquery.ui/#{file}', :media => 'screen, projection'\n"
100
+ end
101
+
102
+ next unless /\.js$/ =~ file
103
+ js = File.read File.join(SRC_JQUERY, path, file)
104
+ manifest.print "javascript '#{file}'\n"
105
+ open File.join(DEST_JRAILS_TEMPLATES, file), 'w' do |f|
106
+ f.write js
107
+ end
108
+ file.gsub!(/\.js$/, '.min.js')
109
+ manifest.print "javascript '#{file}'\n"
110
+ open File.join(DEST_JRAILS_TEMPLATES, file), 'w' do |f|
111
+ f.write compress_js(js, "google")
112
+ end
113
+ end
114
+ end
115
+
116
+ Dir.foreach File.join(SRC_JQUERY, 'plugins', 'images') do |plugin|
117
+ next if /^\./ =~ plugin
118
+
119
+ # Copy the theme images directory
120
+ src_dir = File.join(SRC_JQUERY, 'plugins', 'images', plugin)
121
+ dest_dir = File.join(DEST_JRAILS_IMAGES, plugin)
122
+ FileUtils.mkdir_p dest_dir
123
+
124
+ Dir.foreach(src_dir) do |image|
125
+ next if /^\./ =~ image
126
+ FileUtils.cp(File.join(src_dir, image), dest_dir)
127
+ manifest.print "image 'jquery.ui/#{plugin}/#{image}'\n"
128
+ end
129
+ end
130
+
131
+ # jQuery.UI 1.8.5
132
+
133
+ # Scripts
134
+
135
+ all_jquery_ui_scripts = [
136
+ 'jquery-ui.js',
137
+ 'jquery.effects.blind.js',
138
+ 'jquery.effects.bounce.js',
139
+ 'jquery.effects.clip.js',
140
+ 'jquery.effects.core.js',
141
+ 'jquery.effects.drop.js',
142
+ 'jquery.effects.explode.js',
143
+ 'jquery.effects.fade.js',
144
+ 'jquery.effects.fold.js',
145
+ 'jquery.effects.highlight.js',
146
+ 'jquery.effects.pulsate.js',
147
+ 'jquery.effects.scale.js',
148
+ 'jquery.effects.shake.js',
149
+ 'jquery.effects.slide.js',
150
+ 'jquery.effects.transfer.js',
151
+ 'jquery.ui.accordion.js',
152
+ 'jquery.ui.autocomplete.js',
153
+ 'jquery.ui.button.js',
154
+ 'jquery.ui.core.js',
155
+ 'jquery.ui.datepicker.js',
156
+ 'jquery.ui.dialog.js',
157
+ 'jquery.ui.draggable.js',
158
+ 'jquery.ui.droppable.js',
159
+ 'jquery.ui.mouse.js',
160
+ 'jquery.ui.panel.js',
161
+ 'jquery.ui.position.js',
162
+ 'jquery.ui.progressbar.js',
163
+ 'jquery.ui.resizable.js',
164
+ 'jquery.ui.selectable.js',
165
+ 'jquery.ui.selectmenu.js',
166
+ 'jquery.ui.slider.js',
167
+ 'jquery.ui.sortable.js',
168
+ 'jquery.ui.tabs.js',
169
+ 'jquery.ui.widget.js'
170
+ ].collect {|filename| File.read(File.join(SRC_JQUERY_UI, 'js', filename))}.join "\n\n"
171
+
172
+ open File.join(DEST_JRAILS_TEMPLATES, 'jquery-ui-1.8.5.js'), 'w' do |f|
173
+ f.print concat_files(all_jquery_ui_scripts)
174
+ end
175
+ manifest.print "javascript 'jquery-ui-1.8.5.js'\n"
176
+
177
+ open File.join(DEST_JRAILS_TEMPLATES, 'jquery-ui-1.8.5.min.js'), 'w' do |f|
178
+ f.print compress_js(all_jquery_ui_scripts, "google")
179
+ end
180
+ manifest.print "javascript 'jquery-ui-1.8.5.min.js'\n"
181
+
182
+ # jQuery UI locales
183
+
184
+ ['i18n'].each do |path|
185
+ FileUtils.mkdir_p(DEST_JRAILS_TRANSLATIONS)
186
+ Dir.foreach SRC_JQUERY_UI_TRANSLATIONS do |file|
187
+ next unless /^jquery.ui\.datepicker-(.+)\.js$/ =~ file
188
+ lang = file
189
+ js = File.read File.join(SRC_JQUERY_UI_TRANSLATIONS, file)
190
+ file.gsub!(/^jquery.ui\./,'')
191
+ manifest.print "javascript '#{File.join(path, 'jquery.ui', file)}'\n"
192
+ open File.join(DEST_JRAILS_TRANSLATIONS, file), 'w' do |f|
193
+ f.write js
194
+ end
195
+ file.gsub!(/\.js$/, '.min.js')
196
+ manifest.print "javascript '#{File.join(path, 'jquery.ui', file)}'\n"
197
+ open File.join(DEST_JRAILS_TRANSLATIONS, file), 'w' do |f|
198
+ f.write compress_js(js, "google")
199
+ end
200
+ end
201
+ end
202
+
203
+ # jQuery UI Themes
204
+
205
+ ui = JqueryUiTheme.new(File.join(SRC_JQUERY_UI_THEMES, 'base'))
206
+ ui.convert_css(File.join(DEST_JRAILS_THEMES, '_partials'))
207
+
208
+ all_jquery_ui_stylesheets = [
209
+ '_core.scss',
210
+ '_accordion.scss',
211
+ '_autocomplete.scss',
212
+ '_button.scss',
213
+ '_datepicker.scss',
214
+ '_dialog.scss',
215
+ '_panel.scss',
216
+ '_progressbar.scss',
217
+ '_resizable.scss',
218
+ '_selectable.scss',
219
+ '_selectmenu.scss',
220
+ '_slider.scss',
221
+ '_tabs.scss',
222
+ '_theme.scss'
223
+ ].collect {|filename| File.read(File.join(DEST_JRAILS_THEMES, '_partials', filename))}.join "\n\n"
224
+
225
+ open File.join(DEST_JRAILS_THEMES, '_theme.scss'), 'w' do |f|
226
+ sass = JRAILS_MESSAGE2
227
+ f.print(all_jquery_ui_stylesheets)
228
+ f.print sass
229
+ FileUtils.rm_r(File.join(DEST_JRAILS_THEMES, '_partials'))
230
+ end
231
+
232
+ manifest.print "stylesheet 'jquery.ui/_theme.scss', :media => 'screen, projection'\n"
233
+
234
+ Dir.foreach SRC_JQUERY_UI_THEMES do |theme|
235
+ next if /^\./ =~ theme
236
+
237
+ # Convert the stylesheet
238
+ manifest.print "stylesheet 'jquery.ui/#{theme}.scss', :media => 'screen, projection'\n"
239
+ ui.convert_theme(theme, File.join(SRC_JQUERY_UI_THEMES, theme), File.join(DEST_JRAILS_THEMES))
240
+
241
+ # Copy the theme images directory
242
+ src_dir = File.join(SRC_JQUERY_UI_THEMES, theme, 'images')
243
+ dest_dir = File.join(DEST_JRAILS_IMAGES, theme)
244
+ FileUtils.mkdir_p dest_dir
245
+
246
+ Dir.foreach(src_dir) do |image|
247
+ next if /^\./ =~ image
248
+ FileUtils.cp(File.join(src_dir, image), dest_dir)
249
+ manifest.print "image 'jquery.ui/#{theme}/#{image}'\n"
250
+ end
251
+ end
252
+
253
+ # jQuery Sparklines
254
+
255
+ open File.join(DEST_JRAILS_TEMPLATES, 'jquery.sparkline.js'), 'w' do |f|
256
+ f.print concat_files(all_files(SRC_SPARKLINES_SCRIPTS))
257
+ end
258
+ manifest.print "javascript 'jquery.sparkline.js'\n"
259
+
260
+ open File.join(DEST_JRAILS_TEMPLATES, 'jquery.sparkline.min.js'), 'w' do |f|
261
+ f.print compress_js(all_files(SRC_SPARKLINES_SCRIPTS), "google")
262
+ end
263
+ manifest.print "javascript 'jquery.sparkline.min.js'\n"
264
+
265
+ # jQuery haml
266
+
267
+ open File.join(DEST_JRAILS_TEMPLATES, 'jquery.haml.js'), 'w' do |f|
268
+ f.print concat_files(all_files(SRC_JHAML_SCRIPTS))
269
+ end
270
+ manifest.print "javascript 'jquery.haml.js'\n"
271
+
272
+ open File.join(DEST_JRAILS_TEMPLATES, 'jquery.haml.min.js'), 'w' do |f|
273
+ f.print compress_js(all_files(SRC_JHAML_SCRIPTS), "google")
274
+ end
275
+ manifest.print "javascript 'jquery.haml.min.js'\n"
276
+
277
+ # HAML Js
278
+
279
+ open File.join(DEST_JRAILS_TEMPLATES, 'haml.js'), 'w' do |f|
280
+ f.print concat_files(all_files(SRC_HAML_JS_SCRIPTS))
281
+ end
282
+ manifest.print "javascript 'haml.js'\n"
283
+
284
+ open File.join(DEST_JRAILS_TEMPLATES, 'haml.min.js'), 'w' do |f|
285
+ f.print compress_js(all_files(SRC_JHAML_SCRIPTS), "google")
286
+ end
287
+ manifest.print "javascript 'haml.min.js'\n"
288
+
289
+ #Flash Messages
290
+ FileUtils.mkdir_p(File.join(DEST_FLASH_STYLESHEETS))
291
+ css = File.read File.join(SRC_FLASH, 'flash_messages.css')
292
+ sass = ''
293
+ IO.popen("sass-convert -F css -T scss", 'r+') { |f| f.print(css); f.close_write; sass = f.read }
294
+ open File.join(DEST_FLASH_STYLESHEETS, '_flash_messages.scss'), 'w' do |f|
295
+ f.write sass
296
+ end
297
+ manifest.print "stylesheet 'partials/_flash_messages.scss', :media => 'screen, projection'\n"
298
+
299
+ # Copy the images directory
300
+ FileUtils.mkdir_p File.join(DEST_FLASH_IMAGES)
301
+ src_dir = SRC_FLASH_IMAGES
302
+ dest_dir = DEST_FLASH_IMAGES
303
+
304
+ Dir.foreach(src_dir) do |image|
305
+ next unless /\.png$/ =~ image
306
+ FileUtils.cp(File.join(src_dir, image), dest_dir)
307
+ manifest.print "image 'jquery.ui/flash_messages/#{image}'\n"
308
+ end
309
+ end
310
+ end
311
+ end
312
+
313
+ namespace :jrails do
314
+ desc 'Remove the prototype / script.aculo.us javascript files'
315
+ task :scrub_default_js do
316
+ files = %W[controls.js dragdrop.js effects.js prototype.js]
317
+ project_dir = File.join(RAILS_ROOT, 'public', 'javascripts')
318
+ files.each do |fname|
319
+ FileUtils.rm File.join(project_dir, fname)
320
+ end
321
+ end
322
+ end
312
323