xcode_server 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2fa30cd8b451335c5ec15657c0e9e17b1d2423af
4
+ data.tar.gz: be97133717127bd8da4b448bcc3aa05f33887ef7
5
+ SHA512:
6
+ metadata.gz: ead2a1898d377fbc0856a3024664e896a91a7e550587f90dc887ddd23109ad001e26a705c668480e8b0bc3433b890395ebf28df1b3bbfa13228a8ced17529b45
7
+ data.tar.gz: 580cd770f94fd089ef1c323f11a5937b2490f31fe20b5fd95dbd4b43483a3cc8d4967bcbc900244d3bfaf6936b19df2a1777a86a08c14e0c9ffb14d08ed70080
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Venmo LLC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << 'test'
6
+ t.libs << 'lib'
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task :default => :test
data/Readme.markdown ADDED
@@ -0,0 +1,60 @@
1
+ # XcodeServer
2
+
3
+ Ruby library for working with Xcode Server and Xcode Bots.
4
+
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ``` ruby
11
+ gem 'xcode_server'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install xcode_server
21
+
22
+
23
+ ## Usage
24
+
25
+ First, you need to initialize a server:
26
+
27
+ ``` ruby
28
+ # Initialize a server with its host or IP
29
+ server = XcodeServer.new('10.0.1.2')
30
+ #=> #<XcodeServer::Server @host="10.0.1.2", @scheme="https">
31
+
32
+ # List the bots running on the server
33
+ server.bots
34
+ #=> [#<XcodeServer::Bot...
35
+
36
+ # Create a new bot
37
+ server.create_bot(...)
38
+
39
+ # Destroy a bot
40
+ server.destroy_bot(bot_id)
41
+ #=> true
42
+ ```
43
+
44
+
45
+ ## Development
46
+
47
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
48
+
49
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
50
+
51
+
52
+ ## Contributing
53
+
54
+ Bug reports and pull requests are welcome [on GitHub](https://github.com/venmo/xcode_server).
55
+
56
+
57
+ ## License
58
+
59
+ The gem is available as open source under the terms of the [MIT License](LICENSE).
60
+
data/bin/console ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'xcode_server'
5
+
6
+ require 'irb'
7
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
@@ -0,0 +1,16 @@
1
+ module XcodeServer
2
+ class Bot
3
+ attr_reader :id, :tinyID, :name
4
+
5
+ def initialize(server, json)
6
+ @server = server
7
+ @id = json['_id']
8
+ @tinyID = json['tinyID']
9
+ @name = json['name']
10
+ end
11
+
12
+ def url
13
+ "#{@server.scheme}://#{@server.host}/xcode/bots/latest/#{tinyID}"
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,37 @@
1
+ require 'net/http'
2
+ require 'json'
3
+
4
+ module XcodeServer
5
+ class Server
6
+ module Networking
7
+
8
+ def get(path)
9
+ path = "/xcode/api/#{path}"
10
+ http.request(Net::HTTP::Get.new(path))
11
+ end
12
+
13
+ def get_json(path)
14
+ JSON.load(get(path).body)
15
+ end
16
+
17
+ def delete(path)
18
+ path = "/xcode/api/#{path}"
19
+ http.request(Net::HTTP::Delete.new(path))
20
+ end
21
+
22
+ private
23
+
24
+ def http
25
+ @_http ||= begin
26
+ http = Net::HTTP.new(host, 443)
27
+ http.use_ssl = true
28
+
29
+ # By default, Xcode Server uses a self-signed certificate
30
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
31
+
32
+ http
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,24 @@
1
+ require 'xcode_server/server/networking'
2
+
3
+ module XcodeServer
4
+ class Server
5
+ include Networking
6
+
7
+ attr_reader :scheme
8
+ attr_reader :host
9
+
10
+ def initialize(host, scheme = 'https')
11
+ @host = host
12
+ @scheme = scheme
13
+ end
14
+
15
+ def bots
16
+ get_json('bots')['results'].map { |result| Bot.new(self, result) }
17
+ end
18
+
19
+ def destroy_bot(id, rev = nil)
20
+ rev ||= get_json("bots/#{id}")['_rev']
21
+ delete("bots/#{id}/#{rev}").code.to_i == 204
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,3 @@
1
+ module XcodeServer
2
+ VERSION = '0.1.0'
3
+ end
@@ -0,0 +1,9 @@
1
+ require 'xcode_server/version'
2
+ require 'xcode_server/server'
3
+ require 'xcode_server/bot'
4
+
5
+ module XcodeServer
6
+ def self.new(host)
7
+ Server.new(host)
8
+ end
9
+ end
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'xcode_server/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'xcode_server'
8
+ spec.version = XcodeServer::VERSION
9
+ spec.authors = ['Sam Soffes', 'Mickey Reiss']
10
+ spec.email = ['sam@soff.es', 'mickeyreiss@gmail.com']
11
+
12
+ spec.summary = 'Xcode Bot client'
13
+ spec.description = spec.summary
14
+ spec.homepage = 'https://github.com/venmo/xcode_server'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.require_paths = ['lib']
19
+
20
+ spec.required_ruby_version = '>= 2.0'
21
+
22
+ spec.add_dependency 'json'
23
+
24
+ spec.add_development_dependency 'bundler', '~> 1.10'
25
+ spec.add_development_dependency 'rake', '~> 10.0'
26
+ spec.add_development_dependency 'minitest', '>= 5.0'
27
+ spec.add_development_dependency 'minitest-reporters'
28
+ end
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: xcode_server
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Sam Soffes
8
+ - Mickey Reiss
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2015-06-05 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: json
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: bundler
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '1.10'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '1.10'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rake
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '10.0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '10.0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: minitest
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '5.0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '5.0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: minitest-reporters
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ description: Xcode Bot client
85
+ email:
86
+ - sam@soff.es
87
+ - mickeyreiss@gmail.com
88
+ executables: []
89
+ extensions: []
90
+ extra_rdoc_files: []
91
+ files:
92
+ - ".gitignore"
93
+ - Gemfile
94
+ - LICENSE
95
+ - Rakefile
96
+ - Readme.markdown
97
+ - bin/console
98
+ - bin/setup
99
+ - lib/xcode_server.rb
100
+ - lib/xcode_server/bot.rb
101
+ - lib/xcode_server/server.rb
102
+ - lib/xcode_server/server/networking.rb
103
+ - lib/xcode_server/version.rb
104
+ - xcode_server.gemspec
105
+ homepage: https://github.com/venmo/xcode_server
106
+ licenses:
107
+ - MIT
108
+ metadata: {}
109
+ post_install_message:
110
+ rdoc_options: []
111
+ require_paths:
112
+ - lib
113
+ required_ruby_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '2.0'
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ requirements: []
124
+ rubyforge_project:
125
+ rubygems_version: 2.2.3
126
+ signing_key:
127
+ specification_version: 4
128
+ summary: Xcode Bot client
129
+ test_files: []