codefumes_harvester 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 CHANGED
@@ -1,3 +1,12 @@
1
+ == 0.1.5 / 09-13-09
2
+
3
+ * Renamed harvest_repo_metrics -> bin/cf_harvest_repo_metrics
4
+
5
+ == 0.1.4 / 09-13-09
6
+
7
+ * Moved feedback printing from publish_data! out to CLI#execute
8
+ * Renamed #local_revision_identifier to #local_commit_identifier
9
+
1
10
  == 0.1.3 / 09-12-09
2
11
 
3
12
  * Cached commit stats when building Payload hash to prevent Grit::Git::GitTimeout exceptions
data/Manifest.txt CHANGED
@@ -1,17 +1,19 @@
1
1
  History.txt
2
2
  Manifest.txt
3
- PostInstall.txt
4
3
  README.txt
5
4
  Rakefile
6
- bin/harvest_repo_metrics
5
+ bin/cf_harvest_repo_metrics
6
+ lib/cf_harvest_repo_metrics/cli.rb
7
7
  lib/codefumes_harvester.rb
8
8
  lib/codefumes_harvester/errors.rb
9
9
  lib/codefumes_harvester/harvester.rb
10
10
  lib/codefumes_harvester/quick_metric.rb
11
11
  lib/codefumes_harvester/source_control.rb
12
- lib/harvest_repo_metrics/cli.rb
12
+ spec/cf_harvest_repo_metrics/cli_spec.rb
13
13
  spec/codometer_harvester/harvester_spec.rb
14
14
  spec/codometer_harvester/source_control_spec.rb
15
- spec/harvest_repo_metrics_cli_spec.rb
15
+ spec/fixtures/sample_project_dirs/no_scm/description
16
+ spec/spec.opts
16
17
  spec/spec_helper.rb
17
18
  tasks/codefumes.rake
19
+ tasks/rspec.rake
data/README.txt CHANGED
@@ -1,7 +1,10 @@
1
1
  = codefumes_harvester
2
2
 
3
3
  * http://codefumes.rubyforge.org/codefumes_harvester
4
- * http://codefumes.com
4
+ * Wiki: https://github.com/cosyn/codefumes_harvester/wikis
5
+ * Repository: https://github.com/cosyn/codefumes_harvester
6
+ * Official CodeFumes.com gems: http://codefumes.rubyforge.org
7
+ * Website: http://www.codefumes.com
5
8
 
6
9
  == DESCRIPTION:
7
10
 
data/Rakefile CHANGED
@@ -1,5 +1,7 @@
1
1
  %w[rubygems rake rake/clean fileutils rubigen hoe].each { |f| require f }
2
- require File.dirname(__FILE__) + '/lib/codefumes_harvester'
2
+
3
+ $LOAD_PATH.unshift('lib') unless $LOAD_PATH.include?('lib')
4
+ require 'lib/codefumes_harvester'
3
5
 
4
6
  begin
5
7
  require "hanna/rdoctask"
@@ -16,8 +18,11 @@ end
16
18
  $hoe = Hoe.spec('codefumes_harvester') do
17
19
  self.rubyforge_name = 'codefumes'
18
20
  self.summary = "Tools for sending repository history and metrics to CodeFumes.com"
19
- self.extra_deps = [['codefumes','>= 0.1.2'],['mojombo-grit','>= 1.1.1']]
20
- self.extra_dev_deps = [['mojombo-chronic', ">= 0.3.0"],['jscruggs-metric_fu', ">= 1.1.5"]]
21
+ self.extra_deps = [['codefumes','>= 0.1.3'],['mojombo-grit','>= 1.1.1']]
22
+ self.extra_dev_deps = [['jscruggs-metric_fu', ">= 1.1.5"],
23
+ ['mojombo-chronic', ">= 0.3.0"],
24
+ ['rubigen', ">= 1.5.2"]
25
+ ]
21
26
  developer('Tom Kersten', 'tom.kersten@cosyntech.com')
22
27
  developer('Joe Banks', 'freemarmoset@gmail.com')
23
28
  end
@@ -4,7 +4,6 @@
4
4
  # Copyright (c) 2009. All rights reserved.
5
5
 
6
6
  require File.expand_path(File.dirname(__FILE__) + "/../lib/codefumes_harvester")
7
+ require File.expand_path(File.dirname(__FILE__) + "/../lib/cf_harvest_repo_metrics/cli")
7
8
 
