mikras_utils 0.16.1 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/exe/mkacl +0 -2
- data/lib/mikras.rb +31 -11
- data/lib/mikras_utils/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c816a28ca581275c40dcf3d0b66bf42948bcac6366b5cae0f3409cb58598dcd
|
4
|
+
data.tar.gz: 101f1ec84af04826df059cbfa1cd189d74c5d701da8e462c98201ea0f684e0be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32c2be8417aa64fc1826e45fc5e75c2b97e12b1b1d3cd9d7609c8fbebbb3bee712ed3fd210293031febe0b4d9818779d7eb069549ec4d16ac1f469c11894bb0c
|
7
|
+
data.tar.gz: b0e550f9ef58738abfd7274d1c53e556ea4e2a096559cb4981f35e14abaa0f28b39d39a8cfdc8ffbad1d8ffe96f1eb2aab7567db6a8dd994d886a40d55381f98
|
data/exe/mkacl
CHANGED
@@ -61,8 +61,6 @@ require 'shellopts'
|
|
61
61
|
require_relative '../lib/mikras.rb'
|
62
62
|
require_relative '../lib/mikras_utils/mkacl.rb'
|
63
63
|
|
64
|
-
PRICK_STATE_FILE = "prick.state.yml"
|
65
|
-
|
66
64
|
opts, args = ShellOpts::process(SPEC, ARGV)
|
67
65
|
file = args.extract(-1)
|
68
66
|
database = args.extract(0..1)
|
data/lib/mikras.rb
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
|
2
|
+
# General include file for Mikras scripts that sets up core constants and ruby
|
3
|
+
# include path. It is installed in a gem so that it can be found before the
|
4
|
+
# environment has been initialized
|
5
|
+
#
|
6
|
+
# require 'mikras'
|
7
|
+
# require 'mikras/lib/some-script.rb'
|
8
|
+
#
|
9
|
+
# It defines the Prick constants: PRICK_DIR, PRICK_STATE_FILE, PRICK_ENVIRONMENT_FILE
|
10
|
+
#
|
11
|
+
|
2
12
|
require 'yaml'
|
13
|
+
require 'shellopts'
|
14
|
+
require 'pg_conn'
|
3
15
|
|
4
16
|
module Find # Monkey patching standard library
|
5
17
|
def self.upfind(dir, file)
|
@@ -13,27 +25,34 @@ module Find # Monkey patching standard library
|
|
13
25
|
end
|
14
26
|
|
15
27
|
module Prick
|
16
|
-
# FIXME Hardcoded to avoid dragging in the whole prick environment. Should be
|
17
|
-
# kept in sync with Prick::PRICK_STATE_FILE
|
18
|
-
#
|
19
|
-
# TODO: Make prick.rb includable
|
20
|
-
#
|
21
28
|
PRICK_STATE_FILE = ".prick.state.yml"
|
29
|
+
PRICK_ENVIRONMENT_FILE = "prick.environment.yml"
|
22
30
|
PRICK_DIR = Find.upfind(Dir.getwd, PRICK_STATE_FILE)
|
23
|
-
|
31
|
+
|
32
|
+
$LOAD_PATH.unshift File.join(PRICK_DIR, "lib") if PRICK_DIR
|
24
33
|
end
|
25
34
|
|
35
|
+
__END__
|
36
|
+
|
37
|
+
|
26
38
|
module Mikras
|
27
39
|
MIKRAS_LIBDIR = Prick::PRICK_DIR && File.join(Prick::PRICK_DIR, "lib")
|
28
40
|
|
29
41
|
# Add project-dir/lib to search path
|
30
42
|
$LOAD_PATH.unshift MIKRAS_LIBDIR if MIKRAS_LIBDIR
|
31
43
|
|
32
|
-
# Find database/username. Called from scripts that
|
44
|
+
# Find database/username. Called from scripts that takes an optinal database and
|
33
45
|
# username argument. If the arguments are absent, the database/username is
|
34
46
|
# initialized using the PRICK_DATABASE and PRICK_USERNAME environment
|
35
|
-
# variables and if they are also absent, the PRICK_STATE_FILE is read.
|
36
|
-
#
|
47
|
+
# variables and if they are also absent, the PRICK_STATE_FILE is read.
|
48
|
+
# Returns nil if everything fails
|
49
|
+
#
|
50
|
+
# Should typically be called like this
|
51
|
+
#
|
52
|
+
# opts, args = ShellOpts.parse(SPEC, ARGV)
|
53
|
+
# credentials = Mikras.credentials(args.expect(0..2)) or
|
54
|
+
# ShellOpts.error "Can't find database"
|
55
|
+
# db = PgConn.new(*credentials)
|
37
56
|
#
|
38
57
|
def self.credentials(database_argument, username_argument = nil)
|
39
58
|
if database_argument
|
@@ -48,8 +67,9 @@ module Mikras
|
|
48
67
|
database = prick_state["database"]
|
49
68
|
username = prick_state["username"]
|
50
69
|
else
|
51
|
-
|
52
|
-
|
70
|
+
return nil
|
71
|
+
# database = ENV["USER"]
|
72
|
+
# username = ENV["USER"]
|
53
73
|
end
|
54
74
|
end
|
55
75
|
[database, username]
|
data/lib/mikras_utils/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mikras_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claus Rasmussen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg_conn
|