-
Notifications
You must be signed in to change notification settings - Fork 4
/
wildcat_publish.rb
executable file
·34 lines (29 loc) · 1.02 KB
/
wildcat_publish.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env ruby -wU
require_relative 'wildcat'
# Command-line
# Assumes the current directory is inside the top level of the website project folder.
# Call it like this:
# ruby /path/to/wildcat_publish.rb
#
# Default settings file is wildcat_settings.
# To do a preview (for instance) instead, specify a separate settings file, as in:
# ruby wildcat_publish.rb --settings preview_settings
#
# Tip: create an alias for your shell to shorten things.
# For instance, I use pi — “Publish Inessential” — as an alias like this:
# pushd "/Users/brent/path/to/inessential.com";ruby wildcat_publish.rb;popd
settings_file = nil
next_argument_is_settings = false
found_alternate_settings_file = false
ARGV.each do |arg|
if next_argument_is_settings && !found_alternate_settings_file
settings_file = arg
found_alternate_settings_file = true
end
if arg == '--settings' && !found_alternate_settings_file
next_argument_is_settings = true
end
end
folder = Dir.pwd
wildcat = Wildcat.new(folder, settings_file)
wildcat.build