runeblog 0.0.95 → 0.0.96

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
  SHA1:
3
- metadata.gz: a9d4d9b1bcaafabe52df6f052937384b9ca18994
4
- data.tar.gz: 321bdd0774b16023c07aa178c186c979fe4e3189
3
+ metadata.gz: 6f6d3746b90f11a932bc05711f21f789809cca00
4
+ data.tar.gz: 48b95ce73c73cf0acce1a61377e1a0044ff75fd9
5
5
  SHA512:
6
- metadata.gz: 3f5b753295af284c6c58cae4a9835ccb4ec4533994a39ba5bddac3059de9fac885059d601216ec3472f61f70444fd7f2435d39b57a30b4749e83948b7b6497a5
7
- data.tar.gz: 87fa60d1c80194b23e5ee31fadea623455ec477ccb25e09e51994bbe4f9b92a0e51e4ae5f83dcec641d027744959a683452581cc65dfca237107a46c2b73e0e5
6
+ metadata.gz: 5a349ab1b13babe5d238d43787b1342d72aae3eb4c924b536f99525f4f6db4874d550a9678a16a031b11a6a268a2313ebf15f1072980d9ae49dc10464e00e5d1
7
+ data.tar.gz: 00c2de00d08e210e21acc2c82fa000e23f7e8fcc97d9383664b5354bac001e1401b5aa65df1de4e3fcffe84a1bb1ee652194af13fd57e0d99803390cc3a37b95
data/lib/global.rb CHANGED
@@ -10,7 +10,7 @@ class RuneBlog
10
10
  class View
11
11
  end
12
12
 
13
- class Deployment
13
+ class Publishing
14
14
  end
15
15
 
16
16
  class Post
data/lib/helpers-repl.rb CHANGED
@@ -50,7 +50,7 @@ module RuneBlog::REPL
50
50
 
51
51
  "rebuild" => :cmd_rebuild,
52
52
 
53
- "deploy" => :cmd_deploy,
53
+ "publish" => :cmd_publish,
54
54
 
55
55
  "q" => :cmd_quit,
56
56
  "quit" => :cmd_quit
@@ -193,14 +193,14 @@ module RuneBlog::REPL
193
193
 
194
194
  edit_initial_post(@fname)
195
195
  process_post(@fname)
196
- publish_post(@meta) # if publish?
196
+ link_post_all_views(@meta)
197
197
  rescue => err
198
198
  error(err)
199
199
  end
200
200
 
201
- def ask_deployment_info # returns Deployment object
201
+ def ask_publishing_info # returns Publishing object
202
202
  # user, server, root, path, protocol = "http"
203
- puts "Please enter deployment data for view #{@blog.view}..."
203
+ puts "Please enter publishing data for view #{@blog.view}..."
204
204
  user = ask("User: ")
205
205
  root = ask("Doc root: ")
206
206
  server = ask("Server: ")
@@ -208,7 +208,7 @@ module RuneBlog::REPL
208
208
  proto = ask("Protocol (ENTER for http): ")
209
209
  [user, root, server, path, proto].each {|x| x.chomp! }
210
210
  proto = "http" if proto.empty?
211
- RuneBlog::Deployment.new(user, server, root, path, proto)
211
+ RuneBlog::Publishing.new(user, server, root, path, proto)
212
212
  end
213
213
 
214
214
  ### find_asset
data/lib/post.rb CHANGED
@@ -54,7 +54,7 @@ class RuneBlog::Post
54
54
  error(err)
55
55
  end
56
56
 
57
- def publish
57
+ def build
58
58
  livetext = Livetext.new(STDOUT)
59
59
  @meta = livetext.process_file(@draft, binding)
60
60
  raise LivetextError(@draft) if @meta.nil?
@@ -1,7 +1,7 @@
1
1
  require 'helpers-blog'
2
2
  require 'runeblog'
3
3
 
4
- class RuneBlog::Deployment
4
+ class RuneBlog::Publishing
5
5
  attr_reader :user, :server, :docroot, :path
6
6
 
7
7
  BadRemoteLogin = Exception.new("Can't login remotely")
@@ -29,17 +29,17 @@ class RuneBlog::Deployment
29
29
  url = "#{protocol}://#{@server}/#{@path}"
30
30
  end
31
31
 
32
- def deploy(files)
32
+ def publish(files)
33
33
  reset_output
34
34
  dir = "#@docroot/#@path"
35
35
  result = system("ssh #@user@#@server -x mkdir #{dir}")
36
36
  list = files.join(' ')
37
37
  cmd = "scp -r #{list} #@user@##server:#{dir} >/dev/null 2>&1"
38
- output! "Deploying #{files.size} files...\n"
38
+ output! "Publishing #{files.size} files...\n"
39
39
  result = system(cmd)
