utter 0.1.0 → 1.0.0.alpha
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 +4 -4
- data/bin/utter +138 -0
- data/lib/utter/api.rb +98 -0
- data/lib/utter/ds.rb +70 -0
- data/lib/utter/logger.rb +22 -0
- data/lib/utter.rb +13 -41
- metadata +19 -94
- data/.gitignore +0 -11
- data/.travis.yml +0 -5
- data/CODE_OF_CONDUCT.md +0 -49
- data/Gemfile +0 -4
- data/LICENSE.txt +0 -21
- data/README.md +0 -70
- data/Rakefile +0 -10
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/lib/utter/version.rb +0 -3
- data/utter.gemspec +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 385a5d496664a4ddfc4733fd4906203db830edae
|
4
|
+
data.tar.gz: 01a27502f0e912705b874f550028d0abb78f99de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3cf6ac3faaeb92d34079eee3bf97512a8f164e75d3b25d69c91dcf807af5fa66040c0aeb4fc993c9f06f17b55cda80fa1cf3934b684d52ba3dd2604bb8d2367
|
7
|
+
data.tar.gz: 810147a11ceee4036027ce456083d68798d26b09091f36e330004bf9b08c66d2f05e160a3df4878a5e37ce1b40d5e87ceeb9ee0e714acf50f4f5748274f6f81c
|
data/bin/utter
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'find'
|
4
|
+
require 'fileutils'
|
5
|
+
require 'optparse'
|
6
|
+
require 'rake'
|
7
|
+
#require 'rack'
|
8
|
+
#require 'utter'
|
9
|
+
|
10
|
+
Dir.glob("utils/*.rb").each do |util|
|
11
|
+
require_relative "./#{util}"
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
global = OptionParser.new do |opts|
|
16
|
+
opts.banner = ""
|
17
|
+
#opts.separator UTTER_HELP
|
18
|
+
end
|
19
|
+
global.order!
|
20
|
+
@command = ARGV.shift
|
21
|
+
|
22
|
+
Dir.glob("commands/*.rb").each do |command|
|
23
|
+
require "./#{command}"
|
24
|
+
end
|
25
|
+
|
26
|
+
# Captures the ARGV command
|
27
|
+
case @command
|
28
|
+
when "new", "n"
|
29
|
+
print "Creating a new UTTER API project"
|
30
|
+
# Loads the Rakefile
|
31
|
+
app = Rake.application
|
32
|
+
app.init
|
33
|
+
app.load_rakefile
|
34
|
+
|
35
|
+
app['new'].invoke model = "Users", ver="v1"
|
36
|
+
when "generate", "g"
|
37
|
+
@model = ARGV[0]
|
38
|
+
@auth = ARGV[1]
|
39
|
+
if "auth" == ARGV[1]
|
40
|
+
p "generating authentication for #{@model}"
|
41
|
+
end
|
42
|
+
when "server", "s"
|
43
|
+
#TODO add gem server to gemspec
|
44
|
+
# http://blog.gemnasium.com/post/62702069261/serving-ruby-gems-the-paranoid-way
|
45
|
+
|
46
|
+
#> utter setup server
|
47
|
+
# http://ruby-doc.org/stdlib-2.0.0/libdoc/rubygems/rdoc/Gem/Server.html
|
48
|
+
require 'rubygems/server'
|
49
|
+
gem_server = Gem::Server.new Gem.dir, 8089, false
|
50
|
+
gem_server.run
|
51
|
+
when "publish"
|
52
|
+
@gem = ARGV[0]
|
53
|
+
|
54
|
+
Find.find(Dir.pwd) do |path|
|
55
|
+
if (File.extname(path) == ".gemspec") && (File.basename(path).include? @gem.downcase)
|
56
|
+
@path = path
|
57
|
+
`gem build #{@path.downcase}`
|
58
|
+
end
|
59
|
+
if (File.extname(path) == ".gem") && (File.basename(path).include? @gem.downcase)
|
60
|
+
@path = path
|
61
|
+
`gem push #{@path.downcase}`
|
62
|
+
end
|
63
|
+
end
|
64
|
+
when "clean"
|
65
|
+
|
66
|
+
when "start"
|
67
|
+
@port = ARGV[0]
|
68
|
+
if ARGV[0].nil?
|
69
|
+
@port = 9393
|
70
|
+
end
|
71
|
+
#Rack::Handler::Thin.run Utter::Endpoints, :Port => @port
|
72
|
+
status = `pgrep rack`
|
73
|
+
if status.empty?
|
74
|
+
$pid = fork do
|
75
|
+
`rackup config.ru -p #{@port} &`
|
76
|
+
end
|
77
|
+
puts "utter is UP! pid: #{$pid}, port: #{@port}"
|
78
|
+
else
|
79
|
+
puts "utter is already UP"
|
80
|
+
end
|
81
|
+
when "status"
|
82
|
+
status = `pgrep rack`
|
83
|
+
if status.empty?
|
84
|
+
puts "utter is down"
|
85
|
+
else
|
86
|
+
puts "utter is up"
|
87
|
+
end
|
88
|
+
|
89
|
+
when "stop"
|
90
|
+
status = `pgrep rack`
|
91
|
+
if status.empty?
|
92
|
+
puts "utter is already down"
|
93
|
+
else
|
94
|
+
`pkill rack`
|
95
|
+
puts "utter is down"
|
96
|
+
end
|
97
|
+
when "basic_auth"
|
98
|
+
@model = ARGV[0]
|
99
|
+
#TODO creates User API for the model (default: user) and setup database
|
100
|
+
#
|
101
|
+
# use Rack::Auth::Basic, "Protected Area" do |username, password|
|
102
|
+
# username == 'foo' && password == 'bar'
|
103
|
+
# end
|
104
|
+
#
|
105
|
+
#require 'rack/ssl'
|
106
|
+
|
107
|
+
# use Rack::SSL
|
108
|
+
# $Utter.use Rack::Auth::Basic, "Restricted Area" do |username, password|
|
109
|
+
# username == 'admin' and password == 'admin'
|
110
|
+
# end
|
111
|
+
#
|
112
|
+
when "db"
|
113
|
+
@db - ARGV[0]
|
114
|
+
#Marshling user objects via redis
|
115
|
+
when "console"
|
116
|
+
require 'irb'
|
117
|
+
require 'irb/completion'
|
118
|
+
#TODO require local project files as well.
|
119
|
+
IRB.start
|
120
|
+
|
121
|
+
else
|
122
|
+
puts "Sorry command not found; try --help for more information"
|
123
|
+
end
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
# create a stub new #{} API application
|
129
|
+
|
130
|
+
#> utter new MyCompany User name, address, website
|
131
|
+
# this creates user_api.rb file in the folder <api> with the namespace MyCompany and the class UserAPI
|
132
|
+
# this creates user.rb file in the folder <models> with the namespace MyCompany and the class User with mongoid loaded and ready
|
133
|
+
|
134
|
+
# utter new project #{project_name as namespace}
|
135
|
+
# utter new api #{api_class} # creates its own inside project name namespace, gem.spec, rake, specs,
|
136
|
+
# utter new model #{model} # creates its own inside project name namespace, rake, specs
|
137
|
+
# utter server #{sets a line inside config.ru of the gem server of the company}, rake, specs
|
138
|
+
# utter publish #{publish the project as a gem to the server}
|
data/lib/utter/api.rb
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
# No code is faster than no code.
|
2
|
+
require 'rack'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module Utter
|
6
|
+
|
7
|
+
class Builder < Rack::Builder
|
8
|
+
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.helpers *ext
|
12
|
+
Utter::Builder.send :include, *ext if ext.any?
|
13
|
+
end
|
14
|
+
|
15
|
+
class Endpoint
|
16
|
+
|
17
|
+
$Utter = Utter::Builder.new
|
18
|
+
request = nil
|
19
|
+
|
20
|
+
%w[params session].map do |m|
|
21
|
+
Object.method(:define_method).(m){request.send m}
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.before &b
|
25
|
+
$Utter.use Rack::Config, &b
|
26
|
+
end
|
27
|
+
|
28
|
+
class << self
|
29
|
+
|
30
|
+
%w{get post put delete}.map do |method|
|
31
|
+
|
32
|
+
define_method(method) do |path, &block|
|
33
|
+
|
34
|
+
full = '/' + @prefix.to_s + @version.to_s + @namespace.to_s + path
|
35
|
+
|
36
|
+
$Utter.map(full) do
|
37
|
+
puts "Ready: #{full}"
|
38
|
+
run lambda { |env| [200, {"Content-Type" => "application/json"}, [$Utter.instance_exec(&block)]] }
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
def redirect path
|
47
|
+
full = '/' + @prefix.to_s + @version.to_s + @namespace.to_s + path
|
48
|
+
res = Rack::Response.new
|
49
|
+
res.redirect(full)
|
50
|
+
res.finish
|
51
|
+
|
52
|
+
#$Utter.map(full) do
|
53
|
+
# puts "Redirect: #{full}"
|
54
|
+
# run lambda { |env| [200, {"Content-Type" => "application/json"}, [$Utter.instance_exec(&block)]] }
|
55
|
+
#end
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
before do |e|
|
60
|
+
request=Rack::Request.new e;
|
61
|
+
request.params.dup.map do |k,v|
|
62
|
+
params[k.to_sym]=v
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
$Utter.use Rack::CommonLogger
|
67
|
+
$Utter.use Rack::Session::Cookie; # https://gist.github.com/noahhendrix/1509698 Authenticating with Grape
|
68
|
+
$Utter.use Rack::Lock; # simultanious requests
|
69
|
+
|
70
|
+
|
71
|
+
def self.prefix p
|
72
|
+
if !p.nil?
|
73
|
+
@prefix = p.to_s + '/'
|
74
|
+
else
|
75
|
+
nil
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.version v
|
80
|
+
if !v.nil?
|
81
|
+
@version = v.to_s + '/'
|
82
|
+
else
|
83
|
+
nil
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def self.namespace v
|
88
|
+
if !v.nil?
|
89
|
+
@namespace = v.to_s #+ '/'
|
90
|
+
else
|
91
|
+
nil
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
|
97
|
+
Endpoints = $Utter
|
98
|
+
end
|
data/lib/utter/ds.rb
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# No code is faster than no code.
|
2
|
+
#
|
3
|
+
# What makes Redis different from other key-value stores is that it provides other operations similar to INCR that can be used to model complex problems.
|
4
|
+
# This is why you can use Redis to write whole web applications without using another database like an SQL database, and without going crazy.
|
5
|
+
# Redis values can be more than strings.Redis supports Lists, Sets, Hashes, Sorted Sets, Bitmaps, and HyperLogLog types as values,
|
6
|
+
# and there are atomic operations to operate on them so we are safe even with multiple accesses to the same key.
|
7
|
+
|
8
|
+
|
9
|
+
# lpush users someusername # now i have a list of all users registered
|
10
|
+
# set users:someusername "marsheledobject for presistance" #now i have a hash of every registered user
|
11
|
+
|
12
|
+
require "redis"
|
13
|
+
|
14
|
+
module Utter
|
15
|
+
|
16
|
+
class Model < Utter::Klass
|
17
|
+
|
18
|
+
attr_accessor :id
|
19
|
+
|
20
|
+
def self.inherited utter_model
|
21
|
+
log.info "#Utter::Model: #{utter_model.to_s} initialized"
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.store
|
25
|
+
Redis.new(:host => @host, :port => @port)
|
26
|
+
end
|
27
|
+
|
28
|
+
def save
|
29
|
+
if !self.class.exists? @id
|
30
|
+
Utter::Klass.log.info "saving #{@id}"
|
31
|
+
model = (self.class.to_s.downcase + 's')
|
32
|
+
self.class.store.lpush model, @id # now i have a list of all users registered
|
33
|
+
self.class.store.set "#{model + ":" + @id}", Marshal::dump(self)
|
34
|
+
else
|
35
|
+
Utter::Klass.log.info "#{id} already exists, updating"
|
36
|
+
model = (self.class.to_s.downcase + 's')
|
37
|
+
self.class.store.set "#{model + ":" + @id}", Marshal::dump(self)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.find id
|
42
|
+
if exists? id
|
43
|
+
model = (self.to_s.downcase + 's')
|
44
|
+
Marshal::load(store.get "#{model + ":" + id}")
|
45
|
+
else
|
46
|
+
log.info "#{id} not found"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.all
|
51
|
+
store.lrange(self.to_s.downcase + "s", 0, -1)
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.index( name )
|
55
|
+
alias_method name, :id
|
56
|
+
alias_method "#{name}=".to_sym, :id=
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.exists? id
|
60
|
+
if store.lrange(self.to_s.downcase + "s", 0, -1).include? id
|
61
|
+
return true
|
62
|
+
else
|
63
|
+
return false
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
alias :save! :save
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
data/lib/utter/logger.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#TODO move to another gem 'utter/logger'
|
2
|
+
require 'logger'
|
3
|
+
require 'stringio'
|
4
|
+
|
5
|
+
module Utter
|
6
|
+
module Logging
|
7
|
+
@@logger = Logger.new STDOUT
|
8
|
+
@@logger.datetime_format = '%Y-%m-%d %H:%M:%S'
|
9
|
+
|
10
|
+
def log
|
11
|
+
@@logger
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class Klass
|
16
|
+
extend Utter::Logging
|
17
|
+
end
|
18
|
+
end
|
19
|
+
# Usage
|
20
|
+
#log.info "dd"
|
21
|
+
#log.debug "dd"
|
22
|
+
#log.warn "dd"
|
data/lib/utter.rb
CHANGED
@@ -1,46 +1,18 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
require "sinatra/json"
|
5
|
-
require 'securerandom'
|
6
|
-
require 'sinatra/cross_origin'
|
7
|
-
require 'net/http' # Net::HTTP.get('example.com', '/index.html') # => String
|
8
|
-
require 'ssd'
|
9
|
-
|
10
|
-
require "utter/version"
|
11
|
-
|
12
|
-
$log = Logger.new(STDOUT)
|
1
|
+
require_relative './utter/logger'
|
2
|
+
require_relative './utter/ds'
|
3
|
+
require_relative './utter/api'
|
13
4
|
|
5
|
+
=begin
|
14
6
|
module Utter
|
15
|
-
|
16
|
-
|
17
|
-
# https://github.com/rack/rack/blob/master/lib/rack/auth/basic.rb
|
7
|
+
def self.gem_version
|
8
|
+
Gem::Version.new VERSION::STRING
|
18
9
|
end
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
#TODO set a flag to disable this in production for security
|
26
|
-
# this helps testing APIs on localmachines as CORS fucks developers time.
|
27
|
-
# But not recommended to be set while in production enviroments
|
28
|
-
before do
|
29
|
-
response.headers["Access-Control-Allow-Origin"] = "*"
|
30
|
-
response.headers["Access-Control-Allow-Methods"] = "POST"
|
31
|
-
p response.headers.inspect
|
32
|
-
end
|
10
|
+
module VERSION
|
11
|
+
MAJOR = 1
|
12
|
+
MINOR = 0
|
13
|
+
TINY = 0
|
14
|
+
PRE = "alpha"
|
15
|
+
STRING = [MAJOR, MINOR, TINY, PRE].compact.join
|
33
16
|
end
|
34
|
-
|
35
|
-
class Model
|
36
|
-
def self.inherited(model)
|
37
|
-
model.send :include, SSD
|
38
|
-
model.extend SSD
|
39
|
-
end
|
40
|
-
|
41
|
-
#def save
|
42
|
-
# @id
|
43
|
-
#end
|
44
|
-
end
|
45
|
-
|
46
17
|
end
|
18
|
+
=end
|
metadata
CHANGED
@@ -1,105 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: utter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0.alpha
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zotherstupidguy
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.12'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.12'
|
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: minitest
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '5.0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '5.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: ssd
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
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: ssd
|
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:
|
84
|
-
email:
|
85
|
-
- zotherstupidguy@gmail.com
|
86
|
-
executables: []
|
11
|
+
date: 2015-03-01 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Utter provides a sinatra-like web DSL plus a great console commands for
|
14
|
+
creating, versioning and managing your microservices overtime.
|
15
|
+
email: zaotherstupidguy@gmail.com
|
16
|
+
executables:
|
17
|
+
- utter
|
87
18
|
extensions: []
|
88
19
|
extra_rdoc_files: []
|
89
20
|
files:
|
90
|
-
-
|
91
|
-
- ".travis.yml"
|
92
|
-
- CODE_OF_CONDUCT.md
|
93
|
-
- Gemfile
|
94
|
-
- LICENSE.txt
|
95
|
-
- README.md
|
96
|
-
- Rakefile
|
97
|
-
- bin/console
|
98
|
-
- bin/setup
|
21
|
+
- bin/utter
|
99
22
|
- lib/utter.rb
|
100
|
-
- lib/utter/
|
101
|
-
- utter.
|
102
|
-
|
23
|
+
- lib/utter/api.rb
|
24
|
+
- lib/utter/ds.rb
|
25
|
+
- lib/utter/logger.rb
|
26
|
+
homepage: http://rubygems.org/gems/utter
|
103
27
|
licenses:
|
104
28
|
- MIT
|
105
29
|
metadata: {}
|
@@ -114,13 +38,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
114
38
|
version: '0'
|
115
39
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
40
|
requirements:
|
117
|
-
- - "
|
41
|
+
- - ">"
|
118
42
|
- !ruby/object:Gem::Version
|
119
|
-
version:
|
43
|
+
version: 1.3.1
|
120
44
|
requirements: []
|
121
45
|
rubyforge_project:
|
122
|
-
rubygems_version: 2.5
|
46
|
+
rubygems_version: 2.4.5
|
123
47
|
signing_key:
|
124
48
|
specification_version: 4
|
125
|
-
summary:
|
49
|
+
summary: The way to create web microservices in ruby!
|
126
50
|
test_files: []
|
51
|
+
has_rdoc:
|
data/.gitignore
DELETED
data/.travis.yml
DELETED
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
# Contributor Code of Conduct
|
2
|
-
|
3
|
-
As contributors and maintainers of this project, and in the interest of
|
4
|
-
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
-
contribute through reporting issues, posting feature requests, updating
|
6
|
-
documentation, submitting pull requests or patches, and other activities.
|
7
|
-
|
8
|
-
We are committed to making participation in this project a harassment-free
|
9
|
-
experience for everyone, regardless of level of experience, gender, gender
|
10
|
-
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
-
body size, race, ethnicity, age, religion, or nationality.
|
12
|
-
|
13
|
-
Examples of unacceptable behavior by participants include:
|
14
|
-
|
15
|
-
* The use of sexualized language or imagery
|
16
|
-
* Personal attacks
|
17
|
-
* Trolling or insulting/derogatory comments
|
18
|
-
* Public or private harassment
|
19
|
-
* Publishing other's private information, such as physical or electronic
|
20
|
-
addresses, without explicit permission
|
21
|
-
* Other unethical or unprofessional conduct
|
22
|
-
|
23
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
-
threatening, offensive, or harmful.
|
28
|
-
|
29
|
-
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
-
fairly and consistently applying these principles to every aspect of managing
|
31
|
-
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
-
Conduct may be permanently removed from the project team.
|
33
|
-
|
34
|
-
This code of conduct applies both within project spaces and in public spaces
|
35
|
-
when an individual is representing the project or its community.
|
36
|
-
|
37
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
-
reported by contacting a project maintainer at zotherstupidguy@gmail.com. All
|
39
|
-
complaints will be reviewed and investigated and will result in a response that
|
40
|
-
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
-
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
-
incident.
|
43
|
-
|
44
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
-
version 1.3.0, available at
|
46
|
-
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
-
|
48
|
-
[homepage]: http://contributor-covenant.org
|
49
|
-
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
DELETED
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2016 zotherstupidguy
|
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.md
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
Utter
|
2
|
-
=====
|
3
|
-
|
4
|
-
Utter is microservies framework for building independently deployable services.
|
5
|
-
|
6
|
-
Example:
|
7
|
-
========
|
8
|
-
> utter deploy user@serverip
|
9
|
-
1. Uses puma and nginx Dockerfile to create a proxy container and bind it to the host server
|
10
|
-
2. this command makes a packages gem with the following structure for each endpoint and uploads it to the server
|
11
|
-
|
12
|
-
- Endpoint_name
|
13
|
-
- deploy (sourcecode)
|
14
|
-
- DATA (docker-volume)
|
15
|
-
- Dockerfile
|
16
|
-
3. Excecute the Dockerfile on the Server
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
> utter new project_name -h gitlab -g projectname
|
21
|
-
create folder structure for project_name
|
22
|
-
asks or uses gitlab username&pass to create a new group named project_name
|
23
|
-
creates a number of endpoints each with its own gitrepo locally and on the specified git host
|
24
|
-
|
25
|
-
|
26
|
-
> utter new -e endpoint_name
|
27
|
-
> utter new -m model_name
|
28
|
-
> utter new -u utility_name
|
29
|
-
> utter test -e endpoint # builds the Dockerfile, runs the container, tests it via its local IP
|
30
|
-
> utter deploy -e endpoint # checks a configuration yaml file, cp the Dockerfile of the endpoint into a remote server, builds the Dockerfile, bind it to nginx container to expose it to the world.
|
31
|
-
|
32
|
-
On the deployment server:
|
33
|
-
- Endpoint
|
34
|
-
- endpoint
|
35
|
-
- DATA (docker-volume)
|
36
|
-
|
37
|
-
What is a Microservice?
|
38
|
-
=======================
|
39
|
-
- business capability,
|
40
|
-
- automated deployment,
|
41
|
-
- intelligence in the endpoints, and
|
42
|
-
- decentralized control of languages and data.
|
43
|
-
|
44
|
-
Why Microservies?
|
45
|
-
===================
|
46
|
-
Building software is difficult, if software projects are not keen to avoid complexity, they are destined to fall into its traps.
|
47
|
-
|
48
|
-
|
49
|
-
Microservices Architucural pattern Challenges:
|
50
|
-
================================================
|
51
|
-
- Significant Operations Overhead
|
52
|
-
- Substantial DevOps Skills Required
|
53
|
-
- Implicit Interfaces
|
54
|
-
- Duplication of Effort
|
55
|
-
- Distributed System Complexity
|
56
|
-
- Asynchronicity is Difficult
|
57
|
-
- Testability Challenges
|
58
|
-
|
59
|
-
|
60
|
-
How can Utter help?
|
61
|
-
====================
|
62
|
-
- Utter deploy command deploys for each endpoint (endpoint gem + Dockerfile, DATA docker-volume for SSD), nginx image for mapping ports and services.
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
External Refs:
|
67
|
-
- http://martinfowler.com/articles/microservices.html
|
68
|
-
- http://highscalability.com/blog/2014/4/8/microservices-not-a-free-lunch.html
|
69
|
-
|
70
|
-
|
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "utter"
|
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
DELETED
data/lib/utter/version.rb
DELETED
data/utter.gemspec
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'utter/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "utter"
|
8
|
-
spec.version = Utter::VERSION
|
9
|
-
spec.authors = ["zotherstupidguy"]
|
10
|
-
spec.email = ["zotherstupidguy@gmail.com"]
|
11
|
-
|
12
|
-
spec.summary = %q{Utter is microservies framework for building independently deployable services.}
|
13
|
-
# spec.description = %q{TODO: Write a longer description or delete this line.}
|
14
|
-
spec.homepage = "https://github.com/utter-rb"
|
15
|
-
spec.license = "MIT"
|
16
|
-
|
17
|
-
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
-
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
-
#if spec.respond_to?(:metadata)
|
20
|
-
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
-
#else
|
22
|
-
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
-
#end
|
24
|
-
|
25
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
-
spec.bindir = "exe"
|
27
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
-
spec.require_paths = ["lib"]
|
29
|
-
|
30
|
-
spec.add_development_dependency "bundler", "~> 1.12"
|
31
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
32
|
-
spec.add_development_dependency "minitest", "~> 5.0"
|
33
|
-
|
34
|
-
spec.add_development_dependency "ssd"
|
35
|
-
spec.add_runtime_dependency 'ssd' #, '~> 1.1', '>= 1.1.4'
|
36
|
-
end
|