purescript-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/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +30 -0
- data/Rakefile +2 -0
- data/lib/purescript/assets/purescript.js.erb +2 -0
- data/lib/purescript/rails/engine.rb +9 -0
- data/lib/purescript/rails/generators/purescript/assets/assets_generator.rb +14 -0
- data/lib/purescript/rails/generators/purescript/assets/templates/javascript.js.purs +3 -0
- data/lib/purescript/rails/railtie.rb +11 -0
- data/lib/purescript/rails/template_handler.rb +19 -0
- data/lib/purescript/rails/version.rb +5 -0
- data/lib/purescript/rails.rb +7 -0
- data/lib/purescript/template.rb +55 -0
- data/lib/purescript-rails.rb +6 -0
- data/lib/purescript_rails.rb +1 -0
- data/purescript-rails.gemspec +22 -0
- metadata +75 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e93b0301f3fddf16b881f67b639f5b5673be3a9f
|
4
|
+
data.tar.gz: a75d55ffab637ac98b8ad5fb706a96cd4d64a3b5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 821166d1da8f99ce16b190dc723ef63593105ba419a7f2473896507c0f2a86c28eaa0bbef8be6efa46333e76d0eef9a23e9982f0478dda51841567387495172e
|
7
|
+
data.tar.gz: c4b304698e86e4521e51bb48b638fb7da020f311a4a468f4f1e4420f56cfa9a67bcdcca9a848f6fa367a8df34c9da626518a39b7292234ae2f166ef272f8a801
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Daniel Fox
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Purescript::Rails
|
2
|
+
|
3
|
+
Purescript adapter for the Rails asset pipeline.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
This gem requires the PureScript compiler be available in your $PATH. You can
|
8
|
+
find out how to install the PureScript compiler at
|
9
|
+
http://docs.purescript.org/en/latest/start.html#compiler-installation
|
10
|
+
|
11
|
+
The PureScript compiler requires the Haskell package manager "cabal" be
|
12
|
+
installed. It comes with the Haskell compiler GHC which is available at
|
13
|
+
http://www.haskell.org/haskellwiki/Haskell
|
14
|
+
|
15
|
+
Add this line to your application's Gemfile:
|
16
|
+
|
17
|
+
gem 'purescript-rails'
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
|
21
|
+
$ bundle
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
$ gem install purescript-rails
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
To compile a PureScript file with the asset pipeline, add the file to the
|
30
|
+
compile path and name like "my_script.js.purs".
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require "rails/generators/named_base"
|
2
|
+
|
3
|
+
module PureScript
|
4
|
+
module Generators
|
5
|
+
class AssetsGenerator < ::Rails::Generators::NamedBase
|
6
|
+
source_root File.expand_path("../templates", __FILE__)
|
7
|
+
|
8
|
+
def copy_purescript
|
9
|
+
template "javascript.js.purs", File.join('app/assets/javascripts', class_path, "#{file_name}.js.purs")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module PureScript
|
2
|
+
module Rails
|
3
|
+
class TemplateHandler
|
4
|
+
def self.erb_handler
|
5
|
+
@@erb_handler ||= ActionView::Template.registered_template_handler(:erb)
|
6
|
+
end
|
7
|
+
|
8
|
+
|
9
|
+
def self.call(template)
|
10
|
+
compiled_source = erb_handler.call(template)
|
11
|
+
`psc --stdin #{compiled_source}`
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
ActiveSupport.on_load(:action_view) do
|
18
|
+
ActionView::Template.register_template_handler :purescript, PureScript::Rails::TemplateHandler
|
19
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'tilt/template'
|
2
|
+
|
3
|
+
module PureScript
|
4
|
+
# PureScript template implementation. See:
|
5
|
+
# http://purescript.org/
|
6
|
+
#
|
7
|
+
# PureScript templates do not support object scopes, locals, or yield.
|
8
|
+
class Template < ::Tilt::Template
|
9
|
+
self.default_mime_type = 'application/javascript'
|
10
|
+
|
11
|
+
@@default_bare = false
|
12
|
+
|
13
|
+
def self.default_bare
|
14
|
+
@@default_bare
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.default_bare=(value)
|
18
|
+
@@default_bare = value
|
19
|
+
end
|
20
|
+
|
21
|
+
# DEPRECATED
|
22
|
+
def self.default_no_wrap
|
23
|
+
@@default_bare
|
24
|
+
end
|
25
|
+
|
26
|
+
# DEPRECATED
|
27
|
+
def self.default_no_wrap=(value)
|
28
|
+
@@default_bare = value
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.engine_initialized?
|
32
|
+
defined? ::PureScript
|
33
|
+
end
|
34
|
+
|
35
|
+
def initialize_engine
|
36
|
+
require_template_library 'purescript'
|
37
|
+
end
|
38
|
+
|
39
|
+
def prepare
|
40
|
+
puts "prepare"
|
41
|
+
if !options.key?(:bare) and !options.key?(:no_wrap)
|
42
|
+
options[:bare] = self.class.default_bare
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def evaluate(scope, locals, &block)
|
47
|
+
@output ||= `psc #{file}`
|
48
|
+
end
|
49
|
+
|
50
|
+
def allows_script?
|
51
|
+
false
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'purescript-rails'
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'purescript/rails/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "purescript-rails"
|
8
|
+
spec.version = PureScript::Rails::VERSION
|
9
|
+
spec.authors = ["Daniel Fox"]
|
10
|
+
spec.email = ["romaimperator@gmail.com"]
|
11
|
+
spec.summary = %q{PureScript adapter for the Rails asset pipeline.}
|
12
|
+
spec.description = %q{PureScript adapter for the Rails asset pipeline.}
|
13
|
+
spec.homepage = "https://github.com/romaimperator/purescript-rails"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency 'rails', '>= 4.0'
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: purescript-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Daniel Fox
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-09-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.0'
|
27
|
+
description: PureScript adapter for the Rails asset pipeline.
|
28
|
+
email:
|
29
|
+
- romaimperator@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".gitignore"
|
35
|
+
- Gemfile
|
36
|
+
- LICENSE.txt
|
37
|
+
- README.md
|
38
|
+
- Rakefile
|
39
|
+
- lib/purescript-rails.rb
|
40
|
+
- lib/purescript/assets/purescript.js.erb
|
41
|
+
- lib/purescript/rails.rb
|
42
|
+
- lib/purescript/rails/engine.rb
|
43
|
+
- lib/purescript/rails/generators/purescript/assets/assets_generator.rb
|
44
|
+
- lib/purescript/rails/generators/purescript/assets/templates/javascript.js.purs
|
45
|
+
- lib/purescript/rails/railtie.rb
|
46
|
+
- lib/purescript/rails/template_handler.rb
|
47
|
+
- lib/purescript/rails/version.rb
|
48
|
+
- lib/purescript/template.rb
|
49
|
+
- lib/purescript_rails.rb
|
50
|
+
- purescript-rails.gemspec
|
51
|
+
homepage: https://github.com/romaimperator/purescript-rails
|
52
|
+
licenses:
|
53
|
+
- MIT
|
54
|
+
metadata: {}
|
55
|
+
post_install_message:
|
56
|
+
rdoc_options: []
|
57
|
+
require_paths:
|
58
|
+
- lib
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
requirements: []
|
70
|
+
rubyforge_project:
|
71
|
+
rubygems_version: 2.4.1
|
72
|
+
signing_key:
|
73
|
+
specification_version: 4
|
74
|
+
summary: PureScript adapter for the Rails asset pipeline.
|
75
|
+
test_files: []
|