engine-assets 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/LICENSE +20 -0
- data/README.rdoc +18 -0
- data/Rakefile +45 -0
- data/TODO.md +4 -0
- data/VERSION +1 -0
- data/app/controllers/engine_assets/assets_controller.rb +23 -0
- data/app/controllers/engine_assets/javascripts_controller.rb +8 -0
- data/app/controllers/engine_assets/stylesheets_controller.rb +8 -0
- data/config/routes.rb +5 -0
- data/lib/engine-assets.rb +3 -0
- data/lib/engine_assets/extensions/rails/routes.rb +17 -0
- data/rails/init.rb +7 -0
- data/spec/routing/javascripts_routing_spec.rb +13 -0
- data/spec/routing/stylesheets_routing_spec.rb +13 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +31 -0
- data/spec/spec_suite.rb +28 -0
- data/spec/support/fixtures/app/views/javascripts/asset.js.erb +2 -0
- data/spec/support/fixtures/public/javascripts/asset.js +2 -0
- data/spec/support/helpers/textmate_helper.rb +14 -0
- metadata +90 -0
data/.document
ADDED
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Corey Innis
|
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/README.rdoc
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
= engine-assets
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Note on Patches/Pull Requests
|
6
|
+
|
7
|
+
* Fork the project.
|
8
|
+
* Make your feature addition or bug fix.
|
9
|
+
* Add tests for it. This is important so I don't break it in a
|
10
|
+
future version unintentionally.
|
11
|
+
* Commit, do not mess with rakefile, version, or history.
|
12
|
+
(if you want to have your own version, that is fine but
|
13
|
+
bump version in a commit by itself I can ignore when I pull)
|
14
|
+
* Send me a pull request. Bonus points for topic branches.
|
15
|
+
|
16
|
+
== Copyright
|
17
|
+
|
18
|
+
Copyright (c) 2009 Corey Innis. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "engine-assets"
|
8
|
+
gem.summary = "Rails Engines with assets."
|
9
|
+
gem.description = "A Rails Engine, which enables Rails Engines to provide assets (javascript, css and images)"
|
10
|
+
gem.email = "support@coolerator.net"
|
11
|
+
gem.homepage = "http://github.com/coreyti/engine-assets"
|
12
|
+
gem.authors = ["Corey Innis"]
|
13
|
+
gem.add_development_dependency "rspec", ">= 1.2.9"
|
14
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
|
+
end
|
16
|
+
Jeweler::GemcutterTasks.new
|
17
|
+
rescue LoadError
|
18
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
19
|
+
end
|
20
|
+
|
21
|
+
require 'spec/rake/spectask'
|
22
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
23
|
+
spec.libs << 'lib' << 'spec'
|
24
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
25
|
+
end
|
26
|
+
|
27
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
28
|
+
spec.libs << 'lib' << 'spec'
|
29
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
30
|
+
spec.rcov = true
|
31
|
+
end
|
32
|
+
|
33
|
+
task :spec => :check_dependencies
|
34
|
+
|
35
|
+
task :default => :spec
|
36
|
+
|
37
|
+
require 'rake/rdoctask'
|
38
|
+
Rake::RDocTask.new do |rdoc|
|
39
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
40
|
+
|
41
|
+
rdoc.rdoc_dir = 'rdoc'
|
42
|
+
rdoc.title = "engine-assets #{version}"
|
43
|
+
rdoc.rdoc_files.include('README*')
|
44
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
45
|
+
end
|
data/TODO.md
ADDED
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class EngineAssets::AssetsController < ApplicationController
|
2
|
+
unloadable
|
3
|
+
|
4
|
+
layout nil
|
5
|
+
before_filter :expire, :set_headers
|
6
|
+
after_filter :cache
|
7
|
+
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def expire
|
12
|
+
# TODO
|
13
|
+
# expire_page :controller => self, :action => "all"
|
14
|
+
end
|
15
|
+
|
16
|
+
def cache
|
17
|
+
cache_page
|
18
|
+
end
|
19
|
+
|
20
|
+
def set_headers
|
21
|
+
# optionally override
|
22
|
+
end
|
23
|
+
end
|
data/config/routes.rb
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
ActionController::Routing::Routes.draw do |map|
|
2
|
+
# map.images 'images/:action.:format', :controller => 'engine_assets/images'
|
3
|
+
map.javascripts 'javascripts/:action.:format', :controller => 'engine_assets/javascripts'
|
4
|
+
map.stylesheets 'stylesheets/:action.:format', :controller => 'engine_assets/stylesheets'
|
5
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
if defined?(ActionController::Routing::RouteSet)
|
2
|
+
|
3
|
+
class ActionController::Routing::RouteSet
|
4
|
+
def load_routes_with_assets!
|
5
|
+
lib_path = File.dirname(__FILE__)
|
6
|
+
engine_routes = File.join(lib_path, *%w[.. .. .. .. config routes.rb])
|
7
|
+
|
8
|
+
unless configuration_files.include?(engine_routes)
|
9
|
+
add_configuration_file(engine_routes)
|
10
|
+
end
|
11
|
+
|
12
|
+
load_routes_without_assets!
|
13
|
+
end
|
14
|
+
|
15
|
+
alias_method_chain :load_routes!, :assets
|
16
|
+
end
|
17
|
+
end
|
data/rails/init.rb
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
dir = File.dirname(__FILE__)
|
2
|
+
$LOAD_PATH.unshift(File.join(dir, '..', 'app'))
|
3
|
+
|
4
|
+
require 'engine-assets'
|
5
|
+
require 'controllers/engine_assets/assets_controller'
|
6
|
+
require 'controllers/engine_assets/javascripts_controller'
|
7
|
+
require 'controllers/engine_assets/stylesheets_controller'
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe EngineAssets::JavascriptsController do
|
4
|
+
describe "routing" do
|
5
|
+
it "recognizes valid paths" do
|
6
|
+
{ :get => "/javascripts/asset.js" }.should be_routable
|
7
|
+
end
|
8
|
+
|
9
|
+
it "generates valid paths" do
|
10
|
+
javascripts_path(:asset, :format => :js).should == '/javascripts/asset.js'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe EngineAssets::StylesheetsController do
|
4
|
+
describe "routing" do
|
5
|
+
it "recognizes valid paths" do
|
6
|
+
{ :get => "/stylesheets/asset.css" }.should be_routable
|
7
|
+
end
|
8
|
+
|
9
|
+
it "generates valid paths" do
|
10
|
+
stylesheets_path(:asset, :format => :css).should == '/stylesheets/asset.css'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
RAILS_PATH = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'vanilla'))
|
2
|
+
|
3
|
+
dir = File.dirname(__FILE__)
|
4
|
+
$LOAD_PATH.unshift(dir)
|
5
|
+
|
6
|
+
ENV["RAILS_ENV"] = "test"
|
7
|
+
|
8
|
+
require "#{File.join(RAILS_PATH, 'config', 'environment')}"
|
9
|
+
require 'engine-assets'
|
10
|
+
require 'spec'
|
11
|
+
require 'spec/autorun'
|
12
|
+
require 'spec/rails'
|
13
|
+
require 'support/helpers/textmate_helper'
|
14
|
+
|
15
|
+
Spec::Runner.configure do |config|
|
16
|
+
include Support::Helpers
|
17
|
+
|
18
|
+
config.fixture_path = "#{File.dirname(__FILE__)}/../spec/support/fixtures"
|
19
|
+
config.mock_with :rr
|
20
|
+
config.use_transactional_fixtures = true
|
21
|
+
config.use_instantiated_fixtures = false
|
22
|
+
|
23
|
+
# def add_fixture_views(controller_class)
|
24
|
+
# controller_class.prepend_view_path(File.join(basepath, '..', 'fixtures', 'app', 'views'))
|
25
|
+
# controller_class.prepend_view_path(File.join(basepath, '..', 'fixtures', 'public'))
|
26
|
+
# end
|
27
|
+
#
|
28
|
+
# def basepath
|
29
|
+
# @basepath ||= File.join(File.dirname(__FILE__), '..')
|
30
|
+
# end
|
31
|
+
end
|
data/spec/spec_suite.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
class SpecSuite
|
2
|
+
def files
|
3
|
+
dir = File.dirname(__FILE__)
|
4
|
+
Dir["#{dir}/../spec/**/*_spec.rb"]
|
5
|
+
end
|
6
|
+
|
7
|
+
def run
|
8
|
+
basedir = File.join(File.dirname(__FILE__), '..')
|
9
|
+
libdir = File.join(basedir, 'lib')
|
10
|
+
specdir = File.join(basedir, 'spec')
|
11
|
+
|
12
|
+
$LOAD_PATH.unshift(basedir)
|
13
|
+
$LOAD_PATH.unshift(libdir)
|
14
|
+
$LOAD_PATH.unshift(specdir)
|
15
|
+
|
16
|
+
ARGV.concat ["--options", "#{specdir}/spec.opts"]
|
17
|
+
|
18
|
+
files.each do |file|
|
19
|
+
require file
|
20
|
+
end
|
21
|
+
result = ::Spec::Runner::CommandLine.run
|
22
|
+
exit result
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
if $0 == __FILE__
|
27
|
+
SpecSuite.new.run
|
28
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Support
|
2
|
+
module Helpers
|
3
|
+
def tm_inspect(label = nil, &block)
|
4
|
+
content = yield
|
5
|
+
content = content.inspect unless content.is_a? String
|
6
|
+
|
7
|
+
if $0 =~ /textmate-command/
|
8
|
+
puts %Q|#{label ? "<p>inspecting: #{label}</p><hr />" : ""}<code>#{CGI.escapeHTML(content)}</code><hr />|
|
9
|
+
else
|
10
|
+
puts %Q|#{label ? "\ninspecting: #{label}\n" : "\n"}#{'-' * 80}\n#{content}\n#{"-" * 80}|
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: engine-assets
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Corey Innis
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-11-06 00:00:00 -05:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rspec
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.2.9
|
24
|
+
version:
|
25
|
+
description: A Rails Engine, which enables Rails Engines to provide assets (javascript, css and images)
|
26
|
+
email: support@coolerator.net
|
27
|
+
executables: []
|
28
|
+
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files:
|
32
|
+
- LICENSE
|
33
|
+
- README.rdoc
|
34
|
+
files:
|
35
|
+
- .document
|
36
|
+
- .gitignore
|
37
|
+
- LICENSE
|
38
|
+
- README.rdoc
|
39
|
+
- Rakefile
|
40
|
+
- TODO.md
|
41
|
+
- VERSION
|
42
|
+
- app/controllers/engine_assets/assets_controller.rb
|
43
|
+
- app/controllers/engine_assets/javascripts_controller.rb
|
44
|
+
- app/controllers/engine_assets/stylesheets_controller.rb
|
45
|
+
- config/routes.rb
|
46
|
+
- lib/engine-assets.rb
|
47
|
+
- lib/engine_assets/extensions/rails/routes.rb
|
48
|
+
- rails/init.rb
|
49
|
+
- spec/routing/javascripts_routing_spec.rb
|
50
|
+
- spec/routing/stylesheets_routing_spec.rb
|
51
|
+
- spec/spec.opts
|
52
|
+
- spec/spec_helper.rb
|
53
|
+
- spec/spec_suite.rb
|
54
|
+
- spec/support/fixtures/app/views/javascripts/asset.js.erb
|
55
|
+
- spec/support/fixtures/public/javascripts/asset.js
|
56
|
+
- spec/support/helpers/textmate_helper.rb
|
57
|
+
has_rdoc: true
|
58
|
+
homepage: http://github.com/coreyti/engine-assets
|
59
|
+
licenses: []
|
60
|
+
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options:
|
63
|
+
- --charset=UTF-8
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: "0"
|
71
|
+
version:
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: "0"
|
77
|
+
version:
|
78
|
+
requirements: []
|
79
|
+
|
80
|
+
rubyforge_project:
|
81
|
+
rubygems_version: 1.3.5
|
82
|
+
signing_key:
|
83
|
+
specification_version: 3
|
84
|
+
summary: Rails Engines with assets.
|
85
|
+
test_files:
|
86
|
+
- spec/routing/javascripts_routing_spec.rb
|
87
|
+
- spec/routing/stylesheets_routing_spec.rb
|
88
|
+
- spec/spec_helper.rb
|
89
|
+
- spec/spec_suite.rb
|
90
|
+
- spec/support/helpers/textmate_helper.rb
|