8
- require "harvest_repo_metrics/cli"
9
-
10
- HarvestRepoMetric::CLI.execute(STDOUT, ARGV)
9
+ CfHarvestRepoMetrics::CLI.execute(STDOUT, ARGV)
@@ -1,9 +1,6 @@
1
- $:.unshift(File.dirname(__FILE__)) unless
2
- $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
-
4
1
  require 'optparse'
5
2
 
6
- module HarvestRepoMetric
3
+ module CfHarvestRepoMetrics
7
4
  # Class by the +harvest_metric+ script for command line parsing and
8
5
  # delegation to the Harvester class.
9
6
  class CLI
@@ -15,11 +12,18 @@ module HarvestRepoMetric
15
12
  parse_command_line_options!(stdout, arguments)
16
13
  harvester = Harvester.new(@options)
17
14
 
18
- if harvester.publish_data!
19
- stdout.puts "Project saved to CodeFumes.com. Visit #{harvester.short_uri}"
20
- else
15
+ if (results = harvester.publish_data!) == false
21
16
  stdout.puts "Error saving project...please try again or file a bug report."
22
17
  exit(1)
18
+ else
19
+ if results.empty?
20
+ stdout.puts "Local repository is in sync with server. No updates posted."
21
+ else
22
+ puts "Successfully saved #{results[:successful_count]} of #{results[:total_count]} payloads."
23
+ stdout.puts "Project saved to CodeFumes.com. Visit #{harvester.short_uri}"
24
+ end
25
+ puts "Exiting."
26
+ puts
23
27
  end
24
28
  end
25
29
 
@@ -52,6 +56,12 @@ module HarvestRepoMetric
52
56
  opts.on("-n", "--name [PROJECT_NAME]",
53
57
  "Name of project."
54
58
  ) {|name| @options[:name] = name}
59
+ opts.on("-l", "--local",
60
+ "Send requests to localhost. (Testing/Development)"
61
+ ) { CodeFumes::API.mode(:local) }
62
+ opts.on("-t", "--test",
63
+ "Send requests to test.codefumes.com. (Testing/Development)"
64
+ ) { CodeFumes::API.mode(:test) }
55
65
  opts.parse!(cl_arguments)
56
66
  end
57
67
  rescue Errno::ENOTDIR
@@ -60,4 +70,4 @@ module HarvestRepoMetric
60
70
  end
61
71
  end
62
72
  end
63
- end
73
+ end
@@ -9,7 +9,7 @@ require 'codefumes_harvester/quick_metric'
9
9
  include CodeFumesHarvester
10
10
 
11
11
  module CodeFumesHarvester
12
- VERSION = '0.1.3'
12
+ VERSION = '0.1.4'
13
13
  LIB_ROOT = File.dirname(__FILE__)
14
14
  end
15
15
 
@@ -34,22 +34,19 @@ module CodeFumesHarvester
34
34
  # synchronizes the repository's commit history, and prints the
35
35
  # results to STDOUT.
36
36
  #
37
- # Returns +true+ if the process succeeded.
37
+ # Returns a Hash containing the keys :successful_count and :total_count
38
+ # if the process succeeded and updates were posted to the server with
39
+ # their associated values.
40
+ #
41
+ # Returns and empty Hash if the local repository is in sync with the
42
+ # server and no updates were posted.
38
43
  #
39
44
  # Returns +false+ if the process failed.
40
45
  def publish_data!
41
46
  if @project.save
42
47
  store_public_key_in_repository
43
48
  update_codefumes_config_file
44
- payload_results = generate_and_save_payload
45
- if payload_results.nil?
46
- puts "Local repository is in sync with server. No updates posted."
47
- else
48
- puts "Successfully saved #{payload_results[:successful_count]} of #{payload_results[:total_count]} payloads."
49
- end
50
- puts "Exiting."
51
- puts
52
- true
49
+ generate_and_save_payload || {}
53
50
  else
54
51
  false
55
52
  end
@@ -8,7 +8,7 @@ module CodeFumesHarvester
8
8
  # Returns +false+ if the request failed.
9
9
  def self.save(custom_attributes, repository_path = './')
10
10
  repo = SourceControl.new(repository_path)
