minglr 1.3.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/.document +5 -0
  2. data/.gitignore +3 -0
  3. data/LICENSE +20 -0
  4. data/PostInstall.txt +1 -0
  5. data/README.rdoc +87 -0
  6. data/Rakefile +90 -0
  7. data/VERSION.yml +4 -0
  8. data/bin/minglr +29 -0
  9. data/bin/mtx +14 -0
  10. data/cucumber.yml +2 -0
  11. data/features/cards.feature +27 -0
  12. data/features/step_definitions/minglr_steps.rb +34 -0
  13. data/features/step_definitions/shared_steps.rb +69 -0
  14. data/features/users.feature +6 -0
  15. data/lib/minglr.rb +34 -0
  16. data/lib/minglr/action.rb +85 -0
  17. data/lib/minglr/config_parser.rb +51 -0
  18. data/lib/minglr/extensions/array.rb +23 -0
  19. data/lib/minglr/mtx/input_cache.rb +24 -0
  20. data/lib/minglr/mtx/options_parser.rb +58 -0
  21. data/lib/minglr/options_parser.rb +82 -0
  22. data/lib/minglr/resources/attachment.rb +51 -0
  23. data/lib/minglr/resources/base.rb +42 -0
  24. data/lib/minglr/resources/card.rb +117 -0
  25. data/lib/minglr/resources/project.rb +25 -0
  26. data/lib/minglr/resources/property_definition.rb +12 -0
  27. data/lib/minglr/resources/transition_execution.rb +6 -0
  28. data/lib/minglr/resources/user.rb +19 -0
  29. data/minglr.gemspec +120 -0
  30. data/minglrconfig.sample +37 -0
  31. data/tasks/commit.sample.rake +86 -0
  32. data/tasks/svn.sample.rake +27 -0
  33. data/test/action_test.rb +75 -0
  34. data/test/commands_test.rb +111 -0
  35. data/test/config_parser_test.rb +116 -0
  36. data/test/extensions/array_test.rb +41 -0
  37. data/test/options_parser_test.rb +74 -0
  38. data/test/resources/attachment_test.rb +90 -0
  39. data/test/resources/base_test.rb +58 -0
  40. data/test/resources/card_test.rb +199 -0
  41. data/test/resources/project_test.rb +44 -0
  42. data/test/resources/property_definition_test.rb +25 -0
  43. data/test/resources/user_test.rb +32 -0
  44. data/test/test_helper.rb +31 -0
  45. metadata +219 -0
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
@@ -0,0 +1,3 @@
1
+ pkg/*
2
+ coverage/*
3
+ .DS_Store
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Michael Schubert
2
+
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:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
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.
@@ -0,0 +1 @@
1
+ = Don't not forget to enable your Mingle API authentication by configuring the auth_config.yml file! =
@@ -0,0 +1,87 @@
1
+ = minglr
2
+
3
+ * http://github.com/schubert/minglr/tree/master
4
+
5
+ == DESCRIPTION:
6
+
7
+ * This gem provides two executable binaries to interact with Mingle (http://mingle.thoughtworks.com/mingle-agile-project-management) through its API. It also has sample interactive Rake task on how to facilitate easy card movements when a card enters/exits the development queue.
8
+
9
+ * mtx is a binary that facilities transition changes for use on rake tasks
10
+ * minglr is a more interactive tool that provides a quick interface for many common uses
11
+
12
+ == MINGLR FEATURES:
13
+ * lists cards
14
+ $ minglr cards
15
+ 266 - Task - Development Complete - Investigate new tool
16
+ 265 - Defect - New - The background is the wrong color
17
+
18
+ * list users
19
+ $ minglr users
20
+ schubert - Michael Schubert - michael@yourcompany.com
21
+
22
+ * list all cards with the word "foo"
23
+ $ minglr cards foo
24
+
25
+ * list details for card 215
26
+ $ minglr card 215
27
+ Number: 215
28
+ Name: Add the frobble to the bobble
29
+ Type: Story
30
+ Status: In Development
31
+ Description: Lorem Ipsum
32
+
33
+ * create new story card
34
+ $ minglr create -t Story -n "My New Story" -d "Story Description"
35
+ Created story card 271
36
+
37
+ * update a card
38
+ $ minglr update 271 -d "Bettter Description"
39
+ Card 271 updated
40
+
41
+ Number: 271
42
+ Name: Add the frobble to the bobble
43
+ Type: Task
44
+ Status: Ready for Development
45
+ Description: Better Description
46
+
47
+ * move card based on defined transitions
48
+ $ minglr move 266 -c "All done with development"
49
+ Moved card from In Development to Dev Complete
50
+
51
+ == MTX FEATURES:
52
+
53
+ * Executes a card transition through the Mingle API.
54
+ * Caches user-entered information during Rake task execution.
55
+ * SVN Rake tasks to perform update, remove, add, and conflict check.
56
+ * Sample Rake tasks to illustrate a single Rake command line that will grab latest changes, check for conflicts, run tests, check-in, and finally move card on Mingle.
57
+
58
+ == SYNOPSIS:
59
+
60
+ Do you forget to update a story card on Mingle when the card has moved into developers' hands? How about forgetting to update the story card to kick-off its sign off process when story is completed? If we let these sloppiness happen too often, communication flow will be hindered, and the time it takes to provide business value through story completions will be lengthened. Fortunately, Minglr can help.
61
+
62
+ Minglr allows you to write Rake tasks to execute Mingle card transitions as part of your build process. For example, for a developer to check-in new code, s/he could run the following Rake task:
63
+
64
+ $ rake check_in
65
+
66
+ At the end of this Rake task, it can execute a Mingle API call through the help of Minglr to execute the appropriate transition for the card being worked on, be it to move a card into 'In Development', or mark it as 'Story Completed'.
67
+
68
+ Of course, frequently additional user inputs are required to transition a card. For example, a card number and a comment. Minglr also provides Rake helpers to easily prompt users for inputs as part of their Rake runs, as well as caching them to save future typings.
69
+
70
+ Minglr can be used regardless your application is a Ruby on Rails web application or a simple Ruby application. In fact, it can even be used as a command line tool to transition cards on Mingle.
71
+
72
+ == INSTALL:
73
+
74
+ * sudo gem install schubert-minglr -s http://gems.github.com
75
+
76
+ * Enable Mingle API basic authentication in auth_config.yml, then restart it.
77
+
78
+ * Preferably install rb-password (http://www.caliban.org/ruby/ruby-password.shtml), through Macports (sudo port install rb-password)
79
+ * Copy over the "path-to-minglr/tasks/*.sample.rake" files and start customizing for your check-in needs.
80
+
81
+ == CREDITS:
82
+
83
+ Thank you to Stephen Chu and Chris O'Meara for their original work.
84
+
85
+ == Copyright
86
+
87
+ Copyright (c) 2009 Michael Schubert. See LICENSE for details.
@@ -0,0 +1,90 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ task :default => [:rcov]
5
+
6
+ begin
7
+ require 'jeweler'
8
+ Jeweler::Tasks.new do |gem|
9
+ if File.exist?('VERSION.yml')
10
+ config = YAML.load(File.read('VERSION.yml'))
11
+ gem.version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
12
+ else
13
+ gem.version = ""
14
+ end
15
+ gem.post_install_message = %q{PostInstall.txt}
16
+
17
+ gem.name = "minglr"
18
+ gem.summary = %q{command line user tool for Mingle (http://mingle.thoughtworks.com/mingle-agile-project-management)}
19
+ gem.description = %q{* This gem provides two executable binaries to interact with Mingle (http://mingle.thoughtworks.com/mingle-agile-project-management) through its API. It also has sample interactive Rake task on how to facilitate easy card movements when a card enters/exits the development queue. * mtx is a binary that facilities transition changes for use on rake tasks * minglr is a more interactive tool that provides a quick interface for many common uses}
20
+ gem.email = "michael@schubert.cx"
21
+ gem.homepage = "http://github.com/schubert/minglr"
22
+ gem.authors = ["Michael Schubert", "Stephen Chu", "Chris O'Meara"]
23
+ gem.executables = ["mtx", "minglr"]
24
+
25
+ gem.add_dependency "httpclient"
26
+ gem.add_dependency "activeresource", ">= 2.3.0"
27
+ gem.add_dependency "activesupport", ">= 2.3.0"
28
+
29
+ gem.add_development_dependency "thoughtbot-shoulda"
30
+ gem.add_development_dependency "mocha"
31
+ gem.add_development_dependency "relevance-rcov"
32
+ gem.add_development_dependency "cucumber"
33
+ gem.add_development_dependency "redgreen"
34
+
35
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
36
+ end
37
+ rescue LoadError
38
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
39
+ end
40
+
41
+ require 'rake/testtask'
42
+ Rake::TestTask.new(:test) do |test|
43
+ test.libs << 'lib' << 'test'
44
+ test.pattern = 'test/**/*_test.rb'
45
+ test.verbose = true
46
+ end
47
+
48
+ begin
49
+ require 'rcov/rcovtask'
50
+ Rcov::RcovTask.new do |test|
51
+ test.libs << 'test'
52
+ test.rcov_opts = ['--exclude', 'gems,/System/Library/Frameworks/Ruby.framework/', "--text-report", "--only-uncovered"]
53
+ test.pattern = 'test/**/*_test.rb'
54
+ test.verbose = true
55
+ end
56
+ rescue LoadError
57
+ task :rcov do
58
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install relevance-rcov"
59
+ end
60
+ end
61
+
62
+ require 'rake/rdoctask'
63
+ Rake::RDocTask.new do |rdoc|
64
+ if File.exist?('VERSION.yml')
65
+ config = YAML.load(File.read('VERSION.yml'))
66
+ version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
67
+ else
68
+ version = ""
69
+ end
70
+
71
+ rdoc.rdoc_dir = 'rdoc'
72
+ rdoc.title = "minglr #{version}"
73
+ rdoc.rdoc_files.include('README*')
74
+ rdoc.rdoc_files.include('lib/**/*.rb')
75
+ end
76
+
77
+ begin
78
+ require 'cucumber'
79
+ require 'cucumber/rake/task'
80
+
81
+ Cucumber::Rake::Task.new(:features) do |t|
82
+ t.cucumber_opts = "features --format pretty"
83
+ end
84
+ rescue LoadError
85
+ task :features do
86
+ abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
87
+ end
88
+ end
89
+
90
+ task "ci" => ["rcov", "features", "gemspec", "build", "install"]
@@ -0,0 +1,4 @@
1
+ ---
2
+ :major: 1
3
+ :minor: 3
4
+ :patch: 11
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'minglr'))
4
+
5
+ rc_config = Minglr::ConfigParser.parse
6
+ uri_options = rc_config[:global] || {}
7
+ project = rc_config[:global][:default].to_sym if rc_config[:global][:default]
8
+ original_arguments = ARGV
9
+
10
+ if Minglr::Action.valid_action?(ARGV[0])
11
+ action = ARGV[0]
12
+ else
13
+ if ARGV[0] && (ARGV[0] =~ /^--/).nil?
14
+ project = ARGV[0].to_sym
15
+ action = ARGV[1]
16
+ end
17
+ end
18
+
19
+ unless project.nil?
20
+ if action.nil?
21
+ puts "No action specified. Valid actions are: #{Minglr::Action.valid_actions.join(", ")}"
22
+ exit 1
23
+ end
24
+ uri_options.merge! rc_config[project]
25
+ Resources::Base.configure uri_options
26
+ Resources::Attachment.configure
27
+ extra_options = Minglr::OptionsParser.parse(original_arguments)
28
+ Minglr::Action.execute(action, ARGV, extra_options, rc_config[project])
29
+ end
data/bin/mtx ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'minglr'))
4
+
5
+ uri_options, execution_options = MTX::OptionsParser.parse(ARGV, :card, :transition)
6
+
7
+ Resources::Base.configure uri_options
8
+
9
+ if card = Resources::Card.find(execution_options[:card])
10
+ execution = Resources::TransitionExecution.create(execution_options)
11
+ raise "Transition aborted. Errors: #{execution.errors.full_messages}" if execution.errors.any?
12
+ else
13
+ raise "Card '#{execution_options[:card]}' cannot be found."
14
+ end
@@ -0,0 +1,2 @@
1
+ default: --format profile features
2
+ html_report: --format pretty features
@@ -0,0 +1,27 @@
1
+ Feature: Cards
2
+
3
+ Scenario: Print list of cards in the project
4
+ Given the project "xp"
5
+ When I issue the "cards" action
6
+ Then the result should have "119 - Task - Build PDF Export Widget on UI" in it
7
+ And the result should have "105 - Epic - Find people, projects and documents" in it
8
+
9
+ Scenario: Print list of cards in the project with a filter
10
+ Given the project "xp"
11
+ And a keyword of "Project"
12
+ When I issue the "cards" action
13
+ Then the result should not have "119 - Task - Build PDF Export Widget on UI" in it
14
+ Then the result should have "113 - Feature - Update Project" in it
15
+ And the result should have "112 - Feature - Create Project" in it
16
+ And the result should have "105 - Epic - Find people, projects and documents" in it
17
+
18
+ Scenario: Print the details of a card in the project
19
+ Given the project "xp"
20
+ And the card number "112"
21
+ When I issue the "card" action
22
+ Then the result should have "Number: 112" in it
23
+ And the result should have "Name: Create Project" in it
24
+ And the result should have "Type: Feature" in it
25
+ And the result should have "Status:" in it
26
+ And the result should have "Description: N/A" in it
27
+ And the result should have "Attachments:" in it
@@ -0,0 +1,34 @@
1
+ require File.join(File.dirname(__FILE__), "shared_steps")
2
+
3
+ Given /^the project "([^\"]*)"$/ do |project|
4
+ @project = project
5
+ end
6
+
7
+ Given /^the card number "([^\"]*)"$/ do |card_number|
8
+ if @options
9
+ @options << [card_number]
10
+ else
11
+ @options = [card_number]
12
+ end
13
+ end
14
+
15
+ Given /^a keyword of "([^\"]*)"$/ do |keyword|
16
+ if @options
17
+ @options << [keyword]
18
+ else
19
+ @options = [keyword]
20
+ end
21
+ end
22
+
23
+ When /^I issue the "([^\"]*)" action$/ do |action|
24
+ @action = action
25
+ @response = execute_minglr_command(@project, @action, @options)
26
+ end
27
+
28
+ Then /^the result should have "([^\"]*)" in it$/ do |string|
29
+ assert @response.split("\n").join(" ").include?(string), "Expected #{@response.inspect} to contain '#{string}'"
30
+ end
31
+
32
+ Then /^the result should not have "([^\"]*)" in it$/ do |string|
33
+ assert !@response.split("\n").join(" ").include?(string), "Expected #{@response.inspect} to not contain '#{string}'"
34
+ end
@@ -0,0 +1,69 @@
1
+ require "test/unit/assertions"
2
+ require File.join(File.dirname(__FILE__), "..", "..", "lib", "minglr")
3
+ World(Test::Unit::Assertions)
4
+
5
+ module Kernel
6
+
7
+ def capture_stdout
8
+ $stdout = $cucumberout
9
+ yield
10
+ return $cucumberout
11
+ ensure
12
+ $stdout = STDOUT
13
+ end
14
+
15
+ end
16
+
17
+ def rc_config
18
+ {
19
+ :scrum => {
20
+ :url => "http://localhost:9090/projects/scrum",
21
+ :password => "mingle",
22
+ :status_property => "cp_status",
23
+ :username => "schubert"
24
+ },
25
+ :global => {
26
+ :default => "blank",
27
+ :username => "schubert"
28
+ },
29
+ :storytracker => {
30
+ :url => "http://localhost:9090/projects/storytracker",
31
+ :password => "mingle",
32
+ :status_property => "cp_status",
33
+ :username => "schubert"
34
+ },
35
+ :xp => {
36
+ :url => "http://localhost:9090/projects/xp",
37
+ :password => "mingle",
38
+ :username => "schubert"
39
+ },
40
+ :blank => {
41
+ :url => "http://localhost:9090/projects/blank",
42
+ :password => "mingle",
43
+ :username => "schubert"
44
+ },
45
+ :agilehybrid => {
46
+ :url => "http://localhost:9090/projects/agilehybrid",
47
+ :password => "mingle",
48
+ :status_property => "cp_status",
49
+ :username=>"schubert"
50
+ }
51
+ }
52
+ end
53
+
54
+ def execute_minglr_command(project, action, extra_arguments = [])
55
+ $cucumberout = StringIO.new
56
+ extra_arguments = [] if extra_arguments.nil?
57
+ uri_options = rc_config[:global] || {}
58
+ original_arguments = ([project, action] + extra_arguments)
59
+
60
+ uri_options.merge! rc_config[project.to_sym]
61
+ Resources::Base.configure uri_options
62
+ Resources::Attachment.configure
63
+ extra_options = Minglr::OptionsParser.parse(original_arguments)
64
+
65
+ output = capture_stdout do
66
+ Minglr::Action.execute(action, original_arguments, extra_options, rc_config[project.to_sym])
67
+ end
68
+ output.string.strip
69
+ end
@@ -0,0 +1,6 @@
1
+ Feature: Users
2
+
3
+ Scenario: Print list of users on the project
4
+ Given the project "xp"
5
+ When I issue the "users" action
6
+ Then the result should have "schubert - Michael Schubert - michael@schubert.cx" in it
@@ -0,0 +1,34 @@
1
+ MINGLR_ENV = "normal" unless defined?(MINGLR_ENV)
2
+
3
+ require 'rubygems'
4
+ require 'activeresource'
5
+ require 'activesupport'
6
+ require 'optparse'
7
+
8
+ prefix = File.join(File.dirname(__FILE__), "minglr")
9
+ require File.join(prefix, "action")
10
+ require File.join(prefix, "options_parser")
11
+ require File.join(prefix, "config_parser")
12
+
13
+ mtx = File.join(prefix, "mtx", "*")
14
+ Dir[mtx].each do |file_name|
15
+ load file_name
16
+ end
17
+
18
+ require File.join(prefix, "resources", "base")
19
+ resources = File.join(prefix, "resources", "*")
20
+ Dir[resources].each do |file_name|
21
+ load file_name
22
+ end
23
+
24
+ extensions = File.join(prefix, "extensions", "*")
25
+ Dir[extensions].each do |file_name|
26
+ load file_name
27
+ end
28
+
29
+ $:.unshift(File.dirname(__FILE__)) unless
30
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
31
+
32
+ module Minglr
33
+ ROOT = File.expand_path File.join(File.dirname(__FILE__), '..')
34
+ end