gitra 0.0.2 → 0.0.3

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/README.md CHANGED
@@ -10,6 +10,7 @@
10
10
  Usage: gitra [options]
11
11
  -a, --analyse [BRANCH] Analyze the repository in relation the the specified branch (defaults to master).
12
12
  -l, --log SINCE_REV Shows the stories and bugs committed since the specified revision.
13
+ -m, --matching [BRANCHES] Comma separated list of branches to match
13
14
  ```
14
15
 
15
16
  ### Sample use case
data/bin/gitra CHANGED
@@ -9,16 +9,20 @@ require 'term/ansicolor'
9
9
  class String; include Term::ANSIColor; end
10
10
 
11
11
  options = OpenStruct.new
12
+ options.parameters = []
12
13
  parser = OptionParser.new do |opts|
13
14
  opts.banner = "Usage: gitra [options]"
14
15
 
15
16
  opts.on("-a [BRANCH]", "--analyse [BRANCH]", "Analyze the repository in relation the the specified branch (defaults to master).") do |branch|
16
17
  options.command = :analyze
17
- options.parameter = branch || 'master'
18
+ options.parameters.push branch || 'master'
18
19
  end
19
- opts.on("-l SINCE_REV", "--log SINCE_REV", "Shows the stories and bugs committed since the specified revision.") do |since_rev|
20
+ opts.on("-l SINCE_REV", "--log SINCE_REV", "Shows the stories and bugs committed on the current branch since the specified revision.") do |since_rev|
20
21
  options.command = :history
21
- options.parameter = since_rev
22
+ options.parameters << since_rev
23
+ end
24
+ opts.on("-m [BRANCHES]", "--matching [BRANCHES]", "Comma separated list of branches to match") do |branches|
25
+ options.parameters.push branches.split(',').map { |b| Regexp.new b } || :all
22
26
  end
23
27
  end
24
28
 
@@ -30,7 +34,7 @@ end
30
34
 
31
35
  if options.command
32
36
  cli = Gitra::CLI.new
33
- cli.send(options.command, options.parameter)
37
+ cli.send(options.command, *options.parameters)
34
38
  else
35
39
  puts parser
36
40
  end
data/lib/gitra/cli.rb CHANGED
@@ -11,12 +11,15 @@ module Gitra
11
11
  @tracker = Tracker.new '.'
12
12
  end
13
13
 
14
- def analyze(reference_branch)
14
+ def analyze(reference_branch, matching = :all)
15
15
  reference_branch ||= @tracker.current_branch
16
16
 
17
17
  $stdout.puts "---- Analyzing branches in relation to #{reference_branch.yellow} ----"
18
18
  branches = ([reference_branch] + @tracker.branches).uniq!
19
19
 
20
+ $stdout.puts "-- Using branches matching #{matching.map {|m| m.source}.join(', ').yellow} --" unless matching == :all
21
+ branches = branches.select { |branch| matching == :all or matching.inject(false) { |acc, match| acc || branch =~ match } }
22
+
20
23
  $stdout.print "Analysing #{branches.size} branches: "
21
24
  branch_analysis = branches.map do |branch|
22
25
  $stdout.print '.'
data/lib/gitra/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Gitra
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitra
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Lantos
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-07-16 00:00:00 Z
18
+ date: 2013-07-23 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: git