ember_script 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -7,4 +7,4 @@ before_install:
7
7
  - sudo apt-get update
8
8
  - sudo apt-get -y install nodejs npm
9
9
  - sudo npm install -g 'git://github.com/ghempton/ember-script.git#HEAD'
10
- script: "rspec"
10
+ script: "bundle exec rspec"
data/Gemfile.lock CHANGED
@@ -1,13 +1,19 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ember_script (0.0.3)
4
+ ember_script (0.0.4)
5
+ ember_script-source (>= 0.0.2)
6
+ execjs
5
7
  tilt
6
8
 
7
9
  GEM
8
10
  remote: http://rubygems.org/
9
11
  specs:
10
12
  diff-lcs (1.1.3)
13
+ ember_script-source (0.0.2)
14
+ execjs (1.4.0)
15
+ multi_json (~> 1.0)
16
+ multi_json (1.7.2)
11
17
  rspec (2.12.0)
12
18
  rspec-core (~> 2.12.0)
13
19
  rspec-expectations (~> 2.12.0)
@@ -16,7 +22,7 @@ GEM
16
22
  rspec-expectations (2.12.0)
17
23
  diff-lcs (~> 1.1.3)
18
24
  rspec-mocks (2.12.0)
19
- tilt (1.3.3)
25
+ tilt (1.3.6)
20
26
 
21
27
  PLATFORMS
22
28
  ruby
data/README.md CHANGED
@@ -6,24 +6,8 @@ Provides a lightweight ruby wrapper around [EmberScript](https://github.com/ghem
6
6
 
7
7
  ## Installation
8
8
 
9
- This gem requires that an `ember-script` command be available in the current path. Being as EmberScript is still in early development, it is best to install via npm from git. After installing [Node.js](http://nodejs.org/), run the following command:
10
-
11
- ```
12
- sudo npm install -g 'git://github.com/ghempton/ember-script.git#HEAD'
13
- ```
14
-
15
- ## Rails Integration
16
-
17
- After following the installation instructions above, simply add the following to your gemfile:
18
-
19
- ```
20
- gem 'ember_script-rails'
21
- ```
22
-
23
- ## Plain Ruby
24
-
25
9
  ```
26
- gem 'ember_script'
10
+ gem install ember_script
27
11
  ```
28
12
 
29
13
  ## Contributing to EmberScript-Ruby
data/ember_script.gemspec CHANGED
@@ -17,6 +17,8 @@ Gem::Specification.new do |gem|
17
17
  gem.require_paths = ["lib"]
18
18
 
19
19
  gem.add_dependency "tilt"
20
+ gem.add_dependency "execjs"
21
+ gem.add_dependency "ember_script-source", ">= 0.0.2"
20
22
 
21
23
  gem.add_development_dependency "rspec"
22
24
  end
@@ -1,3 +1,3 @@
1
1
  module EmberScript
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/ember_script.rb CHANGED
@@ -1,24 +1,33 @@
1
1
  # encoding: utf-8
2
2
 
3
+ require 'execjs'
3
4
  require 'tilt'
4
- require 'open3'
5
5
 
6
+ require 'ember_script/source'
6
7
  require 'ember_script/version'
7
8
 
8
9
  module EmberScript
9
10
 
10
- class << self
11
- def engine
11
+ module Source
12
+ def self.path
13
+ @path ||= ENV['EMBERSCRIPT_SOURCE_PATH'] || bundled_path
12
14
  end
13
15
 
14
- def engine=(engine)
16
+ def self.contents
17
+ @contents ||= File.read(path)
15
18
  end
16
19
 
17
- def version
18
- `ember-script -v`
20
+ def self.version
21
+ Source.context.eval("EmberScript.VERSION")
19
22
  end
20
23
 
21
- # Compile a EmberScript file to JavaScript
24
+ def self.context
25
+ @context ||= ExecJS.compile(contents)
26
+ end
27
+ end
28
+
29
+ class << self
30
+ # Compile an EmberScript file to JavaScript
22
31
  # or generate the source maps.
23
32
  #
24
33
  # @param [String,#read] the source string or IO
@@ -37,7 +46,7 @@ module EmberScript
37
46
  end
38
47
  bare = options[:bare] ? "--bare" : ""
39
48
 
40
- Open3.capture3("ember-script --js #{bare}", :stdin_data=>script)[0]
49
+ Source.context.call("EmberScript.em2js", script, options)
41
50
  end
42
51
  end
43
52
 
@@ -20,6 +20,10 @@ eos
20
20
  result.should =~ /property/
21
21
  end
22
22
 
23
+ it 'should output version' do
24
+ EmberScript::Source.version.should_not be_empty
25
+ end
26
+
23
27
  describe EmberScript::EmberScriptTemplate do
24
28
 
25
29
  # Ensure default_bare has its default value.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ember_script
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-26 00:00:00.000000000 Z
12
+ date: 2013-03-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: tilt
@@ -27,6 +27,38 @@ dependencies:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: execjs
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: ember_script-source
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: 0.0.2
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 0.0.2
30
62
  - !ruby/object:Gem::Dependency
31
63
  name: rspec
32
64
  requirement: !ruby/object:Gem::Requirement