tweety_bird 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/Gemfile +15 -0
- data/LICENSE +13 -0
- data/Rakefile +32 -0
- data/Readme.md +56 -0
- data/VERSION +1 -0
- data/bin/tweety +3 -0
- data/lib/tweety_bird.rb +1 -0
- data/lib/tweety_bird/app.rb +62 -0
- data/lib/tweety_bird/helpers.rb +28 -0
- data/lib/tweety_bird/main.rb +67 -0
- data/lib/tweety_bird/metadata.rb +21 -0
- data/tweety_bird.gemspec +27 -0
- metadata +141 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b688806e9125f7504114345bc2c6d6c761cee13f
|
4
|
+
data.tar.gz: 2251b49d73a6bf7137a8c870499e874fa003406d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 98553dd690b9068bcb2e3bcc16a280a8005a16b7108fda5007dda5e1c00b04d8ed71b0c7888a97ca01915eb7fc5acb525cf6508a72044cbfa3b13e0bec994514
|
7
|
+
data.tar.gz: aff13da35c5eca33ed4c7053b5e2a1cad122ec614ab3d247001a97f2199e6a07dc49adf5c58d2c8257385392485c1fe079e4f274fba202217e9236e26f18571c
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright (c) 2015 Sean Clemmer and Blue Jeans Network
|
2
|
+
|
3
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
4
|
+
purpose with or without fee is hereby granted, provided that the above
|
5
|
+
copyright notice and this permission notice appear in all copies.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
8
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
9
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
10
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
11
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
12
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
13
|
+
PERFORMANCE OF THIS SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
require 'rake'
|
4
|
+
|
5
|
+
|
6
|
+
require 'rake/testtask'
|
7
|
+
Rake::TestTask.new(:test) do |test|
|
8
|
+
test.libs << 'lib' << 'test'
|
9
|
+
test.test_files = FileList['test/test*.rb']
|
10
|
+
test.verbose = true
|
11
|
+
end
|
12
|
+
|
13
|
+
task :default => :test
|
14
|
+
|
15
|
+
|
16
|
+
require 'yard'
|
17
|
+
YARD::Rake::YardocTask.new do |t|
|
18
|
+
t.files = %w[ --readme Readme.md lib/**/*.rb - VERSION ]
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
require 'rubygems/tasks'
|
23
|
+
Gem::Tasks.new({
|
24
|
+
sign: {}
|
25
|
+
}) do |tasks|
|
26
|
+
tasks.console.command = 'pry'
|
27
|
+
end
|
28
|
+
Gem::Tasks::Sign::Checksum.new sha2: true
|
29
|
+
|
30
|
+
|
31
|
+
require 'rake/version_task'
|
32
|
+
Rake::VersionTask.new
|
data/Readme.md
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# Tweety Bird
|
2
|
+
|
3
|
+
Tweety Bird is a deployment tracking service for Chef at Blue Jeans.
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
## API
|
8
|
+
|
9
|
+
### Version `GET /`
|
10
|
+
|
11
|
+
Return the application version.
|
12
|
+
|
13
|
+
|
14
|
+
### Create distribution `POST /:environment/:key_path {}`
|
15
|
+
|
16
|
+
Associate the `key_path` in `environment` with the `value_distribution` provided
|
17
|
+
in the request body, which must be valid JSON (see example below). Returns `404`
|
18
|
+
if a distribution for the `environment` and `key_path` already exists. Returns
|
19
|
+
`400` if the distribution is invalid.
|
20
|
+
|
21
|
+
{
|
22
|
+
"abc123": 0.1,
|
23
|
+
"def456": 0.4,
|
24
|
+
"ghi789": 0.5
|
25
|
+
}
|
26
|
+
|
27
|
+
|
28
|
+
### Replace distribution `PUT /:environment/:key_path {}`
|
29
|
+
|
30
|
+
Associate the `key_path` in `environment` with the `value_distribution` provided
|
31
|
+
in the request body, which must be a valid JSON hash. Returns `404` if a
|
32
|
+
distribution for the `environment` and `key_path` does not exist. Returns `400`
|
33
|
+
if the distribution is invalid.
|
34
|
+
|
35
|
+
|
36
|
+
### Update distribution `PATCH /:environment/:key_path {}`
|
37
|
+
|
38
|
+
Merge the current distribution for the `key_path` in `environment` with the
|
39
|
+
`value_distribution` provided in the request body, which must be a valid JSON
|
40
|
+
hash. Returns `404` if a distribution for the `environment` and `key_path` does
|
41
|
+
not exist. Returns `400` if the distribution is invalid.
|
42
|
+
|
43
|
+
|
44
|
+
## Lookup distributions `GET /:environment`
|
45
|
+
|
46
|
+
Return all the distributions associated with the given `environment`. Returns
|
47
|
+
`404` if the environment does not exist.
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
## Changelog
|
52
|
+
|
53
|
+
### Pre-1.0.0
|
54
|
+
|
55
|
+
- Defining initial API
|
56
|
+
- Skeleton laid out
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
data/bin/tweety
ADDED
data/lib/tweety_bird.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require_relative 'tweety_bird/main'
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
require 'logger'
|
3
|
+
require 'thread'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
require 'slog'
|
7
|
+
require 'chronic'
|
8
|
+
require 'daybreak'
|
9
|
+
require 'sinatra/base'
|
10
|
+
|
11
|
+
require_relative 'helpers'
|
12
|
+
require_relative 'metadata'
|
13
|
+
|
14
|
+
|
15
|
+
module TweetyBird
|
16
|
+
|
17
|
+
# Web frontend for TweetyBird, backed by Sinatra.
|
18
|
+
class App < Sinatra::Application
|
19
|
+
include TweetyBird::Helpers
|
20
|
+
|
21
|
+
|
22
|
+
def self.config! options
|
23
|
+
@@logger = Slog::Logger.new
|
24
|
+
@@db = Daybreak::DB.new options.database
|
25
|
+
|
26
|
+
self.set :environment, options.environment
|
27
|
+
self.set :port, options.port
|
28
|
+
self.set :bind, options.bind
|
29
|
+
self.set :raise_errors, options.debug?
|
30
|
+
self.set :dump_errors, options.debug?
|
31
|
+
self.set :show_exceptions, options.debug?
|
32
|
+
self.set :logging, ::Logger::DEBUG if options.debug?
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
def self.close! ; end
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
get '/' do
|
41
|
+
content_type :text
|
42
|
+
TweetyBird::VERSION
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
get '/:environment' do
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
post '/:environment/:key_path' do
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
put '/:environment/:key_path' do
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
patch '/:environment/:key_path' do
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'thor/util'
|
2
|
+
require 'thor/actions'
|
3
|
+
|
4
|
+
|
5
|
+
module TweetyBird
|
6
|
+
|
7
|
+
# Mixins for DBum's Thor subclasses.
|
8
|
+
module Helpers
|
9
|
+
|
10
|
+
# Save the canonical implementation of "puts"
|
11
|
+
alias_method :old_puts, :puts
|
12
|
+
|
13
|
+
# Monkeypatch puts to support Thor::Shell::Color.
|
14
|
+
def puts *args
|
15
|
+
return old_puts if args.empty?
|
16
|
+
old_puts shell.set_color(*args)
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
# Shortcut for Thor::Util.
|
21
|
+
def util ; Thor::Util end
|
22
|
+
|
23
|
+
|
24
|
+
# Shortcut for Thor::Actions.
|
25
|
+
def actions ; Thor::Actions end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'logger'
|
2
|
+
|
3
|
+
require 'thor'
|
4
|
+
|
5
|
+
require_relative 'app'
|
6
|
+
require_relative 'metadata'
|
7
|
+
|
8
|
+
|
9
|
+
module TweetyBird
|
10
|
+
class Main < Thor
|
11
|
+
desc 'version', 'Show application version'
|
12
|
+
def version
|
13
|
+
puts VERSION
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
desc 'art', 'Show application art'
|
18
|
+
def art
|
19
|
+
w = ART.lines.map(&:length).sort.last
|
20
|
+
w += 1 if w % 2 != 0
|
21
|
+
puts
|
22
|
+
puts 'Tweety Bird'.center(w)
|
23
|
+
puts VERSION.center(w)
|
24
|
+
puts
|
25
|
+
puts SUMMARY.center(w)
|
26
|
+
puts "\n\n\n"
|
27
|
+
puts ART
|
28
|
+
puts "\n\n\n"
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
desc 'server', 'Start the application Web server'
|
33
|
+
option :port, \
|
34
|
+
type: :numeric,
|
35
|
+
aliases: %w[ -p ],
|
36
|
+
desc: 'Set Sinatra port',
|
37
|
+
default: 4567
|
38
|
+
option :environment, \
|
39
|
+
type: :string,
|
40
|
+
aliases: %w[ -e ],
|
41
|
+
desc: 'Set Sinatra environment',
|
42
|
+
default: 'development'
|
43
|
+
option :bind, \
|
44
|
+
type: :string,
|
45
|
+
aliases: %w[ -b ],
|
46
|
+
desc: 'Set Sinatra interface',
|
47
|
+
default: '0.0.0.0'
|
48
|
+
option :database, \
|
49
|
+
type: :string,
|
50
|
+
aliases: %w[ -t ],
|
51
|
+
desc: 'Location of application database',
|
52
|
+
default: 'um.db'
|
53
|
+
option :debug, \
|
54
|
+
type: :boolean,
|
55
|
+
aliases: %w[ -d ],
|
56
|
+
desc: 'Enable debugging output',
|
57
|
+
default: false
|
58
|
+
def server
|
59
|
+
App.config! options
|
60
|
+
App.run!
|
61
|
+
at_exit do
|
62
|
+
App.close!
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module TweetyBird
|
2
|
+
# General information about the project
|
3
|
+
SUMMARY = %q.A deployment tracking service for Chef.
|
4
|
+
AUTHOR = 'Sean Clemmer'
|
5
|
+
EMAIL = 'sclemmer@bluejeans.com'
|
6
|
+
LICENSE = 'ISC'
|
7
|
+
HOMEPAGE = 'https://github.com/sczizzo/tweety-bird'
|
8
|
+
|
9
|
+
# Project root
|
10
|
+
ROOT = File.dirname(__FILE__), '..', '..'
|
11
|
+
|
12
|
+
# Pull the project version out of the VERSION file
|
13
|
+
VERSION = File.read(File.join(ROOT, 'VERSION')).strip
|
14
|
+
|
15
|
+
# Every project deserves its own ASCII art
|
16
|
+
ART = <<-'EOART'
|
17
|
+
╔╦╗┬ ┬┌─┐┌─┐┌┬┐┬ ┬╔╗ ┬┬─┐┌┬┐
|
18
|
+
║ │││├┤ ├┤ │ └┬┘╠╩╗│├┬┘ ││
|
19
|
+
╩ └┴┘└─┘└─┘ ┴ ┴ ╚═╝┴┴└──┴┘
|
20
|
+
EOART
|
21
|
+
end
|
data/tweety_bird.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path(File.join('..', 'lib'), __FILE__)
|
3
|
+
require 'tweety_bird/metadata'
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'tweety_bird'
|
7
|
+
s.version = TweetyBird::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.license = TweetyBird::LICENSE
|
10
|
+
s.homepage = TweetyBird::HOMEPAGE
|
11
|
+
s.author = TweetyBird::AUTHOR
|
12
|
+
s.email = TweetyBird::EMAIL
|
13
|
+
s.summary = TweetyBird::SUMMARY
|
14
|
+
s.description = TweetyBird::SUMMARY + '.'
|
15
|
+
|
16
|
+
s.add_runtime_dependency 'thor', '~> 0'
|
17
|
+
s.add_runtime_dependency 'slog', '~> 1.1.0'
|
18
|
+
s.add_runtime_dependency 'ridley', '~> 4.1'
|
19
|
+
s.add_runtime_dependency 'daybreak', '~> 0.3'
|
20
|
+
s.add_runtime_dependency 'sinatra', '~> 1.4'
|
21
|
+
s.add_runtime_dependency 'chronic', '~> 0.10.2'
|
22
|
+
|
23
|
+
s.files = `git ls-files`.split("\n")
|
24
|
+
s.test_files = `git ls-files -- test/*`.split("\n")
|
25
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File::basename(f) }
|
26
|
+
s.require_paths = %w[ lib ]
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tweety_bird
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sean Clemmer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-02-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: slog
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.1.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.1.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: ridley
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '4.1'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '4.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: daybreak
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.3'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: sinatra
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.4'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.4'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: chronic
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.10.2
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.10.2
|
97
|
+
description: A deployment tracking service for Chef.
|
98
|
+
email: sclemmer@bluejeans.com
|
99
|
+
executables:
|
100
|
+
- tweety
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- Gemfile
|
106
|
+
- LICENSE
|
107
|
+
- Rakefile
|
108
|
+
- Readme.md
|
109
|
+
- VERSION
|
110
|
+
- bin/tweety
|
111
|
+
- lib/tweety_bird.rb
|
112
|
+
- lib/tweety_bird/app.rb
|
113
|
+
- lib/tweety_bird/helpers.rb
|
114
|
+
- lib/tweety_bird/main.rb
|
115
|
+
- lib/tweety_bird/metadata.rb
|
116
|
+
- tweety_bird.gemspec
|
117
|
+
homepage: https://github.com/sczizzo/tweety-bird
|
118
|
+
licenses:
|
119
|
+
- ISC
|
120
|
+
metadata: {}
|
121
|
+
post_install_message:
|
122
|
+
rdoc_options: []
|
123
|
+
require_paths:
|
124
|
+
- lib
|
125
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
130
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
requirements: []
|
136
|
+
rubyforge_project:
|
137
|
+
rubygems_version: 2.2.2
|
138
|
+
signing_key:
|
139
|
+
specification_version: 4
|
140
|
+
summary: A deployment tracking service for Chef
|
141
|
+
test_files: []
|