buildr-iidea 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,234 +1,234 @@
1
- require File.expand_path('../../../spec_helper', __FILE__)
2
-
3
- IPR_TEMPLATE_NAME = "project.template.iml"
4
-
5
- IPR_TEMPLATE = <<PROJECT_XML
6
- <?xml version="1.0" encoding="UTF-8"?>
7
- <project version="4">
8
- <component name="SvnBranchConfigurationManager">
9
- <option name="mySupportsUserInfoFilter" value="false" />
10
- </component>
11
- </project>
12
- PROJECT_XML
13
-
14
- IPR_EXISTING = <<PROJECT_XML
15
- <?xml version="1.0" encoding="UTF-8"?>
16
- <project version="4">
17
- <component name="AntConfiguration">
18
- <defaultAnt bundledAnt="true" />
19
- </component>
20
- <component name="SvnBranchConfigurationManager">
21
- <option name="mySupportsUserInfoFilter" value="true" />
22
- </component>
23
- <component name="ProjectModuleManager">
24
- <modules>
25
- <module fileurl="file://$PROJECT_DIR$/existing.iml" filepath="$PROJECT_DIR$/existing.iml" />
26
- </modules>
27
- </component>
28
- </project>
29
- PROJECT_XML
30
-
31
- IPR_FROM_TEMPLATE_XPATH = <<XPATH
32
- /project/component[@name='SvnBranchConfigurationManager']/option[@name = 'mySupportsUserInfoFilter' and @value = 'false']
33
- XPATH
34
-
35
- IPR_FROM_EXISTING_XPATH = <<XPATH
36
- /project/component[@name='AntConfiguration']
37
- XPATH
38
-
39
- IPR_FROM_EXISTING_SHADOWING_TEMPLATE_XPATH = <<XPATH
40
- /project/component[@name='SvnBranchConfigurationManager']/option[@name = 'mySupportsUserInfoFilter' and @value = 'true']
41
- XPATH
42
-
43
- IPR_FROM_EXISTING_SHADOWING_GENERATED_XPATH = <<XPATH
44
- /project/component[@name='ProjectModuleManager']/modules/module[@fileurl = 'file://$PROJECT_DIR$/existing.iml']
45
- XPATH
46
-
47
- IPR_FROM_GENERATED_XPATH = <<XPATH
48
- /project/component[@name='ProjectModuleManager']/modules/module[@fileurl = 'file://$PROJECT_DIR$/foo.iml']
49
- XPATH
50
-
51
- IML_TEMPLATE_NAME = "module.template.iml"
52
-
53
- IML_TEMPLATE = <<PROJECT_XML
54
- <?xml version="1.0" encoding="UTF-8"?>
55
- <module type="JAVA_MODULE" version="4">
56
- <component name="FacetManager">
57
- <facet type="JRUBY" name="JRuby">
58
- <configuration number="0">
59
- <JRUBY_FACET_CONFIG_ID NAME="JRUBY_SDK_NAME" VALUE="JRuby SDK 1.4.0RC1" />
60
- </configuration>
61
- </facet>
62
- </component>
63
- </module>
64
- PROJECT_XML
65
-
66
- IML_EXISTING = <<PROJECT_XML
67
- <?xml version="1.0" encoding="UTF-8"?>
68
- <module type="JAVA_MODULE" version="4">
69
- <component name="FunkyPlugin"/>
70
- <component name="FacetManager">
71
- <facet type="SCALA" name="Scala"/>
72
- </component>
73
- <component name="NewModuleRootManager" inherit-compiler-output="true">
74
- <exclude-output />
75
- <content url="file://$MODULE_DIR$"/>
76
- <orderEntry type="inheritedJdk" />
77
- <orderEntry type="sourceFolder" forTests="false" />
78
- <orderEntry type="module" module-name="buildr-bnd" exported="" />
79
- </component>
80
- </module>
81
- PROJECT_XML
82
-
83
- IML_FROM_TEMPLATE_XPATH = <<XPATH
84
- /module/component[@name='FacetManager']/facet[@type = 'JRUBY']
85
- XPATH
86
-
87
- IML_FROM_EXISTING_XPATH = <<XPATH
88
- /module/component[@name='FunkyPlugin']
89
- XPATH
90
-
91
- IML_FROM_EXISTING_SHADOWING_TEMPLATE_XPATH = <<XPATH
92
- /module/component[@name='FacetManager']/facet[@type = 'SCALA']
93
- XPATH
94
-
95
- IML_FROM_EXISTING_SHADOWING_GENERATED_XPATH = <<XPATH
96
- /module/component[@name='NewModuleRootManager']/orderEntry[@module-name = 'buildr-bnd']
97
- XPATH
98
-
99
- IML_FROM_GENERATED_XPATH = <<XPATH
100
- /module/component[@name='NewModuleRootManager']/orderEntry[@type = 'module-library']
101
- XPATH
102
-
103
- describe "iidea:generate" do
104
-
105
- describe "with existing project files" do
106
- before do
107
- write "foo.ipr", IPR_EXISTING
108
- write "foo.iml", IML_EXISTING
109
- artifact('group:id:jar:1.0') { |t| write t.to_s }
110
- @foo = define "foo" do
111
- ipr.template = nil
112
- iml.template = nil
113
- compile.with 'group:id:jar:1.0'
114
- end
115
- invoke_generate_task
116
- end
117
-
118
- it "replaces ProjectModuleManager component in existing ipr file" do
119
- xml_document(@foo._("foo.ipr")).should have_xpath(IPR_FROM_GENERATED_XPATH)
120
- xml_document(@foo._("foo.ipr")).should_not have_xpath(IPR_FROM_EXISTING_SHADOWING_GENERATED_XPATH)
121
- end
122
-
123
- it "merges component in existing ipr file" do
124
- xml_document(@foo._("foo.ipr")).should have_xpath(IPR_FROM_EXISTING_XPATH)
125
- end
126
-
127
- it "replaces NewModuleRootManager component in existing iml file" do
128
- xml_document(@foo._("foo.iml")).should have_xpath(IML_FROM_GENERATED_XPATH)
129
- xml_document(@foo._("foo.iml")).should_not have_xpath(IML_FROM_EXISTING_SHADOWING_GENERATED_XPATH)
130
- end
131
-
132
- it "merges component in existing iml file" do
133
- xml_document(@foo._("foo.iml")).should have_xpath(IML_FROM_EXISTING_XPATH)
134
- end
135
- end
136
-
137
- describe "with an iml template" do
138
- before do
139
- write IML_TEMPLATE_NAME, IML_TEMPLATE
140
- artifact('group:id:jar:1.0') { |t| write t.to_s }
141
- @foo = define "foo" do
142
- ipr.template = nil
143
- iml.template = IML_TEMPLATE_NAME
144
- compile.with 'group:id:jar:1.0'
145
- end
146
- invoke_generate_task
147
- end
148
-
149
- it "replaces generated components" do
150
- xml_document(@foo._("foo.iml")).should have_xpath(IML_FROM_GENERATED_XPATH)
151
- end
152
-
153
- it "merges component in iml template" do
154
- xml_document(@foo._("foo.iml")).should have_xpath(IML_FROM_TEMPLATE_XPATH)
155
- end
156
- end
157
-
158
- describe "with an iml template and existing iml" do
159
- before do
160
- write IML_TEMPLATE_NAME, IML_TEMPLATE
161
- write "foo.iml", IML_EXISTING
162
- artifact('group:id:jar:1.0') { |t| write t.to_s }
163
- @foo = define "foo" do
164
- ipr.template = nil
165
- iml.template = IML_TEMPLATE_NAME
166
- compile.with 'group:id:jar:1.0'
167
- end
168
- invoke_generate_task
169
- end
170
-
171
- it "replaces generated components" do
172
- xml_document(@foo._("foo.iml")).should have_xpath(IML_FROM_GENERATED_XPATH)
173
- end
174
-
175
- it "merges component in iml template" do
176
- xml_document(@foo._("foo.iml")).should have_xpath(IML_FROM_TEMPLATE_XPATH)
177
- end
178
-
179
- it "merges components not in iml template and not generated by task" do
180
- xml_document(@foo._("foo.iml")).should have_xpath(IML_FROM_EXISTING_XPATH)
181
- xml_document(@foo._("foo.iml")).should_not have_xpath(IML_FROM_EXISTING_SHADOWING_TEMPLATE_XPATH)
182
- xml_document(@foo._("foo.iml")).should_not have_xpath(IML_FROM_EXISTING_SHADOWING_GENERATED_XPATH)
183
- end
184
- end
185
-
186
- describe "with an ipr template" do
187
- before do
188
- write IPR_TEMPLATE_NAME, IPR_TEMPLATE
189
- artifact('group:id:jar:1.0') { |t| write t.to_s }
190
- @foo = define "foo" do
191
- ipr.template = IPR_TEMPLATE_NAME
192
- iml.template = nil
193
- compile.with 'group:id:jar:1.0'
194
- end
195
- invoke_generate_task
196
- end
197
-
198
- it "replaces generated component in ipr template" do
199
- xml_document(@foo._("foo.ipr")).should have_xpath(IPR_FROM_GENERATED_XPATH)
200
- end
201
-
202
- it "merges component in ipr template" do
203
- xml_document(@foo._("foo.ipr")).should have_xpath(IPR_FROM_TEMPLATE_XPATH)
204
- end
205
- end
206
-
207
- describe "with an ipr template and existing ipr" do
208
- before do
209
- write IPR_TEMPLATE_NAME, IPR_TEMPLATE
210
- write "foo.ipr", IPR_EXISTING
211
- artifact('group:id:jar:1.0') { |t| write t.to_s }
212
- @foo = define "foo" do
213
- ipr.template = IPR_TEMPLATE_NAME
214
- iml.template = nil
215
- compile.with 'group:id:jar:1.0'
216
- end
217
- invoke_generate_task
218
- end
219
-
220
- it "replaces generated component in ipr template" do
221
- xml_document(@foo._("foo.ipr")).should have_xpath(IPR_FROM_GENERATED_XPATH)
222
- end
223
-
224
- it "merges component in ipr template" do
225
- xml_document(@foo._("foo.ipr")).should have_xpath(IPR_FROM_TEMPLATE_XPATH)
226
- end
227
-
228
- it "merges components not in ipr template and not generated by task" do
229
- xml_document(@foo._("foo.ipr")).should have_xpath(IPR_FROM_EXISTING_XPATH)
230
- xml_document(@foo._("foo.ipr")).should_not have_xpath(IPR_FROM_EXISTING_SHADOWING_GENERATED_XPATH)
231
- xml_document(@foo._("foo.ipr")).should_not have_xpath(IPR_FROM_EXISTING_SHADOWING_TEMPLATE_XPATH)
232
- end
233
- end
1
+ require File.expand_path('../../../spec_helper', __FILE__)
2
+
3
+ IPR_TEMPLATE_NAME = "project.template.iml"
4
+
5
+ IPR_TEMPLATE = <<PROJECT_XML
6
+ <?xml version="1.0" encoding="UTF-8"?>
7
+ <project version="4">
8
+ <component name="SvnBranchConfigurationManager">
9
+ <option name="mySupportsUserInfoFilter" value="false" />
10
+ </component>
11
+ </project>
12
+ PROJECT_XML
13
+
14
+ IPR_EXISTING = <<PROJECT_XML
15
+ <?xml version="1.0" encoding="UTF-8"?>
16
+ <project version="4">
17
+ <component name="AntConfiguration">
18
+ <defaultAnt bundledAnt="true" />
19
+ </component>
20
+ <component name="SvnBranchConfigurationManager">
21
+ <option name="mySupportsUserInfoFilter" value="true" />
22
+ </component>
23
+ <component name="ProjectModuleManager">
24
+ <modules>
25
+ <module fileurl="file://$PROJECT_DIR$/existing.iml" filepath="$PROJECT_DIR$/existing.iml" />
26
+ </modules>
27
+ </component>
28
+ </project>
29
+ PROJECT_XML
30
+
31
+ IPR_FROM_TEMPLATE_XPATH = <<XPATH
32
+ /project/component[@name='SvnBranchConfigurationManager']/option[@name = 'mySupportsUserInfoFilter' and @value = 'false']
33
+ XPATH
34
+
35
+ IPR_FROM_EXISTING_XPATH = <<XPATH
36
+ /project/component[@name='AntConfiguration']
37
+ XPATH
38
+
39
+ IPR_FROM_EXISTING_SHADOWING_TEMPLATE_XPATH = <<XPATH
40
+ /project/component[@name='SvnBranchConfigurationManager']/option[@name = 'mySupportsUserInfoFilter' and @value = 'true']
41
+ XPATH
42
+
43
+ IPR_FROM_EXISTING_SHADOWING_GENERATED_XPATH = <<XPATH
44
+ /project/component[@name='ProjectModuleManager']/modules/module[@fileurl = 'file://$PROJECT_DIR$/existing.iml']
45
+ XPATH
46
+
47
+ IPR_FROM_GENERATED_XPATH = <<XPATH
48
+ /project/component[@name='ProjectModuleManager']/modules/module[@fileurl = 'file://$PROJECT_DIR$/foo.iml']
49
+ XPATH
50
+
51
+ IML_TEMPLATE_NAME = "module.template.iml"
52
+
53
+ IML_TEMPLATE = <<PROJECT_XML
54
+ <?xml version="1.0" encoding="UTF-8"?>
55
+ <module type="JAVA_MODULE" version="4">
56
+ <component name="FacetManager">
57
+ <facet type="JRUBY" name="JRuby">
58
+ <configuration number="0">
59
+ <JRUBY_FACET_CONFIG_ID NAME="JRUBY_SDK_NAME" VALUE="JRuby SDK 1.4.0RC1" />
60
+ </configuration>
61
+ </facet>
62
+ </component>
63
+ </module>
64
+ PROJECT_XML
65
+
66
+ IML_EXISTING = <<PROJECT_XML
67
+ <?xml version="1.0" encoding="UTF-8"?>
68
+ <module type="JAVA_MODULE" version="4">
69
+ <component name="FunkyPlugin"/>
70
+ <component name="FacetManager">
71
+ <facet type="SCALA" name="Scala"/>
72
+ </component>
73
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
74
+ <exclude-output />
75
+ <content url="file://$MODULE_DIR$"/>
76
+ <orderEntry type="inheritedJdk" />
77
+ <orderEntry type="sourceFolder" forTests="false" />
78
+ <orderEntry type="module" module-name="buildr-bnd" exported="" />
79
+ </component>
80
+ </module>
81
+ PROJECT_XML
82
+
83
+ IML_FROM_TEMPLATE_XPATH = <<XPATH
84
+ /module/component[@name='FacetManager']/facet[@type = 'JRUBY']
85
+ XPATH
86
+
87
+ IML_FROM_EXISTING_XPATH = <<XPATH
88
+ /module/component[@name='FunkyPlugin']
89
+ XPATH
90
+
91
+ IML_FROM_EXISTING_SHADOWING_TEMPLATE_XPATH = <<XPATH
92
+ /module/component[@name='FacetManager']/facet[@type = 'SCALA']
93
+ XPATH
94
+
95
+ IML_FROM_EXISTING_SHADOWING_GENERATED_XPATH = <<XPATH
96
+ /module/component[@name='NewModuleRootManager']/orderEntry[@module-name = 'buildr-bnd']
97
+ XPATH
98
+
99
+ IML_FROM_GENERATED_XPATH = <<XPATH
100
+ /module/component[@name='NewModuleRootManager']/orderEntry[@type = 'module-library']
101
+ XPATH
102
+
103
+ describe "iidea:generate" do
104
+
105
+ describe "with existing project files" do
106
+ before do
107
+ write "foo.ipr", IPR_EXISTING
108
+ write "foo.iml", IML_EXISTING
109
+ artifact('group:id:jar:1.0') { |t| write t.to_s }
110
+ @foo = define "foo" do
111
+ ipr.template = nil
112
+ iml.template = nil
113
+ compile.with 'group:id:jar:1.0'
114
+ end
115
+ invoke_generate_task
116
+ end
117
+
118
+ it "replaces ProjectModuleManager component in existing ipr file" do
119
+ xml_document(@foo._("foo.ipr")).should have_xpath(IPR_FROM_GENERATED_XPATH)
120
+ xml_document(@foo._("foo.ipr")).should_not have_xpath(IPR_FROM_EXISTING_SHADOWING_GENERATED_XPATH)
121
+ end
122
+
123
+ it "merges component in existing ipr file" do
124
+ xml_document(@foo._("foo.ipr")).should have_xpath(IPR_FROM_EXISTING_XPATH)
125
+ end
126
+
127
+ it "replaces NewModuleRootManager component in existing iml file" do
128
+ xml_document(@foo._("foo.iml")).should have_xpath(IML_FROM_GENERATED_XPATH)
129
+ xml_document(@foo._("foo.iml")).should_not have_xpath(IML_FROM_EXISTING_SHADOWING_GENERATED_XPATH)
130
+ end
131
+
132
+ it "merges component in existing iml file" do
133
+ xml_document(@foo._("foo.iml")).should have_xpath(IML_FROM_EXISTING_XPATH)
134
+ end
135
+ end
136
+
137
+ describe "with an iml template" do
138
+ before do
139
+ write IML_TEMPLATE_NAME, IML_TEMPLATE
140
+ artifact('group:id:jar:1.0') { |t| write t.to_s }
141
+ @foo = define "foo" do
142
+ ipr.template = nil
143
+ iml.template = IML_TEMPLATE_NAME
144
+ compile.with 'group:id:jar:1.0'
145
+ end
146
+ invoke_generate_task
147
+ end
148
+
149
+ it "replaces generated components" do
150
+ xml_document(@foo._("foo.iml")).should have_xpath(IML_FROM_GENERATED_XPATH)
151
+ end
152
+
153
+ it "merges component in iml template" do
154
+ xml_document(@foo._("foo.iml")).should have_xpath(IML_FROM_TEMPLATE_XPATH)
155
+ end
156
+ end
157
+
158
+ describe "with an iml template and existing iml" do
159
+ before do
160
+ write IML_TEMPLATE_NAME, IML_TEMPLATE
161
+ write "foo.iml", IML_EXISTING
162
+ artifact('group:id:jar:1.0') { |t| write t.to_s }
163
+ @foo = define "foo" do
164
+ ipr.template = nil
165
+ iml.template = IML_TEMPLATE_NAME
166
+ compile.with 'group:id:jar:1.0'
167
+ end
168
+ invoke_generate_task
169
+ end
170
+
171
+ it "replaces generated components" do
172
+ xml_document(@foo._("foo.iml")).should have_xpath(IML_FROM_GENERATED_XPATH)
173
+ end
174
+
175
+ it "merges component in iml template" do
176
+ xml_document(@foo._("foo.iml")).should have_xpath(IML_FROM_TEMPLATE_XPATH)
177
+ end
178
+
179
+ it "merges components not in iml template and not generated by task" do
180
+ xml_document(@foo._("foo.iml")).should have_xpath(IML_FROM_EXISTING_XPATH)
181
+ xml_document(@foo._("foo.iml")).should_not have_xpath(IML_FROM_EXISTING_SHADOWING_TEMPLATE_XPATH)
182
+ xml_document(@foo._("foo.iml")).should_not have_xpath(IML_FROM_EXISTING_SHADOWING_GENERATED_XPATH)
183
+ end
184
+ end
185
+
186
+ describe "with an ipr template" do
187
+ before do
188
+ write IPR_TEMPLATE_NAME, IPR_TEMPLATE
189
+ artifact('group:id:jar:1.0') { |t| write t.to_s }
190
+ @foo = define "foo" do
191
+ ipr.template = IPR_TEMPLATE_NAME
192
+ iml.template = nil
193
+ compile.with 'group:id:jar:1.0'
194
+ end
195
+ invoke_generate_task
196
+ end
197
+
198
+ it "replaces generated component in ipr template" do
199
+ xml_document(@foo._("foo.ipr")).should have_xpath(IPR_FROM_GENERATED_XPATH)
200
+ end
201
+
202
+ it "merges component in ipr template" do
203
+ xml_document(@foo._("foo.ipr")).should have_xpath(IPR_FROM_TEMPLATE_XPATH)
204
+ end
205
+ end
206
+
207
+ describe "with an ipr template and existing ipr" do
208
+ before do
209
+ write IPR_TEMPLATE_NAME, IPR_TEMPLATE
210
+ write "foo.ipr", IPR_EXISTING
211
+ artifact('group:id:jar:1.0') { |t| write t.to_s }
212
+ @foo = define "foo" do
213
+ ipr.template = IPR_TEMPLATE_NAME
214
+ iml.template = nil
215
+ compile.with 'group:id:jar:1.0'
216
+ end
217
+ invoke_generate_task
218
+ end
219
+
220
+ it "replaces generated component in ipr template" do
221
+ xml_document(@foo._("foo.ipr")).should have_xpath(IPR_FROM_GENERATED_XPATH)
222
+ end
223
+
224
+ it "merges component in ipr template" do
225
+ xml_document(@foo._("foo.ipr")).should have_xpath(IPR_FROM_TEMPLATE_XPATH)
226
+ end
227
+
228
+ it "merges components not in ipr template and not generated by task" do
229
+ xml_document(@foo._("foo.ipr")).should have_xpath(IPR_FROM_EXISTING_XPATH)
230
+ xml_document(@foo._("foo.ipr")).should_not have_xpath(IPR_FROM_EXISTING_SHADOWING_GENERATED_XPATH)
231
+ xml_document(@foo._("foo.ipr")).should_not have_xpath(IPR_FROM_EXISTING_SHADOWING_TEMPLATE_XPATH)
232
+ end
233
+ end
234
234
  end