one_inch_punch 0.1.3 → 0.1.4
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 +7 -0
- data/README.txt +1 -3
- data/bin/punch +18 -3
- data/config/hoe.rb +10 -4
- data/lib/punch/version.rb +1 -1
- data/spec/punch_command_spec.rb +78 -0
- metadata +24 -4
data/History.txt
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
== 0.1.4 2008-10-23
|
2
|
+
|
3
|
+
* punch command enhancements:
|
4
|
+
* can now list data (outputs as YAML)
|
5
|
+
* will output status as YAML if giving status of all projects
|
6
|
+
* will output total as YAML if giving total of all projects
|
7
|
+
|
1
8
|
== 0.1.3 2008-09-30
|
2
9
|
|
3
10
|
* 3 enhancements:
|
data/README.txt
CHANGED
@@ -18,9 +18,7 @@ One-inch punch: Smaller, more effective
|
|
18
18
|
* Can list project data
|
19
19
|
* Can give total time for a project
|
20
20
|
* Can be used command-line
|
21
|
-
|
22
|
-
* Command-line does not give access to the list operation
|
23
|
-
* Command-line output is ugly
|
21
|
+
* Command-line output is less ugly
|
24
22
|
* More, since this is unfinished
|
25
23
|
|
26
24
|
== SYNOPSIS:
|
data/bin/punch
CHANGED
@@ -54,8 +54,22 @@ project = ARGV[1]
|
|
54
54
|
Punch.load
|
55
55
|
|
56
56
|
commands = {
|
57
|
-
'status' => lambda
|
58
|
-
|
57
|
+
'status' => lambda do |project|
|
58
|
+
result = Punch.status(project)
|
59
|
+
if project
|
60
|
+
puts result.inspect
|
61
|
+
else
|
62
|
+
puts result.to_yaml
|
63
|
+
end
|
64
|
+
end,
|
65
|
+
'total' => lambda do |project|
|
66
|
+
result = Punch.total(project, OPTIONS.merge(:format => true))
|
67
|
+
if project
|
68
|
+
puts result.inspect
|
69
|
+
else
|
70
|
+
puts result.to_yaml
|
71
|
+
end
|
72
|
+
end,
|
59
73
|
'in' => lambda do |project|
|
60
74
|
if project
|
61
75
|
if Punch.in(project, OPTIONS)
|
@@ -98,7 +112,8 @@ commands = {
|
|
98
112
|
else
|
99
113
|
puts "Project required"
|
100
114
|
end
|
101
|
-
end
|
115
|
+
end,
|
116
|
+
'list' => lambda { |project| puts Punch.list(project, OPTIONS).to_yaml },
|
102
117
|
}
|
103
118
|
|
104
119
|
if command_code = commands[command]
|
data/config/hoe.rb
CHANGED
@@ -10,6 +10,10 @@ DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
|
10
10
|
EXTRA_DEPENDENCIES = [
|
11
11
|
# ['activesupport', '>= 1.3.1']
|
12
12
|
] # An array of rubygem dependencies [name, version]
|
13
|
+
EXTRA_DEV_DEPENDENCIES = [
|
14
|
+
['rspec', '>= 1.1.4'],
|
15
|
+
['mocha', '>= 0.9.1']
|
16
|
+
] # An array of rubygem dependencies [name, version]
|
13
17
|
|
14
18
|
@config_file = "~/.rubyforge/user-config.yml"
|
15
19
|
@config = nil
|
@@ -61,10 +65,12 @@ $hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
|
61
65
|
|
62
66
|
# == Optional
|
63
67
|
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
+
p.extra_deps = EXTRA_DEPENDENCIES
|
69
|
+
p.extra_dev_deps = EXTRA_DEV_DEPENDENCIES
|
70
|
+
|
71
|
+
#p.spec_extras = {} # A hash of extra values to set in the gemspec.
|
72
|
+
|
73
|
+
end
|
68
74
|
|
69
75
|
CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
|
70
76
|
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
|
data/lib/punch/version.rb
CHANGED
data/spec/punch_command_spec.rb
CHANGED
@@ -59,6 +59,13 @@ describe 'punch command' do
|
|
59
59
|
result = 'total data'
|
60
60
|
Punch.stubs(:total).returns(result)
|
61
61
|
self.expects(:puts).with(result.inspect)
|
62
|
+
run_command('total', @project)
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'should output the total as YAML if no project given' do
|
66
|
+
result = 'total data'
|
67
|
+
Punch.stubs(:total).returns(result)
|
68
|
+
self.expects(:puts).with(result.to_yaml)
|
62
69
|
run_command('total')
|
63
70
|
end
|
64
71
|
|
@@ -134,6 +141,13 @@ describe 'punch command' do
|
|
134
141
|
result = 'status data'
|
135
142
|
Punch.stubs(:status).returns(result)
|
136
143
|
self.expects(:puts).with(result.inspect)
|
144
|
+
run_command('status', @project)
|
145
|
+
end
|
146
|
+
|
147
|
+
it 'should output the status as YAML if no project given' do
|
148
|
+
result = 'status data'
|
149
|
+
Punch.stubs(:status).returns(result)
|
150
|
+
self.expects(:puts).with(result.to_yaml)
|
137
151
|
run_command('status')
|
138
152
|
end
|
139
153
|
|
@@ -520,6 +534,70 @@ describe 'punch command' do
|
|
520
534
|
end
|
521
535
|
end
|
522
536
|
|
537
|
+
describe "when the command is 'list'" do
|
538
|
+
before :each do
|
539
|
+
Punch.stubs(:list)
|
540
|
+
end
|
541
|
+
|
542
|
+
it 'should load punch data' do
|
543
|
+
Punch.expects(:load)
|
544
|
+
run_command('list', @project)
|
545
|
+
end
|
546
|
+
|
547
|
+
it 'should get the data for the requested project' do
|
548
|
+
Punch.expects(:list).with(@project, anything)
|
549
|
+
run_command('list', @project)
|
550
|
+
end
|
551
|
+
|
552
|
+
it 'should get the data for all projects if none given' do
|
553
|
+
Punch.expects(:list).with(nil, anything)
|
554
|
+
run_command('list')
|
555
|
+
end
|
556
|
+
|
557
|
+
it 'should output the list data' do
|
558
|
+
result = 'list data'
|
559
|
+
Punch.stubs(:list).returns(result)
|
560
|
+
self.expects(:puts).with(result.to_yaml)
|
561
|
+
run_command('list')
|
562
|
+
end
|
563
|
+
|
564
|
+
describe 'when options specified' do
|
565
|
+
it "should pass on an 'after' time option given by --after" do
|
566
|
+
time_option = '2008-08-26 09:47'
|
567
|
+
time = Time.local(2008, 8, 26, 9, 47)
|
568
|
+
Punch.expects(:list).with(@project, has_entry(:after => time))
|
569
|
+
run_command('list', @project, '--after', time_option)
|
570
|
+
end
|
571
|
+
|
572
|
+
it "should pass on a 'before' time option given by --before" do
|
573
|
+
time_option = '2008-08-23 15:39'
|
574
|
+
time = Time.local(2008, 8, 23, 15, 39)
|
575
|
+
Punch.expects(:list).with(@project, has_entry(:before => time))
|
576
|
+
run_command('list', @project, '--before', time_option)
|
577
|
+
end
|
578
|
+
|
579
|
+
it 'should handle a time option given as a date' do
|
580
|
+
time_option = '2008-08-23'
|
581
|
+
time = Time.local(2008, 8, 23)
|
582
|
+
Punch.expects(:list).with(@project, has_entry(:before => time))
|
583
|
+
run_command('list', @project, '--before', time_option)
|
584
|
+
end
|
585
|
+
|
586
|
+
it 'should accept time options if no project given' do
|
587
|
+
time_option = '2008-08-26 09:47'
|
588
|
+
time = Time.local(2008, 8, 26, 9, 47)
|
589
|
+
Punch.expects(:list).with(nil, has_entry(:before => time))
|
590
|
+
run_command('list', '--before', time_option)
|
591
|
+
end
|
592
|
+
end
|
593
|
+
|
594
|
+
it 'should not write the data' do
|
595
|
+
@states['write'].become('test')
|
596
|
+
Punch.expects(:write).never.when(@states['write'].is('test'))
|
597
|
+
run_command('list')
|
598
|
+
end
|
599
|
+
end
|
600
|
+
|
523
601
|
describe 'when the command is unknown' do
|
524
602
|
it 'should not error' do
|
525
603
|
lambda { run_command('bunk') }.should_not raise_error
|
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.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yossef Mendelssohn
|
@@ -9,9 +9,29 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-10-23 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rspec
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.1.4
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: mocha
|
27
|
+
type: :development
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.9.1
|
34
|
+
version:
|
15
35
|
- !ruby/object:Gem::Dependency
|
16
36
|
name: hoe
|
17
37
|
type: :development
|
@@ -20,7 +40,7 @@ dependencies:
|
|
20
40
|
requirements:
|
21
41
|
- - ">="
|
22
42
|
- !ruby/object:Gem::Version
|
23
|
-
version: 1.
|
43
|
+
version: 1.8.0
|
24
44
|
version:
|
25
45
|
description: a simple time-tracking tool
|
26
46
|
email:
|
@@ -83,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
103
|
requirements: []
|
84
104
|
|
85
105
|
rubyforge_project: yomendel
|
86
|
-
rubygems_version: 1.
|
106
|
+
rubygems_version: 1.3.0
|
87
107
|
signing_key:
|
88
108
|
specification_version: 2
|
89
109
|
summary: a simple time-tracking tool
|