-
Notifications
You must be signed in to change notification settings - Fork 4
/
wildcat.rb
executable file
·38 lines (29 loc) · 972 Bytes
/
wildcat.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
35
36
37
38
#!/usr/bin/env ruby -wU
require_relative 'model/website_settings'
require_relative 'model/website'
DEFAULT_SETTINGS_FILE_NAME = 'wildcat_settings'
class Wildcat
attr_reader :website
attr_reader :settings
def initialize(project_folder, settings_file_name)
@settings = Wildcat.settings_with_file_name(project_folder, settings_file_name)
@website = Website.new(settings)
end
def build
@website.build
perform_rsync_if_needed
end
def Wildcat.settings_with_file_name(project_folder, file_name)
if file_name.nil? || file_name.empty?
file_name = DEFAULT_SETTINGS_FILE_NAME
end
settings_file_path = File.join(project_folder, file_name)
WebsiteSettings.new(project_folder, settings_file_path)
end
private
def perform_rsync_if_needed
rsync_path = @settings.rsync_remote_path
if rsync_path.nil? || rsync_path.empty? then return end
WildcatUtils.rsync_remote(@settings.output_folder, rsync_path)
end
end