webby 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +7 -0
- data/Manifest.txt +30 -1
- data/Rakefile +6 -2
- data/bin/webby +1 -1
- data/data/Rakefile +6 -2
- data/data/content/{index.rhtml → index.txt} +0 -0
- data/data/tasks/create.rake +6 -1
- data/data/tasks/deploy.rake +22 -0
- data/data/tasks/heel.rake +26 -0
- data/data/tasks/setup.rb +27 -0
- data/lib/webby.rb +20 -12
- data/lib/webby/builder.rb +6 -19
- data/lib/webby/main.rb +85 -15
- data/lib/webby/pages_db.rb +24 -1
- data/lib/webby/renderer.rb +25 -3
- data/lib/webby/resource.rb +89 -13
- data/lib/webby/webby_task.rb +19 -41
- data/tasks/doc.rake +2 -19
- data/tasks/gem.rake +14 -41
- data/tasks/manifest.rake +1 -1
- data/tasks/rubyforge.rake +57 -0
- data/tasks/setup.rb +6 -5
- data/tasks/spec.rake +3 -3
- data/tasks/website.rake +38 -0
- data/website/Rakefile +13 -0
- data/website/content/css/blueprint/lib/buttons.css +112 -0
- data/website/content/css/blueprint/lib/compressed.css +127 -0
- data/website/content/css/blueprint/lib/grid.css +177 -0
- data/website/content/css/blueprint/lib/img/baseline-black.png +0 -0
- data/website/content/css/blueprint/lib/img/baseline.png +0 -0
- data/website/content/css/blueprint/lib/img/grid.png +0 -0
- data/website/content/css/blueprint/lib/img/icons/cross.png +0 -0
- data/website/content/css/blueprint/lib/img/icons/textfield_key.png +0 -0
- data/website/content/css/blueprint/lib/img/icons/tick.png +0 -0
- data/website/content/css/blueprint/lib/reset.css +37 -0
- data/website/content/css/blueprint/lib/typography.css +159 -0
- data/website/content/css/blueprint/print.css +75 -0
- data/website/content/css/blueprint/screen.css +34 -0
- data/website/content/css/site.css +22 -0
- data/website/content/download.txt +8 -0
- data/website/content/index.txt +28 -0
- data/website/content/tutorial.txt +130 -0
- data/website/layouts/default.rhtml +49 -0
- data/website/tasks/create.rake +11 -0
- data/website/tasks/deploy.rake +22 -0
- data/website/tasks/heel.rake +26 -0
- data/website/tasks/setup.rb +27 -0
- data/website/templates/page.erb +8 -0
- metadata +33 -14
data/History.txt
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
== 0.2.0 / 2007-08-28
|
2
|
+
|
3
|
+
* Updated rake tasks for website deployment
|
4
|
+
* Can use 'heel' and 'launchy' for viewing websites
|
5
|
+
* Webby executable can update rake tasks for existing websites
|
6
|
+
* Added more rdoc documentation to classes
|
7
|
+
|
1
8
|
== 0.1.0 / 2007-08-22
|
2
9
|
|
3
10
|
* Birthday!
|
data/Manifest.txt
CHANGED
@@ -20,9 +20,12 @@ data/content/css/blueprint/lib/typography.css
|
|
20
20
|
data/content/css/blueprint/print.css
|
21
21
|
data/content/css/blueprint/screen.css
|
22
22
|
data/content/css/site.css
|
23
|
-
data/content/index.
|
23
|
+
data/content/index.txt
|
24
24
|
data/layouts/default.rhtml
|
25
25
|
data/tasks/create.rake
|
26
|
+
data/tasks/deploy.rake
|
27
|
+
data/tasks/heel.rake
|
28
|
+
data/tasks/setup.rb
|
26
29
|
data/templates/page.erb
|
27
30
|
lib/webby.rb
|
28
31
|
lib/webby/auto_builder.rb
|
@@ -40,5 +43,31 @@ spec/webby/file_spec.rb
|
|
40
43
|
tasks/doc.rake
|
41
44
|
tasks/gem.rake
|
42
45
|
tasks/manifest.rake
|
46
|
+
tasks/rubyforge.rake
|
43
47
|
tasks/setup.rb
|
44
48
|
tasks/spec.rake
|
49
|
+
tasks/website.rake
|
50
|
+
website/Rakefile
|
51
|
+
website/content/css/blueprint/lib/buttons.css
|
52
|
+
website/content/css/blueprint/lib/compressed.css
|
53
|
+
website/content/css/blueprint/lib/grid.css
|
54
|
+
website/content/css/blueprint/lib/img/baseline-black.png
|
55
|
+
website/content/css/blueprint/lib/img/baseline.png
|
56
|
+
website/content/css/blueprint/lib/img/grid.png
|
57
|
+
website/content/css/blueprint/lib/img/icons/cross.png
|
58
|
+
website/content/css/blueprint/lib/img/icons/textfield_key.png
|
59
|
+
website/content/css/blueprint/lib/img/icons/tick.png
|
60
|
+
website/content/css/blueprint/lib/reset.css
|
61
|
+
website/content/css/blueprint/lib/typography.css
|
62
|
+
website/content/css/blueprint/print.css
|
63
|
+
website/content/css/blueprint/screen.css
|
64
|
+
website/content/css/site.css
|
65
|
+
website/content/download.txt
|
66
|
+
website/content/index.txt
|
67
|
+
website/content/tutorial.txt
|
68
|
+
website/layouts/default.rhtml
|
69
|
+
website/tasks/create.rake
|
70
|
+
website/tasks/deploy.rake
|
71
|
+
website/tasks/heel.rake
|
72
|
+
website/tasks/setup.rb
|
73
|
+
website/templates/page.erb
|
data/Rakefile
CHANGED
@@ -4,6 +4,7 @@ require 'rubygems'
|
|
4
4
|
require 'rake'
|
5
5
|
require 'spec'
|
6
6
|
require 'webby'
|
7
|
+
require 'fileutils'
|
7
8
|
load './tasks/setup.rb'
|
8
9
|
|
9
10
|
task :default => 'spec:run'
|
@@ -16,10 +17,13 @@ PROJ.url = 'http://webby.rubyforge.org/'
|
|
16
17
|
PROJ.description = paragraphs_of('README.txt', 3).join("\n\n")
|
17
18
|
PROJ.changes = paragraphs_of('History.txt', 0..1).join("\n\n")
|
18
19
|
PROJ.rubyforge_name = 'webby'
|
19
|
-
|
20
|
+
PROJ.rdoc_dir = 'doc/rdoc'
|
21
|
+
PROJ.rdoc_remote_dir = 'rdoc'
|
20
22
|
PROJ.version = Webby::VERSION
|
21
23
|
|
22
|
-
PROJ.exclude << '^(\.\/|\/)?
|
24
|
+
PROJ.exclude << '^(\.\/|\/)?website/output'
|
25
|
+
PROJ.rdoc_exclude << '^(\.\/|\/)?data'
|
26
|
+
PROJ.rdoc_exclude << '^(\.\/|\/)?website'
|
23
27
|
|
24
28
|
PROJ.spec_opts << '--color'
|
25
29
|
|
data/bin/webby
CHANGED
data/data/Rakefile
CHANGED
File without changes
|
data/data/tasks/create.rake
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
require 'webby'
|
3
3
|
|
4
4
|
Rake::WebbyTask.new do |webby|
|
5
|
-
webby.
|
5
|
+
webby.content_dir = SITE.content_dir
|
6
|
+
webby.output_dir = SITE.output_dir
|
7
|
+
webby.layout_dir = SITE.layout_dir
|
8
|
+
webby.template_dir = SITE.template_dir
|
9
|
+
webby.exclude = SITE.exclude
|
10
|
+
webby.page_defaults = SITE.page_defaults
|
6
11
|
end
|
7
12
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
require 'rake/contrib/sshpublisher'
|
3
|
+
|
4
|
+
namespace :deploy do
|
5
|
+
|
6
|
+
desc 'deploy to the server using rsync'
|
7
|
+
task :rsync do
|
8
|
+
cmd = "rsync #{SITE.rsync_args.join(' ')} "
|
9
|
+
cmd << "#{SITE.output_dir}/ #{SITE.host}:#{SITE.remote_dir}"
|
10
|
+
sh cmd
|
11
|
+
end
|
12
|
+
|
13
|
+
desc 'deploy to the server using ssh'
|
14
|
+
task 'ssh' do
|
15
|
+
Rake::SshDirPublisher.new(
|
16
|
+
SITE.host, SITE.remote_dir, SITE.output_dir
|
17
|
+
).upload
|
18
|
+
end
|
19
|
+
|
20
|
+
end # deploy
|
21
|
+
|
22
|
+
# EOF
|
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
if HAVE_HEEL
|
3
|
+
|
4
|
+
namespace :heel do
|
5
|
+
|
6
|
+
desc 'start the heel server to view website'
|
7
|
+
task :run do
|
8
|
+
sh "heel --root #{SITE.output_dir} --daemonize"
|
9
|
+
end
|
10
|
+
|
11
|
+
desc 'stop the heel server'
|
12
|
+
task :kill do
|
13
|
+
sh "heel --kill"
|
14
|
+
end
|
15
|
+
|
16
|
+
task :autobuild => :run do
|
17
|
+
at_exit {sh "heel --kill"}
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
task :autobuild => 'heel:autobuild'
|
23
|
+
|
24
|
+
end # HAVE_HEEL
|
25
|
+
|
26
|
+
# EOF
|
data/data/tasks/setup.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
require 'ostruct'
|
3
|
+
|
4
|
+
SITE = OpenStruct.new
|
5
|
+
|
6
|
+
SITE.content_dir = 'content'
|
7
|
+
SITE.output_dir = 'output'
|
8
|
+
SITE.layout_dir = 'layouts'
|
9
|
+
SITE.template_dir = 'templates'
|
10
|
+
SITE.exclude = %w[tmp$ bak$ ~$ CVS \.svn]
|
11
|
+
|
12
|
+
SITE.page_defaults = {
|
13
|
+
'extension' => 'html',
|
14
|
+
'layout' => 'default'
|
15
|
+
}
|
16
|
+
|
17
|
+
SITE.host = 'user@hostname.tld'
|
18
|
+
SITE.remote_dir = '/not/a/valid/dir'
|
19
|
+
SITE.rsync_args = %w(-av --delete)
|
20
|
+
|
21
|
+
FileList['tasks/*.rake'].each {|task| import task}
|
22
|
+
|
23
|
+
%w(heel).each do |lib|
|
24
|
+
Object.instance_eval {const_set "HAVE_#{lib.upcase}", try_require(lib)}
|
25
|
+
end
|
26
|
+
|
27
|
+
# EOF
|
data/lib/webby.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
# $Id: webby.rb
|
1
|
+
# $Id: webby.rb 19 2007-08-28 22:48:24Z tim_pease $
|
2
2
|
|
3
3
|
module Webby
|
4
4
|
|
5
|
-
VERSION = '0.
|
5
|
+
VERSION = '0.2.0' # :nodoc:
|
6
6
|
|
7
7
|
# Path to the Webby package
|
8
8
|
PATH = ::File.expand_path(::File.join(::File.dirname(__FILE__), '..'))
|
@@ -29,36 +29,44 @@ module Webby
|
|
29
29
|
# Webby.config => hash
|
30
30
|
#
|
31
31
|
# Returns the configuration hash for the Webby application.
|
32
|
-
|
33
|
-
# The defaults are defined in the lib/webby/webby_task.rb file
|
34
|
-
#++
|
32
|
+
#
|
35
33
|
def self.config
|
36
|
-
@config ||= {
|
34
|
+
@config ||= {
|
35
|
+
'output_dir' => 'output',
|
36
|
+
'content_dir' => 'content',
|
37
|
+
'layout_dir' => 'layouts',
|
38
|
+
'template_dir' => 'templates',
|
39
|
+
'exclude' => %w(tmp$ bak$ ~$ CVS \.svn)
|
40
|
+
}
|
37
41
|
end
|
38
42
|
|
39
43
|
# call-seq:
|
40
44
|
# Webby.page_defaults => hash
|
41
45
|
#
|
42
46
|
# Returns the page defaults hash used for page resource objects.
|
43
|
-
|
44
|
-
# The defaults are defined in the lib/webby/webby_task.rb file
|
45
|
-
#++
|
47
|
+
#
|
46
48
|
def self.page_defaults
|
47
|
-
@page_defaults ||= {
|
49
|
+
@page_defaults ||= {
|
50
|
+
'extension' => 'html',
|
51
|
+
'layout' => 'default'
|
52
|
+
}
|
48
53
|
end
|
49
54
|
|
50
55
|
end # module Webby
|
51
56
|
|
52
57
|
|
53
58
|
# call-seq:
|
54
|
-
# try_require( library )
|
59
|
+
# try_require( library ) => true or false
|
55
60
|
#
|
56
61
|
# Try to laod the given _library_ using the built-in require, but do not
|
57
|
-
# raise a LoadError if unsuccessful.
|
62
|
+
# raise a LoadError if unsuccessful. Returns +true+ if the _library_ was
|
63
|
+
# successfully loaded; returns +false+ otherwise.
|
58
64
|
#
|
59
65
|
def try_require( lib )
|
60
66
|
require lib
|
67
|
+
true
|
61
68
|
rescue LoadError
|
69
|
+
false
|
62
70
|
end
|
63
71
|
|
64
72
|
|
data/lib/webby/builder.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# $Id: builder.rb
|
1
|
+
# $Id: builder.rb 16 2007-08-25 19:55:00Z tim_pease $
|
2
2
|
|
3
3
|
require 'find'
|
4
4
|
require 'fileutils'
|
@@ -77,8 +77,7 @@ class Builder
|
|
77
77
|
FileUtils.mkdir output_dir
|
78
78
|
end
|
79
79
|
|
80
|
-
|
81
|
-
load_content
|
80
|
+
load_files
|
82
81
|
|
83
82
|
Resource.pages.each do |page|
|
84
83
|
next unless page.dirty? or opts[:rebuild]
|
@@ -111,13 +110,13 @@ class Builder
|
|
111
110
|
|
112
111
|
private
|
113
112
|
|
114
|
-
# Scan the <code>layouts/</code> folder and
|
115
|
-
# for each file found there.
|
113
|
+
# Scan the <code>layouts/</code> folder and the <code>content/</code>
|
114
|
+
# folder and create a new Resource object for each file found there.
|
116
115
|
#
|
117
|
-
def
|
116
|
+
def load_files
|
118
117
|
excl = Regexp.new exclude.join('|')
|
119
118
|
|
120
|
-
::Find.find(layout_dir) do |path|
|
119
|
+
::Find.find(layout_dir, content_dir) do |path|
|
121
120
|
next unless test ?f, path
|
122
121
|
next if path =~ excl
|
123
122
|
Resource.new path
|
@@ -141,18 +140,6 @@ class Builder
|
|
141
140
|
end # each
|
142
141
|
end
|
143
142
|
|
144
|
-
# Scan the <code>content/</code> folder and create a new Resource object
|
145
|
-
# for each file found there.
|
146
|
-
#
|
147
|
-
def load_content
|
148
|
-
excl = Regexp.new exclude.join('|')
|
149
|
-
Find.find(content_dir) do |path|
|
150
|
-
next unless test ?f, path
|
151
|
-
next if path =~ excl
|
152
|
-
Resource.new path, ::Webby.page_defaults
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
143
|
%w(output_dir layout_dir content_dir exclude).each do |key|
|
157
144
|
self.class_eval <<-CODE
|
158
145
|
def #{key}( ) ::Webby.config['#{key}'] end
|
data/lib/webby/main.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
-
# $Id: main.rb
|
1
|
+
# $Id: main.rb 20 2007-08-28 23:24:14Z tim_pease $
|
2
2
|
|
3
3
|
require 'fileutils'
|
4
4
|
require 'find'
|
5
|
+
require 'optparse'
|
5
6
|
|
6
7
|
module Webby
|
7
8
|
|
@@ -16,40 +17,97 @@ class Main
|
|
16
17
|
# Directory where the prototype Webby website can be found
|
17
18
|
attr_accessor :data
|
18
19
|
|
20
|
+
# Flag used to update an existing website
|
21
|
+
attr_accessor :update
|
22
|
+
|
19
23
|
# call-seq:
|
20
|
-
# Main.run(
|
24
|
+
# Main.run( args ) => nil
|
21
25
|
#
|
22
26
|
# Create a new instance of Main, and run the +webby+ application given the
|
23
27
|
# command line _args_.
|
24
28
|
#
|
25
|
-
def self.run(
|
26
|
-
self.new
|
29
|
+
def self.run( args )
|
30
|
+
m = self.new
|
31
|
+
m.parse args
|
32
|
+
|
33
|
+
if m.update then m.update_site
|
34
|
+
else m.create_site end
|
27
35
|
end
|
28
36
|
|
29
37
|
# call-seq:
|
30
|
-
#
|
38
|
+
# parse( args ) => nil
|
31
39
|
#
|
32
|
-
#
|
40
|
+
# Parse the command line arguments and store the values for later use by
|
41
|
+
# the create_site and update_site methods.
|
33
42
|
#
|
34
|
-
def
|
35
|
-
abort "Usage: #{$0} /path/to/your/site" unless args.length == 1
|
36
|
-
|
37
|
-
self.site = args.at 0
|
43
|
+
def parse( args )
|
38
44
|
self.data = File.join(::Webby::PATH, 'data')
|
45
|
+
self.update = false
|
46
|
+
|
47
|
+
opts = OptionParser.new
|
48
|
+
opts.banner << ' site'
|
49
|
+
|
50
|
+
opts.separator ''
|
51
|
+
opts.on('-u', '--update',
|
52
|
+
'update the rake tasks for the site') {self.update = true}
|
53
|
+
|
54
|
+
opts.separator ''
|
55
|
+
opts.separator 'common options:'
|
56
|
+
|
57
|
+
opts.on_tail( '-h', '--help', 'show this message' ) {puts opts; exit}
|
58
|
+
opts.on_tail( '--version', 'show version' ) do
|
59
|
+
puts "Webby #{::Webby::VERSION}"
|
60
|
+
exit
|
61
|
+
end
|
62
|
+
|
63
|
+
# parse the command line arguments
|
64
|
+
opts.parse! args
|
65
|
+
self.site = args.shift
|
39
66
|
|
67
|
+
if site.nil?
|
68
|
+
puts opts
|
69
|
+
::Kernel.abort
|
70
|
+
end
|
71
|
+
nil
|
72
|
+
end
|
73
|
+
|
74
|
+
# call-seq:
|
75
|
+
# create_site => nil
|
76
|
+
#
|
77
|
+
# Create a new website.
|
78
|
+
#
|
79
|
+
def create_site
|
40
80
|
# see if the site already exists
|
41
|
-
abort "#{site} already exists" if test ?e, site
|
81
|
+
abort "'#{site}' already exists" if test ?e, site
|
42
82
|
|
43
83
|
# copy over files from the data directory
|
44
84
|
files = site_files
|
45
85
|
|
46
86
|
files.keys.sort.each do |dir|
|
47
87
|
mkdir dir
|
48
|
-
files[dir].each {|file| cp file}
|
88
|
+
files[dir].sort.each {|file| cp file}
|
49
89
|
end
|
50
90
|
nil
|
51
91
|
end
|
52
92
|
|
93
|
+
# call-seq:
|
94
|
+
# update_site => nil
|
95
|
+
#
|
96
|
+
# Update the rake tasks for an existing website.
|
97
|
+
#
|
98
|
+
def update_site
|
99
|
+
# ensure the site already exists
|
100
|
+
abort "'#{site}' does not exist" unless test ?d, site
|
101
|
+
|
102
|
+
# copy over files from the data/tasks directory
|
103
|
+
files = site_files
|
104
|
+
|
105
|
+
mkdir 'tasks'
|
106
|
+
files['tasks'].sort.each {|file| cp file}
|
107
|
+
|
108
|
+
nil
|
109
|
+
end
|
110
|
+
|
53
111
|
# call-seq:
|
54
112
|
# mkdir( dir ) => nil
|
55
113
|
#
|
@@ -58,8 +116,10 @@ class Main
|
|
58
116
|
#
|
59
117
|
def mkdir( dir )
|
60
118
|
dir = dir.empty? ? site : ::File.join(site, dir)
|
61
|
-
|
62
|
-
|
119
|
+
unless test ?d, dir
|
120
|
+
creating dir
|
121
|
+
FileUtils.mkdir_p dir
|
122
|
+
end
|
63
123
|
end
|
64
124
|
|
65
125
|
# call-seq:
|
@@ -72,7 +132,7 @@ class Main
|
|
72
132
|
def cp( file )
|
73
133
|
src = ::File.join(data, file)
|
74
134
|
dst = ::File.join(site, file)
|
75
|
-
|
135
|
+
test(?e, dst) ? updating(dst) : creating(dst)
|
76
136
|
FileUtils.cp src, dst
|
77
137
|
end
|
78
138
|
|
@@ -86,6 +146,16 @@ class Main
|
|
86
146
|
puts msg
|
87
147
|
end
|
88
148
|
|
149
|
+
# call-seq:
|
150
|
+
# updating( msg ) => nil
|
151
|
+
#
|
152
|
+
# Prints a "updating _msg_" to the screen.
|
153
|
+
#
|
154
|
+
def updating( msg )
|
155
|
+
print "updating "
|
156
|
+
puts msg
|
157
|
+
end
|
158
|
+
|
89
159
|
# call-seq:
|
90
160
|
# abort( msg ) => nil
|
91
161
|
#
|