slodd 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e00d847858ca0865d23f53183c4538dbfa7f720e
4
- data.tar.gz: 1fd290d340f241b70618ee08b2b1555b5a7f1f67
3
+ metadata.gz: 41ea0b47a25d03552f7460b8dfec224c00a468db
4
+ data.tar.gz: 8a8e3fcd60153e2d5751a861f76b78bde6d36046
5
5
  SHA512:
6
- metadata.gz: 80fe84100c59f9e9a03e4bf5f5631dcb3e36880aae7124dd0d3b98e261c1989f41511ce46df038ca7b7181aa9897e11bc31fd5582cac9dabc7037f924f6164e6
7
- data.tar.gz: 569ba2572223183e828c0fc02515e166714e5bb17308962e4d8c020ab4cae40c0d64e870fd323382367e00aa1c6a53c881d6db95592b98d84b55e9a10b3174fd
6
+ metadata.gz: 6ebe9b9e37493ffab87582baa12a1d7ec4682e5e6be00da0c2041934c9ac78bd775fae669214bc8da8e7be2a5c5a75cc50f57930afa9f247ea3ea9a0d7e67ff8
7
+ data.tar.gz: 2fd6c384321317eae5e7bfc8d38e457781d0be64ac3eecf216a90b402ed64b734ec30007fa9ec4d5faf5cb053a5ac6391dc29d7013acf8640c86a546efb7b332
@@ -1,9 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.3
4
- - 2.0.0
5
- - 2.1.5
6
- - 2.2.0
3
+ - 2.1.10
4
+ - 2.2.7
5
+ - 2.3.4
7
6
  sudo: false
8
7
  addons:
9
8
  code_climate:
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in slodd.gemspec
4
4
  gemspec
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- require 'bundler/gem_tasks'
2
- require 'rspec/core/rake_task'
3
- require 'reevoocop/rake_task'
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+ require "reevoocop/rake_task"
4
4
 
5
5
  ReevooCop::RakeTask.new(:reevoocop)
6
6
  RSpec::Core::RakeTask.new(:spec)
data/bin/gurl CHANGED
@@ -1,23 +1,23 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
3
 
4
- require 'slodd'
5
- require 'optparse'
4
+ require "slodd"
5
+ require "optparse"
6
6
 
7
7
  OptionParser.new do |opt|
8
- opt.on('-g', '--github USER/REPO', 'github repo') do |g|
8
+ opt.on("-g", "--github USER/REPO", "github repo") do |g|
9
9
  Slodd::Config.github = g
10
10
  end
11
11
 
12
- opt.on('-t', '--token TOKEN', 'github token') do |t|
12
+ opt.on("-t", "--token TOKEN", "github token") do |t|
13
13
  Slodd::Config.token = t
14
14
  end
15
15
 
16
- opt.on('-r', '--ref REF', 'github ref') do |r|
16
+ opt.on("-r", "--ref REF", "github ref") do |r|
17
17
  Slodd::Config.ref = r
18
18
  end
19
19
 
20
- opt.on('-f', '--file-schema-path PATH', 'Path to schema.rb') do |f|
20
+ opt.on("-f", "--file-schema-path PATH", "Path to schema.rb") do |f|
21
21
  Slodd::Config.path = f
22
22
  end
23
23
  end.parse!
data/bin/slodd CHANGED
@@ -1,43 +1,43 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
3
 
4
- require 'slodd'
5
- require 'optparse'
4
+ require "slodd"
5
+ require "optparse"
6
6
 
7
7
  OptionParser.new do |opt|
8
- opt.on('-d', '--database DATABASES', 'Database names') do |d|
8
+ opt.on("-d", "--database DATABASES", "Database names") do |d|
9
9
  Slodd::Config.databases = d
10
10
  end
11
11
 
12
- opt.on('-s', '--schema URI', 'URI for schema.rb') do |s|
12
+ opt.on("-s", "--schema URI", "URI for schema.rb") do |s|
13
13
  Slodd::Config.url = s