40
- raise DeploymentError unless result
40
+ raise PublishError unless result
41
41
 
42
- dump(files, "#{@blog.view.dir}/last_deployed")
42
+ dump(files, "#{@blog.view.dir}/last_published")
43
43
  output! "...finished.\n"
44
44
  @out
45
45
  end
data/lib/repl.rb CHANGED
@@ -2,7 +2,7 @@ require 'runeblog'
2
2
  require 'ostruct'
3
3
  require 'helpers-repl' # FIXME structure
4
4
 
5
- make_exception(:DeploymentError, "Error during deployment")
5
+ make_exception(:PublishError, "Error during publishing")
6
6
  make_exception(:EditorProblem, "Could not edit $1")
7
7
 
8
8
  module RuneBlog::REPL
@@ -23,10 +23,10 @@ module RuneBlog::REPL
23
23
  def cmd_browse
24
24
  reset_output
25
25
  check_empty(arg)
26
- url = @blog.view.deployer.url
26
+ url = @blog.view.publisher.url
27
27
  # FIXME Bad logic here.
28
28
  if url.nil?
29
- output! "Deploy first."
29
+ output! "Publish first."
30
30
  return @out
31
31
  end
32
32
  result = system("open '#{url}'")
@@ -42,13 +42,13 @@ module RuneBlog::REPL
42
42
  raise CantOpen(local) unless result
43
43
  end
44
44
 
45
- def cmd_deploy(arg) # FIXME non-string return expected in caller?
45
+ def cmd_publish(arg) # FIXME non-string return expected in caller?
46
46
  reset_output
47
47
  check_empty(arg)
48
- @blog.view.deploy
49
- user, server, sroot, spath = *@deploy[@blog.view]
48
+ @blog.view.publish
49
+ user, server, sroot, spath = *@publish[@blog.view]
50
50
  if files.empty? # FIXME baloney
51
- output! "No files to deploy"
51
+ output! "No files to publish"
52
52
  return @out
53
53
  end
54
54
 
@@ -61,11 +61,11 @@ module RuneBlog::REPL
61
61
  # ^ needs -c??
62
62
 
63
63
  cmd = "scp -r #{files.join(' ')} root@#{server}:#{dir} >/dev/null 2>&1"
64
- output! "Deploying #{files.size} files...\n"
64
+ output! "Publishing #{files.size} files...\n"
65
65
  result = system(cmd)
66
- raise DeploymentError unless result
66
+ raise PublishError unless result
67
67
 
68
- dump(files, "#{vdir}/last_deployed")
68
+ dump(files, "#{vdir}/last_published")
69
69
  output! "...finished.\n"
70
70
  @out
71
71
  end
@@ -114,9 +114,9 @@ module RuneBlog::REPL
114
114
  def cmd_new_view(arg)
115
115
  reset_output
116
116
  @blog.create_view(arg)
117
- resp = yesno("Add deployment info now? ")
118
- @blog.view.deployer = ask_deployment_info
119
- write_config(@blog.view.deployer, @blog.view.dir + "/deploy") # change this?
117
+ resp = yesno("Add publishing info now? ")
118
+ @blog.view.publisher = ask_publishing_info
119
+ write_config(@blog.view.publisher, @blog.view.dir + "/publish") # change this?
120
120
  nil
121
121
  end
122
122
 
@@ -141,7 +141,7 @@ module RuneBlog::REPL
141
141
  @out
142
142
  end
143
143
 
144
- #-- FIXME affects linking, building, deployment...
144
+ #-- FIXME affects linking, building, publishing...
145
145
 
146
146
  def cmd_remove_post(arg, safe=true)
147
147
  # FIXME - 'safe' is no longer a thing
@@ -155,7 +155,7 @@ module RuneBlog::REPL
155
155
  @out
156
156
  end
157
157
 
158
- #-- FIXME affects linking, building, deployment...
158
+ #-- FIXME affects linking, building, publishing...
159
159
 
160
160
  def cmd_edit_post(arg)
161
161
  reset_output
@@ -242,10 +242,10 @@ module RuneBlog::REPL
242
242
  #{red('edit ID ')} Edit a post
243
243
 
244
244
  #{red('preview ')} Look at current (local) view in browser
245
- #{red('browse ')} Look at current (deployed) view in browser
245
+ #{red('browse ')} Look at current (published) view in browser
246
246
  #{red('relink ')} Regenerate index for all views
247
247
  #{red('rebuild ')} Regenerate all posts and relink
248
- #{red('deploy ')} Deploy (current view)
248
+ #{red('publish ')} Publish (current view)
249
249
  EOS
250
250
  @out
251
251
  end
data/lib/runeblog.rb CHANGED
@@ -4,7 +4,7 @@ require 'global'
4
4
  require 'helpers-blog'
