posterous 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
data/bin/posterous
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
HELP_DOC
|
3
|
+
CONFIG_PATH = "#{ENV['HOME']}/.posterousrc"
|
4
|
+
HELP_DOC = <<DOC
|
5
5
|
## API Help ##
|
6
6
|
|
7
7
|
# Get your primary site
|
@@ -29,22 +29,25 @@ HELP_DOC = <<DOC
|
|
29
29
|
=> <#<Posterous::Comment:0x0000010135f758> ... }>
|
30
30
|
DOC
|
31
31
|
|
32
|
-
def newb
|
33
|
-
puts HELP_DOC
|
34
|
-
end
|
35
|
-
|
36
32
|
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
37
33
|
|
38
34
|
%w{posterous irb fileutils}.each { |f| require f }
|
39
35
|
|
36
|
+
def newb
|
37
|
+
puts HELP_DOC
|
38
|
+
end
|
40
39
|
|
41
|
-
def
|
42
|
-
@
|
40
|
+
def current_user
|
41
|
+
@current_user ||= User.me
|
42
|
+
end
|
43
|
+
|
44
|
+
def load_or_setup_config
|
45
|
+
@yml = YAML.load_file(CONFIG_PATH) rescue nil
|
43
46
|
|
44
47
|
if @yml.is_a?(Hash)
|
45
48
|
@cfg = @yml
|
46
49
|
else
|
47
|
-
@rc = File.open(
|
50
|
+
@rc = File.open(CONFIG_PATH, 'w')
|
48
51
|
@cfg = {}
|
49
52
|
puts "Email Address:"
|
50
53
|
@cfg['username'] = gets.chomp
|
@@ -67,27 +70,22 @@ def setup
|
|
67
70
|
begin
|
68
71
|
Posterous::User.me
|
69
72
|
rescue Exception => e
|
70
|
-
FileUtils.rm(
|
73
|
+
FileUtils.rm(CONFIG_PATH, :force => true)
|
74
|
+
|
71
75
|
puts "*"*100
|
72
|
-
puts "Invalid Login: #{e.inspect}"
|
76
|
+
puts "\033[31m#Invalid Login: #{e.inspect}\033[0m"
|
73
77
|
puts "*"*100
|
74
|
-
|
78
|
+
|
79
|
+
load_or_setup_config
|
75
80
|
end
|
76
81
|
end
|
77
82
|
|
78
|
-
|
79
|
-
|
83
|
+
load_or_setup_config
|
80
84
|
|
81
85
|
include Posterous
|
82
86
|
|
83
|
-
def current_user
|
84
|
-
@current_user ||= User.me
|
85
|
-
end
|
86
|
-
|
87
|
-
|
88
|
-
|
89
87
|
puts "*"*100
|
90
|
-
puts "
|
88
|
+
puts "\033[32mHi #{current_user.nickname}, welcome to the Posterous API Console! For help type `newb`.\033[0m\n"
|
91
89
|
puts "*"*100
|
92
90
|
|
93
91
|
IRB.setup(nil)
|
data/lib/posterous/version.rb
CHANGED
@@ -17,39 +17,4 @@ describe Posterous::ExternalSite do
|
|
17
17
|
@external_sites.each{|p| p.id.should_not be_nil }
|
18
18
|
end
|
19
19
|
end
|
20
|
-
|
21
|
-
describe "CRUD" do
|
22
|
-
before(:all) do
|
23
|
-
@external_site = @primary.external_sites.create({
|
24
|
-
:site_url => 'http://chrisburnett.tumblr.com',
|
25
|
-
:service_type => 'ExtTumblr',
|
26
|
-
:username => 'foo'
|
27
|
-
})
|
28
|
-
@external_site_id = @external_site.id
|
29
|
-
end
|
30
|
-
|
31
|
-
describe "#create" do
|
32
|
-
it "creates a external_site" do
|
33
|
-
@external_site.site_url.should == 'http://chrisburnett.tumblr.com'
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
#describe "#save" do
|
38
|
-
#it "updates a external_site" do
|
39
|
-
#@external_site.site_url = 'http://chrisburnett.tumblr.com'
|
40
|
-
#@external_site.save
|
41
|
-
#@external_site.reload.blogid.should == 'bar'
|
42
|
-
#end
|
43
|
-
#end
|
44
|
-
|
45
|
-
describe "#destroy" do
|
46
|
-
it "deletes a external_site and raises a Connection error when not found" do
|
47
|
-
@external_site.destroy
|
48
|
-
lambda {
|
49
|
-
@primary.external_sites.find(@external_site.id)
|
50
|
-
}.should raise_error Posterous::Connection::ConnectionError
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
20
|
end
|
@@ -20,25 +20,4 @@ describe Posterous::Subscriber do
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
describe "CRUD" do
|
24
|
-
before(:all) do
|
25
|
-
@subscriber = @primary.subscribers.create({:user_id => FAKE_USER_ID})
|
26
|
-
end
|
27
|
-
|
28
|
-
describe "#create" do
|
29
|
-
it "creates a subscriber" do
|
30
|
-
@primary.subscribers.all.first.id.should == FAKE_USER_ID
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe "#destroy" do
|
35
|
-
it "deletes a subscriber and raises a Connection error when not found" do
|
36
|
-
@primary.subscribers.first.destroy
|
37
|
-
lambda {
|
38
|
-
@primary.subscribers.find(FAKE_USER_ID)
|
39
|
-
}.should raise_error Posterous::Connection::ConnectionError
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
23
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 4
|
9
|
+
version: 0.2.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Christopher Burnett @twoism
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-
|
17
|
+
date: 2011-06-08 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|