This repository has been archived by the owner on Dec 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from sanger/gpl181_openstack
Gpl181 openstack
- Loading branch information
Showing
10 changed files
with
201 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ruby-2.5.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
source "http://rubygems.org" | ||
source 'https://rubygems.org' | ||
|
||
gem 'sinatra', "~>1.0" | ||
gem 'activerecord', "~>2.3.15" | ||
gem 'sinatra' | ||
gem 'activerecord' | ||
gem 'builder' | ||
gem 'puma' | ||
|
||
group :development do | ||
gem "mysql", "~> 2.8.1" | ||
gem 'mysql2' | ||
end | ||
|
||
group :deployment do | ||
gem "mongrel_experimental" | ||
gem "mongrel_cluster" | ||
gem "activerecord-oracle_enhanced-adapter", "1.2.3" | ||
gem "ruby-oci8", "~> 2.1.0" | ||
gem 'activerecord-oracle_enhanced-adapter' | ||
gem 'ruby-oci8' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,55 @@ | ||
GEM | ||
remote: http://rubygems.org/ | ||
remote: https://rubygems.org/ | ||
specs: | ||
activerecord (2.3.15) | ||
activesupport (= 2.3.15) | ||
activerecord-oracle_enhanced-adapter (1.2.3) | ||
activerecord (>= 2.0.0) | ||
activesupport (2.3.15) | ||
cgi_multipart_eof_fix (2.5.0) | ||
daemons (1.1.0) | ||
fastthread (1.0.7) | ||
gem_plugin (0.2.3) | ||
mongrel (1.1) | ||
cgi_multipart_eof_fix (>= 2.4) | ||
daemons (>= 1.0.3) | ||
fastthread (>= 1.0.1) | ||
gem_plugin (>= 0.2.3) | ||
mongrel_cluster (1.0.5) | ||
gem_plugin (>= 0.2.3) | ||
mongrel (>= 1.0.2) | ||
mongrel_experimental (1.1) | ||
mongrel (= 1.1) | ||
mysql (2.8.1) | ||
rack (1.2.1) | ||
ruby-oci8 (2.1.5) | ||
sinatra (1.0) | ||
rack (>= 1.0) | ||
activemodel (5.2.1) | ||
activesupport (= 5.2.1) | ||
activerecord (5.2.1) | ||
activemodel (= 5.2.1) | ||
activesupport (= 5.2.1) | ||
arel (>= 9.0) | ||
activerecord-oracle_enhanced-adapter (5.2.3) | ||
activerecord (~> 5.2.0) | ||
ruby-plsql (>= 0.6.0) | ||
activesupport (5.2.1) | ||
concurrent-ruby (~> 1.0, >= 1.0.2) | ||
i18n (>= 0.7, < 2) | ||
minitest (~> 5.1) | ||
tzinfo (~> 1.1) | ||
arel (9.0.0) | ||
builder (3.2.3) | ||
concurrent-ruby (1.0.5) | ||
i18n (1.1.1) | ||
concurrent-ruby (~> 1.0) | ||
minitest (5.11.3) | ||
mustermann (1.0.3) | ||
mysql2 (0.5.2) | ||
puma (3.12.1) | ||
rack (2.0.5) | ||
rack-protection (2.0.4) | ||
rack | ||
ruby-oci8 (2.2.6.1) | ||
ruby-plsql (0.7.1) | ||
sinatra (2.0.4) | ||
mustermann (~> 1.0) | ||
rack (~> 2.0) | ||
rack-protection (= 2.0.4) | ||
tilt (~> 2.0) | ||
thread_safe (0.3.6) | ||
tilt (2.0.8) | ||
tzinfo (1.2.5) | ||
thread_safe (~> 0.1) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
activerecord (~> 2.3.15) | ||
activerecord-oracle_enhanced-adapter (= 1.2.3) | ||
mongrel_cluster | ||
mongrel_experimental | ||
mysql (~> 2.8.1) | ||
ruby-oci8 (~> 2.1.0) | ||
sinatra (~> 1.0) | ||
activerecord | ||
activerecord-oracle_enhanced-adapter | ||
builder | ||
mysql2 | ||
puma | ||
ruby-oci8 | ||
sinatra | ||
|
||
BUNDLED WITH | ||
1.17.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Plate Barcode | ||
============= | ||
|
||
Description | ||
----------- | ||
|
||
Sinatra application which will connnect to an oracle database called SNP and return a new plate barcode ID. | ||
|
||
Usage | ||
----- | ||
|
||
In the repository base directory run: | ||
|
||
``` | ||
bundle exec rackup -E development -p 3011 config.ru | ||
``` | ||
|
||
Then point your browser at: `http://localhost:3011` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#\ -w -p 3011 | ||
require "plate_barcode" | ||
require "./plate_barcode" | ||
disable :run, :reload | ||
|
||
run Sinatra::Application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
development: | ||
adapter: mysql | ||
adapter: mysql2 | ||
username: root | ||
password: | ||
database: plate_barcode_development |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'open3' | ||
|
||
module Deployed | ||
class RepoData | ||
def tag | ||
@tag ||= git_tag || read_file('TAG').strip.presence | ||
end | ||
|
||
def revision | ||
@revision ||= git_rev || read_file('REVISION').strip.presence | ||
end | ||
|
||
def branch | ||
@branch ||= git_branch || read_file('BRANCH').strip.presence | ||
end | ||
|
||
def release | ||
@release ||= read_file('RELEASE').strip | ||
end | ||
|
||
def release_url | ||
@release_url ||= read_file('REPO').strip | ||
end | ||
|
||
def revision_short | ||
@revision_short ||= revision&.slice 0..6 | ||
end | ||
|
||
def label | ||
tag.presence || branch | ||
end | ||
|
||
def major | ||
@major ||= version(:major) | ||
end | ||
|
||
def minor | ||
@minor ||= version(:minor) | ||
end | ||
|
||
def extra | ||
@extra ||= version(:extra) | ||
end | ||
|
||
def version_hash | ||
@version_hash ||= /\Arelease-(?<major>\d+)\.(?<minor>\d+)\.?(?<extra>\S*)\z/.match(label) | ||
end | ||
|
||
def version_label | ||
if major == 0 && minor == 0 && extra == 0 | ||
'WIP' | ||
else | ||
"#{major}.#{minor}.#{extra}" | ||
end | ||
end | ||
|
||
private | ||
|
||
def git_tag | ||
cmd = 'git tag -l --points-at HEAD --sort -version:refname | head -1' | ||
@git_tag ||= execute_command(cmd) | ||
end | ||
|
||
def git_rev | ||
cmd = 'git rev-parse HEAD' | ||
@git_rev ||= execute_command(cmd) | ||
end | ||
|
||
def git_branch | ||
cmd = 'git rev-parse --abbrev-ref HEAD' | ||
@git_branch ||= execute_command(cmd) | ||
end | ||
|
||
def version(rank) | ||
version_hash ? version_hash[rank] : 0 | ||
end | ||
|
||
def execute_command(cmd) | ||
_stdin, stdout, _stderr, _wait_thr = Open3.popen3(cmd) | ||
res = stdout.gets | ||
res&.strip | ||
end | ||
|
||
def read_file(filename) | ||
File.open(File.join(APP_ROOT, filename), 'r', &:readline) | ||
rescue Errno::ENOENT, EOFError | ||
'' | ||
end | ||
end | ||
|
||
ENVIRONMENT = "#{ RAILS_ENV }" | ||
|
||
REPO_DATA = RepoData.new | ||
|
||
VERSION_ID = REPO_DATA.version_label | ||
|
||
APP_NAME = 'Plate Barcode' | ||
RELEASE_NAME = REPO_DATA.release.presence || 'LOCAL' | ||
|
||
MAJOR = REPO_DATA.major | ||
MINOR = REPO_DATA.minor | ||
EXTRA = REPO_DATA.extra | ||
BRANCH = REPO_DATA.label.presence || 'unknown_branch' | ||
COMMIT = REPO_DATA.revision.presence || 'unknown_revision' | ||
ABBREV_COMMIT = REPO_DATA.revision_short.presence || 'unknown_revision' | ||
|
||
VERSION_STRING = "#{APP_NAME} #{VERSION_ID} [#{ENVIRONMENT}]" | ||
VERSION_COMMIT = "#{BRANCH}@#{ABBREV_COMMIT}" | ||
REPO_URL = REPO_DATA.release_url.presence || '#' | ||
HOSTNAME = Socket.gethostname | ||
|
||
require 'ostruct' | ||
DETAILS = OpenStruct.new( | ||
:name => APP_NAME, | ||
:version => VERSION_ID, | ||
:environment => ENVIRONMENT | ||
) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters