yus 1.0.2 → 1.0.4

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 CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NzBiN2NhYjE5MzU5YzAxZDZmZDk1MzI4OTE0YmIwYmUxOWQ5ZmNlOQ==
5
- data.tar.gz: !binary |-
6
- YjNiNThjNmY0ZjYxZWE2YTg1MzkyYThmYmQ1YzczYzBjYTg1MjQ0OQ==
2
+ SHA1:
3
+ metadata.gz: 38cfb069f12865442210784253c0249d165821e0
4
+ data.tar.gz: 6eecec578892f50ba778fec5d7f696114466b48d
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- MzhlMzYxYzUyYzY2NzAyYjg1MWZjMzNiYmNhODQ2MWQyZThkYjBkZDdkNDgx
10
- OWMzOTM0MjFiOTY3YjkxMzA4MzIwNzExNWIwMWFiNjk5OWE0NjJjZmI4MGU5
11
- MmU0M2M1NDk2YzYxYzliOWY4YmIyZTBjYTJhYTBlYjVmNWQyMGE=
12
- data.tar.gz: !binary |-
13
- YTFmODdiNjkwNzcyZjViYTc1NjQzMmZhYjQyNDAyNTE0NjgyYTFjMThjNzdk
14
- YThkYmJlZjQxZDBmOTQ2ZGMwZTRmZDQyY2ViMmIxYjhlOTYwMzk2YmQ5ODM5
15
- MzMzM2QyNzA1MGZiOWQyMDk1YjZiYmE3YmVmYjFjNTI2ZDM0NDQ=
6
+ metadata.gz: 1ebc69681b04a40e6cffe913d0bd2b66077e8e7897fe423b98d768ca6880e476987f1f5429e5fc3bda06f84907a97e119278a4c669182c1871568a13723f02d0
7
+ data.tar.gz: 1eb5017b1700d163eca13caab60510a34fb1900044f7474e9e0e4c5c5791062a0ed9c3b3eabf6684474e2d063ed2f2091eb83ef0558c0c06ad14c945e3658409
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ .bundle/
2
+ vendor/
3
+ pkg/
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.3.1
data/.travis.yml ADDED
@@ -0,0 +1,22 @@
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
+ - ruby-head
15
+ - 2.3.0
16
+ - 2.2.3
17
+ - 2.1.7
18
+ - 1.8.7
19
+ matrix:
20
+ allow_failures:
21
+ - rvm: ruby-head
22
+ - rvm: 1.8.7
@@ -0,0 +1,172 @@
1
+ From 2fc902ee538f96ff9f87920b63bd1a1bb7d2f9f5 Mon Sep 17 00:00:00 2001
2
+ From: Niklaus Giger <ngiger@ywesee.com>
3
+ Date: Wed, 23 Dec 2015 10:45:48 +0100
4
+ Subject: [PATCH] Added support for running yus via docker
5
+
6
+ Signed-off-by: Niklaus Giger <ngiger@ywesee.com>
7
+ ---
8
+ .gitignore | 2 ++
9
+ .travis.yml | 2 +-
10
+ Dockerfile | 10 ++++++++++
11
+ Gemfile | 1 -
12
+ bin/yusd | 3 ++-
13
+ docker-compose.yml | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
14
+ test/yus_demo.yml | 17 +++++++++++++++++
15
+ 7 files changed, 81 insertions(+), 3 deletions(-)
16
+ create mode 100644 Dockerfile
17
+ create mode 100644 docker-compose.yml
18
+ create mode 100644 test/yus_demo.yml
19
+
20
+ diff --git a/.gitignore b/.gitignore
21
+ index 97709c1..fa3d1eb 100644
22
+ --- a/.gitignore
23
+ +++ b/.gitignore
24
+ @@ -1,3 +1,5 @@
25
+ .bundle/
26
+ vendor/
27
+ pkg/
28
+ +coverage
29
+ +.ruby-version
30
+ diff --git a/.travis.yml b/.travis.yml
31
+ index 3641b02..e71a651 100644
32
+ --- a/.travis.yml
33
+ +++ b/.travis.yml
34
+ @@ -5,7 +5,7 @@ before_install:
35
+ bundler_args: --without debugger
36
+
37
+ script:
38
+ - - rake test
39
+ + - bundle exec rake test
40
+
41
+ notifications:
42
+ email:
43
+ diff --git a/Dockerfile b/Dockerfile
44
+ new file mode 100644
45
+ index 0000000..c8108ea
46
+ --- /dev/null
47
+ +++ b/Dockerfile
48
+ @@ -0,0 +1,10 @@
49
+ +FROM ruby:2.2.4-onbuild
50
+ +CMD ["bundle", "exec", "bin/yusd"]
51
+ +
52
+ +# RUN apt-get update && apt-get -y install postgresql-client-9.4
53
+ +
54
+ +# The names for pgTest => db_host, yus_data => db_name must be in sync between
55
+ +# docker-compose.yml, test/yus_demo.yml and Dockerfile
56
+ +COPY 'test/yus_demo.yml' '/etc/yus/yus.yml'
57
+ +COPY 'bin/yusd' '/usr/src/app/bin/yusd'
58
+ +
59
+ diff --git a/Gemfile b/Gemfile
60
+ index 08dd1ab..3ec57ca 100644
61
+ --- a/Gemfile
62
+ +++ b/Gemfile
63
+ @@ -1,7 +1,6 @@
64
+ source "http://rubygems.org"
65
+
66
+ gem 'needle'
67
+ -#gem 'pg', '0.9.0'
68
+ gem 'pg'
69
+ # we have some important patches here!!
70
+ gem 'dbi', '0.4.5', :git => 'https://github.com/zdavatz/ruby-dbi'
71
+ diff --git a/bin/yusd b/bin/yusd
72
+ index ce4e6dd..c7c15d7 100755
73
+ --- a/bin/yusd
74
+ +++ b/bin/yusd
75
+ @@ -18,6 +18,7 @@ default_config_files = [
76
+ defaults = {
77
+ 'cleaning_interval' => 300,
78
+ 'config' => default_config_files,
79
+ + 'db_host' => 'localhost',
80
+ 'db_name' => 'yus',
81
+ 'db_user' => 'yus',
82
+ 'db_auth' => 'yus',
83
+ @@ -48,7 +49,7 @@ when 'odba'
84
+ require 'odba/connection_pool'
85
+ require 'odba/drbwrapper'
86
+ DRb.install_id_conv ODBA::DRbIdConv.new
87
+ - ODBA.storage.dbi = ODBA::ConnectionPool.new("DBI:Pg:#{config.db_name}",
88
+ + ODBA.storage.dbi = ODBA::ConnectionPool.new("DBI:Pg:#{config.db_name}:#{config.db_host}",
89
+ config.db_user, config.db_auth)
90
+ ODBA.cache.setup
91
+ persistence = Yus::Persistence::Odba.new
92
+ diff --git a/docker-compose.yml b/docker-compose.yml
93
+ new file mode 100644
94
+ index 0000000..5ba3196
95
+ --- /dev/null
96
+ +++ b/docker-compose.yml
97
+ @@ -0,0 +1,49 @@
98
+ +# Copyright (c) 2015 by Niklaus Giger ngiger@ywesee.com
99
+ +#
100
+ +# This file is part of oddb-docker.
101
+ +#
102
+ +# oddb-docker is free software: you can redistribute it and/or modify
103
+ +# it under the terms of the GNU General Public License as published by
104
+ +# the Free Software Foundation, either version 3 of the License, or
105
+ +# (at your option) any later version.
106
+ +#
107
+ +# oddb-docker is distributed in the hope that it will be useful,
108
+ +# but WITHOUT ANY WARRANTY; without even the implied warranty of
109
+ +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
110
+ +# GNU General Public License for more details.
111
+ +#
112
+ +# You should have received a copy of the GNU General Public License
113
+ +# along with oddb-docker. If not, see <http://www.gnu.org/licenses/>.
114
+ +#
115
+ +# # This is a setup for running tests
116
+ +# Security is not really a concern!
117
+ +#
118
+ +
119
+ +YusData:
120
+ + image: postgres:9.4
121
+ + entrypoint: /bin/bash
122
+ +
123
+ +# The names for pgTest => db_host, yus_data => db_name must be in sync between
124
+ +# docker-compose.yml, test/yus_demo.yml and Dockerfile
125
+ +pgTest:
126
+ + image: postgres:9.4
127
+ + volumes_from:
128
+ + - YusData
129
+ + environment:
130
+ + POSTGRES_USER: yus
131
+ + POSTGRES_PASSWORD: yus
132
+ + POSTGRES_DB: yus_data
133
+ +yustest:
134
+ + build: .
135
+ + volumes:
136
+ + - /home/docker-data-containers/yus-test:/var/yus_home
137
+ + ports:
138
+ + # by defaul yus run on port 9997, could by overriden by /etc/yus/yus.ml or $HOME/.yus/yus.yml
139
+ + - "9997:9997"
140
+ + links:
141
+ + - pgTest
142
+ + environment:
143
+ + PGHOST: pgTest
144
+ + PGUSER: yus
145
+ + PGPASSWORD: yus
146
+ + PGDATABASE: yus_data
147
+ diff --git a/test/yus_demo.yml b/test/yus_demo.yml
148
+ new file mode 100644
149
+ index 0000000..cf90f6c
150
+ --- /dev/null
151
+ +++ b/test/yus_demo.yml
152
+ @@ -0,0 +1,17 @@
153
+ +---
154
+ +# This is a demo setup for running yus inside a docker
155
+ +#root_name: zdavatz@ywesee.com
156
+ +#root_pass: 0fdcf7ceb36d7b6057c144e676133c8f0aff1490cc0e7f5470f6ae503d3b8878
157
+ +root_name: ngiger@ywesee.com
158
+ +#root_pass: 0fdcf7ceb36d7b6057c144e676133c8f0aff1490cc0e7f5470f6ae503d3b8878
159
+ +# root_pass for 1234
160
+ +root_pass: 03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4
161
+ +log_level: DEBUG
162
+ +ssl_key: /etc/yus/data/yus.key
163
+ +ssl_cert: /etc/yus/data/yus.crt
164
+ +session_timeout: 3600
165
+ +
166
+ +# The names for pgTest => db_host, yus_data => db_name must be in sync between
167
+ +# docker-compose.yml, test/yus_demo.yml and Dockerfile
168
+ +db_host: pgTest
169
+ +db_name: yus_data
170
+ --
171
+ 2.1.4
172
+
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify gem's dependencies in yus.gemspec
4
+ gemspec
5
+
6
+
data/Gemfile.lock ADDED
@@ -0,0 +1,84 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ yus (1.0.4)
5
+ deprecated (= 2.0.1)
6
+ highline
7
+ needle
8
+ odba
9
+ pg (= 0.17.0)
10
+ rclconf
11
+ ydbd-pg (>= 0.5.1)
12
+ ydbi (>= 0.5.1)
13
+
14
+ GEM
15
+ remote: https://rubygems.org/
16
+ specs:
17
+ byebug (9.0.5)
18
+ coderay (1.1.1)
19
+ deprecated (2.0.1)
20
+ diff-lcs (1.2.5)
21
+ docile (1.1.5)
22
+ flexmock (1.3.3)
23
+ highline (1.7.8)
24
+ json (2.0.1)
25
+ method_source (0.8.2)
26
+ minitest (5.9.0)
27
+ needle (1.3.0)
28
+ odba (1.1.2)
29
+ ydbd-pg (>= 0.5.1)
30
+ ydbi (>= 0.5.1)
31
+ pg (0.17.0)
32
+ power_assert (0.3.0)
33
+ pry (0.10.4)
34
+ coderay (~> 1.1.0)
35
+ method_source (~> 0.8.1)
36
+ slop (~> 3.4)
37
+ pry-byebug (3.4.0)
38
+ byebug (~> 9.0)
39
+ pry (~> 0.10)
40
+ rake (11.2.2)
41
+ rclconf (1.0.0)
42
+ rspec (3.5.0)
43
+ rspec-core (~> 3.5.0)
44
+ rspec-expectations (~> 3.5.0)
45
+ rspec-mocks (~> 3.5.0)
46
+ rspec-core (3.5.1)
47
+ rspec-support (~> 3.5.0)
48
+ rspec-expectations (3.5.0)
49
+ diff-lcs (>= 1.2.0, < 2.0)
50
+ rspec-support (~> 3.5.0)
51
+ rspec-mocks (3.5.0)
52
+ diff-lcs (>= 1.2.0, < 2.0)
53
+ rspec-support (~> 3.5.0)
54
+ rspec-support (3.5.0)
55
+ simplecov (0.12.0)
56
+ docile (~> 1.1.0)
57
+ json (>= 1.8, < 3)
58
+ simplecov-html (~> 0.10.0)
59
+ simplecov-html (0.10.0)
60
+ slop (3.6.0)
61
+ test-unit (3.2.0)
62
+ power_assert
63
+ ydbd-pg (0.5.3)
64
+ pg
65
+ ydbi (>= 0.5.0)
66
+ ydbi (0.5.3)
67
+ deprecated (= 2.0.1)
68
+
69
+ PLATFORMS
70
+ ruby
71
+
72
+ DEPENDENCIES
73
+ bundler
74
+ flexmock (~> 1.3.0)
75
+ minitest
76
+ pry-byebug
77
+ rake
78
+ rspec
79
+ simplecov
80
+ test-unit
81
+ yus!
82
+
83
+ BUNDLED WITH
84
+ 1.12.5
data/History.txt CHANGED
@@ -1,3 +1,14 @@
1
+ === 1.0.4 / 11.07.2016
2
+
3
+ * Added yus_migrate_to_utf_8
4
+ * Cleanup yus/helpers and bin/yus* to use always module name Yus (not YUS)
5
+ * Fixed an error preventing yusd to run under Ruby 2.3.1
6
+
7
+ === 1.0.3 / 23.05.2016
8
+
9
+ * Make it run under Ruby >= 2.1
10
+ * Replaced hoe by bundler/gem_tasks
11
+
1
12
  === 1.0.2 / 01.10.2014
2
13
 
3
14
  * Added bin/yus_dump to dump yus-database into data/yus_dump.yml
data/Manifest.txt ADDED
@@ -0,0 +1,25 @@
1
+ Guide.txt
2
+ History.txt
3
+ LICENSE
4
+ README.txt
5
+ bin/yus_add_user
6
+ bin/yus_delete_user
7
+ bin/yus_grant
8
+ bin/yus_passwd
9
+ bin/yus_show
10
+ bin/yusd
11
+ data/yus.crt
12
+ data/yus.key
13
+ install.rb
14
+ lib/yus/entity.rb
15
+ lib/yus/persistence/odba.rb
16
+ lib/yus/persistence/og.rb
17
+ lib/yus/privilege.rb
18
+ lib/yus/server.rb
19
+ lib/yus/session.rb
20
+ sha256.rb
21
+ test/suite.rb
22
+ test/test_entity.rb
23
+ test/test_privilege.rb
24
+ test/test_server.rb
25
+ test/test_session.rb
data/Rakefile ADDED
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+
4
+ require 'bundler/gem_tasks'
5
+ require 'rspec/core/rake_task'
6
+ require 'rake/testtask'
7
+
8
+ RSpec::Core::RakeTask.new(:spec)
9
+
10
+ # dependencies are now declared in bbmb.gemspec
11
+ desc 'Offer a gem task like hoe'
12
+ task :gem => :build do
13
+ Rake::Task[:build].invoke
14
+ end
15
+
16
+ desc 'test using minittest via test/suite.rb'
17
+ task :test do |t|
18
+ $LOAD_PATH << File.dirname(__FILE__)
19
+ require 'test/suite'
20
+ end
21
+
22
+
23
+ task :spec => :clean
24
+
25
+ require 'rake/clean'
26
+ CLEAN.include FileList['pkg/*.gem']
data/bin/yus_add_user CHANGED
@@ -8,18 +8,10 @@ require 'drb/ssl'
8
8
  require 'password'
9
9
  require 'rclconf'
10
10
  require 'yus/session'
11
+ require 'yus/helpers'
11
12
  require 'getoptlong'
12
13
 
13
- opts = []
14
- GetoptLong.new(
15
- ['--config', '-c', GetoptLong::OPTIONAL_ARGUMENT],
16
- ['--root_name', '-r', GetoptLong::OPTIONAL_ARGUMENT],
17
- ['--server_url', '-u', GetoptLong::OPTIONAL_ARGUMENT],
18
- ['--yus_dir', '-d', GetoptLong::OPTIONAL_ARGUMENT]
19
- ).each { |pair|
20
- opts.push(pair.join('=')[2..-1])
21
- }
22
-
14
+ opts = Yus.default_opts
23
15
  name, action, item = ARGV
24
16
 
25
17
  unless(name)
@@ -29,37 +21,9 @@ Usage: yus_add_user <username> [<action> [<item>]]
29
21
  exit
30
22
  end
31
23
 
32
- default_dir = File.join(ENV['HOME'], '.yus')
33
- default_config_files = [
34
- File.join(default_dir, 'yus.yml'),
35
- '/etc/yus/yus.yml',
36
- ]
37
- defaults = {
38
- 'config' => default_config_files,
39
- 'root_name' => 'admin',
40
- 'server_url' => 'drbssl://localhost:9997',
41
- 'yus_dir' => default_dir,
42
- }
43
-
44
- config = RCLConf::RCLConf.new(opts, defaults)
45
- config.load(config.config)
46
-
47
- server = DRb::DRbObject.new(nil, config.server_url)
48
- server.ping
49
-
50
- session = nil
51
- begin
52
- pass = Password.get("Password for #{config.root_name}: ")
53
- session = server.login(config.root_name, pass.to_s, 'commandline')
54
- rescue Yus::YusError => e
55
- puts e.message
56
- retry
57
- end
58
-
59
- cont = nil
60
- callcc { |cont| }
61
- pass1 = Password.get("New Password for #{name}: ")
62
- pass2 = Password.get("Repeat Password for #{name}: ")
24
+ session = Yus.session(opts)
25
+ pass1 = Yus.get_password("New Password for #{name}: ")
26
+ pass2 = Yus.get_password("Repeat Password for #{name}: ")
63
27
 
64
28
  if(pass1 != pass2)
65
29
  puts "Passwords did not match"