angular-templates 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +32 -0
- data/app/assets/javascripts/angular_templates.js.erb +12 -0
- data/app/controllers/angular_templates/templating_controller.rb +33 -0
- data/lib/angular/templates.rb +1 -0
- data/lib/angular_templates.rb +2 -0
- data/lib/angular_templates/engine.rb +5 -0
- data/lib/angular_templates/version.rb +3 -0
- data/lib/tasks/angular_templates_tasks.rake +4 -0
- metadata +81 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1a260cd6b75836c17ed570999f481462bcbd2d23
|
4
|
+
data.tar.gz: 4837c99d02a2b48fe1de5aef1e00cc15f1398b77
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f9b3bee5192aa2c23a9c32d907c0572a319cdbeb2010a55559dffc68e7d228d4005cc707209cec85360a7f54b9e729e25033ccba5954961d4dc1bcadac43afe9
|
7
|
+
data.tar.gz: ae7124031bdf640ccf739e261c958ba0bfe9fe1f6e25691961627b5b302c8cf53184f7ce28c055ba828a30bd72ba5430fa95132564bc617854d53b217fc6826c
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2015 YOURNAME
|
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,32 @@
|
|
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 = 'AngularTemplates'
|
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
|
+
Bundler::GemHelper.install_tasks
|
21
|
+
|
22
|
+
require 'rake/testtask'
|
23
|
+
|
24
|
+
Rake::TestTask.new(:test) do |t|
|
25
|
+
t.libs << 'lib'
|
26
|
+
t.libs << 'test'
|
27
|
+
t.pattern = 'test/**/*_test.rb'
|
28
|
+
t.verbose = false
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
task default: :test
|
@@ -0,0 +1,12 @@
|
|
1
|
+
angular.module("app").run(["$templateCache", function($templateCache) {
|
2
|
+
<% AngularTemplates::TemplatingController.render_templates.each do |k,v| %>
|
3
|
+
$templateCache.put(<%= k.to_json %>, <%= v.to_json %>)
|
4
|
+
<% end %>
|
5
|
+
}]);
|
6
|
+
<%
|
7
|
+
depend_on Rails.root.join('app','templates')
|
8
|
+
files = Dir[Rails.root.join('app','templates','*','**')]
|
9
|
+
files.each do |file|
|
10
|
+
depend_on file
|
11
|
+
end
|
12
|
+
%>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module AngularTemplates
|
2
|
+
class TemplatingController < AbstractController::Base
|
3
|
+
include AbstractController::Rendering
|
4
|
+
if defined?(AbstractController::Layouts)
|
5
|
+
include AbstractController::Layouts
|
6
|
+
else
|
7
|
+
include ActionView::Layouts
|
8
|
+
end
|
9
|
+
include ActionController::Helpers
|
10
|
+
|
11
|
+
self.view_paths = 'app/templates'
|
12
|
+
self.helpers_path = Rails.application.helpers_paths
|
13
|
+
|
14
|
+
helper :all
|
15
|
+
|
16
|
+
public
|
17
|
+
def self.render_templates
|
18
|
+
controller = TemplatingController.new
|
19
|
+
result = {}
|
20
|
+
prefix = Rails.root.join('app','templates').to_s
|
21
|
+
files = Dir[Rails.root.join('app','templates','*','**','**')]
|
22
|
+
files.reject!{|f| File.basename(f)[0] == '_'}
|
23
|
+
files.each do |file|
|
24
|
+
if m = file.match(/#{prefix}\/(.+?)\./)
|
25
|
+
template_name = m[1]
|
26
|
+
puts template_name.inspect
|
27
|
+
result[template_name] = controller.render(template: template_name)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
result
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'angular_templates'
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: angular-templates
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- tye
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-05 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: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sqlite3
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Include your angular templates as part of the Rails assets pipeline.
|
42
|
+
email:
|
43
|
+
- tye@tye.ca
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- MIT-LICENSE
|
49
|
+
- Rakefile
|
50
|
+
- app/assets/javascripts/angular_templates.js.erb
|
51
|
+
- app/controllers/angular_templates/templating_controller.rb
|
52
|
+
- lib/angular/templates.rb
|
53
|
+
- lib/angular_templates.rb
|
54
|
+
- lib/angular_templates/engine.rb
|
55
|
+
- lib/angular_templates/version.rb
|
56
|
+
- lib/tasks/angular_templates_tasks.rake
|
57
|
+
homepage: ''
|
58
|
+
licenses:
|
59
|
+
- MIT
|
60
|
+
metadata: {}
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options: []
|
63
|
+
require_paths:
|
64
|
+
- lib
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - '>='
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
requirements: []
|
76
|
+
rubyforge_project:
|
77
|
+
rubygems_version: 2.2.2
|
78
|
+
signing_key:
|
79
|
+
specification_version: 4
|
80
|
+
summary: Include your angular templates as part of the Rails assets pipeline.
|
81
|
+
test_files: []
|