Menu

[78ac15]: / update.rb  Maximize  Restore  History

Download this file

61 lines (50 with data), 1.6 kB

 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env ruby
require 'pathname'
require 'fileutils'
if ARGV.delete("-h") or ARGV.delete("--help")
puts "Usage: #{$0} [--upload]"
puts " e.g.: #{$0} # only update"
puts " : #{$0} --upload # update and upload"
exit
end
upload = ARGV[0] == "--upload"
def run(*args)
puts "[#{Dir.pwd}] #{args.join(' ')}"
system(*args) or exit(1)
end
tdiary_base_dir = Pathname("~/work/ruby/tdiary").expand_path
tdiary_dir = tdiary_base_dir + "core"
tdiary_clear_code_public_dir = tdiary_base_dir + "clear-code" + "public"
blog_base_dir = nil
tdiary_conf_dir = nil
tdiary_conf = nil
["~/public_html/milter-manager"].each do |dir|
conf = "#{dir}/blog/ja/tdiary.conf"
conf = Pathname(conf).expand_path
if conf.exist?
blog_base_dir = Pathname(dir).expand_path
tdiary_conf = conf
tdiary_conf_dir = conf.dirname
break
end
end
tdiary_compiled_dir = blog_base_dir + "blog-html/ja"
data_path_line = tdiary_conf.read.grep(/^@data_path =/).join
tdiary_data_path = eval(data_path_line)
milter_manager_doc_dir = Pathname("~/work/c/milter-manager-doc").expand_path
Dir.chdir(tdiary_data_path.to_s) do
run("git", "pull", "--rebase")
end
Dir.chdir(tdiary_clear_code_public_dir.to_s) do
run("svn", "up")
FileUtils.rm_rf(tdiary_compiled_dir.to_s)
run("./html-archiver.rb",
"-t", tdiary_dir.to_s, "-c", tdiary_conf_dir.to_s,
tdiary_compiled_dir.to_s)
end
if upload
Dir.chdir(milter_manager_doc_dir.to_s) do
run("git", "pull", "--rebase")
run("./upload.rb", tdiary_compiled_dir.to_s)
end
end
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.