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.
- data/CHANGELOG +38 -33
- data/LICENSE +203 -203
- data/NOTICE +16 -16
- data/README.rdoc +328 -328
- data/Rakefile +42 -33
- data/buildr-iidea.gemspec +25 -25
- data/lib/buildr/intellij_idea/idea_file.rb +85 -85
- data/lib/buildr/intellij_idea/idea_module.rb +255 -263
- data/lib/buildr/intellij_idea/idea_project.rb +105 -105
- data/lib/buildr/intellij_idea/project_extension.rb +108 -108
- data/lib/buildr/intellij_idea/version.rb +10 -10
- data/lib/buildr_iidea.rb +6 -6
- data/spec/buildr/intellij_idea/clean_spec.rb +37 -37
- data/spec/buildr/intellij_idea/dependency_spec.rb +115 -115
- data/spec/buildr/intellij_idea/extra_modules_spec.rb +24 -24
- data/spec/buildr/intellij_idea/facet_generation_spec.rb +36 -36
- data/spec/buildr/intellij_idea/group_spec.rb +33 -33
- data/spec/buildr/intellij_idea/idea_file_generation_spec.rb +243 -243
- data/spec/buildr/intellij_idea/inform_spec.rb +28 -28
- data/spec/buildr/intellij_idea/initial_components_spec.rb +38 -38
- data/spec/buildr/intellij_idea/module_content_generation_spec.rb +96 -96
- data/spec/buildr/intellij_idea/module_defaults.rb +15 -15
- data/spec/buildr/intellij_idea/module_property_inheritance_spec.rb +27 -27
- data/spec/buildr/intellij_idea/project_extension_spec.rb +96 -96
- data/spec/buildr/intellij_idea/template_spec.rb +233 -233
- data/spec/spec_helper.rb +79 -72
- data/spec/xpath_matchers.rb +108 -108
- metadata +15 -16
- data/spec/spec.opts +0 -1
data/spec/spec_helper.rb
CHANGED
@@ -1,72 +1,79 @@
|
|
1
|
-
require 'spec'
|
2
|
-
require File.expand_path(File.dirname(__FILE__) + '/xpath_matchers.rb')
|
3
|
-
|
4
|
-
DEFAULT_BUILDR_DIR=File.expand_path(File.dirname(__FILE__) + '/../../buildr')
|
5
|
-
BUILDR_DIR =
|
6
|
-
begin
|
7
|
-
if ENV['BUILDR_DIR']
|
8
|
-
ENV['BUILDR_DIR']
|
9
|
-
elsif File.exist?(File.expand_path('../buildr_dir', __FILE__))
|
10
|
-
File.read(File.expand_path('../buildr_dir', __FILE__)).strip
|
11
|
-
else
|
12
|
-
DEFAULT_BUILDR_DIR
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
unless File.exist?("#{BUILDR_DIR}/buildr.gemspec")
|
17
|
-
raise "Unable to find buildr.gemspec in #{BUILDR_DIR == DEFAULT_BUILDR_DIR ? 'guessed' : 'specified'} $BUILDR_DIR (#{BUILDR_DIR})"
|
18
|
-
end
|
19
|
-
|
20
|
-
# hook into buildr's spec_helpers load process
|
21
|
-
module SandboxHook
|
22
|
-
def SandboxHook.included(spec_helpers)
|
23
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
24
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
25
|
-
require 'buildr_iidea'
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
1
|
+
require 'spec'
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/xpath_matchers.rb')
|
3
|
+
|
4
|
+
DEFAULT_BUILDR_DIR=File.expand_path(File.dirname(__FILE__) + '/../../buildr')
|
5
|
+
BUILDR_DIR =
|
6
|
+
begin
|
7
|
+
if ENV['BUILDR_DIR']
|
8
|
+
ENV['BUILDR_DIR']
|
9
|
+
elsif File.exist?(File.expand_path('../buildr_dir', __FILE__))
|
10
|
+
File.read(File.expand_path('../buildr_dir', __FILE__)).strip
|
11
|
+
else
|
12
|
+
DEFAULT_BUILDR_DIR
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
unless File.exist?("#{BUILDR_DIR}/buildr.gemspec")
|
17
|
+
raise "Unable to find buildr.gemspec in #{BUILDR_DIR == DEFAULT_BUILDR_DIR ? 'guessed' : 'specified'} $BUILDR_DIR (#{BUILDR_DIR})"
|
18
|
+
end
|
19
|
+
|
20
|
+
# hook into buildr's spec_helpers load process
|
21
|
+
module SandboxHook
|
22
|
+
def SandboxHook.included(spec_helpers)
|
23
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
24
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
25
|
+
require 'buildr_iidea'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
begin
|
30
|
+
require File.expand_path("#{BUILDR_DIR}/lib/buildr/version.rb")
|
31
|
+
require File.expand_path("#{BUILDR_DIR}/spec/spec_helpers.rb")
|
32
|
+
rescue Exception => e
|
33
|
+
$stderr.puts "Error initializing the build environment\n"
|
34
|
+
$stderr.puts "Cause: #{e.inspect}\n"
|
35
|
+
exit(22)
|
36
|
+
end
|
37
|
+
|
38
|
+
module SpecHelpers
|
39
|
+
def invoke_generate_task
|
40
|
+
task('iidea:generate').invoke
|
41
|
+
end
|
42
|
+
|
43
|
+
def invoke_clean_task
|
44
|
+
task('iidea:clean').invoke
|
45
|
+
end
|
46
|
+
|
47
|
+
def root_project_filename(project)
|
48
|
+
project._("#{project.name}#{Buildr::IntellijIdea::IdeaFile::DEFAULT_SUFFIX}.ipr")
|
49
|
+
end
|
50
|
+
|
51
|
+
def root_project_xml(project)
|
52
|
+
xml_document(root_project_filename(project))
|
53
|
+
end
|
54
|
+
|
55
|
+
def root_module_filename(project)
|
56
|
+
project._("#{project.name}#{Buildr::IntellijIdea::IdeaFile::DEFAULT_SUFFIX}.iml")
|
57
|
+
end
|
58
|
+
|
59
|
+
def root_module_xml(project)
|
60
|
+
xml_document(root_module_filename(project))
|
61
|
+
end
|
62
|
+
|
63
|
+
def subproject_module_filename(project, sub_project_name)
|
64
|
+
project._("#{sub_project_name}/#{sub_project_name}#{Buildr::IntellijIdea::IdeaFile::DEFAULT_SUFFIX}.iml")
|
65
|
+
end
|
66
|
+
|
67
|
+
def subproject_module_xml(project, sub_project_name)
|
68
|
+
xml_document(subproject_module_filename(project, sub_project_name))
|
69
|
+
end
|
70
|
+
|
71
|
+
def xml_document(filename)
|
72
|
+
File.should be_exist(filename)
|
73
|
+
REXML::Document.new(File.read(filename))
|
74
|
+
end
|
75
|
+
|
76
|
+
def xpath_to_module
|
77
|
+
"/project/component[@name='ProjectModuleManager']/modules/module"
|
78
|
+
end
|
79
|
+
end
|
data/spec/xpath_matchers.rb
CHANGED
@@ -1,109 +1,109 @@
|
|
1
|
-
# Note: That this helper has been derived from examples on the web and in particular
|
2
|
-
# the example at http://blog.wolfman.com/articles/2008/1/2/xpath-matchers-for-rspec
|
3
|
-
|
4
|
-
require 'rexml/document'
|
5
|
-
require 'rexml/element'
|
6
|
-
|
7
|
-
module Spec
|
8
|
-
module Matchers
|
9
|
-
|
10
|
-
# check if the xpath exists one or more times
|
11
|
-
class HaveXpath
|
12
|
-
def initialize(xpath)
|
13
|
-
@xpath = xpath
|
14
|
-
end
|
15
|
-
|
16
|
-
def matches?(response)
|
17
|
-
@response = response
|
18
|
-
doc = response.is_a?(REXML::Document) ? response : REXML::Document.new(@response)
|
19
|
-
match = REXML::XPath.match(doc, @xpath)
|
20
|
-
not match.empty?
|
21
|
-
end
|
22
|
-
|
23
|
-
def failure_message
|
24
|
-
"Did not find expected xpath #{@xpath}"
|
25
|
-
end
|
26
|
-
|
27
|
-
def negative_failure_message
|
28
|
-
"Did find unexpected xpath #{@xpath}"
|
29
|
-
end
|
30
|
-
|
31
|
-
def description
|
32
|
-
"match the xpath expression #{@xpath}"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def have_xpath(xpath)
|
37
|
-
HaveXpath.new(xpath)
|
38
|
-
end
|
39
|
-
|
40
|
-
# check if the xpath has the specified value
|
41
|
-
# value is a string and there must be a single result to match its
|
42
|
-
# equality against
|
43
|
-
class MatchXpath
|
44
|
-
def initialize(xpath, val)
|
45
|
-
@xpath = xpath
|
46
|
-
@val= val
|
47
|
-
end
|
48
|
-
|
49
|
-
def matches?(response)
|
50
|
-
@response = response
|
51
|
-
doc = response.is_a?(REXML::Document) ? response : REXML::Document.new(@response)
|
52
|
-
ok = true
|
53
|
-
REXML::XPath.each(doc, @xpath) do |e|
|
54
|
-
@actual_val = case e
|
55
|
-
when REXML::Attribute
|
56
|
-
e.to_s
|
57
|
-
when REXML::Element
|
58
|
-
e.text
|
59
|
-
else
|
60
|
-
e.to_s
|
61
|
-
end
|
62
|
-
return false unless @val == @actual_val
|
63
|
-
end
|
64
|
-
return ok
|
65
|
-
end
|
66
|
-
|
67
|
-
def failure_message
|
68
|
-
"The xpath #{@xpath} did not have the value '#{@val}' It was '#{@actual_val}'"
|
69
|
-
end
|
70
|
-
|
71
|
-
def description
|
72
|
-
"match the xpath expression #{@xpath} with #{@val}"
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def match_xpath(xpath, val)
|
77
|
-
MatchXpath.new(xpath, val)
|
78
|
-
end
|
79
|
-
|
80
|
-
# checks if the given xpath occurs num times
|
81
|
-
class HaveNodes #:nodoc:
|
82
|
-
def initialize(xpath, num)
|
83
|
-
@xpath= xpath
|
84
|
-
@num = num
|
85
|
-
end
|
86
|
-
|
87
|
-
def matches?(response)
|
88
|
-
@response = response
|
89
|
-
doc = response.is_a?(REXML::Document) ? response : REXML::Document.new(@response)
|
90
|
-
match = REXML::XPath.match(doc, @xpath)
|
91
|
-
@num_found= match.size
|
92
|
-
@num_found == @num
|
93
|
-
end
|
94
|
-
|
95
|
-
def failure_message
|
96
|
-
"Did not find expected number of nodes #{@num} in xpath #{@xpath} Found #{@num_found}"
|
97
|
-
end
|
98
|
-
|
99
|
-
def description
|
100
|
-
"match the number of nodes #{@num}"
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
def have_nodes(xpath, num)
|
105
|
-
HaveNodes.new(xpath, num)
|
106
|
-
end
|
107
|
-
|
108
|
-
end
|
1
|
+
# Note: That this helper has been derived from examples on the web and in particular
|
2
|
+
# the example at http://blog.wolfman.com/articles/2008/1/2/xpath-matchers-for-rspec
|
3
|
+
|
4
|
+
require 'rexml/document'
|
5
|
+
require 'rexml/element'
|
6
|
+
|
7
|
+
module Spec
|
8
|
+
module Matchers
|
9
|
+
|
10
|
+
# check if the xpath exists one or more times
|
11
|
+
class HaveXpath
|
12
|
+
def initialize(xpath)
|
13
|
+
@xpath = xpath
|
14
|
+
end
|
15
|
+
|
16
|
+
def matches?(response)
|
17
|
+
@response = response
|
18
|
+
doc = response.is_a?(REXML::Document) ? response : REXML::Document.new(@response)
|
19
|
+
match = REXML::XPath.match(doc, @xpath)
|
20
|
+
not match.empty?
|
21
|
+
end
|
22
|
+
|
23
|
+
def failure_message
|
24
|
+
"Did not find expected xpath #{@xpath}"
|
25
|
+
end
|
26
|
+
|
27
|
+
def negative_failure_message
|
28
|
+
"Did find unexpected xpath #{@xpath}"
|
29
|
+
end
|
30
|
+
|
31
|
+
def description
|
32
|
+
"match the xpath expression #{@xpath}"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def have_xpath(xpath)
|
37
|
+
HaveXpath.new(xpath)
|
38
|
+
end
|
39
|
+
|
40
|
+
# check if the xpath has the specified value
|
41
|
+
# value is a string and there must be a single result to match its
|
42
|
+
# equality against
|
43
|
+
class MatchXpath
|
44
|
+
def initialize(xpath, val)
|
45
|
+
@xpath = xpath
|
46
|
+
@val= val
|
47
|
+
end
|
48
|
+
|
49
|
+
def matches?(response)
|
50
|
+
@response = response
|
51
|
+
doc = response.is_a?(REXML::Document) ? response : REXML::Document.new(@response)
|
52
|
+
ok = true
|
53
|
+
REXML::XPath.each(doc, @xpath) do |e|
|
54
|
+
@actual_val = case e
|
55
|
+
when REXML::Attribute
|
56
|
+
e.to_s
|
57
|
+
when REXML::Element
|
58
|
+
e.text
|
59
|
+
else
|
60
|
+
e.to_s
|
61
|
+
end
|
62
|
+
return false unless @val == @actual_val
|
63
|
+
end
|
64
|
+
return ok
|
65
|
+
end
|
66
|
+
|
67
|
+
def failure_message
|
68
|
+
"The xpath #{@xpath} did not have the value '#{@val}' It was '#{@actual_val}'"
|
69
|
+
end
|
70
|
+
|
71
|
+
def description
|
72
|
+
"match the xpath expression #{@xpath} with #{@val}"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def match_xpath(xpath, val)
|
77
|
+
MatchXpath.new(xpath, val)
|
78
|
+
end
|
79
|
+
|
80
|
+
# checks if the given xpath occurs num times
|
81
|
+
class HaveNodes #:nodoc:
|
82
|
+
def initialize(xpath, num)
|
83
|
+
@xpath= xpath
|
84
|
+
@num = num
|
85
|
+
end
|
86
|
+
|
87
|
+
def matches?(response)
|
88
|
+
@response = response
|
89
|
+
doc = response.is_a?(REXML::Document) ? response : REXML::Document.new(@response)
|
90
|
+
match = REXML::XPath.match(doc, @xpath)
|
91
|
+
@num_found= match.size
|
92
|
+
@num_found == @num
|
93
|
+
end
|
94
|
+
|
95
|
+
def failure_message
|
96
|
+
"Did not find expected number of nodes #{@num} in xpath #{@xpath} Found #{@num_found}"
|
97
|
+
end
|
98
|
+
|
99
|
+
def description
|
100
|
+
"match the number of nodes #{@num}"
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def have_nodes(xpath, num)
|
105
|
+
HaveNodes.new(xpath, num)
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
109
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 10
|
9
|
+
version: 0.0.10
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Rhett Sutphin
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-09
|
18
|
+
date: 2010-10-09 00:00:00 +11:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -38,26 +38,25 @@ extra_rdoc_files:
|
|
38
38
|
- CHANGELOG
|
39
39
|
files:
|
40
40
|
- lib/buildr_iidea.rb
|
41
|
-
- lib/buildr/intellij_idea/
|
41
|
+
- lib/buildr/intellij_idea/idea_file.rb
|
42
|
+
- lib/buildr/intellij_idea/idea_module.rb
|
42
43
|
- lib/buildr/intellij_idea/idea_project.rb
|
43
44
|
- lib/buildr/intellij_idea/project_extension.rb
|
44
|
-
- lib/buildr/intellij_idea/
|
45
|
-
- lib/buildr/intellij_idea/idea_file.rb
|
45
|
+
- lib/buildr/intellij_idea/version.rb
|
46
46
|
- spec/spec_helper.rb
|
47
47
|
- spec/xpath_matchers.rb
|
48
|
-
- spec/
|
49
|
-
- spec/buildr/intellij_idea/
|
48
|
+
- spec/buildr/intellij_idea/clean_spec.rb
|
49
|
+
- spec/buildr/intellij_idea/dependency_spec.rb
|
50
|
+
- spec/buildr/intellij_idea/extra_modules_spec.rb
|
50
51
|
- spec/buildr/intellij_idea/facet_generation_spec.rb
|
51
|
-
- spec/buildr/intellij_idea/project_extension_spec.rb
|
52
|
-
- spec/buildr/intellij_idea/module_property_inheritance_spec.rb
|
53
|
-
- spec/buildr/intellij_idea/idea_file_generation_spec.rb
|
54
|
-
- spec/buildr/intellij_idea/module_defaults.rb
|
55
52
|
- spec/buildr/intellij_idea/group_spec.rb
|
56
|
-
- spec/buildr/intellij_idea/
|
53
|
+
- spec/buildr/intellij_idea/idea_file_generation_spec.rb
|
54
|
+
- spec/buildr/intellij_idea/inform_spec.rb
|
57
55
|
- spec/buildr/intellij_idea/initial_components_spec.rb
|
58
|
-
- spec/buildr/intellij_idea/clean_spec.rb
|
59
|
-
- spec/buildr/intellij_idea/dependency_spec.rb
|
60
56
|
- spec/buildr/intellij_idea/module_content_generation_spec.rb
|
57
|
+
- spec/buildr/intellij_idea/module_defaults.rb
|
58
|
+
- spec/buildr/intellij_idea/module_property_inheritance_spec.rb
|
59
|
+
- spec/buildr/intellij_idea/project_extension_spec.rb
|
61
60
|
- spec/buildr/intellij_idea/template_spec.rb
|
62
61
|
- buildr-iidea.gemspec
|
63
62
|
- LICENSE
|
@@ -72,7 +71,7 @@ licenses: []
|
|
72
71
|
post_install_message: Thanks for installing the Intellij IDEA extension for Buildr
|
73
72
|
rdoc_options:
|
74
73
|
- --title
|
75
|
-
- buildr-iidea 0.0.
|
74
|
+
- buildr-iidea 0.0.10
|
76
75
|
- --main
|
77
76
|
- README.rdoc
|
78
77
|
require_paths:
|
data/spec/spec.opts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color
|