bigtiger-rolex 0.1.0 → 0.1.2

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/LICENSE CHANGED
@@ -1,20 +1,13 @@
1
- Copyright (c) 2009 Pairing Workstation Bender
1
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2
+ Version 2, December 2004
2
3
 
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
4
+ Copyright (C) 2004 Sam Hocevar
5
+ 14 rue de Plaisance, 75014 Paris, France
6
+ Everyone is permitted to copy and distribute verbatim or modified
7
+ copies of this license document, and changing it is allowed as long
8
+ as the name is changed.
10
9
 
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
10
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
13
12
 
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
13
+ 0. You just DO WHAT THE FUCK YOU WANT TO.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.2
data/lib/rolex.rb CHANGED
@@ -5,6 +5,9 @@ require 'grit'
5
5
  require 'float_ext'
6
6
 
7
7
  class Rolex
8
+ autoload :Report, 'rolex/report'
9
+ autoload :LineItem, 'rolex/line_item'
10
+
8
11
  attr_accessor :who
9
12
 
10
13
  def initialize(repo_location, who)
@@ -16,58 +19,5 @@ class Rolex
16
19
  commits = Grit::Commit.find_all(@repo, nil, :since => Time.today)
17
20
  Report.new(commits, who).run
18
21
  end
19
-
20
- class Report
21
- attr_reader :commits, :who
22
-
23
- def initialize(commits, who)
24
- @who = who
25
- @commits = commits.reverse
26
- @lines = []
27
- end
28
-
29
- def run
30
- commits.each_with_index do |c,i|
31
- elapsed = nil
32
- if c != commits.first
33
- previous = commits[i-1]
34
- elapsed = c.committed_date - previous.committed_date
35
- end
36
-
37
- if c.author.email.include?(who)
38
- @lines << Line.new(c.message, elapsed)
39
- end
40
- end
41
- @lines << "Total time: #{total_elapsed_time}"
42
- @lines.join("\n")
43
- end
44
-
45
- def total_elapsed_time
46
- total = 0
47
- @lines.each do |l|
48
- total += l.elapsed_time_in_hours
49
- end
50
-
51
- total
52
- end
53
-
54
- end
55
-
56
- class Line
57
- attr_accessor :message, :elapsed
58
-
59
- def initialize(message, elapsed)
60
- @message = message
61
- @elapsed = elapsed
62
- end
63
-
64
- def to_s
65
- "#{message} - #{elapsed_time_in_hours}"
66
- end
67
-
68
- def elapsed_time_in_hours
69
- (elapsed / 60 / 60).round_to(2)
70
- end
71
- end
72
22
  end
73
23
 