11
- commit = {:identifier => repo.local_revision_identifier,
11
+ commit = {:identifier => repo.local_commit_identifier,
12
12
  :custom_attributes => custom_attributes
13
13
  }
14
14
  content = {:commits => [commit]}
@@ -83,9 +83,9 @@ module CodeFumesHarvester
83
83
  CodeFumes::ConfigFile.options_for_project(public_key)[:private_key]
84
84
  end
85
85
 
86
- # Returns the current revision identifier of the underlying
86
+ # Returns the current commit identifier of the underlying
87
87
  # repository ('HEAD' of the supplied branch in git parlance).
88
- def local_revision_identifier(branch_name = "master")
88
+ def local_commit_identifier(branch_name = "master")
89
89
  raise ArgumentError, "nil branch name supplied" if branch_name.nil?
90
90
  @repository.get_head(branch_name).commit.sha
91
91
  end
@@ -1,10 +1,10 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
- require 'harvest_repo_metrics/cli'
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+ require 'cf_harvest_repo_metrics/cli'
3
3
 
4
- describe HarvestRepoMetric::CLI, "execute" do
4
+ describe CfHarvestRepoMetrics::CLI, "execute" do
5
5
  before(:each) do
6
6
  @stdout_io = StringIO.new
7
- HarvestRepoMetric::CLI.execute(@stdout_io, ["-p", GIT_FIXTURE_REPO_PATH])
7
+ CfHarvestRepoMetrics::CLI.execute(@stdout_io, ["-p", GIT_FIXTURE_REPO_PATH])
8
8
  @stdout_io.rewind
9
9
  @stdout = @stdout_io.read
10
10
  end
@@ -23,4 +23,4 @@ describe HarvestRepoMetric::CLI, "execute" do
23
23
  it "creates a .codefumes_config file" do
24
24
  File.exist?(CodeFumes::ConfigFile.path).should be_true
25
25
  end
26
- end
26
+ end
@@ -41,7 +41,7 @@ describe SourceControl do
41
41
  @repository = SourceControl.new(git_repo_path)
42
42
  end
43
43
 
44
- it "returns the identifer (sha/revision #) of the first commit" do
44
+ it "returns the identifer (sha/commit #) of the first commit" do
45
45
  @repository.initial_commit_identifier.should == "a8b3e73fc5e4bc46bbdf5c1cab38cb2ce47ba2d0"
46
46
  end
47
47
  end
@@ -175,14 +175,14 @@ describe SourceControl do
175
175
  end
176
176
  end
177
177
 
178
- describe "local_revision_identifier" do
178
+ describe "local_commit_identifier" do
179
179
  before(:each) do
180
180
  git_repo_path = File.expand_path(File.dirname(__FILE__) + '/../fixtures/sample_project_dirs/git_repository')
181
181
  @repository = SourceControl.new(git_repo_path)
182
182
  end
183
183
 
184
- it "returns the current revision identifier for the local repository" do
185
- @repository.local_revision_identifier.should == "7dc0e73fea4625204b7c1e6a48e9a57025be4d7e"
184
+ it "returns the current commit identifier for the local repository" do
185
+ @repository.local_commit_identifier.should == "7dc0e73fea4625204b7c1e6a48e9a57025be4d7e"
186
186
  end
187
187
  end
188
188
 
@@ -0,0 +1,4 @@
1
+ This is a directory put in place for testing with various
2
+ parts of the CodometerHarvester gem which depend on a
3
+ directory that is not under any sort of source code
4
+ management system.
data/spec/spec.opts ADDED
@@ -0,0 +1 @@
1
+ --colour
- -format specdoc
data/tasks/codefumes.rake CHANGED
@@ -1,7 +1,7 @@
1
1
  namespace :cf do
2
2
  desc "Send scm metrics to Codefumes.com"
3
3
  task :store_repo_metrics, [:public_key, :private_key] do |tsk, args|
4
- harvest_repo_metrics_executable = File.expand_path(File.dirname(__FILE__) + "/../bin/harvest_repo_metrics")
4
+ harvest_repo_metrics_executable = File.expand_path(File.dirname(__FILE__) + "/../bin/cf_harvest_repo_metrics")
5
5
  options = args.public_key.nil? ? "" : "-k #{args.public_key}"
6
6
  options += args.private_key.nil? ? "" : " -a #{args.private_key}"
7
7
  sh "#{harvest_repo_metrics_executable} #{options}"
data/tasks/rspec.rake ADDED
@@ -0,0 +1,21 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems'
5
+ require 'spec'
6
+ end
7
+ begin
8
+ require 'spec/rake/spectask'
9
+ rescue LoadError
10
+ puts <<-EOS
11
+ To use rspec for testing you must install rspec gem:
12
+ gem install rspec
13
+ EOS
14
+ exit(0)
15
+ end
16
+
17
+ desc "Run the specs under spec/models"
18
+ Spec::Rake::SpecTask.new do |t|
19
+ t.spec_opts = ['--options', "spec/spec.opts"]
20
+ t.spec_files = FileList['spec/**/*_spec.rb']
21
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codefumes_harvester
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Kersten
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-09-12 00:00:00 -05:00
13
+ date: 2010-02-20 00:00:00 -06:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -21,7 +21,7 @@ dependencies:
21
21
  requirements:
22
22
  - - ">="
23
23
  - !ruby/object:Gem::Version
24
- version: 0.1.2
24
+ version: 0.1.3
25
25
  version:
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: mojombo-grit
@@ -33,6 +33,16 @@ dependencies:
33
33
  - !ruby/object:Gem::Version
34
34
  version: 1.1.1
35
35
  version:
36
+ - !ruby/object:Gem::Dependency
37
+ name: jscruggs-metric_fu
38
+ type: :development
39
+ version_requirement:
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: 1.1.5
45
+ version:
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: mojombo-chronic
38
48
  type: :development
@@ -44,14 +54,14 @@ dependencies:
44
54
  version: 0.3.0
45
55
  version:
46
56
  - !ruby/object:Gem::Dependency
47
- name: jscruggs-metric_fu
57
+ name: rubigen
48
58
  type: :development
49
59
  version_requirement:
50
60
  version_requirements: !ruby/object:Gem::Requirement
51
61
  requirements:
52
62
  - - ">="
53
63
  - !ruby/object:Gem::Version
54
- version: 1.1.5
64
+ version: 1.5.2
55
65
  version:
56
66
  - !ruby/object:Gem::Dependency
57
67
  name: hoe
@@ -61,41 +71,47 @@ dependencies:
61
71
  requirements:
62
72
  - - ">="
63
73
  - !ruby/object:Gem::Version
64
- version: 2.3.3
74
+ version: 2.5.0
65
75
  version:
66
- description: CodeFumesHarvester provides a set of high-level tools for gathering history and common metrics from a local repository and sending them to CodeFumes.com[http://codefumes.com].
76
+ description: |-
77
+ CodeFumesHarvester provides a set of high-level tools for gathering
78
+ history and common metrics from a local repository and sending them to
79
+ CodeFumes.com[http://codefumes.com].
67
80
  email:
68
81
  - tom.kersten@cosyntech.com
69
82
  - freemarmoset@gmail.com
70
83
  executables:
71
- - harvest_repo_metrics
84
+ - cf_harvest_repo_metrics
72
85
  extensions: []
73
86
 
74
87
  extra_rdoc_files:
75
88
  - History.txt
76
89
  - Manifest.txt
77
- - PostInstall.txt
78
90
  - README.txt
79
91
  files:
80
92
  - History.txt
81
93
  - Manifest.txt
82
- - PostInstall.txt
83
94
  - README.txt
84
95
  - Rakefile
85
- - bin/harvest_repo_metrics
96
+ - bin/cf_harvest_repo_metrics
97
+ - lib/cf_harvest_repo_metrics/cli.rb
86
98
  - lib/codefumes_harvester.rb
87
99
  - lib/codefumes_harvester/errors.rb
88
100
  - lib/codefumes_harvester/harvester.rb
89
101
  - lib/codefumes_harvester/quick_metric.rb
90
102
  - lib/codefumes_harvester/source_control.rb
91
- - lib/harvest_repo_metrics/cli.rb
103
+ - spec/cf_harvest_repo_metrics/cli_spec.rb
92
104
  - spec/codometer_harvester/harvester_spec.rb
93
105
  - spec/codometer_harvester/source_control_spec.rb
94
- - spec/harvest_repo_metrics_cli_spec.rb
106
+ - spec/fixtures/sample_project_dirs/no_scm/description
107
+ - spec/spec.opts
95
108
  - spec/spec_helper.rb
96
109
  - tasks/codefumes.rake
110
+ - tasks/rspec.rake
97
111
  has_rdoc: true
98
112
  homepage: http://codefumes.rubyforge.org/codefumes_harvester
113
+ licenses: []
114
+
99
115
  post_install_message:
100
116
  rdoc_options:
101
117
  - --main
@@ -117,9 +133,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
133
  requirements: []
118
134
 
119
135
  rubyforge_project: codefumes
120
- rubygems_version: 1.3.1
136
+ rubygems_version: 1.3.5
121
137
  signing_key:
122
- specification_version: 2
138
+ specification_version: 3
123
139
  summary: Tools for sending repository history and metrics to CodeFumes.com
124
140
  test_files: []
125
141
 
data/PostInstall.txt DELETED
@@ -1,7 +0,0 @@
1
-
2
- For more information on codometer-harvester, see http://codometer-harvester.rubyforge.org
3
-
4
- NOTE: Change this information in PostInstall.txt
5
- You can also delete it if you don't want it.
6
-
7
-