prick 0.20.2 → 0.20.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -9
- data/lib/prick/version.rb +1 -1
- data/lib/subcommand/prick-drop.rb +3 -3
- data/lib/subcommand/prick-make.rb +0 -113
- data/lib/subcommand/prick-teardown.rb +1 -1
- data/prick.gemspec +3 -22
- metadata +10 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ab5f6fc19173d14d2e5e39dd510eceafa346e402dbab8c0e04b48be623b4fae
|
4
|
+
data.tar.gz: 19a7d2c7fc9e19041c75cee34fdc91267c74f7573a93361bfa90aeafcb2fbe6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5ecd95bed34a3cbfc5e0a246cfb29171063f433d5d9d1edd9c05fe2df5758518575ebb182996c4ae3e97faab46c4adce120eea4538ee83ebacbd829a21561c5
|
7
|
+
data.tar.gz: 5edb4eb6faaa5cc15480aa18dfe11d425edb1051408d61aea44e957691da98a51d89d5bee41106dd9f5c8a31ed073820e048ff558a69027f764a036acbe5fe9b
|
data/Gemfile
CHANGED
@@ -4,12 +4,3 @@ source "https://rubygems.org"
|
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in prick_build.gemspec
|
6
6
|
gemspec
|
7
|
-
|
8
|
-
gem "rake", "~> 13.0"
|
9
|
-
gem "rspec", "~> 3.0"
|
10
|
-
|
11
|
-
gem 'shellopts', :github => 'clrgit/shellopts', branch: "master"
|
12
|
-
gem 'pg_graph', :github => 'clrgit/pg_graph', branch: "master"
|
13
|
-
gem 'pg_meta', :github => 'clrgit/pg_meta', branch: "master"
|
14
|
-
gem 'pg_conn', :github => 'clrgit/pg_conn', branch: "master"
|
15
|
-
|
data/lib/prick/version.rb
CHANGED
@@ -4,18 +4,18 @@ require 'builder/builder.rb'
|
|
4
4
|
|
5
5
|
module Prick::SubCommand
|
6
6
|
def self.drop_users(database)
|
7
|
-
PgConn.new(
|
7
|
+
PgConn.new("postgres") { |conn|
|
8
8
|
users = conn.role.list(database: database)
|
9
9
|
conn.role.drop(users, cascade: true)
|
10
10
|
}
|
11
11
|
end
|
12
12
|
|
13
13
|
def self.drop_database(database)
|
14
|
-
PgConn.new { |conn| conn.rdbms.drop database }
|
14
|
+
PgConn.new("postgres") { |conn| conn.rdbms.drop database }
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.drop_all(database)
|
18
|
-
PgConn.new { |conn|
|
18
|
+
PgConn.new("postgres") { |conn|
|
19
19
|
users = conn.role.list(database: database)
|
20
20
|
PgConn.new(database) { |db| db.role.drop(users, cascade: true) }
|
21
21
|
conn.rdbms.drop database
|
@@ -87,116 +87,3 @@ module Prick::SubCommand
|
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
|
-
__END__
|
91
|
-
require 'prick_build.rb'
|
92
|
-
|
93
|
-
require 'pg_conn'
|
94
|
-
|
95
|
-
require 'ruby-prof'
|
96
|
-
|
97
|
-
DATABASE = "mikras"
|
98
|
-
USERNAME = "mikras"
|
99
|
-
|
100
|
-
#PROFILE = true
|
101
|
-
PROFILE = false
|
102
|
-
TIME = true
|
103
|
-
#TIME = false
|
104
|
-
|
105
|
-
EPOCH = Time.at(0).utc
|
106
|
-
|
107
|
-
schema = ARGV.first
|
108
|
-
|
109
|
-
time "Program" do
|
110
|
-
RubyProf.start if PROFILE
|
111
|
-
begin
|
112
|
-
conn = nil
|
113
|
-
builder = nil
|
114
|
-
built_at = EPOCH
|
115
|
-
clean = false
|
116
|
-
create_schema = true
|
117
|
-
|
118
|
-
time "Load build object" do
|
119
|
-
PgConn.new { |super_conn|
|
120
|
-
if super_conn.rdbms.exist? DATABASE
|
121
|
-
conn = PgConn.new(DATABASE)
|
122
|
-
if conn.schema.exist_table? "prick", "versions"
|
123
|
-
built_at = conn.value("select built_at from prick.versions")
|
124
|
-
end
|
125
|
-
else
|
126
|
-
super_conn.rdbms.create DATABASE, owner: USERNAME
|
127
|
-
conn = PgConn.new(DATABASE)
|
128
|
-
clean = true
|
129
|
-
end
|
130
|
-
}
|
131
|
-
|
132
|
-
builder = Prick::Build::Builder.new(conn, "schema", clean)
|
133
|
-
|
134
|
-
if schema
|
135
|
-
builder.pool.after_schema(schema).each { |schema|
|
136
|
-
conn.schema.drop(schema, cascade: true)
|
137
|
-
builder.pool.delete_schema(schema)
|
138
|
-
}
|
139
|
-
end
|
140
|
-
|
141
|
-
touched_nodes = builder.nodes.select { |node| File.mtime(node.path) > built_at }
|
142
|
-
touched_phases = touched_nodes.map(&:phase).uniq.compact
|
143
|
-
touched_schema = touched_nodes.first&.schema
|
144
|
-
missing_schema = builder.schemas.find { |schema| !conn.schema.exist?(schema) }
|
145
|
-
build_schema = builder.schemas.find { |schema| [touched_schema, missing_schema].include? schema }
|
146
|
-
|
147
|
-
# puts "touched_nodes : #{touched_nodes.size} nodes"
|
148
|
-
# puts "touched_phases: #{touched_phases.inspect}"
|
149
|
-
# puts "touched_schema: #{touched_schema.inspect}"
|
150
|
-
# puts "missing_schema: #{missing_schema.inspect}"
|
151
|
-
# puts "build_schema : #{build_schema.inspect}"
|
152
|
-
|
153
|
-
# builder.pool.dump
|
154
|
-
|
155
|
-
if build_schema.nil?
|
156
|
-
puts "#{DATABASE} is up to date"
|
157
|
-
exit
|
158
|
-
end
|
159
|
-
|
160
|
-
if touched_phases.include?(:decl) || touched_phases.empty?
|
161
|
-
schemas = [build_schema] + builder.pool.after_schema(build_schema)
|
162
|
-
schemas.each { |schema| conn.schema.drop(schema, cascade: true) }
|
163
|
-
builder.pool.delete_schema(builder.pool.before_schema(build_schema))
|
164
|
-
elsif touched_phases.include?(:init) || touched_phases.include?(:term)
|
165
|
-
builder.pool.clear(:decl, :seed)
|
166
|
-
create_schema = false
|
167
|
-
elsif touched_phases.include?(:seed)
|
168
|
-
builder.pool.clear(:init, :decl, :term)
|
169
|
-
create_schema = false
|
170
|
-
end
|
171
|
-
|
172
|
-
# builder.pool.dump
|
173
|
-
builder.group
|
174
|
-
end
|
175
|
-
|
176
|
-
# builder.dump
|
177
|
-
# p builder.schemas
|
178
|
-
# exit
|
179
|
-
|
180
|
-
time "Execute build object" do
|
181
|
-
builder.execute(conn, create_schema: create_schema)
|
182
|
-
end
|
183
|
-
|
184
|
-
rescue Prick::Build::Error => ex
|
185
|
-
$stderr.puts ex.message
|
186
|
-
exit 1
|
187
|
-
|
188
|
-
rescue Command::Error => ex
|
189
|
-
$stderr.puts ex.message
|
190
|
-
exit 1
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
|
-
if PROFILE
|
195
|
-
profile = RubyProf.stop
|
196
|
-
# printer = RubyProf::GraphHtmlPrinter.new(profile)
|
197
|
-
printer = RubyProf::CallStackPrinter.new(profile)
|
198
|
-
File.open("t.html", "w") { |file|
|
199
|
-
printer.print(file, :min_percent => 2)
|
200
|
-
}
|
201
|
-
end
|
202
|
-
|
data/prick.gemspec
CHANGED
@@ -11,7 +11,6 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.summary = "A release control and management system for postgresql"
|
12
12
|
spec.description = "A release control and management system for postgresql"
|
13
13
|
spec.homepage = "http://www.nowhere.com/"
|
14
|
-
# spec.required_ruby_version = "~> 2.7.1"
|
15
14
|
|
16
15
|
# Specify which files should be added to the gem when it is released.
|
17
16
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -30,34 +29,16 @@ Gem::Specification.new do |spec|
|
|
30
29
|
# For more information and examples about making a new gem, checkout our
|
31
30
|
# guide at: https://bundler.io/guides/creating_gem.html
|
32
31
|
|
33
|
-
# Add your production dependencies here
|
34
|
-
# spec.add_dependency GEM [, VERSION]
|
35
32
|
spec.add_dependency "semantic"
|
36
|
-
|
37
33
|
spec.add_dependency "indented_io"
|
38
34
|
spec.add_dependency "constrain"
|
39
35
|
spec.add_dependency "forward_to"
|
40
36
|
spec.add_dependency "bootsnap"
|
41
|
-
|
42
|
-
|
43
|
-
# spec.add_development_dependency GEM [, VERSION]
|
44
|
-
spec.add_development_dependency "ruby-prof"
|
45
|
-
|
46
|
-
# Remove when fox goes a gem
|
47
|
-
spec.add_dependency "pg"
|
48
|
-
spec.add_dependency "dry-inflector"
|
49
|
-
spec.add_dependency "boolean"
|
50
|
-
spec.add_dependency "developer_exceptions"
|
37
|
+
spec.add_dependency "fixture_fox"
|
38
|
+
spec.add_dependency "postspec"
|
51
39
|
spec.add_dependency "shellopts", "~> 2.0.23"
|
52
40
|
|
53
|
-
|
54
|
-
# as siblings of this project directory
|
55
|
-
if File.directory?("#{__dir__}/.git")
|
56
|
-
local_projects = Dir["../*"].select { |path|
|
57
|
-
File.directory?(path) && File.exist?("#{path}/Gemfile")
|
58
|
-
}.map { |relpath| "#{File.absolute_path(relpath)}/lib" }
|
59
|
-
$LOAD_PATH.unshift *local_projects
|
60
|
-
end
|
41
|
+
spec.add_development_dependency "ruby-prof"
|
61
42
|
|
62
43
|
# Also un-comment in spec/spec_helper to use simplecov
|
63
44
|
# spec.add_development_dependency "simplecov"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prick
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.20.
|
4
|
+
version: 0.20.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claus Rasmussen
|
@@ -81,21 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: pg
|
84
|
+
name: fixture_fox
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
100
86
|
requirements:
|
101
87
|
- - ">="
|
@@ -109,7 +95,7 @@ dependencies:
|
|
109
95
|
- !ruby/object:Gem::Version
|
110
96
|
version: '0'
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
98
|
+
name: postspec
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
114
100
|
requirements:
|
115
101
|
- - ">="
|
@@ -123,47 +109,33 @@ dependencies:
|
|
123
109
|
- !ruby/object:Gem::Version
|
124
110
|
version: '0'
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
112
|
+
name: shellopts
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
128
114
|
requirements:
|
129
|
-
- - "
|
115
|
+
- - "~>"
|
130
116
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
117
|
+
version: 2.0.23
|
132
118
|
type: :runtime
|
133
119
|
prerelease: false
|
134
120
|
version_requirements: !ruby/object:Gem::Requirement
|
135
121
|
requirements:
|
136
|
-
- - "
|
122
|
+
- - "~>"
|
137
123
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
124
|
+
version: 2.0.23
|
139
125
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
126
|
+
name: ruby-prof
|
141
127
|
requirement: !ruby/object:Gem::Requirement
|
142
128
|
requirements:
|
143
129
|
- - ">="
|
144
130
|
- !ruby/object:Gem::Version
|
145
131
|
version: '0'
|
146
|
-
type: :
|
132
|
+
type: :development
|
147
133
|
prerelease: false
|
148
134
|
version_requirements: !ruby/object:Gem::Requirement
|
149
135
|
requirements:
|
150
136
|
- - ">="
|
151
137
|
- !ruby/object:Gem::Version
|
152
138
|
version: '0'
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: shellopts
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - "~>"
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: 2.0.23
|
160
|
-
type: :runtime
|
161
|
-
prerelease: false
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
164
|
-
- - "~>"
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: 2.0.23
|
167
139
|
description: A release control and management system for postgresql
|
168
140
|
email:
|
169
141
|
- claus.l.rasmussen@gmail.com
|