mingle-macro-development-toolkit 1.3.3 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/{History.txt → History} +11 -0
- data/{LICENSE.txt → LICENSE} +0 -0
- data/{README.txt → README} +4 -2
- data/Rakefile +15 -40
- data/bin/new_mingle_macro +25 -137
- data/lib/mingle_macro_development_toolkit.rb +4 -0
- data/lib/mingle_macro_development_toolkit/loaders.rb +5 -0
- data/lib/mingle_macro_development_toolkit/loaders/fixture_loaders/base.rb +19 -0
- data/lib/mingle_macro_development_toolkit/loaders/fixture_loaders/card_type_loader.rb +15 -0
- data/lib/mingle_macro_development_toolkit/loaders/fixture_loaders/card_types_loader.rb +10 -0
- data/lib/mingle_macro_development_toolkit/loaders/fixture_loaders/card_types_property_definitions_loader.rb +12 -0
- data/lib/mingle_macro_development_toolkit/loaders/fixture_loaders/project_loader.rb +16 -0
- data/lib/mingle_macro_development_toolkit/loaders/fixture_loaders/project_variables_loader.rb +10 -0
- data/lib/mingle_macro_development_toolkit/loaders/fixture_loaders/property_definition_loader.rb +16 -0
- data/lib/mingle_macro_development_toolkit/loaders/fixture_loaders/property_definitions_loader.rb +10 -0
- data/lib/mingle_macro_development_toolkit/loaders/fixture_loaders/property_values_loader.rb +10 -0
- data/lib/mingle_macro_development_toolkit/loaders/fixture_loaders/team_loader.rb +10 -0
- data/lib/mingle_macro_development_toolkit/loaders/restful_loaders/base.rb +85 -0
- data/lib/mingle_macro_development_toolkit/loaders/restful_loaders/card_type_loader.rb +19 -0
- data/lib/mingle_macro_development_toolkit/loaders/restful_loaders/card_types_loader.rb +14 -0
- data/lib/mingle_macro_development_toolkit/loaders/restful_loaders/card_types_property_definitions_loader.rb +32 -0
- data/lib/mingle_macro_development_toolkit/loaders/restful_loaders/project_loader.rb +26 -0
- data/lib/mingle_macro_development_toolkit/loaders/restful_loaders/project_variables_loader.rb +14 -0
- data/lib/mingle_macro_development_toolkit/loaders/restful_loaders/property_definition_loader.rb +20 -0
- data/lib/mingle_macro_development_toolkit/loaders/restful_loaders/property_definitions_loader.rb +14 -0
- data/lib/mingle_macro_development_toolkit/loaders/restful_loaders/property_values_loader.rb +14 -0
- data/lib/mingle_macro_development_toolkit/loaders/restful_loaders/team_loader.rb +14 -0
- data/templates/Rakefile +23 -0
- data/{getting_started.txt → templates/getting_started.txt} +93 -93
- data/templates/init.rb +1 -0
- data/{example → templates/lib}/macro.rb +0 -0
- data/{test/project_data → templates/test/data/exports}/macro_toolkit_test_template.mingle +0 -0
- data/{test/fixtures/sample → templates/test/data/fixtures}/card_types.yml +0 -0
- data/{test/fixtures/sample → templates/test/data/fixtures}/project_variables.yml +0 -0
- data/{test/fixtures/sample → templates/test/data/fixtures}/projects.yml +0 -0
- data/{test/fixtures/sample → templates/test/data/fixtures}/property_definitions.yml +0 -0
- data/{test/fixtures/sample → templates/test/data/fixtures}/property_type_mappings.yml +0 -0
- data/{test/fixtures/sample → templates/test/data/fixtures}/property_values.yml +0 -0
- data/{test/fixtures/sample → templates/test/data/fixtures}/users.yml +0 -0
- data/{example → templates/test/integration}/integration_test.rb +4 -5
- data/templates/test/integration/integration_test_helper.rb +23 -0
- data/templates/test/test_helper.rb +4 -0
- data/{example → templates/test/unit}/unit_test.rb +7 -7
- data/templates/test/unit/unit_test_helper.rb +13 -0
- data/test/data/exports/macro_toolkit_test_template.mingle +0 -0
- data/test/data/fixtures/card_types.yml +37 -0
- data/test/data/fixtures/project_variables.yml +7 -0
- data/test/data/fixtures/projects.yml +4 -0
- data/test/data/fixtures/property_definitions.yml +51 -0
- data/test/data/fixtures/property_type_mappings.yml +81 -0
- data/test/data/fixtures/property_values.yml +19 -0
- data/test/data/fixtures/users.yml +16 -0
- data/test/integration/integration_test_helper.rb +3 -13
- data/test/integration/{rest_loader_test.rb → restful_loaders_test.rb} +4 -4
- data/test/test_helper.rb +2 -0
- data/test/unit/{fixture_loader_test.rb → fixture_loaders_test.rb} +2 -2
- data/test/unit/unit_test_helper.rb +7 -6
- metadata +101 -100
- data/example/Rakefile +0 -6
- data/example/deploy.rake +0 -10
- data/example/init.rb +0 -10
- data/example/integration_test_helper.rb +0 -31
- data/example/unit_test_helper.rb +0 -13
- data/lib/macro_development_toolkit.rb +0 -29
- data/lib/macro_development_toolkit/mingle/card_type.rb +0 -41
- data/lib/macro_development_toolkit/mingle/card_type_property_definition.rb +0 -26
- data/lib/macro_development_toolkit/mingle/project.rb +0 -168
- data/lib/macro_development_toolkit/mingle/project_variable.rb +0 -24
- data/lib/macro_development_toolkit/mingle/property_definition.rb +0 -105
- data/lib/macro_development_toolkit/mingle/property_value.rb +0 -67
- data/lib/macro_development_toolkit/mingle/user.rb +0 -33
- data/lib/macro_development_toolkit/mingle_model_loader.rb +0 -151
- data/tasks/test.rake +0 -16
- data/test/integration/rest_loader.rb +0 -233
- data/test/unit/fixture_loader.rb +0 -109
data/test/unit/fixture_loader.rb
DELETED
@@ -1,109 +0,0 @@
|
|
1
|
-
#Copyright 2010 ThoughtWorks, Inc. All rights reserved.
|
2
|
-
|
3
|
-
module FixtureLoaders
|
4
|
-
class Base
|
5
|
-
|
6
|
-
def initialize(attributes)
|
7
|
-
@attributes = attributes
|
8
|
-
end
|
9
|
-
|
10
|
-
def load_fixtures_for(name)
|
11
|
-
path = File.join(File.dirname(__FILE__), '..', 'fixtures', "sample", "#{name}.yml")
|
12
|
-
YAML::load(File.read(path))
|
13
|
-
end
|
14
|
-
|
15
|
-
def match?(record)
|
16
|
-
@attributes.all? { |key, value| value == record[key] }
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
class ProjectLoader < Base
|
21
|
-
attr_reader :project
|
22
|
-
|
23
|
-
def initialize(identifier)
|
24
|
-
project_attributes = load_fixtures_for('projects').detect {|project| project['identifier'] == identifier }
|
25
|
-
@project = Mingle::Project.new(OpenStruct.new(project_attributes), nil)
|
26
|
-
project.card_types_loader = CardTypesLoader.new('project_id' => project_attributes['id'])
|
27
|
-
project.property_definitions_loader = PropertyDefinitionsLoader.new('project_id' => project_attributes['id'])
|
28
|
-
project.team_loader = TeamLoader.new('project_id' => project_attributes['id'])
|
29
|
-
project.project_variables_loader = ProjectVariablesLoader.new('project_id' => project_attributes['id'])
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
class CardTypesLoader < Base
|
34
|
-
def load
|
35
|
-
load_fixtures_for('card_types').collect do |ct|
|
36
|
-
CardTypeLoader.new('id' => ct['id']) if match?(ct)
|
37
|
-
end.compact.sort_by { |loader| loader.card_type.position }
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
class CardTypeLoader < Base
|
42
|
-
def card_type
|
43
|
-
@card_type ||= load
|
44
|
-
end
|
45
|
-
|
46
|
-
def load
|
47
|
-
record = load_fixtures_for('card_types').find {|ct| match?(ct)}
|
48
|
-
card_type = Mingle::CardType.new(OpenStruct.new(record))
|
49
|
-
card_type.card_types_property_definitions_loader = CardTypesPropertyDefinitionsLoader.new('card_type_id' => record['id'])
|
50
|
-
card_type
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
class PropertyDefinitionsLoader < Base
|
55
|
-
def load
|
56
|
-
load_fixtures_for('property_definitions').collect do |pd|
|
57
|
-
PropertyDefinitionLoader.new('id' => pd['id']) if match?(pd)
|
58
|
-
end.compact
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
class PropertyDefinitionLoader < Base
|
63
|
-
def property_definition
|
64
|
-
@property_definition ||= load
|
65
|
-
end
|
66
|
-
|
67
|
-
def load
|
68
|
-
record = load_fixtures_for('property_definitions').find { |pd| match?(pd)}
|
69
|
-
property_definition = Mingle::PropertyDefinition.new(OpenStruct.new(record))
|
70
|
-
property_definition.card_types_property_definitions_loader = CardTypesPropertyDefinitionsLoader.new('property_definition_id' => record['id'])
|
71
|
-
property_definition.values_loader = PropertyValuesLoader.new('property_definition_id' => record['id'])
|
72
|
-
property_definition
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
class PropertyValuesLoader < Base
|
77
|
-
def load
|
78
|
-
load_fixtures_for('property_values').collect do |pv|
|
79
|
-
Mingle::PropertyValue.new(OpenStruct.new(pv)) if match?(pv)
|
80
|
-
end.compact
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
class CardTypesPropertyDefinitionsLoader < Base
|
85
|
-
def load
|
86
|
-
load_fixtures_for('property_type_mappings').collect do |mapping|
|
87
|
-
pd = PropertyDefinitionLoader.new('id' => mapping['property_definition_id']) if match?(mapping)
|
88
|
-
ct = CardTypeLoader.new('id' => mapping['card_type_id']) if match?(mapping)
|
89
|
-
OpenStruct.new(:card_type => ct.load, :property_definition => pd.load) if ct && pd
|
90
|
-
end.compact
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
class TeamLoader < Base
|
95
|
-
def load
|
96
|
-
load_fixtures_for('users').collect do |user|
|
97
|
-
Mingle::User.new(OpenStruct.new(user)) if match?(user)
|
98
|
-
end.compact
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
class ProjectVariablesLoader < Base
|
103
|
-
def load
|
104
|
-
load_fixtures_for('project_variables').collect do |pv|
|
105
|
-
Mingle::ProjectVariable.new(OpenStruct.new(pv)) if match?(pv)
|
106
|
-
end.compact
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|