runeblog 0.1.23 → 0.1.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/default.rb +1 -1
- data/lib/helpers-blog.rb +0 -1
- data/lib/post.rb +1 -1
- data/lib/publish.rb +13 -16
- data/lib/repl.rb +17 -3
- data/lib/runeblog_version.rb +1 -1
- data/lib/view.rb +10 -16
- data/test/general.rb +1 -0
- data/test/make_blog.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f04213603ad7442242abfeeff05336fe1c3c47599c1228c1536454a3e15506b7
|
4
|
+
data.tar.gz: 334d6df9b57edf8e8c0c23cb0c74a12623cd152127e6ef5cfde696f54a27946d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9729e32ff5d6001992bd1ef136f44a6ab9efcdade913862b08b22aaee1b97e87796647b1e6fb425b60fad68af8ee091c1b2aa17019f2f91ad224efbc5dfb7e8
|
7
|
+
data.tar.gz: 2cc280923f48d76cf89cc54ae62089bb047dfdcf1114464f2c6eefe714a2656868c5fcfed0098ccbb7f7ab5ca71dfa56ff08efe42a109554e5f6267d374270d6
|
data/lib/default.rb
CHANGED
data/lib/helpers-blog.rb
CHANGED
data/lib/post.rb
CHANGED
@@ -33,10 +33,10 @@ class RuneBlog::Post
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def create_post_subtree(viewname = nil)
|
36
|
+
# FIXME Doesn't really do anything - refactor
|
36
37
|
debug "=== create_post_subtree #{viewname.inspect} pwd = #{Dir.pwd}"
|
37
38
|
# We are INSIDE views/myview/000n-mytitle dir now - FIXME later? how did that happen?
|
38
39
|
create_dir("assets")
|
39
|
-
system("cp body.txt index.html") # gahhh FIXME
|
40
40
|
end
|
41
41
|
|
42
42
|
def write_metadata(meta)
|
data/lib/publish.rb
CHANGED
@@ -29,26 +29,23 @@ class RuneBlog::Publishing
|
|
29
29
|
url = "#@proto://#@server/#@path"
|
30
30
|
end
|
31
31
|
|
32
|
-
def
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
else
|
38
|
-
false
|
39
|
-
end
|
32
|
+
def system!(str)
|
33
|
+
rc = system(str)
|
34
|
+
puts "Running: #{str}"
|
35
|
+
puts "Failed: #{str}" if ! rc
|
36
|
+
rc
|
40
37
|
end
|
41
|
-
|
42
|
-
def publish(files)
|
43
|
-
return false if no_files?(files)
|
44
|
-
# print " Publishing #{files.size} files... "
|
45
|
-
# debug "files = #{files.inspect}"
|
38
|
+
|
39
|
+
def publish(files, assets=[])
|
46
40
|
dir = "#@docroot/#@path"
|
47
|
-
result = system("ssh #@user@#@server -x mkdir -p #{dir}")
|
41
|
+
result = system!("ssh #@user@#@server -x mkdir -p #{dir}")
|
42
|
+
result = system!("ssh #@user@#@server -x mkdir -p #{dir}/../assets")
|
48
43
|
list = files.join(' ')
|
49
|
-
cmd = "scp
|
44
|
+
cmd = "scp #{list} #@user@#@server:#{dir} >/dev/null 2>/tmp/wtf"
|
50
45
|
debug "cmd = #{cmd.inspect} - see /tmp/wtf"
|
51
|
-
result = system(cmd)
|
46
|
+
result = system!(cmd)
|
47
|
+
cmd = "scp #{assets.join(' ')} #@user@#@server:#{dir}/../assets >/dev/null 2>/tmp/wtf2"
|
48
|
+
result = system!(cmd)
|
52
49
|
raise PublishError if !result
|
53
50
|
dump(files, "#{@blog.view.dir}/last_published")
|
54
51
|
true
|
data/lib/repl.rb
CHANGED
@@ -32,7 +32,7 @@ module RuneBlog::REPL
|
|
32
32
|
reset_output
|
33
33
|
check_empty(arg)
|
34
34
|
output RuneBlog::VERSION
|
35
|
-
puts RuneBlog::VERSION unless testing
|
35
|
+
puts fx("\n RuneBlog", :bold), fx(" v #{RuneBlog::VERSION}\n", Red) unless testing
|
36
36
|
[false, @out]
|
37
37
|
end
|
38
38
|
|
@@ -79,12 +79,25 @@ module RuneBlog::REPL
|
|
79
79
|
output! "Can't publish without entries in #{@blog.view.name}/publish"
|
80
80
|
return [false, @out]
|
81
81
|
end
|
82
|
-
|
82
|
+
# Need to check dirty/clean status first
|
83
|
+
dirty, all, assets = @blog.view.publishable_files
|
84
|
+
files = dirty
|
85
|
+
if dirty.empty?
|
86
|
+
puts fx("\n No files are out of date." + " "*20, :bold)
|
87
|
+
print " Publish anyway? "
|
88
|
+
yn = RubyText.gets.chomp
|
89
|
+
files = all if yn == "y"
|
90
|
+
end
|
91
|
+
return if files.empty?
|
92
|
+
|
93
|
+
ret = RubyText.spinner(label: " Publishing... ") do
|
94
|
+
@blog.view.publisher.publish(files, assets) # FIXME weird?
|
95
|
+
end
|
83
96
|
return [false, @out] unless ret
|
84
97
|
vdir = @blog.view.dir
|
85
98
|
dump("fix this later", "#{vdir}/last_published")
|
86
99
|
if ! testing || ! ret
|
87
|
-
puts "
|
100
|
+
puts " ...finished.\n "
|
88
101
|
output! "...finished.\n"
|
89
102
|
end
|
90
103
|
return [false, @out]
|
@@ -123,6 +136,7 @@ module RuneBlog::REPL
|
|
123
136
|
if @blog.view?(arg)
|
124
137
|
@blog.view = arg # reads config
|
125
138
|
output red("View: ") + bold(@blog.view.name.to_s) # FIXME?
|
139
|
+
puts "\n ", fx(arg, :bold), "\n" unless testing
|
126
140
|
end
|
127
141
|
end
|
128
142
|
return [false, @out]
|
data/lib/runeblog_version.rb
CHANGED
data/lib/view.rb
CHANGED
@@ -31,30 +31,24 @@ class RuneBlog::View
|
|
31
31
|
@name
|
32
32
|
end
|
33
33
|
|
34
|
-
def
|
34
|
+
def publishable_files
|
35
35
|
vdir = dir()
|
36
36
|
files = [index()]
|
37
|
-
others = Dir.entries(vdir).grep(/^\d\d\d\d/)
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
others = Dir.entries(vdir).grep(/^\d\d\d\d/).map {|x| "#{vdir}/#{x}" }
|
38
|
+
assets = Dir.entries("#{@blog.root}/assets") - %w[. ..]
|
39
|
+
assets.map! {|x| "#{@blog.root}/assets/#{x}" }
|
40
|
+
assets.reject! {|x| File.directory?(x) }
|
41
|
+
# assets.reject! {|x| ! recent?(x) }
|
42
|
+
files = files + others
|
43
|
+
all = files.dup
|
44
|
+
dirty = files.reject {|f| ! recent?(f) }
|
45
|
+
[dirty, all, assets]
|
41
46
|
end
|
42
47
|
|
43
48
|
def can_publish?
|
44
49
|
@can_publish
|
45
50
|
end
|
46
51
|
|
47
|
-
def publish
|
48
|
-
# ?? @blog.view.publisher.publish
|
49
|
-
# output "Files:"
|
50
|
-
# files.each {|f| output " #{f}\n" }
|
51
|
-
output_newline
|
52
|
-
list = files(true)
|
53
|
-
@publisher.publish(list)
|
54
|
-
rescue => err
|
55
|
-
error(err)
|
56
|
-
end
|
57
|
-
|
58
52
|
def recent?(file)
|
59
53
|
File.mtime(file) > File.mtime("#{dir()}/last_published")
|
60
54
|
rescue
|
data/test/general.rb
CHANGED
data/test/make_blog.rb
CHANGED