weppos-helperful 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +7 -0
- data/Manifest +32 -0
- data/README.rdoc +5 -4
- data/Rakefile +3 -4
- data/helperful.gemspec +9 -9
- data/lib/helperful/asset_tag_helper.rb +78 -0
- data/lib/helperful/version.rb +2 -2
- data/test/asset_tag_helper_test.rb +42 -0
- metadata +8 -4
data/CHANGELOG.rdoc
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
= Changelog
|
2
2
|
|
3
3
|
|
4
|
+
== Release 0.4.0
|
5
|
+
|
6
|
+
* ADDED: javascript and stylesheet AssetTag Helpers.
|
7
|
+
|
8
|
+
* FIXED: GitHub now requires the Manifest file to be included in the repos.
|
9
|
+
|
10
|
+
|
4
11
|
== Release 0.3.1
|
5
12
|
|
6
13
|
* FIXED: #javascript_content_for doesn't properly concat output when called with block (closes #183).
|
data/Manifest
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
CHANGELOG.rdoc
|
2
|
+
helperful.gemspec
|
3
|
+
init.rb
|
4
|
+
install.rb
|
5
|
+
lib/helperful/affiliations_helper.rb
|
6
|
+
lib/helperful/asset_tag_helper.rb
|
7
|
+
lib/helperful/content_helper.rb
|
8
|
+
lib/helperful/deprecations.rb
|
9
|
+
lib/helperful/javascript_helper.rb
|
10
|
+
lib/helperful/title_helper.rb
|
11
|
+
lib/helperful/version.rb
|
12
|
+
lib/helperful.rb
|
13
|
+
LICENSE.rdoc
|
14
|
+
Manifest
|
15
|
+
rails/init.rb
|
16
|
+
Rakefile
|
17
|
+
README.rdoc
|
18
|
+
tasks/helperful_tasks.rake
|
19
|
+
test/affiliations_helper_test.rb
|
20
|
+
test/asset_tag_helper_test.rb
|
21
|
+
test/content_helper_test.rb
|
22
|
+
test/fixtures/content/has_content.html.erb
|
23
|
+
test/fixtures/content/has_content_is_called_alone.html.erb
|
24
|
+
test/fixtures/content/sidebar.html.erb
|
25
|
+
test/fixtures/content/sidebar_concatenate.html.erb
|
26
|
+
test/fixtures/layouts/has_content.html.erb
|
27
|
+
test/fixtures/layouts/sidebar.html.erb
|
28
|
+
test/helperful_test.rb
|
29
|
+
test/javascript_helper_test.rb
|
30
|
+
test/test_helper.rb
|
31
|
+
test/title_helper_test.rb
|
32
|
+
uninstall.rb
|
data/README.rdoc
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Helperful aims to be a collection of useful and reusable Rails helpers.
|
4
4
|
|
5
5
|
|
6
|
-
==
|
6
|
+
== Plugin Installation
|
7
7
|
|
8
8
|
=== As a Gem
|
9
9
|
|
@@ -14,9 +14,6 @@ This is the preferred way to install Helperful and the best way if you want inst
|
|
14
14
|
You can specify the GEM dependency in your application environment.rb file:
|
15
15
|
|
16
16
|
Rails::Initializer.run do |config|
|
17
|
-
|
18
|
-
# other configurations
|
19
|
-
|
20
17
|
config.gem "weppos-helperful", :lib => "helperful", :source => "http://gems.github.com"
|
21
18
|
end
|
22
19
|
|
@@ -96,6 +93,10 @@ Once included, all helper methods are available in the View.
|
|
96
93
|
This is a short description of all available helpers.
|
97
94
|
Please refer to the documentation available at the beginning of any helper file for further details.
|
98
95
|
|
96
|
+
=== Asset Tag Helper
|
97
|
+
|
98
|
+
Provides a set of helpers for generating HTML that links views to assets such as images, javascripts, stylesheets, and feeds.
|
99
|
+
|
99
100
|
=== Affiliations Helper
|
100
101
|
|
101
102
|
Provides a set of helpers for working with online affiliations.
|
data/Rakefile
CHANGED
@@ -1,14 +1,13 @@
|
|
1
|
+
$:.unshift(File.dirname(__FILE__) + "/lib")
|
2
|
+
|
1
3
|
require 'rubygems'
|
2
4
|
require 'rake'
|
3
5
|
require 'echoe'
|
4
|
-
|
5
|
-
$:.unshift(File.dirname(__FILE__) + "/lib")
|
6
6
|
require 'helperful'
|
7
7
|
|
8
8
|
|
9
9
|
PKG_NAME = ENV['PKG_NAME'] || Helperful::GEM
|
10
10
|
PKG_VERSION = ENV['PKG_VERSION'] || Helperful::VERSION
|
11
|
-
PKG_SUMMARY = "A collection of useful Rails helpers."
|
12
11
|
PKG_FILES = FileList.new("{lib,rails,tasks,test}/**/*") do |files|
|
13
12
|
files.include %w(*.{rdoc,rb})
|
14
13
|
files.include %w(Rakefile)
|
@@ -23,7 +22,7 @@ end
|
|
23
22
|
Echoe.new(PKG_NAME, PKG_VERSION) do |p|
|
24
23
|
p.author = "Simone Carletti"
|
25
24
|
p.email = "weppos@weppos.net"
|
26
|
-
p.summary =
|
25
|
+
p.summary = "A collection of useful Rails helpers."
|
27
26
|
p.description = <<-EOD
|
28
27
|
Helperful aims to be a collection of useful and reusable Rails helpers.
|
29
28
|
EOD
|
data/helperful.gemspec
CHANGED
@@ -2,26 +2,26 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{helperful}
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.4.0"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Simone Carletti"]
|
9
|
-
s.date = %q{2009-
|
10
|
-
s.description = %q{Helperful aims to be a collection of useful and reusable Rails helpers.
|
9
|
+
s.date = %q{2009-06-30}
|
10
|
+
s.description = %q{ Helperful aims to be a collection of useful and reusable Rails helpers.
|
11
|
+
}
|
11
12
|
s.email = %q{weppos@weppos.net}
|
12
|
-
s.extra_rdoc_files = ["CHANGELOG.rdoc", "lib/helperful/affiliations_helper.rb", "lib/helperful/content_helper.rb", "lib/helperful/deprecations.rb", "lib/helperful/javascript_helper.rb", "lib/helperful/title_helper.rb", "lib/helperful/version.rb", "lib/helperful.rb", "LICENSE.rdoc", "README.rdoc"]
|
13
|
-
s.files = ["CHANGELOG.rdoc", "helperful.gemspec", "init.rb", "install.rb", "lib/helperful/affiliations_helper.rb", "lib/helperful/content_helper.rb", "lib/helperful/deprecations.rb", "lib/helperful/javascript_helper.rb", "lib/helperful/title_helper.rb", "lib/helperful/version.rb", "lib/helperful.rb", "LICENSE.rdoc", "Manifest", "rails/init.rb", "Rakefile", "README.rdoc", "tasks/helperful_tasks.rake", "test/affiliations_helper_test.rb", "test/content_helper_test.rb", "test/fixtures/content/has_content.html.erb", "test/fixtures/content/has_content_is_called_alone.html.erb", "test/fixtures/content/sidebar.html.erb", "test/fixtures/content/sidebar_concatenate.html.erb", "test/fixtures/layouts/has_content.html.erb", "test/fixtures/layouts/sidebar.html.erb", "test/helperful_test.rb", "test/javascript_helper_test.rb", "test/test_helper.rb", "test/title_helper_test.rb", "uninstall.rb"]
|
14
|
-
s.has_rdoc = true
|
13
|
+
s.extra_rdoc_files = ["CHANGELOG.rdoc", "lib/helperful/affiliations_helper.rb", "lib/helperful/asset_tag_helper.rb", "lib/helperful/content_helper.rb", "lib/helperful/deprecations.rb", "lib/helperful/javascript_helper.rb", "lib/helperful/title_helper.rb", "lib/helperful/version.rb", "lib/helperful.rb", "LICENSE.rdoc", "README.rdoc"]
|
14
|
+
s.files = ["CHANGELOG.rdoc", "helperful.gemspec", "init.rb", "install.rb", "lib/helperful/affiliations_helper.rb", "lib/helperful/asset_tag_helper.rb", "lib/helperful/content_helper.rb", "lib/helperful/deprecations.rb", "lib/helperful/javascript_helper.rb", "lib/helperful/title_helper.rb", "lib/helperful/version.rb", "lib/helperful.rb", "LICENSE.rdoc", "Manifest", "rails/init.rb", "Rakefile", "README.rdoc", "tasks/helperful_tasks.rake", "test/affiliations_helper_test.rb", "test/asset_tag_helper_test.rb", "test/content_helper_test.rb", "test/fixtures/content/has_content.html.erb", "test/fixtures/content/has_content_is_called_alone.html.erb", "test/fixtures/content/sidebar.html.erb", "test/fixtures/content/sidebar_concatenate.html.erb", "test/fixtures/layouts/has_content.html.erb", "test/fixtures/layouts/sidebar.html.erb", "test/helperful_test.rb", "test/javascript_helper_test.rb", "test/test_helper.rb", "test/title_helper_test.rb", "uninstall.rb"]
|
15
15
|
s.homepage = %q{http://code.simonecarletti.com/helperful}
|
16
16
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Helperful", "--main", "README.rdoc"]
|
17
17
|
s.require_paths = ["lib"]
|
18
|
-
s.rubygems_version = %q{1.3.
|
18
|
+
s.rubygems_version = %q{1.3.4}
|
19
19
|
s.summary = %q{A collection of useful Rails helpers.}
|
20
|
-
s.test_files = ["test/affiliations_helper_test.rb", "test/content_helper_test.rb", "test/helperful_test.rb", "test/javascript_helper_test.rb", "test/test_helper.rb", "test/title_helper_test.rb"]
|
20
|
+
s.test_files = ["test/affiliations_helper_test.rb", "test/asset_tag_helper_test.rb", "test/content_helper_test.rb", "test/helperful_test.rb", "test/javascript_helper_test.rb", "test/test_helper.rb", "test/title_helper_test.rb"]
|
21
21
|
|
22
22
|
if s.respond_to? :specification_version then
|
23
23
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
24
|
-
s.specification_version =
|
24
|
+
s.specification_version = 3
|
25
25
|
|
26
26
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
27
27
|
s.add_development_dependency(%q<rake>, [">= 0.8"])
|
@@ -0,0 +1,78 @@
|
|
1
|
+
#
|
2
|
+
# = Helperful
|
3
|
+
#
|
4
|
+
# A collection of useful Rails helpers.
|
5
|
+
#
|
6
|
+
#
|
7
|
+
# Category:: Rails
|
8
|
+
# Package:: Helperful
|
9
|
+
# Author:: Simone Carletti <weppos@weppos.net>
|
10
|
+
# Copyright:: 2008-2009 The Authors
|
11
|
+
# License:: MIT License
|
12
|
+
#
|
13
|
+
#--
|
14
|
+
#
|
15
|
+
#++
|
16
|
+
|
17
|
+
|
18
|
+
module Helperful
|
19
|
+
|
20
|
+
#
|
21
|
+
# = Asset Tag Helper
|
22
|
+
#
|
23
|
+
# Provides a set of helpers for generating HTML that links views to assets such
|
24
|
+
# as images, javascripts, stylesheets, and feeds.
|
25
|
+
#
|
26
|
+
# ==== Requirements
|
27
|
+
#
|
28
|
+
# The following requirements are mandatory for this module.
|
29
|
+
# Including this helper will automatically include them unless already included.
|
30
|
+
#
|
31
|
+
# * ActionView::Helpers::AssetTagHelper
|
32
|
+
#
|
33
|
+
module AssetTagHelper
|
34
|
+
|
35
|
+
def self.included(base)
|
36
|
+
base.class_eval do
|
37
|
+
base.included_modules.include?(ActionView::Helpers::AssetTagHelper) || include(ActionView::Helpers::AssetTagHelper)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# Converts given +files+ in javascript include statements
|
42
|
+
# and appends them in the head section of the page.
|
43
|
+
#
|
44
|
+
# ==== Examples
|
45
|
+
#
|
46
|
+
# # in your index.html.erb view
|
47
|
+
# <% javascript :foo, :bar, :cache => "foobar" %>
|
48
|
+
#
|
49
|
+
# # this is equivalent to
|
50
|
+
# <% content_for :head, javascript_include_tag(:foo, :bar, :cache => "foobar") %>
|
51
|
+
#
|
52
|
+
# # in your application
|
53
|
+
# <% yield :head %>
|
54
|
+
#
|
55
|
+
def javascript(*files)
|
56
|
+
content_for(:head, javascript_include_tag(*files))
|
57
|
+
end
|
58
|
+
|
59
|
+
# Converts given +files+ in stylesheet link statements
|
60
|
+
# and appends them in the head section of the page.
|
61
|
+
#
|
62
|
+
# ==== Examples
|
63
|
+
#
|
64
|
+
# # in your index.html.erb view
|
65
|
+
# <% stylesheet :foo, :bar, :cache => "foobar" %>
|
66
|
+
#
|
67
|
+
# # this is equivalent to
|
68
|
+
# <% content_for :head, stylesheet_link_tag(:foo, :bar, :cache => "foobar") %>
|
69
|
+
#
|
70
|
+
# # in your application
|
71
|
+
# <% yield :head %>
|
72
|
+
#
|
73
|
+
def stylesheet(*files)
|
74
|
+
content_for(:head, stylesheet_link_tag(*files))
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
end
|
data/lib/helperful/version.rb
CHANGED
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class AssetTagHelperTest < ActionView::TestCase
|
4
|
+
tests Helperful::AssetTagHelper
|
5
|
+
|
6
|
+
def setup
|
7
|
+
ActionController::Base.perform_caching = false
|
8
|
+
ActionController::Base.asset_host = nil
|
9
|
+
ENV.delete('RAILS_ASSET_ID')
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
JavascriptToTag = {
|
14
|
+
%(javascript) => %(javascript_include_tag),
|
15
|
+
%(javascript(["foo", "bar"])) => %(javascript_include_tag(["foo", "bar"])),
|
16
|
+
%(javascript("foo", "bar")) => %(javascript_include_tag("foo", "bar")),
|
17
|
+
%(javascript("foo", "bar", :cache => true)) => %(javascript_include_tag("foo", "bar", :cache => true)),
|
18
|
+
}
|
19
|
+
|
20
|
+
test "javascript" do
|
21
|
+
JavascriptToTag.each do |method, content|
|
22
|
+
expects(:content_for).with(:head, eval(content))
|
23
|
+
eval(method)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
StylesheetToTag = {
|
29
|
+
%(stylesheet) => %(stylesheet_link_tag),
|
30
|
+
%(stylesheet(["foo", "bar"])) => %(stylesheet_link_tag(["foo", "bar"])),
|
31
|
+
%(stylesheet("foo", "bar")) => %(stylesheet_link_tag("foo", "bar")),
|
32
|
+
%(stylesheet("foo", "bar", :cache => true)) => %(stylesheet_link_tag("foo", "bar", :cache => true)),
|
33
|
+
}
|
34
|
+
|
35
|
+
test "stylesheet" do
|
36
|
+
StylesheetToTag.each do |method, content|
|
37
|
+
expects(:content_for).with(:head, eval(content))
|
38
|
+
eval(method)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: weppos-helperful
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simone Carletti
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-06-30 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -51,6 +51,7 @@ extensions: []
|
|
51
51
|
extra_rdoc_files:
|
52
52
|
- CHANGELOG.rdoc
|
53
53
|
- lib/helperful/affiliations_helper.rb
|
54
|
+
- lib/helperful/asset_tag_helper.rb
|
54
55
|
- lib/helperful/content_helper.rb
|
55
56
|
- lib/helperful/deprecations.rb
|
56
57
|
- lib/helperful/javascript_helper.rb
|
@@ -65,6 +66,7 @@ files:
|
|
65
66
|
- init.rb
|
66
67
|
- install.rb
|
67
68
|
- lib/helperful/affiliations_helper.rb
|
69
|
+
- lib/helperful/asset_tag_helper.rb
|
68
70
|
- lib/helperful/content_helper.rb
|
69
71
|
- lib/helperful/deprecations.rb
|
70
72
|
- lib/helperful/javascript_helper.rb
|
@@ -78,6 +80,7 @@ files:
|
|
78
80
|
- README.rdoc
|
79
81
|
- tasks/helperful_tasks.rake
|
80
82
|
- test/affiliations_helper_test.rb
|
83
|
+
- test/asset_tag_helper_test.rb
|
81
84
|
- test/content_helper_test.rb
|
82
85
|
- test/fixtures/content/has_content.html.erb
|
83
86
|
- test/fixtures/content/has_content_is_called_alone.html.erb
|
@@ -90,7 +93,7 @@ files:
|
|
90
93
|
- test/test_helper.rb
|
91
94
|
- test/title_helper_test.rb
|
92
95
|
- uninstall.rb
|
93
|
-
has_rdoc:
|
96
|
+
has_rdoc: false
|
94
97
|
homepage: http://code.simonecarletti.com/helperful
|
95
98
|
post_install_message:
|
96
99
|
rdoc_options:
|
@@ -119,10 +122,11 @@ requirements: []
|
|
119
122
|
rubyforge_project:
|
120
123
|
rubygems_version: 1.2.0
|
121
124
|
signing_key:
|
122
|
-
specification_version:
|
125
|
+
specification_version: 3
|
123
126
|
summary: A collection of useful Rails helpers.
|
124
127
|
test_files:
|
125
128
|
- test/affiliations_helper_test.rb
|
129
|
+
- test/asset_tag_helper_test.rb
|
126
130
|
- test/content_helper_test.rb
|
127
131
|
- test/helperful_test.rb
|
128
132
|
- test/javascript_helper_test.rb
|