delinquo-cli 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: 4ccf43f8f9faaa8ef0d21b57aaa5a43973238f23
4
+ data.tar.gz: e17b6b04d127134fb2b9cbb34fd5bb9b4b0a4e65
5
+ SHA512:
6
+ metadata.gz: 0083e6d4d4b4ebc1c4198d25d7b0d57683e81834bab638d00834f33acd82f13d2fe4556d0d02ea2ee0d88e5e77695902b9b2519dbf64da45b1c72bf377b5d0fe
7
+ data.tar.gz: 7e2c6bdd7f8aa6de4b1ef229121f9c456883bf19c592560797b7e604dbc94f65d7030c9bbab2b12a1387e7545dc430a11f527da41d149d43569c1f6b0a9e4a66
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/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.2
4
+ before_install: gem install bundler -v 1.10.6
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in delinquo.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # delinquo-cli
2
+ ## Installation
3
+
4
+ Add this line to your application's Gemfile:
5
+
6
+ ```ruby
7
+ gem 'delinquo-cli'
8
+ ```
9
+
10
+ And then execute:
11
+
12
+ $ bundle
13
+
14
+ Or install it yourself as:
15
+
16
+ $ gem install delinquo-cli
17
+
18
+ ## Usage
19
+
20
+ TODO: Write usage instructions here
21
+
22
+ ## Development
23
+
24
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
25
+
26
+ 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).
27
+
28
+ ## Contributing
29
+
30
+ Bug reports and pull requests are welcome on GitHub at https://github.com/bbc/delinquo-cli.
31
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "delinquo_poster"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'delinquo/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "delinquo-cli"
8
+ spec.version = Delinquo::VERSION
9
+ spec.authors = ["James Ruston"]
10
+ spec.email = ["jruston90@gmail.com"]
11
+
12
+ spec.summary = %q{Post build results to delinquo}
13
+ spec.description = %q{Post the JUnit XML output of your test suite to delinquo}
14
+ spec.homepage = "http://sport-toolbox.cloud.bbc.co.uk/delinquo"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.10"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rspec"
24
+ spec.add_dependency 'thor'
25
+ spec.add_dependency 'httparty'
26
+ end
data/exe/delinquo ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby -wU
2
+
3
+ require 'delinquo'
4
+
5
+ Delinquo::CLI.start(ARGV)
@@ -0,0 +1,45 @@
1
+ require 'httparty'
2
+
3
+ OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
4
+
5
+ module Delinquo
6
+ class AuthenticatedConnection
7
+ include HTTParty
8
+
9
+ base_uri 'https://sport-toolbox.cloud.bbc.co.uk/delinquo'
10
+
11
+ if ENV['http_proxy'] == 'http://www-cache.reith.bbc.co.uk:80'
12
+ http_proxy 'www-cache.reith.bbc.co.uk', 80
13
+ end
14
+
15
+ ssl_version :TLSv1
16
+
17
+ def initialize(cert)
18
+ self.class.pem(File.read('/etc/pki/certificate.pem'))
19
+ end
20
+
21
+ def project(project)
22
+ self.class.get("/project/#{project}")
23
+ end
24
+
25
+ def add_run(project, runner, directory)
26
+ files = Dir["#{directory}/*.xml"]
27
+ if files.empty?
28
+ puts "No .xml files found in #{directory}"
29
+ return
30
+ end
31
+
32
+ run_id = nil
33
+ files.each do |file|
34
+ current = File.read(file)
35
+
36
+ url = "/project/#{project}/runner/#{runner}/run/#{run_id}"
37
+ puts url
38
+ run_id = self.class.post(url, body: current, :headers => { "Content-Type" => "application/xml"}).body
39
+ puts run_id
40
+ end
41
+ end
42
+ end
43
+ end
44
+
45
+
@@ -0,0 +1,24 @@
1
+ require 'thor'
2
+
3
+ module Delinquo
4
+
5
+ class CLI < Thor
6
+
7
+ desc "post", "Post a new run to delinquo"
8
+ option :project, :required => true, :desc => "The name of the project to post to"
9
+ option :runner, :required => true, :desc => "The name of the test runner e.g. rspec, php-unit"
10
+ option :directory, :required => true, :desc => "The directory with the JUnit XML output"
11
+ option :cert, :required => true, :desc => "The path to the certificate pem to authenticate"
12
+
13
+ def post
14
+ connection = Delinquo::AuthenticatedConnection.new(options[:cert])
15
+
16
+ if connection.project(options[:project]).code != 200
17
+ puts "ERROR: Project not found with name '#{options[:project]}'"
18
+ return
19
+ end
20
+ connection.add_run(options[:project], options[:runner], options[:directory])
21
+ end
22
+
23
+ end
24
+ end
@@ -0,0 +1,3 @@
1
+ module Delinquo
2
+ VERSION = "0.1.0"
3
+ end
data/lib/delinquo.rb ADDED
@@ -0,0 +1,7 @@
1
+ require "delinquo/version"
2
+ require "delinquo/cli"
3
+ require "delinquo/authenticated_connection"
4
+
5
+ module Delinquo
6
+ # Your code goes here...
7
+ end
metadata ADDED
@@ -0,0 +1,128 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: delinquo-cli
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Ruston
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-10-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: thor
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: httparty
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Post the JUnit XML output of your test suite to delinquo
84
+ email:
85
+ - jruston90@gmail.com
86
+ executables:
87
+ - delinquo
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - ".rspec"
93
+ - ".travis.yml"
94
+ - Gemfile
95
+ - README.md
96
+ - Rakefile
97
+ - bin/console
98
+ - bin/setup
99
+ - delinquo-cli.gemspec
100
+ - exe/delinquo
101
+ - lib/delinquo.rb
102
+ - lib/delinquo/authenticated_connection.rb
103
+ - lib/delinquo/cli.rb
104
+ - lib/delinquo/version.rb
105
+ homepage: http://sport-toolbox.cloud.bbc.co.uk/delinquo
106
+ licenses: []
107
+ metadata: {}
108
+ post_install_message:
109
+ rdoc_options: []
110
+ require_paths:
111
+ - lib
112
+ required_ruby_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ required_rubygems_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ requirements: []
123
+ rubyforge_project:
124
+ rubygems_version: 2.4.8
125
+ signing_key:
126
+ specification_version: 4
127
+ summary: Post build results to delinquo
128
+ test_files: []