pgpass 2012.01.18 → 2022.07.27
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 +7 -0
- data/AUTHORS +3 -1
- data/CHANGELOG +24 -0
- data/MANIFEST +5 -3
- data/Rakefile +11 -10
- data/lib/pgpass/version.rb +1 -1
- data/lib/pgpass.rb +36 -41
- data/pgpass.gemspec +18 -19
- data/spec/pgpass.rb +5 -3
- data/tasks/authors.rake +13 -8
- data/tasks/bacon.rake +18 -19
- data/tasks/changelog.rake +4 -1
- data/tasks/gem.rake +9 -7
- data/tasks/manifest.rake +3 -1
- data/tasks/release.rake +29 -25
- data/tasks/reversion.rake +3 -1
- metadata +18 -21
- data/.gems +0 -2
- data/.rvmrc +0 -2
- data/.travis.yml +0 -16
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 8155f4d00f38cbb187d0c56eca49a52950c4acb7080ad00b09fbf2c640d878ee
|
|
4
|
+
data.tar.gz: 9a53c3bcfa80fba917c0a513c1aeab92f57dd8ece7dcf76ce37623600ec4e2d2
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 27295af1284f4911af6dd6a74c1fe9f995546d72f729b4d71312631a1d58230b2278b0369e8e25809c97d58196bd2ac6294e4b9fe7e64142bc30fffaa24831ca
|
|
7
|
+
data.tar.gz: 669ee0e7e6c378e1d4f96cfc4296561819a969a1df3361312773b55ba929354a50c266ef42c55e1d837e34aefb804df2cd3243b9cfb96cc21a8454a96d6d9377
|
data/AUTHORS
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
Following persons have contributed to pgpass.
|
|
2
2
|
(Sorted by number of submitted patches, then alphabetically)
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
12 Michael Fellinger <m.fellinger@gmail.com>
|
|
5
|
+
1 Michael Fellinger <michael.fellinger@iohk.io>
|
|
6
|
+
1 Trey Dempsey <trey.dempsey@gmail.com>
|
data/CHANGELOG
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
[302ee50 | 2022-07-27 12:10:17 UTC] Michael Fellinger <michael.fellinger@iohk.io>
|
|
2
|
+
|
|
3
|
+
* fix some rubocop issues and a bug in Pgpass::guess
|
|
4
|
+
|
|
5
|
+
[62a0dd9 | 2013-04-29 21:26:30 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
|
6
|
+
|
|
7
|
+
* identical warning to pg utils
|
|
8
|
+
|
|
9
|
+
[ff4d6dd | 2013-04-24 21:38:01 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
|
10
|
+
|
|
11
|
+
* update to 2.0.0
|
|
12
|
+
|
|
13
|
+
[67cf301 | 2013-04-24 21:37:52 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
|
14
|
+
|
|
15
|
+
* fix weird to_hash behaviour
|
|
16
|
+
|
|
17
|
+
[3e9b3c4 | 2012-03-25 11:01:12 UTC] Trey Dempsey <trey.dempsey@gmail.com>
|
|
18
|
+
|
|
19
|
+
* Adding warning for .pgpass permissions
|
|
20
|
+
|
|
21
|
+
[e00b3ec | 2012-02-14 16:57:46 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
|
22
|
+
|
|
23
|
+
* remove jruby and rbx from supported platforms
|
|
24
|
+
|
|
1
25
|
[5ba2bd0 | 2012-01-18 00:01:36 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
|
2
26
|
|
|
3
27
|
* Version 2012.01.18
|
data/MANIFEST
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
.gems
|
|
2
|
-
.rvmrc
|
|
3
|
-
.travis.yml
|
|
4
1
|
AUTHORS
|
|
5
2
|
CHANGELOG
|
|
6
3
|
LICENSE
|
|
7
4
|
MANIFEST
|
|
8
5
|
README.md
|
|
9
6
|
Rakefile
|
|
7
|
+
lib
|
|
8
|
+
lib/pgpass
|
|
10
9
|
lib/pgpass.rb
|
|
11
10
|
lib/pgpass/version.rb
|
|
12
11
|
pgpass.gemspec
|
|
12
|
+
spec
|
|
13
13
|
spec/pgpass.rb
|
|
14
|
+
spec/sample
|
|
14
15
|
spec/sample/invalid_permission
|
|
15
16
|
spec/sample/multiple
|
|
16
17
|
spec/sample/simple
|
|
18
|
+
tasks
|
|
17
19
|
tasks/authors.rake
|
|
18
20
|
tasks/bacon.rake
|
|
19
21
|
tasks/changelog.rake
|
data/Rakefile
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'rake/clean'
|
|
2
4
|
require 'rubygems/package_task'
|
|
3
5
|
require 'time'
|
|
@@ -8,25 +10,24 @@ PROJECT_MODULE = 'Pgpass'
|
|
|
8
10
|
PROJECT_README = 'README.md'
|
|
9
11
|
PROJECT_VERSION = (ENV['VERSION'] || Date.today.strftime('%Y.%m.%d')).dup
|
|
10
12
|
|
|
11
|
-
DEPENDENCIES = {}
|
|
13
|
+
DEPENDENCIES = {}.freeze
|
|
12
14
|
|
|
13
15
|
DEVELOPMENT_DEPENDENCIES = {
|
|
14
|
-
'bacon'
|
|
15
|
-
}
|
|
16
|
+
'bacon' => { version: '>= 1.1.0' }
|
|
17
|
+
}.freeze
|
|
16
18
|
|
|
17
|
-
GEMSPEC = Gem::Specification.new
|
|
19
|
+
GEMSPEC = Gem::Specification.new do |s|
|
|
18
20
|
s.name = 'pgpass'
|
|
19
21
|
s.author = "Michael 'manveru' Fellinger"
|
|
20
|
-
s.summary =
|
|
22
|
+
s.summary = 'Finding, parsing, and using entries in .pgpass files'
|
|
21
23
|
s.email = 'mf@rubyists.com'
|
|
22
24
|
s.homepage = 'http://github.com/manveru/pgpass'
|
|
23
25
|
s.platform = Gem::Platform::RUBY
|
|
24
26
|
s.version = PROJECT_VERSION
|
|
25
|
-
s.files =
|
|
26
|
-
s.has_rdoc = true
|
|
27
|
+
s.files = Dir['**/*'].sort
|
|
27
28
|
s.require_path = 'lib'
|
|
28
29
|
s.required_ruby_version = '>= 1.9.2'
|
|
29
|
-
|
|
30
|
+
end
|
|
30
31
|
|
|
31
32
|
DEPENDENCIES.each do |name, options|
|
|
32
33
|
GEMSPEC.add_dependency(name, options[:version])
|
|
@@ -36,8 +37,8 @@ DEVELOPMENT_DEPENDENCIES.each do |name, options|
|
|
|
36
37
|
GEMSPEC.add_development_dependency(name, options[:version])
|
|
37
38
|
end
|
|
38
39
|
|
|
39
|
-
Dir['tasks/*.rake'].each{|f| import(f) }
|
|
40
|
+
Dir['tasks/*.rake'].each { |f| import(f) }
|
|
40
41
|
|
|
41
|
-
task :
|
|
42
|
+
task default: [:bacon]
|
|
42
43
|
|
|
43
44
|
CLEAN.include('')
|
data/lib/pgpass/version.rb
CHANGED
data/lib/pgpass.rb
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'strscan'
|
|
4
|
+
require 'uri'
|
|
5
|
+
require 'etc'
|
|
6
|
+
|
|
1
7
|
# The file .pgpass in a user's home directory or the file referenced by
|
|
2
8
|
# PGPASSFILE can contain passwords to be used if the connection requires a
|
|
3
9
|
# password (and no password has been specified otherwise).
|
|
@@ -35,13 +41,8 @@
|
|
|
35
41
|
#
|
|
36
42
|
# On Microsoft Windows, it is assumed that the file is stored in a directory
|
|
37
43
|
# that is secure, so no special permissions check is made.
|
|
38
|
-
|
|
39
|
-
require 'strscan'
|
|
40
|
-
require 'uri'
|
|
41
|
-
require 'etc'
|
|
42
|
-
|
|
43
44
|
module Pgpass
|
|
44
|
-
|
|
45
|
+
Entry = Struct.new(:hostname, :port, :database, :username, :password) do
|
|
45
46
|
def self.create(hash)
|
|
46
47
|
new(*hash.values_at(*members))
|
|
47
48
|
end
|
|
@@ -52,7 +53,7 @@ module Pgpass
|
|
|
52
53
|
end
|
|
53
54
|
|
|
54
55
|
def to_url
|
|
55
|
-
uri = URI(
|
|
56
|
+
uri = URI('postgres:///')
|
|
56
57
|
uri.user = username || ENV['PGUSER'] || Etc.getlogin
|
|
57
58
|
uri.password = password || ENV['PGPASSWORD']
|
|
58
59
|
uri.host = hostname || ENV['PGHOST'] || 'localhost'
|
|
@@ -62,7 +63,7 @@ module Pgpass
|
|
|
62
63
|
end
|
|
63
64
|
|
|
64
65
|
def to_hash
|
|
65
|
-
Hash[self.class.members.map{|m| self[m] }]
|
|
66
|
+
Hash[self.class.members.map { |m| [m, self[m]] }]
|
|
66
67
|
end
|
|
67
68
|
|
|
68
69
|
def merge(other)
|
|
@@ -82,21 +83,21 @@ module Pgpass
|
|
|
82
83
|
database: complement_one(database, other.database),
|
|
83
84
|
username: complement_one(username, other.username),
|
|
84
85
|
hostname: complement_one(hostname, other.hostname),
|
|
85
|
-
port:
|
|
86
|
-
password: complement_one(password, other.password)
|
|
86
|
+
port: complement_one(port, other.port),
|
|
87
|
+
password: complement_one(password, other.password)
|
|
87
88
|
)
|
|
88
89
|
end
|
|
89
90
|
|
|
90
91
|
private
|
|
91
92
|
|
|
92
93
|
def compare(a, b)
|
|
93
|
-
b
|
|
94
|
+
b.nil? || a == b || a == '*' || b == '*'
|
|
94
95
|
end
|
|
95
96
|
|
|
96
97
|
def complement_one(a, b)
|
|
97
98
|
a = nil if a == '*'
|
|
98
99
|
b = nil if b == '*'
|
|
99
|
-
a
|
|
100
|
+
a || b
|
|
100
101
|
end
|
|
101
102
|
end
|
|
102
103
|
|
|
@@ -106,19 +107,23 @@ module Pgpass
|
|
|
106
107
|
|
|
107
108
|
def match(given_options = {})
|
|
108
109
|
search = Entry.create(
|
|
109
|
-
user:
|
|
110
|
+
user: (ENV['PGUSER'] || '*'),
|
|
110
111
|
password: ENV['PGPASSWORD'],
|
|
111
|
-
host:
|
|
112
|
-
port:
|
|
113
|
-
database: (ENV['PGDATABASE'] || '*')
|
|
112
|
+
host: (ENV['PGHOST'] || '*'),
|
|
113
|
+
port: (ENV['PGPORT'] || '*'),
|
|
114
|
+
database: (ENV['PGDATABASE'] || '*')
|
|
114
115
|
).merge(given_options)
|
|
115
116
|
|
|
116
117
|
LOCATIONS.compact.each do |path|
|
|
117
118
|
path = File.expand_path(path)
|
|
118
119
|
# consider only files
|
|
119
120
|
next unless File.file?(path)
|
|
121
|
+
|
|
120
122
|
# that aren't world/group accessible
|
|
121
|
-
|
|
123
|
+
unless (File.stat(path).mode & 0o077).zero?
|
|
124
|
+
warn %(WARNING: password file "#{path}" has group or world access; permissions should be u=rw (0600) or less)
|
|
125
|
+
next
|
|
126
|
+
end
|
|
122
127
|
|
|
123
128
|
load_file(path).each do |entry|
|
|
124
129
|
return entry.complement(search) if entry == search
|
|
@@ -129,44 +134,36 @@ module Pgpass
|
|
|
129
134
|
end
|
|
130
135
|
|
|
131
136
|
def guess(paths = PATH)
|
|
132
|
-
|
|
137
|
+
paths.each do |path|
|
|
133
138
|
begin
|
|
134
|
-
load_file(File.join(path,
|
|
135
|
-
rescue Errno::ENOENT =>
|
|
136
|
-
warn(
|
|
139
|
+
load_file(File.join(path, '.pgpass'))
|
|
140
|
+
rescue Errno::ENOENT => e
|
|
141
|
+
warn(e)
|
|
137
142
|
end
|
|
138
143
|
end
|
|
139
144
|
end
|
|
140
145
|
|
|
141
146
|
def load_file(path)
|
|
142
|
-
File.open(File.expand_path(path), 'r'){|io| load(io) }
|
|
147
|
+
File.open(File.expand_path(path), 'r') { |io| load(io) }
|
|
143
148
|
end
|
|
144
149
|
|
|
145
150
|
def load(io)
|
|
146
|
-
io.each_line.map{|line| parse_line(line) }
|
|
151
|
+
io.each_line.map { |line| parse_line(line) }
|
|
147
152
|
end
|
|
148
153
|
|
|
149
154
|
def parse_line(line)
|
|
150
155
|
sc = StringScanner.new(line)
|
|
151
156
|
entry = Entry.new
|
|
152
157
|
key_index = 0
|
|
153
|
-
value =
|
|
158
|
+
value = []
|
|
154
159
|
|
|
155
160
|
loop do
|
|
156
161
|
pos = sc.pos
|
|
157
162
|
|
|
158
|
-
if sc.bol?
|
|
159
|
-
if sc.scan(/\s*#/)
|
|
160
|
-
# commented line
|
|
161
|
-
return
|
|
162
|
-
elsif sc.scan(/\s*$/)
|
|
163
|
-
# empty line
|
|
164
|
-
return
|
|
165
|
-
end
|
|
166
|
-
end
|
|
163
|
+
return if sc.bol? && (sc.scan(/\s*#/) || sc.scan(/\s*$/))
|
|
167
164
|
|
|
168
165
|
if sc.eos?
|
|
169
|
-
entry[Entry.members[key_index]] = value
|
|
166
|
+
entry[Entry.members[key_index]] = value.join
|
|
170
167
|
return entry # end of string
|
|
171
168
|
end
|
|
172
169
|
|
|
@@ -175,21 +172,19 @@ module Pgpass
|
|
|
175
172
|
elsif sc.scan(/\\\\/)
|
|
176
173
|
value << '\\'
|
|
177
174
|
elsif sc.scan(/:/)
|
|
178
|
-
entry[Entry.members[key_index]] = value
|
|
175
|
+
entry[Entry.members[key_index]] = value.join
|
|
179
176
|
key_index += 1
|
|
180
|
-
value =
|
|
177
|
+
value = []
|
|
181
178
|
elsif sc.scan(/\r\n|\r|\n/)
|
|
182
|
-
entry[Entry.members[key_index]] = value
|
|
179
|
+
entry[Entry.members[key_index]] = value.join
|
|
183
180
|
return entry
|
|
184
181
|
elsif sc.scan(/./)
|
|
185
182
|
value << sc[0]
|
|
186
183
|
end
|
|
187
184
|
|
|
188
|
-
if sc.pos == pos
|
|
189
|
-
raise "position didn't advance, stuck in parsing"
|
|
190
|
-
end
|
|
185
|
+
raise "position didn't advance, stuck in parsing" if sc.pos == pos
|
|
191
186
|
end
|
|
192
187
|
|
|
193
|
-
|
|
188
|
+
entry
|
|
194
189
|
end
|
|
195
190
|
end
|
data/pgpass.gemspec
CHANGED
|
@@ -1,29 +1,28 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
+
# stub: pgpass 2022.07.27 ruby lib
|
|
2
3
|
|
|
3
4
|
Gem::Specification.new do |s|
|
|
4
|
-
s.name = "pgpass"
|
|
5
|
-
s.version = "
|
|
5
|
+
s.name = "pgpass".freeze
|
|
6
|
+
s.version = "2022.07.27"
|
|
6
7
|
|
|
7
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
8
|
-
s.
|
|
9
|
-
s.
|
|
10
|
-
s.
|
|
11
|
-
s.
|
|
12
|
-
s.
|
|
13
|
-
s.
|
|
14
|
-
s.required_ruby_version = Gem::Requirement.new(">= 1.9.2")
|
|
15
|
-
s.rubygems_version = "
|
|
16
|
-
s.summary = "Finding, parsing, and using entries in .pgpass files"
|
|
8
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
|
9
|
+
s.require_paths = ["lib".freeze]
|
|
10
|
+
s.authors = ["Michael 'manveru' Fellinger".freeze]
|
|
11
|
+
s.date = "1980-01-01"
|
|
12
|
+
s.email = "mf@rubyists.com".freeze
|
|
13
|
+
s.files = ["AUTHORS".freeze, "CHANGELOG".freeze, "LICENSE".freeze, "MANIFEST".freeze, "README.md".freeze, "Rakefile".freeze, "lib".freeze, "lib/pgpass".freeze, "lib/pgpass.rb".freeze, "lib/pgpass/version.rb".freeze, "pgpass.gemspec".freeze, "spec".freeze, "spec/pgpass.rb".freeze, "spec/sample".freeze, "spec/sample/invalid_permission".freeze, "spec/sample/multiple".freeze, "spec/sample/simple".freeze, "tasks".freeze, "tasks/authors.rake".freeze, "tasks/bacon.rake".freeze, "tasks/changelog.rake".freeze, "tasks/gem.rake".freeze, "tasks/manifest.rake".freeze, "tasks/release.rake".freeze, "tasks/reversion.rake".freeze]
|
|
14
|
+
s.homepage = "http://github.com/manveru/pgpass".freeze
|
|
15
|
+
s.required_ruby_version = Gem::Requirement.new(">= 1.9.2".freeze)
|
|
16
|
+
s.rubygems_version = "3.2.26".freeze
|
|
17
|
+
s.summary = "Finding, parsing, and using entries in .pgpass files".freeze
|
|
17
18
|
|
|
18
19
|
if s.respond_to? :specification_version then
|
|
19
|
-
s.specification_version =
|
|
20
|
+
s.specification_version = 4
|
|
21
|
+
end
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
else
|
|
24
|
-
s.add_dependency(%q<bacon>, [">= 1.1.0"])
|
|
25
|
-
end
|
|
23
|
+
if s.respond_to? :add_runtime_dependency then
|
|
24
|
+
s.add_development_dependency(%q<bacon>.freeze, [">= 1.1.0"])
|
|
26
25
|
else
|
|
27
|
-
s.add_dependency(%q<bacon
|
|
26
|
+
s.add_dependency(%q<bacon>.freeze, [">= 1.1.0"])
|
|
28
27
|
end
|
|
29
28
|
end
|
data/spec/pgpass.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'bacon'
|
|
2
4
|
Bacon.summary_on_exit
|
|
3
5
|
|
|
@@ -50,7 +52,7 @@ describe Pgpass do
|
|
|
50
52
|
port: 'bar:',
|
|
51
53
|
database: ':d',
|
|
52
54
|
username: 'u:',
|
|
53
|
-
password: 'p'
|
|
55
|
+
password: 'p'
|
|
54
56
|
)
|
|
55
57
|
]
|
|
56
58
|
end
|
|
@@ -64,7 +66,7 @@ describe Pgpass do
|
|
|
64
66
|
port: 'bar\\',
|
|
65
67
|
database: '\\d',
|
|
66
68
|
username: 'u',
|
|
67
|
-
password: 'p'
|
|
69
|
+
password: 'p'
|
|
68
70
|
)
|
|
69
71
|
]
|
|
70
72
|
end
|
|
@@ -73,7 +75,7 @@ describe Pgpass do
|
|
|
73
75
|
describe '::match' do
|
|
74
76
|
def with_pgpass(relative_path)
|
|
75
77
|
location = File.expand_path("../#{relative_path}", __FILE__)
|
|
76
|
-
File.chmod(
|
|
78
|
+
File.chmod(0o600, location)
|
|
77
79
|
Pgpass::LOCATIONS.unshift(location)
|
|
78
80
|
yield
|
|
79
81
|
ensure
|
data/tasks/authors.rake
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# Once git has a fix for the glibc in handling .mailmap and another fix for
|
|
2
4
|
# allowing empty mail address to be mapped in .mailmap we won't have to handle
|
|
3
5
|
# them manually.
|
|
@@ -8,12 +10,15 @@ task :authors do
|
|
|
8
10
|
|
|
9
11
|
`git shortlog -nse`.scan(/(\d+)\s(.+)\s<(.*)>$/) do |count, name, email|
|
|
10
12
|
case name
|
|
11
|
-
when
|
|
12
|
-
name
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
when 'ahoward'
|
|
14
|
+
name = 'Ara T. Howard'
|
|
15
|
+
email = 'ara.t.howard@gmail.com'
|
|
16
|
+
when 'Martin Hilbig blueonyx@dev-area.net'
|
|
17
|
+
name = 'Martin Hilbig'
|
|
18
|
+
email = 'blueonyx@dev-area.net'
|
|
19
|
+
when 'Michael Fellinger m.fellinger@gmail.com'
|
|
20
|
+
name = 'Michael Fellinger'
|
|
21
|
+
email = 'm.fellinger@gmail.com'
|
|
17
22
|
end
|
|
18
23
|
|
|
19
24
|
authors[[name, email]] += count.to_i
|
|
@@ -23,8 +28,8 @@ task :authors do
|
|
|
23
28
|
io.puts "Following persons have contributed to #{GEMSPEC.name}."
|
|
24
29
|
io.puts '(Sorted by number of submitted patches, then alphabetically)'
|
|
25
30
|
io.puts ''
|
|
26
|
-
authors.sort_by{|(n,
|
|
27
|
-
io.puts(
|
|
31
|
+
authors.sort_by { |(n, _e), c| [-c, n.downcase] }.each do |(name, email), count|
|
|
32
|
+
io.puts(format('%6d %s <%s>', count, name, email))
|
|
28
33
|
end
|
|
29
34
|
end
|
|
30
35
|
end
|
data/tasks/bacon.rake
CHANGED
|
@@ -1,60 +1,59 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
desc 'Run all bacon specs with pretty output'
|
|
4
4
|
task :bacon do
|
|
5
5
|
require 'open3'
|
|
6
|
-
require 'scanf'
|
|
7
6
|
require 'matrix'
|
|
7
|
+
require 'fileutils'
|
|
8
8
|
|
|
9
9
|
specs = PROJECT_SPECS
|
|
10
10
|
|
|
11
11
|
some_failed = false
|
|
12
12
|
specs_size = specs.size
|
|
13
|
-
len = specs.map
|
|
14
|
-
total_tests = total_assertions = total_failures = total_errors = 0
|
|
13
|
+
len = specs.map(&:size).max
|
|
15
14
|
totals = Vector[0, 0, 0, 0]
|
|
16
15
|
|
|
17
|
-
red
|
|
16
|
+
red = "\e[31m%s\e[0m"
|
|
17
|
+
yellow = "\e[33m%s\e[0m"
|
|
18
|
+
green = "\e[32m%s\e[0m"
|
|
18
19
|
left_format = "%4d/%d: %-#{len + 11}s"
|
|
19
|
-
spec_format =
|
|
20
|
+
spec_format = /(?<specifications>\d+) specifications \((?<requirements>\d+) requirements\), (?<failures>\d+) failures, (?<errors>\d+) errors/
|
|
20
21
|
|
|
21
22
|
specs.each_with_index do |spec, idx|
|
|
22
|
-
print(left_format
|
|
23
|
+
print(format(left_format, idx + 1, specs_size, spec))
|
|
23
24
|
|
|
24
|
-
Open3.popen3(FileUtils::RUBY, '-w', spec) do |
|
|
25
|
+
Open3.popen3(FileUtils::RUBY, '-w', spec) do |_sin, sout, serr|
|
|
25
26
|
out = sout.read.strip
|
|
26
27
|
err = serr.read.strip
|
|
27
28
|
|
|
28
29
|
# this is conventional, see spec/innate/state/fiber.rb for usage
|
|
29
30
|
if out =~ /^Bacon::Error: (needed .*)/
|
|
30
|
-
puts(yellow % (
|
|
31
|
+
puts(yellow % format('%6s %s', '', Regexp.last_match(1)))
|
|
31
32
|
else
|
|
32
33
|
total = nil
|
|
33
34
|
|
|
34
35
|
out.each_line do |line|
|
|
35
|
-
|
|
36
|
+
next unless spec_format =~ line
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
total = Vector[*scanned]
|
|
38
|
+
total = Vector[*$~[1..-1].map(&:to_i)]
|
|
40
39
|
break
|
|
41
40
|
end
|
|
42
41
|
|
|
43
42
|
if total
|
|
44
43
|
totals += total
|
|
45
|
-
tests, assertions, failures, errors =
|
|
44
|
+
tests, assertions, failures, errors = total.to_a
|
|
46
45
|
|
|
47
|
-
if tests
|
|
48
|
-
puts((green %
|
|
46
|
+
if tests.positive? && (failures + errors).zero?
|
|
47
|
+
puts((green % '%6d passed') % tests)
|
|
49
48
|
else
|
|
50
49
|
some_failed = true
|
|
51
|
-
puts(red %
|
|
50
|
+
puts(red % ' failed')
|
|
52
51
|
puts out unless out.empty?
|
|
53
52
|
puts err unless err.empty?
|
|
54
53
|
end
|
|
55
54
|
else
|
|
56
55
|
some_failed = true
|
|
57
|
-
puts(red %
|
|
56
|
+
puts(red % ' failed')
|
|
58
57
|
puts out unless out.empty?
|
|
59
58
|
puts err unless err.empty?
|
|
60
59
|
end
|
|
@@ -63,6 +62,6 @@ task :bacon do
|
|
|
63
62
|
end
|
|
64
63
|
|
|
65
64
|
total_color = some_failed ? red : green
|
|
66
|
-
puts(total_color % (
|
|
65
|
+
puts(total_color % ('%d specifications (%d requirements), %d failures, %d errors' % totals.to_a))
|
|
67
66
|
exit 1 if some_failed
|
|
68
67
|
end
|
data/tasks/changelog.rake
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
desc 'update changelog'
|
|
2
4
|
task :changelog do
|
|
3
5
|
File.open('CHANGELOG', 'w+') do |changelog|
|
|
4
6
|
`git log -z --abbrev-commit`.split("\0").each do |commit|
|
|
5
7
|
next if commit =~ /^Merge: \d*/
|
|
8
|
+
|
|
6
9
|
ref, author, time, _, title, _, message = commit.split("\n", 7)
|
|
7
|
-
ref
|
|
10
|
+
ref = ref[/commit ([0-9a-f]+)/, 1]
|
|
8
11
|
author = author[/Author: (.*)/, 1].strip
|
|
9
12
|
time = Time.parse(time[/Date: (.*)/, 1]).utc
|
|
10
13
|
title.strip!
|
data/tasks/gem.rake
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
task gemspec: %i[manifest changelog] do
|
|
2
4
|
gemspec_file = "#{GEMSPEC.name}.gemspec"
|
|
3
|
-
File.open(gemspec_file, 'w+'){|gs| gs.puts(GEMSPEC.to_ruby) }
|
|
5
|
+
File.open(gemspec_file, 'w+') { |gs| gs.puts(GEMSPEC.to_ruby) }
|
|
4
6
|
end
|
|
5
7
|
|
|
6
|
-
desc
|
|
7
|
-
task :
|
|
8
|
+
desc 'package and install from gemspec'
|
|
9
|
+
task install: [:gemspec] do
|
|
8
10
|
sh "gem build #{GEMSPEC.name}.gemspec"
|
|
9
11
|
sh "gem install #{GEMSPEC.name}-#{GEMSPEC.version}.gem"
|
|
10
12
|
end
|
|
11
13
|
|
|
12
|
-
desc
|
|
13
|
-
task :
|
|
14
|
-
sh %
|
|
14
|
+
desc 'uninstall the gem'
|
|
15
|
+
task uninstall: [:clean] do
|
|
16
|
+
sh %(gem uninstall -x #{GEMSPEC.name})
|
|
15
17
|
end
|
|
16
18
|
|
|
17
19
|
Gem::PackageTask.new(GEMSPEC) do |pkg|
|
data/tasks/manifest.rake
CHANGED
data/tasks/release.rake
CHANGED
|
@@ -1,41 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
namespace :release do
|
|
2
|
-
task :
|
|
3
|
-
task :
|
|
4
|
+
task prepare: %i[reversion authors gemspec]
|
|
5
|
+
task all: ['release:github', 'release:gemcutter']
|
|
4
6
|
|
|
5
7
|
desc 'Release on github'
|
|
6
|
-
task :
|
|
7
|
-
name
|
|
8
|
+
task github: :prepare do
|
|
9
|
+
name = GEMSPEC.name
|
|
10
|
+
version = GEMSPEC.version
|
|
8
11
|
|
|
9
12
|
sh('git', 'add',
|
|
10
13
|
'MANIFEST', 'CHANGELOG', 'AUTHORS',
|
|
11
14
|
"#{name}.gemspec",
|
|
12
15
|
"lib/#{name}/version.rb")
|
|
13
16
|
|
|
14
|
-
puts
|
|
15
|
-
================================================================================
|
|
16
|
-
|
|
17
|
-
I added the relevant files, you can commit them, tag the commit, and push:
|
|
18
|
-
|
|
19
|
-
git commit -m 'Version #{version}'
|
|
20
|
-
git tag -a -m '#{version}' '#{version}'
|
|
21
|
-
git push
|
|
22
|
-
|
|
23
|
-
================================================================================
|
|
17
|
+
puts <<~INSTRUCTIONS
|
|
18
|
+
================================================================================
|
|
19
|
+
|
|
20
|
+
I added the relevant files, you can commit them, tag the commit, and push:
|
|
21
|
+
|
|
22
|
+
git commit -m 'Version #{version}'
|
|
23
|
+
git tag -a -m '#{version}' '#{version}'
|
|
24
|
+
git push
|
|
25
|
+
|
|
26
|
+
================================================================================
|
|
24
27
|
INSTRUCTIONS
|
|
25
28
|
end
|
|
26
29
|
|
|
27
30
|
desc 'Release on gemcutter'
|
|
28
|
-
task :
|
|
29
|
-
name
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
task gemcutter: ['release:prepare', :package] do
|
|
32
|
+
name = GEMSPEC.name
|
|
33
|
+
version = GEMSPEC.version
|
|
34
|
+
|
|
35
|
+
puts <<~INSTRUCTIONS
|
|
36
|
+
================================================================================
|
|
37
|
+
|
|
38
|
+
To publish to gemcutter do following:
|
|
39
|
+
|
|
40
|
+
gem push pkg/#{name}-#{version}.gem
|
|
41
|
+
|
|
42
|
+
================================================================================
|
|
39
43
|
INSTRUCTIONS
|
|
40
44
|
end
|
|
41
45
|
end
|
data/tasks/reversion.rake
CHANGED
metadata
CHANGED
|
@@ -1,36 +1,35 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pgpass
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
5
|
-
prerelease:
|
|
4
|
+
version: 2022.07.27
|
|
6
5
|
platform: ruby
|
|
7
6
|
authors:
|
|
8
7
|
- Michael 'manveru' Fellinger
|
|
9
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 1980-01-01 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: bacon
|
|
16
|
-
requirement:
|
|
17
|
-
none: false
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
18
16
|
requirements:
|
|
19
|
-
- -
|
|
17
|
+
- - ">="
|
|
20
18
|
- !ruby/object:Gem::Version
|
|
21
19
|
version: 1.1.0
|
|
22
20
|
type: :development
|
|
23
21
|
prerelease: false
|
|
24
|
-
version_requirements:
|
|
25
|
-
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 1.1.0
|
|
27
|
+
description:
|
|
26
28
|
email: mf@rubyists.com
|
|
27
29
|
executables: []
|
|
28
30
|
extensions: []
|
|
29
31
|
extra_rdoc_files: []
|
|
30
32
|
files:
|
|
31
|
-
- .gems
|
|
32
|
-
- .rvmrc
|
|
33
|
-
- .travis.yml
|
|
34
33
|
- AUTHORS
|
|
35
34
|
- CHANGELOG
|
|
36
35
|
- LICENSE
|
|
@@ -53,26 +52,24 @@ files:
|
|
|
53
52
|
- tasks/reversion.rake
|
|
54
53
|
homepage: http://github.com/manveru/pgpass
|
|
55
54
|
licenses: []
|
|
56
|
-
|
|
55
|
+
metadata: {}
|
|
56
|
+
post_install_message:
|
|
57
57
|
rdoc_options: []
|
|
58
58
|
require_paths:
|
|
59
59
|
- lib
|
|
60
60
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
61
|
-
none: false
|
|
62
61
|
requirements:
|
|
63
|
-
- -
|
|
62
|
+
- - ">="
|
|
64
63
|
- !ruby/object:Gem::Version
|
|
65
64
|
version: 1.9.2
|
|
66
65
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
67
|
-
none: false
|
|
68
66
|
requirements:
|
|
69
|
-
- -
|
|
67
|
+
- - ">="
|
|
70
68
|
- !ruby/object:Gem::Version
|
|
71
69
|
version: '0'
|
|
72
70
|
requirements: []
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
specification_version: 3
|
|
71
|
+
rubygems_version: 3.2.26
|
|
72
|
+
signing_key:
|
|
73
|
+
specification_version: 4
|
|
77
74
|
summary: Finding, parsing, and using entries in .pgpass files
|
|
78
75
|
test_files: []
|
data/.gems
DELETED
data/.rvmrc
DELETED
data/.travis.yml
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
script: 'RUBYOPT=-rubygems rake bacon'
|
|
2
|
-
before_script:
|
|
3
|
-
- test -s "$HOME/.rvm/scripts/rvm" && source "$HOME/.rvm/scripts/rvm"
|
|
4
|
-
- test -s .gems && rvm gemset import .gems
|
|
5
|
-
rvm:
|
|
6
|
-
- 1.9.2
|
|
7
|
-
- 1.9.3
|
|
8
|
-
- ruby-head
|
|
9
|
-
- rbx-19mode
|
|
10
|
-
- jruby
|
|
11
|
-
notifications:
|
|
12
|
-
email:
|
|
13
|
-
- mf@rubyists.com
|
|
14
|
-
branches:
|
|
15
|
-
only:
|
|
16
|
-
- master
|