ymdp 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -67,7 +67,11 @@ module YMDP
67
67
  # <script src='http://www.myserver.com/javascripts/application.js' type='text/javascript
68
68
  # charset='utf-8'></script>
69
69
  #
70
- def javascript_include(filename)
70
+ def javascript_include(filename, options={})
71
+ if filename == :defaults
72
+ render_default_javascripts(options)
73
+ filename = "defaults.js"
74
+ end
71
75
  unless filename =~ /^http/
72
76
  filename = "#{@assets_directory}/javascripts/#{filename}"
73
77
  end
@@ -192,7 +196,7 @@ module YMDP
192
196
  #
193
197
  def render_html_partial(params)
194
198
  output = []
195
-
199
+
196
200
  if params[:partial]
197
201
  params[:partial].to_a.each do |partial|
198
202
  output << render_partial(partial)
@@ -246,6 +250,32 @@ module YMDP
246
250
  path
247
251
  end
248
252
 
253
+ def render_default_javascripts(options={})
254
+ default_javascripts = ['application', 'params', 'browser', 'data', 'ajax', 'user', 'init', 'reporter', 'debug', 'tag_helper', 'launcher', 'logger', 'i18n', 'flash', 'ab_testing', 'education']
255
+
256
+ filenames = default_javascripts.map do |filename|
257
+ File.join(File.dirname(__FILE__), "..", "javascripts", "#{filename}.js")
258
+ end
259
+
260
+ filenames = filter_filenames(filenames, options)
261
+ output = combine_files(filenames)
262
+ write_javascript_asset(output, "defaults")
263
+ end
264
+
265
+ def filter_filenames(filenames, options={})
266
+ if options[:only]
267
+ filenames = filenames.select do |filename|
268
+ filename =~ /\/#{filename}.js/
269
+ end
270
+ end
271
+ if options[:except]
272
+ filenames = filenames.reject do |filename|
273
+ filename =~ /\/#{filename}.js/
274
+ end
275
+ end
276
+ filenames
277
+ end
278
+
249
279
  def render_javascript_partial(params)
250
280
  filename = params[:filename] || params[:javascript].to_a.join("_")
251
281
 
@@ -300,7 +330,7 @@ module YMDP
300
330
  # Renders a JavaScript partial.
301
331
  #
302
332
  def render_javascripts(filenames, combined_filename=nil)
303
- filenames_str = combined_filename || filenames.join()
333
+ filenames_str = combined_filename || filenames.join().gsub("/", "_")
304
334
 
305
335
  filenames.map! do |filename|
306
336
  filename.gsub!(/\.js$/, "")
@@ -352,7 +382,7 @@ module YMDP
352
382
  # Renders a JavaScript partial.
353
383
  #
354
384
  def render_stylesheets(filenames, combined_filename=nil)
355
- filenames_str = combined_filename || filenames.join()
385
+ filenames_str = combined_filename || filenames.join().gsub("/", "_")
356
386
  tmp_filename = "#{TMP_PATH}/#{filenames_str}.css"
357
387
 
358
388
  filenames.map! do |filename|
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ymdp}
8
- s.version = "0.3.1"
8
+ s.version = "0.4.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jeff Coleman"]
12
- s.date = %q{2011-03-11}
12
+ s.date = %q{2011-04-03}
13
13
  s.description = %q{Framework for developing applications in the Yahoo! Mail Development Platform.}
14
14
  s.email = %q{progressions@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -53,6 +53,23 @@ Gem::Specification.new do |s|
53
53
  "lib/ymdp/generator/templates/stylesheet.css",
54
54
  "lib/ymdp/generator/templates/translation.pres",
55
55
  "lib/ymdp/generator/templates/view.html.haml",
56
+ "lib/ymdp/javascripts/ab_testing.js",
57
+ "lib/ymdp/javascripts/ajax.js",
58
+ "lib/ymdp/javascripts/application.js",
59
+ "lib/ymdp/javascripts/browser.js",
60
+ "lib/ymdp/javascripts/data.js",
61
+ "lib/ymdp/javascripts/debug.js",
62
+ "lib/ymdp/javascripts/education.js",
63
+ "lib/ymdp/javascripts/flash.js",
64
+ "lib/ymdp/javascripts/help.js",
65
+ "lib/ymdp/javascripts/i18n.js",
66
+ "lib/ymdp/javascripts/init.js",
67
+ "lib/ymdp/javascripts/launcher.js",
68
+ "lib/ymdp/javascripts/logger.js",
69
+ "lib/ymdp/javascripts/params.js",
70
+ "lib/ymdp/javascripts/reporter.js",
71
+ "lib/ymdp/javascripts/tag_helper.js",
72
+ "lib/ymdp/javascripts/user.js",
56
73
  "lib/ymdp/tasks/build.rake",
57
74
  "lib/ymdp/tasks/keys.rake",
58
75
  "lib/ymdp/tasks/ymdp.rake",
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ymdp
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 3
9
- - 1
10
- version: 0.3.1
8
+ - 4
9
+ - 0
10
+ version: 0.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jeff Coleman
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-11 00:00:00 -06:00
18
+ date: 2011-04-03 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -614,6 +614,23 @@ files:
614
614
  - lib/ymdp/generator/templates/stylesheet.css
615
615
  - lib/ymdp/generator/templates/translation.pres
616
616
  - lib/ymdp/generator/templates/view.html.haml
617
+ - lib/ymdp/javascripts/ab_testing.js
618
+ - lib/ymdp/javascripts/ajax.js
619
+ - lib/ymdp/javascripts/application.js
620
+ - lib/ymdp/javascripts/browser.js
621
+ - lib/ymdp/javascripts/data.js
622
+ - lib/ymdp/javascripts/debug.js
623
+ - lib/ymdp/javascripts/education.js
624
+ - lib/ymdp/javascripts/flash.js
625
+ - lib/ymdp/javascripts/help.js
626
+ - lib/ymdp/javascripts/i18n.js
627
+ - lib/ymdp/javascripts/init.js
628
+ - lib/ymdp/javascripts/launcher.js
629
+ - lib/ymdp/javascripts/logger.js
630
+ - lib/ymdp/javascripts/params.js
631
+ - lib/ymdp/javascripts/reporter.js
632
+ - lib/ymdp/javascripts/tag_helper.js
633
+ - lib/ymdp/javascripts/user.js
617
634
  - lib/ymdp/tasks/build.rake
618
635
  - lib/ymdp/tasks/keys.rake
619
636
  - lib/ymdp/tasks/ymdp.rake