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,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
- require "#{BUILDR_DIR}/spec/spec_helpers.rb"
30
-
31
- module SpecHelpers
32
- def invoke_generate_task
33
- task('iidea:generate').invoke
34
- end
35
-
36
- def invoke_clean_task
37
- task('iidea:clean').invoke
38
- end
39
-
40
- def root_project_filename(project)
41
- project._("#{project.name}#{Buildr::IntellijIdea::IdeaFile::DEFAULT_SUFFIX}.ipr")
42
- end
43
-
44
- def root_project_xml(project)
45
- xml_document(root_project_filename(project))
46
- end
47
-
48
- def root_module_filename(project)
49
- project._("#{project.name}#{Buildr::IntellijIdea::IdeaFile::DEFAULT_SUFFIX}.iml")
50
- end
51
-
52
- def root_module_xml(project)
53
- xml_document(root_module_filename(project))
54
- end
55
-
56
- def subproject_module_filename(project, sub_project_name)
57
- project._("#{sub_project_name}/#{sub_project_name}#{Buildr::IntellijIdea::IdeaFile::DEFAULT_SUFFIX}.iml")
58
- end
59
-
60
- def subproject_module_xml(project, sub_project_name)
61
- xml_document(subproject_module_filename(project, sub_project_name))
62
- end
63
-
64
- def xml_document(filename)
65
- File.should be_exist(filename)
66
- REXML::Document.new(File.read(filename))
67
- end
68
-
69
- def xpath_to_module
70
- "/project/component[@name='ProjectModuleManager']/modules/module"
71
- end
72
- end
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
@@ -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
9
- version: 0.0.9
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-08 00:00:00 +10:00
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/version.rb
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/idea_module.rb
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/spec.opts
49
- - spec/buildr/intellij_idea/inform_spec.rb
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/extra_modules_spec.rb
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.9
74
+ - buildr-iidea 0.0.10
76
75
  - --main
77
76
  - README.rdoc
78
77
  require_paths:
@@ -1 +0,0 @@
1
- --color