@@ -0,0 +1,18 @@
1
+ class Rolex
2
+ class LineItem
3
+ attr_accessor :message, :elapsed
4
+
5
+ def initialize(message, elapsed)
6
+ @message = message
7
+ @elapsed = elapsed
8
+ end
9
+
10
+ def to_s
11
+ "#{message} - #{elapsed_time_in_hours}"
12
+ end
13
+
14
+ def elapsed_time_in_hours
15
+ elapsed.nil? ? 0 : (elapsed / 60 / 60).round_to(2)
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,37 @@
1
+ class Rolex
2
+ class Report
3
+ attr_reader :commits, :who
4
+
5
+ def initialize(commits, who)
6
+ @who = who
7
+ @commits = commits.reverse
8
+ @lines = []
9
+ end
10
+
11
+ def run
12
+ commits.each_with_index do |c,i|
13
+ elapsed = nil
14
+ if c != commits.first
15
+ previous = commits[i-1]
16
+ elapsed = c.committed_date - previous.committed_date
17
+ end
18
+
19
+ if c.author.email.include?(who)
20
+ @lines << LineItem.new(c.message, elapsed)
21
+ end
22
+ end
23
+ @lines << "Total time: #{total_elapsed_time}"
24
+ @lines.join("\n")
25
+ end
26
+
27
+ def total_elapsed_time
28
+ total = 0
29
+ @lines.each do |l|
30
+ total += l.elapsed_time_in_hours
31
+ end
32
+
33
+ total
34
+ end
35
+
36
+ end
37
+ end
data/rolex.gemspec ADDED
@@ -0,0 +1,52 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{rolex}
5
+ s.version = "0.1.2"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Jim Remsik", "Sandro Turriate"]
9
+ s.date = %q{2009-06-12}
10
+ s.email = %q{bigtiger+rolex@hashrocket.com}
11
+ s.extra_rdoc_files = [
12
+ "LICENSE",
13
+ "README.rdoc"
14
+ ]
15
+ s.files = [
16
+ ".document",
17
+ ".gitignore",
18
+ "LICENSE",
19
+ "README.rdoc",
20
+ "Rakefile",
21
+ "VERSION",
22
+ "lib/float_ext.rb",
23
+ "lib/rolex.rb",
24
+ "lib/rolex/line_item.rb",
25
+ "lib/rolex/report.rb",
26
+ "rolex.gemspec",
27
+ "spec/rolex_spec.rb",
28
+ "spec/spec_helper.rb"
29
+ ]
30
+ s.has_rdoc = true
31
+ s.homepage = %q{http://github.com/bigtiger/rolex}
32
+ s.rdoc_options = ["--charset=UTF-8"]
33
+ s.require_paths = ["lib"]
34
+ s.rubygems_version = %q{1.3.1}
35
+ s.summary = %q{TODO}
36
+ s.test_files = [
37
+ "spec/rolex_spec.rb",
38
+ "spec/spec_helper.rb"
39
+ ]
40
+
41
+ if s.respond_to? :specification_version then
42
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
43
+ s.specification_version = 2
44
+
45
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
46
+ else
47
+ end
48
+ else
49
+ end
50
+
51
+ s.add_dependency("grit", [">= 1.1.1"])
52
+ end
data/spec/rolex_spec.rb CHANGED
@@ -1,13 +1,24 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
1
+ require File.join(File.dirname(__FILE__),'spec_helper')
2
2
 
3
3
  describe "Rolex" do
4
4
  before do
5
- @rolex = Rolex.new("~/hashrocket/newhomeguide", "bigtiger")
5
+ @commits = ["commit1", "commit2"]
6
+ @repo = Grit::Repo.stub!(:new).and_return('/some/path')
7
+ @rolex = Rolex.new(@repo, "someuser")
8
+ @report = stub('report', :run => true)
6
9
  end
7
10
 
8
11
  describe '#today' do
9
12
  it "retrieves today's commits" do
10
- Grit::Commit.should_receive(:find_all)
13
+ Grit::Commit.should_receive(:find_all).with('/some/path', nil, :since => anything).and_return(@commits)
14
+ Rolex::Report.should_receive(:new).with(@commits, "someuser").and_return(@report)
15
+ @rolex.today
16
+ end
17
+
18
+ it "runs a report" do
19
+ Grit::Commit.should_receive(:find_all).and_return(@commits)
20
+ Rolex::Report.stub!(:new).and_return(@report)
21
+ @report.should_receive(:run)
11
22
  @rolex.today
12
23
  end
13
24
  end
metadata CHANGED
@@ -1,21 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bigtiger-rolex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
- - bigtiger
8
- - sandro
7
+ - Jim Remsik
8
+ - Sandro Turriate
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
13
  date: 2009-06-12 00:00:00 -07:00
14
14
  default_executable:
15
- dependencies: []
16
-
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: grit
18
+ type: :runtime
19
+ version_requirement:
20
+ version_requirements: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: 1.1.1
25
+ version:
17
26
  description:
18
- email: dev+bigtiger+sandro@hashrocket.com
27
+ email: bigtiger+rolex@hashrocket.com
19
28
  executables: []
20
29
 
21
30
  extensions: []
@@ -32,6 +41,9 @@ files:
32
41
  - VERSION
33
42
  - lib/float_ext.rb
34
43
  - lib/rolex.rb
44
+ - lib/rolex/line_item.rb
45
+ - lib/rolex/report.rb
46
+ - rolex.gemspec
35
47
  - spec/rolex_spec.rb
36
48
  - spec/spec_helper.rb
37
49
  has_rdoc: true