blastr 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.0.9 2009-01-17
2
+
3
+ * Added usage instructions.
4
+
1
5
  == 0.0.8 2009-01-17
2
6
 
3
7
  * Bug fix.
data/README.rdoc CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  Blastr observes a version control repository for commits and makes audible announcements out of the commit messages. It currently supports Subversion and Git on Linux and OS X, possibly on other UNIX-like operating systems as well.
8
8
 
9
- == FEATURES/PROBLEMS:
9
+ == FEATURES:
10
10
 
11
11
  Blastr watches for incoming commits to a source repository and voices the commit
12
12
  messages out loud.
@@ -35,6 +35,10 @@ being in the user's PATH.
35
35
 
36
36
  sudo gem install blastr
37
37
 
38
+ == KNOWN PROBLEMS AND GOTCHAS:
39
+
40
+ * Blastr doesn't provide any kind of online help, there's no "--help" option, etc.
41
+
38
42
  == LICENSE:
39
43
 
40
44
  (The BSD License)
data/bin/blastr CHANGED
@@ -3,4 +3,8 @@
3
3
  require 'rubygems'
4
4
  require "#{File.dirname(__FILE__)}/../lib/blastr.rb"
5
5
 
6
- Blastr::Process.new(ARGV).run
6
+ begin
7
+ Blastr::Process.new(ARGV).run
8
+ rescue Blastr::UsageError => e
9
+ puts e
10
+ end
data/lib/blastr.rb CHANGED
@@ -6,14 +6,44 @@ module Blastr
6
6
  require 'tts/tts.rb'
7
7
  require 'people/people.rb'
8
8
 
9
- VERSION = '0.0.8'
9
+ VERSION = '0.0.9'
10
+
11
+ class UsageError < ArgumentError
12
+
13
+ USAGE_TEXT = <<EOS
14
+
15
+ Usage: blastr URL [revision]
16
+
17
+ The options are as follows:
18
+
19
+ URL (required) The URL identifying the source repository
20
+ you want to observe. For Subversion repositories the
21
+ URL could be, for example, "http://svn.foo.com/bar" or
22
+ "svn://svn.foo.com/bar". For a Git repository, the URL
23
+ usually looks like "git://github.com/foo/bar.git".
24
+
25
+ revision (optional) The revision or commit you want to start
26
+ observing from. For a Subversion repository, this
27
+ would be a number (e.g. 123 or 5000). For Git, the
28
+ revision would be the commit SHA hash - something that
29
+ looks like "4d1863552c03bc1ff9c9376b9a24b04daabc67e2".
30
+ When this option is omitted, Blastr starts observing
31
+ from the latest revision onwards.
32
+
33
+ EOS
34
+
35
+ def initialize
36
+ super(USAGE_TEXT)
37
+ end
38
+ end
10
39
 
11
40
  class Process
12
41
  def initialize(args=[])
13
- scm_url = ARGV[0]
42
+ validate(args)
43
+ scm_url = args[0]
14
44
  @scm = Blastr::SourceControl.implementation_for(scm_url)
15
- @since_revision = @scm.as_revision(ARGV[1]) if ARGV.size > 1
16
- @since_revision = @scm.latest_revision unless ARGV.size > 1
45
+ @since_revision = @scm.as_revision(args[1]) if args.size > 1
46
+ @since_revision = @scm.latest_revision unless args.size > 1
17
47
  end
18
48
 
19
49
  def run
@@ -29,6 +59,7 @@ module Blastr
29
59
  Blastr::TTS.speak("Commit by #{People.full_name_of(commit.author)}: #{commit.comment}")
30
60
  end
31
61
 
62
+ private
32
63
  def announce_new_commits
33
64
  @scm.commits_since(@since_revision.to_s).each do |commit|
34
65
  if @since_revision.before?(commit.revision)
@@ -37,6 +68,9 @@ module Blastr
37
68
  end
38
69
  end
39
70
  end
71
+ def validate(args)
72
+ raise UsageError.new if args.size == 0 or args.size > 2
73
+ end
40
74
  end
41
75
 
42
76
  def Blastr::temp_dir
data/lib/people/people.rb CHANGED
@@ -3,7 +3,20 @@ require 'yaml'
3
3
  module Blastr
4
4
  class People
5
5
  PEOPLE_FILE = File.expand_path("~/.blastr/people")
6
- CONFIG_HELP_MESSAGE = ""
6
+ CONFIG_HELP_MESSAGE = <<EOS
7
+
8
+ If you'd like Blastr to pronounce committers' real names instead of their
9
+ UNIX names, you can create a YAML configuration file at
10
+
11
+ #{PEOPLE_FILE}
12
+
13
+ The file format is like this:
14
+
15
+ johndoe: John Doe
16
+ janedoe: Jane Doe
17
+ jimbo: James Ruby
18
+
19
+ EOS
7
20
 
8
21
  puts CONFIG_HELP_MESSAGE unless File.file?(PEOPLE_FILE)
9
22
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blastr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lasse Koskela