go_figure 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -2,3 +2,5 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  pkg/*
5
+ TAGS
6
+ coverage
@@ -19,6 +19,6 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
 
21
21
  # specify any dependencies here; for example:
22
- # s.add_development_dependency "rspec"
22
+ s.add_development_dependency "simplecov"
23
23
  s.add_runtime_dependency "nokogiri", "~> 1.5.0"
24
24
  end
@@ -7,6 +7,12 @@
7
7
  <jobs>
8
8
  <job name="Test">
9
9
  <tasks>
10
+ <exec command="/bin/ln">
11
+ <arg>-sf</arg>
12
+ <arg>/etc/go_saas/database.yml</arg>
13
+ <arg>config/database.yml</arg>
14
+ <runif status="passed" />
15
+ </exec>
10
16
  <exec command="bundle">
11
17
  <arg>install</arg>
12
18
  <arg>--local</arg>
@@ -21,11 +27,22 @@
21
27
  <arg>db:migrate</arg>
22
28
  <runif status="passed" />
23
29
  </exec>
30
+ <% if @params[:test_unit] %>
31
+ <exec command="bundle">
32
+ <arg>exec</arg>
33
+ <arg>rake</arg>
34
+ <arg>test</arg>
35
+ <runif status="passed" />
36
+ </exec>
37
+ <%end%>
38
+ <% if @params[:rspec] %>
24
39
  <exec command="bundle">
25
40
  <arg>exec</arg>
26
41
  <arg>rake</arg>
42
+ <arg>spec</arg>
27
43
  <runif status="passed" />
28
44
  </exec>
45
+ <%end%>
29
46
  </tasks>
30
47
  </job>
31
48
  </jobs>
@@ -10,6 +10,7 @@ module GoFigure
10
10
  @original_md5 = options[:md5]
11
11
  @original_xml = options[:xml]
12
12
  @doc = Nokogiri.XML(@original_xml, nil, 'utf-8')
13
+ @params = {}
13
14
  end
14
15
 
15
16
  def set_pipeline(git_url, working_dir)
@@ -36,17 +37,26 @@ module GoFigure
36
37
 
37
38
  def pipeline_template(git_url, working_dir)
38
39
  template = ERB.new(File.read(File.expand_path('../../go-pipelines.xml.erb', __FILE__)))
39
- template.result(PipelineConfig.new(git_url, working_dir).get_binding)
40
+ template.result(PipelineConfig.new(git_url, working_dir, @params).get_binding)
40
41
  end
41
42
 
42
43
  def xml_content
43
44
  @doc.to_s
44
45
  end
45
46
 
47
+ def set_rspec
48
+ @params[:rspec] = true
49
+ end
50
+
51
+ def set_test_unit
52
+ @params[:test_unit] = true
53
+ end
54
+
46
55
  class PipelineConfig
47
- def initialize(git_url, working_dir)
56
+ def initialize(git_url, working_dir, params)
48
57
  @git_url = git_url
49
58
  @working_dir = working_dir
59
+ @params = params
50
60
  end
51
61
 
52
62
  def get_binding
@@ -1,3 +1,3 @@
1
1
  module GoFigure
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -43,12 +43,63 @@ module GoFigure
43
43
  }
44
44
  end
45
45
 
46
+ def test_should_set_the_rspec_pipeline_if_configured
47
+ xml = %Q{<?xml version="1.0" encoding="utf-8"?>
48
+ <cruise />
49
+ }
50
+
51
+ config = GoConfig.new(:xml => xml)
52
+ config.set_rspec
53
+ config.set_pipeline('http://git.example.com/my_project/atlas.git', 'atlas_rails')
54
+ assert config.xml_content =~ /<arg>rake<\/arg>.\s*<arg>spec<\/arg>/m
55
+ end
56
+
57
+ def test_should_not_set_the_rspec_pipeline_if_not_configured
58
+ xml = %Q{<?xml version="1.0" encoding="utf-8"?>
59
+ <cruise />
60
+ }
61
+
62
+ config = GoConfig.new(:xml => xml)
63
+ config.set_pipeline('http://git.example.com/my_project/atlas.git', 'atlas_rails')
64
+ assert config.xml_content !~ /<arg>rake<\/arg>.\s*<arg>spec<\/arg>/m
65
+ end
66
+
67
+ def test_should_set_the_test_unit_pipeline_if_configured
68
+ xml = %Q{<?xml version="1.0" encoding="utf-8"?>
69
+ <cruise />
70
+ }
71
+
72
+ config = GoConfig.new(:xml => xml)
73
+ config.set_test_unit
74
+ config.set_pipeline('http://git.example.com/my_project/atlas.git', 'atlas_rails')
75
+ assert config.xml_content =~ /<arg>rake<\/arg>.\s*<arg>test<\/arg>/m
76
+ end
77
+
78
+ def test_should_not_set_the_test_unit_pipeline_if_not_configured
79
+ xml = %Q{<?xml version="1.0" encoding="utf-8"?>
80
+ <cruise />
81
+ }
82
+
83
+ config = GoConfig.new(:xml => xml)
84
+ config.set_pipeline('http://git.example.com/my_project/atlas.git', 'atlas_rails')
85
+ assert config.xml_content !~ /<arg>rake<\/arg>.\s*<arg>test<\/arg>/m
86
+ end
87
+
88
+ def test_should_link_the_db_yml_to_a_controlled_db_yml
89
+ xml = %Q{<?xml version="1.0" encoding="utf-8"?>
90
+ <cruise />
91
+ }
92
+
93
+ config = GoConfig.new(:xml => xml)
94
+ config.set_pipeline('http://git.example.com/my_project/atlas.git', 'atlas_rails')
95
+ assert config.xml_content =~ /<exec command="\/bin\/ln">.\s*<arg>-sf<\/arg>.\s*<arg>\/etc\/go_saas\/database.yml<\/arg>.\s*<arg>config\/database.yml<\/arg>/m
96
+ end
46
97
 
47
98
  def assert_pipeline_template(xml)
48
99
  config = GoConfig.new(:xml => xml)
49
100
  config.set_pipeline('http://git.example.com/my_project/atlas.git', 'atlas_rails')
50
101
  assert config.xml_content =~ %r{<pipelines group="defaultGroup">}
51
- assert config.xml_content =~ %r{<git url="http://git.example.com/my_project/atlas.git"/>}
102
+ assert config.xml_content =~ %r{<git autoUpdate="false" url="http://git.example.com/my_project/atlas.git"/>}
52
103
  end
53
104
 
54
105
  end
@@ -1,3 +1,8 @@
1
+ require 'simplecov'
2
+ SimpleCov.start do
3
+ add_filter "/bundle/"
4
+ end
5
+
1
6
  require 'test/unit'
2
7
  require 'go_figure/test'
3
8
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: go_figure
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,24 +11,30 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-04-10 00:00:00.000000000 Z
14
+ date: 2012-04-20 00:00:00.000000000Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
- name: nokogiri
18
- requirement: !ruby/object:Gem::Requirement
17
+ name: simplecov
18
+ requirement: &70324008555740 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
- - - ~>
21
+ - - ! '>='
22
22
  - !ruby/object:Gem::Version
23
- version: 1.5.0
24
- type: :runtime
23
+ version: '0'
24
+ type: :development
25
25
  prerelease: false
26
- version_requirements: !ruby/object:Gem::Requirement
26
+ version_requirements: *70324008555740
27
+ - !ruby/object:Gem::Dependency
28
+ name: nokogiri
29
+ requirement: &70324008555240 !ruby/object:Gem::Requirement
27
30
  none: false
28
31
  requirements:
29
32
  - - ~>
30
33
  - !ruby/object:Gem::Version
31
34
  version: 1.5.0
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: *70324008555240
32
38
  description: This provides a ruby DSL to create a configuration file for the go server
33
39
  (thoughtworks-studios.com/go)
34
40
  email:
@@ -76,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
82
  version: '0'
77
83
  requirements: []
78
84
  rubyforge_project: go_figure
79
- rubygems_version: 1.8.21
85
+ rubygems_version: 1.8.15
80
86
  signing_key:
81
87
  specification_version: 3
82
88
  summary: A Ruby DSL to write a configuration file for the a go server.
@@ -85,4 +91,3 @@ test_files:
85
91
  - test/go_figure/go_config_endpoint_test.rb
86
92
  - test/go_figure/go_config_test.rb
87
93
  - test/test_helper.rb
88
- has_rdoc: