concourse-technician 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e124b3ec79ff6952ad28547f53e6ab42271d509a
4
+ data.tar.gz: 2a816dbb8ee2c1ec2cc32b7ec095c019af487994
5
+ SHA512:
6
+ metadata.gz: 9967df2118470c437ceb6c788b2fc9f8c7eabffd03577d4db874f8bd43d0999bdc40733a156dd1591a79532cf85072d4c044717f2588c1492590153c1d3f70f9
7
+ data.tar.gz: deea7e620f9b8fba9b213397fbe7d951c38aef8aa4c0d1f58268825aada852d05fb3632319f83e5e2654d67766f57c9953f0ffc401fc85ef783e1b3008377460
data/.gitignore ADDED
@@ -0,0 +1,54 @@
1
+
2
+ # Created by https://www.gitignore.io/api/ruby
3
+
4
+ ### Ruby ###
5
+ *.gem
6
+ *.rbc
7
+ /.config
8
+ /coverage/
9
+ /InstalledFiles
10
+ /pkg/
11
+ /spec/reports/
12
+ /spec/examples.txt
13
+ /test/tmp/
14
+ /test/version_tmp/
15
+ /tmp/
16
+
17
+ # Used by dotenv library to load environment variables.
18
+ # .env
19
+
20
+ ## Specific to RubyMotion:
21
+ .dat*
22
+ .repl_history
23
+ build/
24
+ *.bridgesupport
25
+ build-iPhoneOS/
26
+ build-iPhoneSimulator/
27
+
28
+ ## Specific to RubyMotion (use of CocoaPods):
29
+ #
30
+ # We recommend against adding the Pods directory to your .gitignore. However
31
+ # you should judge for yourself, the pros and cons are mentioned at:
32
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
33
+ #
34
+ # vendor/Pods/
35
+
36
+ ## Documentation cache and generated files:
37
+ /.yardoc/
38
+ /_yardoc/
39
+ /doc/
40
+ /rdoc/
41
+
42
+ ## Environment normalization:
43
+ /.bundle/
44
+ /vendor/bundle
45
+ /lib/bundler/man/
46
+
47
+ # for a library or gem, you might want to ignore these files since the code is
48
+ # intended to run in multiple environments; otherwise, check them in:
49
+ # Gemfile.lock
50
+ # .ruby-version
51
+ # .ruby-gemset
52
+
53
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
54
+ .rvmrc
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+
2
+ The MIT License (MIT)
3
+ Copyright © 2016 Chris Olstrom <chris@olstrom.com>
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/README.org ADDED
@@ -0,0 +1,34 @@
1
+ #+TITLE: Concourse Technician
2
+ #+LATEX: \pagebreak
3
+
4
+ * Overview
5
+
6
+ A tool to diangose and repair issues with Concourse.
7
+
8
+ * Installation
9
+
10
+ #+BEGIN_SRC shell
11
+ gem install concourse-technician
12
+ #+END_SRC
13
+
14
+ * Usage
15
+
16
+ To get a list of abandoned volumes...
17
+
18
+ #+BEGIN_SRC shell
19
+ technician abandoned_volumes
20
+ #+END_SRC
21
+
22
+ To clean up all abandoned volumes...
23
+
24
+ #+BEGIN_SRC shell
25
+ technician delete_abandoned_volumes
26
+ #+END_SRC
27
+
28
+ * License
29
+
30
+ ~dbviz~ is available under the [[https://tldrlegal.com/license/mit-license][MIT License]]. See ~LICENSE.txt~ for the full text.
31
+
32
+ * Contributors
33
+
34
+ - [[https://colstrom.github.io/][Chris Olstrom]] | [[mailto:chris@olstrom.com][e-mail]] | [[https://twitter.com/ChrisOlstrom][Twitter]]
data/bin/technician ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'json'
4
+ require 'concourse-technician/cli'
5
+ require 'concourse-technician/database'
6
+
7
+ ConcourseTechnician::Database.new.tap do |database|
8
+ ConcourseTechnician::CLI.new(database: database).execute(*ARGV).tap do |out|
9
+ puts JSON.dump(out.respond_to?(:to_i) ? out.to_i : out.to_a) if out
10
+ end
11
+ end
@@ -0,0 +1,18 @@
1
+ Gem::Specification.new do |gem|
2
+ gem.name = 'concourse-technician'
3
+ gem.version = `git describe --tags --abbrev=0`.chomp
4
+ gem.licenses = 'MIT'
5
+ gem.authors = ['Chris Olstrom']
6
+ gem.email = 'chris@olstrom.com'
7
+ gem.homepage = 'https://github.com/colstrom/concourse-technician'
8
+ gem.summary = 'Troubleshoot Concourse without fly'
9
+
10
+ gem.files = `git ls-files`.split("\n")
11
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
12
+ gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
13
+ gem.require_paths = ['lib']
14
+
15
+ gem.add_runtime_dependency 'contracts', '~> 0.14', '>= 0.14.0'
16
+ gem.add_runtime_dependency 'instacli', '~> 1.1', '>= 1.1.2'
17
+ gem.add_runtime_dependency 'sequel', '~> 4.36', '>= 4.36.0'
18
+ end
@@ -0,0 +1,4 @@
1
+
2
+ require_relative 'concourse-technician/cli'
3
+ require_relative 'concourse-technician/database'
4
+ require_relative 'concourse-technician/settings'
@@ -0,0 +1,12 @@
1
+ require 'instacli'
2
+
3
+ module ConcourseTechnician
4
+ class CLI < ::InstaCLI::CLI
5
+ include ::InstaCLI::Help
6
+ include ::InstaCLI::Silence
7
+
8
+ def methods(m)
9
+ super(m).reject { |m| [:Contract, :functype].include? m }
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,38 @@
1
+ require 'contracts'
2
+ require 'sequel'
3
+ require_relative 'settings'
4
+
5
+ module ConcourseTechnician
6
+ class Database
7
+ include ::Contracts::Core
8
+ include ::Contracts::Builtin
9
+ include Settings
10
+
11
+ Contract None => Sequel::Dataset
12
+ def workers
13
+ db[:workers].select(:name)
14
+ end
15
+
16
+ Contract None => Sequel::Dataset
17
+ def volumes
18
+ db[:volumes].select(:id)
19
+ end
20
+
21
+ Contract None => Sequel::Dataset
22
+ def abandoned_volumes
23
+ volumes.exclude(worker_name: workers)
24
+ end
25
+
26
+ Contract None => Num
27
+ def delete_abandoned_volumes
28
+ abandoned_volumes.delete
29
+ end
30
+
31
+ private
32
+
33
+ Contract None => Sequel::Database
34
+ def db
35
+ @db ||= Sequel.connect(settings)
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,21 @@
1
+ require 'contracts'
2
+ require 'yaml'
3
+
4
+ module ConcourseTechnician
5
+ module Settings
6
+ include ::Contracts::Core
7
+ include ::Contracts::Builtin
8
+
9
+ private
10
+
11
+ Contract None => String
12
+ def settings_path
13
+ @config_path ||= ENV['CONCOURSE_TECHNICIAN_CONFIG'] || File.expand_path('~/.config/concourse-technician.yaml')
14
+ end
15
+
16
+ Contract None => HashOf[String, Or[String, Num]]
17
+ def settings
18
+ @config ||= YAML.load_file settings_path
19
+ end
20
+ end
21
+ end
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: concourse-technician
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.4
5
+ platform: ruby
6
+ authors:
7
+ - Chris Olstrom
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-07-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: contracts
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.14'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.14.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '0.14'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.14.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: instacli
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.1'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 1.1.2
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '1.1'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 1.1.2
53
+ - !ruby/object:Gem::Dependency
54
+ name: sequel
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '4.36'
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 4.36.0
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '4.36'
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 4.36.0
73
+ description:
74
+ email: chris@olstrom.com
75
+ executables:
76
+ - technician
77
+ extensions: []
78
+ extra_rdoc_files: []
79
+ files:
80
+ - ".gitignore"
81
+ - LICENSE.txt
82
+ - README.org
83
+ - bin/technician
84
+ - concourse-technician.gemspec
85
+ - lib/concourse-technician.rb
86
+ - lib/concourse-technician/cli.rb
87
+ - lib/concourse-technician/database.rb
88
+ - lib/concourse-technician/settings.rb
89
+ homepage: https://github.com/colstrom/concourse-technician
90
+ licenses:
91
+ - MIT
92
+ metadata: {}
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 2.5.1
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: Troubleshoot Concourse without fly
113
+ test_files: []
114
+ has_rdoc: