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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e4b3cbc5968e9ae601693f9100c564bd52c78d521fbc51c6ba6e2a92d414c0d4
4
- data.tar.gz: c408d74ef879272abc36334d0fbacc8055d28b0529775fc91a77fc3f128bc27c
3
+ metadata.gz: f04213603ad7442242abfeeff05336fe1c3c47599c1228c1536454a3e15506b7
4
+ data.tar.gz: 334d6df9b57edf8e8c0c23cb0c74a12623cd152127e6ef5cfde696f54a27946d
5
5
  SHA512:
6
- metadata.gz: b832c5dee0d21f88ec60185de217135ff28134e96416ad4953a3bc1f67fd2714b6a099801bace01172d16f6bda429af812c6938b0c07ff74f1ff7496bae61f90
7
- data.tar.gz: 2150a767245ac855bf3a14707da752409c4a9a30b97ed4f5b2f6e68539326d822aa73b4385dd7e4e6d80e1aa2559152b52728bde0edf957d8f8d6430f3259b9a
6
+ metadata.gz: d9729e32ff5d6001992bd1ef136f44a6ab9efcdade913862b08b22aaee1b97e87796647b1e6fb425b60fad68af8ee091c1b2aa17019f2f91ad224efbc5dfb7e8
7
+ data.tar.gz: 2cc280923f48d76cf89cc54ae62089bb047dfdcf1114464f2c6eefe714a2656868c5fcfed0098ccbb7f7ab5ca71dfa56ff08efe42a109554e5f6267d374270d6
data/lib/default.rb CHANGED
@@ -11,7 +11,7 @@ BlogHeader = <<-TEXT
11
11
  <table>
12
12
  <tr>
13
13
  <td>
14
- <img src=fakeimage.jpg width=400 height=300>
14
+ <img src=../assets/fakeimage.jpg width=400 height=300>
15
15
  </td>
16
16
  <td>
17
17
  <h3>Yet another blog... by Kilgore Trout</h3>
data/lib/helpers-blog.rb CHANGED
@@ -45,7 +45,6 @@ module RuneBlog::Helpers
45
45
  Dir.mkdir(".blog")
46
46
  x = OpenStruct.new
47
47
  x.root, x.current_view, x.editor = root, current_view, editor
48
- puts "config = #{RuneBlog::ConfigFile}"
49
48
  write_config(x, RuneBlog::ConfigFile)
50
49
  end
51
50
 
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 no_files?(files)
33
- if files.empty?
34
- STDSCR.up
35
- puts fx("\n No files to publish", :bold)
36
- true
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 -r #{list} #@user@#@server:#{dir} >/dev/null 2>/tmp/wtf"
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
- ret = RubyText.spinner(label: "Publishing... ") { @blog.view.publish }
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 " ...finished.\n "
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]
@@ -1,6 +1,6 @@
1
1
 
2
2
  class RuneBlog
3
- VERSION = "0.1.23"
3
+ VERSION = "0.1.24"
4
4
 
5
5
  Path = File.expand_path(File.join(File.dirname(__FILE__)))
6
6
  end
data/lib/view.rb CHANGED
@@ -31,30 +31,24 @@ class RuneBlog::View
31
31
  @name
32
32
  end
33
33
 
34
- def files(recent = false)
34
+ def publishable_files
35
35
  vdir = dir()
36
36
  files = [index()]
37
- others = Dir.entries(vdir).grep(/^\d\d\d\d/)
38
- files += others.map {|x| "#{vdir}/#{x}" }
39
- files.reject! {|f| ! recent?(f) } if recent
40
- files
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
@@ -6,6 +6,7 @@ require 'runeblog'
6
6
  require 'lib/repl'
7
7
  require 'rubytext'
8
8
 
9
+
9
10
  RubyText.start
10
11
 
11
12
  class TestREPL < Minitest::Test
data/test/make_blog.rb CHANGED
@@ -5,7 +5,7 @@ require 'global'
5
5
  require 'repl'
6
6
 
7
7
  def debug(str)
8
- STDERR.puts str
8
+ # STDERR.puts str
9
9
  end
10
10
 
11
11
  def make_post(x, title)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runeblog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.23
4
+ version: 0.1.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton