stitch_rails 0.0.4 → 0.0.5

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.5
@@ -0,0 +1,59 @@
1
+ require 'tilt'
2
+
3
+ module Stitch
4
+ class CoffeeScriptTemplate < Tilt::Template
5
+ self.default_mime_type = 'application/javascript'
6
+
7
+ @@default_bare = false
8
+
9
+ def self.default_bare
10
+ @@default_bare
11
+ end
12
+
13
+ def self.default_bare=(value)
14
+ @@default_bare = value
15
+ end
16
+
17
+ @@excludes = []
18
+
19
+ def self.engine_initialized?
20
+ defined? ::CoffeeScript
21
+ end
22
+
23
+ def self.excludes=(excludes)
24
+ @@excludes = excludes
25
+ end
26
+
27
+ def initialize_engine
28
+ require_template_library 'coffee_script'
29
+ end
30
+
31
+ def prepare
32
+ if !options.key?(:bare)
33
+ options[:bare] = self.class.default_bare
34
+ end
35
+ end
36
+
37
+ def evaluate(scope, locals, &block)
38
+ name = module_name(scope)
39
+ if (name == 'stitch_rails') || @@excludes.include?(name)
40
+ @output ||= CoffeeScript.compile(data, options)
41
+ else
42
+ @output ||= <<JS
43
+ require.define({
44
+ '#{name}': function(exports, require, module) {
45
+ #{CoffeeScript.compile(data, options.merge(:bare => true))}
46
+ }
47
+ });
48
+ JS
49
+ end
50
+ end
51
+
52
+ private
53
+ # this might need to be customisable to generate the desired module names
54
+ # this implementation lops off the first segment of the path
55
+ def module_name(scope)
56
+ scope.logical_path
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,13 @@
1
+ require 'stitch/coffee_script_template'
2
+
3
+ module Stitch
4
+ class Railtie < ::Rails::Engine
5
+ config.before_configuration do
6
+ config.stitch = ::Stitch::CoffeeScriptTemplate
7
+ end
8
+
9
+ initializer 'stitch.configure_rails_initialization' do |app|
10
+ app.assets.register_engine '.coffee', ::Stitch::CoffeeScriptTemplate
11
+ end
12
+ end
13
+ end
@@ -1,69 +1 @@
1
- require 'tilt'
2
-
3
- module Stitch
4
- class StitchyCoffeeScriptTemplate < Tilt::Template
5
- self.default_mime_type = 'application/javascript'
6
-
7
- @@default_bare = false
8
-
9
- def self.default_bare
10
- @@default_bare
11
- end
12
-
13
- def self.default_bare=(value)
14
- @@default_bare = value
15
- end
16
-
17
- @@excludes = []
18
-
19
- def self.engine_initialized?
20
- defined? ::CoffeeScript
21
- end
22
-
23
- def self.excludes=(excludes)
24
- @@excludes = excludes
25
- end
26
-
27
- def initialize_engine
28
- require_template_library 'coffee_script'
29
- end
30
-
31
- def prepare
32
- if !options.key?(:bare)
33
- options[:bare] = self.class.default_bare
34
- end
35
- end
36
-
37
- def evaluate(scope, locals, &block)
38
- name = module_name(scope)
39
- if (name == 'stitch_rails') || @@excludes.include?(name)
40
- @output ||= CoffeeScript.compile(data, options)
41
- else
42
- @output ||= <<JS
43
- require.define({
44
- '#{name}': function(exports, require, module) {
45
- #{CoffeeScript.compile(data, options.merge(:bare => true))}
46
- }
47
- });
48
- JS
49
- end
50
- end
51
-
52
- private
53
- # this might need to be customisable to generate the desired module names
54
- # this implementation lops off the first segment of the path
55
- def module_name(scope)
56
- scope.logical_path
57
- end
58
- end
59
-
60
- class Railtie < ::Rails::Engine
61
- config.before_configuration do
62
- config.stitch = StitchyCoffeeScriptTemplate
63
- end
64
-
65
- initializer 'stitch.configure_rails_initialization' do |app|
66
- app.assets.register_engine '.coffee', StitchyCoffeeScriptTemplate
67
- end
68
- end
69
- end
1
+ require 'stitch/railtie'
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "stitch_rails"
8
- s.version = "0.0.4"
8
+ s.version = "0.0.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ian Yang"]
12
- s.date = "2012-02-27"
12
+ s.date = "2012-03-08"
13
13
  s.description = "coffee CommonJS"
14
14
  s.email = "me@iany.me"
15
15
  s.extra_rdoc_files = [
@@ -24,6 +24,8 @@ Gem::Specification.new do |s|
24
24
  "Rakefile",
25
25
  "VERSION",
26
26
  "lib/assets/javascripts/stitch_rails.js.coffee",
27
+ "lib/stitch/coffee_script_template.rb",
28
+ "lib/stitch/railtie.rb",
27
29
  "lib/stitch_rails.rb",
28
30
  "stitch_rails.gemspec"
29
31
  ]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stitch_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
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: 2012-02-27 00:00:00.000000000 Z
12
+ date: 2012-03-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: tilt
16
- requirement: &8527160 !ruby/object:Gem::Requirement
16
+ requirement: &16121180 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *8527160
24
+ version_requirements: *16121180
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bundler
27
- requirement: &8526680 !ruby/object:Gem::Requirement
27
+ requirement: &16120700 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.0.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *8526680
35
+ version_requirements: *16120700
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: jeweler
38
- requirement: &8526200 !ruby/object:Gem::Requirement
38
+ requirement: &16119900 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: 1.8.3
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *8526200
46
+ version_requirements: *16119900
47
47
  description: coffee CommonJS
48
48
  email: me@iany.me
49
49
  executables: []
@@ -59,6 +59,8 @@ files:
59
59
  - Rakefile
60
60
  - VERSION
61
61
  - lib/assets/javascripts/stitch_rails.js.coffee
62
+ - lib/stitch/coffee_script_template.rb
63
+ - lib/stitch/railtie.rb
62
64
  - lib/stitch_rails.rb
63
65
  - stitch_rails.gemspec
64
66
  homepage: http://github.com/doitian/stitch_rails
@@ -76,7 +78,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
76
78
  version: '0'
77
79
  segments:
78
80
  - 0
79
- hash: -1438919120205210059
81
+ hash: -1287820883361062371
80
82
  required_rubygems_version: !ruby/object:Gem::Requirement
81
83
  none: false
82
84
  requirements: