mingle-macro-development-toolkit 1.3 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.specification +160 -0
- data/History.txt +4 -0
- data/LICENSE.txt +1 -1
- data/README.rdoc +1 -1
- data/Rakefile +28 -20
- data/bin/new_mingle_macro +62 -25
- data/getting_started.txt +5 -5
- data/lib/macro_development_toolkit.rb +10 -3
- data/tasks/test.rake +3 -2
- data/test/integration/rest_loader.rb +3 -7
- data/test/integration/rest_loader_test.rb +13 -13
- data/test/project_data/macro_toolkit_test_template.mingle +0 -0
- metadata +45 -14
data/.specification
ADDED
@@ -0,0 +1,160 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mingle-macro-development-toolkit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 3
|
8
|
+
- 1
|
9
|
+
version: 1.3.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- ThoughtWorks Inc
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-03-30 00:00:00 -07:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: activesupport
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 2
|
29
|
+
- 0
|
30
|
+
- 2
|
31
|
+
version: 2.0.2
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: rubyforge
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 2
|
43
|
+
- 0
|
44
|
+
- 4
|
45
|
+
version: 2.0.4
|
46
|
+
type: :development
|
47
|
+
version_requirements: *id002
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: gemcutter
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
segments:
|
56
|
+
- 0
|
57
|
+
- 4
|
58
|
+
- 1
|
59
|
+
version: 0.4.1
|
60
|
+
type: :development
|
61
|
+
version_requirements: *id003
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: hoe
|
64
|
+
prerelease: false
|
65
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
segments:
|
70
|
+
- 2
|
71
|
+
- 5
|
72
|
+
- 0
|
73
|
+
version: 2.5.0
|
74
|
+
type: :development
|
75
|
+
version_requirements: *id004
|
76
|
+
description: ""
|
77
|
+
email:
|
78
|
+
- support@thoughtworks.com
|
79
|
+
executables:
|
80
|
+
- new_mingle_macro
|
81
|
+
extensions: []
|
82
|
+
|
83
|
+
extra_rdoc_files:
|
84
|
+
- getting_started.txt
|
85
|
+
- LICENSE.txt
|
86
|
+
- History.txt
|
87
|
+
- README.rdoc
|
88
|
+
files:
|
89
|
+
- .specification
|
90
|
+
- getting_started.txt
|
91
|
+
- README.rdoc
|
92
|
+
- LICENSE.txt
|
93
|
+
- History.txt
|
94
|
+
- Rakefile
|
95
|
+
- lib/macro_development_toolkit.rb
|
96
|
+
- lib/macro_development_toolkit/mingle/card_type_property_definition.rb
|
97
|
+
- lib/macro_development_toolkit/mingle/card_type.rb
|
98
|
+
- lib/macro_development_toolkit/mingle/project_variable.rb
|
99
|
+
- lib/macro_development_toolkit/mingle/project.rb
|
100
|
+
- lib/macro_development_toolkit/mingle/property_definition.rb
|
101
|
+
- lib/macro_development_toolkit/mingle/property_value.rb
|
102
|
+
- lib/macro_development_toolkit/mingle/user.rb
|
103
|
+
- lib/macro_development_toolkit/mingle_model_loader.rb
|
104
|
+
- tasks/test.rake
|
105
|
+
- test/unit/fixture_loader.rb
|
106
|
+
- test/unit/unit_test_helper.rb
|
107
|
+
- test/unit/fixture_loader_test.rb
|
108
|
+
- test/integration/rest_loader.rb
|
109
|
+
- test/integration/integration_test_helper.rb
|
110
|
+
- test/integration/rest_loader_test.rb
|
111
|
+
- test/fixtures/sample/card_types.yml
|
112
|
+
- test/fixtures/sample/card_types_property_definitions.yml
|
113
|
+
- test/fixtures/sample/project_variables.yml
|
114
|
+
- test/fixtures/sample/projects.yml
|
115
|
+
- test/fixtures/sample/property_definitions.yml
|
116
|
+
- test/fixtures/sample/users.yml
|
117
|
+
- test/project_data/macro_toolkit_test_template.mingle
|
118
|
+
- bin/new_mingle_macro
|
119
|
+
- example/Rakefile
|
120
|
+
- example/deploy.rake
|
121
|
+
- example/init.rb
|
122
|
+
- example/macro.rb
|
123
|
+
- example/unit_test.rb
|
124
|
+
- example/unit_test_helper.rb
|
125
|
+
- example/integration_test.rb
|
126
|
+
- example/integration_test_helper.rb
|
127
|
+
has_rdoc: true
|
128
|
+
homepage:
|
129
|
+
licenses: []
|
130
|
+
|
131
|
+
post_install_message: getting_started.txt
|
132
|
+
rdoc_options:
|
133
|
+
- --main
|
134
|
+
- README.txt
|
135
|
+
require_paths:
|
136
|
+
- lib
|
137
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
segments:
|
142
|
+
- 0
|
143
|
+
version: "0"
|
144
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - ">="
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
segments:
|
149
|
+
- 0
|
150
|
+
version: "0"
|
151
|
+
requirements: []
|
152
|
+
|
153
|
+
rubyforge_project: mingle-macros
|
154
|
+
rubygems_version: 1.3.6
|
155
|
+
signing_key:
|
156
|
+
specification_version: 3
|
157
|
+
summary: This toolkit provides support for developing, testing and deploying custom Mingle macros.
|
158
|
+
test_files: []
|
159
|
+
|
160
|
+
|
data/History.txt
CHANGED
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License
|
2
2
|
|
3
|
-
Copyright (c)
|
3
|
+
Copyright (c) 2010 ThoughtWorks, Inc. All rights reserved.
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.rdoc
CHANGED
@@ -45,7 +45,7 @@ team over email at support@thoughtworks.com
|
|
45
45
|
|
46
46
|
The MIT License
|
47
47
|
|
48
|
-
Copyright (c)
|
48
|
+
Copyright (c) 2010 ThoughtWorks, Inc. All rights reserved.
|
49
49
|
|
50
50
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
51
51
|
of this software and associated documentation files (the "Software"), to deal
|
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
begin
|
4
4
|
require 'rubygems'
|
5
|
-
|
5
|
+
|
6
6
|
unless Gem::RubyGemsVersion >= '1.2.0'
|
7
7
|
$stderr.puts %(Rails requires RubyGems >= 1.2.0 (you have #{rubygems_version}). Please `gem update --system` and try again.)
|
8
8
|
exit 1
|
@@ -13,26 +13,34 @@ rescue LoadError
|
|
13
13
|
exit 1
|
14
14
|
end
|
15
15
|
|
16
|
-
%w[rake rake/clean fileutils
|
16
|
+
%w[rake rake/clean rake/testtask fileutils].each { |f| require f }
|
17
17
|
require File.dirname(__FILE__) + '/lib/macro_development_toolkit'
|
18
18
|
|
19
|
-
# Generate all the Rake tasks
|
20
|
-
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
21
|
-
$hoe = Hoe.spec('mingle-macro-development-toolkit') do |p|
|
22
|
-
p.version = MacroDevelopmentToolkit::VERSION
|
23
|
-
p.developer('ThoughtWorks Inc', 'support@thoughtworks.com')
|
24
|
-
p.post_install_message = 'getting_started.txt'
|
25
|
-
p.rubyforge_name = 'mingle-macros'
|
26
|
-
p.extra_deps = [
|
27
|
-
['activesupport','>= 2.0.2'],
|
28
|
-
]
|
29
|
-
p.summary = "This toolkit provides support for developing, testing and deploying custom Mingle macros."
|
30
|
-
p.extra_rdoc_files = ['README.rdoc']
|
31
|
-
p.clean_globs |= %w[**/.DS_Store tmp *.log]
|
32
|
-
path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
|
33
|
-
p.remote_rdoc_dir = ''
|
34
|
-
p.rsync_args = '-av --delete --ignore-errors'
|
35
|
-
end
|
36
19
|
|
37
|
-
|
20
|
+
# if ARGV[0] == "repackage"
|
21
|
+
|
22
|
+
%w[newgem rubigen hoe].each { |f| require f }
|
23
|
+
|
24
|
+
# Generate all the Rake tasks
|
25
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
26
|
+
$hoe = Hoe.spec('mingle-macro-development-toolkit') do |p|
|
27
|
+
p.version = MacroDevelopmentToolkit::VERSION
|
28
|
+
p.developer('ThoughtWorks Inc', 'support@thoughtworks.com')
|
29
|
+
p.post_install_message = 'getting_started.txt'
|
30
|
+
p.rubyforge_name = 'mingle-macros'
|
31
|
+
p.extra_deps = [
|
32
|
+
['activesupport','>= 2.0.2'],
|
33
|
+
]
|
34
|
+
p.summary = "This toolkit provides support for developing, testing and deploying custom Mingle macros."
|
35
|
+
p.extra_rdoc_files = ['README.rdoc']
|
36
|
+
p.clean_globs |= %w[**/.DS_Store tmp *.log]
|
37
|
+
path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
|
38
|
+
p.remote_rdoc_dir = ''
|
39
|
+
p.rsync_args = '-av --delete --ignore-errors'
|
40
|
+
end
|
41
|
+
|
42
|
+
require 'newgem/tasks'
|
43
|
+
|
44
|
+
# end
|
45
|
+
|
38
46
|
Dir['tasks/**/*.rake'].each { |t| load t }
|
data/bin/new_mingle_macro
CHANGED
@@ -1,5 +1,36 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
#Copyright
|
2
|
+
#Copyright 2010 ThoughtWorks, Inc. All rights reserved.
|
3
|
+
|
4
|
+
module NewMingleMacro
|
5
|
+
module Messages
|
6
|
+
USAGE = <<-USAGE
|
7
|
+
Macro name cannot be blank.
|
8
|
+
|
9
|
+
Usage: new_mingle_macro <macro_name> [macro_class_name]
|
10
|
+
|
11
|
+
macro_name : The name of your new macro. Should be alphabetic, possibly
|
12
|
+
including underscores(_).
|
13
|
+
macro_class_name: (optional) The name of the class that implements the macro.
|
14
|
+
Should be a CamelCased alphabetic string. Defaults to
|
15
|
+
CamelCased version of macro_name. We highly recommend setting
|
16
|
+
your own class name with an appropriate namespace to avoid
|
17
|
+
collisions with standard libraries or Mingle classes.
|
18
|
+
USAGE
|
19
|
+
|
20
|
+
SPECIAL_CHARACTER_REPLACEMENT_MESSAGE = <<-SPECIAL_CHARACTER_REPLACEMENT_MESSAGE
|
21
|
+
Your macro name contains special characters that will be replaced with
|
22
|
+
underscores (_). Is this OK? [Yes/No]"
|
23
|
+
SPECIAL_CHARACTER_REPLACEMENT_MESSAGE
|
24
|
+
|
25
|
+
AUTO_GENERATED_CLASS_NAME_MESSAGE = <<-AUTO_GENERATED_CLASS_NAME_MESSAGE
|
26
|
+
Warning: You did not provide a class name for your macro. A class name has been generated
|
27
|
+
for you. This name should be considered a guide and we highly recommend naming your own
|
28
|
+
classes name with appropriate namespaces to avoid collisions with standard libraries
|
29
|
+
or Mingle classes. Please run this tool with no command-line arguments to learn
|
30
|
+
how to provide a class name.
|
31
|
+
AUTO_GENERATED_CLASS_NAME_MESSAGE
|
32
|
+
end
|
33
|
+
end
|
3
34
|
|
4
35
|
require 'erb'
|
5
36
|
begin
|
@@ -10,15 +41,7 @@ rescue LoadError
|
|
10
41
|
end
|
11
42
|
|
12
43
|
def print_usage
|
13
|
-
puts
|
14
|
-
Macro name cannot be blank.
|
15
|
-
|
16
|
-
Usage: new_mingle_macro <macro_name> [macro_class_name]
|
17
|
-
|
18
|
-
macro_name : The name of your new macro. Should be alphabetic, possibly including underscores(_)
|
19
|
-
macro_class_name: (optional) The name of the class that implements the macro. Should be a CamelCased alphabetic string. Defaults to CamelCased version of macro_name.
|
20
|
-
|
21
|
-
EOS
|
44
|
+
puts NewMingleMacro::Messages::USAGE
|
22
45
|
end
|
23
46
|
|
24
47
|
if ARGV[0].blank?
|
@@ -26,28 +49,42 @@ if ARGV[0].blank?
|
|
26
49
|
exit!
|
27
50
|
end
|
28
51
|
|
29
|
-
|
52
|
+
def read_macro_name
|
53
|
+
result = ARGV[0].downcase.gsub(/\s/, '_')
|
54
|
+
if result !~ /^[_A-Za-z]+$/
|
55
|
+
print NewMingleMacro::Messages::SPECIAL_CHARACTER_REPLACEMENT_MESSAGE
|
56
|
+
exit if STDIN.gets.downcase =~ /^n/
|
57
|
+
result = result.gsub(/[^_A-Za-z]/, '_').squeeze('_')
|
58
|
+
end
|
59
|
+
result
|
60
|
+
end
|
30
61
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
62
|
+
def read_or_generate_macro_class_name(macro_name)
|
63
|
+
if ARGV[1]
|
64
|
+
ARGV[1]
|
65
|
+
else
|
66
|
+
puts NewMingleMacro::Messages::AUTO_GENERATED_CLASS_NAME_MESSAGE
|
67
|
+
macro_name.gsub(/\W/, '_').camelize
|
68
|
+
end
|
35
69
|
end
|
36
70
|
|
37
|
-
|
38
|
-
if macro_class_name.camelize != macro_class_name
|
39
|
-
|
40
|
-
|
41
|
-
|
71
|
+
def validate_class_name(macro_class_name)
|
72
|
+
if macro_class_name.camelize != macro_class_name
|
73
|
+
print "Your macro class name is not a valid class name. Continue with the default class name of #{macro_name.camelize}? [Yes/No]"
|
74
|
+
exit if STDIN.gets.downcase =~ /^n/
|
75
|
+
macro_class_name = macro_name.camelize
|
76
|
+
end
|
77
|
+
macro_class_name
|
42
78
|
end
|
43
79
|
|
80
|
+
macro_name = read_macro_name
|
81
|
+
macro_class_name = validate_class_name(read_or_generate_macro_class_name(macro_name))
|
82
|
+
|
44
83
|
if File.exists?(macro_name)
|
45
84
|
print "Folder #{macro_name} already exists in your current directory. Either rename the macro or delete the folder and then execute this command to continue."
|
46
85
|
exit
|
47
86
|
end
|
48
87
|
|
49
|
-
puts "macro name is #{macro_name}"
|
50
|
-
|
51
88
|
class Path
|
52
89
|
def initialize(location=:gem)
|
53
90
|
@base_location = if location.to_s == 'gem'
|
@@ -64,9 +101,9 @@ class Path
|
|
64
101
|
|
65
102
|
def cp(options = {:to => nil, :r => true})
|
66
103
|
if options[:r]
|
67
|
-
FileUtils.cp(@base_location, options[:to].to_s, :verbose =>
|
104
|
+
FileUtils.cp(@base_location, options[:to].to_s, :verbose => false)
|
68
105
|
else
|
69
|
-
FileUtils.cp_r(@base_location, options[:to].to_s, :verbose =>
|
106
|
+
FileUtils.cp_r(@base_location, options[:to].to_s, :verbose => false)
|
70
107
|
end
|
71
108
|
end
|
72
109
|
|
@@ -104,4 +141,4 @@ templates = {
|
|
104
141
|
templates.each do |template, output|
|
105
142
|
template_file = File.open(template.to_s)
|
106
143
|
File.open(output.to_s, 'w').write(ERB.new(template_file.read, nil, '-').result(binding))
|
107
|
-
end
|
144
|
+
end
|
data/getting_started.txt
CHANGED
@@ -55,7 +55,7 @@ The second parameter is special and could be either a single project or multiple
|
|
55
55
|
|
56
56
|
The execute method uses the MQL execution facility that the project class provides, to execute the MQL string that is passed into through the parameters hash. It then formats the results to be a number, and provides that result of the execute command.
|
57
57
|
|
58
|
-
For more help on what constitutes valid MQL, you can refer to our help documentation at http://studios.thoughtworks.com/mingle-agile-project-management/3.
|
58
|
+
For more help on what constitutes valid MQL, you can refer to our help documentation at http://studios.thoughtworks.com/mingle-agile-project-management/3.1/help/mql_reference.html
|
59
59
|
|
60
60
|
To see an example of how to use the gem to report across multiple projects, refer to the cross_project_rollup macro which ships with versions of Mingle 3.0 and higher.
|
61
61
|
|
@@ -215,7 +215,7 @@ Integration testing your macro
|
|
215
215
|
|
216
216
|
########################################################NOTE###############################################################
|
217
217
|
# #
|
218
|
-
# IN ORDER TO RUN THE INTEGRATION TESTS, YOU WILL NEED TO TURN ON BASIC AUTHENTICATION FOR THE MINGLE 3.
|
218
|
+
# IN ORDER TO RUN THE INTEGRATION TESTS, YOU WILL NEED TO TURN ON BASIC AUTHENTICATION FOR THE MINGLE 3.1 SERVER THAT YOU #
|
219
219
|
# ARE GOING TO BE TESTING AGAINST. #
|
220
220
|
# #
|
221
221
|
#########################################################NOTE##############################################################
|
@@ -246,7 +246,7 @@ end
|
|
246
246
|
|
247
247
|
The skeleton project also has a sample integration test set up for you, which points to a bogus Mingle server, and uses bad credentials. Replace this resource URL with the URL for a deployed instance within your organization. The helper method project(...) which takes the resource URL, loads the data from the XML data obtained from the live instance of Mingle.
|
248
248
|
|
249
|
-
You can see examples of integration tests in the average macro that is packaged with Mingle in the vendor/plugins/average_macro directory. These tests run against a standard template that ships with Mingle 3.
|
249
|
+
You can see examples of integration tests in the average macro that is packaged with Mingle in the vendor/plugins/average_macro directory. These tests run against a standard template that ships with Mingle 3.1, and so you should be able to run them within your organization too, without a problem.
|
250
250
|
|
251
251
|
To run your integration tests, run
|
252
252
|
|
@@ -278,7 +278,7 @@ To deploy your macro to a locally deployed instance of Mingle, which is running
|
|
278
278
|
|
279
279
|
% rake macro:deploy MINGLE_LOCATION=/path/to/mingle_root
|
280
280
|
|
281
|
-
where /path/to/mingle_root is the location where Mingle 3.
|
281
|
+
where /path/to/mingle_root is the location where Mingle 3.1 is installed.
|
282
282
|
|
283
283
|
* On Windows, this is the location that the installer installed Mingle at
|
284
284
|
* On OSX, this will be within the app bundle, at <mingle_application_bundle>/Contents/Resources/app
|
@@ -294,7 +294,7 @@ Alternatively, you could also copy the folder by hand into the same location.
|
|
294
294
|
# #
|
295
295
|
#########################################################NOTE###############################################################
|
296
296
|
|
297
|
-
This Getting Started file and the mingle-macro-development-toolkit-1.
|
297
|
+
This Getting Started file and the mingle-macro-development-toolkit-1.3.1.gem are owned exclusively by ThoughtWorks, Inc.,
|
298
298
|
and ThoughtWorks reserves all rights therein.
|
299
299
|
|
300
300
|
We believe that it is a sound practice from legal, business and software development perspectives to always provide copyright
|
@@ -1,10 +1,10 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2010 ThoughtWorks, Inc. All rights reserved.
|
2
2
|
|
3
3
|
$:.unshift(File.dirname(__FILE__)) unless
|
4
4
|
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
5
5
|
|
6
6
|
module MacroDevelopmentToolkit
|
7
|
-
VERSION = '1.3'
|
7
|
+
VERSION = '1.3.1'
|
8
8
|
end
|
9
9
|
|
10
10
|
require 'yaml'
|
@@ -15,7 +15,14 @@ begin
|
|
15
15
|
rescue Exception
|
16
16
|
#ignore
|
17
17
|
end
|
18
|
-
|
18
|
+
begin
|
19
|
+
require 'active_support'
|
20
|
+
rescue Exception
|
21
|
+
unless defined? RAILS_ENV && RAILS_ENV == 'production'
|
22
|
+
$: << 'vendor/gems/activesupport-2.3.3/lib'
|
23
|
+
require 'active_support'
|
24
|
+
end
|
25
|
+
end
|
19
26
|
|
20
27
|
Dir.glob(File.join("#{File.dirname(__FILE__)}", 'macro_development_toolkit', '**', '*')).reverse.each do |f|
|
21
28
|
require f unless File.directory?(f)
|
data/tasks/test.rake
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
#Copyright
|
1
|
+
#Copyright 2010 ThoughtWorks, Inc. All rights reserved.
|
2
2
|
|
3
3
|
module RESTfulLoaders
|
4
4
|
class RemoteError < StandardError
|
5
5
|
def self.parse(response_body)
|
6
|
-
Hash.from_xml(response_body)['
|
6
|
+
Hash.from_xml(response_body)['errors'].delete("error")
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
@@ -83,7 +83,7 @@ module RESTfulLoaders
|
|
83
83
|
def extract_array_of(container_key, options)
|
84
84
|
contents_hash = options[:from]
|
85
85
|
container = contents_hash[container_key]
|
86
|
-
container ? [container[container_key.singularize]].flatten : []
|
86
|
+
container ? [container[container_key.singularize]].flatten.compact : []
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
@@ -226,14 +226,12 @@ module RESTfulLoaders
|
|
226
226
|
def load
|
227
227
|
load_all_card_types_property_definitions_from_xml.collect do |ctpd|
|
228
228
|
next unless ctpd['card_type_id'] == @card_type_id
|
229
|
-
|
230
229
|
card_type_property_definition = Mingle::CardTypePropertyDefinition.new(OpenStruct.new(ctpd))
|
231
230
|
card_type_property_definition.card_type_loader = card_type_by_id_loader(ctpd['card_type_id'])
|
232
231
|
card_type_property_definition.property_definition_loader = property_definition_by_id_loader(ctpd['property_definition_id'])
|
233
232
|
card_type_property_definition
|
234
233
|
end.compact.sort_by(&:position).compact
|
235
234
|
end
|
236
|
-
|
237
235
|
end
|
238
236
|
|
239
237
|
class LoadCardTypesPropertyDefinitionsByPropertyDefinitionId < Base
|
@@ -245,14 +243,12 @@ module RESTfulLoaders
|
|
245
243
|
def load
|
246
244
|
load_all_card_types_property_definitions_from_xml.collect do |ctpd|
|
247
245
|
next unless ctpd['property_definition_id'] == @property_definition_id
|
248
|
-
|
249
246
|
card_type_property_definition = Mingle::CardTypePropertyDefinition.new(OpenStruct.new(ctpd))
|
250
247
|
card_type_property_definition.card_type_loader = card_type_by_id_loader(ctpd['card_type_id'])
|
251
248
|
card_type_property_definition.property_definition_loader = property_definition_by_id_loader(ctpd['property_definition_id'])
|
252
249
|
card_type_property_definition
|
253
250
|
end.compact.sort_by(&:position).compact
|
254
251
|
end
|
255
|
-
|
256
252
|
end
|
257
253
|
|
258
254
|
class LoadCardTypeById < Base
|
@@ -1,24 +1,24 @@
|
|
1
|
-
#Copyright
|
1
|
+
#Copyright 2010 ThoughtWorks, Inc. All rights reserved.
|
2
2
|
|
3
3
|
require File.dirname(__FILE__) + '/integration_test_helper.rb'
|
4
4
|
|
5
5
|
class RestLoaderTest < Test::Unit::TestCase
|
6
6
|
|
7
|
-
TEST_PROJECT = 'http://bjanakir:
|
8
|
-
TEST_PROJECT_V1 = "http://bjanakir:
|
7
|
+
TEST_PROJECT = 'http://bjanakir:pass1.@localhost:8080/api/v2/lightweight_projects/macro_toolkit_test.xml'
|
8
|
+
TEST_PROJECT_V1 = "http://bjanakir:pass1.@localhost:8080/api/v1/lightweight_projects/macro_toolkit_test.xml"
|
9
9
|
|
10
10
|
def test_should_load_direct_project_attributes_from_correct_fixture
|
11
11
|
assert_not_nil project(TEST_PROJECT)
|
12
|
-
assert_equal '
|
12
|
+
assert_equal 'macro_toolkit_test', project(TEST_PROJECT).identifier
|
13
13
|
end
|
14
14
|
|
15
15
|
def test_should_load_first_level_project_associations_from_correct_fixture
|
16
|
-
assert_equal([
|
16
|
+
assert_equal(["Story", "Release", "Sprint", "Task", "Defect", "Feature", "Epic Story"], project(TEST_PROJECT).card_types.collect(&:name))
|
17
17
|
end
|
18
18
|
|
19
19
|
def test_should_load_second_level_project_associations_for_card_type_from_correct_fixture
|
20
20
|
task_type = project(TEST_PROJECT).card_types.detect { |ct| ct.name == 'Task' }
|
21
|
-
assert_equal([
|
21
|
+
assert_equal(["Priority", "Task Status", "Owner", "Depend on", "Release", "Sprint", "Story", "Date Task Completed", "Estimated Hours"], task_type.property_definitions.collect(&:name))
|
22
22
|
end
|
23
23
|
|
24
24
|
def test_should_load_second_level_project_associations_for_property_definition_from_correct_fixture
|
@@ -45,17 +45,17 @@ class RestLoaderTest < Test::Unit::TestCase
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def test_should_execute_mql_to_return_an_array_of_hash_results_for_each_result_row_for_v2
|
48
|
-
mql_results = project(TEST_PROJECT).execute_mql("SELECT SUM('
|
48
|
+
mql_results = project(TEST_PROJECT).execute_mql("SELECT SUM('Story Points') WHERE 'Release' = (Current Release) AND 'Date Created' IS NOT NULL")
|
49
49
|
assert_equal 1, mql_results.size
|
50
50
|
assert_equal Hash, mql_results.first.class
|
51
|
-
assert_equal
|
51
|
+
assert_equal 97, mql_results.first['sum_story_points'].to_i
|
52
52
|
end
|
53
53
|
|
54
54
|
def test_should_execute_mql_to_return_an_array_of_hash_results_for_each_result_row_for_v1
|
55
|
-
mql_results = project(TEST_PROJECT_V1).execute_mql("SELECT SUM('
|
55
|
+
mql_results = project(TEST_PROJECT_V1).execute_mql("SELECT SUM('story points') WHERE 'Release' = (Current Release) AND 'Date Created' IS NOT NULL")
|
56
56
|
assert_equal 1, mql_results.size
|
57
57
|
assert_equal Hash, mql_results.first.class
|
58
|
-
assert_equal
|
58
|
+
assert_equal 97, mql_results.first['Sum_Story_Points'].to_i
|
59
59
|
end
|
60
60
|
|
61
61
|
def test_should_execute_number_format_remotely_for_v2
|
@@ -90,13 +90,13 @@ class RestLoaderTest < Test::Unit::TestCase
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def test_should_raise_error_on_trying_to_call_values_for_anything_other_than_managed_or_user_properties
|
93
|
-
added_on = project(TEST_PROJECT).property_definitions.detect { |pd| pd.name == '
|
93
|
+
added_on = project(TEST_PROJECT).property_definitions.detect { |pd| pd.name == 'Date Created' }
|
94
94
|
assert_raise(RuntimeError) { added_on.values }
|
95
95
|
end
|
96
96
|
|
97
97
|
def test_should_tell_whether_mql_query_is_cacheable
|
98
|
-
assert project(TEST_PROJECT).can_be_cached?("SELECT '
|
99
|
-
assert_equal false, project(TEST_PROJECT).can_be_cached?("SELECT '
|
98
|
+
assert project(TEST_PROJECT).can_be_cached?("SELECT 'Story Points'")
|
99
|
+
assert_equal false, project(TEST_PROJECT).can_be_cached?("SELECT 'Story Points' WHERE 'Date Created' IS TODAY")
|
100
100
|
end
|
101
101
|
|
102
102
|
end
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mingle-macro-development-toolkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 3
|
8
|
+
- 1
|
9
|
+
version: 1.3.1
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- ThoughtWorks Inc
|
@@ -9,29 +14,51 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date:
|
17
|
+
date: 2010-04-02 00:00:00 -07:00
|
13
18
|
default_executable:
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: activesupport
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
24
|
requirements:
|
21
25
|
- - ">="
|
22
26
|
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 2
|
29
|
+
- 0
|
30
|
+
- 2
|
23
31
|
version: 2.0.2
|
24
|
-
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
25
34
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
35
|
+
name: rubyforge
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 2
|
43
|
+
- 0
|
44
|
+
- 4
|
45
|
+
version: 2.0.4
|
27
46
|
type: :development
|
28
|
-
|
29
|
-
|
47
|
+
version_requirements: *id002
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: hoe
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
30
52
|
requirements:
|
31
53
|
- - ">="
|
32
54
|
- !ruby/object:Gem::Version
|
33
|
-
|
34
|
-
|
55
|
+
segments:
|
56
|
+
- 2
|
57
|
+
- 6
|
58
|
+
- 0
|
59
|
+
version: 2.6.0
|
60
|
+
type: :development
|
61
|
+
version_requirements: *id003
|
35
62
|
description: ""
|
36
63
|
email:
|
37
64
|
- support@thoughtworks.com
|
@@ -45,6 +72,7 @@ extra_rdoc_files:
|
|
45
72
|
- History.txt
|
46
73
|
- README.rdoc
|
47
74
|
files:
|
75
|
+
- .specification
|
48
76
|
- getting_started.txt
|
49
77
|
- README.rdoc
|
50
78
|
- LICENSE.txt
|
@@ -72,6 +100,7 @@ files:
|
|
72
100
|
- test/fixtures/sample/projects.yml
|
73
101
|
- test/fixtures/sample/property_definitions.yml
|
74
102
|
- test/fixtures/sample/users.yml
|
103
|
+
- test/project_data/macro_toolkit_test_template.mingle
|
75
104
|
- bin/new_mingle_macro
|
76
105
|
- example/Rakefile
|
77
106
|
- example/deploy.rake
|
@@ -95,18 +124,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
95
124
|
requirements:
|
96
125
|
- - ">="
|
97
126
|
- !ruby/object:Gem::Version
|
127
|
+
segments:
|
128
|
+
- 0
|
98
129
|
version: "0"
|
99
|
-
version:
|
100
130
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
131
|
requirements:
|
102
132
|
- - ">="
|
103
133
|
- !ruby/object:Gem::Version
|
134
|
+
segments:
|
135
|
+
- 0
|
104
136
|
version: "0"
|
105
|
-
version:
|
106
137
|
requirements: []
|
107
138
|
|
108
139
|
rubyforge_project: mingle-macros
|
109
|
-
rubygems_version: 1.3.
|
140
|
+
rubygems_version: 1.3.6
|
110
141
|
signing_key:
|
111
142
|
specification_version: 3
|
112
143
|
summary: This toolkit provides support for developing, testing and deploying custom Mingle macros.
|