14
14
  end
15
15
 
16
- opt.on('-g', '--github USER/REPO', 'github repo') do |g|
16
+ opt.on("-g", "--github USER/REPO", "github repo") do |g|
17
17
  Slodd::Config.github = g
18
18
  end
19
19
 
20
- opt.on('-t', '--token TOKEN', 'github token') do |t|
20
+ opt.on("-t", "--token TOKEN", "github token") do |t|
21
21
  Slodd::Config.token = t
22
22
  end
23
23
 
24
- opt.on('-r', '--ref REF', 'github ref') do |r|
24
+ opt.on("-r", "--ref REF", "github ref") do |r|
25
25
  Slodd::Config.ref = r
26
26
  end
27
27
 
28
- opt.on('-f', '--file-schema-path PATH', 'Path to schema.rb') do |f|
28
+ opt.on("-f", "--file-schema-path PATH", "Path to schema.rb") do |f|
29
29
  Slodd::Config.path = f
30
30
  end
31
31
 
32
- opt.on('-u', '--username USERNAME', 'MySQL Username') do |u|
32
+ opt.on("-u", "--username USERNAME", "MySQL Username") do |u|
33
33
  Slodd::Config.username = u
34
34
  end
35
35
 
36
- opt.on('-p', '--password PASSWORD', 'MySQL Password') do |p|
36
+ opt.on("-p", "--password PASSWORD", "MySQL Password") do |p|
37
37
  Slodd::Config.password = p
38
38
  end
39
39
 
40
- opt.on('-h', '--host HOST', 'MySQL Hostname') do |h|
40
+ opt.on("-h", "--host HOST", "MySQL Hostname") do |h|
41
41
  Slodd::Config.host = h
42
42
  end
43
43
  end.parse!
@@ -1,11 +1,11 @@
1
1
  # encoding: utf-8
2
- require 'slodd/version'
2
+ require "slodd/version"
3
3
 
4
- require 'slodd/github'
5
- require 'slodd/local'
6
- require 'slodd/http'
7
- require 'slodd/config'
8
- require 'slodd/runner'
4
+ require "slodd/github"
5
+ require "slodd/local"
6
+ require "slodd/http"
7
+ require "slodd/config"
8
+ require "slodd/runner"
9
9
 
10
10
  module Slodd
11
11
  end
@@ -1,17 +1,17 @@
1
1
  # encoding: utf-8
2
- require 'active_support/core_ext/module/attribute_accessors'
3
- require 'uri'
2
+ require "active_support/core_ext/module/attribute_accessors"
3
+ require "uri"
4
4
 
5
5
  module Slodd
6
6
  module Config
7
7
  mattr_accessor :path, :github, :username, :password,
8
- :host, :url, :token, :ref
8
+ :host, :url, :token, :ref
9
9
  mattr_writer :databases
10
10
 
11
11
  def self.defaults
12
- self.path = 'db/schema.rb'
13
- self.username = 'root'
14
- self.host = 'localhost'
12
+ self.path = "db/schema.rb"
13
+ self.username = "root"
14
+ self.host = "localhost"
15
15
  self.databases = nil
16
16
  end
17
17
 
@@ -27,11 +27,11 @@ module Slodd
27
27
  end
28
28
 
29
29
  def self.owner
30
- github.split('/')[0] if github
30
+ github.split("/")[0] if github
31
31
  end
32
32
 
33
33
  def self.repo
34
- github.split('/')[1] if github
34
+ github.split("/")[1] if github
35
35
  end
36
36
 
37
37
  def self.fetcher
@@ -74,12 +74,12 @@ module Slodd
74
74
  end
75
75
 
76
76
  def self.database_uri
77
- return unless ENV['DATABASE_URL']
78
- @_database_uri ||= URI.parse(ENV['DATABASE_URL'])
77
+ return unless ENV["DATABASE_URL"]
78
+ @_database_uri ||= URI.parse(ENV["DATABASE_URL"])
79
79
  end
80
80
 
81
81
  def self.settings_from_args
82
- settings = { adapter: 'mysql2', host: host, username: username }
82
+ settings = { adapter: "mysql2", host: host, username: username }
83
83
  settings.merge!(password: password) if password
84
84
  settings
85
85
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require 'open-uri'
2
+ require "open-uri"
3
3
 
4
4
  module Slodd
5
5
  class Github
@@ -29,8 +29,8 @@ module Slodd
29
29
 
30
30
  def headers
31
31
  {
32
- 'Accept' => 'application/vnd.github.3.raw',
33
- 'Authorization' => "token #{token}",
32
+ "Accept" => "application/vnd.github.3.raw",
33
+ "Authorization" => "token #{token}",
34
34
  }
35
35
  end
36
36
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require 'open-uri'
2
+ require "open-uri"
3
3
 
4
4
  module Slodd
5
5
  class Http
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
- require 'active_record'
3
- require 'mysql2'
2
+ require "active_record"
3
+ require "mysql2"
4
4
 
5
5
  module Slodd
6
6
  class Runner
@@ -39,7 +39,7 @@ module Slodd
39
39
  end
40
40
 
41
41
  def options
42
- { charset: 'utf8', collation: 'utf8_unicode_ci' }
42
+ { charset: "utf8", collation: "utf8_unicode_ci" }
43
43
  end
44
44
 
45
45
  def error_message(sqlerr, database)
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Slodd
3
- VERSION = '0.1.6'
3
+ VERSION = "0.1.7"
4
4
  end
@@ -1,26 +1,26 @@
1
1
  # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
2
+ lib = File.expand_path("../lib", __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'slodd/version'
5
- require 'English'
4
+ require "slodd/version"
5
+ require "English"
6
6
 
7
7
  Gem::Specification.new do |gem|
8
- gem.name = 'slodd'
8
+ gem.name = "slodd"
9
9
  gem.version = Slodd::VERSION
10
- gem.authors = ['Ed Robinson']
11
- gem.email = ['ed.robinson@reevoo.com']
12
- gem.description = 'Schema Loading On Dependent Databases'
13
- gem.summary = 'Schema Loading On Dependent Databases'
14
- gem.homepage = 'https://github.com/errm/slodd'
10
+ gem.authors = ["Ed Robinson"]
11
+ gem.email = ["ed.robinson@reevoo.com"]
12
+ gem.description = "Schema Loading On Dependent Databases"
13
+ gem.summary = "Schema Loading On Dependent Databases"
14
+ gem.homepage = "https://github.com/errm/slodd"
15
15
 
16
16
  gem.files = `git ls-files`.split($RS)
17
17
  gem.executables = gem.files.grep(/^bin\//).map { |f| File.basename(f) }
18
18
  gem.test_files = gem.files.grep(/^(test|spec|features)\//)
19
- gem.require_paths = ['lib']
20
- gem.add_dependency('activerecord', '~> 3.2.22')
21
- gem.add_dependency('mysql2')
22
- gem.add_development_dependency('rspec')
23
- gem.add_development_dependency('rake')
24
- gem.add_development_dependency('codeclimate-test-reporter')
25
- gem.add_development_dependency('reevoocop')
19
+ gem.require_paths = ["lib"]
20
+ gem.add_dependency("activerecord", "~> 3.2.22")
21
+ gem.add_dependency("mysql2", "~> 0.3.10")
22
+ gem.add_development_dependency("rspec")
23
+ gem.add_development_dependency("rake")
24
+ gem.add_development_dependency("codeclimate-test-reporter")
25
+ gem.add_development_dependency("reevoocop")
26
26
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require 'spec_helper'
2
+ require "spec_helper"
3
3
 
4
4
  describe Slodd::Config do
5
5
  subject { described_class }
@@ -8,205 +8,205 @@ describe Slodd::Config do
8
8
  subject.reset
9
9
  end
10
10
 
11
- describe 'attributes' do
12
- describe '.path' do
13
- it 'has a default' do
14
- expect(subject.path).to eq 'db/schema.rb'
11
+ describe "attributes" do
12
+ describe ".path" do
13
+ it "has a default" do
14
+ expect(subject.path).to eq "db/schema.rb"
15
15
  end
16
16
 
17
- it 'can be overridden' do
18
- subject.path = 'dingdong/schema.rb'
19
- expect(subject.path).to eq 'dingdong/schema.rb'
17
+ it "can be overridden" do
18
+ subject.path = "dingdong/schema.rb"
19
+ expect(subject.path).to eq "dingdong/schema.rb"
20
20
  end
21
21
  end
22
22
 
23
- describe 'github attrs' do
23
+ describe "github attrs" do
24
24
  before do
25
- subject.github = 'errm/awesome_rails_app'
25
+ subject.github = "errm/awesome_rails_app"
26
26
  end
27
27
 
28
- describe '.owner' do
29
- specify { expect(subject.owner).to eq 'errm' }
28
+ describe ".owner" do
29
+ specify { expect(subject.owner).to eq "errm" }
30
30
  end
31
31
 
32
- describe '.repo' do
33
- specify { expect(subject.repo).to eq 'awesome_rails_app' }
32
+ describe ".repo" do
33
+ specify { expect(subject.repo).to eq "awesome_rails_app" }
34
34
  end
35
35
  end
36
36
 
37
- describe '.username' do
38
- it 'has a default' do
39
- expect(subject.username).to eq 'root'
37
+ describe ".username" do
38
+ it "has a default" do
39
+ expect(subject.username).to eq "root"
40
40
  end
41
41
 
42
- it 'can be overridden' do
43
- subject.username = 'mysqlusr'
44
- expect(subject.username).to eq 'mysqlusr'
42
+ it "can be overridden" do
43
+ subject.username = "mysqlusr"
44
+ expect(subject.username).to eq "mysqlusr"
45
45
  end
46
46
  end
47
47
 
48
- describe '.password' do
49
- it 'defaults to nil' do
48
+ describe ".password" do
49
+ it "defaults to nil" do
50
50
  expect(subject.password).to be_nil
51
51
  end
52
52
 
53
- it 'can be overridden' do
54
- subject.password = 'mysqlpass'
55
- expect(subject.password).to eq 'mysqlpass'
53
+ it "can be overridden" do
54
+ subject.password = "mysqlpass"
55
+ expect(subject.password).to eq "mysqlpass"
56
56
  end
57
57
  end
58
58
 
59
- describe '.url' do
60
- it 'defaults to nil' do
59
+ describe ".url" do
60
+ it "defaults to nil" do
61
61
  expect(subject.url).to be_nil
62
62
  end
63
63
 
64
- it 'can be overridden' do
65
- subject.url = 'http://some.site.com/schema.rb'
66
- expect(subject.url).to eq 'http://some.site.com/schema.rb'
64
+ it "can be overridden" do
65
+ subject.url = "http://some.site.com/schema.rb"
66
+ expect(subject.url).to eq "http://some.site.com/schema.rb"
67
67
  end
68
68
  end
69
69
 
70
- describe '.fetcher' do
71
- it 'defaults to Local' do
70
+ describe ".fetcher" do
71
+ it "defaults to Local" do
72
72
  expect(subject.fetcher.class).to eq Slodd::Local
73
73
  end
74
74
 
75
- it 'returns Github if details are supplied' do
76
- subject.github = 'errm/awesome_rails_app'
77
- subject.token = 'oauth token'
75
+ it "returns Github if details are supplied" do
76
+ subject.github = "errm/awesome_rails_app"
77
+ subject.token = "oauth token"
78
78
  expect(subject.fetcher.class).to eq Slodd::Github
79
79
  end
80
80
 
81
- it 'rasies an argument error if no github token is supplied' do
82
- subject.github = 'errm/awesome_rails_app'
81
+ it "rasies an argument error if no github token is supplied" do
82
+ subject.github = "errm/awesome_rails_app"
83
83
  expect { subject.fetcher }.to raise_error(ArgumentError)
84
84
  end
85
85
 
86
- it 'rasies an argument error if the github string is malformed' do
87
- subject.github = 'errm'
88
- subject.token = 'oauth token'
86
+ it "rasies an argument error if the github string is malformed" do
87
+ subject.github = "errm"
88
+ subject.token = "oauth token"
89
89
  expect { subject.fetcher }.to raise_error(ArgumentError)
90
90
  end
91
91
 
92
- it 'returns Http if a url is supplied' do
93
- subject.url = 'http://some.url/schema.rb'
92
+ it "returns Http if a url is supplied" do
93
+ subject.url = "http://some.url/schema.rb"
94
94
  expect(subject.fetcher.class).to eq Slodd::Http
95
95
  end
96
96
  end
97
97
 
98
- describe '.attributes' do
99
- context 'Github' do
100
- it 'returns all the arguments needed by github' do
101
- subject.github = 'errm/awesome_rails_app'
102
- subject.token = 'oauth token'
103
- subject.ref = 'my-awesome-branch'
98
+ describe ".attributes" do
99
+ context "Github" do
100
+ it "returns all the arguments needed by github" do
101
+ subject.github = "errm/awesome_rails_app"
102
+ subject.token = "oauth token"
103
+ subject.ref = "my-awesome-branch"
104
104
  attrs = {
105
- owner: 'errm',
106
- repo: 'awesome_rails_app',
107
- token: 'oauth token',
108
- path: 'db/schema.rb',
109
- ref: 'my-awesome-branch',
105
+ owner: "errm",
106
+ repo: "awesome_rails_app",
107
+ token: "oauth token",
108
+ path: "db/schema.rb",
109
+ ref: "my-awesome-branch",
110
110
  }
111
111
  expect(subject.attributes).to eq attrs
112
112
  end
113
113
  end
114
114
 
115
- context 'Local' do
116
- it 'returns all the arguments needed by Local' do
115
+ context "Local" do
116
+ it "returns all the arguments needed by Local" do
117
117
  attrs = {
118
- path: 'db/schema.rb',
118
+ path: "db/schema.rb",
119
119
  }
120
120
  expect(subject.attributes).to eq attrs
121
121
  end
122
122
  end
123
123
 
124
- context 'Http' do
125
- it 'returns all the arguments needed by Http' do
126
- subject.url = 'http://some.url.com/db/schema.rb'
124
+ context "Http" do
125
+ it "returns all the arguments needed by Http" do
126
+ subject.url = "http://some.url.com/db/schema.rb"
127
127
  attrs = {
128
- path: 'db/schema.rb',
129
- url: 'http://some.url.com/db/schema.rb',
128
+ path: "db/schema.rb",
129
+ url: "http://some.url.com/db/schema.rb",
130
130
  }
131
131
  expect(subject.attributes).to eq attrs
132
132
  end
133
133
  end
134
134
  end
135
135
 
136
- describe '.databases' do
137
- it 'defaults to empty array' do
136
+ describe ".databases" do
137
+ it "defaults to empty array" do
138
138
  expect(subject.databases).to eq []
139
139
  end
140
140
 
141
- it 'is an array of names' do
142
- subject.databases = 'db1 db2 db3'
141
+ it "is an array of names" do
142
+ subject.databases = "db1 db2 db3"
143
143
  expect(subject.databases).to eq %w(db1 db2 db3)
144
144
  end
145
145
 
146
- it 'is an array of one name' do
147
- subject.databases = 'db1'
148
- expect(subject.databases).to eq ['db1']
146
+ it "is an array of one name" do
147
+ subject.databases = "db1"
148
+ expect(subject.databases).to eq ["db1"]
149
149
  end
150
150
  end
151
151
 
152
- describe '.database_settings' do
153
- context 'without a password' do
154
- it 'returns the settings' do
152
+ describe ".database_settings" do
153
+ context "without a password" do
154
+ it "returns the settings" do
155
155
  settings = {
156
- adapter: 'mysql2',
157
- host: 'localhost',
158
- username: 'root',
156
+ adapter: "mysql2",
157
+ host: "localhost",
158
+ username: "root",
159
159
  }
160
160
  expect(subject.database_settings).to eq settings
161
161
  end
162
162
  end
163
163
 
164
- context 'with a password' do
165
- it 'returns the settings' do
166
- subject.password = 'brian'
164
+ context "with a password" do
165
+ it "returns the settings" do
166
+ subject.password = "brian"
167
167
  settings = {
168
- adapter: 'mysql2',
169
- host: 'localhost',
170
- username: 'root',
171
- password: 'brian',
168
+ adapter: "mysql2",
169
+ host: "localhost",
170
+ username: "root",
171
+ password: "brian",
172
172
  }
173
173
  expect(subject.database_settings).to eq settings
174
174
  end
175
175
  end
176
176
 
177
- context 'with a database url in the environment' do
177
+ context "with a database url in the environment" do
178
178
  before do
179
- ENV['DATABASE_URL'] = 'mysql2://nova:sekret@127.0.0.1/foo_bar'
179
+ ENV["DATABASE_URL"] = "mysql2://nova:sekret@127.0.0.1/foo_bar"
180
180
  end
181
181
 
182
182
  after do
183
- ENV['DATABASE_URL'] = nil
183
+ ENV["DATABASE_URL"] = nil
184
184
  end
185
185
 
186
- it 'returns the settings' do
186
+ it "returns the settings" do
187
187
  settings = {
188
- adapter: 'mysql2',
189
- host: '127.0.0.1',
190
- username: 'nova',
191
- password: 'sekret',
188
+ adapter: "mysql2",
189
+ host: "127.0.0.1",
190
+ username: "nova",
191
+ password: "sekret",
192
192
  }
193
193
  expect(subject.database_settings).to eq settings
194
194
  end
195
195
 
196
- it 'sets the database' do
197
- expect(subject.databases).to eq ['foo_bar']
196
+ it "sets the database" do
197
+ expect(subject.databases).to eq ["foo_bar"]
198
198
  end
199
199
  end
200
200
  end
201
201
 
202
- describe '.host' do
203
- it 'defaults to localhost' do
204
- expect(subject.host).to eq 'localhost'
202
+ describe ".host" do
203
+ it "defaults to localhost" do
204
+ expect(subject.host).to eq "localhost"
205
205
  end
206
206
 
207
- it 'it can be overridden' do
208
- subject.host = 'db1.something.com'
209
- expect(subject.host).to eq 'db1.something.com'
207
+ it "it can be overridden" do
208
+ subject.host = "db1.something.com"
209
+ expect(subject.host).to eq "db1.something.com"
210
210
  end
211
211
  end
212
212
  end
@@ -1,11 +1,11 @@
1
1
  # encoding: utf-8
2
- require 'spec_helper'
2
+ require "spec_helper"
3
3
 
4
4
  describe Slodd::Github do
5
- let(:owner) { 'errm' }
6
- let(:repo) { 'awesome_rails_app' }
7
- let(:path) { 'database/schema.rb' }
8
- let(:token) { 'secret-oauth-token' }
5
+ let(:owner) { "errm" }
6
+ let(:repo) { "awesome_rails_app" }
7
+ let(:path) { "database/schema.rb" }
8
+ let(:token) { "secret-oauth-token" }
9
9
  let(:ref) { nil }
10
10
 
11
11
  let(:schema) { double(read: nil) }
@@ -24,8 +24,8 @@ describe Slodd::Github do
24
24
  "https://api.github.com/repos/#{owner}/#{repo}/contents/#{path}"
25
25
  end
26
26
 
27
- describe '#schema' do
28
- it 'hits the correct url' do
27
+ describe "#schema" do
28
+ it "hits the correct url" do
29
29
  allow(subject).to receive(:open) do |url, _|
30
30
  expect(url).to eq(expected_url)
31
31
  schema
@@ -34,10 +34,10 @@ describe Slodd::Github do
34
34
  subject.schema
35
35
  end
36
36
 
37
- context 'with a ref' do
38
- let(:ref) { 'exciting-feature-branch' }
37
+ context "with a ref" do
38
+ let(:ref) { "exciting-feature-branch" }
39
39
 
40
- it 'hits a url including the ref param' do
40
+ it "hits a url including the ref param" do
41
41
  allow(subject).to receive(:open) do |url, _|
42
42
  expect(url).to eq(expected_url + "?ref=#{ref}")
43
43
  schema
@@ -47,28 +47,28 @@ describe Slodd::Github do
47
47
  end
48
48
  end
49
49
 
50
- it 'uses the correct token' do
50
+ it "uses the correct token" do
51
51
  allow(subject).to receive(:open) do |_, headers|
52
- expect(headers['Authorization']).to eq "token #{token}"
52
+ expect(headers["Authorization"]).to eq "token #{token}"
53
53
  schema
54
54
  end
55
55
 
56
56
  subject.schema
57
57
  end
58
58
 
59
- it 'requests the raw mediatype' do
59
+ it "requests the raw mediatype" do
60
60
  allow(subject).to receive(:open) do |_, headers|
61
- expect(headers['Accept']).to eq 'application/vnd.github.3.raw'
61
+ expect(headers["Accept"]).to eq "application/vnd.github.3.raw"
62
62
  schema
63
63
  end
64
64
 
65
65
  subject.schema
66
66
  end
67
67
 
68
- it 'returns the schema' do
68
+ it "returns the schema" do
69
69
  allow(subject).to receive(:open).and_return(schema)
70
- allow(schema).to receive(:read).and_return('the schema')
71
- expect(subject.schema).to eq 'the schema'
70
+ allow(schema).to receive(:read).and_return("the schema")
71
+ expect(subject.schema).to eq "the schema"
72
72
  end
73
73
  end
74
74
  end
@@ -1,15 +1,15 @@
1
1
  # encoding: utf-8
2
- require 'spec_helper'
2
+ require "spec_helper"
3
3
 
4
4
  describe Slodd::Http do
5
5
  let(:url) { double }
6
- let(:schema_file) { double(read: 'the schema') }
6
+ let(:schema_file) { double(read: "the schema") }
7
7
  subject { described_class.new(url: url) }
8
8
 
9
- describe '#schema' do
10
- it 'downloads the schema from the url given' do
9
+ describe "#schema" do
10
+ it "downloads the schema from the url given" do
11
11
  expect(subject).to receive(:open).with(url).and_return(schema_file)
12
- expect(subject.schema).to eq 'the schema'
12
+ expect(subject.schema).to eq "the schema"
13
13
  end
14
14
  end
15
15
  end
@@ -1,11 +1,11 @@
1
1
  # encoding: utf-8
2
- require 'spec_helper'
2
+ require "spec_helper"
3
3
 
4
4
  describe Slodd::Local do
5
5
  subject { described_class.new(path: schema_path) }
6
6
 
7
- describe '#schema' do
8
- it 'reads the file' do
7
+ describe "#schema" do
8
+ it "reads the file" do
9
9
  expect(subject.schema).to eq File.read(schema_path)
10
10
  end
11
11
  end
@@ -1,20 +1,20 @@
1
1
  # encoding: utf-8
2
- require 'spec_helper'
2
+ require "spec_helper"
3
3
 
4
4
  describe Slodd::Runner do
5
5
  subject { described_class }
6
6
 
7
- describe '#run' do
7
+ describe "#run" do
8
8
  before do
9
9
  Slodd::Config.path = schema_path
10
- Slodd::Config.databases = 'slodd_test'
10
+ Slodd::Config.databases = "slodd_test"
11
11
  end
12
12
 
13
13
  after do
14
14
  Slodd::Config.reset
15
15
  end
16
16
 
17
- it 'creates the database ready for testing' do
17
+ it "creates the database ready for testing" do
18
18
  output = capture_stdout do
19
19
  subject.run!
20
20
  end
@@ -22,10 +22,10 @@ describe Slodd::Runner do
22
22
  expect(output).to match(/create_database\(slodd_test\)/)
23
23
 
24
24
  expect(Test.count).to eq 0
25
- Test.create(name: 'James')
25
+ Test.create(name: "James")
26
26
 
27
27
  expect(Test.count).to eq 1
28
- expect(Test.last.name).to eq 'James'
28
+ expect(Test.last.name).to eq "James"
29
29
  expect(`mysql -uroot -e "show databases;"`).to match(/slodd_test/)
30
30
 
31
31
  capture_stdout do
@@ -35,12 +35,12 @@ describe Slodd::Runner do
35
35
  expect(Test.count).to eq 0
36
36
  end
37
37
 
38
- context 'with multiple databases' do
38
+ context "with multiple databases" do
39
39
  before do
40
- Slodd::Config.databases = 'slodd_test slodd_test_2'
40
+ Slodd::Config.databases = "slodd_test slodd_test_2"
41
41
  end
42
42
 
43
- it 'creates both databases' do
43
+ it "creates both databases" do
44
44
  output = capture_stdout do
45
45
  subject.run!
46
46
  end
@@ -54,13 +54,13 @@ describe Slodd::Runner do
54
54
  end
55
55
  end
56
56
 
57
- context 'when something is failing' do
57
+ context "when something is failing" do
58
58
  before do
59
59
  allow(ActiveRecord::Base).to receive(:establish_connection)
60
- .and_raise(Mysql2::Error, 'mysql error')
60
+ .and_raise(Mysql2::Error, "mysql error")
61
61
  end
62
62
 
63
- it 'ouputs a usefull message to stderr' do
63
+ it "ouputs a usefull message to stderr" do
64
64
  message = capture_stderr do
65
65
  subject.run!
66
66
  end
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
- require 'simplecov'
3
- require 'codeclimate-test-reporter'
2
+ require "simplecov"
3
+ require "codeclimate-test-reporter"
4
4
 
5
5
  SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
6
6
  SimpleCov::Formatter::HTMLFormatter,
@@ -10,13 +10,13 @@ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
10
10
  SimpleCov.minimum_coverage 100
11
11
  SimpleCov.start
12
12
 
13
- require 'slodd'
14
- require 'stringio'
13
+ require "slodd"
14
+ require "stringio"
15
15
 
16
16
  RSpec.configure do |config|
17
17
  config.run_all_when_everything_filtered = true
18
18
  config.filter_run :focus
19
- config.order = 'random'
19
+ config.order = "random"
20
20
  end
21
21
 
22
22
  module Slodd
@@ -56,5 +56,5 @@ ensure
56
56
  end
57
57
 
58
58
  def schema_path
59
- File.join(File.dirname(__FILE__), 'support', 'schema.rb')
59
+ File.join(File.dirname(__FILE__), "support", "schema.rb")
60
60
  end
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  ActiveRecord::Schema.define(version: 1) do
3
- create_table 'tests', force: true do |t|
4
- t.string 'name'
3
+ create_table "tests", force: true do |t|
4
+ t.string "name"
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slodd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ed Robinson
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: mysql2
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 0.3.10
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 0.3.10
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement