mcornick-laika 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +4 -1
- data/bin/laika +13 -1
- data/lib/laika/version.rb +1 -1
- metadata +2 -2
data/README.markdown
CHANGED
@@ -8,7 +8,7 @@ Laika (Russian: Лайка, "barker") is a simple script to monitor an RSS or At
|
|
8
8
|
|
9
9
|
Laika is delivered as a RubyGem:
|
10
10
|
|
11
|
-
sudo gem install
|
11
|
+
sudo gem install laika
|
12
12
|
|
13
13
|
## Usage
|
14
14
|
|
@@ -30,6 +30,7 @@ Now you're ready to start barking about feeds. You can see all Laika's options b
|
|
30
30
|
laika-auth) (default: laika.yml)
|
31
31
|
--url, -u <s>: URL of the feed to bark about
|
32
32
|
--dont-yammer, -d: Don't post to Yammer, just echo to standard out
|
33
|
+
--announcement, -a <s>: Announcement format. See the documentation
|
33
34
|
--version, -v: Print version and exit
|
34
35
|
--help, -h: Show this message
|
35
36
|
|
@@ -39,6 +40,8 @@ When running for the first time, you will also need to specify --url for the URL
|
|
39
40
|
|
40
41
|
--credential-file specifies the location of the file written by laika-auth. It will default to "laika.yml" in the current directory, but if it is elsewhere, you can specify it here.
|
41
42
|
|
43
|
+
--announcement lets you change the announcement text. The default text is `ENTRY_AUTHOR just posted "ENTRY_TITLE" to FEED_TITLE: ENTRY_URL`, with the uppercase strings converted to the appropriate values from the feed.
|
44
|
+
|
42
45
|
Finally, --dont-yammer is useful for testing, or for avoiding spamming Yammer. It will send announcements of new posts to standard output, rather than to Yammer.
|
43
46
|
|
44
47
|
You will probably want to run Laika periodically from cron. When doing so, providing only the --feed-file option should be sufficient (unless you also need to specify a non-default --credential-file.)
|
data/bin/laika
CHANGED
@@ -11,11 +11,23 @@ opts = Trollop::options do
|
|
11
11
|
opt :credential_file, "File with Yammer credential data (from laika-auth)", :type => String, :default => 'laika.yml'
|
12
12
|
opt :url, "URL of the feed to bark about", :type => String
|
13
13
|
opt :dont_yammer, "Don't post to Yammer, just echo to standard out", :default => false
|
14
|
+
opt :announcement, "Announcement format. See the documentation", :type => String
|
14
15
|
end
|
15
16
|
|
16
17
|
Trollop::die(:feed_file, "must be specified") unless opts[:feed_file]
|
17
18
|
Trollop::die(:url, "must be specified because #{opts[:feed_file]} does not yet exist") if opts[:feed_file] && !opts[:url] && !File.exist?(opts[:feed_file])
|
18
19
|
|
20
|
+
opts[:announcement] = "ENTRY_AUTHOR just posted \"ENTRY_TITLE\" to FEED_TITLE: ENTRY_URL" unless opts[:announcement]
|
21
|
+
|
22
|
+
def announcement_for(feed, entry, template)
|
23
|
+
a = template.clone
|
24
|
+
a = a.sub('ENTRY_AUTHOR', entry.author.strip)
|
25
|
+
a = a.sub('ENTRY_TITLE', entry.title.strip)
|
26
|
+
a = a.sub('FEED_TITLE', feed.title.strip)
|
27
|
+
a = a.sub('ENTRY_URL', entry.urls.first.strip)
|
28
|
+
a
|
29
|
+
end
|
30
|
+
|
19
31
|
unless opts[:url].nil?
|
20
32
|
begin
|
21
33
|
blog = Laika::Blog.new(opts[:url])
|
@@ -31,7 +43,7 @@ else
|
|
31
43
|
end
|
32
44
|
|
33
45
|
begin
|
34
|
-
announcements = blog.get_new_entries.collect { |e|
|
46
|
+
announcements = blog.get_new_entries.collect { |e| announcement_for(blog.feed, e, opts[:announcement]) }
|
35
47
|
rescue
|
36
48
|
Trollop::die(:feed_file, "could not be parsed")
|
37
49
|
end
|
data/lib/laika/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mcornick-laika
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Cornick
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-11-
|
12
|
+
date: 2008-11-18 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|