backpack-journal 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ === 1.1.0 / 2009-06-22
2
+
3
+ * Publish as a Gem.
4
+ * Standardize directory structure.
5
+ * Switch to new Hoe.
6
+
7
+ === 1.0.2 / 2008-05-23
8
+
9
+ * Unbreak RDoc generation.
10
+
11
+ === 1.0.1 / 2008-05-23
12
+
13
+ * Dependency, gem, and README fixes.
14
+
15
+ === 1.0.0 / 2008-05-22
16
+
17
+ * Birthday!
@@ -0,0 +1,6 @@
1
+ CHANGELOG.rdoc
2
+ Manifest.txt
3
+ README.rdoc
4
+ Rakefile
5
+ bin/backpack-journal
6
+ lib/backpack-journal.rb
@@ -0,0 +1,46 @@
1
+ = Backpack Journal
2
+
3
+ * http://github.com/jbarnette/backpack-journal
4
+
5
+ == Description
6
+
7
+ Make journal and status entries in 37signals' Backpack. This was a
8
+ lunchtime project, and it's been dormant for a while. I'm not even
9
+ sure if this code works. If you happen to use this and want to take
10
+ over as maintainer, drop me a line!
11
+
12
+ == Examples
13
+
14
+ # user-id is your NUMERIC user ID. Check your URL, e.g.,
15
+ # http://something.backpackit.com/users/31415926/edit
16
+
17
+ $ backpack-journal setup <user-id> <api-token>
18
+ $ backpack-journal status "Messing with backpack-journal!"
19
+ $ backpack-journal entry "Got my daily dose of awesome."
20
+
21
+ == Installation
22
+
23
+ $ gem install backpack-journal
24
+
25
+ == License
26
+
27
+ Copyright 2008 John Barnette <jbarnette@rubyforge.org>
28
+
29
+ Permission is hereby granted, free of charge, to any person obtaining
30
+ a copy of this software and associated documentation files (the
31
+ 'Software'), to deal in the Software without restriction, including
32
+ without limitation the rights to use, copy, modify, merge, publish,
33
+ distribute, sublicense, and/or sell copies of the Software, and to
34
+ permit persons to whom the Software is furnished to do so, subject to
35
+ the following conditions:
36
+
37
+ The above copyright notice and this permission notice shall be
38
+ included in all copies or substantial portions of the Software.
39
+
40
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
41
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
42
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
43
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
44
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
45
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
46
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,13 @@
1
+ require "rubygems"
2
+ require "hoe"
3
+
4
+ Hoe.spec "backpack-journal" do
5
+ developer "John Barnette", "jbarnette@rubyforge.org"
6
+
7
+ self.extra_rdoc_files = FileList["*.rdoc"]
8
+ self.history_file = "CHANGELOG.rdoc"
9
+ self.readme_file = "README.rdoc"
10
+ self.rubyforge_name = "backpackjournal"
11
+
12
+ extra_deps << ["thor", ">= 0.9.7"]
13
+ 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
@@ -0,0 +1,3 @@
1
+ module BackpackJournal
2
+ VERSION = "1.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: backpack-journal
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.0
5
+ platform: ruby
6
+ authors:
7
+ - John Barnette
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-06-22 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: thor
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.9.7
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: hoe
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 2.2.0
34
+ version:
35
+ description: |-
36
+ Make journal and status entries in 37signals' Backpack. This was a
37
+ lunchtime project, and it's been dormant for a while. I'm not even
38
+ sure if this code works. If you happen to use this and want to take
39
+ over as maintainer, drop me a line!
40
+ email:
41
+ - jbarnette@rubyforge.org
42
+ executables:
43
+ - backpack-journal
44
+ extensions: []
45
+
46
+ extra_rdoc_files:
47
+ - Manifest.txt
48
+ - CHANGELOG.rdoc
49
+ - README.rdoc
50
+ files:
51
+ - CHANGELOG.rdoc
52
+ - Manifest.txt
53
+ - README.rdoc
54
+ - Rakefile
55
+ - bin/backpack-journal
56
+ - lib/backpack-journal.rb
57
+ has_rdoc: true
58
+ homepage: http://github.com/jbarnette/backpack-journal
59
+ licenses: []
60
+
61
+ post_install_message:
62
+ rdoc_options:
63
+ - --main
64
+ - README.rdoc
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: "0"
72
+ version:
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: "0"
78
+ version:
79
+ requirements: []
80
+
81
+ rubyforge_project: backpackjournal
82
+ rubygems_version: 1.3.3
83
+ signing_key:
84
+ specification_version: 3
85
+ summary: Make journal and status entries in 37signals' Backpack
86
+ test_files: []
87
+