teamcity_ruby 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. data/.gitignore +17 -0
  2. data/.ruby-version +1 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +42 -0
  6. data/Rakefile +5 -0
  7. data/lib/teamcity_ruby/build_configuration.rb +86 -0
  8. data/lib/teamcity_ruby/element_builder.rb +27 -0
  9. data/lib/teamcity_ruby/project.rb +52 -0
  10. data/lib/teamcity_ruby/resource.rb +26 -0
  11. data/lib/teamcity_ruby/vcs_root.rb +49 -0
  12. data/lib/teamcity_ruby/version.rb +3 -0
  13. data/lib/teamcity_ruby.rb +28 -0
  14. data/spec/cassettes/TeamcityRuby_BuildConfiguration/a_existing_build_configuration/can_get_a_build_step_added_to_it.yml +331 -0
  15. data/spec/cassettes/TeamcityRuby_BuildConfiguration/a_existing_build_configuration/can_get_a_build_trigger_added_to_it.yml +298 -0
  16. data/spec/cassettes/TeamcityRuby_BuildConfiguration/a_existing_build_configuration/can_get_a_vcs_root_attached_with_specific_checkout_rules.yml +335 -0
  17. data/spec/cassettes/TeamcityRuby_BuildConfiguration/fetches_a_specific_build_configuration_by_id.yml +261 -0
  18. data/spec/cassettes/TeamcityRuby_BuildConfiguration/lists_all_build_configurations.yml +397 -0
  19. data/spec/cassettes/TeamcityRuby_Project/creates_a_project_copying_its_settings_from_a_source_project.yml +301 -0
  20. data/spec/cassettes/TeamcityRuby_Project/creates_a_project_with_a_parent_project.yml +154 -0
  21. data/spec/cassettes/TeamcityRuby_Project/destroys_a_specific_project.yml +223 -0
  22. data/spec/cassettes/TeamcityRuby_Project/fetches_a_specific_project_by_id_locator.yml +220 -0
  23. data/spec/cassettes/TeamcityRuby_Project/fetches_a_specific_project_by_name_locator.yml +187 -0
  24. data/spec/cassettes/TeamcityRuby_Project/lists_all_projects_including_root_built_in_on_TeamCity_.yml +224 -0
  25. data/spec/cassettes/TeamcityRuby_VcsRoot/lists_all_vcs_roots.yml +151 -0
  26. data/spec/spec_helper.rb +32 -0
  27. data/spec/teamcity_ruby/build_configuration_spec.rb +59 -0
  28. data/spec/teamcity_ruby/element_builder_spec.rb +29 -0
  29. data/spec/teamcity_ruby/project_spec.rb +59 -0
  30. data/spec/teamcity_ruby/vcs_root_spec.rb +21 -0
  31. data/teamcity_ruby.gemspec +31 -0
  32. metadata +242 -0
