flay-actionpack 0.0.1

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.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
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
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in flay_rails_erb.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Eugene Kalenkovich
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,16 @@
1
+ flay-actionpack
2
+ ==============
3
+
4
+ Flay plugin for rails erb templates.
5
+ Tested with Rails 3.x and 4.0
6
+
7
+ Installation
8
+ ------------
9
+
10
+ gem install flay-rails-erb
11
+
12
+ or add to your application's Gemfile development section
13
+
14
+ gem 'flay-rails-erb'
15
+
16
+ For flay usage please see [flay docummentation](https://github.com/seattlerb/flay)
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+ require 'rake/testtask'
4
+
5
+ Rake::TestTask.new(:test) do |t|
6
+ t.libs << 'lib'
7
+ t.libs << 'test'
8
+ t.pattern = 'test/**/test_*.rb'
9
+ t.verbose = false
10
+ end
11
+
12
+ task :default => :test
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "flay-actionpack"
7
+ spec.version = '0.0.1'
8
+ spec.authors = ["Eugene Kalenkovich"]
9
+ spec.email = ["rubify@softover.com"]
10
+ spec.description = "Flay plugin for Rails ERB templates"
11
+ spec.summary = "Flay actionpack ERB"
12
+ spec.homepage = "https://github.com/kalenkov/flay-actionpack"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency "flay", ">= 1.2", "< 3"
21
+ spec.add_development_dependency "actionpack", ">= 3", "< 5"
22
+ spec.add_development_dependency "bundler", "~> 1.3"
23
+ spec.add_development_dependency "rake"
24
+ end
@@ -0,0 +1,23 @@
1
+ require 'ruby_parser'
2
+ require 'action_view'
3
+
4
+ class Flay
5
+
6
+ @@plugins << 'erb'
7
+
8
+ ##
9
+ # Process erb template and parse the result. Returns the sexp of the parsed
10
+ # ruby.
11
+
12
+ def actionpack_erb file
13
+ erb = File.read file
14
+ src = Struct.new(:source, :mime_type, :type).new(erb, 'text/html', 'text/html')
15
+ ruby = ActionView::Template::Handlers::ERB.call src
16
+ begin
17
+ RubyParser.new.process(ruby, file)
18
+ rescue => e
19
+ warn ruby if option[:verbose]
20
+ raise e
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,6 @@
1
+ <%= form_tag do %>
2
+ Just test
3
+ <% end %>
4
+ <%= other_tag do %>
5
+ Something else
6
+ <% end %>
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/ruby -w
2
+
3
+ require 'minitest/autorun'
4
+ require 'flay'
5
+ require 'action_view'
6
+
7
+ class TestFlayActionpack < MiniTest::Unit::TestCase
8
+ def test_actionpack_erb
9
+ res = Flay.new.process_erb File.dirname(__FILE__) + '/sample.html.erb'
10
+ assert Sexp === res
11
+ assert res.size > 0
12
+ end
13
+ end
metadata ADDED
@@ -0,0 +1,133 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: flay-actionpack
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Eugene Kalenkovich
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-07-10 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: flay
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '1.2'
22
+ - - <
23
+ - !ruby/object:Gem::Version
24
+ version: '3'
25
+ type: :runtime
26
+ prerelease: false
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '1.2'
33
+ - - <
34
+ - !ruby/object:Gem::Version
35
+ version: '3'
36
+ - !ruby/object:Gem::Dependency
37
+ name: actionpack
38
+ requirement: !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '3'
44
+ - - <
45
+ - !ruby/object:Gem::Version
46
+ version: '5'
47
+ type: :development
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '3'
55
+ - - <
56
+ - !ruby/object:Gem::Version
57
+ version: '5'
58
+ - !ruby/object:Gem::Dependency
59
+ name: bundler
60
+ requirement: !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: '1.3'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ~>
72
+ - !ruby/object:Gem::Version
73
+ version: '1.3'
74
+ - !ruby/object:Gem::Dependency
75
+ name: rake
76
+ requirement: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ! '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ description: Flay plugin for Rails ERB templates
91
+ email:
92
+ - rubify@softover.com
93
+ executables: []
94
+ extensions: []
95
+ extra_rdoc_files: []
96
+ files:
97
+ - .gitignore
98
+ - Gemfile
99
+ - LICENSE.txt
100
+ - README.md
101
+ - Rakefile
102
+ - flay-actionpack.gemspec
103
+ - lib/flay_actionpack.rb
104
+ - test/sample.html.erb
105
+ - test/test_flay_actionpack.rb
106
+ homepage: https://github.com/kalenkov/flay-actionpack
107
+ licenses:
108
+ - MIT
109
+ post_install_message:
110
+ rdoc_options: []
111
+ require_paths:
112
+ - lib
113
+ required_ruby_version: !ruby/object:Gem::Requirement
114
+ none: false
115
+ requirements:
116
+ - - ! '>='
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ required_rubygems_version: !ruby/object:Gem::Requirement
120
+ none: false
121
+ requirements:
122
+ - - ! '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ requirements: []
126
+ rubyforge_project:
127
+ rubygems_version: 1.8.25
128
+ signing_key:
129
+ specification_version: 3
130
+ summary: Flay actionpack ERB
131
+ test_files:
132
+ - test/sample.html.erb
133
+ - test/test_flay_actionpack.rb