sprockets-illusionist 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7d686729c107a708076b8f9ade61d30477e4269a
4
- data.tar.gz: 552271821ffa535d551da195fb841cb068b9c1b8
3
+ metadata.gz: 171987302d4fbf78eedcd397cb70d687da9af4ce
4
+ data.tar.gz: 9887933990182998b6b90abc45ceafab683d63d6
5
5
  SHA512:
6
- metadata.gz: 8b2da32a23f87e767bf570f77d20bf0a5270f7058863674ad86e027c2a5bcef2955f1eb8cb3abacbc000d2d581ef91ec21268af92d354f228f0d4f82d95f6921
7
- data.tar.gz: c5968a9e94ad652ac30d3732b80f4626d0bed6b2766968e9397c4eceba3ebbc050e5af8ba2ed4c87fc65642fd76209531754596967475876e1e36d2ca7e3cc48
6
+ metadata.gz: aa841fa874664c7d16a3771523fc97dcc4a0d43692475cb5839e4334603b818867d355e8a2bff0a2be914248d871aabc646256c36ce929360c8633bd289c6883
7
+ data.tar.gz: 592b00fe9038ec624cd578dd47886333d169ee299fb5560e273d3a62a8d36c58c704640c1e45b114aa6e11ed187e688f6fda0c3d18b95e92f17f3273f8125e04
data/README.md CHANGED
@@ -35,6 +35,10 @@ Create an initializer:
35
35
  ```ruby
36
36
  SprocketsIllusionist::Config.configure do |config|
37
37
  config.base_path = Rails.root.join('app', 'assets', 'javascripts')
38
+
39
+ # You can also choose which module format you want.
40
+ # 'amd' is the default, other options are: 'cjs' and 'globals'
41
+ config.module_type = 'amd'
38
42
  end
39
43
  ```
40
44
 
@@ -61,6 +65,6 @@ See the [`LICENSE.md`](https://github.com/mirego/sprockets-illusionist/blob/mast
61
65
 
62
66
  ## About Mirego
63
67
 
64
- Mirego is a team of passionate people who believe that work is a place where you can innovate and have fun. We proudly build mobile applications for [iPhone](http://mirego.com/en/iphone-app-development/ "iPhone application development"), [iPad](http://mirego.com/en/ipad-app-development/ "iPad application development"), [Android](http://mirego.com/en/android-app-development/ "Android application development"), [Blackberry](http://mirego.com/en/blackberry-app-development/ "Blackberry application development"), [Windows Phone](http://mirego.com/en/windows-phone-app-development/ "Windows Phone application development") and [Windows 8](http://mirego.com/en/windows-8-app-development/ "Windows 8 application development") in beautiful Quebec City.
68
+ [Mirego](http://mirego.com) is a team of passionate people who believe that work is a place where you can innovate and have fun. We're a team of [talented people](http://life.mirego.com) who imagine and build beautiful Web and mobile applications. We come together to share ideas and [change the world](http://mirego.org).
65
69
 
66
- We also love [open-source software](http://open.mirego.com/) and we try to extract as much code as possible from our projects to give back to the community.
70
+ We also [love open-source software](http://open.mirego.com) and we try to give back to the community as much as we can.
@@ -2,6 +2,7 @@ module SprocketsIllusionist
2
2
  module Config
3
3
  class << self
4
4
  attr_accessor :base_path
5
+ attr_accessor :module_type
5
6
  end
6
7
 
7
8
  def self.configure
@@ -6,6 +6,16 @@ module SprocketsIllusionist
6
6
  class IllusionistTemplate < Tilt::Template
7
7
  self.default_mime_type = 'application/javascript'
8
8
 
9
+ def prepare
10
+ end
11
+
12
+ def evaluate(scope, locals, &block)
13
+ stdout, _stderr, _status = Open3.capture3("illusionist #{option_string_from_config}", stdin_data: data)
14
+ stdout
15
+ end
16
+
17
+ private
18
+
9
19
  def amd_module_name
10
20
  base_path = SprocketsIllusionist::Config.base_path
11
21
  file_name = File.basename(file, '.js.es6')
@@ -24,12 +34,15 @@ module SprocketsIllusionist
24
34
  end
25
35
  end
26
36
 
27
- def prepare
28
- end
37
+ def option_string_from_config
38
+ module_type = SprocketsIllusionist::Config.try(:module_type)
39
+ options = ["-m #{amd_module_name}"]
29
40
 
30
- def evaluate(scope, locals, &block)
31
- stdout, _stderr, _status = Open3.capture3("illusionist -p -m #{amd_module_name}", stdin_data: data)
32
- stdout
41
+ if (!module_type.nil? && %w(amd cjs globals).include?(module_type))
42
+ options << "-M #{module_type}"
43
+ end
44
+
45
+ options.join(' ')
33
46
  end
34
47
  end
35
48
  end
@@ -1,3 +1,3 @@
1
1
  module SprocketsIllusionist
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprockets-illusionist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charles Demers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-24 00:00:00.000000000 Z
11
+ date: 2014-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler