slodd 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +2 -3
- data/Dockerfile +20 -0
- data/docker-compose.yml +26 -0
- data/lib/slodd.rb +1 -0
- data/lib/slodd/exceptions.rb +4 -0
- data/lib/slodd/github.rb +3 -1
- data/lib/slodd/runner.rb +4 -1
- data/lib/slodd/version.rb +1 -1
- data/slodd.gemspec +1 -1
- data/spec/lib/{gitub_spec.rb → github_spec.rb} +12 -0
- metadata +10 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58ad0ed388dc2f17445eb085c9e95903c2714bc0
|
4
|
+
data.tar.gz: e175c62ef7ee59e0f6caef00c4826e3d01660bdb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68d653d3f5153d9b923ada555e1008db3d51ffbfe3f8ef871bfa00687171cf1761870d0bcc91d6d5de46bbb2b627ec864012072d888c9f68dbbac473f053f984
|
7
|
+
data.tar.gz: ef32c965d69e51fa93ffcd078f34049c1e8663965ea2b10fde0c9e418e27e0783fceb5c489b936dcff493b7ac786e68800cacf6aa9bb68b6d6531e972027bbfd
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.3.5
|
data/.travis.yml
CHANGED
data/Dockerfile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
FROM quay.io/assemblyline/alpine:3.6
|
2
|
+
|
3
|
+
WORKDIR /app
|
4
|
+
|
5
|
+
COPY . .
|
6
|
+
|
7
|
+
RUN apk add --no-cache --virtual .builddeps \
|
8
|
+
build-base \
|
9
|
+
ca-certificates \
|
10
|
+
curl \
|
11
|
+
git \
|
12
|
+
mariadb-dev \
|
13
|
+
mariadb-client \
|
14
|
+
ruby$(cat .ruby-version) \
|
15
|
+
ruby$(cat .ruby-version)-dev \
|
16
|
+
ruby$(cat .ruby-version)-irb
|
17
|
+
|
18
|
+
RUN bundle install -j4 -r3
|
19
|
+
|
20
|
+
ENTRYPOINT ["bundle", "exec"]
|
data/docker-compose.yml
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
version: '3.4'
|
2
|
+
services:
|
3
|
+
mysql:
|
4
|
+
image: mysql:8
|
5
|
+
restart: always
|
6
|
+
ports:
|
7
|
+
- "3306:3306"
|
8
|
+
environment:
|
9
|
+
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
|
10
|
+
volumes:
|
11
|
+
- mysql-socket:/run/mysqld/
|
12
|
+
|
13
|
+
slodd:
|
14
|
+
build:
|
15
|
+
context: .
|
16
|
+
depends_on:
|
17
|
+
- mysql
|
18
|
+
volumes:
|
19
|
+
- type: bind
|
20
|
+
source: .
|
21
|
+
target: /app
|
22
|
+
- mysql-socket:/run/mysqld/
|
23
|
+
command: rake
|
24
|
+
|
25
|
+
volumes:
|
26
|
+
mysql-socket:
|
data/lib/slodd.rb
CHANGED
data/lib/slodd/github.rb
CHANGED
@@ -15,6 +15,8 @@ module Slodd
|
|
15
15
|
|
16
16
|
def schema
|
17
17
|
@schema ||= open(url, headers).read
|
18
|
+
rescue OpenURI::HTTPError
|
19
|
+
raise Slodd::GithubError, "Check your credentials and the schema file location!"
|
18
20
|
end
|
19
21
|
|
20
22
|
private
|
@@ -24,7 +26,7 @@ module Slodd
|
|
24
26
|
end
|
25
27
|
|
26
28
|
def branch
|
27
|
-
"?ref=#{ref}"
|
29
|
+
"?ref=#{ref}" unless ref.nil?
|
28
30
|
end
|
29
31
|
|
30
32
|
def headers
|
data/lib/slodd/runner.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require "active_record"
|
3
|
+
require "active_record/connection_adapters/abstract_mysql_adapter"
|
3
4
|
require "mysql2"
|
4
5
|
|
5
6
|
module Slodd
|
@@ -10,12 +11,14 @@ module Slodd
|
|
10
11
|
|
11
12
|
def initialize
|
12
13
|
self.schema = Config.fetcher.schema
|
14
|
+
# patch AR to work with mysql 5.7
|
15
|
+
ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::NATIVE_DATABASE_TYPES[:primary_key] = "int(11) auto_increment PRIMARY KEY" # rubocop:disable Metrics/LineLength
|
13
16
|
end
|
14
17
|
|
15
18
|
def run!
|
16
19
|
Config.databases.each do |database|
|
17
20
|
create_database(database)
|
18
|
-
eval(schema) # rubocop:disable
|
21
|
+
eval(schema) # rubocop:disable Security/Eval
|
19
22
|
end
|
20
23
|
end
|
21
24
|
|
data/lib/slodd/version.rb
CHANGED
data/slodd.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.executables = gem.files.grep(/^bin\//).map { |f| File.basename(f) }
|
19
19
|
gem.test_files = gem.files.grep(/^(test|spec|features)\//)
|
20
20
|
gem.require_paths = ["lib"]
|
21
|
-
gem.add_dependency("activerecord", "~> 3.2.22")
|
21
|
+
gem.add_dependency("activerecord", "~> 3.2.22.5")
|
22
22
|
gem.add_dependency("mysql2", "~> 0.3.10")
|
23
23
|
gem.add_development_dependency("rspec")
|
24
24
|
gem.add_development_dependency("rake")
|
@@ -70,5 +70,17 @@ describe Slodd::Github do
|
|
70
70
|
allow(schema).to receive(:read).and_return("the schema")
|
71
71
|
expect(subject.schema).to eq "the schema"
|
72
72
|
end
|
73
|
+
|
74
|
+
context "with an invalid or unauthorized token" do
|
75
|
+
let(:token) { "invalid-or-unauthorized-token" }
|
76
|
+
|
77
|
+
it "raises exception on Github 404" do
|
78
|
+
allow(subject).to receive(:open).and_raise(OpenURI::HTTPError.new("404 not found", nil))
|
79
|
+
expect { subject.schema }.to raise_exception(
|
80
|
+
Slodd::GithubError,
|
81
|
+
"Check your credentials and the schema file location!",
|
82
|
+
)
|
83
|
+
end
|
84
|
+
end
|
73
85
|
end
|
74
86
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slodd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ed Robinson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 3.2.22
|
19
|
+
version: 3.2.22.5
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 3.2.22
|
26
|
+
version: 3.2.22.5
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: mysql2
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -107,14 +107,17 @@ files:
|
|
107
107
|
- ".rspec"
|
108
108
|
- ".ruby-version"
|
109
109
|
- ".travis.yml"
|
110
|
+
- Dockerfile
|
110
111
|
- Gemfile
|
111
112
|
- LICENCE
|
112
113
|
- README.md
|
113
114
|
- Rakefile
|
114
115
|
- bin/gurl
|
115
116
|
- bin/slodd
|
117
|
+
- docker-compose.yml
|
116
118
|
- lib/slodd.rb
|
117
119
|
- lib/slodd/config.rb
|
120
|
+
- lib/slodd/exceptions.rb
|
118
121
|
- lib/slodd/github.rb
|
119
122
|
- lib/slodd/http.rb
|
120
123
|
- lib/slodd/local.rb
|
@@ -122,7 +125,7 @@ files:
|
|
122
125
|
- lib/slodd/version.rb
|
123
126
|
- slodd.gemspec
|
124
127
|
- spec/lib/config_spec.rb
|
125
|
-
- spec/lib/
|
128
|
+
- spec/lib/github_spec.rb
|
126
129
|
- spec/lib/http_spec.rb
|
127
130
|
- spec/lib/local_spec.rb
|
128
131
|
- spec/lib/runner_spec.rb
|
@@ -148,13 +151,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
151
|
version: '0'
|
149
152
|
requirements: []
|
150
153
|
rubyforge_project:
|
151
|
-
rubygems_version: 2.2.
|
154
|
+
rubygems_version: 2.5.2.1
|
152
155
|
signing_key:
|
153
156
|
specification_version: 4
|
154
157
|
summary: Schema Loading On Dependent Databases
|
155
158
|
test_files:
|
156
159
|
- spec/lib/config_spec.rb
|
157
|
-
- spec/lib/
|
160
|
+
- spec/lib/github_spec.rb
|
158
161
|
- spec/lib/http_spec.rb
|
159
162
|
- spec/lib/local_spec.rb
|
160
163
|
- spec/lib/runner_spec.rb
|