5
5
  require 'default'
6
6
  require 'view'
7
- require 'deploy'
7
+ require 'publish'
8
8
  require 'post'
9
9
  require 'version'
10
10
 
@@ -57,7 +57,7 @@ class RuneBlog
57
57
 
58
58
  def initialize # assumes existing blog
59
59
  # Crude - FIXME later -
60
- # What views are there? Deployment, etc.
60
+ # What views are there? Publishing, etc.
61
61
  self.class.blog = self # Weird. Like a singleton - dumbass circular dependency?
62
62
  @root, @view_name, @editor =
63
63
  read_config(ConfigFile, :root, :current_view, :editor)
@@ -85,12 +85,12 @@ class RuneBlog
85
85
  case arg
86
86
  when RuneBlog::View
87
87
  @view = arg
88
- @view.deployer = read_config(@view.dir + "/deploy")
88
+ @view.publisher = read_config(@view.dir + "/publish")
89
89
  when String
90
90
  new_view = str2view(arg)
91
91
  raise NoSuchView(arg) if new_view.nil?
92
92
  @view = new_view
93
- @view.deployer = read_config(@view.dir + "/deploy")
93
+ @view.publisher = read_config(@view.dir + "/publish")
94
94
  else
95
95
  raise CantAssignView(arg.class.to_s)
96
96
  end
@@ -130,11 +130,11 @@ class RuneBlog
130
130
  create_dir('custom')
131
131
  create_dir('assets')
132
132
  # FIXME dump method??
133
- dump("", "deploy")
133
+ dump("", "publish")
134
134
  dump(x::BlogHeader, "custom/blog_header.html")
135
135
  dump(x::BlogTrailer, "custom/blog_trailer.html")
136
136
  dump(x::PostTemplate, "custom/post_template.html")
137
- dump("Initial creation", "last_deployed")
137
+ dump("Initial creation", "last_published")
138
138
  Dir.chdir(up)
139
139
  @views << RuneBlog::View.new(arg)
140
140
  end
@@ -152,7 +152,7 @@ class RuneBlog
152
152
  files = ["#{vdir}/index.html"]
153
153
  files += posts.map {|x| "#{vdir}/#{x}" }
154
154
  # Huh?
155
- files.reject! {|f| File.mtime(f) < File.mtime("#{vdir}/last_deployed") }
155
+ files.reject! {|f| File.mtime(f) < File.mtime("#{vdir}/last_published") }
156
156
  end
157
157
 
158
158
  def files_by_id(id) # FIXME get rid of this later
@@ -169,7 +169,7 @@ class RuneBlog
169
169
  meta.body ||= "Remainder of post goes here."
170
170
  post = RuneBlog::Post.new(meta, @view.to_s)
171
171
  post.edit unless testing
172
- post.publish
172
+ post.build
173
173
  post.num
174
174
  rescue => err
175
175
  puts err # error(err)
@@ -219,7 +219,7 @@ class RuneBlog
219
219
  error(err)
220
220
  end
221
221
 
222
- def publish_post(meta)
222
+ def link_post_all_views(meta)
223
223
  meta.views.each {|view| link_post_view(view) }
224
224
  # assets = find_all_assets(@meta.assets, views)
225
225
  nil
@@ -230,7 +230,7 @@ class RuneBlog
230
230
  def link_post_view(view)
231
231
  raise ArgumentError unless view.is_a?(String) || view.is_a?(RuneBlog::View)
232
232
  # Create dir using slug (index.html, metadata?)
233
- vdir = self.viewdir(view)
233
+ vdir = self.viewdir(view) # FIXME
234
234
  dir = vdir + @meta.slug + "/"
235
235
  create_dir(dir + "assets")
236
236
  Dir.chdir(dir) do
@@ -307,7 +307,7 @@ class RuneBlog
307
307
  def rebuild_post(file)
308
308
  raise ArgumentError unless file.is_a?(String)
309
309
  @meta = process_post(file)
310
- publish_post(@meta) # FIXME ??
310
+ link_post_all_views(@meta) # FIXME ??
311
311
  rescue => err
312
312
  error(err)
313
313
  end
data/lib/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  class RuneBlog
3
- VERSION = "0.0.95"
3
+ VERSION = "0.0.96"
4
4
 
5
5
  Path = File.expand_path(File.join(File.dirname(__FILE__)))
6
6
  end
data/lib/view.rb CHANGED
@@ -3,7 +3,7 @@ require 'runeblog'
3
3
 
4
4
  class RuneBlog::View
5
5
  attr_reader :name, :state
6
- attr_accessor :deployer
6
+ attr_accessor :publisher
7
7
 
8
8
  include RuneBlog::Helpers
9
9
 
