github-ds 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +6 -0
- data/examples/example_setup.rb +14 -1
- data/examples/sql_with_connection.rb +1 -0
- data/lib/generators/github/ds/active_record_generator.rb +12 -2
- data/lib/generators/github/ds/templates/migration.rb +1 -1
- data/lib/github/ds/version.rb +1 -1
- data/lib/github/result.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3dda4d4ed9f093a4e3d098f5701f804bde5fc55
|
4
|
+
data.tar.gz: ee1f88f94fcd6986913b9c4ee1dc85269b8bb108
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcff9123a791a1ca4e81f2db9faef112331712070cf5920465c4bcd46c42eabc36b48626f80eeff886dd8791e98e0d6611be9b94b7f20ff179b17fe585ee2f9d
|
7
|
+
data.tar.gz: a30eed58460e4f4e9430f12fe41f6ab1537eb1f3b07a33d990606cb62b8e19dedd079ac210da68105ff8f30dec56b91e2f5ebd9213606882dcf6b32e31067014
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/examples/example_setup.rb
CHANGED
@@ -10,16 +10,29 @@ attempts = 0
|
|
10
10
|
begin
|
11
11
|
ActiveRecord::Base.establish_connection({
|
12
12
|
adapter: "mysql2",
|
13
|
+
username: "root",
|
13
14
|
database: "github_ds_test",
|
14
15
|
})
|
15
16
|
ActiveRecord::Base.connection.execute("DROP TABLE IF EXISTS `key_values`")
|
16
|
-
|
17
|
+
|
18
|
+
# remove db tree if present so we can start fresh
|
19
|
+
db_path = root_path.join("db")
|
20
|
+
db_path.rmtree if db_path.exist?
|
21
|
+
|
22
|
+
# use generator to create the migration
|
23
|
+
require "rails/generators"
|
24
|
+
require "generators/github/ds/active_record_generator"
|
25
|
+
Rails::Generators.invoke "github:ds:active_record"
|
26
|
+
|
27
|
+
# require migration and run it so we have the key values table
|
28
|
+
require db_path.join("migrate").children.first.to_s
|
17
29
|
ActiveRecord::Migration.verbose = false
|
18
30
|
CreateKeyValuesTable.up
|
19
31
|
rescue
|
20
32
|
raise if attempts >= 1
|
21
33
|
ActiveRecord::Base.establish_connection({
|
22
34
|
adapter: "mysql2",
|
35
|
+
username: "root",
|
23
36
|
})
|
24
37
|
ActiveRecord::Base.connection.execute("CREATE DATABASE `github_ds_test`")
|
25
38
|
attempts += 1
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require "rails/generators/active_record"
|
2
|
-
|
2
|
+
require "rails/version"
|
3
3
|
module Github
|
4
4
|
module Ds
|
5
5
|
module Generators
|
@@ -10,12 +10,22 @@ module Github
|
|
10
10
|
source_paths << File.join(File.dirname(__FILE__), "templates")
|
11
11
|
|
12
12
|
def create_migration_file
|
13
|
-
migration_template "migration.rb", "db/migrate/create_key_values_table.rb"
|
13
|
+
migration_template "migration.rb", "db/migrate/create_key_values_table.rb", migration_version: migration_version
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.next_migration_number(dirname)
|
17
17
|
::ActiveRecord::Generators::Base.next_migration_number(dirname)
|
18
18
|
end
|
19
|
+
|
20
|
+
def self.migration_version
|
21
|
+
if Rails.version.start_with?('5')
|
22
|
+
"[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def migration_version
|
27
|
+
self.class.migration_version
|
28
|
+
end
|
19
29
|
end
|
20
30
|
end
|
21
31
|
end
|
data/lib/github/ds/version.rb
CHANGED
data/lib/github/result.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github-ds
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub Open Source
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-07-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|