shared_mustache 0.2.0 → 0.2.1

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.
data/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # 0.2.1
2
+
3
+ * Remove `typeof exports` check in Hogan libraries: https://github.com/alphagov/shared_mustache/pull/8.
4
+
5
+ # 0.2.0
6
+
7
+ * shared_mustache no longer ships with a blank template.js file. Any apps using shared_mustache will now need to ensure they have their own template.js and that it is checked in to the source.
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 HM Government
1
+ Copyright (c) 2013 Crown Copyright (Government Digital Service)
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -13,10 +13,8 @@ module SharedMustache
13
13
  end
14
14
 
15
15
  def self.hogan_source
16
- hogan_path = File.expand_path('../../vendor/assets/javascripts/hogan-2.0.0.js', File.dirname(__FILE__))
16
+ hogan_path = File.expand_path('../../vendor/assets/javascripts/hogan-2.0.0-hotfix.js', File.dirname(__FILE__))
17
17
  File.read(hogan_path)
18
18
  end
19
19
  end
20
20
  end
21
-
22
-
@@ -1,7 +1,13 @@
1
1
  require 'mustache'
2
2
 
3
3
  class MustacheView < Mustache
4
+
5
+ def initialize
6
+ super
7
+ @partial_cache = {}
8
+ end
9
+
4
10
  def partial(name)
5
- File.read("#{template_path}/#{name}.#{template_extension}")
11
+ @partial_cache[name] ||= File.read("#{template_path}/#{name}.#{template_extension}")
6
12
  end
7
13
  end
@@ -1,3 +1,3 @@
1
1
  module SharedMustache
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -8,7 +8,7 @@ module SharedMustache
8
8
  script_tags = file_list.map do |file|
9
9
  content_tag(:script, File.read(file), id: SharedMustache.file_name_to_id(file), type: 'text/mustache')
10
10
  end
11
- script_tags << javascript_include_tag("hogan-2.0.0.js")
11
+ script_tags << javascript_include_tag("hogan-2.0.0-hotfix.js")
12
12
  script_tags.join('').html_safe
13
13
  end
14
14
 
@@ -1,3 +1,9 @@
1
+ /* Modified to remove `typeof exports` check on final line.
2
+ * Sometimes the `exports` global variable is present through a quirk of dynamically
3
+ * generated heading IDs which the browser makes accessible through the window namespace.
4
+ * eg <h2 id="exports">Exports</h2> becomes `window.exports` and typeof exports is no
5
+ * longer undefined. */
6
+
1
7
  /*
2
8
  * Copyright 2011 Twitter, Inc.
3
9
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -572,5 +578,4 @@ var Hogan = {};
572
578
  t = this.generate(this.parse(this.scan(text, options.delimiters), text, options), text, options);
573
579
  return this.cache[key] = t;
574
580
  };
575
- })(typeof exports !== 'undefined' ? exports : Hogan);
576
-
581
+ })(Hogan);
@@ -1,3 +1,9 @@
1
+ /* Modified to remove `typeof exports` check on final line.
2
+ * Sometimes the `exports` global variable is present through a quirk of dynamically
3
+ * generated heading IDs which the browser makes accessible through the window namespace.
4
+ * eg <h2 id="exports">Exports</h2> becomes `window.exports` and typeof exports is no
5
+ * longer undefined. */
6
+
1
7
  /*
2
8
  * Copyright 2011 Twitter, Inc.
3
9
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -239,5 +245,4 @@ if(typeof window.Hogan === 'undefined'){
239
245
  return Object.prototype.toString.call(a) === '[object Array]';
240
246
  };
241
247
 
242
- })(typeof exports !== 'undefined' ? exports : Hogan);
243
-
248
+ })(Hogan);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shared_mustache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-01-29 00:00:00.000000000 Z
12
+ date: 2015-05-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mustache
16
- requirement: &9019840 !ruby/object:Gem::Requirement
16
+ requirement: &23677700 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.99.4
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *9019840
24
+ version_requirements: *23677700
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: execjs
27
- requirement: &9019260 !ruby/object:Gem::Requirement
27
+ requirement: &23676920 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.2.4
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *9019260
35
+ version_requirements: *23676920
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: gem_publisher
38
- requirement: &9018780 !ruby/object:Gem::Requirement
38
+ requirement: &23676460 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: 1.1.1
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *9018780
46
+ version_requirements: *23676460
47
47
  description: Share mustache between Rails templates and the browser (using compiled
48
48
  hogan.js templates).
49
49
  email:
@@ -53,6 +53,7 @@ extensions: []
53
53
  extra_rdoc_files: []
54
54
  files:
55
55
  - .gitignore
56
+ - CHANGELOG.md
56
57
  - Gemfile
57
58
  - LICENSE.txt
58
59
  - README.md
@@ -68,10 +69,10 @@ files:
68
69
  - lib/shared_mustache/view_helpers.rb
69
70
  - lib/tasks/shared_mustache.rake
70
71
  - shared_mustache.gemspec
71
- - vendor/assets/javascripts/hogan-2.0.0.js
72
+ - vendor/assets/javascripts/hogan-2.0.0-hotfix.js
72
73
  - vendor/assets/javascripts/shared_mustache.js
73
74
  - vendor/assets/javascripts/shared_mustache/mustache-loader.js
74
- - vendor/assets/javascripts/shared_mustache/template-2.0.0.js
75
+ - vendor/assets/javascripts/shared_mustache/template-2.0.0-hotfix.js
75
76
  homepage: ''
76
77
  licenses: []
77
78
  post_install_message:
@@ -86,7 +87,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
86
87
  version: '0'
87
88
  segments:
88
89
  - 0
89
- hash: -3854426233594066840
90
+ hash: -4224337685634070782
90
91
  required_rubygems_version: !ruby/object:Gem::Requirement
91
92
  none: false
92
93
  requirements:
@@ -95,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
96
  version: '0'
96
97
  segments:
97
98
  - 0
98
- hash: -3854426233594066840
99
+ hash: -4224337685634070782
99
100
  requirements: []
100
101
  rubyforge_project:
101
102
  rubygems_version: 1.8.11