crawlable 0.0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Lance Pollard (lancejpollard@gmail.com)
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.markdown ADDED
@@ -0,0 +1,28 @@
1
+ # Crawlable
2
+
3
+ Super DRY Sitemaps for Rails and Sinatra Apps (works on Heroku!)
4
+
5
+ ## Usage
6
+
7
+ ### Install
8
+
9
+ sudo gem install crawlable
10
+
11
+ ### Setup (config/sitemap.rb)
12
+
13
+ Sitemap do |sitemap|
14
+
15
+ sitemap.add posts_path, :priority => 1, :changes => 'daily'
16
+
17
+ Post.all.each do |post|
18
+ sitemap.add posts_path(post), :last_modified => post.updated_at
19
+ end
20
+
21
+ end
22
+
23
+ ## Features
24
+
25
+ - Works on Heroku
26
+
27
+ ## Alternatives
28
+
data/Rakefile ADDED
@@ -0,0 +1,78 @@
1
+ require 'rake'
2
+ require "rake/rdoctask"
3
+ require 'rake/gempackagetask'
4
+
5
+ spec = Gem::Specification.new do |s|
6
+ s.name = "crawlable"
7
+ s.authors = ["Lance Pollard"]
8
+ s.version = "0.0.1.5"
9
+ s.summary = "Crawlable: Super DRY Sitemaps for Rails and Sinatra Apps"
10
+ s.homepage = "http://github.com/viatropos/crawlable"
11
+ s.email = "lancejpollard@gmail.com"
12
+ s.description = "Super DRY Sitemaps for Rails and Sinatra Apps"
13
+ s.has_rdoc = false
14
+ s.rubyforge_project = "crawlable"
15
+ s.platform = Gem::Platform::RUBY
16
+ s.files = %w(README.markdown Rakefile init.rb MIT-LICENSE) + Dir["{lib,rails,test}/**/*"] - Dir["test/tmp"]
17
+ s.require_path = "lib"
18
+ end
19
+
20
+ Rake::GemPackageTask.new(spec) do |pkg|
21
+ pkg.gem_spec = spec
22
+ pkg.package_dir = "pkg"
23
+ end
24
+
25
+ desc 'run unit tests'
26
+ task :test do
27
+ Dir["test/**/*"].each do |file|
28
+ next unless File.basename(file) =~ /test_/
29
+ next unless File.extname(file) == ".rb"
30
+ system "ruby #{file}"
31
+ end
32
+ end
33
+
34
+ desc "Create .gemspec file (useful for github)"
35
+ task :gemspec do
36
+ File.open("pkg/#{spec.name}.gemspec", "w") do |f|
37
+ f.puts spec.to_ruby
38
+ end
39
+ end
40
+
41
+ desc "Build the gem into the current directory"
42
+ task :gem => :gemspec do
43
+ `gem build pkg/#{spec.name}.gemspec`
44
+ end
45
+
46
+ desc "Publish gem to rubygems"
47
+ task :publish => [:package] do
48
+ %x[gem push pkg/#{spec.name}-#{spec.version}.gem]
49
+ end
50
+
51
+ desc "Print a list of the files to be put into the gem"
52
+ task :manifest do
53
+ File.open("Manifest", "w") do |f|
54
+ spec.files.each do |file|
55
+ f.puts file
56
+ end
57
+ end
58
+ end
59
+
60
+ desc "Install the gem locally"
61
+ task :install => [:package] do
62
+ File.mkdir("pkg") unless File.exists?("pkg")
63
+ command = "gem install pkg/#{spec.name}-#{spec.version} --no-ri --no-rdoc"
64
+ command = "sudo #{command}" if ENV["SUDO"] == true
65
+ sh %{#{command}}
66
+ end
67
+
68
+ desc "Generate the rdoc"
69
+ Rake::RDocTask.new do |rdoc|
70
+ files = ["README.markdown", "lib/**/*.rb"]
71
+ rdoc.rdoc_files.add(files)
72
+ rdoc.main = "README.markdown"
73
+ rdoc.title = spec.summary
74
+ end
75
+
76
+ task :yank do
77
+ `gem yank #{spec.name} -v #{spec.version}`
78
+ end
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ File.dirname(__FILE__) + "/rails/init.rb"
data/lib/crawlable.rb ADDED
@@ -0,0 +1,22 @@
1
+ require 'rubygems'
2
+ require 'active_support'
3
+ require 'active_record'
4
+
5
+ this = File.dirname(__FILE__)
6
+ Dir["#{this}/crawlable/*"].each { |c| require c }
7
+
8
+ class Settings
9
+ include Cockpit::Configuration
10
+ end
11
+
12
+ def Sitemap(*args, &block)
13
+ Sitemap.configure(*args, &block)
14
+ end
15
+
16
+ def Crawlable(*args, &block)
17
+ Sitemap(*args, &block)
18
+ end
19
+
20
+ def Crawl(*args, &block)
21
+ Sitemap(*args, &block)
22
+ end
@@ -0,0 +1,12 @@
1
+ module Crawlable
2
+
3
+ def self.included(base)
4
+ base.extend ClassMethods
5
+ end
6
+
7
+ module ClassMethods
8
+ def acts_as_crawlable(*args, &block)
9
+ end
10
+ end
11
+
12
+ end
data/rails/init.rb ADDED
@@ -0,0 +1 @@
1
+ require 'crawlable'
@@ -0,0 +1,18 @@
1
+ require "rubygems"
2
+ require "ruby-debug"
3
+ gem 'test-unit'
4
+ require "test/unit"
5
+ require 'active_support'
6
+ require 'active_support/test_case'
7
+ require 'active_record'
8
+ require 'active_record/fixtures'
9
+ require 'shoulda'
10
+ require 'shoulda/active_record'
11
+
12
+ require File.expand_path(File.join(File.dirname(__FILE__), '/../lib/crawlable'))
13
+
14
+ ActiveRecord::Base.class_eval do
15
+ def self.detonate
16
+ all.map(&:destroy)
17
+ end
18
+ end
@@ -0,0 +1,11 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+
3
+ class SitemapTest < ActiveSupport::TestCase
4
+
5
+ context "Sitemap" do
6
+
7
+
8
+
9
+ end
10
+
11
+ end
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: crawlable
3
+ version: !ruby/object:Gem::Version
4
+ hash: 65
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ - 5
11
+ version: 0.0.1.5
12
+ platform: ruby
13
+ authors:
14
+ - Lance Pollard
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2010-06-19 00:00:00 -07:00
20
+ default_executable:
21
+ dependencies: []
22
+
23
+ description: Super DRY Sitemaps for Rails and Sinatra Apps
24
+ email: lancejpollard@gmail.com
25
+ executables: []
26
+
27
+ extensions: []
28
+
29
+ extra_rdoc_files: []
30
+
31
+ files:
32
+ - README.markdown
33
+ - Rakefile
34
+ - init.rb
35
+ - MIT-LICENSE
36
+ - lib/crawlable/crawlable.rb
37
+ - lib/crawlable.rb
38
+ - rails/init.rb
39
+ - test/test_helper.rb
40
+ - test/test_sitemap.rb
41
+ has_rdoc: true
42
+ homepage: http://github.com/viatropos/crawlable
43
+ licenses: []
44
+
45
+ post_install_message:
46
+ rdoc_options: []
47
+
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ hash: 3
56
+ segments:
57
+ - 0
58
+ version: "0"
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ hash: 3
65
+ segments:
66
+ - 0
67
+ version: "0"
68
+ requirements: []
69
+
70
+ rubyforge_project: crawlable
71
+ rubygems_version: 1.3.7
72
+ signing_key:
73
+ specification_version: 3
74
+ summary: "Crawlable: Super DRY Sitemaps for Rails and Sinatra Apps"
75
+ test_files: []
76
+