sitemap_generator 2.2.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +9 -24
- data/Gemfile.lock +23 -58
- data/README.md +56 -75
- data/Rakefile +29 -117
- data/VERSION +1 -1
- data/lib/sitemap_generator.rb +24 -8
- data/lib/sitemap_generator/application.rb +31 -4
- data/lib/sitemap_generator/builder.rb +0 -6
- data/lib/sitemap_generator/builder/sitemap_file.rb +16 -6
- data/lib/sitemap_generator/builder/sitemap_index_file.rb +4 -3
- data/lib/sitemap_generator/builder/sitemap_index_url.rb +1 -1
- data/lib/sitemap_generator/builder/sitemap_url.rb +6 -8
- data/lib/sitemap_generator/core_ext.rb +3 -0
- data/lib/sitemap_generator/core_ext/big_decimal.rb +45 -0
- data/lib/sitemap_generator/core_ext/numeric.rb +48 -0
- data/lib/sitemap_generator/helpers/number_helper.rb +237 -0
- data/lib/sitemap_generator/interpreter.rb +1 -1
- data/lib/sitemap_generator/link_set.rb +39 -18
- data/lib/sitemap_generator/railtie.rb +2 -2
- data/lib/sitemap_generator/sitemap_namer.rb +1 -1
- data/lib/sitemap_generator/tasks.rb +53 -1
- data/lib/sitemap_generator/utilities.rb +107 -1
- data/lib/tasks/sitemap_generator_tasks.rake +1 -0
- data/spec/blueprint.rb +15 -0
- data/spec/files/sitemap.create.rb +12 -0
- data/spec/files/sitemap.deprecated.rb +13 -0
- data/spec/files/sitemap.groups.rb +37 -0
- data/spec/sitemap_generator/application_spec.rb +69 -0
- data/spec/sitemap_generator/builder/sitemap_file_spec.rb +77 -0
- data/spec/sitemap_generator/builder/sitemap_index_file_spec.rb +38 -0
- data/spec/sitemap_generator/builder/sitemap_index_url_spec.rb +16 -0
- data/spec/sitemap_generator/builder/sitemap_url_spec.rb +152 -0
- data/spec/sitemap_generator/core_ext/bigdecimal_spec.rb +20 -0
- data/spec/sitemap_generator/core_ext/numeric_spec.rb +43 -0
- data/spec/sitemap_generator/geo_sitemap_spec.rb +30 -0
- data/spec/sitemap_generator/helpers/number_helper_spec.rb +191 -0
- data/spec/sitemap_generator/interpreter_spec.rb +24 -0
- data/spec/sitemap_generator/link_set_spec.rb +606 -0
- data/spec/sitemap_generator/news_sitemap_spec.rb +42 -0
- data/spec/sitemap_generator/sitemap_generator_spec.rb +232 -0
- data/spec/sitemap_generator/sitemap_groups_spec.rb +133 -0
- data/spec/sitemap_generator/sitemap_location_spec.rb +124 -0
- data/spec/sitemap_generator/sitemap_namer_spec.rb +61 -0
- data/spec/sitemap_generator/templates_spec.rb +24 -0
- data/spec/sitemap_generator/utilities/existence_spec.rb +26 -0
- data/spec/sitemap_generator/utilities/hash_spec.rb +57 -0
- data/spec/sitemap_generator/utilities/rounding_spec.rb +31 -0
- data/spec/sitemap_generator/utilities_spec.rb +50 -0
- data/spec/sitemap_generator/video_sitemap_spec.rb +103 -0
- data/spec/spec_helper.rb +20 -0
- data/spec/support/file_macros.rb +39 -0
- data/spec/support/schemas/siteindex.xsd +73 -0
- data/spec/support/schemas/sitemap-geo.xsd +41 -0
- data/spec/support/schemas/sitemap-news.xsd +159 -0
- data/spec/support/schemas/sitemap-video.xsd +409 -0
- data/spec/support/schemas/sitemap.xsd +115 -0
- data/spec/support/xml_macros.rb +55 -0
- metadata +141 -122
- data/tasks/sitemap_generator_tasks.rake +0 -43
data/Gemfile
CHANGED
@@ -1,28 +1,13 @@
|
|
1
1
|
source 'http://rubygems.org'
|
2
2
|
|
3
|
+
gem 'builder'
|
3
4
|
gem 'sitemap_generator', :path => './'
|
4
5
|
|
5
|
-
|
6
|
-
gem 'mocha'
|
7
|
-
gem '
|
8
|
-
gem '
|
9
|
-
gem '
|
10
|
-
|
11
|
-
#
|
12
|
-
|
13
|
-
gem 'jeweler', '=1.4.0'
|
14
|
-
gem 'github', '0.4.5' # comment out to test on 1.9; removed in framework_agnostic
|
15
|
-
gem 'gemcutter', '0.6.1'
|
16
|
-
|
17
|
-
# These seem to be dependencies of jeweler or one of the other gems
|
18
|
-
gem 'nokogiri', '1.4.4'
|
19
|
-
gem 'sqlite3-ruby', '1.3.1', :require => 'sqlite3'
|
20
|
-
|
21
|
-
#group :test do
|
22
|
-
# gem 'ruby-debug', '~>0.10'
|
23
|
-
# gem 'ruby-debug-base', '~>0.10'
|
24
|
-
#end
|
25
|
-
# group :test do
|
26
|
-
# gem 'ruby-debug-base19', '0.11.26'
|
27
|
-
# gem 'ruby-debug19'
|
28
|
-
# end
|
6
|
+
group :development, :test do
|
7
|
+
gem 'mocha'
|
8
|
+
gem 'nokogiri'
|
9
|
+
gem 'rake'
|
10
|
+
gem 'rcov'
|
11
|
+
gem 'rspec'
|
12
|
+
# gem 'ruby-debug19', :require => 'ruby-debug'
|
13
|
+
end
|
data/Gemfile.lock
CHANGED
@@ -1,72 +1,37 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ./
|
3
3
|
specs:
|
4
|
-
sitemap_generator (
|
4
|
+
sitemap_generator (3.0.0)
|
5
|
+
builder
|
5
6
|
|
6
7
|
GEM
|
7
8
|
remote: http://rubygems.org/
|
8
9
|
specs:
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
activesupport (= 2.3.8)
|
16
|
-
activeresource (2.3.8)
|
17
|
-
activesupport (= 2.3.8)
|
18
|
-
activesupport (2.3.8)
|
19
|
-
gemcutter (0.6.1)
|
20
|
-
git (1.2.5)
|
21
|
-
github (0.4.5)
|
22
|
-
highline (~> 1.5.1)
|
23
|
-
json (>= 1.2.0)
|
24
|
-
text-format (>= 1.0.0)
|
25
|
-
highline (1.5.2)
|
26
|
-
jeweler (1.4.0)
|
27
|
-
gemcutter (>= 0.1.0)
|
28
|
-
git (>= 1.2.5)
|
29
|
-
rubyforge (>= 2.0.0)
|
30
|
-
json (1.6.2)
|
31
|
-
json_pure (1.5.4)
|
32
|
-
spruz (~> 0.2.8)
|
33
|
-
mocha (0.9.10)
|
34
|
-
rake
|
35
|
-
nokogiri (1.4.4)
|
36
|
-
rack (1.1.2)
|
37
|
-
rails (2.3.8)
|
38
|
-
actionmailer (= 2.3.8)
|
39
|
-
actionpack (= 2.3.8)
|
40
|
-
activerecord (= 2.3.8)
|
41
|
-
activeresource (= 2.3.8)
|
42
|
-
activesupport (= 2.3.8)
|
43
|
-
rake (>= 0.8.3)
|
10
|
+
builder (3.0.0)
|
11
|
+
diff-lcs (1.1.3)
|
12
|
+
metaclass (0.0.1)
|
13
|
+
mocha (0.10.0)
|
14
|
+
metaclass (~> 0.0.1)
|
15
|
+
nokogiri (1.5.0)
|
44
16
|
rake (0.9.2.2)
|
45
|
-
|
46
|
-
rspec
|
47
|
-
|
48
|
-
rspec (~>
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
text-hyphen (~> 1.0.0)
|
55
|
-
text-hyphen (1.0.2)
|
17
|
+
rcov (0.9.11)
|
18
|
+
rspec (2.8.0)
|
19
|
+
rspec-core (~> 2.8.0)
|
20
|
+
rspec-expectations (~> 2.8.0)
|
21
|
+
rspec-mocks (~> 2.8.0)
|
22
|
+
rspec-core (2.8.0)
|
23
|
+
rspec-expectations (2.8.0)
|
24
|
+
diff-lcs (~> 1.1.2)
|
25
|
+
rspec-mocks (2.8.0)
|
56
26
|
|
57
27
|
PLATFORMS
|
58
28
|
ruby
|
59
29
|
|
60
30
|
DEPENDENCIES
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
rails (= 2.3.8)
|
68
|
-
rake (>= 0.8.7)
|
69
|
-
rspec (= 1.3.1)
|
70
|
-
rspec-rails (~> 1.3.2)
|
31
|
+
builder
|
32
|
+
mocha
|
33
|
+
nokogiri
|
34
|
+
rake
|
35
|
+
rcov
|
36
|
+
rspec
|
71
37
|
sitemap_generator!
|
72
|
-
sqlite3-ruby (= 1.3.1)
|
data/README.md
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
SitemapGenerator
|
2
2
|
================
|
3
3
|
|
4
|
-
SitemapGenerator
|
4
|
+
SitemapGenerator is the easiest way to generate Sitemaps in Ruby. Rails integration provides access to the Rails route helpers within your sitemap config file and automatically makes the rake tasks available to you. Or if you prefer to use another framework, you can! You can use the rake tasks provided or run your sitemap configs as plain ruby scripts.
|
5
|
+
|
6
|
+
Sitemaps adhere to the [Sitemap 0.9 protocol][sitemap_protocol] specification.
|
5
7
|
|
6
8
|
Features
|
7
9
|
-------
|
8
10
|
|
11
|
+
- Framework agnostic
|
9
12
|
- Supports [News sitemaps][sitemap_news], [Video sitemaps][sitemap_video], [Image sitemaps][sitemap_images], and [Geo sitemaps][sitemap_geo]
|
10
13
|
- Supports read-only filesystems like Heroku via uploading to a remote host like Amazon S3
|
11
14
|
- Compatible with Rails 2 & 3
|
@@ -16,6 +19,35 @@ Features
|
|
16
19
|
- Ensures your old sitemaps stay in place if the new sitemap fails to generate
|
17
20
|
- Gives you complete control over your sitemaps and their content
|
18
21
|
|
22
|
+
Show Me
|
23
|
+
-------
|
24
|
+
|
25
|
+
Install:
|
26
|
+
|
27
|
+
gem install sitemap_generator
|
28
|
+
|
29
|
+
Create `sitemap.rb`:
|
30
|
+
|
31
|
+
require 'rubygems'
|
32
|
+
require 'sitemap_generator'
|
33
|
+
|
34
|
+
SitemapGenerator::Sitemap.default_host = 'http://example.com'
|
35
|
+
SitemapGenerator::Sitemap.create do
|
36
|
+
add '/home', :changefreq => 'daily', :priority => 0.9
|
37
|
+
add '/contact_us', :changefreq => 'weekly'
|
38
|
+
end
|
39
|
+
|
40
|
+
Run it:
|
41
|
+
|
42
|
+
ruby sitemap.rb
|
43
|
+
|
44
|
+
Output:
|
45
|
+
|
46
|
+
In /Users/karl/projects/sitemap_generator-test/public/
|
47
|
+
+ sitemap1.xml.gz 4 links / 357 Bytes
|
48
|
+
+ sitemap_index.xml.gz 1 sitemaps / 228 Bytes
|
49
|
+
Sitemap stats: 4 links / 1 sitemaps / 0m00s
|
50
|
+
|
19
51
|
Contribute
|
20
52
|
-------
|
21
53
|
|
@@ -26,6 +58,7 @@ Does your website use SitemapGenerator to generate Sitemaps? Where would you be
|
|
26
58
|
Changelog
|
27
59
|
-------
|
28
60
|
|
61
|
+
- **v3.0.0: Framework agnostic**; fix alignment in output, show directory sitemaps are being generated into, only show sitemap compressed file size; toggle output using VERBOSE environment variable; remove tasks/ directory because it's deprecated in Rails 2; Simplify dependencies.
|
29
62
|
- v2.2.1: Support adding new search engines to ping and modifying the default search engines.
|
30
63
|
Allow the URL of the sitemap index to be passed as an argument to `ping_search_engines`. See **Pinging Search Engines**.
|
31
64
|
- v2.1.8: Extend and improve Video Sitemap support. Include sitemap docs in the README, support all element attributes, properly format values.
|
@@ -62,6 +95,17 @@ The canonical repository is now: [http://github.com/kjvarga/sitemap_generator][c
|
|
62
95
|
Install
|
63
96
|
=======
|
64
97
|
|
98
|
+
Ruby
|
99
|
+
-----
|
100
|
+
|
101
|
+
gem install 'sitemap_generator'
|
102
|
+
|
103
|
+
To use the rake tasks add the following to your `Rakefile`:
|
104
|
+
|
105
|
+
require 'sitemap_generator/tasks'
|
106
|
+
|
107
|
+
The Rake tasks expect your sitemap to be at `config/sitemap.rb` but if you need to change that call like so: `rake sitemap:refresh CONFIG_FILE="path/to/sitemap.rb"`
|
108
|
+
|
65
109
|
Rails
|
66
110
|
-----
|
67
111
|
|
@@ -86,6 +130,17 @@ Alternatively, if you are not using a `Gemfile` add the gem to your `config/envi
|
|
86
130
|
Getting Started
|
87
131
|
======
|
88
132
|
|
133
|
+
Preventing Output
|
134
|
+
-----
|
135
|
+
|
136
|
+
To disable all non-essential output set the environment variable `VERBOSE=false` when calling Rake or running your Ruby script.
|
137
|
+
|
138
|
+
Alternatively you can pass the `-s` option to Rake, for example `rake -s sitemap:refresh`.
|
139
|
+
|
140
|
+
To disable output in-code use the following:
|
141
|
+
|
142
|
+
SitemapGenerator.verbose = false
|
143
|
+
|
89
144
|
Rake Tasks
|
90
145
|
-----
|
91
146
|
|
@@ -95,7 +150,6 @@ Run `rake sitemap:refresh` as needed to create or rebuild your sitemap files. S
|
|
95
150
|
|
96
151
|
`rake sitemap:refresh` will output information about each sitemap that is written including its location, how many links it contains and the size of the file.
|
97
152
|
|
98
|
-
**To disable all non-essential output from `rake` run the tasks passing a `-s` option.** For example: `rake -s sitemap:refresh`.
|
99
153
|
|
100
154
|
Pinging Search Engines
|
101
155
|
-----
|
@@ -606,81 +660,8 @@ To add more than one video to a url, pass an array of video hashes using the `:v
|
|
606
660
|
|
607
661
|
* `:thumbnail_loc` - Required, string.
|
608
662
|
|
609
|
-
A URL pointing to the URL for the video thumbnail image file. We can accept most image sizes/types but recommend your thumbs are at least at least 640x480 pixels in .jpg, .png, or. gif formats. The max size is 1920 x 1080 pixels.
|
610
|
-
|
611
|
-
* `:title` - Required, string.
|
612
|
-
|
613
|
-
The title of the video. Limited to 100 characters.
|
614
|
-
|
615
|
-
* `:description` - Required, string.
|
616
|
-
|
617
|
-
The description of the video. Descriptions longer than 2048 characters will be truncated.
|
618
663
|
|
619
|
-
* `:content_loc` - String. **At least one of `player_loc` or `content_loc` is required.**
|
620
664
|
|
621
|
-
The URL should point to a .mpg, .mpeg, .mp4, .m4v, .mov, .wmv, .asf, .avi, .ra, .ram, .rm, .flv, or other video file format, and can be omitted if `:player_loc` is specified. However, because Google needs to be able to check that the Flash object is actually a player for video (as opposed to some other use of Flash, e.g. games and animations), it's helpful to provide both.
|
622
|
-
|
623
|
-
* `:player_loc` - String. **At least one of `player_loc` or `content_loc` is required.**
|
624
|
-
|
625
|
-
A URL pointing to a Flash player for a specific video. In general, this is the information in the src element of an <embed> tag and should not be the same as the content of the <loc> tag. Since each video is uniquely identified by its content URL (the location of the actual video file) or, if a content URL is not present, a player URL (a URL pointing to a player for the video), you must include either the `:player_loc` or `:content_loc` options. If these options are omitted and we can't find this information, we'll be unable to index your video.
|
626
|
-
|
627
|
-
Attributes:
|
628
|
-
* `:allow_embed` - Optional. Values: boolean, or string 'yes' or 'no'. Default: 'yes'.
|
629
|
-
|
630
|
-
Specifies whether Google can embed the video in search results.
|
631
|
-
* `:autoplay` - String, user defined.
|
632
|
-
|
633
|
-
A user-defined string that Google may append (if appropriate) to the flashvars parameter to enable autoplay of the video. For example: <embed src="http://www.example.com/videoplayer.swf?video=123" autoplay="ap=1"/>
|
634
|
-
|
635
|
-
* `:expiration_date` - Recommended. Values: Date, DateTime, Time, ActiveSupport::TimeWithZone or String.
|
636
|
-
|
637
|
-
The date after which the video will no longer be available. Don't supply this information if your video does not expire. Ruby date and time objects will be formatted for you in the appropriate W3C format. However, if you are passing a string, follow these guidelines: acceptable values are complete date (YYYY-MM-DD) and complete date plus hours, minutes and seconds, and timezone (YYYY-MM-DDThh:mm:ss+TZD). For example, 2007-07-16T19:20:30+08:00.
|
638
|
-
|
639
|
-
* `:duration` - Recommended. Integer.
|
640
|
-
|
641
|
-
The duration of the clip in seconds.
|
642
|
-
|
643
|
-
* `:rating` - Optional. The value must be a float or integer between 0.0 and 5.0.
|
644
|
-
|
645
|
-
The rating of the video.
|
646
|
-
|
647
|
-
* `:view_count` - Optional, integer.
|
648
|
-
|
649
|
-
The number of times the video has been viewed.
|
650
|
-
|
651
|
-
* `:publication_date` - Optional. Values: Date, DateTime, Time, ActiveSupport::TimeWithZone or String.
|
652
|
-
|
653
|
-
The date the video was first published. Ruby date and time objects will be formatted for you in the appropriate W3C format. However, if you are passing a string, follow these guidelines: acceptable values are complete date (YYYY-MM-DD) and complete date plus hours, minutes and seconds, and timezone (YYYY-MM-DDThh:mm:ss+TZD). For example, 2007-07-16T19:20:30+08:00.
|
654
|
-
|
655
|
-
* `:family_friendly` - Optional. Values: boolean, or string 'yes' or 'no'.
|
656
|
-
|
657
|
-
Whether the video is suitable for viewing by children. If `No` the video is only available to users with SafeSearch turned off.
|
658
|
-
|
659
|
-
* `:tags` - Optional. A list of one or more string tags. A maximum of 32 tags is permitted.
|
660
|
-
|
661
|
-
* `:tag` - Optional. String. A single tag. If the video has more than one tag, use `:tags`.
|
662
|
-
|
663
|
-
A tag associated with the video. Tags are generally very short descriptions of key concepts associated with a video or piece of content. A single video could have several tags, although it might belong to only one category. For example, a video about grilling food may belong in the Grilling category, but could be tagged "steak", "meat", "summer", and "outdoor".
|
664
|
-
|
665
|
-
* `:category` - Optional, string.
|
666
|
-
|
667
|
-
The video's category. For example, cooking. The value should be a string no longer than 256 characters. In general, categories are broad groupings of content by subject. Usually a video will belong to a single category. For example, a site about cooking could have categories for Broiling, Baking, and Grilling.
|
668
|
-
|
669
|
-
* `:gallery_loc` - Optional, string.
|
670
|
-
|
671
|
-
A link to the gallery (collection of videos) in which this video appears. Only one <video:gallery_loc> tag can be listed for each video.
|
672
|
-
|
673
|
-
Attributes:
|
674
|
-
* `:gallery_title` - Optional, string. The title of the gallery. Sets the `title` attribute of the <video:gallery_loc> tag.
|
675
|
-
|
676
|
-
* `:uploader` - Optional, string.
|
677
|
-
|
678
|
-
A name or handle of the video’s uploader. Only one <video:uploader> is allowed per video.
|
679
|
-
|
680
|
-
Attributes:
|
681
|
-
* `:uploader_info` - Optional, string. Specifies the URL of a webpage with additional information about this uploader. This URL must be on the same domain as the <loc> tag. Sets the `info` attribute of the <video:uploader_info> tag.
|
682
|
-
|
683
|
-
* * *
|
684
665
|
Geo Sitemaps
|
685
666
|
-----------
|
686
667
|
|
data/Rakefile
CHANGED
@@ -1,131 +1,43 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require 'rake'
|
4
|
-
require 'rake/rdoctask'
|
5
|
-
require 'spec/rake/spectask'
|
6
|
-
require 'sitemap_generator/tasks'
|
1
|
+
require 'bundler/setup'
|
2
|
+
Bundler.require
|
7
3
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
gem.homepage = "http://github.com/kjvarga/sitemap_generator"
|
16
|
-
gem.authors = ["Karl Varga", "Adam Salter"]
|
17
|
-
gem.files = FileList["[A-Z]*", "{bin,lib,rails,templates,tasks}/**/*"]
|
18
|
-
gem.test_files = []
|
19
|
-
gem.add_development_dependency "rspec"
|
20
|
-
gem.add_development_dependency "nokogiri"
|
21
|
-
gem.add_development_dependency "sqlite3-ruby"
|
22
|
-
gem.add_development_dependency "jeweler"
|
23
|
-
gem.add_development_dependency "github"
|
24
|
-
gem.add_development_dependency "git"
|
25
|
-
end
|
26
|
-
Jeweler::GemcutterTasks.new
|
27
|
-
rescue LoadError
|
28
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
4
|
+
desc 'Default: run spec tests.'
|
5
|
+
task :default => :spec
|
6
|
+
|
7
|
+
require "rspec/core/rake_task"
|
8
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
9
|
+
spec.pattern = Dir.glob(['spec/sitemap_generator/**/*'])
|
10
|
+
spec.rspec_opts = ['--backtrace']
|
29
11
|
end
|
30
12
|
|
31
13
|
#
|
32
|
-
#
|
14
|
+
# Helpers
|
33
15
|
#
|
34
|
-
module Helpers
|
35
|
-
extend self
|
36
|
-
|
37
|
-
# Return a full local path to path fragment <tt>path</tt>
|
38
|
-
def local_path(path)
|
39
|
-
File.join(File.dirname(__FILE__), path)
|
40
|
-
end
|
41
16
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
cp_r(FileList["[A-Z]*", "{bin,lib,rails,templates,tasks}"], path)
|
47
|
-
end
|
48
|
-
end
|
17
|
+
def name; @name ||= Dir['*.gemspec'].first.split('.').first end
|
18
|
+
def version; File.read('VERSION').chomp end
|
19
|
+
def gemspec_file; "#{name}.gemspec" end
|
20
|
+
def gem_file; "#{name}-#{version}.gem" end
|
49
21
|
|
50
22
|
#
|
51
|
-
# Tasks
|
23
|
+
# Release Tasks
|
24
|
+
# @see https://github.com/mojombo/rakegem
|
52
25
|
#
|
53
|
-
task :default => :test
|
54
|
-
|
55
|
-
desc "Run specs"
|
56
|
-
namespace :test do
|
57
|
-
#desc "Test as a gem, plugin and Rails 3 gem"
|
58
|
-
#task :all => ['test:gem', 'test:plugin']
|
59
|
-
|
60
|
-
desc "Run specs on a gem install"
|
61
|
-
task :gem => ['test:prepare:gem', 'multi_spec']
|
62
|
-
desc "Run specs on a plugin install"
|
63
|
-
task :plugin => ['test:prepare:plugin', 'multi_spec']
|
64
|
-
desc "Run specs on a rails3 install"
|
65
|
-
task :rails3 => ['test:prepare:rails3', 'multi_spec']
|
66
|
-
|
67
|
-
task :multi_spec do
|
68
|
-
Rake::Task['spec'].invoke
|
69
|
-
Rake::Task['spec'].reenable
|
70
|
-
end
|
71
|
-
|
72
|
-
namespace :prepare do
|
73
|
-
desc "Prepare the gem install for testing"
|
74
|
-
task :gem do
|
75
|
-
ENV["SITEMAP_RAILS"] = 'gem'
|
76
|
-
rm_rf(Helpers.local_path('spec/mock_app_gem/public/sitemap*'))
|
77
|
-
end
|
78
26
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
end
|
85
|
-
|
86
|
-
desc "Prepare the rails3 install for testing"
|
87
|
-
task :rails3 do
|
88
|
-
ENV["SITEMAP_RAILS"] = 'rails3'
|
89
|
-
rm_rf(Helpers.local_path('spec/mock_rails3_gem/public/sitemap*'))
|
90
|
-
end
|
27
|
+
desc "Create tag v#{version}, build the gem and push to Git"
|
28
|
+
task :release => :build do
|
29
|
+
unless `git branch` =~ /^\* master$/
|
30
|
+
puts "You must be on the master branch to release!"
|
31
|
+
exit!
|
91
32
|
end
|
33
|
+
sh "git tag v#{version}"
|
34
|
+
sh "git push origin master --tags"
|
92
35
|
end
|
93
36
|
|
94
|
-
desc "
|
95
|
-
task :
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
end
|
101
|
-
|
102
|
-
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
103
|
-
spec.libs << 'lib' << 'spec'
|
104
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
105
|
-
spec.rcov = true
|
106
|
-
end
|
107
|
-
|
108
|
-
desc 'Generate documentation'
|
109
|
-
Rake::RDocTask.new(:rdoc) do |rdoc|
|
110
|
-
rdoc.rdoc_dir = 'rdoc'
|
111
|
-
rdoc.title = 'SitemapGenerator'
|
112
|
-
rdoc.options << '--line-numbers' << '--inline-source'
|
113
|
-
rdoc.rdoc_files.include('README.md')
|
114
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
37
|
+
desc "Build #{gem_file} into the pkg/ directory"
|
38
|
+
task :build do
|
39
|
+
sh "mkdir -p pkg"
|
40
|
+
sh "gem build #{gemspec_file}"
|
41
|
+
sh "mv #{gem_file} pkg"
|
42
|
+
sh "bundle --local"
|
115
43
|
end
|
116
|
-
|
117
|
-
namespace :release do
|
118
|
-
|
119
|
-
desc "Release a new patch version"
|
120
|
-
task :patch do
|
121
|
-
Rake::Task['version:bump:patch'].invoke
|
122
|
-
Rake::Task['release:current'].invoke
|
123
|
-
end
|
124
|
-
|
125
|
-
desc "Release the current version (e.g. after a version bump). This rebuilds the gemspec, pushes the updated code, tags it and releases to RubyGems"
|
126
|
-
task :current do
|
127
|
-
Rake::Task['github:release'].invoke
|
128
|
-
Rake::Task['git:release'].invoke
|
129
|
-
Rake::Task['gemcutter:release'].invoke
|
130
|
-
end
|
131
|
-
end
|