Module: Metior
- Defined in:
- lib/metior.rb,
lib/metior/git.rb,
lib/metior/vcs.rb,
lib/metior/actor.rb,
lib/metior/commit.rb,
lib/metior/errors.rb,
lib/metior/github.rb,
lib/metior/report.rb,
lib/metior/version.rb,
lib/metior/git/actor.rb,
lib/metior/git/commit.rb,
lib/metior/repository.rb,
lib/metior/github/actor.rb,
lib/metior/github/commit.rb,
lib/metior/git/repository.rb,
lib/metior/auto_include_vcs.rb,
lib/metior/github/repository.rb,
lib/metior/collections/collection.rb,
lib/metior/collections/actor_collection.rb,
lib/metior/collections/commit_collection.rb
Overview
This code is free software; you can redistribute it and/or modify it under the terms of the new BSD License.
Copyright (c) 2011, Sebastian Staudt
Defined Under Namespace
Modules: AutoIncludeVCS, Git, GitHub, VCS Classes: Actor, ActorCollection, Collection, Commit, CommitCollection, Report, Repository, UnsupportedError
Constant Summary collapse
- VERSION =
The current version of the Metior gem
'0.2.0'
- @@vcs_types =
This hash will be dynamically filled with all available VCS types and the corresponding implementation modules
{}
Class Method Summary collapse
-
.report(type, repo_options, target_dir, range = nil, report = 'default') ⇒ Object
Generates a report for the given repository.
-
.repository(type, *options) ⇒ Repository
Creates a new repository for the given repository type and path.
-
.simple_stats(type, repo_options, range = nil) ⇒ Hash<Symbol, Object>
Calculates simplistic stats for the given repository and branch.
-
.vcs(type) ⇒ VCS
Returns the VCS implementation
Module
for a given symbolic VCS name. -
.vcs_types ⇒ Hash<Symbol, VCS>
Returns a Hash with all available VCS types as keys and the implementation modules as values.
Class Method Details
.report(type, repo_options, target_dir, range = nil, report = 'default') ⇒ Object
Generates a report for the given repository
36 37 38 39 40 |
# File 'lib/metior.rb', line 36 def self.report(type, , target_dir, range = nil, report = 'default') repo = repository type, * range ||= repo.vcs::DEFAULT_BRANCH Report.create(report, repo, range).generate target_dir end |
.repository(type, *options) ⇒ Repository
Creates a new repository for the given repository type and path
24 25 26 |
# File 'lib/metior.rb', line 24 def self.repository(type, *) vcs(type)::Repository.new(*) end |
.simple_stats(type, repo_options, range = nil) ⇒ Hash<Symbol, Object>
Calculates simplistic stats for the given repository and branch
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/metior.rb', line 54 def self.simple_stats(type, , range = nil) range = vcs(type)::DEFAULT_BRANCH if range.nil? repo = repository type, * commits = repo.commits(range) { :commit_count => commits.size, :top_contributors => repo.top_contributors(range, 5), }.merge commits.activity end |
.vcs(type) ⇒ VCS
Returns the VCS implementation Module
for a given symbolic VCS name
18 19 20 21 22 23 24 |
# File 'lib/metior/vcs.rb', line 18 def self.vcs(type) type = type.to_sym unless @@vcs_types.key? type raise 'No VCS registered for :%s' % type end @@vcs_types[type].init end |
.vcs_types ⇒ Hash<Symbol, VCS>
Returns a Hash with all available VCS types as keys and the implementation modules as values
31 32 33 |
# File 'lib/metior/vcs.rb', line 31 def self.vcs_types @@vcs_types end |