buildr-iidea 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,38 +1,38 @@
1
- require File.expand_path('../../../spec_helper', __FILE__)
2
-
3
- describe "iidea:clean" do
4
- before do
5
- write "foo.ipr"
6
- write "foo.iml"
7
- write "other.ipr"
8
- write "other.iml"
9
- mkdir_p 'bar'
10
- write "bar/bar.iml"
11
- write "bar/other.ipr"
12
- write "bar/other.iml"
13
-
14
- @foo = define "foo" do
15
- define "bar"
16
- end
17
- invoke_clean_task
18
- end
19
-
20
- it "should remove the ipr file" do
21
- File.exists?("foo.ipr").should be_false
22
- end
23
-
24
- it "should remove the project iml file" do
25
- File.exists?("foo.iml").should be_false
26
- end
27
-
28
- it "should remove the subproject iml file" do
29
- File.exists?("foo.iml").should be_false
30
- end
31
-
32
- it "should not remove other iml and ipr files" do
33
- File.exists?("other.ipr").should be_true
34
- File.exists?("other.iml").should be_true
35
- File.exists?("bar/other.ipr").should be_true
36
- File.exists?("bar/other.iml").should be_true
37
- end
1
+ require File.expand_path('../../../spec_helper', __FILE__)
2
+
3
+ describe "iidea:clean" do
4
+ before do
5
+ write "foo.ipr"
6
+ write "foo.iml"
7
+ write "other.ipr"
8
+ write "other.iml"
9
+ mkdir_p 'bar'
10
+ write "bar/bar.iml"
11
+ write "bar/other.ipr"
12
+ write "bar/other.iml"
13
+
14
+ @foo = define "foo" do
15
+ define "bar"
16
+ end
17
+ invoke_clean_task
18
+ end
19
+
20
+ it "should remove the ipr file" do
21
+ File.exists?("foo.ipr").should be_false
22
+ end
23
+
24
+ it "should remove the project iml file" do
25
+ File.exists?("foo.iml").should be_false
26
+ end
27
+
28
+ it "should remove the subproject iml file" do
29
+ File.exists?("foo.iml").should be_false
30
+ end
31
+
32
+ it "should not remove other iml and ipr files" do
33
+ File.exists?("other.ipr").should be_true
34
+ File.exists?("other.iml").should be_true
35
+ File.exists?("bar/other.ipr").should be_true
36
+ File.exists?("bar/other.iml").should be_true
37
+ end
38
38
  end
@@ -1,116 +1,116 @@
1
- require File.expand_path('../../../spec_helper', __FILE__)
2
-
3
- ORDER_ENTRY_XPATH = "/module/component[@name='NewModuleRootManager']/orderEntry"
4
- DEPENDENCY_NAME = 'group:id:jar:1.0'
5
- DEPENDENCY_SOURCES_NAME = 'group:id:jar:sources:1.0'
6
- DEPENDENCY2_NAME = 'group:id2:jar:1.0'
7
-
8
- describe "iidea:generate" do
9
-
10
- describe "with a single dependency" do
11
- before do
12
- @artifact = artifact(DEPENDENCY_NAME) { |t| write t.to_s }
13
- end
14
-
15
- describe "of type compile" do
16
- before do
17
- @foo = define "foo" do
18
- compile.with DEPENDENCY_NAME
19
- end
20
- invoke_generate_task
21
- end
22
-
23
- it "generates one exported 'module-library' orderEntry in IML" do
24
- root_module_xml(@foo).should have_nodes("#{ORDER_ENTRY_XPATH}[@type='module-library', @exported='']/library/CLASSES/root", 1)
25
- end
26
- end
27
-
28
- describe "of type test" do
29
- before do
30
- @foo = define "foo" do
31
- test.with DEPENDENCY_NAME
32
- end
33
- invoke_generate_task
34
- end
35
-
36
- it "generates one non-exported 'module-library' orderEntry in IML" do
37
- root_module_xml(@foo).should have_nodes("#{ORDER_ENTRY_XPATH}[@type='module-library' and @exported]/library/CLASSES/root", 0)
38
- root_module_xml(@foo).should have_nodes("#{ORDER_ENTRY_XPATH}[@type='module-library']/library/CLASSES/root", 1)
39
- end
40
- end
41
-
42
- describe "with sources artifact present" do
43
- before do
44
- artifact(DEPENDENCY_SOURCES_NAME) { |t| write t.to_s }
45
- @foo = define "foo" do
46
- compile.with DEPENDENCY_NAME
47
- end
48
- invoke_generate_task
49
- end
50
-
51
- it "generates 'module-library' orderEntry in IML with SOURCES specified" do
52
- root_module_xml(@foo).should have_nodes("#{ORDER_ENTRY_XPATH}[@type='module-library', @exported='']/library/SOURCES/root", 1)
53
- end
54
- end
55
-
56
- describe "with local_repository_env_override set to nil" do
57
- before do
58
- @foo = define "foo" do
59
- iml.local_repository_env_override = nil
60
- compile.with DEPENDENCY_NAME
61
- end
62
- invoke_generate_task
63
- end
64
-
65
- it "generates orderEntry with absolute path for classes jar" do
66
- root_module_xml(@foo).should match_xpath("#{ORDER_ENTRY_XPATH}/library/CLASSES/root/@url",
67
- "jar://$MODULE_DIR$/home/.m2/repository/group/id/1.0/id-1.0.jar!/")
68
- end
69
- end
70
- describe "with local_repository_env_override set to MAVEN_REPOSITORY" do
71
- before do
72
- @foo = define "foo" do
73
- iml.local_repository_env_override = 'MAVEN_REPOSITORY'
74
- compile.with DEPENDENCY_NAME
75
- end
76
- invoke_generate_task
77
- end
78
-
79
- it "generates orderEntry with absolute path for classes jar" do
80
- root_module_xml(@foo).should match_xpath("#{ORDER_ENTRY_XPATH}/library/CLASSES/root/@url",
81
- "jar://$MAVEN_REPOSITORY$/group/id/1.0/id-1.0.jar!/")
82
- end
83
- end
84
- end
85
-
86
- describe "with multiple dependencies" do
87
- before do
88
- @artifact1 = artifact(DEPENDENCY_NAME) { |t| write t.to_s }
89
- @artifact2 = artifact(DEPENDENCY2_NAME) { |t| write t.to_s }
90
- @foo = define "foo" do
91
- compile.with DEPENDENCY_NAME, DEPENDENCY2_NAME
92
- end
93
- invoke_generate_task
94
- end
95
-
96
- it "generates multiple 'module-library' orderEntry in IML" do
97
- root_module_xml(@foo).should have_nodes("#{ORDER_ENTRY_XPATH}[@type='module-library']", 2)
98
- end
99
- end
100
-
101
- describe "with a single non artifact dependency" do
102
- before do
103
- @foo = define "foo" do
104
- filename = _("foo-dep.jar")
105
- File.open(filename,"w") { |t| write t.to_s }
106
- compile.with filename
107
- end
108
- invoke_generate_task
109
- end
110
-
111
- it "generates one exported 'module-library' orderEntry in IML" do
112
- root_module_xml(@foo).should match_xpath("#{ORDER_ENTRY_XPATH}/library/CLASSES/root/@url",
113
- "jar://$MODULE_DIR$/foo-dep.jar!/")
114
- end
115
- end
1
+ require File.expand_path('../../../spec_helper', __FILE__)
2
+
3
+ ORDER_ENTRY_XPATH = "/module/component[@name='NewModuleRootManager']/orderEntry"
4
+ DEPENDENCY_NAME = 'group:id:jar:1.0'
5
+ DEPENDENCY_SOURCES_NAME = 'group:id:jar:sources:1.0'
6
+ DEPENDENCY2_NAME = 'group:id2:jar:1.0'
7
+
8
+ describe "iidea:generate" do
9
+
10
+ describe "with a single dependency" do
11
+ before do
12
+ @artifact = artifact(DEPENDENCY_NAME) { |t| write t.to_s }
13
+ end
14
+
15
+ describe "of type compile" do
16
+ before do
17
+ @foo = define "foo" do
18
+ compile.with DEPENDENCY_NAME
19
+ end
20
+ invoke_generate_task
21
+ end
22
+
23
+ it "generates one exported 'module-library' orderEntry in IML" do
24
+ root_module_xml(@foo).should have_nodes("#{ORDER_ENTRY_XPATH}[@type='module-library', @exported='']/library/CLASSES/root", 1)
25
+ end
26
+ end
27
+
28
+ describe "of type test" do
29
+ before do
30
+ @foo = define "foo" do
31
+ test.with DEPENDENCY_NAME
32
+ end
33
+ invoke_generate_task
34
+ end
35
+
36
+ it "generates one non-exported 'module-library' orderEntry in IML" do
37
+ root_module_xml(@foo).should have_nodes("#{ORDER_ENTRY_XPATH}[@type='module-library' and @exported]/library/CLASSES/root", 0)
38
+ root_module_xml(@foo).should have_nodes("#{ORDER_ENTRY_XPATH}[@type='module-library']/library/CLASSES/root", 1)
39
+ end
40
+ end
41
+
42
+ describe "with sources artifact present" do
43
+ before do
44
+ artifact(DEPENDENCY_SOURCES_NAME) { |t| write t.to_s }
45
+ @foo = define "foo" do
46
+ compile.with DEPENDENCY_NAME
47
+ end
48
+ invoke_generate_task
49
+ end
50
+
51
+ it "generates 'module-library' orderEntry in IML with SOURCES specified" do
52
+ root_module_xml(@foo).should have_nodes("#{ORDER_ENTRY_XPATH}[@type='module-library', @exported='']/library/SOURCES/root", 1)
53
+ end
54
+ end
55
+
56
+ describe "with local_repository_env_override set to nil" do
57
+ before do
58
+ @foo = define "foo" do
59
+ iml.local_repository_env_override = nil
60
+ compile.with DEPENDENCY_NAME
61
+ end
62
+ invoke_generate_task
63
+ end
64
+
65
+ it "generates orderEntry with absolute path for classes jar" do
66
+ root_module_xml(@foo).should match_xpath("#{ORDER_ENTRY_XPATH}/library/CLASSES/root/@url",
67
+ "jar://$MODULE_DIR$/home/.m2/repository/group/id/1.0/id-1.0.jar!/")
68
+ end
69
+ end
70
+ describe "with local_repository_env_override set to MAVEN_REPOSITORY" do
71
+ before do
72
+ @foo = define "foo" do
73
+ iml.local_repository_env_override = 'MAVEN_REPOSITORY'
74
+ compile.with DEPENDENCY_NAME
75
+ end
76
+ invoke_generate_task
77
+ end
78
+
79
+ it "generates orderEntry with absolute path for classes jar" do
80
+ root_module_xml(@foo).should match_xpath("#{ORDER_ENTRY_XPATH}/library/CLASSES/root/@url",
81
+ "jar://$MAVEN_REPOSITORY$/group/id/1.0/id-1.0.jar!/")
82
+ end
83
+ end
84
+ end
85
+
86
+ describe "with multiple dependencies" do
87
+ before do
88
+ @artifact1 = artifact(DEPENDENCY_NAME) { |t| write t.to_s }
89
+ @artifact2 = artifact(DEPENDENCY2_NAME) { |t| write t.to_s }
90
+ @foo = define "foo" do
91
+ compile.with DEPENDENCY_NAME, DEPENDENCY2_NAME
92
+ end
93
+ invoke_generate_task
94
+ end
95
+
96
+ it "generates multiple 'module-library' orderEntry in IML" do
97
+ root_module_xml(@foo).should have_nodes("#{ORDER_ENTRY_XPATH}[@type='module-library']", 2)
98
+ end
99
+ end
100
+
101
+ describe "with a single non artifact dependency" do
102
+ before do
103
+ @foo = define "foo" do
104
+ filename = _("foo-dep.jar")
105
+ File.open(filename,"wb") { |t| write "Hello" }
106
+ compile.with filename
107
+ end
108
+ invoke_generate_task
109
+ end
110
+
111
+ it "generates one exported 'module-library' orderEntry in IML" do
112
+ root_module_xml(@foo).should match_xpath("#{ORDER_ENTRY_XPATH}/library/CLASSES/root/@url",
113
+ "jar://$MODULE_DIR$/foo-dep.jar!/")
114
+ end
115
+ end
116
116
  end
