one_inch_punch 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ == 0.4.1 2008-08-26
2
+
3
+ * 1 tiny enhancement:
4
+ * allowing command-line log message to be specified with --message
5
+ (will take precedence over normal message argument if both are specified)
6
+
1
7
  == 0.4.0 2008-08-17
2
8
 
3
9
  * 1 minor enhancement:
data/bin/punch CHANGED
@@ -30,9 +30,9 @@ BANNER
30
30
  opts.on('--before [TIME]', String,
31
31
  "Restrict command to only before the given time") { |time| OPTIONS[:before] = Time.parse(time) }
32
32
  opts.on('--at [TIME]', '--time [TIME]', String,
33
- "Use the given time to punch in/out") { |time| OPTIONS[:time] = Time.parse(time) }
33
+ "Use the given time") { |time| OPTIONS[:time] = Time.parse(time) }
34
34
  opts.on('-m', '--message [MESSAGE]', String,
35
- "Add the given log message when punching in/out") { |message| OPTIONS[:message] = message }
35
+ "Use the given log message") { |message| OPTIONS[:message] = message }
36
36
  opts.on('--full',
37
37
  "Show full output for the command") { |full| OPTIONS[:full] = true }
38
38
  opts.on('--short',
@@ -104,7 +104,7 @@ commands = {
104
104
  end,
105
105
  'log' => lambda do |project|
106
106
  if project
107
- if message = ARGV[2]
107
+ if message = OPTIONS.delete(:message) || ARGV[2]
108
108
  if Punch.log(project, message, OPTIONS)
109
109
  Punch.write
110
110
  else
data/lib/punch/version.rb CHANGED
@@ -2,7 +2,7 @@ class Punch
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 4
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -535,6 +535,25 @@ describe 'punch command' do
535
535
  run_command('log', @project, @message)
536
536
  end
537
537
 
538
+ it 'should accept a message specified with --message' do
539
+ Punch.stub!(:write)
540
+ Punch.should.receive(:log).with(@project, @message, {})
541
+ run_command('log', @project, '--message', @message)
542
+ end
543
+
544
+ it 'should accept a message specified with -m' do
545
+ Punch.stub!(:write)
546
+ Punch.should.receive(:log).with(@project, @message, {})
547
+ run_command('log', @project, '-m', @message)
548
+ end
549
+
550
+ it 'should use the message option specified with --message over the command-line argument' do
551
+ other_message = 'some other message'
552
+ Punch.stub!(:write)
553
+ Punch.should.receive(:log).with(@project, other_message, {})
554
+ run_command('log', @project, @message, '-m', other_message)
555
+ end
556
+
538
557
  it 'should pass a time if specified on the command line (with --time)' do
539
558
  time_option = '2008-08-23 15:39'
540
559
  time = Time.local(2008, 8, 23, 15, 39)
@@ -822,7 +841,7 @@ describe 'punch command' do
822
841
  end
823
842
 
824
843
  it 'should not run any punch command' do
825
- [:in, :out, :delete, :status, :total, :log, :list].each do |command|
844
+ [:in, :out, :delete, :status, :total, :log, :list, :summary].each do |command|
826
845
  Punch.should.receive(command).never
827
846
  end
828
847
  run_command('bunk')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: one_inch_punch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yossef Mendelssohn
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-17 00:00:00 -05:00
12
+ date: 2009-08-26 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency