moneypools-sitemap_generator 0.1.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +45 -8
- data/Rakefile +12 -11
- data/VERSION +1 -1
- data/lib/sitemap_generator.rb +10 -1
- data/lib/sitemap_generator/helper.rb +14 -18
- data/lib/sitemap_generator/mapper.rb +0 -1
- data/lib/sitemap_generator/tasks.rb +1 -1
- data/{install.rb → rails/install.rb} +1 -2
- data/{uninstall.rb → rails/uninstall.rb} +0 -0
- data/tasks/sitemap_generator_tasks.rake +54 -33
- data/test/sitemap_generator_test.rb +70 -6
- data/test/test_helper.rb +1 -0
- metadata +8 -39
- data/.autotest +0 -36
- data/.gitignore +0 -2
- data/init.rb +0 -2
- data/sitemap_generator.gemspec +0 -101
- data/test/mock_app/.gitignore +0 -3
- data/test/mock_app/README +0 -243
- data/test/mock_app/Rakefile +0 -10
- data/test/mock_app/config/database.yml +0 -5
- data/test/mock_app/config/locales/en.yml +0 -5
- data/test/mock_app/db/test.sqlite3 +0 -0
- data/test/mock_app/public/index.html +0 -275
- data/test/mock_app/script/console +0 -3
data/README.md
CHANGED
@@ -42,21 +42,40 @@ Other "difficult" Sitemap issues, solved by this plugin:
|
|
42
42
|
Installation
|
43
43
|
=======
|
44
44
|
|
45
|
+
**As a gem**
|
46
|
+
|
47
|
+
1. Add the gem as a dependency in your config/environment.rb
|
48
|
+
|
49
|
+
<code>config.gem 'sitemap_generator', :lib => false, :source => 'http://gemcutter.org'</code>
|
50
|
+
|
51
|
+
2. `$ rake gems:install`
|
52
|
+
|
53
|
+
3. Add the following line to your RAILS_ROOT/Rakefile
|
54
|
+
|
55
|
+
<code>require 'sitemap_generator/tasks' rescue LoadError</code>
|
56
|
+
|
57
|
+
4. `$ rake sitemap:install`
|
58
|
+
|
59
|
+
**As a plugin**
|
60
|
+
|
45
61
|
1. Install plugin as normal
|
46
62
|
|
47
|
-
<code
|
63
|
+
<code>$ ./script/plugin install git://github.com/adamsalter/sitemap_generator.git</code>
|
64
|
+
|
65
|
+
----
|
48
66
|
|
49
|
-
|
67
|
+
Installation should create a 'config/sitemap.rb' file which will contain your logic for generation of the Sitemap files. (If you want to recreate this file manually run `rake sitemap:install`)
|
50
68
|
|
51
|
-
|
69
|
+
You can run `rake sitemap:refresh` as needed to create Sitemap files. This will also ping all the ['major'][sitemap_engines] search engines. (if you want to disable all non-essential output run the rake task thusly `rake -s sitemap:refresh`)
|
52
70
|
|
53
|
-
|
71
|
+
Sitemaps with many urls (100,000+) take quite a long time to generate, so if you need to refresh your Sitemaps regularly you can set the rake task up as a cron job. Most cron agents will only send you an email if there is output from the cron task.
|
54
72
|
|
55
|
-
|
73
|
+
Optionally, you can add the following to your robots.txt file, so that robots can find the sitemap file.
|
56
74
|
|
57
|
-
|
75
|
+
Sitemap: <hostname>/sitemap_index.xml.gz
|
58
76
|
|
59
|
-
|
77
|
+
The robots.txt Sitemap URL should be the complete URL to the Sitemap Index, such as: `http://www.example.org/sitemap_index.xml.gz`
|
78
|
+
|
60
79
|
|
61
80
|
Example 'config/sitemap.rb'
|
62
81
|
==========
|
@@ -106,6 +125,15 @@ Notes
|
|
106
125
|
end
|
107
126
|
end
|
108
127
|
|
128
|
+
3) New Capistrano deploys will remove your Sitemap files, unless you run `rake sitemap:refresh`. The way around this is to create a cap task:
|
129
|
+
|
130
|
+
after "deploy:update_code", "deploy:copy_old_sitemap"
|
131
|
+
|
132
|
+
namespace :deploy do
|
133
|
+
task :copy_old_sitemap do
|
134
|
+
run "if [ -e #{previous_release}/public/sitemap_index.xml.gz ]; then cp #{previous_release}/public/sitemap* #{current_release}/public/; fi"
|
135
|
+
end
|
136
|
+
end
|
109
137
|
|
110
138
|
Known Bugs
|
111
139
|
========
|
@@ -114,6 +142,15 @@ Known Bugs
|
|
114
142
|
- There's no check on the size of a URL which [isn't supposed to exceed 2,048 bytes][sitemaps_xml].
|
115
143
|
- Currently only supports one Sitemap Index file, which can contain 50,000 Sitemap files which can each contain 50,000 urls, so it _only_ supports up to 2,500,000,000 (2.5 billion) urls. I personally have no need of support for more urls, but plugin could be improved to support this.
|
116
144
|
|
145
|
+
Thanks (in no particular order)
|
146
|
+
========
|
147
|
+
|
148
|
+
- [Karl Varga (aka Bear Grylls)](http://github.com/kjvarga)
|
149
|
+
- [Dan Pickett](http://github.com/dpickett)
|
150
|
+
- [Rob Biedenharn](http://github.com/rab)
|
151
|
+
- [Richie Vos](http://github.com/jerryvos)
|
152
|
+
|
153
|
+
|
117
154
|
Follow me on:
|
118
155
|
---------
|
119
156
|
|
@@ -126,6 +163,6 @@ Copyright (c) 2009 Adam @ [Codebright.net][cb], released under the MIT license
|
|
126
163
|
[sitemap_engines]:http://en.wikipedia.org/wiki/Sitemap_index "http://en.wikipedia.org/wiki/Sitemap_index"
|
127
164
|
[sitemaps_org]:http://www.sitemaps.org/protocol.php "http://www.sitemaps.org/protocol.php"
|
128
165
|
[sitemaps_xml]:http://www.sitemaps.org/protocol.php#xmlTagDefinitions "XML Tag Definitions"
|
129
|
-
[sitemap_generator_usage]:http://wiki.github.com/adamsalter/sitemap_generator
|
166
|
+
[sitemap_generator_usage]:http://wiki.github.com/adamsalter/sitemap_generator/sitemapgenerator-usage "http://wiki.github.com/adamsalter/sitemap_generator/sitemapgenerator-usage"
|
130
167
|
[boost_juice]:http://www.boostjuice.com.au/ "Mmmm, sweet, sweet Boost Juice."
|
131
168
|
[cb]:http://codebright.net "http://codebright.net"
|
data/Rakefile
CHANGED
@@ -3,24 +3,25 @@ require 'find'
|
|
3
3
|
|
4
4
|
begin
|
5
5
|
require 'jeweler'
|
6
|
-
Jeweler::Tasks.new do |
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
Jeweler::Tasks.new do |s|
|
7
|
+
s.name = "moneypools-sitemap_generator"
|
8
|
+
s.summary = %Q{Generate 'enterprise-class' Sitemaps for your Rails site using a simple 'Rails Routes'-like DSL and a single Rake task}
|
9
|
+
s.description = %Q{Install as a plugin or Gem to easily generate ['enterprise-class'][enterprise_class] Google Sitemaps for your Rails site, using a simple 'Rails Routes'-like DSL and a single rake task.}
|
10
|
+
s.email = "adam.salter@codebright.net "
|
11
|
+
s.homepage = "http://github.com/adamsalter/sitemap_generator"
|
12
|
+
s.authors = ["Adam Salter"]
|
13
|
+
s.files = FileList["[A-Z]*", "{bin,lib,rails,templates,tasks}/**/*"]
|
14
|
+
# s is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
14
15
|
end
|
15
|
-
|
16
|
+
Jeweler::GemcutterTasks.new
|
16
17
|
rescue LoadError
|
17
|
-
puts "Jeweler (or a dependency) not available. Install it with:
|
18
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
18
19
|
end
|
19
20
|
|
20
21
|
desc 'Default: run unit tests.'
|
21
22
|
task :default => :test
|
22
23
|
|
23
|
-
desc 'Test
|
24
|
+
desc 'Test.'
|
24
25
|
Rake::TestTask.new(:test) do |t|
|
25
26
|
t.libs << 'lib'
|
26
27
|
t.pattern = 'test/**/*_test.rb'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.2
|
data/lib/sitemap_generator.rb
CHANGED
@@ -2,9 +2,18 @@ require 'sitemap_generator/mapper'
|
|
2
2
|
require 'sitemap_generator/link'
|
3
3
|
require 'sitemap_generator/link_set'
|
4
4
|
require 'sitemap_generator/helper'
|
5
|
-
require 'sitemap_generator/tasks'
|
6
5
|
|
7
6
|
module SitemapGenerator
|
7
|
+
class <<self
|
8
|
+
attr_accessor :root, :templates
|
9
|
+
end
|
10
|
+
self.root = File.expand_path(File.join(File.dirname(__FILE__), '../'))
|
11
|
+
self.templates = {
|
12
|
+
:sitemap_index => File.join(self.root, 'templates/sitemap_index.builder'),
|
13
|
+
:sitemap_xml => File.join(self.root, 'templates/xml_sitemap.builder'),
|
14
|
+
:sitemap_sample => File.join(self.root, 'templates/sitemap.rb'),
|
15
|
+
}
|
16
|
+
|
8
17
|
Sitemap = LinkSet.new
|
9
18
|
end
|
10
19
|
|
@@ -1,22 +1,18 @@
|
|
1
|
-
require 'action_controller'
|
2
|
-
require 'action_controller/test_process'
|
3
|
-
begin
|
4
|
-
require 'application_controller'
|
5
|
-
rescue LoadError
|
6
|
-
# Rails < 2.3
|
7
|
-
require 'application'
|
8
|
-
end
|
9
|
-
|
10
1
|
module SitemapGenerator
|
11
2
|
module Helper
|
3
|
+
include ActionController::UrlWriter
|
4
|
+
|
5
|
+
def self.included(base)
|
6
|
+
base.class_eval do
|
7
|
+
def self.default_url_options(options = nil)
|
8
|
+
{}
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
12
13
|
def load_sitemap_rb
|
13
|
-
controller = ApplicationController.new
|
14
|
-
controller.request = ActionController::TestRequest.new
|
15
|
-
controller.params = {}
|
16
|
-
controller.send(:initialize_current_url)
|
17
|
-
b = controller.instance_eval{binding}
|
18
14
|
sitemap_mapper_file = File.join(RAILS_ROOT, 'config/sitemap.rb')
|
19
|
-
eval(open(sitemap_mapper_file).read
|
15
|
+
eval(open(sitemap_mapper_file).read)
|
20
16
|
end
|
21
17
|
|
22
18
|
def url_with_hostname(path)
|
@@ -40,11 +36,11 @@ module SitemapGenerator
|
|
40
36
|
begin
|
41
37
|
unless SitemapGenerator::Sitemap.yahoo_app_id == false
|
42
38
|
open(link)
|
43
|
-
puts "Successful ping of #{engine.to_s.titleize}"
|
39
|
+
puts "Successful ping of #{engine.to_s.titleize}" if verbose
|
44
40
|
end
|
45
41
|
rescue Timeout::Error, StandardError => e
|
46
|
-
puts "Ping failed for #{engine.to_s.titleize}: #{e.inspect}"
|
47
|
-
puts <<-END if engine == :yahoo
|
42
|
+
puts "Ping failed for #{engine.to_s.titleize}: #{e.inspect}" if verbose
|
43
|
+
puts <<-END if engine == :yahoo && verbose
|
48
44
|
Yahoo requires an 'AppID' for more than one ping per "timeframe", you can either:
|
49
45
|
- remove yahoo from the ping list (config/sitemap.rb):
|
50
46
|
SitemapGenerator::Sitemap.yahoo_app_id = false
|
@@ -1 +1 @@
|
|
1
|
-
load
|
1
|
+
load File.expand_path(File.join(File.dirname(__FILE__), '../../tasks/sitemap_generator_tasks.rake'))
|
@@ -2,8 +2,7 @@
|
|
2
2
|
|
3
3
|
# Copy sitemap_template.rb to config/sitemap.rb
|
4
4
|
require 'fileutils'
|
5
|
-
|
6
|
-
sitemap_template = File.join(current_dir, 'templates/sitemap.rb')
|
5
|
+
sitemap_template = File.join(File.dirname(__FILE__), '../templates/sitemap.rb')
|
7
6
|
new_sitemap = File.join(RAILS_ROOT, 'config/sitemap.rb')
|
8
7
|
if File.exist?(new_sitemap)
|
9
8
|
puts "already exists: config/sitemap.rb, file not copied"
|
File without changes
|
@@ -1,32 +1,25 @@
|
|
1
1
|
require 'zlib'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
desc "Install a default config/sitemap.rb file"
|
6
|
-
task :install do
|
7
|
-
load File.expand_path(File.join(File.dirname(__FILE__), "..", "install.rb"))
|
8
|
-
end
|
3
|
+
class SiteMapRefreshTask < Rake::Task
|
4
|
+
include SitemapGenerator::Helper
|
9
5
|
|
10
|
-
|
11
|
-
|
12
|
-
sitemap_files = Dir[File.join(RAILS_ROOT, 'public/sitemap*.xml.gz')]
|
13
|
-
FileUtils.rm sitemap_files
|
14
|
-
end
|
15
|
-
|
16
|
-
desc "Create Sitemap XML files in public/ directory"
|
17
|
-
desc "Create Sitemap XML files in public/ directory (set SILENT=true for no output)"
|
18
|
-
task :refresh => ['sitemap:create'] do
|
6
|
+
def execute(*)
|
7
|
+
super
|
19
8
|
ping_search_engines("sitemap_index.xml.gz")
|
20
9
|
end
|
10
|
+
end
|
21
11
|
|
22
|
-
|
23
|
-
|
24
|
-
|
12
|
+
class SiteMapCreateTask < Rake::Task
|
13
|
+
include SitemapGenerator::Helper
|
14
|
+
include ActionView::Helpers::NumberHelper
|
25
15
|
|
26
|
-
|
27
|
-
|
28
|
-
|
16
|
+
def execute(*)
|
17
|
+
super
|
18
|
+
build_files
|
19
|
+
end
|
29
20
|
|
21
|
+
private
|
22
|
+
def build_files
|
30
23
|
start_time = Time.now
|
31
24
|
|
32
25
|
# update links from config/sitemap.rb
|
@@ -34,41 +27,69 @@ namespace :sitemap do
|
|
34
27
|
|
35
28
|
raise(ArgumentError, "Default hostname not defined") if SitemapGenerator::Sitemap.default_host.blank?
|
36
29
|
|
37
|
-
links_grps = SitemapGenerator::Sitemap.links.in_groups_of(
|
30
|
+
links_grps = SitemapGenerator::Sitemap.links.in_groups_of(50_000, false)
|
38
31
|
raise(ArgumentError, "TOO MANY LINKS!! I really thought 2,500,000,000 links would be enough for anybody!") if links_grps.length > 50000
|
39
32
|
|
40
33
|
Rake::Task['sitemap:clean'].invoke
|
41
34
|
|
42
35
|
# render individual sitemaps
|
36
|
+
sitemap_files = render_sitemap(links_grps)
|
37
|
+
|
38
|
+
# render index
|
39
|
+
render_index(sitemap_files)
|
40
|
+
|
41
|
+
stop_time = Time.now
|
42
|
+
puts "Sitemap stats: #{number_with_delimiter(SitemapGenerator::Sitemap.links.length)} links, " + ("%dm%02ds" % (stop_time - start_time).divmod(60)) if verbose
|
43
|
+
end
|
44
|
+
|
45
|
+
def render_sitemap(links_grps)
|
43
46
|
sitemap_files = []
|
44
|
-
xml_sitemap_template = File.join(File.dirname(__FILE__), '../templates/xml_sitemap.builder')
|
45
47
|
links_grps.each_with_index do |links, index|
|
46
48
|
buffer = ''
|
47
49
|
xml = Builder::XmlMarkup.new(:target=>buffer)
|
48
|
-
eval(open(
|
50
|
+
eval(open(SitemapGenerator.templates[:sitemap_xml]).read, binding)
|
49
51
|
filename = File.join(RAILS_ROOT, "public/sitemap#{index+1}.xml.gz")
|
50
52
|
Zlib::GzipWriter.open(filename) do |gz|
|
51
53
|
gz.write buffer
|
52
54
|
end
|
53
|
-
puts "+ #{filename}" unless ENV['SILENT'].present?
|
54
|
-
puts "** Sitemap too big! The uncompressed size exceeds 10Mb" if (buffer.size > 10 * 1024 * 1024) && ENV['SILENT'].blank?
|
55
55
|
sitemap_files << filename
|
56
|
+
puts "+ #{filename}" if verbose
|
57
|
+
puts "** Sitemap too big! The uncompressed size exceeds 10Mb" if (buffer.size > 10 * 1024 * 1024) && verbose
|
56
58
|
end
|
59
|
+
sitemap_files
|
60
|
+
end
|
57
61
|
|
58
|
-
|
59
|
-
sitemap_index_template = File.join(File.dirname(__FILE__), '../templates/sitemap_index.builder')
|
62
|
+
def render_index(sitemap_files)
|
60
63
|
buffer = ''
|
61
64
|
xml = Builder::XmlMarkup.new(:target=>buffer)
|
62
|
-
eval(open(
|
65
|
+
eval(open(SitemapGenerator.templates[:sitemap_index]).read, binding)
|
63
66
|
filename = File.join(RAILS_ROOT, "public/sitemap_index.xml.gz")
|
64
67
|
Zlib::GzipWriter.open(filename) do |gz|
|
65
68
|
gz.write buffer
|
66
69
|
end
|
67
|
-
|
68
|
-
puts "
|
70
|
+
|
71
|
+
puts "+ #{filename}" if verbose
|
72
|
+
puts "** Sitemap Index too big! The uncompressed size exceeds 10Mb" if (buffer.size > 10 * 1024 * 1024) && verbose
|
73
|
+
end
|
74
|
+
end
|
69
75
|
|
70
|
-
|
71
|
-
|
76
|
+
namespace :sitemap do
|
77
|
+
desc "Install a default config/sitemap.rb file"
|
78
|
+
task :install do
|
79
|
+
load File.expand_path(File.join(File.dirname(__FILE__), "../rails/install.rb"))
|
80
|
+
end
|
72
81
|
|
82
|
+
desc "Delete all Sitemap files in public/ directory"
|
83
|
+
task :clean do
|
84
|
+
sitemap_files = Dir[File.join(RAILS_ROOT, 'public/sitemap*.xml.gz')]
|
85
|
+
FileUtils.rm sitemap_files
|
73
86
|
end
|
87
|
+
|
88
|
+
desc "Create Sitemap XML files in public/ directory (rake -s for no output)"
|
89
|
+
SiteMapRefreshTask.define_task :refresh => ['sitemap:create']
|
90
|
+
|
91
|
+
desc "Create Sitemap XML files (don't ping search engines)"
|
92
|
+
task :refresh => ['sitemap:create']
|
93
|
+
|
94
|
+
SiteMapCreateTask.define_task :create => [:environment]
|
74
95
|
end
|
@@ -1,19 +1,83 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/test_helper'
|
2
2
|
|
3
3
|
class SitemapGeneratorTest < Test::Unit::TestCase
|
4
|
-
context "SitemapGenerator Rake
|
5
|
-
|
6
|
-
|
4
|
+
context "SitemapGenerator Rake Tasks" do
|
5
|
+
|
6
|
+
context "when running the clean task" do
|
7
|
+
setup do
|
8
|
+
copy_sitemap_file_to_rails_app
|
9
|
+
FileUtils.touch(File.join(RAILS_ROOT, '/public/sitemap_index.xml.gz'))
|
10
|
+
Rake::Task['sitemap:clean'].invoke
|
11
|
+
end
|
12
|
+
|
13
|
+
should "the sitemap xml files be deleted" do
|
14
|
+
assert !File.exists?(File.join(RAILS_ROOT, '/public/sitemap_index.xml.gz'))
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# For some reason I just couldn't get this to work! It seemed to delete the
|
19
|
+
# file before calling the second *should* assertion.
|
20
|
+
context "when installed to a clean Rails app" do
|
21
|
+
setup do
|
22
|
+
#delete_sitemap_file_from_rails_app
|
23
|
+
#Rake::Task['sitemap:install'].invoke
|
24
|
+
end
|
25
|
+
|
26
|
+
should "a sitemap.rb is created" do
|
27
|
+
#assert File.exists?(File.join(RAILS_ROOT, 'config/sitemap.rb'))
|
28
|
+
end
|
29
|
+
|
30
|
+
should "the sitemap.rb file matches the template" do
|
31
|
+
#assert identical_files?(File.join(RAILS_ROOT, 'config/sitemap.rb'), SitemapGenerator.templates[:sitemap_sample])
|
32
|
+
end
|
7
33
|
end
|
8
34
|
|
9
|
-
|
35
|
+
context "when installed multiple times" do
|
36
|
+
setup do
|
37
|
+
copy_sitemap_file_to_rails_app
|
38
|
+
Rake::Task['sitemap:install'].invoke
|
39
|
+
end
|
40
|
+
|
41
|
+
should "not overwrite existing sitemap.rb file" do
|
42
|
+
assert identical_files?(File.join(File.dirname(__FILE__), '/sitemap.file'), File.join(RAILS_ROOT, '/config/sitemap.rb'))
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context "when sitemap generated" do
|
47
|
+
setup do
|
48
|
+
copy_sitemap_file_to_rails_app
|
49
|
+
Rake::Task['sitemap:refresh'].invoke
|
50
|
+
end
|
51
|
+
|
52
|
+
should "not create sitemap xml files" do
|
53
|
+
assert File.exists?(File.join(RAILS_ROOT, '/public/sitemap_index.xml.gz'))
|
54
|
+
assert File.exists?(File.join(RAILS_ROOT, '/public/sitemap1.xml.gz'))
|
55
|
+
end
|
10
56
|
end
|
11
57
|
end
|
12
|
-
|
58
|
+
|
13
59
|
context "SitemapGenerator library" do
|
60
|
+
setup do
|
61
|
+
copy_sitemap_file_to_rails_app
|
62
|
+
end
|
63
|
+
|
14
64
|
should "be have x elements" do
|
15
|
-
assert_equal SitemapGenerator::Sitemap.links.size
|
65
|
+
assert_equal 14, SitemapGenerator::Sitemap.links.size
|
16
66
|
end
|
17
67
|
end
|
68
|
+
|
69
|
+
def copy_sitemap_file_to_rails_app
|
70
|
+
FileUtils.cp(File.join(File.dirname(__FILE__), '/sitemap.file'), File.join(RAILS_ROOT, '/config/sitemap.rb'))
|
71
|
+
end
|
72
|
+
|
73
|
+
def delete_sitemap_file_from_rails_app
|
74
|
+
FileUtils.remove(File.join(RAILS_ROOT, '/config/sitemap.rb')) rescue nil
|
75
|
+
end
|
76
|
+
|
77
|
+
def identical_files?(first, second)
|
78
|
+
first = open(first, 'r').read
|
79
|
+
second = open(second, 'r').read
|
80
|
+
first == second
|
81
|
+
end
|
18
82
|
end
|
19
83
|
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moneypools-sitemap_generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Salter
|
@@ -9,12 +9,12 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-12-08 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
16
|
-
description:
|
17
|
-
email: "adam@
|
16
|
+
description: Install as a plugin or Gem to easily generate ['enterprise-class'][enterprise_class] Google Sitemaps for your Rails site, using a simple 'Rails Routes'-like DSL and a single rake task.
|
17
|
+
email: "adam.salter@codebright.net "
|
18
18
|
executables: []
|
19
19
|
|
20
20
|
extensions: []
|
@@ -22,55 +22,24 @@ extensions: []
|
|
22
22
|
extra_rdoc_files:
|
23
23
|
- README.md
|
24
24
|
files:
|
25
|
-
- .autotest
|
26
|
-
- .gitignore
|
27
25
|
- MIT-LICENSE
|
28
26
|
- README.md
|
29
27
|
- Rakefile
|
30
28
|
- VERSION
|
31
|
-
- init.rb
|
32
|
-
- install.rb
|
33
29
|
- lib/sitemap_generator.rb
|
34
30
|
- lib/sitemap_generator/helper.rb
|
35
31
|
- lib/sitemap_generator/link.rb
|
36
32
|
- lib/sitemap_generator/link_set.rb
|
37
33
|
- lib/sitemap_generator/mapper.rb
|
38
34
|
- lib/sitemap_generator/tasks.rb
|
39
|
-
-
|
35
|
+
- rails/install.rb
|
36
|
+
- rails/uninstall.rb
|
40
37
|
- tasks/sitemap_generator_tasks.rake
|
41
38
|
- templates/sitemap.rb
|
42
39
|
- templates/sitemap_index.builder
|
43
40
|
- templates/xml_sitemap.builder
|
44
|
-
- test/mock_app/.gitignore
|
45
|
-
- test/mock_app/README
|
46
|
-
- test/mock_app/Rakefile
|
47
|
-
- test/mock_app/app/controllers/application_controller.rb
|
48
|
-
- test/mock_app/app/controllers/contents_controller.rb
|
49
|
-
- test/mock_app/app/models/content.rb
|
50
|
-
- test/mock_app/config/boot.rb
|
51
|
-
- test/mock_app/config/database.yml
|
52
|
-
- test/mock_app/config/environment.rb
|
53
|
-
- test/mock_app/config/environments/development.rb
|
54
|
-
- test/mock_app/config/environments/production.rb
|
55
|
-
- test/mock_app/config/environments/test.rb
|
56
|
-
- test/mock_app/config/initializers/backtrace_silencers.rb
|
57
|
-
- test/mock_app/config/initializers/inflections.rb
|
58
|
-
- test/mock_app/config/initializers/mime_types.rb
|
59
|
-
- test/mock_app/config/initializers/new_rails_defaults.rb
|
60
|
-
- test/mock_app/config/initializers/session_store.rb
|
61
|
-
- test/mock_app/config/locales/en.yml
|
62
|
-
- test/mock_app/config/routes.rb
|
63
|
-
- test/mock_app/config/sitemap.rb
|
64
|
-
- test/mock_app/db/migrate/20090826121911_create_contents.rb
|
65
|
-
- test/mock_app/db/schema.rb
|
66
|
-
- test/mock_app/db/test.sqlite3
|
67
|
-
- test/mock_app/public/index.html
|
68
|
-
- test/mock_app/script/console
|
69
|
-
- test/sitemap_generator_test.rb
|
70
|
-
- test/test_helper.rb
|
71
|
-
- uninstall.rb
|
72
41
|
has_rdoc: true
|
73
|
-
homepage: http://github.com/adamsalter/sitemap_generator
|
42
|
+
homepage: http://github.com/adamsalter/sitemap_generator
|
74
43
|
licenses: []
|
75
44
|
|
76
45
|
post_install_message:
|
@@ -96,7 +65,7 @@ rubyforge_project:
|
|
96
65
|
rubygems_version: 1.3.5
|
97
66
|
signing_key:
|
98
67
|
specification_version: 3
|
99
|
-
summary:
|
68
|
+
summary: Generate 'enterprise-class' Sitemaps for your Rails site using a simple 'Rails Routes'-like DSL and a single Rake task
|
100
69
|
test_files:
|
101
70
|
- test/mock_app/app/controllers/application_controller.rb
|
102
71
|
- test/mock_app/app/controllers/contents_controller.rb
|
data/.autotest
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
class Autotest
|
2
|
-
##
|
3
|
-
# Convert a path in a string, s, into a class name, changing
|
4
|
-
# underscores to CamelCase, etc.
|
5
|
-
|
6
|
-
def path_to_classname(s)
|
7
|
-
sep = File::SEPARATOR
|
8
|
-
f = s.sub(/^test#{sep}/, '').sub(/\.rb$/, '').split(sep)
|
9
|
-
f = f.map { |path| path.split(/_|(\d+)/).map { |seg| seg.capitalize }.join }
|
10
|
-
f = f.map { |path| path =~ /Test$/ ? path : "#{path}Test" }
|
11
|
-
f.join('::')
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
Autotest.add_hook :initialize do |at|
|
16
|
-
unless ARGV.empty?
|
17
|
-
if ARGV[0] == '-d'
|
18
|
-
at.find_directories = ARGV[1..-1].dup
|
19
|
-
else
|
20
|
-
at.find_directories = []
|
21
|
-
at.extra_files = ARGV.dup
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
# doesn't seem to work
|
26
|
-
# at.clear_mappings
|
27
|
-
|
28
|
-
at.add_mapping(/^lib\/.*\.rb$/) do |filename, _|
|
29
|
-
possible = File.basename(filename, 'rb').gsub '_', '_?'
|
30
|
-
files_matching %r%^test/.*#{possible}_test\.rb$%
|
31
|
-
end
|
32
|
-
|
33
|
-
at.add_mapping(/^test.*\/.*test\.rb$/) do |filename, _|
|
34
|
-
filename
|
35
|
-
end
|
36
|
-
end
|
data/.gitignore
DELETED
data/init.rb
DELETED
data/sitemap_generator.gemspec
DELETED
@@ -1,101 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{sitemap_generator}
|
8
|
-
s.version = "0.1.0"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Adam Salter"]
|
12
|
-
s.date = %q{2009-10-30}
|
13
|
-
s.description = %q{This plugin enables 'enterprise-class' Google Sitemaps to be easily generated for a Rails site as a rake task}
|
14
|
-
s.email = %q{adam@salter.net }
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"README.md"
|
17
|
-
]
|
18
|
-
s.files = [
|
19
|
-
".autotest",
|
20
|
-
"MIT-LICENSE",
|
21
|
-
"README.md",
|
22
|
-
"Rakefile",
|
23
|
-
"VERSION",
|
24
|
-
"init.rb",
|
25
|
-
"install.rb",
|
26
|
-
"lib/sitemap_generator.rb",
|
27
|
-
"lib/sitemap_generator/helper.rb",
|
28
|
-
"lib/sitemap_generator/link.rb",
|
29
|
-
"lib/sitemap_generator/link_set.rb",
|
30
|
-
"lib/sitemap_generator/mapper.rb",
|
31
|
-
"lib/sitemap_generator/tasks.rb",
|
32
|
-
"tasks/sitemap_generator_tasks.rake",
|
33
|
-
"templates/sitemap.rb",
|
34
|
-
"templates/sitemap_index.builder",
|
35
|
-
"templates/xml_sitemap.builder",
|
36
|
-
"test/mock_app/.gitignore",
|
37
|
-
"test/mock_app/README",
|
38
|
-
"test/mock_app/Rakefile",
|
39
|
-
"test/mock_app/app/controllers/application_controller.rb",
|
40
|
-
"test/mock_app/app/controllers/contents_controller.rb",
|
41
|
-
"test/mock_app/app/models/content.rb",
|
42
|
-
"test/mock_app/config/boot.rb",
|
43
|
-
"test/mock_app/config/database.yml",
|
44
|
-
"test/mock_app/config/environment.rb",
|
45
|
-
"test/mock_app/config/environments/development.rb",
|
46
|
-
"test/mock_app/config/environments/production.rb",
|
47
|
-
"test/mock_app/config/environments/test.rb",
|
48
|
-
"test/mock_app/config/initializers/backtrace_silencers.rb",
|
49
|
-
"test/mock_app/config/initializers/inflections.rb",
|
50
|
-
"test/mock_app/config/initializers/mime_types.rb",
|
51
|
-
"test/mock_app/config/initializers/new_rails_defaults.rb",
|
52
|
-
"test/mock_app/config/initializers/session_store.rb",
|
53
|
-
"test/mock_app/config/locales/en.yml",
|
54
|
-
"test/mock_app/config/routes.rb",
|
55
|
-
"test/mock_app/config/sitemap.rb",
|
56
|
-
"test/mock_app/db/migrate/20090826121911_create_contents.rb",
|
57
|
-
"test/mock_app/db/schema.rb",
|
58
|
-
"test/mock_app/db/test.sqlite3",
|
59
|
-
"test/mock_app/public/index.html",
|
60
|
-
"test/mock_app/script/console",
|
61
|
-
"test/sitemap_generator_test.rb",
|
62
|
-
"test/test_helper.rb",
|
63
|
-
"uninstall.rb"
|
64
|
-
]
|
65
|
-
s.homepage = %q{http://github.com/adamsalter/sitemap_generator-plugin}
|
66
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
67
|
-
s.require_paths = ["lib"]
|
68
|
-
s.rubygems_version = %q{1.3.5}
|
69
|
-
s.summary = %q{This plugin enables 'enterprise-class' Google Sitemaps to be easily generated for a Rails site as a rake task}
|
70
|
-
s.test_files = [
|
71
|
-
"test/mock_app/app/controllers/application_controller.rb",
|
72
|
-
"test/mock_app/app/controllers/contents_controller.rb",
|
73
|
-
"test/mock_app/app/models/content.rb",
|
74
|
-
"test/mock_app/config/boot.rb",
|
75
|
-
"test/mock_app/config/environment.rb",
|
76
|
-
"test/mock_app/config/environments/development.rb",
|
77
|
-
"test/mock_app/config/environments/production.rb",
|
78
|
-
"test/mock_app/config/environments/test.rb",
|
79
|
-
"test/mock_app/config/initializers/backtrace_silencers.rb",
|
80
|
-
"test/mock_app/config/initializers/inflections.rb",
|
81
|
-
"test/mock_app/config/initializers/mime_types.rb",
|
82
|
-
"test/mock_app/config/initializers/new_rails_defaults.rb",
|
83
|
-
"test/mock_app/config/initializers/session_store.rb",
|
84
|
-
"test/mock_app/config/routes.rb",
|
85
|
-
"test/mock_app/config/sitemap.rb",
|
86
|
-
"test/mock_app/db/migrate/20090826121911_create_contents.rb",
|
87
|
-
"test/mock_app/db/schema.rb",
|
88
|
-
"test/sitemap_generator_test.rb",
|
89
|
-
"test/test_helper.rb"
|
90
|
-
]
|
91
|
-
|
92
|
-
if s.respond_to? :specification_version then
|
93
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
94
|
-
s.specification_version = 3
|
95
|
-
|
96
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
97
|
-
else
|
98
|
-
end
|
99
|
-
else
|
100
|
-
end
|
101
|
-
end
|
data/test/mock_app/.gitignore
DELETED
data/test/mock_app/README
DELETED
@@ -1,243 +0,0 @@
|
|
1
|
-
== Welcome to Rails
|
2
|
-
|
3
|
-
Rails is a web-application framework that includes everything needed to create
|
4
|
-
database-backed web applications according to the Model-View-Control pattern.
|
5
|
-
|
6
|
-
This pattern splits the view (also called the presentation) into "dumb" templates
|
7
|
-
that are primarily responsible for inserting pre-built data in between HTML tags.
|
8
|
-
The model contains the "smart" domain objects (such as Account, Product, Person,
|
9
|
-
Post) that holds all the business logic and knows how to persist themselves to
|
10
|
-
a database. The controller handles the incoming requests (such as Save New Account,
|
11
|
-
Update Product, Show Post) by manipulating the model and directing data to the view.
|
12
|
-
|
13
|
-
In Rails, the model is handled by what's called an object-relational mapping
|
14
|
-
layer entitled Active Record. This layer allows you to present the data from
|
15
|
-
database rows as objects and embellish these data objects with business logic
|
16
|
-
methods. You can read more about Active Record in
|
17
|
-
link:files/vendor/rails/activerecord/README.html.
|
18
|
-
|
19
|
-
The controller and view are handled by the Action Pack, which handles both
|
20
|
-
layers by its two parts: Action View and Action Controller. These two layers
|
21
|
-
are bundled in a single package due to their heavy interdependence. This is
|
22
|
-
unlike the relationship between the Active Record and Action Pack that is much
|
23
|
-
more separate. Each of these packages can be used independently outside of
|
24
|
-
Rails. You can read more about Action Pack in
|
25
|
-
link:files/vendor/rails/actionpack/README.html.
|
26
|
-
|
27
|
-
|
28
|
-
== Getting Started
|
29
|
-
|
30
|
-
1. At the command prompt, start a new Rails application using the <tt>rails</tt> command
|
31
|
-
and your application name. Ex: rails myapp
|
32
|
-
2. Change directory into myapp and start the web server: <tt>script/server</tt> (run with --help for options)
|
33
|
-
3. Go to http://localhost:3000/ and get "Welcome aboard: You're riding the Rails!"
|
34
|
-
4. Follow the guidelines to start developing your application
|
35
|
-
|
36
|
-
|
37
|
-
== Web Servers
|
38
|
-
|
39
|
-
By default, Rails will try to use Mongrel if it's are installed when started with script/server, otherwise Rails will use WEBrick, the webserver that ships with Ruby. But you can also use Rails
|
40
|
-
with a variety of other web servers.
|
41
|
-
|
42
|
-
Mongrel is a Ruby-based webserver with a C component (which requires compilation) that is
|
43
|
-
suitable for development and deployment of Rails applications. If you have Ruby Gems installed,
|
44
|
-
getting up and running with mongrel is as easy as: <tt>gem install mongrel</tt>.
|
45
|
-
More info at: http://mongrel.rubyforge.org
|
46
|
-
|
47
|
-
Say other Ruby web servers like Thin and Ebb or regular web servers like Apache or LiteSpeed or
|
48
|
-
Lighttpd or IIS. The Ruby web servers are run through Rack and the latter can either be setup to use
|
49
|
-
FCGI or proxy to a pack of Mongrels/Thin/Ebb servers.
|
50
|
-
|
51
|
-
== Apache .htaccess example for FCGI/CGI
|
52
|
-
|
53
|
-
# General Apache options
|
54
|
-
AddHandler fastcgi-script .fcgi
|
55
|
-
AddHandler cgi-script .cgi
|
56
|
-
Options +FollowSymLinks +ExecCGI
|
57
|
-
|
58
|
-
# If you don't want Rails to look in certain directories,
|
59
|
-
# use the following rewrite rules so that Apache won't rewrite certain requests
|
60
|
-
#
|
61
|
-
# Example:
|
62
|
-
# RewriteCond %{REQUEST_URI} ^/notrails.*
|
63
|
-
# RewriteRule .* - [L]
|
64
|
-
|
65
|
-
# Redirect all requests not available on the filesystem to Rails
|
66
|
-
# By default the cgi dispatcher is used which is very slow
|
67
|
-
#
|
68
|
-
# For better performance replace the dispatcher with the fastcgi one
|
69
|
-
#
|
70
|
-
# Example:
|
71
|
-
# RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
|
72
|
-
RewriteEngine On
|
73
|
-
|
74
|
-
# If your Rails application is accessed via an Alias directive,
|
75
|
-
# then you MUST also set the RewriteBase in this htaccess file.
|
76
|
-
#
|
77
|
-
# Example:
|
78
|
-
# Alias /myrailsapp /path/to/myrailsapp/public
|
79
|
-
# RewriteBase /myrailsapp
|
80
|
-
|
81
|
-
RewriteRule ^$ index.html [QSA]
|
82
|
-
RewriteRule ^([^.]+)$ $1.html [QSA]
|
83
|
-
RewriteCond %{REQUEST_FILENAME} !-f
|
84
|
-
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
|
85
|
-
|
86
|
-
# In case Rails experiences terminal errors
|
87
|
-
# Instead of displaying this message you can supply a file here which will be rendered instead
|
88
|
-
#
|
89
|
-
# Example:
|
90
|
-
# ErrorDocument 500 /500.html
|
91
|
-
|
92
|
-
ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
|
93
|
-
|
94
|
-
|
95
|
-
== Debugging Rails
|
96
|
-
|
97
|
-
Sometimes your application goes wrong. Fortunately there are a lot of tools that
|
98
|
-
will help you debug it and get it back on the rails.
|
99
|
-
|
100
|
-
First area to check is the application log files. Have "tail -f" commands running
|
101
|
-
on the server.log and development.log. Rails will automatically display debugging
|
102
|
-
and runtime information to these files. Debugging info will also be shown in the
|
103
|
-
browser on requests from 127.0.0.1.
|
104
|
-
|
105
|
-
You can also log your own messages directly into the log file from your code using
|
106
|
-
the Ruby logger class from inside your controllers. Example:
|
107
|
-
|
108
|
-
class WeblogController < ActionController::Base
|
109
|
-
def destroy
|
110
|
-
@weblog = Weblog.find(params[:id])
|
111
|
-
@weblog.destroy
|
112
|
-
logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
The result will be a message in your log file along the lines of:
|
117
|
-
|
118
|
-
Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1
|
119
|
-
|
120
|
-
More information on how to use the logger is at http://www.ruby-doc.org/core/
|
121
|
-
|
122
|
-
Also, Ruby documentation can be found at http://www.ruby-lang.org/ including:
|
123
|
-
|
124
|
-
* The Learning Ruby (Pickaxe) Book: http://www.ruby-doc.org/docs/ProgrammingRuby/
|
125
|
-
* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
|
126
|
-
|
127
|
-
These two online (and free) books will bring you up to speed on the Ruby language
|
128
|
-
and also on programming in general.
|
129
|
-
|
130
|
-
|
131
|
-
== Debugger
|
132
|
-
|
133
|
-
Debugger support is available through the debugger command when you start your Mongrel or
|
134
|
-
Webrick server with --debugger. This means that you can break out of execution at any point
|
135
|
-
in the code, investigate and change the model, AND then resume execution!
|
136
|
-
You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
|
137
|
-
Example:
|
138
|
-
|
139
|
-
class WeblogController < ActionController::Base
|
140
|
-
def index
|
141
|
-
@posts = Post.find(:all)
|
142
|
-
debugger
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
|
-
So the controller will accept the action, run the first line, then present you
|
147
|
-
with a IRB prompt in the server window. Here you can do things like:
|
148
|
-
|
149
|
-
>> @posts.inspect
|
150
|
-
=> "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
|
151
|
-
#<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
|
152
|
-
>> @posts.first.title = "hello from a debugger"
|
153
|
-
=> "hello from a debugger"
|
154
|
-
|
155
|
-
...and even better is that you can examine how your runtime objects actually work:
|
156
|
-
|
157
|
-
>> f = @posts.first
|
158
|
-
=> #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
|
159
|
-
>> f.
|
160
|
-
Display all 152 possibilities? (y or n)
|
161
|
-
|
162
|
-
Finally, when you're ready to resume execution, you enter "cont"
|
163
|
-
|
164
|
-
|
165
|
-
== Console
|
166
|
-
|
167
|
-
You can interact with the domain model by starting the console through <tt>script/console</tt>.
|
168
|
-
Here you'll have all parts of the application configured, just like it is when the
|
169
|
-
application is running. You can inspect domain models, change values, and save to the
|
170
|
-
database. Starting the script without arguments will launch it in the development environment.
|
171
|
-
Passing an argument will specify a different environment, like <tt>script/console production</tt>.
|
172
|
-
|
173
|
-
To reload your controllers and models after launching the console run <tt>reload!</tt>
|
174
|
-
|
175
|
-
== dbconsole
|
176
|
-
|
177
|
-
You can go to the command line of your database directly through <tt>script/dbconsole</tt>.
|
178
|
-
You would be connected to the database with the credentials defined in database.yml.
|
179
|
-
Starting the script without arguments will connect you to the development database. Passing an
|
180
|
-
argument will connect you to a different database, like <tt>script/dbconsole production</tt>.
|
181
|
-
Currently works for mysql, postgresql and sqlite.
|
182
|
-
|
183
|
-
== Description of Contents
|
184
|
-
|
185
|
-
app
|
186
|
-
Holds all the code that's specific to this particular application.
|
187
|
-
|
188
|
-
app/controllers
|
189
|
-
Holds controllers that should be named like weblogs_controller.rb for
|
190
|
-
automated URL mapping. All controllers should descend from ApplicationController
|
191
|
-
which itself descends from ActionController::Base.
|
192
|
-
|
193
|
-
app/models
|
194
|
-
Holds models that should be named like post.rb.
|
195
|
-
Most models will descend from ActiveRecord::Base.
|
196
|
-
|
197
|
-
app/views
|
198
|
-
Holds the template files for the view that should be named like
|
199
|
-
weblogs/index.html.erb for the WeblogsController#index action. All views use eRuby
|
200
|
-
syntax.
|
201
|
-
|
202
|
-
app/views/layouts
|
203
|
-
Holds the template files for layouts to be used with views. This models the common
|
204
|
-
header/footer method of wrapping views. In your views, define a layout using the
|
205
|
-
<tt>layout :default</tt> and create a file named default.html.erb. Inside default.html.erb,
|
206
|
-
call <% yield %> to render the view using this layout.
|
207
|
-
|
208
|
-
app/helpers
|
209
|
-
Holds view helpers that should be named like weblogs_helper.rb. These are generated
|
210
|
-
for you automatically when using script/generate for controllers. Helpers can be used to
|
211
|
-
wrap functionality for your views into methods.
|
212
|
-
|
213
|
-
config
|
214
|
-
Configuration files for the Rails environment, the routing map, the database, and other dependencies.
|
215
|
-
|
216
|
-
db
|
217
|
-
Contains the database schema in schema.rb. db/migrate contains all
|
218
|
-
the sequence of Migrations for your schema.
|
219
|
-
|
220
|
-
doc
|
221
|
-
This directory is where your application documentation will be stored when generated
|
222
|
-
using <tt>rake doc:app</tt>
|
223
|
-
|
224
|
-
lib
|
225
|
-
Application specific libraries. Basically, any kind of custom code that doesn't
|
226
|
-
belong under controllers, models, or helpers. This directory is in the load path.
|
227
|
-
|
228
|
-
public
|
229
|
-
The directory available for the web server. Contains subdirectories for images, stylesheets,
|
230
|
-
and javascripts. Also contains the dispatchers and the default HTML files. This should be
|
231
|
-
set as the DOCUMENT_ROOT of your web server.
|
232
|
-
|
233
|
-
script
|
234
|
-
Helper scripts for automation and generation.
|
235
|
-
|
236
|
-
test
|
237
|
-
Unit and functional tests along with fixtures. When using the script/generate scripts, template
|
238
|
-
test files will be generated for you and placed in this directory.
|
239
|
-
|
240
|
-
vendor
|
241
|
-
External libraries that the application depends on. Also includes the plugins subdirectory.
|
242
|
-
If the app has frozen rails, those gems also go here, under vendor/rails/.
|
243
|
-
This directory is in the load path.
|
data/test/mock_app/Rakefile
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
|
-
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
|
-
|
4
|
-
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
|
5
|
-
|
6
|
-
require 'rake'
|
7
|
-
require 'rake/testtask'
|
8
|
-
require 'rake/rdoctask'
|
9
|
-
|
10
|
-
require 'tasks/rails'
|
Binary file
|
@@ -1,275 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
6
|
-
<title>Ruby on Rails: Welcome aboard</title>
|
7
|
-
<style type="text/css" media="screen">
|
8
|
-
body {
|
9
|
-
margin: 0;
|
10
|
-
margin-bottom: 25px;
|
11
|
-
padding: 0;
|
12
|
-
background-color: #f0f0f0;
|
13
|
-
font-family: "Lucida Grande", "Bitstream Vera Sans", "Verdana";
|
14
|
-
font-size: 13px;
|
15
|
-
color: #333;
|
16
|
-
}
|
17
|
-
|
18
|
-
h1 {
|
19
|
-
font-size: 28px;
|
20
|
-
color: #000;
|
21
|
-
}
|
22
|
-
|
23
|
-
a {color: #03c}
|
24
|
-
a:hover {
|
25
|
-
background-color: #03c;
|
26
|
-
color: white;
|
27
|
-
text-decoration: none;
|
28
|
-
}
|
29
|
-
|
30
|
-
|
31
|
-
#page {
|
32
|
-
background-color: #f0f0f0;
|
33
|
-
width: 750px;
|
34
|
-
margin: 0;
|
35
|
-
margin-left: auto;
|
36
|
-
margin-right: auto;
|
37
|
-
}
|
38
|
-
|
39
|
-
#content {
|
40
|
-
float: left;
|
41
|
-
background-color: white;
|
42
|
-
border: 3px solid #aaa;
|
43
|
-
border-top: none;
|
44
|
-
padding: 25px;
|
45
|
-
width: 500px;
|
46
|
-
}
|
47
|
-
|
48
|
-
#sidebar {
|
49
|
-
float: right;
|
50
|
-
width: 175px;
|
51
|
-
}
|
52
|
-
|
53
|
-
#footer {
|
54
|
-
clear: both;
|
55
|
-
}
|
56
|
-
|
57
|
-
|
58
|
-
#header, #about, #getting-started {
|
59
|
-
padding-left: 75px;
|
60
|
-
padding-right: 30px;
|
61
|
-
}
|
62
|
-
|
63
|
-
|
64
|
-
#header {
|
65
|
-
background-image: url("images/rails.png");
|
66
|
-
background-repeat: no-repeat;
|
67
|
-
background-position: top left;
|
68
|
-
height: 64px;
|
69
|
-
}
|
70
|
-
#header h1, #header h2 {margin: 0}
|
71
|
-
#header h2 {
|
72
|
-
color: #888;
|
73
|
-
font-weight: normal;
|
74
|
-
font-size: 16px;
|
75
|
-
}
|
76
|
-
|
77
|
-
|
78
|
-
#about h3 {
|
79
|
-
margin: 0;
|
80
|
-
margin-bottom: 10px;
|
81
|
-
font-size: 14px;
|
82
|
-
}
|
83
|
-
|
84
|
-
#about-content {
|
85
|
-
background-color: #ffd;
|
86
|
-
border: 1px solid #fc0;
|
87
|
-
margin-left: -11px;
|
88
|
-
}
|
89
|
-
#about-content table {
|
90
|
-
margin-top: 10px;
|
91
|
-
margin-bottom: 10px;
|
92
|
-
font-size: 11px;
|
93
|
-
border-collapse: collapse;
|
94
|
-
}
|
95
|
-
#about-content td {
|
96
|
-
padding: 10px;
|
97
|
-
padding-top: 3px;
|
98
|
-
padding-bottom: 3px;
|
99
|
-
}
|
100
|
-
#about-content td.name {color: #555}
|
101
|
-
#about-content td.value {color: #000}
|
102
|
-
|
103
|
-
#about-content.failure {
|
104
|
-
background-color: #fcc;
|
105
|
-
border: 1px solid #f00;
|
106
|
-
}
|
107
|
-
#about-content.failure p {
|
108
|
-
margin: 0;
|
109
|
-
padding: 10px;
|
110
|
-
}
|
111
|
-
|
112
|
-
|
113
|
-
#getting-started {
|
114
|
-
border-top: 1px solid #ccc;
|
115
|
-
margin-top: 25px;
|
116
|
-
padding-top: 15px;
|
117
|
-
}
|
118
|
-
#getting-started h1 {
|
119
|
-
margin: 0;
|
120
|
-
font-size: 20px;
|
121
|
-
}
|
122
|
-
#getting-started h2 {
|
123
|
-
margin: 0;
|
124
|
-
font-size: 14px;
|
125
|
-
font-weight: normal;
|
126
|
-
color: #333;
|
127
|
-
margin-bottom: 25px;
|
128
|
-
}
|
129
|
-
#getting-started ol {
|
130
|
-
margin-left: 0;
|
131
|
-
padding-left: 0;
|
132
|
-
}
|
133
|
-
#getting-started li {
|
134
|
-
font-size: 18px;
|
135
|
-
color: #888;
|
136
|
-
margin-bottom: 25px;
|
137
|
-
}
|
138
|
-
#getting-started li h2 {
|
139
|
-
margin: 0;
|
140
|
-
font-weight: normal;
|
141
|
-
font-size: 18px;
|
142
|
-
color: #333;
|
143
|
-
}
|
144
|
-
#getting-started li p {
|
145
|
-
color: #555;
|
146
|
-
font-size: 13px;
|
147
|
-
}
|
148
|
-
|
149
|
-
|
150
|
-
#search {
|
151
|
-
margin: 0;
|
152
|
-
padding-top: 10px;
|
153
|
-
padding-bottom: 10px;
|
154
|
-
font-size: 11px;
|
155
|
-
}
|
156
|
-
#search input {
|
157
|
-
font-size: 11px;
|
158
|
-
margin: 2px;
|
159
|
-
}
|
160
|
-
#search-text {width: 170px}
|
161
|
-
|
162
|
-
|
163
|
-
#sidebar ul {
|
164
|
-
margin-left: 0;
|
165
|
-
padding-left: 0;
|
166
|
-
}
|
167
|
-
#sidebar ul h3 {
|
168
|
-
margin-top: 25px;
|
169
|
-
font-size: 16px;
|
170
|
-
padding-bottom: 10px;
|
171
|
-
border-bottom: 1px solid #ccc;
|
172
|
-
}
|
173
|
-
#sidebar li {
|
174
|
-
list-style-type: none;
|
175
|
-
}
|
176
|
-
#sidebar ul.links li {
|
177
|
-
margin-bottom: 5px;
|
178
|
-
}
|
179
|
-
|
180
|
-
</style>
|
181
|
-
<script type="text/javascript" src="javascripts/prototype.js"></script>
|
182
|
-
<script type="text/javascript" src="javascripts/effects.js"></script>
|
183
|
-
<script type="text/javascript">
|
184
|
-
function about() {
|
185
|
-
if (Element.empty('about-content')) {
|
186
|
-
new Ajax.Updater('about-content', 'rails/info/properties', {
|
187
|
-
method: 'get',
|
188
|
-
onFailure: function() {Element.classNames('about-content').add('failure')},
|
189
|
-
onComplete: function() {new Effect.BlindDown('about-content', {duration: 0.25})}
|
190
|
-
});
|
191
|
-
} else {
|
192
|
-
new Effect[Element.visible('about-content') ?
|
193
|
-
'BlindUp' : 'BlindDown']('about-content', {duration: 0.25});
|
194
|
-
}
|
195
|
-
}
|
196
|
-
|
197
|
-
window.onload = function() {
|
198
|
-
$('search-text').value = '';
|
199
|
-
$('search').onsubmit = function() {
|
200
|
-
$('search-text').value = 'site:rubyonrails.org ' + $F('search-text');
|
201
|
-
}
|
202
|
-
}
|
203
|
-
</script>
|
204
|
-
</head>
|
205
|
-
<body>
|
206
|
-
<div id="page">
|
207
|
-
<div id="sidebar">
|
208
|
-
<ul id="sidebar-items">
|
209
|
-
<li>
|
210
|
-
<form id="search" action="http://www.google.com/search" method="get">
|
211
|
-
<input type="hidden" name="hl" value="en" />
|
212
|
-
<input type="text" id="search-text" name="q" value="site:rubyonrails.org " />
|
213
|
-
<input type="submit" value="Search" /> the Rails site
|
214
|
-
</form>
|
215
|
-
</li>
|
216
|
-
|
217
|
-
<li>
|
218
|
-
<h3>Join the community</h3>
|
219
|
-
<ul class="links">
|
220
|
-
<li><a href="http://www.rubyonrails.org/">Ruby on Rails</a></li>
|
221
|
-
<li><a href="http://weblog.rubyonrails.org/">Official weblog</a></li>
|
222
|
-
<li><a href="http://wiki.rubyonrails.org/">Wiki</a></li>
|
223
|
-
</ul>
|
224
|
-
</li>
|
225
|
-
|
226
|
-
<li>
|
227
|
-
<h3>Browse the documentation</h3>
|
228
|
-
<ul class="links">
|
229
|
-
<li><a href="http://api.rubyonrails.org/">Rails API</a></li>
|
230
|
-
<li><a href="http://stdlib.rubyonrails.org/">Ruby standard library</a></li>
|
231
|
-
<li><a href="http://corelib.rubyonrails.org/">Ruby core</a></li>
|
232
|
-
<li><a href="http://guides.rubyonrails.org/">Rails Guides</a></li>
|
233
|
-
</ul>
|
234
|
-
</li>
|
235
|
-
</ul>
|
236
|
-
</div>
|
237
|
-
|
238
|
-
<div id="content">
|
239
|
-
<div id="header">
|
240
|
-
<h1>Welcome aboard</h1>
|
241
|
-
<h2>You’re riding Ruby on Rails!</h2>
|
242
|
-
</div>
|
243
|
-
|
244
|
-
<div id="about">
|
245
|
-
<h3><a href="rails/info/properties" onclick="about(); return false">About your application’s environment</a></h3>
|
246
|
-
<div id="about-content" style="display: none"></div>
|
247
|
-
</div>
|
248
|
-
|
249
|
-
<div id="getting-started">
|
250
|
-
<h1>Getting started</h1>
|
251
|
-
<h2>Here’s how to get rolling:</h2>
|
252
|
-
|
253
|
-
<ol>
|
254
|
-
<li>
|
255
|
-
<h2>Use <tt>script/generate</tt> to create your models and controllers</h2>
|
256
|
-
<p>To see all available options, run it without parameters.</p>
|
257
|
-
</li>
|
258
|
-
|
259
|
-
<li>
|
260
|
-
<h2>Set up a default route and remove or rename this file</h2>
|
261
|
-
<p>Routes are set up in config/routes.rb.</p>
|
262
|
-
</li>
|
263
|
-
|
264
|
-
<li>
|
265
|
-
<h2>Create your database</h2>
|
266
|
-
<p>Run <tt>rake db:migrate</tt> to create your database. If you're not using SQLite (the default), edit <tt>config/database.yml</tt> with your username and password.</p>
|
267
|
-
</li>
|
268
|
-
</ol>
|
269
|
-
</div>
|
270
|
-
</div>
|
271
|
-
|
272
|
-
<div id="footer"> </div>
|
273
|
-
</div>
|
274
|
-
</body>
|
275
|
-
</html>
|