haxe-rails 0.1.0
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.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +34 -0
- data/lib/haxe-rails.rb +5 -0
- data/lib/haxe/rails/compiler.rb +35 -0
- data/lib/haxe/rails/engine.rb +8 -0
- data/lib/haxe/rails/error.rb +23 -0
- data/lib/haxe/rails/railtie.rb +13 -0
- data/lib/haxe/rails/template.rb +28 -0
- data/lib/haxe/rails/version.rb +5 -0
- metadata +165 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e9361a0759a6a9fb1ad0024fcd71459900844837
|
4
|
+
data.tar.gz: 46a5d790c715df9356ebd89024a911aba7c82320
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0a17dd9559c0dfbd9a0e2162635032ec110a2c770ebaa0279baccb709f64af0ab463b91917c722d5f226e0123914f07d6e8e7baf1930640f823bb7b9647f8465
|
7
|
+
data.tar.gz: fa37f137a5a262e01cbad6e4e383379152164b1fa52808791e0b079a1af9411dcf0bbb0b35bdc9b9b8a04c6a27eed106d1ec8a9e3c198bae6bd4139dd04aca26
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2015 kenta.motoyanagi
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'HaxeRails'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
Bundler::GemHelper.install_tasks
|
23
|
+
|
24
|
+
require 'rake/testtask'
|
25
|
+
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
27
|
+
t.libs << 'lib'
|
28
|
+
t.libs << 'test'
|
29
|
+
t.pattern = 'test/**/*_test.rb'
|
30
|
+
t.verbose = false
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
task default: :test
|
data/lib/haxe-rails.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
require 'haxe-cli-proxy'
|
3
|
+
|
4
|
+
module Haxe
|
5
|
+
module Rails
|
6
|
+
class Compiler
|
7
|
+
class << self
|
8
|
+
##
|
9
|
+
# Execute haxe compile by hxml.
|
10
|
+
#
|
11
|
+
# @param [String] hxml_path hxml file path.
|
12
|
+
# @param [String] hxml_src hxml source code.
|
13
|
+
# @return [String] compiled javascript code.
|
14
|
+
##
|
15
|
+
def compile(hxml_path, hxml_src)
|
16
|
+
dirname = File.dirname(hxml_path)
|
17
|
+
filename = File.basename(hxml_path)
|
18
|
+
result = ::Haxe::Cli::Proxy::Command.compile(dirname, { hxml: filename })
|
19
|
+
|
20
|
+
unless result.stderr.empty?
|
21
|
+
raise ::Haxe::Rails::Error::HaxeCompileError.new(result.stderr)
|
22
|
+
end
|
23
|
+
|
24
|
+
matches = /-js (.+)/.match(hxml_src)
|
25
|
+
|
26
|
+
if matches.nil?
|
27
|
+
raise ::Haxe::Rails::Error::HxmlOutputTargetError.new
|
28
|
+
end
|
29
|
+
|
30
|
+
Pathname("#{dirname}/#{matches[1]}").read
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Haxe
|
2
|
+
module Rails
|
3
|
+
module Error
|
4
|
+
class HaxeRailsError < StandardError
|
5
|
+
end
|
6
|
+
|
7
|
+
class HaxeCompileError < HaxeRailsError
|
8
|
+
##
|
9
|
+
# @param [String] message haxe compile result message.
|
10
|
+
##
|
11
|
+
def initialize(message)
|
12
|
+
super message
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class HxmlOutputTargetError < HaxeRailsError
|
17
|
+
def initialize
|
18
|
+
super 'Compile target only javascript.'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'rails/railtie'
|
2
|
+
|
3
|
+
module Haxe
|
4
|
+
module Rails
|
5
|
+
class Railtie < ::Rails::Railtie
|
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
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'tilt/template'
|
2
|
+
|
3
|
+
module Haxe
|
4
|
+
module Rails
|
5
|
+
class Template < ::Tilt::Template
|
6
|
+
def initialize_engine
|
7
|
+
require 'haxe/rails/compiler'
|
8
|
+
end
|
9
|
+
|
10
|
+
def prepare
|
11
|
+
end
|
12
|
+
|
13
|
+
def evaluate(scope, locals, &block)
|
14
|
+
@output ||= ::Haxe::Rails::Compiler.compile(file, data)
|
15
|
+
end
|
16
|
+
|
17
|
+
def allows_script?
|
18
|
+
false
|
19
|
+
end
|
20
|
+
|
21
|
+
self.default_mime_type = 'application/javascript'
|
22
|
+
|
23
|
+
def self.engine_initialized?
|
24
|
+
defined? ::Haxe::Rails::Compiler
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: haxe-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- k-motoyan
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: haxe-cli-proxy
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
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
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: tilt
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !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'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simplecov
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: codeclimate-test-reporter
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description: Haxe adapter for the Rails asset pipeline.
|
126
|
+
email:
|
127
|
+
- k.motoyan888@gmail.com
|
128
|
+
executables: []
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files: []
|
131
|
+
files:
|
132
|
+
- MIT-LICENSE
|
133
|
+
- Rakefile
|
134
|
+
- lib/haxe-rails.rb
|
135
|
+
- lib/haxe/rails/compiler.rb
|
136
|
+
- lib/haxe/rails/engine.rb
|
137
|
+
- lib/haxe/rails/error.rb
|
138
|
+
- lib/haxe/rails/railtie.rb
|
139
|
+
- lib/haxe/rails/template.rb
|
140
|
+
- lib/haxe/rails/version.rb
|
141
|
+
homepage: https://github.com/k-motoyan/haxe-rails
|
142
|
+
licenses:
|
143
|
+
- MIT
|
144
|
+
metadata: {}
|
145
|
+
post_install_message:
|
146
|
+
rdoc_options: []
|
147
|
+
require_paths:
|
148
|
+
- lib
|
149
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - ">="
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
159
|
+
requirements: []
|
160
|
+
rubyforge_project:
|
161
|
+
rubygems_version: 2.4.5
|
162
|
+
signing_key:
|
163
|
+
specification_version: 4
|
164
|
+
summary: Haxe adapter for the Rails asset pipeline.
|
165
|
+
test_files: []
|