forml-rails 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -2
- data/lib/forml-rails.rb +2 -0
- data/lib/forml/engine.rb +7 -0
- data/lib/forml/template_handler.rb +16 -0
- data/lib/forml/version.rb +1 -1
- data/lib/{generators/forml/forml_generator.rb → rails/generators/forml/assets/assets_generator.rb} +1 -1
- data/lib/{generators/forml → rails/generators/forml/assets}/templates/javascript.js.forml +0 -0
- data/test/lib/forml-rails_test.rb +37 -0
- data/test/lib/{generators/forml/forml_generator_test.rb → rails/generators/forml/assets/assets_generator_test.rb} +4 -4
- data/test/support/routes.rb +1 -0
- data/test/test_helper.rb +9 -1
- metadata +12 -6
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Forml-Rails
|
2
2
|
|
3
|
-
|
3
|
+
Support for [Forml](https://github.com/texodus/forml) in Rails.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -18,7 +18,7 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
$ rails generate forml MODEL
|
22
22
|
|
23
23
|
## Contributing
|
24
24
|
|
data/lib/forml-rails.rb
CHANGED
data/lib/forml/engine.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
module Forml
|
2
|
+
class TemplateHandler
|
3
|
+
def self.erb_handler
|
4
|
+
@@erb_handler ||= ActionView::Template.registered_template_handler(:erb)
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.call(template)
|
8
|
+
compiled_source = erb_handler.call(template)
|
9
|
+
# TODO
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
ActiveSupport.on_load(:action_view) do
|
15
|
+
ActionView::Template.register_template_handler :forml, Forml::TemplateHandler
|
16
|
+
end
|
data/lib/forml/version.rb
CHANGED
File without changes
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'rails/generators/rails/controller/controller_generator'
|
3
|
+
require 'rails/generators/rails/scaffold/scaffold_generator'
|
4
|
+
|
5
|
+
class ControllerGeneratorTest < Rails::Generators::TestCase
|
6
|
+
tests Rails::Generators::ControllerGenerator
|
7
|
+
|
8
|
+
destination File.expand_path("../tmp", __FILE__)
|
9
|
+
|
10
|
+
setup do
|
11
|
+
prepare_destination
|
12
|
+
copy_routes
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_controller
|
16
|
+
run_generator %w(abcs --javascript-engine=forml --orm=false)
|
17
|
+
assert_no_file "app/assets/javascripts/abcs.js"
|
18
|
+
assert_file "app/assets/javascripts/abcs.js.forml"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class ScaffoldGeneratorTest < Rails::Generators::TestCase
|
23
|
+
tests Rails::Generators::ScaffoldGenerator
|
24
|
+
|
25
|
+
destination File.expand_path("../tmp", __FILE__)
|
26
|
+
setup do
|
27
|
+
prepare_destination
|
28
|
+
copy_routes
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_assets
|
32
|
+
run_generator %w(blahs --javascript-engine=forml --orm=false)
|
33
|
+
assert_no_file "app/assets/javascripts/blahs.js"
|
34
|
+
assert_file "app/assets/javascripts/blahs.js.forml"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
@@ -1,8 +1,8 @@
|
|
1
|
-
require_relative '
|
2
|
-
require 'generators/forml/
|
1
|
+
require_relative '../../../../../test_helper'
|
2
|
+
require 'rails/generators/forml/assets/assets_generator'
|
3
3
|
|
4
|
-
class
|
5
|
-
tests Forml::Generators::
|
4
|
+
class AssetsGeneratorTest < Rails::Generators::TestCase
|
5
|
+
tests Forml::Generators::AssetsGenerator
|
6
6
|
|
7
7
|
destination File.expand_path("../tmp", __FILE__)
|
8
8
|
setup :prepare_destination
|
@@ -0,0 +1 @@
|
|
1
|
+
# routes file
|
data/test/test_helper.rb
CHANGED
@@ -10,4 +10,12 @@ require 'rails/generators/test_case'
|
|
10
10
|
require 'minitest/autorun'
|
11
11
|
require 'minitest/pride'
|
12
12
|
|
13
|
-
Dir["#{File.dirname(__FILE__)}/../lib/**/*.rb"].each { |f| load(f) }
|
13
|
+
Dir["#{File.dirname(__FILE__)}/../lib/**/*.rb"].each { |f| load(f) }
|
14
|
+
|
15
|
+
def copy_routes
|
16
|
+
routes = File.expand_path("../support/routes.rb", __FILE__)
|
17
|
+
destination = File.join(destination_root, "config")
|
18
|
+
|
19
|
+
FileUtils.mkdir_p(destination)
|
20
|
+
FileUtils.cp routes, destination
|
21
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forml-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
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-
|
12
|
+
date: 2012-12-31 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Enjoy Forml in your Rails with forml-rails, an adapter for the Rails
|
15
15
|
asset pipeline.
|
@@ -27,11 +27,15 @@ files:
|
|
27
27
|
- forml-rails.gemspec
|
28
28
|
- lib/assets/javascripts/forml.js.erb
|
29
29
|
- lib/forml-rails.rb
|
30
|
+
- lib/forml/engine.rb
|
31
|
+
- lib/forml/template_handler.rb
|
30
32
|
- lib/forml/version.rb
|
31
|
-
- lib/generators/forml/
|
32
|
-
- lib/generators/forml/templates/javascript.js.forml
|
33
|
+
- lib/rails/generators/forml/assets/assets_generator.rb
|
34
|
+
- lib/rails/generators/forml/assets/templates/javascript.js.forml
|
35
|
+
- test/lib/forml-rails_test.rb
|
33
36
|
- test/lib/forml/version_test.rb
|
34
|
-
- test/lib/generators/forml/
|
37
|
+
- test/lib/rails/generators/forml/assets/assets_generator_test.rb
|
38
|
+
- test/support/routes.rb
|
35
39
|
- test/test_helper.rb
|
36
40
|
homepage: https://github.com/JHawk/forml-rails
|
37
41
|
licenses: []
|
@@ -58,6 +62,8 @@ signing_key:
|
|
58
62
|
specification_version: 3
|
59
63
|
summary: Forml adapter for the Rails asset pipeline.
|
60
64
|
test_files:
|
65
|
+
- test/lib/forml-rails_test.rb
|
61
66
|
- test/lib/forml/version_test.rb
|
62
|
-
- test/lib/generators/forml/
|
67
|
+
- test/lib/rails/generators/forml/assets/assets_generator_test.rb
|
68
|
+
- test/support/routes.rb
|
63
69
|
- test/test_helper.rb
|