@@ -1,24 +1,24 @@
1
- require File.expand_path('../../../spec_helper', __FILE__)
2
-
3
- describe "iidea:generate" do
4
- describe "with extra_modules specified" do
5
- before do
6
- @foo = define "foo" do
7
- ipr.extra_modules << 'other.iml'
8
- ipr.extra_modules << 'other_other.iml'
9
- end
10
- invoke_generate_task
11
- end
12
-
13
- it "generate an IPR with extra modules specified" do
14
- doc = xml_document(@foo._("foo.ipr"))
15
- doc.should have_nodes("#{xpath_to_module}", 3)
16
- module_ref = "$PROJECT_DIR$/foo.iml"
17
- doc.should have_xpath("#{xpath_to_module}[@fileurl='file://#{module_ref}', @filepath='#{module_ref}']")
18
- module_ref = "$PROJECT_DIR$/other.iml"
19
- doc.should have_xpath("#{xpath_to_module}[@fileurl='file://#{module_ref}', @filepath='#{module_ref}']")
20
- module_ref = "$PROJECT_DIR$/other_other.iml"
21
- doc.should have_xpath("#{xpath_to_module}[@fileurl='file://#{module_ref}', @filepath='#{module_ref}']")
22
- end
23
- end
24
- end
1
+ require File.expand_path('../../../spec_helper', __FILE__)
2
+
3
+ describe "iidea:generate" do
4
+ describe "with extra_modules specified" do
5
+ before do
6
+ @foo = define "foo" do
7
+ ipr.extra_modules << 'other.iml'
8
+ ipr.extra_modules << 'other_other.iml'
9
+ end
10
+ invoke_generate_task
11
+ end
12
+
13
+ it "generate an IPR with extra modules specified" do
14
+ doc = xml_document(@foo._("foo.ipr"))
15
+ doc.should have_nodes("#{xpath_to_module}", 3)
16
+ module_ref = "$PROJECT_DIR$/foo.iml"
17
+ doc.should have_xpath("#{xpath_to_module}[@fileurl='file://#{module_ref}', @filepath='#{module_ref}']")
18
+ module_ref = "$PROJECT_DIR$/other.iml"
19
+ doc.should have_xpath("#{xpath_to_module}[@fileurl='file://#{module_ref}', @filepath='#{module_ref}']")
20
+ module_ref = "$PROJECT_DIR$/other_other.iml"
21
+ doc.should have_xpath("#{xpath_to_module}[@fileurl='file://#{module_ref}', @filepath='#{module_ref}']")
22
+ end
23
+ end
24
+ end
@@ -1,36 +1,36 @@
1
- require File.expand_path('../../../spec_helper', __FILE__)
2
-
3
- FACET_XPATH = "/module/component[@name='FacetManager']/facet"
4
-
5
- describe "iidea:generate" do
6
- describe "with web and webservice facet added to root project" do
7
- before do
8
- @foo = define "foo" do
9
- iml.add_facet("Web", "web") do |facet|
10
- facet.configuration do |conf|
11
- conf.descriptors do |desc|
12
- desc.deploymentDescriptor :name => 'web.xml',
13
- :url => "file://$MODULE_DIR$/src/main/webapp/WEB-INF/web.xml",
14
- :optional => "false", :version => "2.4"
15
- end
16
- conf.webroots do |webroots|
17
- webroots.root :url => "file://$MODULE_DIR$/src/main/webapp", :relative => "/"
18
- end
19
- end
20
- end
21
- iml.add_facet("WebServices Client", "WebServicesClient") do |facet|
22
- facet.configuration "ws.engine" => "Glassfish / JAX-WS 2.X RI / Metro 1.X / JWSDP 2.0"
23
- end
24
- define 'bar'
25
- end
26
- invoke_generate_task
27
- end
28
-
29
- it "generates an IML for root project with a web and webservice facet" do
30
- doc = xml_document(@foo._("foo.iml"))
31
- doc.should have_nodes(FACET_XPATH, 2)
32
- doc.should have_xpath("#{FACET_XPATH}[@type='web', @name='Web']")
33
- doc.should have_xpath("#{FACET_XPATH}[@type='WebServicesClient', @name='WebServices Client']")
34
- end
35
- end
36
- end
1
+ require File.expand_path('../../../spec_helper', __FILE__)
2
+
3
+ FACET_XPATH = "/module/component[@name='FacetManager']/facet"
4
+
5
+ describe "iidea:generate" do
6
+ describe "with web and webservice facet added to root project" do
7
+ before do
8
+ @foo = define "foo" do
9
+ iml.add_facet("Web", "web") do |facet|
10
+ facet.configuration do |conf|
11
+ conf.descriptors do |desc|
12
+ desc.deploymentDescriptor :name => 'web.xml',
13
+ :url => "file://$MODULE_DIR$/src/main/webapp/WEB-INF/web.xml",
14
+ :optional => "false", :version => "2.4"
15
+ end
16
+ conf.webroots do |webroots|
17
+ webroots.root :url => "file://$MODULE_DIR$/src/main/webapp", :relative => "/"
18
+ end
19
+ end
20
+ end
21
+ iml.add_facet("WebServices Client", "WebServicesClient") do |facet|
22
+ facet.configuration "ws.engine" => "Glassfish / JAX-WS 2.X RI / Metro 1.X / JWSDP 2.0"
23
+ end
24
+ define 'bar'
25
+ end
26
+ invoke_generate_task
27
+ end
28
+
29
+ it "generates an IML for root project with a web and webservice facet" do
30
+ doc = xml_document(@foo._("foo.iml"))
31
+ doc.should have_nodes(FACET_XPATH, 2)
32
+ doc.should have_xpath("#{FACET_XPATH}[@type='web', @name='Web']")
33
+ doc.should have_xpath("#{FACET_XPATH}[@type='WebServicesClient', @name='WebServices Client']")
34
+ end
35
+ end
36
+ end
@@ -1,33 +1,33 @@
1
- require File.expand_path('../../../spec_helper', __FILE__)
2
-
3
- describe "iidea:generate" do
4
- describe "with iml.group specified" do
5
- before do
6
- @foo = define "foo" do
7
- iml.group = true
8
- define 'bar' do
9
- define 'baz' do
10
-
11
- end
12
- end
13
- define 'rab' do
14
- iml.group = "MyGroup"
15
- end
16
- end
17
- invoke_generate_task
18
- end
19
-
20
- it "generate an IPR with correct group references" do
21
- doc = xml_document(@foo._("foo.ipr"))
22
- doc.should have_nodes("#{xpath_to_module}", 4)
23
- module_ref = "$PROJECT_DIR$/foo.iml"
24
- doc.should have_xpath("#{xpath_to_module}[@fileurl='file://#{module_ref}', @filepath='#{module_ref}']")
25
- module_ref = "$PROJECT_DIR$/rab/rab.iml"
26
- doc.should have_xpath("#{xpath_to_module}[@fileurl='file://#{module_ref}', @filepath='#{module_ref}' @group = 'MyGroup']")
27
- module_ref = "$PROJECT_DIR$/bar/bar.iml"
28
- doc.should have_xpath("#{xpath_to_module}[@fileurl='file://#{module_ref}', @filepath='#{module_ref}' @group = 'foo']")
29
- module_ref = "$PROJECT_DIR$/bar/baz/baz.iml"
30
- doc.should have_xpath("#{xpath_to_module}[@fileurl='file://#{module_ref}', @filepath='#{module_ref}' @group = 'foo/bar']")
31
- end
32
- end
33
- end
1
+ require File.expand_path('../../../spec_helper', __FILE__)
2
+
3
+ describe "iidea:generate" do
4
+ describe "with iml.group specified" do
5
+ before do
6
+ @foo = define "foo" do
7
+ iml.group = true
8
+ define 'bar' do
9
+ define 'baz' do
10
+
11
+ end
12
+ end
13
+ define 'rab' do
14
+ iml.group = "MyGroup"
15
+ end
16
+ end
17
+ invoke_generate_task
18
+ end
19
+
20
+ it "generate an IPR with correct group references" do
21
+ doc = xml_document(@foo._("foo.ipr"))
22
+ doc.should have_nodes("#{xpath_to_module}", 4)
23
+ module_ref = "$PROJECT_DIR$/foo.iml"
24
+ doc.should have_xpath("#{xpath_to_module}[@fileurl='file://#{module_ref}', @filepath='#{module_ref}']")
25
+ module_ref = "$PROJECT_DIR$/rab/rab.iml"
26
+ doc.should have_xpath("#{xpath_to_module}[@fileurl='file://#{module_ref}', @filepath='#{module_ref}' @group = 'MyGroup']")
27
+ module_ref = "$PROJECT_DIR$/bar/bar.iml"
28
+ doc.should have_xpath("#{xpath_to_module}[@fileurl='file://#{module_ref}', @filepath='#{module_ref}' @group = 'foo']")
29
+ module_ref = "$PROJECT_DIR$/bar/baz/baz.iml"
30
+ doc.should have_xpath("#{xpath_to_module}[@fileurl='file://#{module_ref}', @filepath='#{module_ref}' @group = 'foo/bar']")
31
+ end
32
+ end
33
+ end