timmatheson-asset_autoinclude_helper 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +0 -0
- data/README.rdoc +12 -0
- data/Rakefile +14 -0
- data/asset_autoinclude_helper.gemspec +31 -0
- data/lib/asset_autoinclude_helper.rb +19 -0
- metadata +65 -0
data/CHANGELOG
ADDED
File without changes
|
data/README.rdoc
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
Usage =======================================
|
2
|
+
|
3
|
+
<%= asset_autoinclude_tag %>
|
4
|
+
|
5
|
+
Prerequisites ===============================
|
6
|
+
|
7
|
+
You need to create files named after your controllers.
|
8
|
+
For example a controller with the name BooksController
|
9
|
+
You would create books.js and books.css
|
10
|
+
This keeps your javascript and css logic in the correct places.
|
11
|
+
If you practice unobtrusive css and javascript methods in your
|
12
|
+
development practice this should clean things up quite a bit.
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'echoe'
|
4
|
+
|
5
|
+
Echoe.new('asset_autoinclude_helper', '0.1.0') do |p|
|
6
|
+
p.description = "Automatically includes javascript and css files named after the current controller"
|
7
|
+
p.url = "http://github.com/timmatheson/asset_autoinclude_helper"
|
8
|
+
p.author = "Tim Matheson"
|
9
|
+
p.email = "me@timmatheson.com"
|
10
|
+
p.ignore_pattern = ["tmp/*", "script/*"]
|
11
|
+
p.development_dependencies = []
|
12
|
+
end
|
13
|
+
|
14
|
+
Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{asset_autoinclude_helper}
|
5
|
+
s.version = "0.1.0"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Tim Matheson"]
|
9
|
+
s.date = %q{2008-11-18}
|
10
|
+
s.description = %q{Automatically includes javascript and css files named after the current controller}
|
11
|
+
s.email = %q{me@timmatheson.com}
|
12
|
+
s.extra_rdoc_files = ["CHANGELOG", "lib/asset_autoinclude_helper.rb", "README.rdoc"]
|
13
|
+
s.files = ["asset_autoinclude_helper.gemspec", "CHANGELOG", "lib/asset_autoinclude_helper.rb", "Manifest", "Rakefile", "README.rdoc"]
|
14
|
+
s.has_rdoc = true
|
15
|
+
s.homepage = %q{http://github.com/timmatheson/asset_autoinclude_helper}
|
16
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Asset_autoinclude_helper", "--main", "README.rdoc"]
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
s.rubyforge_project = %q{asset_autoinclude_helper}
|
19
|
+
s.rubygems_version = %q{1.3.1}
|
20
|
+
s.summary = %q{Automatically includes javascript and css files named after the current controller}
|
21
|
+
|
22
|
+
if s.respond_to? :specification_version then
|
23
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
24
|
+
s.specification_version = 2
|
25
|
+
|
26
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
27
|
+
else
|
28
|
+
end
|
29
|
+
else
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module AssetAutoIncludeHelper
|
2
|
+
def asset_autoinclude_tag(options = {})
|
3
|
+
asset_base_path = "#{RAILS_ROOT}/public/"
|
4
|
+
tags = Array.new
|
5
|
+
%w(javascripts stylesheets).each do |dir,ext|
|
6
|
+
file_name = "#{controller.controller_name}"
|
7
|
+
%w(js css).each do |ext|
|
8
|
+
if File.exists?(File.join([asset_base_path,dir,"#{file_name}.#{ext}"]))
|
9
|
+
ext.eql?("js") ? tags << javascript_include_tag("#{file_name}.#{ext}", options) : tags << stylesheet_link_tag("#{file_name}.#{ext}")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
return tags.map{|tag| "#{tag}\n"}
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class ActionView::Base
|
18
|
+
include AssetAutoIncludeHelper
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: timmatheson-asset_autoinclude_helper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tim Matheson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-11-18 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Automatically includes javascript and css files named after the current controller
|
17
|
+
email: me@timmatheson.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- CHANGELOG
|
24
|
+
- lib/asset_autoinclude_helper.rb
|
25
|
+
- README.rdoc
|
26
|
+
files:
|
27
|
+
- asset_autoinclude_helper.gemspec
|
28
|
+
- CHANGELOG
|
29
|
+
- lib/asset_autoinclude_helper.rb
|
30
|
+
- Manifest
|
31
|
+
- Rakefile
|
32
|
+
- README.rdoc
|
33
|
+
has_rdoc: true
|
34
|
+
homepage: http://github.com/timmatheson/asset_autoinclude_helper
|
35
|
+
post_install_message:
|
36
|
+
rdoc_options:
|
37
|
+
- --line-numbers
|
38
|
+
- --inline-source
|
39
|
+
- --title
|
40
|
+
- Asset_autoinclude_helper
|
41
|
+
- --main
|
42
|
+
- README.rdoc
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: "0"
|
50
|
+
version:
|
51
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: "1.2"
|
56
|
+
version:
|
57
|
+
requirements: []
|
58
|
+
|
59
|
+
rubyforge_project: asset_autoinclude_helper
|
60
|
+
rubygems_version: 1.2.0
|
61
|
+
signing_key:
|
62
|
+
specification_version: 2
|
63
|
+
summary: Automatically includes javascript and css files named after the current controller
|
64
|
+
test_files: []
|
65
|
+
|