mingle-macro-development-toolkit 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History +4 -0
- data/README +3 -3
- data/Rakefile +5 -0
- data/lib/mingle_macro_development_toolkit/loaders/fixture_loaders/base.rb +2 -2
- data/lib/mingle_macro_development_toolkit/loaders/fixture_loaders/card_type_loader.rb +1 -1
- data/lib/mingle_macro_development_toolkit/loaders/fixture_loaders/card_types_loader.rb +1 -1
- data/lib/mingle_macro_development_toolkit/loaders/fixture_loaders/card_types_property_definitions_loader.rb +1 -1
- data/lib/mingle_macro_development_toolkit/loaders/fixture_loaders/project_loader.rb +1 -1
- data/lib/mingle_macro_development_toolkit/loaders/fixture_loaders/project_variables_loader.rb +1 -1
- data/lib/mingle_macro_development_toolkit/loaders/fixture_loaders/property_definition_loader.rb +1 -1
- data/lib/mingle_macro_development_toolkit/loaders/fixture_loaders/property_definitions_loader.rb +1 -1
- data/lib/mingle_macro_development_toolkit/loaders/fixture_loaders/property_values_loader.rb +1 -1
- data/lib/mingle_macro_development_toolkit/loaders/fixture_loaders/team_loader.rb +1 -1
- data/lib/mingle_macro_development_toolkit/loaders/restful_loaders/base.rb +1 -1
- data/lib/mingle_macro_development_toolkit/loaders/restful_loaders/card_type_loader.rb +1 -1
- data/lib/mingle_macro_development_toolkit/loaders/restful_loaders/card_types_loader.rb +1 -1
- data/lib/mingle_macro_development_toolkit/loaders/restful_loaders/card_types_property_definitions_loader.rb +1 -1
- data/lib/mingle_macro_development_toolkit/loaders/restful_loaders/project_loader.rb +1 -1
- data/lib/mingle_macro_development_toolkit/loaders/restful_loaders/project_variables_loader.rb +1 -1
- data/lib/mingle_macro_development_toolkit/loaders/restful_loaders/property_definition_loader.rb +1 -1
- data/lib/mingle_macro_development_toolkit/loaders/restful_loaders/property_definitions_loader.rb +1 -1
- data/lib/mingle_macro_development_toolkit/loaders/restful_loaders/property_values_loader.rb +1 -1
- data/lib/mingle_macro_development_toolkit/loaders/restful_loaders/team_loader.rb +1 -1
- data/lib/mingle_macro_development_toolkit/loaders.rb +2 -2
- data/lib/mingle_macro_development_toolkit.rb +1 -1
- data/templates/getting_started.txt +61 -48
- data/templates/test/integration/integration_test_helper.rb +1 -1
- data/test/integration/integration_test_helper.rb +1 -1
- data/test/integration/restful_loaders_test.rb +2 -2
- data/test/unit/fixture_loaders_test.rb +1 -1
- data/test/unit/unit_test_helper.rb +1 -1
- metadata +6 -6
data/History
CHANGED
data/README
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
https://github.com/ThoughtWorksStudios/mingle_macro_development_toolkit
|
4
4
|
|
5
|
-
NOTE: This new version will only work with
|
5
|
+
NOTE: This new version will only work with Mingle 12.1 release and later. For older versions of Mingle, please use version 1.3.3
|
6
6
|
|
7
7
|
This toolkit provides support for developing, testing and deploying custom Mingle macros.
|
8
8
|
|
@@ -37,7 +37,7 @@ the macro skeleton as follows
|
|
37
37
|
|
38
38
|
% new_mingle_macro risk_meter
|
39
39
|
|
40
|
-
The skeleton project will also contain a file, called "getting_started.txt" that will walk you through the steps
|
40
|
+
The skeleton project will also contain a file, called "getting_started.txt"[https://github.com/ThoughtWorksStudios/mingle_macro_development_toolkit/blob/master/templates/getting_started.txt] that will walk you through the steps
|
41
41
|
of fleshing out your macro.
|
42
42
|
|
43
43
|
== SUPPORT:
|
@@ -49,7 +49,7 @@ team over email at support@thoughtworks.com
|
|
49
49
|
|
50
50
|
The MIT License
|
51
51
|
|
52
|
-
Copyright (c)
|
52
|
+
Copyright (c) 2007 - 2013 ThoughtWorks, Inc. All rights reserved.
|
53
53
|
|
54
54
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
55
55
|
of this software and associated documentation files (the "Software"), to deal
|
data/Rakefile
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "rake/testtask"
|
2
|
+
require 'rdoc/task'
|
2
3
|
|
3
4
|
namespace :test do
|
4
5
|
Rake::TestTask.new(:unit) do |t|
|
@@ -12,4 +13,8 @@ namespace :test do
|
|
12
13
|
t.pattern = 'test/integration/*_test.rb'
|
13
14
|
t.verbose = true
|
14
15
|
end
|
16
|
+
end
|
17
|
+
|
18
|
+
RDoc::Task.new do |rdoc|
|
19
|
+
rdoc.rdoc_files.include "README", "LICENSE", "lib/**/*.rb", "bin/**/*.rb"
|
15
20
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#Copyright
|
1
|
+
#Copyright 2007 - 2013 ThoughtWorks, Inc. All rights reserved.
|
2
2
|
require "yaml"
|
3
3
|
|
4
4
|
module FixtureLoaders
|
@@ -16,4 +16,4 @@ module FixtureLoaders
|
|
16
16
|
@attributes.all? { |key, value| value == record[key] }
|
17
17
|
end
|
18
18
|
end
|
19
|
-
end
|
19
|
+
end
|
@@ -1,27 +1,25 @@
|
|
1
|
+
|
2
|
+
|
1
3
|
A background on macros in Mingle
|
2
4
|
---------------------------------
|
3
5
|
|
4
|
-
Macros
|
6
|
+
Macros allow you to create tables, charts and graphs using data from your Mingle project. A macro is identified by the following markup generic syntax
|
5
7
|
|
6
|
-
{{
|
7
8
|
macro_name
|
8
9
|
parameter1: value1
|
9
10
|
parameter2: value2
|
10
11
|
...
|
11
|
-
}}
|
12
12
|
|
13
13
|
The markup has to be valid YAML syntax. Specifically, this means that the markup is sensitive to spacing and indentation. For more help around YAML and what constitutes valid YAML markup, you can refer to http://yaml.org/spec/current.html
|
14
14
|
|
15
15
|
Specific examples of this include the pre-written macros, such as the value, average & table macros and the macros for all the charts.
|
16
16
|
|
17
|
-
When Mingle encounters a macro
|
17
|
+
When Mingle encounters a macro in your card or page content, it delegates handling of the macro to a custom class behind the scenes that is registered to handle it. For example, if Mingle encountered the following macro,
|
18
18
|
|
19
|
-
{{
|
20
19
|
average
|
21
20
|
query: SELECT 'Pre-release Estimate' WHERE Release = (current release)
|
22
|
-
}}
|
23
21
|
|
24
|
-
it would parse the content
|
22
|
+
it would parse the content and identify the following.
|
25
23
|
|
26
24
|
Macro Name: average
|
27
25
|
Macro Parameters: {query => "SELECT 'Pre-release Estimate' WHERE Release = (current release)"}
|
@@ -55,7 +53,8 @@ The second parameter is special and could be either a single project or multiple
|
|
55
53
|
|
56
54
|
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
55
|
|
58
|
-
For more help on what constitutes valid MQL, you can refer to our help documentation at
|
56
|
+
For more help on what constitutes valid MQL, you can refer to our help documentation at
|
57
|
+
http://www.thoughtworks-studios.com/docs/mingle/current/help/mql_reference.html
|
59
58
|
|
60
59
|
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
60
|
|
@@ -94,14 +93,12 @@ your_new_macro
|
|
94
93
|
|
95
94
|
The lib directory contains the actual macro, and the test folders give you the option to run the tests either against local YAML based fixtures, or using REST to test against a deployed mingle instance.
|
96
95
|
|
97
|
-
When this macro is deployed to Mingle, all
|
96
|
+
When this macro is deployed to Mingle, all content of the form
|
98
97
|
|
99
|
-
{{
|
100
98
|
your_new_macro
|
101
99
|
parameter1: value1
|
102
100
|
parameter2: <some_mql_statement>
|
103
101
|
...
|
104
|
-
}}
|
105
102
|
|
106
103
|
will be parsed as YAML and handling will be delegated to an instance of your macro class, YourNewMacro. The parameters will be parsed into a Ruby hash, of the following structure:
|
107
104
|
|
@@ -113,7 +110,7 @@ def self.supports_project_group?
|
|
113
110
|
true
|
114
111
|
end
|
115
112
|
|
116
|
-
|
113
|
+
The following is an example of what you can do with this toolkit. It uses the Google Charting API to render a Google-o-meter style chart to represent work completed in a fuel gauge style meter.
|
117
114
|
|
118
115
|
class WorkGauge
|
119
116
|
|
@@ -122,6 +119,7 @@ class WorkGauge
|
|
122
119
|
@project = project
|
123
120
|
@current_user = current_user
|
124
121
|
end
|
122
|
+
|
125
123
|
|
126
124
|
def execute
|
127
125
|
completed_work = @project.execute_mql(@parameters['completed_work']).first.values.sum
|
@@ -133,52 +131,67 @@ class WorkGauge
|
|
133
131
|
|
134
132
|
end
|
135
133
|
|
136
|
-
The execute method can return any valid HTML or Javascript content.
|
134
|
+
The execute method can return any valid HTML or Javascript content.
|
137
135
|
|
138
136
|
The following example demonstrates how to use the Javascript emission functionality to embed a Google Maps map.
|
139
137
|
|
140
138
|
Note: For this example to work, you will have to supply your own Google Maps API key as a part of the script tag that loads the Google API.
|
141
139
|
|
142
|
-
|
143
|
-
|
140
|
+
require 'uri'
|
141
|
+
require 'rack'
|
142
|
+
require "thread"
|
143
|
+
require "active_support"
|
144
|
+
|
145
|
+
class GoogleMapsMacro
|
146
|
+
|
144
147
|
def initialize(parameters, project, current_user)
|
145
|
-
@
|
146
|
-
@
|
147
|
-
@
|
148
|
+
@src = parameters['src']
|
149
|
+
@width = parameters['width']
|
150
|
+
@height = parameters['height']
|
148
151
|
end
|
149
|
-
|
152
|
+
|
150
153
|
def execute
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
<script type="text/javascript">
|
157
|
-
// register the initialize function for executing after page loaded.
|
158
|
-
MingleJavascript.register(function initialize() {
|
159
|
-
if (GBrowserIsCompatible()) {
|
160
|
-
var map = new GMap2(document.getElementById("map_canvas"));
|
161
|
-
map.setCenter(new GLatLng(#{@latitude}, #{@longitude}), #{@zoom_level});
|
162
|
-
}
|
163
|
-
})
|
164
|
-
</script>
|
165
|
-
HTML
|
154
|
+
raise "Parameter src must be a recognized Google Maps URL." unless valid?
|
155
|
+
|
156
|
+
%{
|
157
|
+
<iframe src="#{source_with_embedded_output}" width="#{@width}" height="#{@height}" />
|
158
|
+
}
|
166
159
|
end
|
167
|
-
|
160
|
+
|
161
|
+
def valid?
|
162
|
+
return false unless @src
|
163
|
+
begin
|
164
|
+
uri = URI.parse(@src)
|
165
|
+
return unless uri.host
|
166
|
+
return unless (uri.scheme == "http" ||uri.scheme == "https")
|
167
|
+
uri.host.start_with?('maps.google.com')
|
168
|
+
rescue URI::InvalidURIError
|
169
|
+
false
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
168
173
|
def can_be_cached?
|
169
|
-
|
174
|
+
true
|
170
175
|
end
|
171
|
-
|
176
|
+
|
177
|
+
private
|
178
|
+
|
179
|
+
def source_with_embedded_output
|
180
|
+
uri = URI.parse(@src)
|
181
|
+
query = uri.query || ""
|
182
|
+
query_params = Rack::Utils.parse_query(query)
|
183
|
+
uri.query = query_params.merge('output' => 'embed').to_query
|
184
|
+
uri.to_s
|
185
|
+
end
|
186
|
+
|
172
187
|
end
|
173
188
|
|
174
|
-
Long running or integration macros which run on server will result in long page render times. We recommend these
|
175
|
-
of macros use Javascript (or JSONP) to offload work to the browser.
|
189
|
+
Long running or integration macros which run on server will result in long page render times. We recommend that these macros use Javascript (or JSONP) to offload work to the browser.
|
176
190
|
|
177
191
|
You can find both simpler and more complex examples in the vendor/plugins/sample_macros directory.
|
178
192
|
|
179
|
-
Tip: If you wish to use JQuery
|
180
|
-
|
181
|
-
|
193
|
+
Tip: If you wish to use JQuery use $j instead of $ or JQuery.
|
194
|
+
|
182
195
|
Unit testing your macro
|
183
196
|
------------------------
|
184
197
|
|
@@ -215,7 +228,7 @@ Integration testing your macro
|
|
215
228
|
|
216
229
|
########################################################NOTE###############################################################
|
217
230
|
# #
|
218
|
-
# IN ORDER TO RUN THE INTEGRATION TESTS, YOU WILL NEED TO TURN ON BASIC AUTHENTICATION FOR THE MINGLE
|
231
|
+
# IN ORDER TO RUN THE INTEGRATION TESTS, YOU WILL NEED TO TURN ON BASIC AUTHENTICATION FOR THE MINGLE SERVER THAT YOU #
|
219
232
|
# ARE GOING TO BE TESTING AGAINST. #
|
220
233
|
# #
|
221
234
|
#########################################################NOTE##############################################################
|
@@ -246,7 +259,7 @@ end
|
|
246
259
|
|
247
260
|
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
261
|
|
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
|
262
|
+
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, so you should be able to run them within your organization too without a problem.
|
250
263
|
|
251
264
|
To run your integration tests, run
|
252
265
|
|
@@ -278,7 +291,7 @@ To deploy your macro to a locally deployed instance of Mingle, which is running
|
|
278
291
|
|
279
292
|
% rake macro:deploy MINGLE_LOCATION=/path/to/mingle_root
|
280
293
|
|
281
|
-
where /path/to/mingle_root is the location where Mingle
|
294
|
+
where /path/to/mingle_root is the location where Mingle is installed.
|
282
295
|
|
283
296
|
* On Windows, this is the location that the installer installed Mingle at
|
284
297
|
* On OSX, this will be within the app bundle, at <mingle_application_bundle>/Contents/Resources/app
|
@@ -294,13 +307,13 @@ Alternatively, you could also copy the folder by hand into the same location.
|
|
294
307
|
# #
|
295
308
|
#########################################################NOTE###############################################################
|
296
309
|
|
297
|
-
This Getting Started file and the mingle-macro-development-toolkit-
|
310
|
+
This Getting Started file and the mingle-macro-development-toolkit-2.0.1.gem are owned exclusively by ThoughtWorks, Inc.,
|
298
311
|
and ThoughtWorks reserves all rights therein.
|
299
312
|
|
300
313
|
We believe that it is a sound practice from legal, business and software development perspectives to always provide copyright
|
301
314
|
information and license information with any software that you make available to others. We have provided this information
|
302
|
-
for the Mingle Macro Development Toolkit in the LICENSE
|
315
|
+
for the Mingle Macro Development Toolkit in the LICENSE file distributed with the Toolkit. We encourage you to use that
|
303
316
|
as an example to follow when marking your software with a copyright notice, as well as providing users with a license to your
|
304
317
|
software. We have chosen to use the MIT License, an Open Source License, you may choose to use the same or a different
|
305
318
|
license. If you are going to use an Open Source License we strongly encourage you to use a license approved by the Open Source
|
306
|
-
Initiative, available here: http://www.opensource.org/licenses.
|
319
|
+
Initiative, available here: http://www.opensource.org/licenses.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#Copyright
|
1
|
+
#Copyright 2007 - 2013 ThoughtWorks, Inc. All rights reserved.
|
2
2
|
|
3
3
|
require File.join(File.dirname(__FILE__), 'integration_test_helper')
|
4
4
|
|
@@ -104,4 +104,4 @@ class RestLoaderTest < Test::Unit::TestCase
|
|
104
104
|
assert_equal false, project(TEST_PROJECT).can_be_cached?("SELECT 'Story Points' WHERE 'Date Created' IS TODAY")
|
105
105
|
end
|
106
106
|
|
107
|
-
end
|
107
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#Copyright
|
1
|
+
#Copyright 2007 - 2013 ThoughtWorks, Inc. All rights reserved.
|
2
2
|
|
3
3
|
require File.join(File.dirname(__FILE__), "..", "test_helper")
|
4
4
|
FixtureLoaders::FIXTURE_PATH = File.join(File.dirname(__FILE__), "..", "data", "fixtures")
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mingle-macro-development-toolkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 2.0.
|
9
|
+
- 1
|
10
|
+
version: 2.0.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- ThoughtWorks Inc
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2013-03-19 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: mingle_macro_models
|
@@ -118,7 +118,7 @@ files:
|
|
118
118
|
homepage: https://github.com/ThoughtWorksStudios/mingle_macro_development_toolkit
|
119
119
|
licenses:
|
120
120
|
- MIT
|
121
|
-
post_install_message: "NOTE: This version will only work with Mingle 12.1. For older versions of Mingle, please use version 1.3.3"
|
121
|
+
post_install_message: "NOTE: This version will only work with Mingle 12.1 and later. For older versions of Mingle, please use version 1.3.3"
|
122
122
|
rdoc_options: []
|
123
123
|
|
124
124
|
require_paths:
|
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
144
|
requirements: []
|
145
145
|
|
146
146
|
rubyforge_project:
|
147
|
-
rubygems_version: 1.8.
|
147
|
+
rubygems_version: 1.8.24
|
148
148
|
signing_key:
|
149
149
|
specification_version: 3
|
150
150
|
summary: This toolkit provides support for developing, testing and deploying custom Mingle macros.
|