webby 0.8.4 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +19 -0
- data/Manifest.txt +104 -91
- data/README.txt +27 -45
- data/Rakefile +4 -5
- data/bin/webby +2 -1
- data/bin/webby-gen +8 -0
- data/{data/Rakefile → examples/blog/Sitefile} +0 -2
- data/examples/{webby → blog}/tasks/blog.rake +5 -4
- data/{data → examples/blog}/templates/atom_feed.erb +10 -11
- data/{data → examples/blog}/templates/blog/month.erb +1 -1
- data/{data → examples/blog}/templates/blog/post.erb +1 -0
- data/{data → examples/blog}/templates/blog/year.erb +1 -1
- data/examples/presentation/{Rakefile → Sitefile} +0 -4
- data/examples/presentation/content/{_sample_code.txt → presentation/_sample_code.txt} +0 -0
- data/examples/presentation/content/{index.txt → presentation/index.txt} +0 -0
- data/{data/content → examples/presentation/content/presentation}/s5/blank.gif +0 -0
- data/{data/content → examples/presentation/content/presentation}/s5/bodybg.gif +0 -0
- data/{data/content → examples/presentation/content/presentation}/s5/framing.css +0 -0
- data/{data/content → examples/presentation/content/presentation}/s5/iepngfix.htc +0 -0
- data/{data/content → examples/presentation/content/presentation}/s5/opera.css +0 -0
- data/{data/content → examples/presentation/content/presentation}/s5/outline.css +0 -0
- data/{data/content → examples/presentation/content/presentation}/s5/pretty.css +0 -0
- data/{data/content → examples/presentation/content/presentation}/s5/print.css +0 -0
- data/{data/content → examples/presentation/content/presentation}/s5/s5-core.css +0 -0
- data/{data/content → examples/presentation/content/presentation}/s5/slides.css +0 -0
- data/{data/content → examples/presentation/content/presentation}/s5/slides.js +0 -0
- data/examples/presentation/layouts/{presentation.rhtml → presentation.txt} +3 -3
- data/examples/presentation/templates/{_partial.erb → _code_partial.erb} +0 -0
- data/examples/tumblog/Sitefile +9 -0
- data/examples/tumblog/content/css/tumblog.css +308 -0
- data/examples/tumblog/content/images/tumblog/permalink.gif +0 -0
- data/examples/tumblog/content/images/tumblog/rss.gif +0 -0
- data/examples/tumblog/content/tumblog/200806/the-noble-chicken/index.txt +12 -0
- data/examples/tumblog/content/tumblog/200807/historical-perspectives-on-the-classic-chicken-joke/index.txt +12 -0
- data/examples/tumblog/content/tumblog/200807/mad-city-chickens/index.txt +10 -0
- data/examples/tumblog/content/tumblog/200807/the-wisdom-of-the-dutch/index.txt +11 -0
- data/examples/tumblog/content/tumblog/200807/up-a-tree/index.txt +13 -0
- data/examples/tumblog/content/tumblog/index.txt +37 -0
- data/examples/tumblog/content/tumblog/rss.txt +37 -0
- data/examples/tumblog/layouts/tumblog/default.txt +44 -0
- data/examples/tumblog/layouts/tumblog/post.txt +15 -0
- data/examples/tumblog/lib/tumblog_helper.rb +32 -0
- data/examples/tumblog/tasks/tumblog.rake +30 -0
- data/examples/tumblog/templates/atom_feed.erb +40 -0
- data/examples/tumblog/templates/tumblog/conversation.erb +12 -0
- data/examples/tumblog/templates/tumblog/link.erb +10 -0
- data/examples/tumblog/templates/tumblog/photo.erb +13 -0
- data/examples/tumblog/templates/tumblog/post.erb +12 -0
- data/examples/tumblog/templates/tumblog/quote.erb +11 -0
- data/examples/webby/{Rakefile → Sitefile} +2 -2
- data/examples/webby/content/communicate/index.txt +28 -0
- data/examples/webby/content/css/background.gif +0 -0
- data/examples/webby/content/css/site.css +52 -20
- data/examples/webby/content/index.txt +7 -8
- data/examples/webby/content/learn/index.txt +28 -0
- data/examples/webby/content/reference/index.txt +3 -1
- data/examples/webby/content/release-notes/rel-0-9-0/index.txt +73 -0
- data/examples/webby/content/sitemap.txt +31 -0
- data/examples/webby/content/tips_and_tricks/index.txt +1 -1
- data/examples/webby/content/tutorial/index.txt +17 -17
- data/examples/webby/content/{manual → user-manual}/index.txt +53 -50
- data/examples/webby/layouts/{default.rhtml → default.txt} +8 -15
- data/examples/webby/templates/page.erb +1 -1
- data/examples/website/Sitefile +7 -0
- data/{data → examples/website}/content/css/blueprint/License.txt +0 -0
- data/{data → examples/website}/content/css/blueprint/Readme.txt +0 -0
- data/{data → examples/website}/content/css/blueprint/compressed/print.css +0 -0
- data/{data → examples/website}/content/css/blueprint/compressed/screen.css +0 -0
- data/{data → examples/website}/content/css/blueprint/lib/forms.css +0 -0
- data/{data → examples/website}/content/css/blueprint/lib/grid.css +0 -0
- data/{data → examples/website}/content/css/blueprint/lib/grid.png +0 -0
- data/{data → examples/website}/content/css/blueprint/lib/ie.css +0 -0
- data/{data → examples/website}/content/css/blueprint/lib/reset.css +0 -0
- data/{data → examples/website}/content/css/blueprint/lib/typography.css +0 -0
- data/{data → examples/website}/content/css/blueprint/plugins/buttons/Readme +0 -0
- data/{data → examples/website}/content/css/blueprint/plugins/buttons/buttons.css +0 -0
- data/{data → examples/website}/content/css/blueprint/plugins/buttons/icons/cross.png +0 -0
- data/{data → examples/website}/content/css/blueprint/plugins/buttons/icons/key.png +0 -0
- data/{data → examples/website}/content/css/blueprint/plugins/buttons/icons/tick.png +0 -0
- data/{data → examples/website}/content/css/blueprint/plugins/css-classes/Readme +0 -0
- data/{data → examples/website}/content/css/blueprint/plugins/css-classes/css-classes.css +0 -0
- data/{data → examples/website}/content/css/blueprint/plugins/fancy-type/Readme +0 -0
- data/{data → examples/website}/content/css/blueprint/plugins/fancy-type/fancy-type-compressed.css +0 -0
- data/{data → examples/website}/content/css/blueprint/plugins/fancy-type/fancy-type.css +0 -0
- data/{data → examples/website}/content/css/blueprint/print.css +0 -0
- data/{data → examples/website}/content/css/blueprint/screen.css +0 -0
- data/{data → examples/website}/content/css/coderay.css +0 -0
- data/{data → examples/website}/content/css/site.css +0 -0
- data/{data → examples/website}/content/index.txt +2 -1
- data/{data/layouts/default.rhtml → examples/website/layouts/default.txt} +1 -1
- data/{data → examples/website}/lib/breadcrumbs.rb +0 -0
- data/{data → examples/website}/templates/_partial.erb +0 -0
- data/{data → examples/website}/templates/page.erb +0 -0
- data/{data → examples/website}/templates/presentation.erb +0 -0
- data/lib/webby/apps/generator.rb +283 -0
- data/lib/webby/apps/main.rb +221 -0
- data/lib/webby/apps.rb +12 -0
- data/lib/webby/builder.rb +8 -10
- data/lib/webby/core_ext/enumerable.rb +11 -0
- data/lib/webby/{utils.rb → core_ext/hash.rb} +2 -26
- data/lib/webby/core_ext/kernel.rb +21 -0
- data/lib/webby/core_ext/string.rb +163 -0
- data/lib/webby/core_ext/time.rb +9 -0
- data/lib/webby/filters/haml.rb +13 -5
- data/lib/webby/filters/markdown.rb +12 -4
- data/lib/webby/filters/outline.rb +3 -2
- data/lib/webby/filters/sass.rb +12 -4
- data/lib/webby/filters/textile.rb +12 -4
- data/lib/webby/filters/tidy.rb +10 -8
- data/lib/webby/filters.rb +2 -0
- data/lib/webby/helpers/graphviz_helper.rb +1 -2
- data/lib/webby/helpers/tex_img_helper.rb +6 -10
- data/lib/webby/renderer.rb +5 -3
- data/lib/webby/resources/layout.rb +1 -1
- data/lib/webby/resources/page.rb +1 -1
- data/lib/webby/resources/resource.rb +13 -3
- data/lib/webby/resources.rb +16 -0
- data/{data → lib/webby}/tasks/build.rake +0 -0
- data/{examples/presentation → lib/webby}/tasks/create.rake +1 -1
- data/{data → lib/webby}/tasks/deploy.rake +0 -0
- data/{examples → lib}/webby/tasks/growl.rake +4 -1
- data/{data → lib/webby}/tasks/heel.rake +0 -0
- data/{data → lib/webby}/tasks/validate.rake +0 -0
- data/lib/webby.rb +11 -5
- data/spec/core_ext/hash_spec.rb +47 -0
- data/spec/core_ext/string_spec.rb +110 -0
- data/spec/core_ext/time_spec.rb +19 -0
- data/spec/webby/apps/generator_spec.rb +111 -0
- data/spec/webby/apps/main_spec.rb +75 -0
- data/spec/webby/helpers/capture_helper_spec.rb +1 -1
- data/spec/webby/resources_spec.rb +17 -0
- data/tasks/gem.rake +10 -2
- data/tasks/git.rake +41 -0
- data/tasks/rubyforge.rake +2 -2
- data/tasks/website.rake +38 -38
- metadata +125 -98
- data/data/tasks/blog.rake +0 -71
- data/data/tasks/create.rake +0 -22
- data/data/tasks/growl.rake +0 -12
- data/data/tasks/setup.rb +0 -17
- data/examples/presentation/content/s5/blank.gif +0 -0
- data/examples/presentation/content/s5/bodybg.gif +0 -0
- data/examples/presentation/content/s5/framing.css +0 -23
- data/examples/presentation/content/s5/iepngfix.htc +0 -42
- data/examples/presentation/content/s5/opera.css +0 -7
- data/examples/presentation/content/s5/outline.css +0 -15
- data/examples/presentation/content/s5/pretty.css +0 -86
- data/examples/presentation/content/s5/print.css +0 -1
- data/examples/presentation/content/s5/s5-core.css +0 -9
- data/examples/presentation/content/s5/slides.css +0 -3
- data/examples/presentation/content/s5/slides.js +0 -553
- data/examples/presentation/tasks/blog.rake +0 -71
- data/examples/presentation/tasks/build.rake +0 -27
- data/examples/presentation/tasks/deploy.rake +0 -22
- data/examples/presentation/tasks/growl.rake +0 -12
- data/examples/presentation/tasks/heel.rake +0 -28
- data/examples/presentation/tasks/setup.rb +0 -17
- data/examples/presentation/tasks/validate.rake +0 -19
- data/examples/webby/tasks/build.rake +0 -27
- data/examples/webby/tasks/create.rake +0 -22
- data/examples/webby/tasks/deploy.rake +0 -22
- data/examples/webby/tasks/heel.rake +0 -28
- data/examples/webby/tasks/setup.rb +0 -17
- data/examples/webby/tasks/validate.rake +0 -19
- data/lib/webby/main.rb +0 -227
@@ -1,28 +0,0 @@
|
|
1
|
-
|
2
|
-
namespace :heel do
|
3
|
-
|
4
|
-
desc 'Start the heel server to view website (not for Windows)'
|
5
|
-
task :start do
|
6
|
-
sh "heel --root #{SITE.output_dir} --port #{SITE.heel_port} --daemonize"
|
7
|
-
end
|
8
|
-
|
9
|
-
desc 'Stop the heel server'
|
10
|
-
task :stop do
|
11
|
-
sh "heel --kill"
|
12
|
-
end
|
13
|
-
|
14
|
-
task :autorun do
|
15
|
-
heel_exe = File.join(Gem.bindir, 'heel')
|
16
|
-
@heel_spawner = Spawner.new(Spawner.ruby, heel_exe, '--root', SITE.output_dir, '--port', SITE.heel_port.to_s, :pause => 86_400)
|
17
|
-
@heel_spawner.start
|
18
|
-
end
|
19
|
-
|
20
|
-
task :autobuild => :autorun do
|
21
|
-
at_exit {@heel_spawner.stop if defined? @heel_spawner and not @heel_spawner.nil?}
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
task :autobuild => 'heel:autobuild'
|
27
|
-
|
28
|
-
# EOF
|
@@ -1,17 +0,0 @@
|
|
1
|
-
|
2
|
-
begin
|
3
|
-
require 'webby'
|
4
|
-
rescue LoadError
|
5
|
-
require 'rubygems'
|
6
|
-
require 'webby'
|
7
|
-
end
|
8
|
-
|
9
|
-
SITE = Webby.site
|
10
|
-
|
11
|
-
# Load the other rake files in the tasks folder
|
12
|
-
Dir.glob(::File.join(%w[tasks *.rake])).sort.each {|fn| import fn}
|
13
|
-
|
14
|
-
# Load all the ruby files in the lib folder
|
15
|
-
Dir.glob(::File.join(%w[lib ** *.rb])).sort.each {|fn| require fn}
|
16
|
-
|
17
|
-
# EOF
|
@@ -1,19 +0,0 @@
|
|
1
|
-
|
2
|
-
namespace :validate do
|
3
|
-
|
4
|
-
desc 'Validate hyperlinks (exclude exteranl sites)'
|
5
|
-
task :internal => :build do
|
6
|
-
Webby::LinkValidator.validate(:external => false)
|
7
|
-
end
|
8
|
-
|
9
|
-
desc 'Validate hyperlinks (include external sites)'
|
10
|
-
task :external => :build do
|
11
|
-
Webby::LinkValidator.validate(:external => true)
|
12
|
-
end
|
13
|
-
|
14
|
-
end # validate
|
15
|
-
|
16
|
-
desc 'Alias to validate:internal'
|
17
|
-
task :validate => 'validate:internal'
|
18
|
-
|
19
|
-
# EOF
|
@@ -1,27 +0,0 @@
|
|
1
|
-
|
2
|
-
task :configure_basepath do
|
3
|
-
Webby.site.base = ENV['BASE'] if ENV.has_key?('BASE')
|
4
|
-
end
|
5
|
-
|
6
|
-
desc "Build the website"
|
7
|
-
task :build => :configure_basepath do |t|
|
8
|
-
Webby::Builder.run
|
9
|
-
end
|
10
|
-
|
11
|
-
desc "Rebuild the website"
|
12
|
-
task :rebuild => :configure_basepath do |t|
|
13
|
-
Webby::Builder.run :rebuild => true
|
14
|
-
end
|
15
|
-
|
16
|
-
desc "Continuously build the website"
|
17
|
-
task :autobuild => :configure_basepath do |t|
|
18
|
-
Webby::AutoBuilder.run
|
19
|
-
end
|
20
|
-
|
21
|
-
desc "Delete the website"
|
22
|
-
task :clobber do |t|
|
23
|
-
rm_rf Webby.site.output_dir
|
24
|
-
mkdir Webby.site.output_dir
|
25
|
-
end
|
26
|
-
|
27
|
-
# EOF
|
@@ -1,22 +0,0 @@
|
|
1
|
-
|
2
|
-
namespace :create do
|
3
|
-
|
4
|
-
FileList["#{Webby.site.template_dir}/*"].each do |template|
|
5
|
-
next unless test(?f, template)
|
6
|
-
name = template.pathmap '%n'
|
7
|
-
|
8
|
-
# if the file is a partial template
|
9
|
-
name = $1 if name =~ %r/^_(.*)/
|
10
|
-
|
11
|
-
desc "Create a new #{name}"
|
12
|
-
task name do |t|
|
13
|
-
page, title, dir = Webby::Builder.new_page_info(t)
|
14
|
-
page = Webby::Builder.create(page, :from => template,
|
15
|
-
:locals => {:title => title, :directory => dir})
|
16
|
-
exec(::Webby.editor, page) unless ::Webby.editor.nil?
|
17
|
-
end
|
18
|
-
end # each
|
19
|
-
|
20
|
-
end # namespace :create
|
21
|
-
|
22
|
-
# EOF
|
@@ -1,22 +0,0 @@
|
|
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.user}@#{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.user}@#{SITE.host}", SITE.remote_dir, SITE.output_dir
|
17
|
-
).upload
|
18
|
-
end
|
19
|
-
|
20
|
-
end # deploy
|
21
|
-
|
22
|
-
# EOF
|
@@ -1,28 +0,0 @@
|
|
1
|
-
|
2
|
-
namespace :heel do
|
3
|
-
|
4
|
-
desc 'Start the heel server to view website (not for Windows)'
|
5
|
-
task :start do
|
6
|
-
sh "heel --root #{SITE.output_dir} --port #{SITE.heel_port} --daemonize"
|
7
|
-
end
|
8
|
-
|
9
|
-
desc 'Stop the heel server'
|
10
|
-
task :stop do
|
11
|
-
sh "heel --kill"
|
12
|
-
end
|
13
|
-
|
14
|
-
task :autorun do
|
15
|
-
heel_exe = File.join(Gem.bindir, 'heel')
|
16
|
-
@heel_spawner = Spawner.new(Spawner.ruby, heel_exe, '--root', SITE.output_dir, '--port', SITE.heel_port.to_s, :pause => 86_400)
|
17
|
-
@heel_spawner.start
|
18
|
-
end
|
19
|
-
|
20
|
-
task :autobuild => :autorun do
|
21
|
-
at_exit {@heel_spawner.stop if defined? @heel_spawner and not @heel_spawner.nil?}
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
task :autobuild => 'heel:autobuild'
|
27
|
-
|
28
|
-
# EOF
|
@@ -1,17 +0,0 @@
|
|
1
|
-
|
2
|
-
begin
|
3
|
-
require 'webby'
|
4
|
-
rescue LoadError
|
5
|
-
require 'rubygems'
|
6
|
-
require 'webby'
|
7
|
-
end
|
8
|
-
|
9
|
-
SITE = Webby.site
|
10
|
-
|
11
|
-
# Load the other rake files in the tasks folder
|
12
|
-
Dir.glob(::File.join(%w[tasks *.rake])).sort.each {|fn| import fn}
|
13
|
-
|
14
|
-
# Load all the ruby files in the lib folder
|
15
|
-
Dir.glob(::File.join(%w[lib ** *.rb])).sort.each {|fn| require fn}
|
16
|
-
|
17
|
-
# EOF
|
@@ -1,19 +0,0 @@
|
|
1
|
-
|
2
|
-
namespace :validate do
|
3
|
-
|
4
|
-
desc 'Validate hyperlinks (exclude exteranl sites)'
|
5
|
-
task :internal => :build do
|
6
|
-
Webby::LinkValidator.validate(:external => false)
|
7
|
-
end
|
8
|
-
|
9
|
-
desc 'Validate hyperlinks (include external sites)'
|
10
|
-
task :external => :build do
|
11
|
-
Webby::LinkValidator.validate(:external => true)
|
12
|
-
end
|
13
|
-
|
14
|
-
end # validate
|
15
|
-
|
16
|
-
desc 'Alias to validate:internal'
|
17
|
-
task :validate => 'validate:internal'
|
18
|
-
|
19
|
-
# EOF
|
data/lib/webby/main.rb
DELETED
@@ -1,227 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
require 'find'
|
3
|
-
require 'optparse'
|
4
|
-
|
5
|
-
module Webby
|
6
|
-
|
7
|
-
# The Webby::Main class contains all the functionality needed by the +webby+
|
8
|
-
# command line application.
|
9
|
-
#
|
10
|
-
class Main
|
11
|
-
|
12
|
-
WINDOWS = %r/djgpp|(cyg|ms|bcc)win|mingw/ =~ RUBY_PLATFORM # :nodoc:
|
13
|
-
|
14
|
-
# Directory where the Webby website will be created
|
15
|
-
attr_accessor :site
|
16
|
-
|
17
|
-
# Directory where the prototype Webby website can be found
|
18
|
-
attr_accessor :data
|
19
|
-
|
20
|
-
# Flag used to update an existing website
|
21
|
-
attr_accessor :update
|
22
|
-
|
23
|
-
# call-seq:
|
24
|
-
# Main.run( args ) => nil
|
25
|
-
#
|
26
|
-
# Create a new instance of Main, and run the +webby+ application given the
|
27
|
-
# command line _args_.
|
28
|
-
#
|
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
|
35
|
-
end
|
36
|
-
|
37
|
-
# call-seq:
|
38
|
-
# Main.new
|
39
|
-
#
|
40
|
-
# Create a new Main webby object for building websites.
|
41
|
-
#
|
42
|
-
def initialize
|
43
|
-
@log = Logging::Logger[self]
|
44
|
-
end
|
45
|
-
|
46
|
-
# call-seq:
|
47
|
-
# parse( args ) => nil
|
48
|
-
#
|
49
|
-
# Parse the command line arguments and store the values for later use by
|
50
|
-
# the create_site and update_site methods.
|
51
|
-
#
|
52
|
-
def parse( args )
|
53
|
-
self.data = File.join(::Webby::PATH, 'data')
|
54
|
-
self.update = false
|
55
|
-
|
56
|
-
opts = OptionParser.new
|
57
|
-
opts.banner << ' site'
|
58
|
-
|
59
|
-
opts.separator ''
|
60
|
-
opts.on('-u', '--update',
|
61
|
-
'update the rake tasks for the site') {self.update = true}
|
62
|
-
|
63
|
-
opts.separator ''
|
64
|
-
opts.separator 'common options:'
|
65
|
-
|
66
|
-
opts.on_tail( '-h', '--help', 'show this message' ) {puts opts; exit}
|
67
|
-
opts.on_tail( '--version', 'show version' ) do
|
68
|
-
puts "Webby #{::Webby::VERSION}"
|
69
|
-
exit
|
70
|
-
end
|
71
|
-
|
72
|
-
# parse the command line arguments
|
73
|
-
opts.parse! args
|
74
|
-
self.site = args.shift
|
75
|
-
|
76
|
-
if site.nil?
|
77
|
-
puts opts
|
78
|
-
::Kernel.abort
|
79
|
-
end
|
80
|
-
nil
|
81
|
-
end
|
82
|
-
|
83
|
-
# call-seq:
|
84
|
-
# create_site => nil
|
85
|
-
#
|
86
|
-
# Create a new website.
|
87
|
-
#
|
88
|
-
def create_site
|
89
|
-
# see if the site already exists
|
90
|
-
abort "'#{site}' already exists" if test ?e, site
|
91
|
-
|
92
|
-
# copy over files from the data directory
|
93
|
-
files = site_files
|
94
|
-
|
95
|
-
files.keys.sort.each do |dir|
|
96
|
-
mkdir dir
|
97
|
-
files[dir].sort.each {|file| cp file}
|
98
|
-
end
|
99
|
-
nil
|
100
|
-
end
|
101
|
-
|
102
|
-
# call-seq:
|
103
|
-
# update_site => nil
|
104
|
-
#
|
105
|
-
# Update the rake tasks for an existing website.
|
106
|
-
#
|
107
|
-
def update_site
|
108
|
-
# ensure the site already exists
|
109
|
-
abort "'#{site}' does not exist" unless test ?d, site
|
110
|
-
|
111
|
-
# copy over files from the data/tasks directory
|
112
|
-
files = site_files
|
113
|
-
|
114
|
-
mkdir 'tasks'
|
115
|
-
files['tasks'].sort.each {|file| cp file}
|
116
|
-
|
117
|
-
nil
|
118
|
-
end
|
119
|
-
|
120
|
-
# call-seq:
|
121
|
-
# mkdir( dir ) => nil
|
122
|
-
#
|
123
|
-
# Make a directory in the user specified site location. A message will be
|
124
|
-
# displayed to the screen indicating tha the directory is being created.
|
125
|
-
#
|
126
|
-
def mkdir( dir )
|
127
|
-
dir = dir.empty? ? site : ::File.join(site, dir)
|
128
|
-
unless test ?d, dir
|
129
|
-
creating dir
|
130
|
-
FileUtils.mkdir_p dir
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
# call-seq:
|
135
|
-
# cp( file ) => nil
|
136
|
-
#
|
137
|
-
# Copy a file from the Webby prototype website location to the user
|
138
|
-
# specified site location. A message will be displayed to the screen
|
139
|
-
# indicating tha the file is being created.
|
140
|
-
#
|
141
|
-
def cp( file )
|
142
|
-
src = ::File.join(data, file)
|
143
|
-
dst = ::File.join(site, file)
|
144
|
-
test(?e, dst) ? updating(dst) : creating(dst)
|
145
|
-
# FileUtils.cp(src, dst)
|
146
|
-
if WINDOWS then win_line_endings(src, dst)
|
147
|
-
else FileUtils.cp(src, dst) end
|
148
|
-
end
|
149
|
-
|
150
|
-
# call-seq:
|
151
|
-
# win_line_endings( src, dst )
|
152
|
-
#
|
153
|
-
# Copy the file from the _src_ location to the _dst_ location and
|
154
|
-
# transform the line endings to the windows "\r\n" format.
|
155
|
-
#
|
156
|
-
def win_line_endings( src, dst )
|
157
|
-
case ::File.extname(src)
|
158
|
-
when *%w[.png .gif .jpg .jpeg]
|
159
|
-
FileUtils.cp src, dst
|
160
|
-
else
|
161
|
-
::File.open(dst,'w') do |fd|
|
162
|
-
::File.foreach(src, "\n") do |line|
|
163
|
-
line.tr!("\r\n",'')
|
164
|
-
fd.puts line
|
165
|
-
end
|
166
|
-
end
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
# call-seq:
|
171
|
-
# creating( msg ) => nil
|
172
|
-
#
|
173
|
-
# Prints a "creating _msg_" to the screen.
|
174
|
-
#
|
175
|
-
def creating( msg )
|
176
|
-
@log.info "creating #{msg}"
|
177
|
-
end
|
178
|
-
|
179
|
-
# call-seq:
|
180
|
-
# updating( msg ) => nil
|
181
|
-
#
|
182
|
-
# Prints a "updating _msg_" to the screen.
|
183
|
-
#
|
184
|
-
def updating( msg )
|
185
|
-
@log.info "updating #{msg}"
|
186
|
-
end
|
187
|
-
|
188
|
-
# call-seq:
|
189
|
-
# abort( msg ) => nil
|
190
|
-
#
|
191
|
-
# Prints an abort _msg_ to the screen and then exits the Ruby interpreter.
|
192
|
-
#
|
193
|
-
def abort( msg )
|
194
|
-
@log.fatal msg
|
195
|
-
exit 1
|
196
|
-
end
|
197
|
-
|
198
|
-
# call-seq:
|
199
|
-
# site_files => hash
|
200
|
-
#
|
201
|
-
# Iterates over all the files in the Webby prototype website directory and
|
202
|
-
# stores them in a hash.
|
203
|
-
#
|
204
|
-
def site_files
|
205
|
-
exclude = %r/tmp$|bak$|~$|CVS|\.svn/o
|
206
|
-
|
207
|
-
rgxp = %r/\A#{data}\/?/o
|
208
|
-
paths = Hash.new {|h,k| h[k] = []}
|
209
|
-
|
210
|
-
Find.find(data) do |p|
|
211
|
-
next if exclude =~ p
|
212
|
-
|
213
|
-
if test(?d, p)
|
214
|
-
paths[p.sub(rgxp, '')]
|
215
|
-
next
|
216
|
-
end
|
217
|
-
dir = ::File.dirname(p).sub(rgxp, '')
|
218
|
-
paths[dir] << p.sub(rgxp, '')
|
219
|
-
end
|
220
|
-
|
221
|
-
paths
|
222
|
-
end
|
223
|
-
|
224
|
-
end # class Main
|
225
|
-
end # module Webby
|
226
|
-
|
227
|
-
# EOF
|