cliblog 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +2 -0
- data/bin/cliblog +2 -2
- data/lib/cliblog.rb +3 -0
- metadata +2 -3
- data/bin/trackback.rb +0 -69
data/ChangeLog
CHANGED
data/bin/cliblog
CHANGED
@@ -37,10 +37,10 @@ cliblog = CliBlog.new(conf)
|
|
37
37
|
|
38
38
|
# blog login
|
39
39
|
puts "\nNow, you're trying to login <<#{conf.blogid}>>"
|
40
|
-
|
40
|
+
loop do
|
41
41
|
begin
|
42
42
|
cliblog.login
|
43
|
-
|
43
|
+
break
|
44
44
|
rescue
|
45
45
|
puts "#{$!}... Retrying..."
|
46
46
|
redo
|
data/lib/cliblog.rb
CHANGED
@@ -12,8 +12,11 @@ require 'uri'
|
|
12
12
|
require 'xmlrpc/client'
|
13
13
|
require 'yaml'
|
14
14
|
|
15
|
+
# Supported commands.
|
15
16
|
COMMANDS = %w{ list view create edit delete category help quit }
|
17
|
+
# Blog configuration includes cliblog.yml, except username/password.
|
16
18
|
BlogConfig = Struct.new(:blogid, :url, :api, :text_formatter, :username, :password)
|
19
|
+
# Template for creating a new post.
|
17
20
|
POST_TEMPLATE = <<END_TPL
|
18
21
|
---
|
19
22
|
title:
|
metadata
CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.8.10
|
|
3
3
|
specification_version: 1
|
4
4
|
name: cliblog
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.1.
|
6
|
+
version: 0.1.6
|
7
7
|
date: 2005-06-27
|
8
8
|
summary: cliblog is a command-line blog client.
|
9
9
|
require_paths:
|
@@ -37,7 +37,6 @@ files:
|
|
37
37
|
- test/tc_option_config.rb
|
38
38
|
- bin/CVS
|
39
39
|
- bin/cliblog
|
40
|
-
- bin/trackback.rb
|
41
40
|
- conf/CVS
|
42
41
|
- conf/cliblog.yml
|
43
42
|
- README
|
@@ -66,7 +65,7 @@ extensions: []
|
|
66
65
|
requirements: []
|
67
66
|
dependencies:
|
68
67
|
- !ruby/object:Gem::Dependency
|
69
|
-
name:
|
68
|
+
name: highline
|
70
69
|
version_requirement:
|
71
70
|
version_requirements: !ruby/object:Gem::Version::Requirement
|
72
71
|
requirements:
|
data/bin/trackback.rb
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# = Send trackback using EDITOR.
|
4
|
-
#
|
5
|
-
# See http://www.sixapart.com/pronet/docs/trackback_spec
|
6
|
-
#
|
7
|
-
# - License : Ruby's
|
8
|
-
# - Author : Gyoung-Yoon Noh <nohmad@sub-port.net>
|
9
|
-
#
|
10
|
-
# TODO:
|
11
|
-
# - How to get comment from xml document? (SGML Parser or strscan?)
|
12
|
-
#
|
13
|
-
# $Id: trackback.rb 132 2005-06-23 23:59:53Z nohmad $
|
14
|
-
|
15
|
-
require 'cgi'
|
16
|
-
require 'net/http'
|
17
|
-
require 'tempfile'
|
18
|
-
require 'uri'
|
19
|
-
require 'yaml'
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
if $0 == __FILE__ then
|
24
|
-
msg = TrackBack::Message.new
|
25
|
-
|
26
|
-
Tempfile.open('trackback-') do |tf|
|
27
|
-
# Read template.
|
28
|
-
tf << DATA.read
|
29
|
-
tf.fsync
|
30
|
-
|
31
|
-
# Launch EDITOR.
|
32
|
-
Thread.new(tf.path) do |path|
|
33
|
-
unless editor = ENV['EDITOR']
|
34
|
-
$stdout.sync = $stdin.sync = true
|
35
|
-
$stdout.write "EDITOR path: "
|
36
|
-
editor = $stdin.gets.chomp
|
37
|
-
end
|
38
|
-
system "#{editor} #{path}"
|
39
|
-
end.join
|
40
|
-
|
41
|
-
# Fill sending message.
|
42
|
-
tf.seek(0)
|
43
|
-
yaml = YAML.load(tf.read)
|
44
|
-
begin
|
45
|
-
yaml.each_pair do |key, value|
|
46
|
-
if key == 'TB-URL' then
|
47
|
-
$tb_url = value
|
48
|
-
else
|
49
|
-
msg[key.downcase.sub('-', '_')] = value.to_s.strip
|
50
|
-
end
|
51
|
-
end
|
52
|
-
rescue
|
53
|
-
fail $!
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
fail "-!- Wrong Input -!-" if
|
58
|
-
msg.members.select{ |k| msg.send(k).nil? or msg.send(k).empty? }.any?
|
59
|
-
p TrackBack::send_ping($tb_url, msg)
|
60
|
-
end
|
61
|
-
|
62
|
-
TB_TEMPLATE = <<END_TBTPL
|
63
|
-
---
|
64
|
-
TB-URL : '<TrackBack Ping URL>'
|
65
|
-
URL : '<Your Blog URL>'
|
66
|
-
Blog-Name : '<Your Blog Name>'
|
67
|
-
Title : '<This Entry Title>'
|
68
|
-
Excerpt :
|
69
|
-
END_TBTPL
|