prick 0.20.1 → 0.20.5

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
  SHA256:
3
- metadata.gz: 2abdd6978f9dce4cf9570d2ad5165fef65541ed5e69bd6150086a30b232498a5
4
- data.tar.gz: bb1accf8f541d7197c73b14407401d91d5e3b9475b205bad46bea8851d2825c6
3
+ metadata.gz: 546c5ddee2590544bc4d77eeac96db85cbe2bcf1f752a310ead0623bd02af69c
4
+ data.tar.gz: fe5ea7a76834b33d4e50664fa379d617b7820b89b82907613fa9d7e4be9d81b4
5
5
  SHA512:
6
- metadata.gz: 951dee9f87d7ba9475bf70512b35d29720a30ec5371e2c03c00575c21a94163f3aa43bf28bfbb6a5fe80e0da63cb1154bd84f29ae671651b7aa54de0e45630e2
7
- data.tar.gz: cc5ef462d6c9ae5e1add6bb9fc53ffc4a6684c64020d24fad39327cd80218f01c031060f7c2e14a125a94caad305c658994e2ea53845f211909a4764a72f8d75
6
+ metadata.gz: f7c3c32abf035d32c787df578b7ba9a6b9f87cac4b76afb37f3293621a4dc3c7b098bf102e64fe0c9959cca75559d0b8f5273833067b76101b82f3439598bad9
7
+ data.tar.gz: b7628d68390952963b185e68bdcb8431fa86a1bc7e847ba546eaed57525ac748dedc951f6619c202dc192fe5bd03e841699d75f4e10746b013a86a44f4a79ed3
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/exe/prick CHANGED
@@ -82,7 +82,7 @@ SPEC = %(
82
82
 
83
83
  Checks file timestamps against the time of the last build and only
84
84
  rebuild affected parts of the project. KIND can be 'nodes', 'allnodes' or
85
- 'batches'
85
+ 'batches' (the default)
86
86
 
87
87
  fox! -- FILE...
88
88
  Load fox file data. Data are reset to their initial state after build
@@ -178,11 +178,11 @@ begin
178
178
  end
179
179
 
180
180
  when :build!
181
- dump = cmd.dump("batches")&.to_sym
181
+ dump = cmd.dump? ? cmd.dump("batches").to_sym : nil
182
182
  Prick::SubCommand.build(database, username, args.expect(0..1), timer: cmd.time?, dump: dump)
183
183
 
184
184
  when :make!
185
- dump = cmd.dump("batches")&.to_sym
185
+ dump = cmd.dump? ? cmd.dump("batches").to_sym : nil
186
186
  Prick::SubCommand.make(database, username, args.expect(0..1), timer: cmd.time?, dump: dump)
187
187
 
188
188
  when :fox!
@@ -222,7 +222,7 @@ begin
222
222
  when :data, :schema, :database
223
223
  raise NotImplementedError
224
224
  else
225
- raise Prick::Error, "Unknown subject: #{subject}"
225
+ raise Prick::Error, "Unknown subject: #{subject.inspect}"
226
226
  end
227
227
 
228
228
  else
data/lib/prick/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Prick
4
- VERSION = "0.20.1"
4
+ VERSION = "0.20.5"
5
5
  end
@@ -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(database) { |conn|
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
-
@@ -4,7 +4,7 @@ require 'builder/builder.rb'
4
4
 
5
5
  module Prick::SubCommand
6
6
  def self.teardown(database, username)
7
- conn = PgConn.new # Superuser connection
7
+ conn = PgConn.new "postgres" # Superuser connection
8
8
  if conn.rdbms.exist? database
9
9
  conn.rdbms.drop database
10
10
  end
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
- # Add your development dependencies here
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
- # In development mode override load paths for gems whose source are located
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.1
4
+ version: 0.20.5
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: ruby-prof
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: dry-inflector
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: boolean
112
+ name: shellopts
127
113
  requirement: !ruby/object:Gem::Requirement
128
114
  requirements:
129
- - - ">="
115
+ - - "~>"
130
116
  - !ruby/object:Gem::Version
131
- version: '0'
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: '0'
124
+ version: 2.0.23
139
125
  - !ruby/object:Gem::Dependency
140
- name: developer_exceptions
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: :runtime
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