haxe-rails 0.1.1 → 0.1.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: a3064f3dc4f85c15aa1053af4eb48a9ebe5ba1c6
4
- data.tar.gz: 2cbf92b4d3db1a17f893a70898bc7db0c58b579d
3
+ metadata.gz: 821faecc9b1be59847124822ac9224fc3b4d5e85
4
+ data.tar.gz: 677ddf6bcb9222084499dccbf10e0d73bbd91b25
5
5
  SHA512:
6
- metadata.gz: fdbd79409818ce36500c581f27e0557c292f43b430717cb182636bc2ccf42d0a3901f04ec00631a7b7852784975c017813f0410c5983974e88e18f4aba767210
7
- data.tar.gz: 6ad259c7aaf47660536d09dd2a5e263e52922226091a3ce21b10b95ef61111f34471c0f8b2baa797e53c91fffbc458d85a41c449d4d899a7153b670b5a6cd5ba
6
+ metadata.gz: b8666d332bbcd33016f4636fbe1eceb031905628c12fd51668a846fb0d76f7412ed95884e396ad07e6c49bcbd8f51e90412be704db6e65e4dbe5bfb4856b62e3
7
+ data.tar.gz: e90b0e4e87132745bcb97ca9fd0570f9e81f6eb8f333b23ded3be7e437bacbb3e711e0017d4346db03142a9073e775841daae62b9476e5167ddd78d71f52bcf2
data/README.md ADDED
@@ -0,0 +1,56 @@
1
+ # HaxeRails
2
+
3
+ [![wercker status](https://app.wercker.com/status/eef2f567ea674b9df30a472759d85b16/s/master "wercker status")](https://app.wercker.com/project/bykey/eef2f567ea674b9df30a472759d85b16)
4
+ [![Test Coverage](https://codeclimate.com/github/k-motoyan/haxe-rails/badges/coverage.svg)](https://codeclimate.com/github/k-motoyan/haxe-rails/coverage)
5
+ [![Code Climate](https://codeclimate.com/github/k-motoyan/haxe-rails/badges/gpa.svg)](https://codeclimate.com/github/k-motoyan/haxe-rails)
6
+
7
+ Haxe adapter for the Rails asset pipeline.
8
+
9
+ ## Installation
10
+
11
+ Add the gem to Gemfile.
12
+
13
+ ```
14
+ gem 'haxe-rails'
15
+ ```
16
+
17
+ Run `bundle install`.
18
+
19
+ ## Usage
20
+
21
+ 1 Create haxe project under the `app/assets/javascript`.
22
+
23
+ ```
24
+ rails_project/
25
+ app/
26
+ assets/
27
+ javascripts/
28
+ haxe_project
29
+ ```
30
+
31
+ 2 Create `hxml` file under the haxe project directory.
32
+
33
+ ```diff
34
+ rails_project/
35
+ app/
36
+ assets/
37
+ javascripts/
38
+ haxe_project
39
+ + compile.hxml
40
+ ```
41
+
42
+ > haxe-rails compiles using hxml file.
43
+
44
+ 3 Add a postscript to hxml path in under the assets/*.js file.
45
+
46
+ ```diff
47
+ + //= require haxe_project/compile
48
+ ```
49
+
50
+ Or Add a postscript to a hxml file path in `Rails.application.config.assets.precompile` of the `config/initizlizers/assets.rb`.
51
+
52
+ ```rb
53
+ Rails.application.config.assets.precompile += %w( haxe_project/compile.js )
54
+ ```
55
+
56
+ > It is necessary for the extension of hxml file to make `.js`.
@@ -4,9 +4,7 @@ module Haxe
4
4
  module Rails
5
5
  class Railtie < ::Rails::Railtie
6
6
  config.before_initialize do |app|
7
- if ::Rails::VERSION::MAJOR >= 4 || app.config.assets.enabled
8
- Sprockets.register_engine '.hxml', ::Haxe::Rails::Template
9
- end
7
+ Sprockets.register_engine '.hxml', ::Haxe::Rails::Template
10
8
  end
11
9
  end
12
10
  end
@@ -1,5 +1,5 @@
1
1
  module Haxe
2
2
  module Rails
3
- VERSION = '0.1.1'
3
+ VERSION = '0.1.2'
4
4
  end
5
5
  end
@@ -0,0 +1,13 @@
1
+ package ;
2
+
3
+ class Main {
4
+
5
+ static function put(str:String): Void {
6
+ trace(str);
7
+ }
8
+
9
+ static function main() {
10
+ put(100);
11
+ }
12
+
13
+ }
@@ -0,0 +1,2 @@
1
+ -js main.js
2
+ -mian Main
@@ -0,0 +1,5 @@
1
+ package ;
2
+
3
+ class Main {
4
+ public function new() {}
5
+ }
@@ -0,0 +1,2 @@
1
+ -python main.py
2
+ Main
@@ -0,0 +1,5 @@
1
+ package ;
2
+
3
+ class Main {
4
+ public function new() {}
5
+ }
@@ -0,0 +1,2 @@
1
+ -js main.js
2
+ Main
@@ -0,0 +1,30 @@
1
+ require 'pathname'
2
+ require 'haxe/rails/compiler'
3
+
4
+ describe Haxe::Rails::Compiler do
5
+ let(:hxml_path) do
6
+ File.expand_path 'spec/fixtures/haxe_projects/will_compile/compile.hxml'
7
+ end
8
+ let(:hxml_src) { Pathname(hxml_path).read }
9
+
10
+ describe 'compile' do
11
+ context 'compile success' do
12
+ before { @output = Haxe::Rails::Compiler.compile(hxml_path, hxml_src) }
13
+ it { expect(@output).not_to be_empty }
14
+ end
15
+
16
+ context 'compile failed' do
17
+ let(:hxml_path) do
18
+ File.expand_path 'spec/fixtures/haxe_projects/fail_compile/compile.hxml'
19
+ end
20
+ it { expect{Haxe::Rails::Compiler.compile(hxml_path, hxml_src)}.to raise_error(Haxe::Rails::Error::HaxeCompileError) }
21
+ end
22
+
23
+ context 'unexpected compile target' do
24
+ let(:hxml_path) do
25
+ File.expand_path 'spec/fixtures/haxe_projects/target_python/compile.hxml'
26
+ end
27
+ it { expect{Haxe::Rails::Compiler.compile(hxml_path, hxml_src)}.to raise_error(Haxe::Rails::Error::HxmlOutputTargetError) }
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,33 @@
1
+ describe Haxe::Rails::Template do
2
+ let(:hxml_path) do
3
+ File.expand_path 'spec/fixtures/haxe_projects/will_compile/compile.hxml'
4
+ end
5
+
6
+ before do
7
+ @template = Haxe::Rails::Template.new(hxml_path)
8
+ end
9
+
10
+ describe 'instance property' do
11
+ describe 'prepare' do
12
+ it { expect(@template.prepare).to be_nil }
13
+ end
14
+
15
+ describe 'evaluate' do
16
+ it { expect(@template.evaluate(nil, nil)).not_to be_empty }
17
+ end
18
+
19
+ describe 'allows_script?' do
20
+ it { expect(@template.allows_script?).to be_falsey }
21
+ end
22
+ end
23
+
24
+ describe 'static property' do
25
+ describe 'default_mime_type' do
26
+ it { expect(Haxe::Rails::Template::default_mime_type).to eq 'application/javascript' }
27
+ end
28
+
29
+ describe 'engine_initialized?' do
30
+ it { expect(Haxe::Rails::Template.engine_initialized?).to eq 'constant' }
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,5 @@
1
+ describe Haxe::Rails do
2
+ describe 'Version' do
3
+ it { expect(Haxe::Rails::VERSION).to eq '0.1.2' }
4
+ end
5
+ end
@@ -0,0 +1,12 @@
1
+ if ENV['CODECLIMATE_REPO_TOKEN']
2
+ require 'rails'
3
+ require 'codeclimate-test-reporter'
4
+ CodeClimate::TestReporter.start
5
+ else
6
+ require 'simplecov'
7
+ SimpleCov.start { add_filter '/spec/' }
8
+ end
9
+
10
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
11
+
12
+ require 'haxe-rails'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haxe-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - k-motoyan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-14 00:00:00.000000000 Z
11
+ date: 2015-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: haxe-cli-proxy
@@ -16,70 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '0.3'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '0.3'
27
27
  - !ruby/object:Gem::Dependency
28
- name: railties
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: sprockets
28
+ name: rails
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
31
  - - ">="
46
32
  - !ruby/object:Gem::Version
47
- version: '0'
33
+ version: '4'
48
34
  type: :runtime
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
38
  - - ">="
53
39
  - !ruby/object:Gem::Version
54
- version: '0'
40
+ version: '4'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: tilt
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
45
  - - ">="
60
46
  - !ruby/object:Gem::Version
61
- version: '0'
47
+ version: '2'
62
48
  type: :runtime
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
52
  - - ">="
67
53
  - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: rails
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
54
+ version: '2'
83
55
  - !ruby/object:Gem::Dependency
84
56
  name: rspec
85
57
  requirement: !ruby/object:Gem::Requirement
@@ -130,6 +102,7 @@ extensions: []
130
102
  extra_rdoc_files: []
131
103
  files:
132
104
  - MIT-LICENSE
105
+ - README.md
133
106
  - Rakefile
134
107
  - lib/haxe-rails.rb
135
108
  - lib/haxe/rails/compiler.rb
@@ -138,6 +111,16 @@ files:
138
111
  - lib/haxe/rails/railtie.rb
139
112
  - lib/haxe/rails/template.rb
140
113
  - lib/haxe/rails/version.rb
114
+ - spec/fixtures/haxe_projects/fail_compile/Main.hx
115
+ - spec/fixtures/haxe_projects/fail_compile/compile.hxml
116
+ - spec/fixtures/haxe_projects/target_python/Main.hx
117
+ - spec/fixtures/haxe_projects/target_python/compile.hxml
118
+ - spec/fixtures/haxe_projects/will_compile/Main.hx
119
+ - spec/fixtures/haxe_projects/will_compile/compile.hxml
120
+ - spec/haxe-rails_spec.rb
121
+ - spec/haxe/rails/compiler_spec.rb
122
+ - spec/haxe/rails/template_spec.rb
123
+ - spec/spec_helper.rb
141
124
  homepage: https://github.com/k-motoyan/haxe-rails
142
125
  licenses:
143
126
  - MIT
@@ -162,4 +145,14 @@ rubygems_version: 2.4.5
162
145
  signing_key:
163
146
  specification_version: 4
164
147
  summary: Haxe adapter for the Rails asset pipeline.
165
- test_files: []
148
+ test_files:
149
+ - spec/fixtures/haxe_projects/fail_compile/compile.hxml
150
+ - spec/fixtures/haxe_projects/fail_compile/Main.hx
151
+ - spec/fixtures/haxe_projects/target_python/compile.hxml
152
+ - spec/fixtures/haxe_projects/target_python/Main.hx
153
+ - spec/fixtures/haxe_projects/will_compile/compile.hxml
154
+ - spec/fixtures/haxe_projects/will_compile/Main.hx
155
+ - spec/haxe/rails/compiler_spec.rb
156
+ - spec/haxe/rails/template_spec.rb
157
+ - spec/haxe-rails_spec.rb
158
+ - spec/spec_helper.rb