yuzu 0.2.1.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.document +5 -0
- data/.yardopts +7 -0
- data/ChangeLog.md +8 -0
- data/Gemfile +26 -0
- data/Gemfile.lock +30 -0
- data/LICENSE.txt +20 -0
- data/README.md +52 -0
- data/Rakefile +62 -0
- data/bin/yuzu +17 -0
- data/docs/About.md +19 -0
- data/docs/GettingStarted.md +48 -0
- data/docs/Reference.md +97 -0
- data/lib/helpers/object.rb +19 -0
- data/lib/helpers/path.rb +296 -0
- data/lib/helpers/string.rb +35 -0
- data/lib/helpers/system_checks.rb +10 -0
- data/lib/helpers/url.rb +64 -0
- data/lib/html/base.rb +187 -0
- data/lib/uploader/base.rb +59 -0
- data/lib/uploader/config.rb +19 -0
- data/lib/uploader/filesystem_service.rb +72 -0
- data/lib/uploader/ftp_service.rb +90 -0
- data/lib/uploader/s3_service.rb +135 -0
- data/lib/uploader/service.rb +57 -0
- data/lib/uploader/suppressor.rb +25 -0
- data/lib/yuzu.rb +6 -0
- data/lib/yuzu/argparse.rb +60 -0
- data/lib/yuzu/command.rb +104 -0
- data/lib/yuzu/commands/base.rb +150 -0
- data/lib/yuzu/commands/create.rb +68 -0
- data/lib/yuzu/commands/generate.rb +95 -0
- data/lib/yuzu/commands/help.rb +20 -0
- data/lib/yuzu/commands/preview.rb +58 -0
- data/lib/yuzu/commands/publish.rb +43 -0
- data/lib/yuzu/commands/stage.rb +62 -0
- data/lib/yuzu/commands/watch.rb +70 -0
- data/lib/yuzu/content/blog_post.rb +45 -0
- data/lib/yuzu/content/sample_project.rb +130 -0
- data/lib/yuzu/core/config.rb +154 -0
- data/lib/yuzu/core/layout.rb +85 -0
- data/lib/yuzu/core/paginated_file.rb +69 -0
- data/lib/yuzu/core/registrar.rb +32 -0
- data/lib/yuzu/core/siteroot.rb +57 -0
- data/lib/yuzu/core/template.rb +158 -0
- data/lib/yuzu/core/updater.rb +123 -0
- data/lib/yuzu/core/visitor.rb +44 -0
- data/lib/yuzu/core/website_base.rb +150 -0
- data/lib/yuzu/core/website_file.rb +270 -0
- data/lib/yuzu/core/website_folder.rb +176 -0
- data/lib/yuzu/filters/base.rb +86 -0
- data/lib/yuzu/filters/catalog.rb +248 -0
- data/lib/yuzu/filters/categories.rb +58 -0
- data/lib/yuzu/filters/currentpath.rb +35 -0
- data/lib/yuzu/filters/description.rb +16 -0
- data/lib/yuzu/filters/extension.rb +16 -0
- data/lib/yuzu/filters/images.rb +32 -0
- data/lib/yuzu/filters/linkroot.rb +35 -0
- data/lib/yuzu/filters/post_date.rb +45 -0
- data/lib/yuzu/filters/post_title.rb +66 -0
- data/lib/yuzu/filters/post_title_removed.rb +28 -0
- data/lib/yuzu/filters/sidebar.rb +26 -0
- data/lib/yuzu/filters/template.rb +16 -0
- data/lib/yuzu/generators/base.rb +44 -0
- data/lib/yuzu/generators/category_folders.rb +91 -0
- data/lib/yuzu/generators/index.rb +108 -0
- data/lib/yuzu/generators/paginate.rb +136 -0
- data/lib/yuzu/postprocessors/all_categories.rb +48 -0
- data/lib/yuzu/postprocessors/base.rb +34 -0
- data/lib/yuzu/postprocessors/contents_without_first_paragraph.rb +20 -0
- data/lib/yuzu/postprocessors/excerpt.rb +23 -0
- data/lib/yuzu/postprocessors/first_paragraph.rb +16 -0
- data/lib/yuzu/postprocessors/pagination.rb +35 -0
- data/lib/yuzu/postprocessors/recent_posts.rb +27 -0
- data/lib/yuzu/postprocessors/thumbnails.rb +48 -0
- data/lib/yuzu/preprocessors/base.rb +71 -0
- data/lib/yuzu/preprocessors/insert_contents.rb +57 -0
- data/lib/yuzu/renderers/base.rb +23 -0
- data/lib/yuzu/renderers/breadcrumb.rb +163 -0
- data/lib/yuzu/renderers/gallery.rb +24 -0
- data/lib/yuzu/renderers/title.rb +21 -0
- data/lib/yuzu/translators/base.rb +57 -0
- data/lib/yuzu/translators/markdown.rb +21 -0
- data/lib/yuzu/translators/plaintext.rb +17 -0
- data/lib/yuzu/version.rb +12 -0
- data/resources/config/compass.rb +6 -0
- data/resources/config/yuzu.yml +166 -0
- data/resources/git/post-commit +42 -0
- data/resources/sample_content/introduction/_snippets/about_insert_contents.md +3 -0
- data/resources/sample_content/introduction/about.md +6 -0
- data/resources/sample_content/introduction/advanced-posts.md +18 -0
- data/resources/sample_content/introduction/blog/blog-folder-is-special.md +8 -0
- data/resources/sample_content/introduction/getting-started.md +14 -0
- data/resources/sample_content/introduction/index.md +6 -0
- data/resources/sample_content/introduction/sample-post.md +13 -0
- data/resources/sample_projects.yml +7 -0
- data/resources/themes/minimal/_sass/print.sass +0 -0
- data/resources/themes/minimal/_sass/screen.sass +81 -0
- data/resources/themes/minimal/_templates/_block.haml +4 -0
- data/resources/themes/minimal/_templates/_blog.haml +3 -0
- data/resources/themes/minimal/_templates/_footer.haml +2 -0
- data/resources/themes/minimal/_templates/_gallery.haml +25 -0
- data/resources/themes/minimal/_templates/_head.haml +12 -0
- data/resources/themes/minimal/_templates/_header.haml +1 -0
- data/resources/themes/minimal/_templates/_menu.haml +6 -0
- data/resources/themes/minimal/_templates/blog.haml +21 -0
- data/resources/themes/minimal/_templates/generic.haml +26 -0
- data/resources/themes/minimal/_templates/home.haml +15 -0
- data/resources/themes/minimal/_templates/index.haml +21 -0
- data/resources/themes/minimal/css/print.css +0 -0
- data/resources/themes/minimal/css/screen.css +133 -0
- data/resources/themes/minimal/img/favicon.png +0 -0
- data/resources/yard/default/fulldoc/html/css/common.css +16 -0
- data/test/helper.rb +18 -0
- data/test/test_yuzu.rb +8 -0
- data/yuzu.gemspec +182 -0
- metadata +302 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
require 'fileutils'
|
|
2
|
+
|
|
3
|
+
require 'uploader/base'
|
|
4
|
+
|
|
5
|
+
require 'core/updater'
|
|
6
|
+
require 'core/config'
|
|
7
|
+
|
|
8
|
+
require 'helpers/string'
|
|
9
|
+
require 'helpers/object'
|
|
10
|
+
|
|
11
|
+
module Yuzu::Command
|
|
12
|
+
|
|
13
|
+
# The Base class for all commands provides methods for coordinating the Updater, which manages the
|
|
14
|
+
# files to be updated and the actual update commands, and the Uploader, which takes care of
|
|
15
|
+
# turning update operations into service calls via FTP, S3, etc.
|
|
16
|
+
class Base
|
|
17
|
+
include Uploader
|
|
18
|
+
|
|
19
|
+
attr_reader :args
|
|
20
|
+
|
|
21
|
+
def initialize(args, config)
|
|
22
|
+
@args = args
|
|
23
|
+
@config = config
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def self.shell(cmd)
|
|
27
|
+
FileUtils.cd(Dir.pwd) {|d| return `#{cmd}`}
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def updater
|
|
31
|
+
@updater ||= Yuzu::Core::Updater.new(uploader, @config)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def uploader
|
|
35
|
+
@uploader ||= UploadManager.new(uploader_config, self.class.service_override)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def uploader_config
|
|
39
|
+
options = {
|
|
40
|
+
:connection => @config.connection,
|
|
41
|
+
:verbose? => @config.verbose?
|
|
42
|
+
}
|
|
43
|
+
config_hash = @config.services.merge(options)
|
|
44
|
+
UploaderConfig.new(config_hash)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# This method enables a command to override the configuration's selected publication service.
|
|
48
|
+
# Some commands work only locally, such as preview, or don't have a publication method involved.
|
|
49
|
+
def self.service_override
|
|
50
|
+
nil
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def self.help(method)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def self.requires_config?
|
|
57
|
+
true
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class ConfiglessCommand
|
|
63
|
+
def initialize(args)
|
|
64
|
+
@args = args
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def self.help(method)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def self.requires_config?
|
|
71
|
+
false
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
# The base class for all commands regarding publishing contents, e.g. preview, stage, publish.
|
|
77
|
+
class PublicationCommand < Base
|
|
78
|
+
include Uploader
|
|
79
|
+
|
|
80
|
+
def index
|
|
81
|
+
updater.update_these(@args)
|
|
82
|
+
updater.done
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def all
|
|
86
|
+
updater.update_all
|
|
87
|
+
updater.done
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def text
|
|
91
|
+
updater.update_text
|
|
92
|
+
updater.done
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def resources
|
|
96
|
+
$stderr.puts `compass compile` if @config.has_compass?
|
|
97
|
+
updater.upload_all_resources
|
|
98
|
+
updater.done
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def css
|
|
102
|
+
$stderr.puts `compass compile` if @config.has_compass?
|
|
103
|
+
updater.upload_all_css
|
|
104
|
+
updater.done
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def images
|
|
108
|
+
images = updater.upload_all_images
|
|
109
|
+
|
|
110
|
+
catalog = File.open("_images.yml","w")
|
|
111
|
+
catalog.puts(images.join("\n"))
|
|
112
|
+
catalog.close
|
|
113
|
+
|
|
114
|
+
updater.done
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def assets
|
|
118
|
+
updater.upload_all_assets
|
|
119
|
+
updater.done
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def changed
|
|
123
|
+
# git_diff_output = `git diff --name-only --diff-filter=AMRX`
|
|
124
|
+
# changed_files = git_diff_output.split("\n")
|
|
125
|
+
# updatable_files = changed_files.reject {|f| File.extname(f).includes_one_of?( @config['extension_blacklist'] )}
|
|
126
|
+
|
|
127
|
+
# puts "Found changes to these files:\n" + updatable_files.join("\n").to_s
|
|
128
|
+
# puts
|
|
129
|
+
|
|
130
|
+
# updater.update_these(updatable_files)
|
|
131
|
+
|
|
132
|
+
# puts "Looking for new images to upload..."
|
|
133
|
+
|
|
134
|
+
# # Traverse images and upload if new.
|
|
135
|
+
# catalog = File.open("images-preview.yml","a+") rescue nil
|
|
136
|
+
|
|
137
|
+
# unless catalog.nil?
|
|
138
|
+
# catalog.rewind
|
|
139
|
+
# image_paths = catalog.readlines
|
|
140
|
+
# known_images = image_paths.collect {|img| img.strip}
|
|
141
|
+
# new_images = updater.upload_new_images known_images
|
|
142
|
+
# catalog.puts(new_images.join("\n"))
|
|
143
|
+
# catalog.close
|
|
144
|
+
# end
|
|
145
|
+
|
|
146
|
+
# updater.done
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
end
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
require 'content/sample_project'
|
|
2
|
+
require 'content/blog_post'
|
|
3
|
+
|
|
4
|
+
module Yuzu::Command
|
|
5
|
+
|
|
6
|
+
# Create produces a new content such as a new yuzu website project or new blog post.
|
|
7
|
+
class Create < ConfiglessCommand
|
|
8
|
+
include Yuzu::Content
|
|
9
|
+
|
|
10
|
+
def initialize(args)
|
|
11
|
+
@args = args
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def index
|
|
15
|
+
sample_project = nil
|
|
16
|
+
sample_project_name = @args.length > 0 ? @args[0] : "default"
|
|
17
|
+
|
|
18
|
+
$stderr.puts "Creating a new Yuzu '#{sample_project_name}' project in this directory..."
|
|
19
|
+
|
|
20
|
+
if SampleProject.exists?(sample_project_name)
|
|
21
|
+
sample_project = SampleProject.new(sample_project_name)
|
|
22
|
+
sample_project.deliver!
|
|
23
|
+
else
|
|
24
|
+
raise RuntimeError, "Sample project called #{sample_project_name} was not found."
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
$stderr.puts "Done!"
|
|
28
|
+
$stderr.puts
|
|
29
|
+
$stderr.puts "Now try:"
|
|
30
|
+
$stderr.puts
|
|
31
|
+
$stderr.puts " yuzu preview"
|
|
32
|
+
$stderr.puts
|
|
33
|
+
|
|
34
|
+
preview_url = sample_project.new_config['services']['preview']['link_root'] + '/index.html'
|
|
35
|
+
$stderr.puts "And point your web browser to #{preview_url}"
|
|
36
|
+
|
|
37
|
+
$stderr.puts "to see your new Yuzu site."
|
|
38
|
+
$stderr.puts
|
|
39
|
+
$stderr.puts "Remember to edit yuzu.yml to set your site settings, preview path, and remote host."
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Produces a new blog post with the name given on the command line.
|
|
43
|
+
def post
|
|
44
|
+
# TODO re-enable blog post creation. Requires a config file.
|
|
45
|
+
#if @args.length > 0
|
|
46
|
+
# new_post = BlogPost.new(@args.first, @config)
|
|
47
|
+
#else
|
|
48
|
+
# @stderr.puts 'create:post requires a filename. Try yuzu create:post "Post Title Here"'
|
|
49
|
+
#end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def self.help method
|
|
53
|
+
case method
|
|
54
|
+
when :index
|
|
55
|
+
%Q{Create a new website project in the current directory.}
|
|
56
|
+
|
|
57
|
+
when :post
|
|
58
|
+
%Q{Creates a new blog post with the date prepended to the file name.
|
|
59
|
+
Pass a quoted string, capitalized, for the title of the post.}
|
|
60
|
+
|
|
61
|
+
else
|
|
62
|
+
"No help available for #{method}."
|
|
63
|
+
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
end
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
require 'fileutils'
|
|
2
|
+
|
|
3
|
+
module Yuzu::Command
|
|
4
|
+
|
|
5
|
+
# Generate handles some cross-media production (e.g. pdf) and handling of the creation of files
|
|
6
|
+
# (e.g. thumbnails).
|
|
7
|
+
class Generate < ConfiglessCommand
|
|
8
|
+
def index
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# TODO Resurrect PDF rendering.
|
|
12
|
+
#def pdf
|
|
13
|
+
# f = File.open(@args.first, "r")
|
|
14
|
+
# unless f.nil?
|
|
15
|
+
# contents = f.readlines.join
|
|
16
|
+
# updater.render_pdf contents, @args.first
|
|
17
|
+
# updater.done
|
|
18
|
+
# else
|
|
19
|
+
# puts "File load error."
|
|
20
|
+
# end
|
|
21
|
+
#end
|
|
22
|
+
|
|
23
|
+
# TODO: Put this in its own class, update it, and integrate with the rest of the app.
|
|
24
|
+
def thumbnails
|
|
25
|
+
path = args.first
|
|
26
|
+
web_image_types = [".png", ".jpg", ".gif"]
|
|
27
|
+
thumbnail_types = @config.thumbnails.keys
|
|
28
|
+
|
|
29
|
+
thumbnail_endings = []
|
|
30
|
+
thumbnail_types.each do |type|
|
|
31
|
+
web_image_types.each do |ext|
|
|
32
|
+
thumbnail_endings += ["-#{type}#{ext}"]
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
if File.directory?(path)
|
|
37
|
+
# Get all the original images requested.
|
|
38
|
+
all_files = Dir[File.join(path, "**/*")]
|
|
39
|
+
|
|
40
|
+
images = all_files.select { |f|
|
|
41
|
+
web_image_types.include?(File.extname(f))
|
|
42
|
+
}.reject { |f|
|
|
43
|
+
f[0].chr == "_" or
|
|
44
|
+
f.include?("#{File::SEPARATOR}_") or
|
|
45
|
+
f.includes_one_of?(thumbnail_endings)
|
|
46
|
+
}
|
|
47
|
+
else
|
|
48
|
+
# A single image.
|
|
49
|
+
images = [path]
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
images.each do |image_path|
|
|
53
|
+
ext = File.extname(image_path)
|
|
54
|
+
|
|
55
|
+
# Loop through the configured thumbnail types ("small", "medium", etc.)
|
|
56
|
+
thumbnail_types.each do |thumbnail_type|
|
|
57
|
+
thumbnail_path = image_path.gsub(ext, "-#{thumbnail_type}#{ext}")
|
|
58
|
+
thumbnail_size = @config.thumbnails[thumbnail_type]
|
|
59
|
+
|
|
60
|
+
$stderr.puts `cp #{image_path} #{thumbnail_path}; sips --resampleWidth #{thumbnail_size} #{thumbnail_path}`
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def config
|
|
66
|
+
if not File.exists?("yuzu.yml") and not File.exists?("config/yuzu.yml")
|
|
67
|
+
# TODO Update to use Path objects.
|
|
68
|
+
FileUtils.copy(
|
|
69
|
+
"#{File.dirname(__FILE__)}/../templates/yuzu.yml",
|
|
70
|
+
"#{Dir.pwd}/config/yuzu.yml"
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
$stderr.puts %Q{Copied a sample config file into the current folder. \
|
|
74
|
+
Update it with your remote server information.}
|
|
75
|
+
|
|
76
|
+
else
|
|
77
|
+
$stderr.puts %Q{Config file yuzu.yml already exists. Please rename or \
|
|
78
|
+
erase it to generate a new one.}
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def self.help method
|
|
83
|
+
case method
|
|
84
|
+
when :thumbnails
|
|
85
|
+
%Q{Generates small, medium, and large thumbnail images from a given path.
|
|
86
|
+
Uses the Mac 'sips' command-line tool.}
|
|
87
|
+
|
|
88
|
+
else
|
|
89
|
+
"No help available for #{method}."
|
|
90
|
+
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
end
|
|
95
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Yuzu::Command
|
|
2
|
+
|
|
3
|
+
class Help < ConfiglessCommand
|
|
4
|
+
def initialize(args)
|
|
5
|
+
@args = args
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def index
|
|
9
|
+
if @args.first.nil?
|
|
10
|
+
puts ArgParser.parse(["--help"])
|
|
11
|
+
else
|
|
12
|
+
command_class, method = Yuzu::Command.parse(@args.first)
|
|
13
|
+
puts command_class.help(method)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
|
|
2
|
+
module Yuzu::Command
|
|
3
|
+
|
|
4
|
+
# Preview enables a publication endpoint that always publishes to the local filesystem such as a
|
|
5
|
+
# web server folder.
|
|
6
|
+
class Preview < PublicationCommand
|
|
7
|
+
|
|
8
|
+
def usage
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def help
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self.service_override
|
|
15
|
+
"preview"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def self.help(method)
|
|
19
|
+
case method
|
|
20
|
+
when :index
|
|
21
|
+
%Q{Updates files in the preview folder.
|
|
22
|
+
|
|
23
|
+
preview # Alias for preview:all below.
|
|
24
|
+
preview [filenames] # Update the preview with the files listed.
|
|
25
|
+
preview:all # Update all the files in the preview.
|
|
26
|
+
preview:text # Only update the processable content files.
|
|
27
|
+
preview:css # Regenerates the css files and copies them
|
|
28
|
+
to the preview.
|
|
29
|
+
preview:images # Copy all the images into the preview folder.
|
|
30
|
+
preview:images [files] # Copy the images listed into the preview folder.
|
|
31
|
+
preview:resources # Copy all the resources, like CSS and JS
|
|
32
|
+
files, into the preview folder.
|
|
33
|
+
preview:assets # Copy all images and other assets (like PDFs and
|
|
34
|
+
other downloadables) into the preview folder.
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
when :all
|
|
38
|
+
"Updates all files in the preview folder."
|
|
39
|
+
|
|
40
|
+
when :resources
|
|
41
|
+
"Copy all the resources, like CSS and JS files, into the preview folder."
|
|
42
|
+
|
|
43
|
+
when :images
|
|
44
|
+
"Copy all images into the preview folder."
|
|
45
|
+
|
|
46
|
+
when :assets
|
|
47
|
+
%Q{Copy all images and other assets, usually PDF files and other archives,
|
|
48
|
+
into the preview folder.}
|
|
49
|
+
|
|
50
|
+
else
|
|
51
|
+
"No help available for #{method}."
|
|
52
|
+
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
end
|
|
58
|
+
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
|
|
2
|
+
module Yuzu::Command
|
|
3
|
+
|
|
4
|
+
# Publish is the primary mechanism to upload files to a remote server such as via FTP or S3.
|
|
5
|
+
class Publish < PublicationCommand
|
|
6
|
+
|
|
7
|
+
def self.help method
|
|
8
|
+
case method
|
|
9
|
+
when :index
|
|
10
|
+
%Q{Updates files and publishes to the current remote service.
|
|
11
|
+
|
|
12
|
+
Can be used in the following forms:
|
|
13
|
+
|
|
14
|
+
publish # Alias for publish:all below.
|
|
15
|
+
publish [filenames] # Publish just the files listed to the remote server.
|
|
16
|
+
publish:all # Publish and upload all files.
|
|
17
|
+
publish:text # Only update the processable content files.
|
|
18
|
+
publish:css # Regenerates the css files and publishes them.
|
|
19
|
+
publish:images # Upload all the images.
|
|
20
|
+
publish:images [files] # Upload the images given.
|
|
21
|
+
publish:resources # Upload all resources like CSS and Javascript files.
|
|
22
|
+
publish:assets # Upload all assets (like PDFs and other downloadables).
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
when :all
|
|
26
|
+
"Publishes and uploads all files to the remote server."
|
|
27
|
+
|
|
28
|
+
when :resources
|
|
29
|
+
"Publish all resources like CSS and Javascript files."
|
|
30
|
+
|
|
31
|
+
when :images
|
|
32
|
+
"Upload all the images or the ones given after the command."
|
|
33
|
+
|
|
34
|
+
when :assets
|
|
35
|
+
"Upload all file assets (usually PDF files and other download archives.)"
|
|
36
|
+
|
|
37
|
+
else
|
|
38
|
+
"No help available for #{method}."
|
|
39
|
+
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
|
|
2
|
+
module Yuzu::Command
|
|
3
|
+
|
|
4
|
+
# Stage is used as a third mechanism to render the webpage under production settings, but still to
|
|
5
|
+
# a local file system. The scenario may be that the website must be published with a different
|
|
6
|
+
# mechanism than what is automated, so this enables someone to render with the appropriate
|
|
7
|
+
# linkroot for the final production destination.
|
|
8
|
+
class Stage < PublicationCommand
|
|
9
|
+
|
|
10
|
+
def usage
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def help
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def self.service_override
|
|
17
|
+
"stage"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.help method
|
|
21
|
+
case method
|
|
22
|
+
when :index
|
|
23
|
+
%Q{Updates files in the staging folder.
|
|
24
|
+
|
|
25
|
+
Can be used in the following forms:
|
|
26
|
+
|
|
27
|
+
stage # Alias for stage:all below.
|
|
28
|
+
stage [filenames] # Update the local staging folder with the files listed.
|
|
29
|
+
stage:all # Update all the files in the staging folder.
|
|
30
|
+
stage:text # Only update the processable content files.
|
|
31
|
+
stage:css # Regenerates the CSS files and copies them
|
|
32
|
+
to the staging folder.
|
|
33
|
+
stage:images # Copy all the images into the staging folder.
|
|
34
|
+
stage:images [files] # Copy the images listed into the staging folder.
|
|
35
|
+
stage:resources # Copy all the resources, like CSS and JS
|
|
36
|
+
files, into the staging folder.
|
|
37
|
+
stage:assets # Copy all images and other assets (like PDFs and
|
|
38
|
+
other downloadables) into the staging folder.
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
when :all
|
|
42
|
+
"Updates all files in the staging folder."
|
|
43
|
+
|
|
44
|
+
when :resources
|
|
45
|
+
"Copy all the resources, like CSS and JS files, into the staging folder."
|
|
46
|
+
|
|
47
|
+
when :images
|
|
48
|
+
"Copy all images into the preview folder."
|
|
49
|
+
|
|
50
|
+
when :assets
|
|
51
|
+
%Q{Copy all images and other assets, usually PDF files and other archives,
|
|
52
|
+
into the staging folder.}
|
|
53
|
+
|
|
54
|
+
else
|
|
55
|
+
"No help available for #{method}."
|
|
56
|
+
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
end
|
|
62
|
+
|