yus 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.envrc +3 -0
- data/.github/workflows/ruby.yml +32 -0
- data/.gitignore +10 -0
- data/Gemfile.lock +31 -42
- data/History.txt +9 -0
- data/Rakefile +0 -5
- data/bin/yusd +2 -3
- data/data/yus_dump.yml +3 -3
- data/devenv.lock +168 -0
- data/devenv.nix +50 -0
- data/devenv.yaml +8 -0
- data/lib/yus/helpers.rb +1 -2
- data/lib/yus/server.rb +0 -0
- data/lib/yus/session.rb +0 -0
- data/lib/yus/version.rb +1 -1
- data/readme.md +7 -5
- data/yus.gemspec +6 -4
- metadata +55 -27
- data/.ruby-version +0 -1
- data/.travis.yml +0 -20
- data/yus_migrate_to_utf_8 +0 -214
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a4e9d36a220ba81011adc1a2f07d20f4fca9c9b2d12bfc9cc344ea0c0e4829e
|
4
|
+
data.tar.gz: f09165485ece1c0e4d2d3650cf95c4cfc462d8bf91f91ace56ca6dfa0eedb12e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4328617716343bbae7c629c0458e6b8b2c537ec8523c7c00a58564b400fb9a931c5957cd3175a2835bbfd79d79db1c56e33ada38d401b95e624a2c5e113d43f0
|
7
|
+
data.tar.gz: 3edb6452809dea43af0d07111bbd7f2a9840041b73eb940b9cac1a393a773507202f39a1542b08877eb7ccf49dabebaba5e2c520b217ff4390171534e47f5410
|
data/.envrc
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: Ruby
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches: [ master ]
|
13
|
+
pull_request:
|
14
|
+
branches: [ master ]
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
test:
|
18
|
+
# see https://github.com/ruby/setup-ruby
|
19
|
+
strategy:
|
20
|
+
fail-fast: false
|
21
|
+
matrix:
|
22
|
+
os: [ubuntu-latest]
|
23
|
+
ruby: ['3.0', 3.1, 3.2, 3.3, 3.4, 'head']
|
24
|
+
runs-on: ${{ matrix.os }}
|
25
|
+
steps:
|
26
|
+
- uses: actions/checkout@v3
|
27
|
+
- uses: ruby/setup-ruby@v1
|
28
|
+
with:
|
29
|
+
ruby-version: ${{ matrix.ruby }}
|
30
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
31
|
+
- name: Run tests via rake test
|
32
|
+
run: bundle exec rake test
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,77 +1,66 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
yus (1.0.
|
4
|
+
yus (1.0.7)
|
5
5
|
deprecated (= 2.0.1)
|
6
6
|
highline
|
7
|
+
logger
|
7
8
|
needle
|
8
9
|
odba (>= 1.1.6)
|
9
10
|
rclconf
|
11
|
+
ydbd-pg
|
12
|
+
ydbi
|
10
13
|
|
11
14
|
GEM
|
12
15
|
remote: https://rubygems.org/
|
13
16
|
specs:
|
14
|
-
|
15
|
-
coderay (1.1.3)
|
17
|
+
bigdecimal (3.1.9)
|
16
18
|
deprecated (2.0.1)
|
17
|
-
|
18
|
-
|
19
|
+
docile (1.4.1)
|
20
|
+
drb (2.2.1)
|
19
21
|
flexmock (1.3.3)
|
20
|
-
highline (
|
21
|
-
|
22
|
-
|
22
|
+
highline (3.1.2)
|
23
|
+
reline
|
24
|
+
io-console (0.8.0)
|
25
|
+
logger (1.6.4)
|
26
|
+
minitest (5.25.4)
|
23
27
|
needle (1.3.0)
|
24
|
-
odba (1.1.
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
power_assert (1.2.0)
|
29
|
-
pry (0.13.1)
|
30
|
-
coderay (~> 1.1)
|
31
|
-
method_source (~> 1.0)
|
32
|
-
pry-byebug (3.9.0)
|
33
|
-
byebug (~> 11.0)
|
34
|
-
pry (~> 0.13.0)
|
35
|
-
rake (13.0.1)
|
28
|
+
odba (1.1.8)
|
29
|
+
pg (1.5.9)
|
30
|
+
power_assert (2.0.5)
|
31
|
+
rake (13.2.1)
|
36
32
|
rclconf (1.0.0)
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
rspec-mocks (~> 3.9.0)
|
41
|
-
rspec-core (3.9.2)
|
42
|
-
rspec-support (~> 3.9.3)
|
43
|
-
rspec-expectations (3.9.2)
|
44
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
45
|
-
rspec-support (~> 3.9.0)
|
46
|
-
rspec-mocks (3.9.1)
|
47
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
48
|
-
rspec-support (~> 3.9.0)
|
49
|
-
rspec-support (3.9.3)
|
50
|
-
simplecov (0.18.5)
|
33
|
+
reline (0.6.0)
|
34
|
+
io-console (~> 0.5)
|
35
|
+
simplecov (0.22.0)
|
51
36
|
docile (~> 1.1)
|
52
37
|
simplecov-html (~> 0.11)
|
53
|
-
|
54
|
-
|
38
|
+
simplecov_json_formatter (~> 0.1)
|
39
|
+
simplecov-html (0.13.1)
|
40
|
+
simplecov_json_formatter (0.1.4)
|
41
|
+
test-unit (3.6.7)
|
55
42
|
power_assert
|
56
|
-
ydbd-pg (0.
|
43
|
+
ydbd-pg (0.6.0)
|
57
44
|
pg
|
58
|
-
ydbi (= 0.
|
59
|
-
ydbi (0.
|
45
|
+
ydbi (= 0.6.0)
|
46
|
+
ydbi (0.6.0)
|
47
|
+
bigdecimal
|
60
48
|
deprecated (= 2.0.1)
|
49
|
+
pg (>= 1.0.0)
|
61
50
|
|
62
51
|
PLATFORMS
|
63
52
|
ruby
|
53
|
+
x86_64-linux
|
64
54
|
|
65
55
|
DEPENDENCIES
|
66
56
|
bundler
|
57
|
+
drb
|
67
58
|
flexmock (~> 1.3.0)
|
68
59
|
minitest
|
69
|
-
pry-byebug
|
70
60
|
rake
|
71
|
-
rspec
|
72
61
|
simplecov
|
73
62
|
test-unit
|
74
63
|
yus!
|
75
64
|
|
76
65
|
BUNDLED WITH
|
77
|
-
2.
|
66
|
+
2.5.22
|
data/History.txt
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
=== 1.0.7 / 08.01.2025
|
2
|
+
|
3
|
+
* Added devenv environment for Ruby 3.4 (see https://devenv.sh/)
|
4
|
+
* Fixed Rakefile
|
5
|
+
* Added minimal Ruby version 3.0 in gemspec
|
6
|
+
* (#8) Force yus.yml to be found in /etc/yus
|
7
|
+
* changelog_uri to gemspec
|
8
|
+
* Fix spelling for default cleaner_interval in bin/yusd
|
9
|
+
|
1
10
|
=== 1.0.6 / 17.06.2020
|
2
11
|
|
3
12
|
* Update for Ruby 2.7.1, remove obsolete calls to untaint/SAFE
|
data/Rakefile
CHANGED
@@ -2,10 +2,8 @@
|
|
2
2
|
# encoding: utf-8
|
3
3
|
|
4
4
|
require 'bundler/gem_tasks'
|
5
|
-
require 'rspec/core/rake_task'
|
6
5
|
require 'rake/testtask'
|
7
6
|
|
8
|
-
RSpec::Core::RakeTask.new(:spec)
|
9
7
|
|
10
8
|
# dependencies are now declared in bbmb.gemspec
|
11
9
|
desc 'Offer a gem task like hoe'
|
@@ -19,8 +17,5 @@ task :test do |t|
|
|
19
17
|
require 'test/suite'
|
20
18
|
end
|
21
19
|
|
22
|
-
|
23
|
-
task :spec => :clean
|
24
|
-
|
25
20
|
require 'rake/clean'
|
26
21
|
CLEAN.include FileList['pkg/*.gem']
|
data/bin/yusd
CHANGED
@@ -11,13 +11,12 @@ require 'drb/timeridconv'
|
|
11
11
|
require 'digest/sha2'
|
12
12
|
require 'odba/18_19_loading_compatibility'
|
13
13
|
|
14
|
-
default_dir = File.join(
|
14
|
+
default_dir = File.join('/etc', 'yus')
|
15
15
|
default_config_files = [
|
16
16
|
File.join(default_dir, 'yus.yml'),
|
17
|
-
'/etc/yus/yus.yml',
|
18
17
|
]
|
19
18
|
defaults = {
|
20
|
-
'
|
19
|
+
'cleaner_interval' => 300,
|
21
20
|
'config' => default_config_files,
|
22
21
|
'db_name' => 'yus',
|
23
22
|
'db_user' => 'yus',
|
data/data/yus_dump.yml
CHANGED
@@ -3,12 +3,12 @@ entities:
|
|
3
3
|
entity_name: !ruby/object:Yus::Entity
|
4
4
|
name: entity_name
|
5
5
|
valid_until: entity_pass
|
6
|
-
valid_from:
|
6
|
+
valid_from: 2025-01-08 17:06:06.725487367 +01:00
|
7
7
|
affiliations:
|
8
8
|
- &1 !ruby/object:Yus::Entity
|
9
9
|
name: a_yus_group
|
10
10
|
valid_until: entity_pass
|
11
|
-
valid_from:
|
11
|
+
valid_from: 2025-01-08 17:06:06.725511873 +01:00
|
12
12
|
affiliations: []
|
13
13
|
privileges:
|
14
14
|
set_password: !ruby/object:Yus::Privilege
|
@@ -30,7 +30,7 @@ entities:
|
|
30
30
|
second_name: !ruby/object:Yus::Entity
|
31
31
|
name: second_name
|
32
32
|
valid_until: entity_pass
|
33
|
-
valid_from:
|
33
|
+
valid_from: 2025-01-08 17:06:06.725501017 +01:00
|
34
34
|
affiliations: []
|
35
35
|
privileges:
|
36
36
|
set_password: !ruby/object:Yus::Privilege
|
data/devenv.lock
ADDED
@@ -0,0 +1,168 @@
|
|
1
|
+
{
|
2
|
+
"nodes": {
|
3
|
+
"devenv": {
|
4
|
+
"locked": {
|
5
|
+
"dir": "src/modules",
|
6
|
+
"lastModified": 1736273305,
|
7
|
+
"owner": "cachix",
|
8
|
+
"repo": "devenv",
|
9
|
+
"rev": "cc48e044747cef4e4f69897e20a100adf5b716a3",
|
10
|
+
"type": "github"
|
11
|
+
},
|
12
|
+
"original": {
|
13
|
+
"dir": "src/modules",
|
14
|
+
"owner": "cachix",
|
15
|
+
"repo": "devenv",
|
16
|
+
"type": "github"
|
17
|
+
}
|
18
|
+
},
|
19
|
+
"flake-compat": {
|
20
|
+
"flake": false,
|
21
|
+
"locked": {
|
22
|
+
"lastModified": 1733328505,
|
23
|
+
"owner": "edolstra",
|
24
|
+
"repo": "flake-compat",
|
25
|
+
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
|
26
|
+
"type": "github"
|
27
|
+
},
|
28
|
+
"original": {
|
29
|
+
"owner": "edolstra",
|
30
|
+
"repo": "flake-compat",
|
31
|
+
"type": "github"
|
32
|
+
}
|
33
|
+
},
|
34
|
+
"flake-compat_2": {
|
35
|
+
"flake": false,
|
36
|
+
"locked": {
|
37
|
+
"lastModified": 1733328505,
|
38
|
+
"owner": "edolstra",
|
39
|
+
"repo": "flake-compat",
|
40
|
+
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
|
41
|
+
"type": "github"
|
42
|
+
},
|
43
|
+
"original": {
|
44
|
+
"owner": "edolstra",
|
45
|
+
"repo": "flake-compat",
|
46
|
+
"type": "github"
|
47
|
+
}
|
48
|
+
},
|
49
|
+
"flake-utils": {
|
50
|
+
"inputs": {
|
51
|
+
"systems": "systems"
|
52
|
+
},
|
53
|
+
"locked": {
|
54
|
+
"lastModified": 1731533236,
|
55
|
+
"owner": "numtide",
|
56
|
+
"repo": "flake-utils",
|
57
|
+
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
58
|
+
"type": "github"
|
59
|
+
},
|
60
|
+
"original": {
|
61
|
+
"owner": "numtide",
|
62
|
+
"repo": "flake-utils",
|
63
|
+
"type": "github"
|
64
|
+
}
|
65
|
+
},
|
66
|
+
"gitignore": {
|
67
|
+
"inputs": {
|
68
|
+
"nixpkgs": [
|
69
|
+
"pre-commit-hooks",
|
70
|
+
"nixpkgs"
|
71
|
+
]
|
72
|
+
},
|
73
|
+
"locked": {
|
74
|
+
"lastModified": 1709087332,
|
75
|
+
"owner": "hercules-ci",
|
76
|
+
"repo": "gitignore.nix",
|
77
|
+
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
|
78
|
+
"type": "github"
|
79
|
+
},
|
80
|
+
"original": {
|
81
|
+
"owner": "hercules-ci",
|
82
|
+
"repo": "gitignore.nix",
|
83
|
+
"type": "github"
|
84
|
+
}
|
85
|
+
},
|
86
|
+
"nixpkgs": {
|
87
|
+
"locked": {
|
88
|
+
"lastModified": 1736200483,
|
89
|
+
"owner": "NixOS",
|
90
|
+
"repo": "nixpkgs",
|
91
|
+
"rev": "3f0a8ac25fb674611b98089ca3a5dd6480175751",
|
92
|
+
"type": "github"
|
93
|
+
},
|
94
|
+
"original": {
|
95
|
+
"owner": "NixOS",
|
96
|
+
"ref": "nixos-24.11",
|
97
|
+
"repo": "nixpkgs",
|
98
|
+
"type": "github"
|
99
|
+
}
|
100
|
+
},
|
101
|
+
"nixpkgs-ruby": {
|
102
|
+
"inputs": {
|
103
|
+
"flake-compat": "flake-compat",
|
104
|
+
"flake-utils": "flake-utils",
|
105
|
+
"nixpkgs": [
|
106
|
+
"nixpkgs"
|
107
|
+
]
|
108
|
+
},
|
109
|
+
"locked": {
|
110
|
+
"lastModified": 1735192621,
|
111
|
+
"owner": "bobvanderlinden",
|
112
|
+
"repo": "nixpkgs-ruby",
|
113
|
+
"rev": "602c528c8228f231f912c6d117703a1700464202",
|
114
|
+
"type": "github"
|
115
|
+
},
|
116
|
+
"original": {
|
117
|
+
"owner": "bobvanderlinden",
|
118
|
+
"repo": "nixpkgs-ruby",
|
119
|
+
"type": "github"
|
120
|
+
}
|
121
|
+
},
|
122
|
+
"pre-commit-hooks": {
|
123
|
+
"inputs": {
|
124
|
+
"flake-compat": "flake-compat_2",
|
125
|
+
"gitignore": "gitignore",
|
126
|
+
"nixpkgs": [
|
127
|
+
"nixpkgs"
|
128
|
+
]
|
129
|
+
},
|
130
|
+
"locked": {
|
131
|
+
"lastModified": 1735882644,
|
132
|
+
"owner": "cachix",
|
133
|
+
"repo": "pre-commit-hooks.nix",
|
134
|
+
"rev": "a5a961387e75ae44cc20f0a57ae463da5e959656",
|
135
|
+
"type": "github"
|
136
|
+
},
|
137
|
+
"original": {
|
138
|
+
"owner": "cachix",
|
139
|
+
"repo": "pre-commit-hooks.nix",
|
140
|
+
"type": "github"
|
141
|
+
}
|
142
|
+
},
|
143
|
+
"root": {
|
144
|
+
"inputs": {
|
145
|
+
"devenv": "devenv",
|
146
|
+
"nixpkgs": "nixpkgs",
|
147
|
+
"nixpkgs-ruby": "nixpkgs-ruby",
|
148
|
+
"pre-commit-hooks": "pre-commit-hooks"
|
149
|
+
}
|
150
|
+
},
|
151
|
+
"systems": {
|
152
|
+
"locked": {
|
153
|
+
"lastModified": 1681028828,
|
154
|
+
"owner": "nix-systems",
|
155
|
+
"repo": "default",
|
156
|
+
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
157
|
+
"type": "github"
|
158
|
+
},
|
159
|
+
"original": {
|
160
|
+
"owner": "nix-systems",
|
161
|
+
"repo": "default",
|
162
|
+
"type": "github"
|
163
|
+
}
|
164
|
+
}
|
165
|
+
},
|
166
|
+
"root": "root",
|
167
|
+
"version": 7
|
168
|
+
}
|
data/devenv.nix
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# Please look at the file [oddb.org/devenv.README.md](https://github.com/zdavatz/oddb.org/blob/ruby-3.2/devenv.README.md)
|
2
|
+
{ pkgs, ... }:
|
3
|
+
|
4
|
+
{
|
5
|
+
env.GREET = "devenv";
|
6
|
+
packages = [ pkgs.git pkgs.libyaml ]; # after I added pkgs.openssl here, I could no longer call devenup because of a glibc mismatch
|
7
|
+
# therefore I ${pkgs.openssl}/bin/openssl in the enterShell
|
8
|
+
|
9
|
+
enterShell = ''
|
10
|
+
echo This is the devenv shell for oddb2xml
|
11
|
+
git --version
|
12
|
+
ruby --version
|
13
|
+
psql --version
|
14
|
+
OLD_YUS_CRT=`git status --porcelain data;`
|
15
|
+
if [[ -z $OLD_YUS_CRT ]]; then
|
16
|
+
echo Must replace old yus certificat from 2006
|
17
|
+
cd data
|
18
|
+
pwd
|
19
|
+
${pkgs.openssl}/bin/openssl req -nodes -new -x509 -key yus.key -out yus.crt -subj "/C=CH/ST=Zurich/L=Zurich/O=ywesee GmbH/OU=IT Department CI/CN=ywesee.com"
|
20
|
+
else
|
21
|
+
echo Found changed data/yus.key
|
22
|
+
fi
|
23
|
+
bundle install
|
24
|
+
'';
|
25
|
+
|
26
|
+
languages.ruby.enable = true;
|
27
|
+
languages.ruby.version = "3.4";
|
28
|
+
services.postgres = {
|
29
|
+
enable = true;
|
30
|
+
package = pkgs.postgresql_16;
|
31
|
+
listen_addresses = "0.0.0.0";
|
32
|
+
port = 5435;
|
33
|
+
|
34
|
+
initialDatabases = [
|
35
|
+
{ name = "yus"; }
|
36
|
+
];
|
37
|
+
|
38
|
+
initdbArgs =
|
39
|
+
[
|
40
|
+
"--locale=C"
|
41
|
+
"--encoding=UTF8"
|
42
|
+
];
|
43
|
+
|
44
|
+
initialScript = ''
|
45
|
+
create role yus superuser login password null;
|
46
|
+
\connect yus;
|
47
|
+
\i ../22:20-postgresql_database-yus-backup
|
48
|
+
'';
|
49
|
+
};
|
50
|
+
}
|
data/devenv.yaml
ADDED
data/lib/yus/helpers.rb
CHANGED
@@ -39,10 +39,9 @@ module Yus
|
|
39
39
|
EOF
|
40
40
|
exit
|
41
41
|
end
|
42
|
-
default_dir =
|
42
|
+
default_dir = '/etc/yus'
|
43
43
|
default_config_files = [
|
44
44
|
File.join(default_dir, 'yus.yml'),
|
45
|
-
'/etc/yus/yus.yml',
|
46
45
|
]
|
47
46
|
defaults = {
|
48
47
|
'config' => default_config_files,
|
data/lib/yus/server.rb
CHANGED
File without changes
|
data/lib/yus/session.rb
CHANGED
File without changes
|
data/lib/yus/version.rb
CHANGED
data/readme.md
CHANGED
@@ -2,20 +2,22 @@
|
|
2
2
|
|
3
3
|
* https://github.com/zdavatz/yus
|
4
4
|
|
5
|
-
##
|
5
|
+
## Description:
|
6
6
|
|
7
7
|
ywesee user server. Works with the ywesee webframework and all the ywesee
|
8
8
|
software packages.
|
9
9
|
|
10
|
-
##
|
10
|
+
## Features/Problems:
|
11
11
|
|
12
12
|
* Only runs on Ruby >= 2.1.0
|
13
|
+
* runs fine with Ruby 3.1.1
|
13
14
|
|
14
|
-
##
|
15
|
+
## Install:
|
15
16
|
|
16
|
-
* sudo gem install yus
|
17
|
+
* `sudo gem install yus`
|
18
|
+
* `bundle install --without development`
|
17
19
|
|
18
|
-
##
|
20
|
+
## Developers:
|
19
21
|
|
20
22
|
* Masaomi Hatakeyama
|
21
23
|
* Zeno Davatz
|
data/yus.gemspec
CHANGED
@@ -13,6 +13,8 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.platform = Gem::Platform::RUBY
|
14
14
|
spec.license = "GPLv3"
|
15
15
|
spec.homepage = "https://github.com/zdavatz/yus/"
|
16
|
+
spec.metadata["changelog_uri"] = spec.homepage + "/blob/master/History.txt"
|
17
|
+
spec.required_ruby_version = '>= 3.0'
|
16
18
|
|
17
19
|
spec.metadata['allowed_push_host'] = 'https://rubygems.org' if RUBY_VERSION.to_f > 2.0
|
18
20
|
|
@@ -21,19 +23,19 @@ Gem::Specification.new do |spec|
|
|
21
23
|
spec.require_paths = ["lib"]
|
22
24
|
|
23
25
|
spec.add_dependency "needle"
|
26
|
+
spec.add_dependency "ydbi"
|
27
|
+
spec.add_dependency "ydbd-pg"
|
24
28
|
spec.add_dependency 'rclconf'
|
29
|
+
spec.add_dependency 'logger'
|
25
30
|
spec.add_dependency 'odba', '>= 1.1.6'
|
26
31
|
|
27
32
|
spec.add_runtime_dependency 'highline'
|
28
33
|
spec.add_dependency 'deprecated', '2.0.1'
|
34
|
+
spec.add_development_dependency "drb"
|
29
35
|
spec.add_development_dependency "test-unit"
|
30
36
|
spec.add_development_dependency "minitest"
|
31
|
-
if RUBY_VERSION.to_f > 2.0
|
32
|
-
spec.add_development_dependency "pry-byebug"
|
33
|
-
end
|
34
37
|
spec.add_development_dependency "bundler"
|
35
38
|
spec.add_development_dependency "flexmock", '~>1.3.0'
|
36
39
|
spec.add_development_dependency "rake"
|
37
|
-
spec.add_development_dependency "rspec"
|
38
40
|
spec.add_development_dependency "simplecov"
|
39
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yasuhiro Asaka, Zeno R.R. Davatz, Niklaus Giger
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-01 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: needle
|
@@ -24,6 +23,34 @@ dependencies:
|
|
24
23
|
- - ">="
|
25
24
|
- !ruby/object:Gem::Version
|
26
25
|
version: '0'
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: ydbi
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: ydbd-pg
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
type: :runtime
|
48
|
+
prerelease: false
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
27
54
|
- !ruby/object:Gem::Dependency
|
28
55
|
name: rclconf
|
29
56
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,6 +65,20 @@ dependencies:
|
|
38
65
|
- - ">="
|
39
66
|
- !ruby/object:Gem::Version
|
40
67
|
version: '0'
|
68
|
+
- !ruby/object:Gem::Dependency
|
69
|
+
name: logger
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
type: :runtime
|
76
|
+
prerelease: false
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
41
82
|
- !ruby/object:Gem::Dependency
|
42
83
|
name: odba
|
43
84
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,7 +122,7 @@ dependencies:
|
|
81
122
|
- !ruby/object:Gem::Version
|
82
123
|
version: 2.0.1
|
83
124
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
125
|
+
name: drb
|
85
126
|
requirement: !ruby/object:Gem::Requirement
|
86
127
|
requirements:
|
87
128
|
- - ">="
|
@@ -95,7 +136,7 @@ dependencies:
|
|
95
136
|
- !ruby/object:Gem::Version
|
96
137
|
version: '0'
|
97
138
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
139
|
+
name: test-unit
|
99
140
|
requirement: !ruby/object:Gem::Requirement
|
100
141
|
requirements:
|
101
142
|
- - ">="
|
@@ -109,7 +150,7 @@ dependencies:
|
|
109
150
|
- !ruby/object:Gem::Version
|
110
151
|
version: '0'
|
111
152
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
153
|
+
name: minitest
|
113
154
|
requirement: !ruby/object:Gem::Requirement
|
114
155
|
requirements:
|
115
156
|
- - ">="
|
@@ -164,20 +205,6 @@ dependencies:
|
|
164
205
|
- - ">="
|
165
206
|
- !ruby/object:Gem::Version
|
166
207
|
version: '0'
|
167
|
-
- !ruby/object:Gem::Dependency
|
168
|
-
name: rspec
|
169
|
-
requirement: !ruby/object:Gem::Requirement
|
170
|
-
requirements:
|
171
|
-
- - ">="
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: '0'
|
174
|
-
type: :development
|
175
|
-
prerelease: false
|
176
|
-
version_requirements: !ruby/object:Gem::Requirement
|
177
|
-
requirements:
|
178
|
-
- - ">="
|
179
|
-
- !ruby/object:Gem::Version
|
180
|
-
version: '0'
|
181
208
|
- !ruby/object:Gem::Dependency
|
182
209
|
name: simplecov
|
183
210
|
requirement: !ruby/object:Gem::Requirement
|
@@ -205,9 +232,9 @@ executables:
|
|
205
232
|
extensions: []
|
206
233
|
extra_rdoc_files: []
|
207
234
|
files:
|
235
|
+
- ".envrc"
|
236
|
+
- ".github/workflows/ruby.yml"
|
208
237
|
- ".gitignore"
|
209
|
-
- ".ruby-version"
|
210
|
-
- ".travis.yml"
|
211
238
|
- 0001-Added-support-for-running-yus-via-docker.patch
|
212
239
|
- Gemfile
|
213
240
|
- Gemfile.lock
|
@@ -226,6 +253,9 @@ files:
|
|
226
253
|
- data/yus.crt
|
227
254
|
- data/yus.key
|
228
255
|
- data/yus_dump.yml
|
256
|
+
- devenv.lock
|
257
|
+
- devenv.nix
|
258
|
+
- devenv.yaml
|
229
259
|
- install.rb
|
230
260
|
- lib/data/yus_dump.yml
|
231
261
|
- lib/yus/entity.rb
|
@@ -240,13 +270,12 @@ files:
|
|
240
270
|
- second.env
|
241
271
|
- sha256.rb
|
242
272
|
- yus.gemspec
|
243
|
-
- yus_migrate_to_utf_8
|
244
273
|
homepage: https://github.com/zdavatz/yus/
|
245
274
|
licenses:
|
246
275
|
- GPLv3
|
247
276
|
metadata:
|
277
|
+
changelog_uri: https://github.com/zdavatz/yus//blob/master/History.txt
|
248
278
|
allowed_push_host: https://rubygems.org
|
249
|
-
post_install_message:
|
250
279
|
rdoc_options: []
|
251
280
|
require_paths:
|
252
281
|
- lib
|
@@ -254,15 +283,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
254
283
|
requirements:
|
255
284
|
- - ">="
|
256
285
|
- !ruby/object:Gem::Version
|
257
|
-
version: '0'
|
286
|
+
version: '3.0'
|
258
287
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
259
288
|
requirements:
|
260
289
|
- - ">="
|
261
290
|
- !ruby/object:Gem::Version
|
262
291
|
version: '0'
|
263
292
|
requirements: []
|
264
|
-
rubygems_version: 3.
|
265
|
-
signing_key:
|
293
|
+
rubygems_version: 3.6.2
|
266
294
|
specification_version: 4
|
267
295
|
summary: ywesee user server
|
268
296
|
test_files: []
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.5.0
|
data/.travis.yml
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
before_install:
|
3
|
-
- gem install bundler
|
4
|
-
|
5
|
-
bundler_args: --without debugger
|
6
|
-
|
7
|
-
script:
|
8
|
-
- bundle exec rake test
|
9
|
-
|
10
|
-
notifications:
|
11
|
-
email:
|
12
|
-
- ngiger@ywesee.com
|
13
|
-
rvm:
|
14
|
-
- 2.7.1
|
15
|
-
- 2.5.0
|
16
|
-
- ruby-head
|
17
|
-
|
18
|
-
matrix:
|
19
|
-
allow_failures:
|
20
|
-
- rvm: ruby-head
|
data/yus_migrate_to_utf_8
DELETED
@@ -1,214 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#encoding: ASCII-8BIT
|
3
|
-
require 'fileutils'
|
4
|
-
require 'syck'
|
5
|
-
|
6
|
-
here = File.expand_path(File.join(File.dirname(File.dirname(__FILE__)), 'lib'))
|
7
|
-
$: << here
|
8
|
-
require 'logger'
|
9
|
-
require 'needle'
|
10
|
-
require 'odba/id_server'
|
11
|
-
require 'rrba/server'
|
12
|
-
require 'yus/entity'
|
13
|
-
require 'yus/privilege'
|
14
|
-
require 'odba/connection_pool'
|
15
|
-
require 'odba/drbwrapper'
|
16
|
-
require 'odba/storage'
|
17
|
-
require 'rclconf'
|
18
|
-
require 'odba/18_19_loading_compatibility'
|
19
|
-
|
20
|
-
module Yus
|
21
|
-
attr_reader :config
|
22
|
-
|
23
|
-
def self.load_config
|
24
|
-
default_dir = File.join(ENV['HOME'], '.yus')
|
25
|
-
default_config_files = [
|
26
|
-
File.join(default_dir, 'yus.yml'),
|
27
|
-
'/etc/yus/yus.yml',
|
28
|
-
]
|
29
|
-
defaults = {
|
30
|
-
'cleaning_interval' => 300,
|
31
|
-
'config' => default_config_files,
|
32
|
-
'db_name' => 'yus',
|
33
|
-
'db_user' => 'yus',
|
34
|
-
'db_auth' => 'yus',
|
35
|
-
'db_backend' => :psql,
|
36
|
-
'digest' => Digest::SHA256,
|
37
|
-
'log_file' => STDERR,
|
38
|
-
'log_level' => 'INFO',
|
39
|
-
'persistence' => 'odba',
|
40
|
-
'root_name' => 'admin',
|
41
|
-
'root_pass' => nil,
|
42
|
-
'server_url' => 'drbssl://localhost:9997',
|
43
|
-
'session_timeout' => 300,
|
44
|
-
'ssl_key' => File.expand_path('../data/yus.key',
|
45
|
-
File.dirname(__FILE__)),
|
46
|
-
'ssl_cert' => File.expand_path('../data/yus.crt',
|
47
|
-
File.dirname(__FILE__)),
|
48
|
-
'token_lifetime' => 30,
|
49
|
-
'yus_dir' => default_dir,
|
50
|
-
}
|
51
|
-
|
52
|
-
@config = RCLConf::RCLConf.new(ARGV, defaults)
|
53
|
-
@config.load(@config.config)
|
54
|
-
|
55
|
-
require File.join('yus', 'persistence', @config.persistence)
|
56
|
-
end
|
57
|
-
|
58
|
-
class Server
|
59
|
-
# http://stackoverflow.com/questions/2982677/ruby-1-9-invalid-byte-sequence-in-utf-8
|
60
|
-
# https://robots.thoughtbot.com/fight-back-utf-8-invalid-byte-sequences
|
61
|
-
def sanitize_utf8(string)
|
62
|
-
return nil if string.nil?
|
63
|
-
# return string.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')
|
64
|
-
return string if string.valid_encoding?
|
65
|
-
if string.force_encoding(Encoding::ISO_8859_1).valid_encoding?
|
66
|
-
string.force_encoding(Encoding::ISO_8859_1).clone.encode(Encoding::UTF_8)
|
67
|
-
else
|
68
|
-
string.chars.select { |c| c.valid_encoding? }.join
|
69
|
-
end
|
70
|
-
end
|
71
|
-
def _migrate_to_utf8 queue, table, opts={}
|
72
|
-
while obj = queue.shift do
|
73
|
-
if obj.is_a?(Numeric)
|
74
|
-
begin
|
75
|
-
obj = ODBA.cache.fetch obj
|
76
|
-
rescue ODBA::OdbaError
|
77
|
-
return
|
78
|
-
end
|
79
|
-
else
|
80
|
-
obj = obj.odba_instance
|
81
|
-
end
|
82
|
-
puts " #{__LINE__}: Migrating #{obj.class} #{obj.to_s}" if $VERBOSE
|
83
|
-
return unless obj
|
84
|
-
_migrate_obj_to_utf8 obj, queue, table, opts
|
85
|
-
obj.odba_store unless obj.odba_unsaved?
|
86
|
-
end
|
87
|
-
end
|
88
|
-
def _migrate_obj_to_utf8 obj, queue, table, opts={}
|
89
|
-
obj.instance_variables.each do |name|
|
90
|
-
child = obj.instance_variable_get name
|
91
|
-
if child.respond_to?(:odba_unsaved?) && !child.odba_unsaved? \
|
92
|
-
&& obj.respond_to?(:odba_serializables) \
|
93
|
-
&& obj.odba_serializables.include?(name)
|
94
|
-
child.instance_variable_set '@odba_persistent', nil
|
95
|
-
end
|
96
|
-
child = _migrate_child_to_utf8 child, queue, table, opts
|
97
|
-
obj.instance_variable_set name, child
|
98
|
-
end
|
99
|
-
if obj.is_a?(Array)
|
100
|
-
obj.collect! do |child|
|
101
|
-
_migrate_child_to_utf8 child, queue, table, opts
|
102
|
-
end
|
103
|
-
end
|
104
|
-
if obj.is_a?(Hash)
|
105
|
-
obj.dup.each do |key, child|
|
106
|
-
obj.store key, _migrate_child_to_utf8(child, queue, table, opts)
|
107
|
-
end
|
108
|
-
end
|
109
|
-
obj
|
110
|
-
end
|
111
|
-
def _migrate_child_to_utf8 child, queue, table, opts={}
|
112
|
-
@serialized ||= {}
|
113
|
-
case child
|
114
|
-
when ODBA::Persistable, ODBA::Stub
|
115
|
-
if child = child.odba_instance
|
116
|
-
if child.odba_unsaved?
|
117
|
-
_migrate_to_utf8 [child], table, opts
|
118
|
-
elsif opts[:all]
|
119
|
-
odba_id = child.odba_id
|
120
|
-
unless table[odba_id]
|
121
|
-
table.store odba_id, true
|
122
|
-
queue.push odba_id
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
126
|
-
when String
|
127
|
-
old = child.encoding
|
128
|
-
orig = child.clone
|
129
|
-
if ( child.encoding != Encoding::UTF_8 && child.force_encoding(Encoding::ISO_8859_1).valid_encoding? ) ||
|
130
|
-
( child.encoding == Encoding::UTF_8 && !child.valid_encoding? )
|
131
|
-
child = child.force_encoding(Encoding::UTF_8)
|
132
|
-
puts "force_encoding from ISO_8859_1 #{old}. Now #{child}" unless child.to_i > 0
|
133
|
-
end
|
134
|
-
case child.encoding.to_s
|
135
|
-
when /ASCII-8BIT|US-ASCII/
|
136
|
-
# nothing todo
|
137
|
-
when /UTF-8/
|
138
|
-
puts "UTF-8: for #{child.to_s}" if $VERBOSE
|
139
|
-
child = sanitize_utf8(child)
|
140
|
-
when /ISO-8859-1/i
|
141
|
-
child = sanitize_utf8(child)
|
142
|
-
# child = child.force_encoding('UTF-8')
|
143
|
-
puts "force_encoding from #{old}. is now #{child}"
|
144
|
-
else
|
145
|
-
puts "Unhandeled encoding #{child.encoding}"
|
146
|
-
# child = child.force_encoding
|
147
|
-
end
|
148
|
-
when
|
149
|
-
Yus::Entity,
|
150
|
-
Yus::Privilege
|
151
|
-
child = _migrate_obj_to_utf8 child, queue, table, opts
|
152
|
-
when Float, Fixnum, TrueClass, FalseClass, NilClass,
|
153
|
-
Symbol, Time, Date, DateTime
|
154
|
-
# do nothing
|
155
|
-
else
|
156
|
-
@ignored ||= {}
|
157
|
-
unless @ignored[child.class]
|
158
|
-
@ignored.store child.class, true
|
159
|
-
warn "ignoring #{child.class}"
|
160
|
-
end
|
161
|
-
end
|
162
|
-
child
|
163
|
-
rescue SystemStackError
|
164
|
-
puts child.class
|
165
|
-
raise
|
166
|
-
end
|
167
|
-
end
|
168
|
-
class Entity
|
169
|
-
include ODBA::Persistable
|
170
|
-
class << self
|
171
|
-
alias :all :odba_extent
|
172
|
-
end
|
173
|
-
end
|
174
|
-
class Privilege
|
175
|
-
include ODBA::Persistable
|
176
|
-
class << self
|
177
|
-
alias :all :odba_extent
|
178
|
-
end
|
179
|
-
end
|
180
|
-
def self.migrate_to_uf_8
|
181
|
-
self.load_config
|
182
|
-
@logger = Logger.new("/tmp/#{File.basename(__FILE__)}.log")
|
183
|
-
@logger.level = Logger::DEBUG
|
184
|
-
@logger.info "#{Time.now}: Calling #{File.basename(__FILE__)}"
|
185
|
-
|
186
|
-
puts "storage #{@config.db_name} name #{@config.db_user} auth #{@config.db_auth} pass #{@config.db_pass} storage is #{@config.persistence}"
|
187
|
-
require 'odba/connection_pool'
|
188
|
-
require 'odba/drbwrapper'
|
189
|
-
DRb.install_id_conv ODBA::DRbIdConv.new
|
190
|
-
ODBA.storage.dbi = ODBA::ConnectionPool.new("DBI:Pg:#{@config.db_name}", @config.db_user, @config.db_auth)
|
191
|
-
ODBA.cache.setup
|
192
|
-
@persistence = Yus::Persistence::Odba.new
|
193
|
-
ODBA.cache.setup
|
194
|
-
|
195
|
-
DRb.install_id_conv ODBA::DRbIdConv.new
|
196
|
-
@server = Yus::Server.new(@persistence, @config, @logger)
|
197
|
-
@server.extend(DRbUndumped)
|
198
|
-
{
|
199
|
-
:entitites => Yus::Entity.odba_extent,
|
200
|
-
:privileges => Yus::Privilege.odba_extent,
|
201
|
-
}.each do |name, to_migrate|
|
202
|
-
msg = "#{Time.now}: Start migrating #{to_migrate.size} #{name}"
|
203
|
-
@logger.info msg
|
204
|
-
puts msg
|
205
|
-
@server._migrate_to_utf8(to_migrate, {})
|
206
|
-
end
|
207
|
-
puts "#{Time.now}: Finished #{File.basename(__FILE__)}"
|
208
|
-
rescue Exception => error
|
209
|
-
@logger.error('fatal') { error } if @logger
|
210
|
-
raise
|
211
|
-
end
|
212
|
-
end
|
213
|
-
|
214
|
-
Yus.migrate_to_uf_8
|