| |   |
| 1 | require 'cmdparse' |
| 2 | |
| 3 | module Kipling |
| 4 | # Various command line commands |
| 5 | module Commands |
| 6 | end |
| 7 | |
| 8 | class CommandLine < CmdParse::CommandParser |
| 9 | def initialize |
| 10 | super(true,true) |
| 11 | self.program_name = "kipling" |
| 12 | self.program_version = Kipling::VERSION.split('.') |
| 13 | |
| 14 | @scanner = 'git' |
| 15 | @glob = 'stories/**/*.story' |
| 16 | |
| 17 | self.options = CmdParse::OptionParserWrapper.new do |opt| |
| 18 | opt.separator "Global options:" |
| 19 | opt.on("--verbose", "Be verbose when outputting info") {|t| $verbose = true } |
| 20 | opt.on("--scanner=SCANNER", "What scanner to use. Valid values are git or file") {|v| @scanner = v } |
| 21 | end |
| 22 | |
| 23 | add_command(CmdParse::HelpCommand.new) |
| 24 | add_command(CmdParse::VersionCommand.new) |
| 25 | |
| 26 | require 'kipling/commands/snapshot_command' |
| 27 | require 'kipling/commands/timeline_command' |
| 28 | require 'kipling/commands/server_command' |
| 29 | add_command(Commands::SnapshotCommand.new) |
| 30 | add_command(Commands::TimelineCommand.new) |
| 31 | add_command(Commands::ServerCommand.new) |
| 32 | end |
| 33 | |
| 34 | def scanner |
| 35 | if @scanner == 'file' |
| 36 | scanner = Scanner::FileSystem.new(@glob) |
| 37 | else |
| 38 | scanner = Scanner::Git.new('.', 'stories/stories') |
| 39 | end |
| 40 | end |
| 41 | |
| 42 | def timeline(after, before) |
| 43 | scanner.timeline(after, before) |
| 44 | end |
| 45 | end |
| 46 | end |
| toggle raw diff |
--- /dev/null
+++ b/lib/kipling/command_line.rb
@@ -0,0 +1,46 @@
+require 'cmdparse'
+
+module Kipling
+ # Various command line commands
+ module Commands
+ end
+
+ class CommandLine < CmdParse::CommandParser
+ def initialize
+ super(true,true)
+ self.program_name = "kipling"
+ self.program_version = Kipling::VERSION.split('.')
+
+ @scanner = 'git'
+ @glob = 'stories/**/*.story'
+
+ self.options = CmdParse::OptionParserWrapper.new do |opt|
+ opt.separator "Global options:"
+ opt.on("--verbose", "Be verbose when outputting info") {|t| $verbose = true }
+ opt.on("--scanner=SCANNER", "What scanner to use. Valid values are git or file") {|v| @scanner = v }
+ end
+
+ add_command(CmdParse::HelpCommand.new)
+ add_command(CmdParse::VersionCommand.new)
+
+ require 'kipling/commands/snapshot_command'
+ require 'kipling/commands/timeline_command'
+ require 'kipling/commands/server_command'
+ add_command(Commands::SnapshotCommand.new)
+ add_command(Commands::TimelineCommand.new)
+ add_command(Commands::ServerCommand.new)
+ end
+
+ def scanner
+ if @scanner == 'file'
+ scanner = Scanner::FileSystem.new(@glob)
+ else
+ scanner = Scanner::Git.new('.', 'stories/stories')
+ end
+ end
+
+ def timeline(after, before)
+ scanner.timeline(after, before)
+ end
+ end
+end |
| |   |
| 0 | | require 'cmdparse' |
| 1 | | |
| 2 | | module Kipling |
| 3 | | module Commands |
| 4 | | class KiplingParser < CmdParse::CommandParser |
| 5 | | def initialize |
| 6 | | super(true,true) |
| 7 | | self.program_name = "kipling" |
| 8 | | self.program_version = Kipling::VERSION.split('.') |
| 9 | | |
| 10 | | @scanner = 'git' |
| 11 | | @glob = 'stories/**/*.story' |
| 12 | | |
| 13 | | self.options = CmdParse::OptionParserWrapper.new do |opt| |
| 14 | | opt.separator "Global options:" |
| 15 | | opt.on("--verbose", "Be verbose when outputting info") {|t| $verbose = true } |
| 16 | | opt.on("--scanner=SCANNER", "What scanner to use. Valid values are git or file") {|v| @scanner = v } |
| 17 | | end |
| 18 | | |
| 19 | | add_command(CmdParse::HelpCommand.new) |
| 20 | | add_command(CmdParse::VersionCommand.new) |
| 21 | | add_command(ViewCommand.new) |
| 22 | | add_command(TimelineCommand.new) |
| 23 | | add_command(ServerCommand.new) |
| 24 | | end |
| 25 | | |
| 26 | | def scanner |
| 27 | | if @scanner == 'file' |
| 28 | | scanner = Scanner::FileSystem.new(@glob) |
| 29 | | else |
| 30 | | scanner = Scanner::Git.new('.', 'stories/stories') |
| 31 | | end |
| 32 | | end |
| 33 | | |
| 34 | | def timeline(after, before) |
| 35 | | scanner.timeline(after, before) |
| 36 | | end |
| 37 | | end |
| 38 | | end |
| 39 | | end |
| toggle raw diff |
--- a/lib/kipling/commands/kipling_parser.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-require 'cmdparse'
-
-module Kipling
- module Commands
- class KiplingParser < CmdParse::CommandParser
- def initialize
- super(true,true)
- self.program_name = "kipling"
- self.program_version = Kipling::VERSION.split('.')
-
- @scanner = 'git'
- @glob = 'stories/**/*.story'
-
- self.options = CmdParse::OptionParserWrapper.new do |opt|
- opt.separator "Global options:"
- opt.on("--verbose", "Be verbose when outputting info") {|t| $verbose = true }
- opt.on("--scanner=SCANNER", "What scanner to use. Valid values are git or file") {|v| @scanner = v }
- end
-
- add_command(CmdParse::HelpCommand.new)
- add_command(CmdParse::VersionCommand.new)
- add_command(ViewCommand.new)
- add_command(TimelineCommand.new)
- add_command(ServerCommand.new)
- end
-
- def scanner
- if @scanner == 'file'
- scanner = Scanner::FileSystem.new(@glob)
- else
- scanner = Scanner::Git.new('.', 'stories/stories')
- end
- end
-
- def timeline(after, before)
- scanner.timeline(after, before)
- end
- end
- end
-end |
| |   |
| 1 | require 'cmdparse' |
| 2 | |
| 3 | module Kipling |
| 4 | module Commands |
| 5 | class SnapshotCommand < CmdParse::Command |
| 6 | def initialize |
| 7 | super('snapshot', false) |
| 8 | self.short_desc = "Print a snapshot of cards" |
| 9 | self.description = "This command prints a snapshot of cards in a grid, typically used in XP or Scrum projects" |
| 10 | |
| 11 | @format = 'ascii' |
| 12 | @attribute = 'state' |
| 13 | @n = 0 |
| 14 | @sum = nil |
| 15 | self.options = CmdParse::OptionParserWrapper.new do |opt| |
| 16 | opt.on("--format=X", "How to output format. Valid types are ascii or html") {|f| @format = f } |
| 17 | opt.on("--group=X", "Name of card attribute cards will be grouped by") {|g| @attribute = g } |
| 18 | opt.on("--n=X", "What point in time") {|p| @p = p.to_i } |
| 19 | opt.on("--sum=x", "Add sum") {|s| @sum = s } |
| 20 | end |
| 21 | end |
| 22 | |
| 23 | def execute(args) |
| 24 | after = Time.now - 4*24*3600 |
| 25 | before = Time.now |
| 26 | timeline = super_command.super_command.timeline(after, before) |
| 27 | points = timeline.points[@n] |
| 28 | cards = points[1] |
| 29 | card_view = CardView.new(cards, :attribute => @attribute, :sum => @sum) |
| 30 | renderer_class = {'ascii' => Renderer::Snapshot::Ascii, 'html' => Renderer::Snapshot::Html}[@format] |
| 31 | renderer = renderer_class.new(card_view) |
| 32 | renderer.render(STDOUT) |
| 33 | end |
| 34 | end |
| 35 | end |
| 36 | end |
| toggle raw diff |
--- /dev/null
+++ b/lib/kipling/commands/snapshot_command.rb
@@ -0,0 +1,36 @@
+require 'cmdparse'
+
+module Kipling
+ module Commands
+ class SnapshotCommand < CmdParse::Command
+ def initialize
+ super('snapshot', false)
+ self.short_desc = "Print a snapshot of cards"
+ self.description = "This command prints a snapshot of cards in a grid, typically used in XP or Scrum projects"
+
+ @format = 'ascii'
+ @attribute = 'state'
+ @n = 0
+ @sum = nil
+ self.options = CmdParse::OptionParserWrapper.new do |opt|
+ opt.on("--format=X", "How to output format. Valid types are ascii or html") {|f| @format = f }
+ opt.on("--group=X", "Name of card attribute cards will be grouped by") {|g| @attribute = g }
+ opt.on("--n=X", "What point in time") {|p| @p = p.to_i }
+ opt.on("--sum=x", "Add sum") {|s| @sum = s }
+ end
+ end
+
+ def execute(args)
+ after = Time.now - 4*24*3600
+ before = Time.now
+ timeline = super_command.super_command.timeline(after, before)
+ points = timeline.points[@n]
+ cards = points[1]
+ card_view = CardView.new(cards, :attribute => @attribute, :sum => @sum)
+ renderer_class = {'ascii' => Renderer::Snapshot::Ascii, 'html' => Renderer::Snapshot::Html}[@format]
+ renderer = renderer_class.new(card_view)
+ renderer.render(STDOUT)
+ end
+ end
+ end
+end
\ No newline at end of file |
| |   |
| 0 | | require 'cmdparse' |
| 1 | | |
| 2 | | module Kipling |
| 3 | | module Commands |
| 4 | | class ViewCommand < CmdParse::Command |
| 5 | | def initialize |
| 6 | | super('view', false) |
| 7 | | self.short_desc = "Print a view of cards" |
| 8 | | self.description = "This command prints cards in a grid, typically used in XP or Scrum projects" |
| 9 | | |
| 10 | | @format = 'txt' |
| 11 | | @attribute = 'state' |
| 12 | | @n = 0 |
| 13 | | @sum = nil |
| 14 | | self.options = CmdParse::OptionParserWrapper.new do |opt| |
| 15 | | opt.on("--format=X", "How to output format") {|f| @format = f } |
| 16 | | opt.on("--group=X", "Name of card attribute cards will be grouped by") {|g| @attribute = g } |
| 17 | | opt.on("--n=X", "What point in time") {|p| @p = p.to_i } |
| 18 | | opt.on("--sum=x", "Add sum") {|s| @sum = s } |
| 19 | | end |
| 20 | | end |
| 21 | | |
| 22 | | def execute(args) |
| 23 | | after = Time.now - 4*24*3600 |
| 24 | | before = Time.now |
| 25 | | timeline = super_command.super_command.timeline(after, before) |
| 26 | | points = timeline.points[@n] |
| 27 | | cards = points[1] |
| 28 | | card_view = CardView.new(cards, :attribute => @attribute, :sum => @sum) |
| 29 | | renderer_class = {'txt' => ConsoleRenderer, 'html' => HtmlRenderer}[@format] |
| 30 | | renderer = renderer_class.new(card_view) |
| 31 | | renderer.render(STDOUT) |
| 32 | | end |
| 33 | | end |
| 34 | | end |
| 35 | | end |
| toggle raw diff |
--- a/lib/kipling/commands/view_command.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-require 'cmdparse'
-
-module Kipling
- module Commands
- class ViewCommand < CmdParse::Command
- def initialize
- super('view', false)
- self.short_desc = "Print a view of cards"
- self.description = "This command prints cards in a grid, typically used in XP or Scrum projects"
-
- @format = 'txt'
- @attribute = 'state'
- @n = 0
- @sum = nil
- self.options = CmdParse::OptionParserWrapper.new do |opt|
- opt.on("--format=X", "How to output format") {|f| @format = f }
- opt.on("--group=X", "Name of card attribute cards will be grouped by") {|g| @attribute = g }
- opt.on("--n=X", "What point in time") {|p| @p = p.to_i }
- opt.on("--sum=x", "Add sum") {|s| @sum = s }
- end
- end
-
- def execute(args)
- after = Time.now - 4*24*3600
- before = Time.now
- timeline = super_command.super_command.timeline(after, before)
- points = timeline.points[@n]
- cards = points[1]
- card_view = CardView.new(cards, :attribute => @attribute, :sum => @sum)
- renderer_class = {'txt' => ConsoleRenderer, 'html' => HtmlRenderer}[@format]
- renderer = renderer_class.new(card_view)
- renderer.render(STDOUT)
- end
- end
- end
-end
\ No newline at end of file |