@@ -11,8 +11,8 @@ class RuneBlog::View
11
11
  raise NoBlogAccessor if RuneBlog.blog.nil?
12
12
  @blog = RuneBlog.blog
13
13
  @name = name
14
- dep_file = @blog.root + "/views/#@name/deploy"
15
- @deployer = read_config(dep_file)
14
+ dep_file = @blog.root + "/views/#@name/publish"
15
+ @publisher = read_config(dep_file)
16
16
  end
17
17
 
18
18
  def dir
@@ -36,19 +36,19 @@ class RuneBlog::View
36
36
  files
37
37
  end
38
38
 
39
- def deploy
40
- # ?? @blog.view.deployment.deploy
39
+ def publish
40
+ # ?? @blog.view.publisher.publish
41
41
  # output "Files:"
42
42
  # files.each {|f| output " #{f}\n" }
43
43
  output_newline
44
44
  list = files(true)
45
- @deployer.deploy(list)
45
+ @publisher.publish(list)
46
46
  rescue => err
47
47
  error(err)
48
48
  end
49
49
 
50
50
  def recent?(file)
51
- File.mtime(file) < File.mtime("#{dir()}/last_deployed")
51
+ File.mtime(file) < File.mtime("#{dir()}/last_published")
52
52
  end
53
53
 
54
54
  end
data/test/general.rb CHANGED
@@ -98,7 +98,7 @@ class TestREPL < Minitest::Test
98
98
  "browse" => [:cmd_browse, nil],
99
99
  "relink" => [:cmd_relink, nil],
100
100
  "rebuild" => [:cmd_rebuild, nil],
101
- "deploy" => [:cmd_deploy, nil],
101
+ "publish" => [:cmd_publish, nil],
102
102
  "q" => [:cmd_quit, nil],
103
103
  "quit" => [:cmd_quit, nil]
104
104
  # Later: too many/few params
@@ -193,33 +193,33 @@ class TestREPL < Minitest::Test
193
193
  @blog.undelete_post(7)
194
194
  end
195
195
 
196
- if File.exist?("testing.deploy")
196
+ if File.exist?("testing.publish")
197
197
 
198
- def test_016_can_deploy
198
+ def test_016_can_publish
199
199
  x = OpenStruct.new
200
200
  x.user, x.server, x.docroot, x.docroot, x.path, x.proto =
201
201
  "root", "rubyhacker.com", "/var/www", "whatever", "http"
202
- dep = RuneBlog::Deployment.new(x)
202
+ dep = RuneBlog::Publishing.new(x)
203
203
  result = dep.remote_login?
204
204
  assert result == true, "Valid login doesn't work"
205
205
  result = dep.remote_permissions?
206
206
  assert result == true, "Valid mkdir doesn't work"
207
207
  end
208
208
 
209
- def test_017_cannot_deploy_wrong_user
209
+ def test_017_cannot_publish_wrong_user
210
210
  x = OpenStruct.new
211
211
  x.user, x.server, x.docroot, x.docroot, x.path, x.proto =
212
212
  "bad_user", "rubyhacker.com", "/var/www", "whatever", "http"
213
- dep = RuneBlog::Deployment.new(x)
213
+ dep = RuneBlog::Publishing.new(x)
214
214
  result = dep.remote_login?
215
215
  assert result.nil?, "Expected to detect login error (bad user)"
216
216
  end
217
217
 
218
- def test_018_cannot_deploy_bad_server
218
+ def test_018_cannot_publish_bad_server
219
219
  x = OpenStruct.new
220
220
  x.user, x.server, x.docroot, x.docroot, x.path, x.proto =
221
221
  "root", "nonexistent123.com", "/var/www", "whatever", "http"
222
- dep = RuneBlog::Deployment.new(x)
222
+ dep = RuneBlog::Publishing.new(x)
223
223
  result = dep.remote_login?
224
224
  assert result.nil?, "Expected to detect login error (bad server)"
225
225
  end
@@ -261,7 +261,7 @@ end # conditional tests
261
261
  end
262
262
 
263
263
  # later tests...
264
- # new view asks for deployment info and writes it
264
+ # new view asks for publishing info and writes it
265
265
  # (how to mimic user input? test some other way?)
266
266
 
267
267
  end
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.0.95
4
+ version: 0.0.96
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton
@@ -42,11 +42,11 @@ files:
42
42
  - "./runeblog.gemspec"
43
43
  - bin/blog
44
44
  - lib/default.rb
45
- - lib/deploy.rb
46
45
  - lib/global.rb
47
46
  - lib/helpers-blog.rb
48
47
  - lib/helpers-repl.rb
49
48
  - lib/post.rb
49
+ - lib/publish.rb
50
50
  - lib/repl.rb
51
51
  - lib/runeblog.rb
52
52
  - lib/version.rb