@@ -0,0 +1,59 @@
1
+ require 'spec_helper'
2
+
3
+ module TeamcityRuby
4
+ describe Project do
5
+ before do
6
+ delete_all_projects
7
+ end
8
+
9
+ it "lists all projects including root (built in on TeamCity)", :vcr do
10
+ project_names = ["Project 1", "Project 2"]
11
+ all_projects_including_root = ["<Root project>", project_names].flatten
12
+
13
+ project_names.each do |p|
14
+ Project.create(p)
15
+ end
16
+
17
+ Project.all.map(&:name).should == all_projects_including_root
18
+ end
19
+
20
+ it "fetches a specific project by id locator", :vcr do
21
+ project_name = "Petshop App"
22
+ project = Project.create(project_name)
23
+
24
+ Project.find(:id => project.teamcity_id).should == project
25
+ end
26
+
27
+ it "fetches a specific project by name locator", :vcr do
28
+ project_name = "Petshop App"
29
+ project = Project.create(project_name)
30
+
31
+ Project.find(:name => project_name).should == project
32
+ end
33
+
34
+ it "destroys a specific project", :vcr do
35
+ project = Project.create("Petshop App")
36
+
37
+ project.destroy!
38
+
39
+ Project.find(:id => project.teamcity_id).should be_nil
40
+ end
41
+
42
+ it "creates a project with a parent project", :vcr do
43
+ parent = Project.create("Petshop Group")
44
+
45
+ project = Project.create("Sample Project", :parent_id => parent.teamcity_id)
46
+
47
+ project.parent_id.should == parent.teamcity_id
48
+ end
49
+
50
+ it "creates a project copying its settings from a source project", :vcr do
51
+ base_project = Project.create("Base Project")
52
+ base_project.description = "Base Project Description"
53
+
54
+ project_copy = Project.create("Project Copy", :source_id => base_project.teamcity_id)
55
+
56
+ project_copy.description.should == "Base Project Description"
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ module TeamcityRuby
4
+ describe VcsRoot do
5
+ before do
6
+ delete_all_vcs_roots
7
+ end
8
+
9
+ it "lists all vcs roots", :vcr do
10
+ vcs_root_names = ["VCS Root 1", "VCS Root 2"]
11
+
12
+ vcs_root_names.each do |name|
13
+ VcsRoot.create(:name => name) do |vcs_root|
14
+ vcs_root['url'] = 'git@example.com/repo.git'
15
+ end
16
+ end
17
+
18
+ VcsRoot.all.map(&:name).should == vcs_root_names
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'teamcity_ruby/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "teamcity_ruby"
8
+ spec.version = TeamcityRuby::VERSION
9
+ spec.authors = ["Jefferson Girao"]
10
+ spec.email = ["me@jefferson.eti.br"]
11
+ spec.description = %q{TeamCity API Ruby Wrapper}
12
+ spec.summary = %q{TeamCity API Ruby Wrapper}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "httparty", "~> 0.11.0"
22
+ spec.add_dependency "json"
23
+ spec.add_dependency "hashie"
24
+
25
+ spec.add_development_dependency "pry"
26
+ spec.add_development_dependency "bundler", "~> 1.3"
27
+ spec.add_development_dependency "rspec"
28
+ spec.add_development_dependency "vcr"
29
+ spec.add_development_dependency "webmock"
30
+ spec.add_development_dependency "rake"
31
+ end
metadata ADDED
@@ -0,0 +1,242 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: teamcity_ruby
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Jefferson Girao
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2014-05-09 00:00:00 -04:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: httparty
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 51
30
+ segments:
31
+ - 0
32
+ - 11
33
+ - 0
34
+ version: 0.11.0
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: json
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 3
46
+ segments:
47
+ - 0
48
+ version: "0"
49
+ type: :runtime
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ name: hashie
53
+ prerelease: false
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 3
60
+ segments:
61
+ - 0
62
+ version: "0"
63
+ type: :runtime
64
+ version_requirements: *id003
65
+ - !ruby/object:Gem::Dependency
66
+ name: pry
67
+ prerelease: false
68
+ requirement: &id004 !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ version: "0"
77
+ type: :development
78
+ version_requirements: *id004
79
+ - !ruby/object:Gem::Dependency
80
+ name: bundler
81
+ prerelease: false
82
+ requirement: &id005 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ~>
86
+ - !ruby/object:Gem::Version
87
+ hash: 9
88
+ segments:
89
+ - 1
90
+ - 3
91
+ version: "1.3"
92
+ type: :development
93
+ version_requirements: *id005
94
+ - !ruby/object:Gem::Dependency
95
+ name: rspec
96
+ prerelease: false
97
+ requirement: &id006 !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ hash: 3
103
+ segments:
104
+ - 0
105
+ version: "0"
106
+ type: :development
107
+ version_requirements: *id006
108
+ - !ruby/object:Gem::Dependency
109
+ name: vcr
110
+ prerelease: false
111
+ requirement: &id007 !ruby/object:Gem::Requirement
112
+ none: false
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ hash: 3
117
+ segments:
118
+ - 0
119
+ version: "0"
120
+ type: :development
121
+ version_requirements: *id007
122
+ - !ruby/object:Gem::Dependency
123
+ name: webmock
124
+ prerelease: false
125
+ requirement: &id008 !ruby/object:Gem::Requirement
126
+ none: false
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ hash: 3
131
+ segments:
132
+ - 0
133
+ version: "0"
134
+ type: :development
135
+ version_requirements: *id008
136
+ - !ruby/object:Gem::Dependency
137
+ name: rake
138
+ prerelease: false
139
+ requirement: &id009 !ruby/object:Gem::Requirement
140
+ none: false
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ hash: 3
145
+ segments:
146
+ - 0
147
+ version: "0"
148
+ type: :development
149
+ version_requirements: *id009
150
+ description: TeamCity API Ruby Wrapper
151
+ email:
152
+ - me@jefferson.eti.br
153
+ executables: []
154
+
155
+ extensions: []
156
+
157
+ extra_rdoc_files: []
158
+
159
+ files:
160
+ - .gitignore
161
+ - .ruby-version
162
+ - Gemfile
163
+ - LICENSE.txt
164
+ - README.md
165
+ - Rakefile
166
+ - lib/teamcity_ruby.rb
167
+ - lib/teamcity_ruby/build_configuration.rb
168
+ - lib/teamcity_ruby/element_builder.rb
169
+ - lib/teamcity_ruby/project.rb
170
+ - lib/teamcity_ruby/resource.rb
171
+ - lib/teamcity_ruby/vcs_root.rb
172
+ - lib/teamcity_ruby/version.rb
173
+ - spec/cassettes/TeamcityRuby_BuildConfiguration/a_existing_build_configuration/can_get_a_build_step_added_to_it.yml
174
+ - spec/cassettes/TeamcityRuby_BuildConfiguration/a_existing_build_configuration/can_get_a_build_trigger_added_to_it.yml
175
+ - spec/cassettes/TeamcityRuby_BuildConfiguration/a_existing_build_configuration/can_get_a_vcs_root_attached_with_specific_checkout_rules.yml
176
+ - spec/cassettes/TeamcityRuby_BuildConfiguration/fetches_a_specific_build_configuration_by_id.yml
177
+ - spec/cassettes/TeamcityRuby_BuildConfiguration/lists_all_build_configurations.yml
178
+ - spec/cassettes/TeamcityRuby_Project/creates_a_project_copying_its_settings_from_a_source_project.yml
179
+ - spec/cassettes/TeamcityRuby_Project/creates_a_project_with_a_parent_project.yml
180
+ - spec/cassettes/TeamcityRuby_Project/destroys_a_specific_project.yml
181
+ - spec/cassettes/TeamcityRuby_Project/fetches_a_specific_project_by_id_locator.yml
182
+ - spec/cassettes/TeamcityRuby_Project/fetches_a_specific_project_by_name_locator.yml
183
+ - spec/cassettes/TeamcityRuby_Project/lists_all_projects_including_root_built_in_on_TeamCity_.yml
184
+ - spec/cassettes/TeamcityRuby_VcsRoot/lists_all_vcs_roots.yml
185
+ - spec/spec_helper.rb
186
+ - spec/teamcity_ruby/build_configuration_spec.rb
187
+ - spec/teamcity_ruby/element_builder_spec.rb
188
+ - spec/teamcity_ruby/project_spec.rb
189
+ - spec/teamcity_ruby/vcs_root_spec.rb
190
+ - teamcity_ruby.gemspec
191
+ has_rdoc: true
192
+ homepage: ""
193
+ licenses:
194
+ - MIT
195
+ post_install_message:
196
+ rdoc_options: []
197
+
198
+ require_paths:
199
+ - lib
200
+ required_ruby_version: !ruby/object:Gem::Requirement
201
+ none: false
202
+ requirements:
203
+ - - ">="
204
+ - !ruby/object:Gem::Version
205
+ hash: 3
206
+ segments:
207
+ - 0
208
+ version: "0"
209
+ required_rubygems_version: !ruby/object:Gem::Requirement
210
+ none: false
211
+ requirements:
212
+ - - ">="
213
+ - !ruby/object:Gem::Version
214
+ hash: 3
215
+ segments:
216
+ - 0
217
+ version: "0"
218
+ requirements: []
219
+
220
+ rubyforge_project:
221
+ rubygems_version: 1.6.2
222
+ signing_key:
223
+ specification_version: 3
224
+ summary: TeamCity API Ruby Wrapper
225
+ test_files:
226
+ - spec/cassettes/TeamcityRuby_BuildConfiguration/a_existing_build_configuration/can_get_a_build_step_added_to_it.yml
227
+ - spec/cassettes/TeamcityRuby_BuildConfiguration/a_existing_build_configuration/can_get_a_build_trigger_added_to_it.yml
228
+ - spec/cassettes/TeamcityRuby_BuildConfiguration/a_existing_build_configuration/can_get_a_vcs_root_attached_with_specific_checkout_rules.yml
229
+ - spec/cassettes/TeamcityRuby_BuildConfiguration/fetches_a_specific_build_configuration_by_id.yml
230
+ - spec/cassettes/TeamcityRuby_BuildConfiguration/lists_all_build_configurations.yml
231
+ - spec/cassettes/TeamcityRuby_Project/creates_a_project_copying_its_settings_from_a_source_project.yml
232
+ - spec/cassettes/TeamcityRuby_Project/creates_a_project_with_a_parent_project.yml
233
+ - spec/cassettes/TeamcityRuby_Project/destroys_a_specific_project.yml
234
+ - spec/cassettes/TeamcityRuby_Project/fetches_a_specific_project_by_id_locator.yml
235
+ - spec/cassettes/TeamcityRuby_Project/fetches_a_specific_project_by_name_locator.yml
236
+ - spec/cassettes/TeamcityRuby_Project/lists_all_projects_including_root_built_in_on_TeamCity_.yml
237
+ - spec/cassettes/TeamcityRuby_VcsRoot/lists_all_vcs_roots.yml
238
+ - spec/spec_helper.rb
239
+ - spec/teamcity_ruby/build_configuration_spec.rb
240
+ - spec/teamcity_ruby/element_builder_spec.rb
241
+ - spec/teamcity_ruby/project_spec.rb
242
+ - spec/teamcity_ruby/vcs_root_spec.rb