ruml 0.1.0 → 1.0.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 +7 -0
- data/.travis.yml +6 -4
- data/LICENSE +23 -0
- data/README.md +21 -0
- data/Rakefile +13 -28
- data/bin/ruml +1 -2
- data/lib/ruml.rb +8 -12
- data/lib/ruml/broadcaster.rb +8 -5
- data/lib/ruml/config.rb +7 -38
- data/lib/ruml/list.rb +0 -11
- data/lib/ruml/version.rb +1 -1
- data/ruml.gemspec +5 -5
- data/test/helper.rb +6 -5
- metadata +45 -34
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 26624f26b8c0e59e66a365e7f4bc4e923a27a1b8
|
4
|
+
data.tar.gz: 3fe5126a748e5e735f081f6b153c132edce8253d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8182e3d2dc0a53c24cef8556463981c1daea58d07dda1cf6606f6c70f3bc19ee5e9003b04126a3406cecc0294b53632e47edc26d8aac2daa457cfe5f213539c9
|
7
|
+
data.tar.gz: e1b98f6081c2724be2b12a3cb8f4abc7baff7b619c49405d78087371ad08165f6d87750e87084fccb05ffcf3b11034653708aedd17ae021c35e5fc99eee49e4c
|
data/.travis.yml
CHANGED
data/LICENSE
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
Copyright (c) 2011 Peter Suschlik
|
2
|
+
Copyright (c) 2018 Peter Leitzen
|
3
|
+
|
4
|
+
MIT License
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
a copy of this software and associated documentation files (the
|
8
|
+
"Software"), to deal in the Software without restriction, including
|
9
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
the following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be
|
15
|
+
included in all copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,8 +1,16 @@
|
|
1
1
|
# ruml
|
2
2
|
|
3
|
+
[](https://travis-ci.org/splattael/ruml)
|
4
|
+
[](https://rubygems.org/gems/ruml)
|
5
|
+
|
3
6
|
Ruby mailing list software
|
4
7
|
|
5
8
|
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
$ gem install ruml
|
12
|
+
|
13
|
+
|
6
14
|
## Configration (ruml)
|
7
15
|
|
8
16
|
### File based
|
@@ -50,3 +58,16 @@ alias_database = hash:/etc/postfix/ml-aliases
|
|
50
58
|
## TODO
|
51
59
|
|
52
60
|
* Write unit tests!
|
61
|
+
|
62
|
+
|
63
|
+
## Release
|
64
|
+
|
65
|
+
Follow these steps to release this gem:
|
66
|
+
|
67
|
+
# Bump version in
|
68
|
+
edit lib/ruml/version.rb
|
69
|
+
edit README.md
|
70
|
+
|
71
|
+
git commit -m "Release X.Y.Z"
|
72
|
+
|
73
|
+
rake release
|
data/Rakefile
CHANGED
@@ -5,41 +5,26 @@ require 'rake/testtask'
|
|
5
5
|
desc 'Default: run unit tests.'
|
6
6
|
task :default => :test
|
7
7
|
|
8
|
+
namespace :test do
|
9
|
+
desc "Test runner"
|
10
|
+
Rake::TestTask.new :run do |test|
|
11
|
+
ENV['TEST_FIXTURE'] ||= "file"
|
12
|
+
test.test_files = FileList.new('test/**/*_test.rb')
|
13
|
+
test.libs << 'test'
|
14
|
+
test.verbose = true
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
8
18
|
AVAILABLE_TEST_FIXTURES = %w[file yaml]
|
9
19
|
|
10
20
|
AVAILABLE_TEST_FIXTURES.each do |test_fixture|
|
11
21
|
namespace :test do
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
test.libs << 'test'
|
16
|
-
test.verbose = true
|
22
|
+
desc "Run tests with fixture #{test_fixture}"
|
23
|
+
task test_fixture do
|
24
|
+
system "bundle exec rake test:run TEST_FIXTURE=#{test_fixture}"
|
17
25
|
end
|
18
26
|
end
|
19
27
|
end
|
20
28
|
|
21
29
|
desc "Run tests for #{AVAILABLE_TEST_FIXTURES.join(', ')}"
|
22
30
|
task :test => AVAILABLE_TEST_FIXTURES.map { |f| "test:#{f}" }
|
23
|
-
|
24
|
-
SUPPORTED_RUBIES = %w[ree 1.9.2 1.9.3 jruby rbx]
|
25
|
-
GEMSPEC = Bundler::GemHelper.new(Dir.pwd).gemspec
|
26
|
-
|
27
|
-
def with_ruby(ruby, command)
|
28
|
-
rvm = "#{ruby}@#{GEMSPEC.name}"
|
29
|
-
command = %{rvm #{rvm} exec bash -c '#{command}'}
|
30
|
-
|
31
|
-
puts "\n" * 3
|
32
|
-
puts "CMD: #{command}"
|
33
|
-
puts "=" * 40
|
34
|
-
|
35
|
-
system(command) or raise "command failed: #{command}"
|
36
|
-
end
|
37
|
-
|
38
|
-
namespace :rubies do
|
39
|
-
desc "Run tests for following supported platforms #{SUPPORTED_RUBIES.join ", "}"
|
40
|
-
task :test do
|
41
|
-
command = "bundle check || bundle install && bundle exec rake"
|
42
|
-
rubies = ENV['RUBIES'] ? ENV['RUBIES'].split(",") : SUPPORTED_RUBIES
|
43
|
-
rubies.each { |ruby| with_ruby(ruby, command) }
|
44
|
-
end
|
45
|
-
end
|
data/bin/ruml
CHANGED
data/lib/ruml.rb
CHANGED
@@ -1,15 +1,11 @@
|
|
1
|
-
require 'mail'
|
2
|
-
require 'moneta'
|
3
|
-
require 'moneta/adapters/basic_file'
|
4
|
-
require 'moneta/adapters/yaml'
|
5
|
-
|
6
1
|
module Ruml
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
autoload :VERSION, 'ruml/version'
|
11
|
-
|
12
|
-
def self.new(*args)
|
13
|
-
List.new(*args)
|
2
|
+
def self.broadcast!(name, input)
|
3
|
+
ml = Ruml::List.new(name)
|
4
|
+
Ruml::Broadcaster.new(ml, input).broadcast!
|
14
5
|
end
|
15
6
|
end
|
7
|
+
|
8
|
+
require 'ruml/list'
|
9
|
+
require 'ruml/config'
|
10
|
+
require 'ruml/broadcaster'
|
11
|
+
require 'ruml/version'
|
data/lib/ruml/broadcaster.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'mail'
|
2
|
+
|
1
3
|
module Ruml
|
2
4
|
class Broadcaster
|
3
5
|
def initialize(ml, message)
|
@@ -5,10 +7,6 @@ module Ruml
|
|
5
7
|
@message = Mail.new(message)
|
6
8
|
end
|
7
9
|
|
8
|
-
def sendable?
|
9
|
-
!been_there? && valid_member?
|
10
|
-
end
|
11
|
-
|
12
10
|
def valid_member?
|
13
11
|
expected = @message.from.size
|
14
12
|
actual = (@message.from.map(&:downcase) & @ml.members.map(&:downcase)).size
|
@@ -59,7 +57,12 @@ module Ruml
|
|
59
57
|
end
|
60
58
|
end
|
61
59
|
|
62
|
-
def
|
60
|
+
def broadcastable?
|
61
|
+
!been_there? && valid_member?
|
62
|
+
end
|
63
|
+
|
64
|
+
def broadcast!
|
65
|
+
return unless broadcastable?
|
63
66
|
mail = Mail.new
|
64
67
|
mail.subject subject
|
65
68
|
mail.from from
|
data/lib/ruml/config.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'moneta'
|
2
|
+
|
1
3
|
module Ruml
|
2
4
|
class Config
|
3
5
|
attr_reader :path
|
@@ -7,10 +9,10 @@ module Ruml
|
|
7
9
|
|
8
10
|
case @path
|
9
11
|
when /\.ya?ml/
|
10
|
-
construct
|
12
|
+
construct Moneta::Adapters::YAML, :file => @path
|
11
13
|
else
|
12
14
|
raise ArgumentError, "Couldn't find mailing list in #{@path.inspect}" unless File.directory?(@path)
|
13
|
-
construct Moneta::Adapters::
|
15
|
+
construct Moneta::Adapters::File, :dir => @path
|
14
16
|
end
|
15
17
|
end
|
16
18
|
|
@@ -22,43 +24,10 @@ module Ruml
|
|
22
24
|
@moneta[name] = value
|
23
25
|
end
|
24
26
|
|
25
|
-
def construct(
|
26
|
-
@moneta =
|
27
|
-
|
28
|
-
|
29
|
-
class Builder
|
30
|
-
include Moneta::Middleware
|
31
|
-
|
32
|
-
def initialize(adapater)
|
33
|
-
adapater.extend NoSerialization
|
34
|
-
build(adapater)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
private
|
39
|
-
|
40
|
-
class PlainYAML < ::Moneta::Adapters::YAML
|
41
|
-
def [](key)
|
42
|
-
string_key = key_for(key)
|
43
|
-
yaml[string_key] if yaml.key?(string_key)
|
44
|
-
end
|
45
|
-
|
46
|
-
def store(key, value, *)
|
47
|
-
hash = yaml
|
48
|
-
hash[key_for(key)] = value
|
49
|
-
save(hash)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
module NoSerialization
|
54
|
-
def serialize(value)
|
55
|
-
value
|
56
|
-
end
|
57
|
-
|
58
|
-
def deserialize(value)
|
59
|
-
value
|
27
|
+
def construct(adapter, *args)
|
28
|
+
@moneta = Moneta.build do
|
29
|
+
use adapter, *args
|
60
30
|
end
|
61
31
|
end
|
62
|
-
|
63
32
|
end
|
64
33
|
end
|
data/lib/ruml/list.rb
CHANGED
@@ -30,17 +30,6 @@ module Ruml
|
|
30
30
|
@bounce_to ||= lines("bounce_to").first || to
|
31
31
|
end
|
32
32
|
|
33
|
-
def broadcaster(body)
|
34
|
-
Broadcaster.new(self, body)
|
35
|
-
end
|
36
|
-
|
37
|
-
def broadcast!(body)
|
38
|
-
message = broadcaster(body)
|
39
|
-
if message.sendable?
|
40
|
-
message.send!
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
33
|
private
|
45
34
|
|
46
35
|
def lines(name)
|
data/lib/ruml/version.rb
CHANGED
data/ruml.gemspec
CHANGED
@@ -5,8 +5,8 @@ require "ruml/version"
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "ruml"
|
7
7
|
s.version = Ruml::VERSION
|
8
|
-
s.authors = ["Peter
|
9
|
-
s.email = ["peter@suschlik.de"]
|
8
|
+
s.authors = ["Peter Leitzen"]
|
9
|
+
s.email = ["peter-ruml@suschlik.de"]
|
10
10
|
s.homepage = "https://github.com/splattael/ruml"
|
11
11
|
s.summary = %q{Ruby mailing list software}
|
12
12
|
s.description = %q{}
|
@@ -17,8 +17,8 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
|
19
19
|
s.add_development_dependency "rake", "~> 0.9.2"
|
20
|
-
s.add_development_dependency "minitest"
|
20
|
+
s.add_development_dependency "minitest", "~> 5.11.2"
|
21
21
|
|
22
|
-
s.add_runtime_dependency "mail",
|
23
|
-
s.add_runtime_dependency "moneta
|
22
|
+
s.add_runtime_dependency "mail", "~> 2.7.0"
|
23
|
+
s.add_runtime_dependency "moneta", "~> 1.0.0"
|
24
24
|
end
|
data/test/helper.rb
CHANGED
@@ -21,8 +21,7 @@ module RumlTestSupport
|
|
21
21
|
def exec_ruml(arg, input)
|
22
22
|
# TODO execute "bin/ruml" directly
|
23
23
|
begin
|
24
|
-
|
25
|
-
ml.broadcast!(input)
|
24
|
+
Ruml.broadcast!(arg, input)
|
26
25
|
"" # empty output
|
27
26
|
rescue => e
|
28
27
|
"#{e.message} (#{e.class})"
|
@@ -49,10 +48,12 @@ module RumlTestSupport
|
|
49
48
|
end
|
50
49
|
end
|
51
50
|
|
52
|
-
MiniTest::
|
51
|
+
class MiniTest::Test
|
52
|
+
include RumlTestSupport
|
53
53
|
|
54
|
-
|
55
|
-
|
54
|
+
def setup
|
55
|
+
Mail::TestMailer.deliveries.clear
|
56
|
+
end
|
56
57
|
end
|
57
58
|
|
58
59
|
module Kernel
|
metadata
CHANGED
@@ -1,72 +1,84 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
|
-
- Peter
|
7
|
+
- Peter Leitzen
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2018-01-27 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rake
|
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: 0.9.2
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.9.2
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
28
|
name: minitest
|
27
|
-
requirement:
|
28
|
-
none: false
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
|
-
- -
|
31
|
+
- - "~>"
|
31
32
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
33
|
+
version: 5.11.2
|
33
34
|
type: :development
|
34
35
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 5.11.2
|
36
41
|
- !ruby/object:Gem::Dependency
|
37
42
|
name: mail
|
38
|
-
requirement:
|
39
|
-
none: false
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
40
44
|
requirements:
|
41
|
-
- - ~>
|
45
|
+
- - "~>"
|
42
46
|
- !ruby/object:Gem::Version
|
43
|
-
version: 2.
|
47
|
+
version: 2.7.0
|
44
48
|
type: :runtime
|
45
49
|
prerelease: false
|
46
|
-
version_requirements:
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.7.0
|
47
55
|
- !ruby/object:Gem::Dependency
|
48
|
-
name: moneta
|
49
|
-
requirement:
|
50
|
-
none: false
|
56
|
+
name: moneta
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
51
58
|
requirements:
|
52
|
-
- - ~>
|
59
|
+
- - "~>"
|
53
60
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
61
|
+
version: 1.0.0
|
55
62
|
type: :runtime
|
56
63
|
prerelease: false
|
57
|
-
version_requirements:
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.0.0
|
58
69
|
description: ''
|
59
70
|
email:
|
60
|
-
- peter@suschlik.de
|
71
|
+
- peter-ruml@suschlik.de
|
61
72
|
executables:
|
62
73
|
- ruml
|
63
74
|
extensions: []
|
64
75
|
extra_rdoc_files: []
|
65
76
|
files:
|
66
|
-
- .gitignore
|
67
|
-
- .rvmrc
|
68
|
-
- .travis.yml
|
77
|
+
- ".gitignore"
|
78
|
+
- ".rvmrc"
|
79
|
+
- ".travis.yml"
|
69
80
|
- Gemfile
|
81
|
+
- LICENSE
|
70
82
|
- README.md
|
71
83
|
- Rakefile
|
72
84
|
- bin/ruml
|
@@ -89,26 +101,25 @@ files:
|
|
89
101
|
- test/integration_test.rb
|
90
102
|
homepage: https://github.com/splattael/ruml
|
91
103
|
licenses: []
|
104
|
+
metadata: {}
|
92
105
|
post_install_message:
|
93
106
|
rdoc_options: []
|
94
107
|
require_paths:
|
95
108
|
- lib
|
96
109
|
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
110
|
requirements:
|
99
|
-
- -
|
111
|
+
- - ">="
|
100
112
|
- !ruby/object:Gem::Version
|
101
113
|
version: '0'
|
102
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
-
none: false
|
104
115
|
requirements:
|
105
|
-
- -
|
116
|
+
- - ">="
|
106
117
|
- !ruby/object:Gem::Version
|
107
118
|
version: '0'
|
108
119
|
requirements: []
|
109
120
|
rubyforge_project:
|
110
|
-
rubygems_version:
|
121
|
+
rubygems_version: 2.6.14
|
111
122
|
signing_key:
|
112
|
-
specification_version:
|
123
|
+
specification_version: 4
|
113
124
|
summary: Ruby mailing list software
|
114
125
|
test_files: []
|