jbarnette-backpack-journal 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/Manifest.txt +8 -0
- data/README.txt +50 -0
- data/Rakefile +9 -0
- data/backpack-journal.gemspec +27 -0
- data/bin/backpack-journal +76 -0
- data/lib/backpack-journal/version.rb +3 -0
- data/test/test_backpack-journal.rb +0 -0
- metadata +81 -0
data/History.txt
ADDED
data/Manifest.txt
ADDED
data/README.txt
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
= backpack-journal
|
2
|
+
|
3
|
+
* http://github.com/jbarnette/backpack-journal
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
Make journal and status entries in 37signals' Backpack.
|
8
|
+
|
9
|
+
|
10
|
+
== FEATURES/PROBLEMS:
|
11
|
+
|
12
|
+
* This is lunchcode. Tread lightly.
|
13
|
+
|
14
|
+
== SYNOPSIS:
|
15
|
+
|
16
|
+
# NOTE: I usually alias to 'bpj'
|
17
|
+
backpack-journal setup <user-id> <user-token>
|
18
|
+
|
19
|
+
backpack-journal status "Messing with backpack-journal!"
|
20
|
+
|
21
|
+
backpack-journal entry "Got my daily dose of awesome."
|
22
|
+
|
23
|
+
== INSTALL:
|
24
|
+
|
25
|
+
sudo gem install jbarnette-backpack-journal --source=http://gems.github.com
|
26
|
+
|
27
|
+
== LICENSE:
|
28
|
+
|
29
|
+
(The MIT License)
|
30
|
+
|
31
|
+
Copyright (c) 2008 John Barnette <jbarnette@rubyforge.org>
|
32
|
+
|
33
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
34
|
+
a copy of this software and associated documentation files (the
|
35
|
+
'Software'), to deal in the Software without restriction, including
|
36
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
37
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
38
|
+
permit persons to whom the Software is furnished to do so, subject to
|
39
|
+
the following conditions:
|
40
|
+
|
41
|
+
The above copyright notice and this permission notice shall be
|
42
|
+
included in all copies or substantial portions of the Software.
|
43
|
+
|
44
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
45
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
46
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
47
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
48
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
49
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
50
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = %q{backpack-journal}
|
3
|
+
s.version = "1.0.0"
|
4
|
+
|
5
|
+
s.specification_version = 2 if s.respond_to? :specification_version=
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["John Barnette"]
|
9
|
+
s.date = %q{2008-05-22}
|
10
|
+
s.default_executable = %q{backpack-journal}
|
11
|
+
s.description = %q{Make journal and status entries in 37signals' Backpack.}
|
12
|
+
s.email = ["jbarnette@rubyforge.org"]
|
13
|
+
s.executables = ["backpack-journal"]
|
14
|
+
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
|
15
|
+
s.files = ["History.txt", "Manifest.txt", "README.txt", "Rakefile", "backpack-journal.gemspec", "bin/backpack-journal", "lib/backpack-journal/version.rb", "test/test_backpack-journal.rb"]
|
16
|
+
s.has_rdoc = true
|
17
|
+
s.homepage = %q{http://github.com/jbarnette/backpack-journal}
|
18
|
+
s.rdoc_options = ["--main", "README.txt"]
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
s.rubyforge_project = %q{backpack-journal}
|
21
|
+
s.rubygems_version = %q{1.1.1}
|
22
|
+
s.summary = %q{Make journal and status entries in 37signals' Backpack.}
|
23
|
+
s.test_files = ["test/test_backpack-journal.rb"]
|
24
|
+
|
25
|
+
s.add_dependency(%q<thor>, [">= 0.9.2"])
|
26
|
+
s.add_dependency(%q<hoe>, [">= 1.5.3"])
|
27
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "rubygems"
|
4
|
+
require "pathname"
|
5
|
+
require "thor"
|
6
|
+
|
7
|
+
require "net/http"
|
8
|
+
require "uri"
|
9
|
+
|
10
|
+
module BackpackJournal
|
11
|
+
class CLI < Thor
|
12
|
+
IDENTITY = Pathname.new(File.expand_path("~/.backpack-journal"))
|
13
|
+
|
14
|
+
desc "setup USER_ID TOKEN", "set up your Backpack identity"
|
15
|
+
def setup(user_id, token)
|
16
|
+
save_identity(user_id, token)
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "status MESSAGE", "set your current status"
|
20
|
+
def status(message)
|
21
|
+
user_id, token = load_identity
|
22
|
+
|
23
|
+
user_id, token = load_identity
|
24
|
+
|
25
|
+
url = URI.parse("http://adready.backpackit.com/users/#{user_id}/status.xml")
|
26
|
+
|
27
|
+
body =<<-END
|
28
|
+
<request>
|
29
|
+
<token>#{token}</token>
|
30
|
+
<status>
|
31
|
+
<message>#{message}</message>
|
32
|
+
</status>
|
33
|
+
</request>
|
34
|
+
END
|
35
|
+
|
36
|
+
request = Net::HTTP::Put.new(url.path)
|
37
|
+
request.body = body.strip
|
38
|
+
request.set_content_type("application/xml")
|
39
|
+
response = Net::HTTP.new(url.host, url.port).start { |h| h.request(request) }
|
40
|
+
end
|
41
|
+
|
42
|
+
desc "entry MESSAGE", "add a journal entry"
|
43
|
+
def entry(message)
|
44
|
+
user_id, token = load_identity
|
45
|
+
|
46
|
+
url = URI.parse("http://adready.backpackit.com/users/#{user_id}/journal_entries.xml")
|
47
|
+
|
48
|
+
body =<<-END
|
49
|
+
<request>
|
50
|
+
<token>#{token}</token>
|
51
|
+
<journal-entry>
|
52
|
+
<body>#{message}</body>
|
53
|
+
</journal-entry>
|
54
|
+
</request>
|
55
|
+
END
|
56
|
+
|
57
|
+
request = Net::HTTP::Post.new(url.path)
|
58
|
+
request.body = body.strip
|
59
|
+
request.set_content_type("application/xml")
|
60
|
+
response = Net::HTTP.new(url.host, url.port).start { |h| h.request(request) }
|
61
|
+
end
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
def save_identity(user_id, token)
|
66
|
+
IDENTITY.open("w") { |i| i.write("#{user_id},#{token}") }
|
67
|
+
end
|
68
|
+
|
69
|
+
def load_identity
|
70
|
+
abort("No identity: run backpack-journal setup") unless IDENTITY.exist?
|
71
|
+
IDENTITY.read.split(",")
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
BackpackJournal::CLI.start
|
File without changes
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jbarnette-backpack-journal
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- John Barnette
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-05-22 00:00:00 -07:00
|
13
|
+
default_executable: backpack-journal
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: thor
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.9.2
|
23
|
+
version:
|
24
|
+
- !ruby/object:Gem::Dependency
|
25
|
+
name: hoe
|
26
|
+
version_requirement:
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 1.5.3
|
32
|
+
version:
|
33
|
+
description: Make journal and status entries in 37signals' Backpack.
|
34
|
+
email:
|
35
|
+
- jbarnette@rubyforge.org
|
36
|
+
executables:
|
37
|
+
- backpack-journal
|
38
|
+
extensions: []
|
39
|
+
|
40
|
+
extra_rdoc_files:
|
41
|
+
- History.txt
|
42
|
+
- Manifest.txt
|
43
|
+
- README.txt
|
44
|
+
files:
|
45
|
+
- History.txt
|
46
|
+
- Manifest.txt
|
47
|
+
- README.txt
|
48
|
+
- Rakefile
|
49
|
+
- backpack-journal.gemspec
|
50
|
+
- bin/backpack-journal
|
51
|
+
- lib/backpack-journal/version.rb
|
52
|
+
- test/test_backpack-journal.rb
|
53
|
+
has_rdoc: true
|
54
|
+
homepage: http://github.com/jbarnette/backpack-journal
|
55
|
+
post_install_message:
|
56
|
+
rdoc_options:
|
57
|
+
- --main
|
58
|
+
- README.txt
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: "0"
|
66
|
+
version:
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: "0"
|
72
|
+
version:
|
73
|
+
requirements: []
|
74
|
+
|
75
|
+
rubyforge_project: backpack-journal
|
76
|
+
rubygems_version: 1.0.1
|
77
|
+
signing_key:
|
78
|
+
specification_version: 2
|
79
|
+
summary: Make journal and status entries in 37signals' Backpack.
|
80
|
+
test_files:
|
81
|
+
- test/test_backpack-journal.rb
|