copyright_date_range 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.mdown +45 -0
- data/Rakefile +14 -0
- data/copyright_date_range.gemspec +29 -0
- data/lib/copyright_date_range.rb +17 -0
- metadata +72 -0
data/README.mdown
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# CopyrightDateRange
|
2
|
+
|
3
|
+
This is a simple gem that provides a single helper method:
|
4
|
+
|
5
|
+
copyright_date_range(start_year)
|
6
|
+
|
7
|
+
Simply call it in a layout file as such:
|
8
|
+
|
9
|
+
.copyright Copyright © #{copyright_date_range(2011)} MyCoolCompany. All Rights Reserved.
|
10
|
+
|
11
|
+
If it is currently 2012, this will yield:
|
12
|
+
|
13
|
+
Copyright © 2011 - 2012 MyCoolCompany. All Rights Reserved.
|
14
|
+
|
15
|
+
If it is currently 2011, it would simply yield:
|
16
|
+
|
17
|
+
Copyright © 2011 MyCoolCompany. All Rights Reserved.
|
18
|
+
|
19
|
+
# Installation
|
20
|
+
|
21
|
+
You can install this gem by including it in your Gemfile:
|
22
|
+
|
23
|
+
gem 'copyright_date_range', :git => "git://github.com/geckocircle/copyright_date_range.git"
|
24
|
+
|
25
|
+
# License
|
26
|
+
|
27
|
+
Copyright (C) 2012 Dave Rosborough.
|
28
|
+
|
29
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
30
|
+
this software and associated documentation files (the "Software"), to deal in
|
31
|
+
the Software without restriction, including without limitation the rights to
|
32
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
33
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
34
|
+
so, subject to the following conditions:
|
35
|
+
|
36
|
+
The above copyright notice and this permission notice shall be included in all
|
37
|
+
copies or substantial portions of the Software.
|
38
|
+
|
39
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
40
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
41
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
42
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
43
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
44
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
45
|
+
SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'echoe'
|
4
|
+
|
5
|
+
Echoe.new('copyright_date_range', '0.1.1') do |p|
|
6
|
+
p.description = "Generate a copyright date range from a particular year to the current year."
|
7
|
+
p.url = "http://github.com/geckocircle/copyright_date_range"
|
8
|
+
p.author = "Dave Rosborough"
|
9
|
+
p.email = "dave@geckocircle.com"
|
10
|
+
p.ignore_pattern = ["tmp/*", "script/*", "Manifest"]
|
11
|
+
p.development_dependencies = []
|
12
|
+
end
|
13
|
+
|
14
|
+
Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "copyright_date_range"
|
5
|
+
s.version = "0.1.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Dave Rosborough"]
|
9
|
+
s.date = "2012-02-04"
|
10
|
+
s.description = "Generate a copyright date range from a particular year to the current year."
|
11
|
+
s.email = "dave@geckocircle.com"
|
12
|
+
s.extra_rdoc_files = ["README.mdown", "lib/copyright_date_range.rb"]
|
13
|
+
s.files = ["README.mdown", "Rakefile", "copyright_date_range.gemspec", "lib/copyright_date_range.rb"]
|
14
|
+
s.homepage = "http://github.com/geckocircle/copyright_date_range"
|
15
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Copyright_date_range", "--main", "README.mdown"]
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.rubyforge_project = "copyright_date_range"
|
18
|
+
s.rubygems_version = "1.8.15"
|
19
|
+
s.summary = "Generate a copyright date range from a particular year to the current year."
|
20
|
+
|
21
|
+
if s.respond_to? :specification_version then
|
22
|
+
s.specification_version = 3
|
23
|
+
|
24
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
25
|
+
else
|
26
|
+
end
|
27
|
+
else
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module CopyrightDateRangeHelper
|
2
|
+
def copyright_date_range(start_year)
|
3
|
+
if start_year.to_i == 0
|
4
|
+
return Date.today.year
|
5
|
+
end
|
6
|
+
|
7
|
+
if Date.today.year > start_year
|
8
|
+
start_year.to_s + " - " + Date.today.year.to_s
|
9
|
+
else
|
10
|
+
[start_year.to_i, Date.today.year].max.to_s
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class ActionView::Base
|
16
|
+
include CopyrightDateRangeHelper
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: copyright_date_range
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Dave Rosborough
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2012-02-04 00:00:00 -08:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: Generate a copyright date range from a particular year to the current year.
|
22
|
+
email: dave@geckocircle.com
|
23
|
+
executables: []
|
24
|
+
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files:
|
28
|
+
- README.mdown
|
29
|
+
- lib/copyright_date_range.rb
|
30
|
+
files:
|
31
|
+
- README.mdown
|
32
|
+
- Rakefile
|
33
|
+
- copyright_date_range.gemspec
|
34
|
+
- lib/copyright_date_range.rb
|
35
|
+
has_rdoc: true
|
36
|
+
homepage: http://github.com/geckocircle/copyright_date_range
|
37
|
+
licenses: []
|
38
|
+
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options:
|
41
|
+
- --line-numbers
|
42
|
+
- --inline-source
|
43
|
+
- --title
|
44
|
+
- Copyright_date_range
|
45
|
+
- --main
|
46
|
+
- README.mdown
|
47
|
+
require_paths:
|
48
|
+
- lib
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
segments:
|
54
|
+
- 0
|
55
|
+
version: "0"
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
segments:
|
61
|
+
- 1
|
62
|
+
- 2
|
63
|
+
version: "1.2"
|
64
|
+
requirements: []
|
65
|
+
|
66
|
+
rubyforge_project: copyright_date_range
|
67
|
+
rubygems_version: 1.3.6
|
68
|
+
signing_key:
|
69
|
+
specification_version: 3
|
70
|
+
summary: Generate a copyright date range from a particular year to the current year.
|
71
|
+
test_files: []
|
72
|
+
|