shabng 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/HISTORY +4 -1
- data/bin/shabng +6 -2
- data/lib/post.rb +19 -11
- data/shabng.gemspec +1 -1
- metadata +3 -3
data/HISTORY
CHANGED
@@ -7,4 +7,7 @@
|
|
7
7
|
* Cleanup releases, figuring out how Rubygems work.
|
8
8
|
|
9
9
|
==0.0.7 - November 14, 2010
|
10
|
-
* Addition of sequence attribute for posts, so we're not combing through everyone's posts to edit.
|
10
|
+
* Addition of sequence attribute for posts, so we're not combing through everyone's posts to edit.
|
11
|
+
|
12
|
+
==0.0.8 - November 14, 2010
|
13
|
+
* Addition of sequence attribute for categories (same technique and reason as for posts...)
|
data/bin/shabng
CHANGED
@@ -8,7 +8,7 @@ require 'xmlsimple'
|
|
8
8
|
#require 'ap'
|
9
9
|
require 'post.rb'
|
10
10
|
|
11
|
-
SB_VERSION = "0.0.
|
11
|
+
SB_VERSION = "0.0.8"
|
12
12
|
|
13
13
|
# get configuration file
|
14
14
|
# and conduct testing to ensure proper setup
|
@@ -62,7 +62,11 @@ if arg == "list"
|
|
62
62
|
# list all blog posts
|
63
63
|
puts "Here are your blog postings..."
|
64
64
|
@post = Post.new(@urlstring, @apikey)
|
65
|
-
|
65
|
+
if arg2.nil? || arg2 == "posts"
|
66
|
+
@post.list("posts")
|
67
|
+
elsif arg2 == "categories"
|
68
|
+
@post.list("categories")
|
69
|
+
end
|
66
70
|
|
67
71
|
elsif arg == "new"
|
68
72
|
if arg2.nil? || arg2 == "post"
|
data/lib/post.rb
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rest-client'
|
3
3
|
require 'xmlsimple'
|
4
4
|
require 'time'
|
5
|
-
|
5
|
+
|
6
6
|
class Post
|
7
7
|
|
8
8
|
attr_accessor :title, :body, :publication_date, :status, :blogid, :apikey
|
@@ -20,16 +20,24 @@ class Post
|
|
20
20
|
puts "Blog post has been saved with ID " + post["id"].first["content"]
|
21
21
|
end
|
22
22
|
|
23
|
-
def list
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
posts["post"].
|
28
|
-
|
29
|
-
|
23
|
+
def list(action)
|
24
|
+
if action == "posts"
|
25
|
+
docs = RestClient.get @urlstring + "/posts", :params=>{:api_key=>@apikey}
|
26
|
+
posts = XmlSimple.xml_in(docs)
|
27
|
+
if posts["post"].nil? == false
|
28
|
+
posts["post"].each do |d|
|
29
|
+
pubdate = Time.parse(d["publication-date"].first["content"])
|
30
|
+
puts "[" + d["sequence"].first["content"] + "] " + d["title"].first + " - " + pubdate.strftime("%Y-%m-%d") + " - " + d["status"].first
|
31
|
+
end
|
32
|
+
else
|
33
|
+
puts "No postings yet. Use the new command to create your first!"
|
34
|
+
end
|
35
|
+
elsif action == "categories"
|
36
|
+
xml = RestClient.get @urlstring + "/categories", :params=>{:api_key => @apikey}
|
37
|
+
post = XmlSimple.xml_in(xml)
|
38
|
+
post["category"].each do |c|
|
39
|
+
puts "[" + c["sequence"].first["content"] + "] " + c["name"].first
|
30
40
|
end
|
31
|
-
else
|
32
|
-
puts "No postings yet. Use the new command to create your first!"
|
33
41
|
end
|
34
42
|
end
|
35
43
|
|
@@ -73,7 +81,7 @@ class Post
|
|
73
81
|
xml = RestClient.get @urlstring + "/categories", :params=>{:api_key => @apikey}
|
74
82
|
post = XmlSimple.xml_in(xml)
|
75
83
|
post["category"].each do |c|
|
76
|
-
puts "[" + c["
|
84
|
+
puts "[" + c["sequence"].first["content"] + "] " + c["name"].first
|
77
85
|
end
|
78
86
|
puts "Enter a comma-separated list of category IDs: "
|
79
87
|
cats = STDIN.gets.chomp
|
data/shabng.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
|
|
7
7
|
## If your rubyforge_project name is different, then edit it and comment out
|
8
8
|
## the sub! line in the Rakefile
|
9
9
|
s.name = 'shabng'
|
10
|
-
s.version = '0.0.
|
10
|
+
s.version = '0.0.8'
|
11
11
|
s.date = '2010-11-14'
|
12
12
|
s.rubyforge_project = 'shabng'
|
13
13
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shabng
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 8
|
10
|
+
version: 0.0.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Aaron Vegh
|