Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Let's get rid of Jeweler #22

Closed
wants to merge 2 commits into from

1 participant

@rngtng
Collaborator

Hey Alex
nice to see the work on BigSitemap continuing. I'll try to cherry pick my changes. Let's start with this little nice one:

I don't see any advantage of using jeweler, so let's get rid it and save lot of code. Just make use of 'native gem native for gem maintenance. Use gem build to package and gem push to release

@rngtng rngtng closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
13 Gemfile
@@ -1,14 +1,5 @@
source :rubygems
-gem 'rake'
-gem 'rdoc'
+# Specify your gem's dependencies in big_sitemap.gemspec
+gemspec
-group :development do
- gem 'jeweler'
-end
-
-group :test do
- gem 'shoulda'
- gem 'mocha'
- gem 'nokogiri'
-end
View
18 Gemfile.lock
@@ -1,27 +1,23 @@
+PATH
+ remote: .
+ specs:
+ big_sitemap (1.0.0)
+
GEM
remote: http://rubygems.org/
specs:
- git (1.2.5)
- jeweler (1.6.4)
- bundler (~> 1.0)
- git (>= 1.2.5)
- rake
- json (1.6.1)
mocha (0.9.10)
rake
nokogiri (1.4.4)
rake (0.8.7)
- rdoc (3.11)
- json (~> 1.4)
shoulda (2.11.3)
PLATFORMS
ruby
DEPENDENCIES
- jeweler
+ big_sitemap!
+ bundler
mocha
nokogiri
- rake
- rdoc
shoulda
View
17 Rakefile
@@ -1,19 +1,4 @@
-require 'rake'
-
-begin
- require 'jeweler'
- Jeweler::Tasks.new do |s|
- s.name = "big_sitemap"
- s.summary = %Q{A Sitemap generator specifically designed for large sites (although it works equally well with small sites)}
- s.email = %w(alexrabarts@gmail.com tobi@soundcloud.com)
- s.homepage = "http://github.com/alexrabarts/big_sitemap"
- s.description = "A Sitemap generator specifically designed for large sites (although it works equally well with small sites)"
- s.authors = ["Alex Rabarts", "Tobias Bielohlawek"]
- s.add_dependency 'bundler'
- end
-rescue LoadError
- puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
-end
+require 'bundler/gem_tasks'
require 'rdoc/task'
RDoc::Task.new do |rdoc|
View
1  VERSION
@@ -0,0 +1 @@
+1.0.0
View
5 VERSION.yml
@@ -1,5 +0,0 @@
----
-:major: 1
-:minor: 0
-:patch: 0
-:build:
View
63 big_sitemap.gemspec
@@ -1,59 +1,22 @@
-# Generated by jeweler
-# DO NOT EDIT THIS FILE DIRECTLY
-# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
+$:.push File.expand_path("../lib", __FILE__)
Gem::Specification.new do |s|
- s.name = "big_sitemap"
- s.version = "1.0.0"
+ s.name = "big_sitemap"
+ s.version = File.read('VERSION').strip
+ s.authors = ["Alex Rabarts", "Tobias Bielohlawek"]
+ s.email = ["alexrabarts@gmail.com", "tobi@soundcloud.com"]
+ s.homepage = %q{http://github.com/alexrabarts/big_sitemap}
+ s.summary = %q{A Sitemap generator specifically designed for large sites (although it works equally well with small sites)}
+ s.description = %q{BigSitemap is a Sitemapgenerator suitable for applications with greater than 50,000 URLs. It splits large Sitemaps into multiple files, gzips the files to minimize bandwidth usage, batches database queries to minimize memory usage, supports increment updates, can be set up with just a few lines of code and is compatible with just about any framework.}
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.authors = ["Alex Rabarts", "Tobias Bielohlawek"]
- s.date = "2011-10-24"
- s.description = "A Sitemap generator specifically designed for large sites (although it works equally well with small sites)"
- s.email = ["alexrabarts@gmail.com", "tobi@soundcloud.com"]
- s.extra_rdoc_files = [
- "LICENSE",
- "README.rdoc"
- ]
- s.files = [
- "Gemfile",
- "Gemfile.lock",
- "History.txt",
- "LICENSE",
- "README.rdoc",
- "Rakefile",
- "VERSION.yml",
- "lib/big_sitemap.rb",
- "lib/big_sitemap/builder.rb",
- "test/big_sitemap_test.rb",
- "test/fixtures/test_model.rb",
- "test/test_helper.rb"
- ]
- s.homepage = "http://github.com/alexrabarts/big_sitemap"
+ s.files = `git ls-files`.split("\n")
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
- s.rubygems_version = "1.8.11"
- s.summary = "A Sitemap generator specifically designed for large sites (although it works equally well with small sites)"
- if s.respond_to? :specification_version then
- s.specification_version = 3
-
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
- s.add_runtime_dependency(%q<rake>, [">= 0"])
- s.add_runtime_dependency(%q<rdoc>, [">= 0"])
- s.add_development_dependency(%q<jeweler>, [">= 0"])
- s.add_runtime_dependency(%q<bundler>, [">= 0"])
- else
- s.add_dependency(%q<rake>, [">= 0"])
- s.add_dependency(%q<rdoc>, [">= 0"])
- s.add_dependency(%q<jeweler>, [">= 0"])
- s.add_dependency(%q<bundler>, [">= 0"])
- end
- else
- s.add_dependency(%q<rake>, [">= 0"])
- s.add_dependency(%q<rdoc>, [">= 0"])
- s.add_dependency(%q<jeweler>, [">= 0"])
- s.add_dependency(%q<bundler>, [">= 0"])
+ ["bundler", "shoulda", "mocha", "nokogiri"].each do |gem|
+ s.add_development_dependency *gem.split(' ')
end
end
View
57 test/big_sitemap_test.rb
@@ -335,61 +335,4 @@ def teardown
end
end
end
-
- private
- def generate_sitemap(options={}, &block)
- BigSitemap.generate(options.merge(:base_url => 'http://example.com', :document_root => tmp_dir), &block)
- end
-
- def delete_tmp_files
- Dir["#{sitemaps_dir}/sitemap*"].each do |f|
- FileUtils.rm_rf f
- end
- end
-
- def sitemaps_index_file
- "#{unzipped_sitemaps_index_file}.gz"
- end
-
- def unzipped_sitemaps_index_file
- "#{sitemaps_dir}/sitemap_index.xml"
- end
-
- def unzipped_first_sitemap_file
- "#{sitemaps_dir}/sitemap.xml"
- end
-
- def first_sitemap_file
- "#{sitemaps_dir}/sitemap.xml.gz"
- end
-
- def second_sitemap_file
- "#{sitemaps_dir}/sitemap_1.xml.gz"
- end
-
- def third_sitemap_file
- "#{sitemaps_dir}/sitemap_2.xml.gz"
- end
-
- def sitemaps_dir
- tmp_dir
- end
-
- def tmp_dir
- '/tmp'
- end
-
- def ns
- {'s' => 'http://www.sitemaps.org/schemas/sitemap/0.9'}
- end
-
- def elements(filename, el)
- file_class = filename.include?('.gz') ? Zlib::GzipReader : File
- data = Nokogiri::XML.parse(file_class.open(filename).read)
- data.search("//s:#{el}", ns)
- end
-
- def num_elements(filename, el)
- elements(filename, el).size
- end
end
View
105 test/test_helper.rb
@@ -9,4 +9,109 @@
require 'big_sitemap'
class Test::Unit::TestCase
+
+ def delete_tmp_files
+ FileUtils.rm_rf(sitemaps_dir)
+ end
+
+ def create_files(*files)
+ files.each do |filename|
+ File.open(filename, 'w')
+ end
+ end
+
+ def create_sitemap(options={})
+ @sitemap = BigSitemap.new({
+ :base_url => 'http://example.com',
+ :document_root => tmp_dir,
+ :ping_google => false
+ }.update(options))
+ end
+
+ def generate_sitemap_files(options={})
+ create_sitemap(options)
+ add_model
+ @sitemap.generate
+ end
+
+ def generate_one_sitemap_model_file(options={})
+ change_frequency = options.delete(:change_frequency)
+ priority = options.delete(:priority)
+ create_sitemap(options.merge(:max_per_sitemap => default_num_items, :batch_size => default_num_items))
+ add_model(:change_frequency => change_frequency, :priority => priority)
+ @sitemap.generate
+ end
+
+ def generate_two_model_sitemap_files(options={})
+ change_frequency = options.delete(:change_frequency)
+ priority = options.delete(:priority)
+ create_sitemap(options.merge(:max_per_sitemap => 2, :batch_size => 1))
+ add_model(:num_items => 4, :change_frequency => change_frequency, :priority => priority)
+ @sitemap.generate
+ end
+
+ def add_model(options={})
+ num_items = options.delete(:num_items) || default_num_items
+ TestModel.stubs(:count_for_sitemap).returns(num_items)
+ @sitemap.add(TestModel, options)
+ end
+
+ def default_num_items
+ 10
+ end
+
+ def sitemaps_index_file
+ "#{unzipped_sitemaps_index_file}.gz"
+ end
+
+ def unzipped_sitemaps_index_file
+ "#{sitemaps_dir}/sitemap_index.xml"
+ end
+
+ def unzipped_first_sitemaps_model_file
+ "#{sitemaps_dir}/sitemap_test_models.xml"
+ end
+
+ def first_sitemaps_model_file
+ "#{sitemaps_dir}/sitemap_test_models.xml.gz"
+ end
+
+ def static_sitemaps_file
+ "#{sitemaps_dir}/sitemap_static.xml.gz"
+ end
+
+ def second_sitemaps_model_file
+ "#{sitemaps_dir}/sitemap_test_models_1.xml.gz"
+ end
+
+ def third_sitemaps_model_file
+ "#{sitemaps_dir}/sitemap_test_models_2.xml.gz"
+ end
+
+ def sitemaps_dir
+ "#{tmp_dir}/sitemaps"
+ end
+
+ def tmp_dir
+ '/tmp'
+ end
+
+ def ns
+ {'s' => 'http://www.sitemaps.org/schemas/sitemap/0.9',
+ 'mobile' => 'http://www.google.com/schemas/sitemap-mobile/1.0'}
+ end
+
+ def elements(filename, el, nsp = 's')
+ file_class = filename.include?('.gz') ? Zlib::GzipReader : File
+ data = Nokogiri::XML.parse(file_class.open(filename).read)
+ data.search("//#{nsp}:#{el}", ns)
+ end
+
+ def mobile_elements(filename, el)
+ elements(filename, el, nsp = 'mobile')
+ end
+
+ def num_elements(filename, el)
+ elements(filename, el).size
+ end
end
Something went wrong with that request. Please try again.