runeblog 0.0.26 → 0.0.27

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/bin/blog +14 -1
  3. data/data/VERSION +1 -1
  4. data/lib/runeblog.rb +25 -3
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e864d009575482ec34e4a38a1b7498b79a1444e3
4
- data.tar.gz: cfbdbc4f3078d2ea1af6e2bbd36920cb08887020
3
+ metadata.gz: bf0dcc8def748a2e0a54573512b6a89a534dbe98
4
+ data.tar.gz: 9cce56ddeeab4c3e614f3d8fa22a11f6a0cdf500
5
5
  SHA512:
6
- metadata.gz: 2f7ffaba4caf91bbe66075fb3fb11a615a4a2d349a767607039c94a67318873d131cd61e9aa6230353d2ebef748c73ce84facd04a2fc9035a482b9ef9e2e7cc7
7
- data.tar.gz: 4351cf1556e89ab5abf11ed8009f6c2650e19956460aad24b261fb8129a17a4d5ba7a53fd10bf875db9cc5dfcdc026ebe0ae7f12371d930e0f611b3b45f4282e
6
+ metadata.gz: d8b53758adf82ef1a5b2354e05e4a02f44c1ec6358344674f188fc99c55bea224ea738d16f99f3e0bdbd759dfd210425be36f15bc3666383936e232609248d5d
7
+ data.tar.gz: 26280aae2cd1fcab1fe8e991bdd676ef7d9029cd96e53882e908b5dd9446b36cd40aabd50461def6583c0795179832a916d7424285231afd465e77ce99499823
data/bin/blog CHANGED
@@ -9,7 +9,7 @@ trap("INT") { }
9
9
  def execute_command
10
10
  case @meth
11
11
  when :help, :quit, :new_post, :list_views, :relink, :rebuild, :version,
12
- :list_posts, :list_drafts, :do_nothing, :deploy
12
+ :list_posts, :list_drafts, :do_nothing, :deploy, :open_remote, :open_local
13
13
  self.send(@meth)
14
14
  when Object
15
15
  self.send(@meth, @arg)
@@ -75,6 +75,19 @@ def parse_cmd
75
75
  when "version"
76
76
  @meth = :version
77
77
  expected(1)
78
+ when "open"
79
+ case @words.size
80
+ when 1
81
+ @meth = :open_local
82
+ when 2
83
+ if @words[1] == "remote"
84
+ @meth = :open_remote
85
+ else
86
+ raise "Don't know '#{@words[1]}'"
87
+ end
88
+ else
89
+ raise "Don't understand '#{@words.join(' ')}'"
90
+ end
78
91
  when "cv"
79
92
  raise "Too many arguments" if @words.size > 2
80
93
  @meth = :change_view
data/data/VERSION CHANGED
@@ -1 +1 @@
1
- RuneBlog v 0.0.26 2017-05-09
1
+ RuneBlog v 0.0.27 2017-05-10
data/lib/runeblog.rb CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  class RuneBlog
3
- VERSION = "0.0.26"
3
+ VERSION = "0.0.27"
4
4
 
5
5
  Path = File.expand_path(File.join(File.dirname(__FILE__)))
6
6
  DefaultData = Path + "/../data"
@@ -109,7 +109,7 @@ def new_blog!
109
109
  File.open("data/VERSION", "a") {|f| f.puts "\nBlog created: " + Time.now.to_s }
110
110
  end
111
111
  end
112
- end
112
+ end
113
113
 
114
114
  ### make_slug
115
115
 
@@ -161,14 +161,36 @@ def edit_post(file)
161
161
  system("vi #@root/src/#{file} +8 ")
162
162
  end
163
163
 
164
+ ### open_remote
165
+
166
+ def open_remote
167
+ @deploy ||= {}
168
+ unless @deploy[@view]
169
+ puts red("\n Deploy first.")
170
+ return
171
+ end
172
+ lines = @deploy[@view]
173
+ user, server, sroot, spath = *lines
174
+ system("open 'http://#{server}/#{spath}'")
175
+ end
176
+
177
+ ### open_local
178
+
179
+ def open_local
180
+ system("open #{@config.viewdir(@view)}/index.html")
181
+ end
182
+
164
183
  def deploy
165
184
  # TBD clunky FIXME
185
+ @deploy ||= {}
166
186
  deployment = @config.viewdir(@view) + "deploy"
167
187
  lines = File.readlines(deployment).map {|x| x.chomp }
168
- user, server, dir = *lines
188
+ @deploy[@view] = lines
189
+ user, server, sroot, spath = *lines
169
190
  vdir = @config.viewdir(@view)
170
191
  files = ["#{vdir}/index.html"]
171
192
  files += Dir.entries(vdir).grep(/^\d\d\d\d/).map {|x| "#{vdir}/#{x}" }
193
+ dir = "#{sroot}/#{spath}"
172
194
  cmd = "scp -r #{files.join(' ')} root@#{server}:#{dir} >/dev/null 2>&1"
173
195
  print red("\n Deploying #{files.size} files... ")
174
196
  # puts cmd
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runeblog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.26
4
+ version: 0.0.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-09 00:00:00.000000000 Z
11
+ date: 2017-05-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A blog system based on Ruby and Livetext
14
14
  email: rubyhacker@gmail.com