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.
@@ -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
@@ -1,6 +1,8 @@
1
+ language: ruby
2
+ cache: bundler
1
3
  rvm:
2
- - ree
3
- - 1.9.2
4
4
  - 1.9.3
5
- - rbx-2.0
6
- - jruby
5
+ - 2.1
6
+ - 2.2
7
+ - 2.3
8
+ - 2.4
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
+ [![Build Status](https://img.shields.io/travis/splattael/ruml.svg?branch=master)](https://travis-ci.org/splattael/ruml)
4
+ [![Gem Version](https://img.shields.io/gem/v/ruml.svg)](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
- Rake::TestTask.new(test_fixture) do |test|
13
- ENV['TEST_FIXTURE'] = test_fixture
14
- test.test_files = FileList.new('test/*_test.rb')
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
@@ -22,5 +22,4 @@ else
22
22
  end
23
23
  end
24
24
 
25
- ml = Ruml.new(ARGV[0])
26
- ml.broadcast!($stdin.read)
25
+ Ruml.broadcast!(ARGV[0], $stdin.read)
@@ -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
- autoload :List, 'ruml/list'
8
- autoload :Config, 'ruml/config'
9
- autoload :Broadcaster, 'ruml/broadcaster'
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'
@@ -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 send!
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
@@ -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 PlainYAML, :path => @path
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::BasicFile, :path => @path
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(adapater, *args)
26
- @moneta = Builder.new(adapater.new(*args))
27
- end
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
@@ -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)
@@ -1,3 +1,3 @@
1
1
  module Ruml
2
- VERSION = "0.1.0"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -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 Suschlik"]
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", "~> 2.3.0"
23
- s.add_runtime_dependency "moneta-splattael", "~> 0.7.0"
22
+ s.add_runtime_dependency "mail", "~> 2.7.0"
23
+ s.add_runtime_dependency "moneta", "~> 1.0.0"
24
24
  end
@@ -21,8 +21,7 @@ module RumlTestSupport
21
21
  def exec_ruml(arg, input)
22
22
  # TODO execute "bin/ruml" directly
23
23
  begin
24
- ml = Ruml.new(arg)
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::Unit::TestCase.send :include, RumlTestSupport
51
+ class MiniTest::Test
52
+ include RumlTestSupport
53
53
 
54
- MiniTest::Unit::TestCase.add_setup_hook do
55
- Mail::TestMailer.deliveries.clear
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: 0.1.0
5
- prerelease:
4
+ version: 1.0.0
6
5
  platform: ruby
7
6
  authors:
8
- - Peter Suschlik
7
+ - Peter Leitzen
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2011-11-23 00:00:00.000000000 Z
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: &5745740 !ruby/object:Gem::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: *5745740
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: &5744960 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
- - - ! '>='
31
+ - - "~>"
31
32
  - !ruby/object:Gem::Version
32
- version: '0'
33
+ version: 5.11.2
33
34
  type: :development
34
35
  prerelease: false
35
- version_requirements: *5744960
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: &5743680 !ruby/object:Gem::Requirement
39
- none: false
43
+ requirement: !ruby/object:Gem::Requirement
40
44
  requirements:
41
- - - ~>
45
+ - - "~>"
42
46
  - !ruby/object:Gem::Version
43
- version: 2.3.0
47
+ version: 2.7.0
44
48
  type: :runtime
45
49
  prerelease: false
46
- version_requirements: *5743680
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-splattael
49
- requirement: &5760440 !ruby/object:Gem::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.7.0
61
+ version: 1.0.0
55
62
  type: :runtime
56
63
  prerelease: false
57
- version_requirements: *5760440
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: 1.8.10
121
+ rubygems_version: 2.6.14
111
122
  signing_key:
112
- specification_version: 3
123
+ specification_version: 4
113
124
  summary: Ruby mailing list software
114
125
  test_files: []