concord 0.1.4 → 0.1.5
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 +4 -4
- data/.rubocop.yml +7 -0
- data/.travis.yml +1 -3
- data/Changelog.md +18 -0
- data/Gemfile +2 -2
- data/Gemfile.devtools +36 -20
- data/Rakefile +9 -0
- data/circle.yml +4 -0
- data/concord.gemspec +6 -3
- data/config/flay.yml +1 -1
- data/config/reek.yml +3 -2
- data/config/rubocop.yml +82 -0
- data/lib/concord.rb +12 -11
- data/spec/unit/concord/universal_spec.rb +41 -5
- metadata +23 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f74165f31b905e23604129b63bee915d27163b01
|
4
|
+
data.tar.gz: a0c18289f47110909de05e3a0af56b10a282101a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4efa105dc76a5bdff0b93d2fb91897a56f16ae1115314472bc25b913d7eb2f153ef0c0514d123b1d257856a2524008c7463d61a2e97ea447bfb30a8b878b9229
|
7
|
+
data.tar.gz: 1c13e549d343a704e9df9d336e7f6d9430280c8a24a069a90c2c81e20ec9a1256792aa294e90ae54a1df10392d028b703b8faf22eb97979173f32a9302cbc780
|
data/.rubocop.yml
ADDED
data/.travis.yml
CHANGED
data/Changelog.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
# v0.1.5 2014-04-10
|
2
|
+
|
3
|
+
* Dependency bumps
|
4
|
+
* Support calling (z)super from custom initialize
|
5
|
+
|
6
|
+
# v0.1.4 2013-09-22
|
7
|
+
|
8
|
+
* Dependency bumps
|
9
|
+
|
10
|
+
# v0.1.3 2013-08-31
|
11
|
+
|
12
|
+
* Dependency bumps
|
13
|
+
|
14
|
+
# v0.1.2 2013-08-07
|
15
|
+
|
16
|
+
* Dependency bumps
|
17
|
+
* Internal refactorings
|
18
|
+
|
1
19
|
# v0.1.1 2013-05-15
|
2
20
|
|
3
21
|
+ Add Concord::Public mixin defaulting to public attr_readers
|
data/Gemfile
CHANGED
data/Gemfile.devtools
CHANGED
@@ -1,47 +1,63 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
group :development do
|
4
|
-
gem 'rake',
|
5
|
-
gem 'rspec',
|
6
|
-
gem '
|
4
|
+
gem 'rake', '~> 10.2.1'
|
5
|
+
gem 'rspec', '~> 2.14.1'
|
6
|
+
gem 'rspec-core', '~> 2.14.8'
|
7
|
+
gem 'yard', '~> 0.8.7.4'
|
8
|
+
|
9
|
+
platform :rbx do
|
10
|
+
gem 'rubysl-singleton', '~> 2.0.0'
|
11
|
+
end
|
7
12
|
end
|
8
13
|
|
9
14
|
group :yard do
|
10
|
-
gem 'kramdown', '~> 1.
|
15
|
+
gem 'kramdown', '~> 1.3.3'
|
11
16
|
end
|
12
17
|
|
13
18
|
group :guard do
|
14
|
-
gem 'guard', '~>
|
15
|
-
gem 'guard-bundler', '~>
|
16
|
-
gem 'guard-rspec', '~>
|
17
|
-
gem 'guard-rubocop', '~> 0.2
|
18
|
-
# gem 'guard-mutant', '~> 0.0.1'
|
19
|
+
gem 'guard', '~> 2.6.0'
|
20
|
+
gem 'guard-bundler', '~> 2.0.0'
|
21
|
+
gem 'guard-rspec', '~> 4.2.8'
|
22
|
+
gem 'guard-rubocop', '~> 1.0.2'
|
19
23
|
|
20
24
|
# file system change event handling
|
21
|
-
gem 'listen', '~>
|
25
|
+
gem 'listen', '~> 2.7.1'
|
22
26
|
gem 'rb-fchange', '~> 0.0.6', require: false
|
23
|
-
gem 'rb-fsevent', '~> 0.9.
|
24
|
-
gem 'rb-inotify', '~> 0.9.
|
27
|
+
gem 'rb-fsevent', '~> 0.9.4', require: false
|
28
|
+
gem 'rb-inotify', '~> 0.9.3', require: false
|
25
29
|
|
26
30
|
# notification handling
|
27
|
-
gem 'libnotify', '~> 0.8.
|
31
|
+
gem 'libnotify', '~> 0.8.2', require: false
|
28
32
|
gem 'rb-notifu', '~> 0.0.4', require: false
|
29
33
|
gem 'terminal-notifier-guard', '~> 1.5.3', require: false
|
30
34
|
end
|
31
35
|
|
32
36
|
group :metrics do
|
33
|
-
gem 'coveralls', '~> 0.
|
37
|
+
gem 'coveralls', '~> 0.7.0'
|
34
38
|
gem 'flay', '~> 2.4.0'
|
35
|
-
gem 'flog', '~> 4.
|
36
|
-
gem 'reek', '~> 1.3.
|
37
|
-
gem 'rubocop', '~> 0.
|
38
|
-
gem 'simplecov', '~> 0.
|
39
|
-
gem 'yardstick', '~> 0.9.
|
39
|
+
gem 'flog', '~> 4.2.0'
|
40
|
+
gem 'reek', '~> 1.3.7'
|
41
|
+
gem 'rubocop', '~> 0.19.1'
|
42
|
+
gem 'simplecov', '~> 0.8.2'
|
43
|
+
gem 'yardstick', '~> 0.9.9'
|
44
|
+
|
45
|
+
platforms :mri do
|
46
|
+
gem 'mutant', '~> 0.5.10'
|
47
|
+
gem 'mutant-rspec', '~> 0.5.10'
|
48
|
+
end
|
40
49
|
|
41
50
|
platforms :ruby_19, :ruby_20 do
|
42
|
-
# gem 'mutant', git: 'https://github.com/mbj/mutant.git'
|
43
51
|
gem 'yard-spellcheck', '~> 0.1.5'
|
44
52
|
end
|
53
|
+
|
54
|
+
platform :rbx do
|
55
|
+
gem 'json', '~> 1.8.1'
|
56
|
+
gem 'racc', '~> 1.4.11'
|
57
|
+
gem 'rubysl-logger', '~> 2.0.0'
|
58
|
+
gem 'rubysl-open-uri', '~> 2.0.0'
|
59
|
+
gem 'rubysl-prettyprint', '~> 2.0.3'
|
60
|
+
end
|
45
61
|
end
|
46
62
|
|
47
63
|
group :benchmarks do
|
data/Rakefile
CHANGED
@@ -1,2 +1,11 @@
|
|
1
1
|
require 'devtools'
|
2
2
|
Devtools.init_rake_tasks
|
3
|
+
|
4
|
+
Rake.application.load_imports
|
5
|
+
task('metrics:mutant').clear
|
6
|
+
|
7
|
+
namespace :metrics do
|
8
|
+
task :mutant => :coverage do
|
9
|
+
$stderr.puts 'Concord is a dependency of mutant and zombification is currently defunkt :('
|
10
|
+
end
|
11
|
+
end
|
data/circle.yml
ADDED
data/concord.gemspec
CHANGED
@@ -2,11 +2,12 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'concord'
|
5
|
-
s.version = '0.1.
|
5
|
+
s.version = '0.1.5'
|
6
6
|
s.authors = ['Markus Schirp']
|
7
7
|
s.email = ['mbj@schirp-dso.com']
|
8
8
|
s.homepage = 'https://github.com/mbj/concord'
|
9
9
|
s.summary = %q{Helper for object composition}
|
10
|
+
s.license = 'MIT'
|
10
11
|
s.description = s.summary
|
11
12
|
|
12
13
|
s.files = `git ls-files`.split("\n")
|
@@ -14,6 +15,8 @@ Gem::Specification.new do |s|
|
|
14
15
|
s.executables = []
|
15
16
|
s.require_paths = ['lib']
|
16
17
|
|
17
|
-
s.
|
18
|
-
|
18
|
+
s.required_ruby_version = '>= 1.9.3'
|
19
|
+
|
20
|
+
s.add_dependency('adamantium', '~> 0.2.0')
|
21
|
+
s.add_dependency('equalizer', '~> 0.0.9')
|
19
22
|
end
|
data/config/flay.yml
CHANGED
data/config/reek.yml
CHANGED
data/config/rubocop.yml
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
inherit_from: ../.rubocop.yml
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
Includes:
|
5
|
+
- '**/*.rake'
|
6
|
+
- 'Gemfile'
|
7
|
+
- 'Gemfile.triage'
|
8
|
+
|
9
|
+
# Avoid parameter lists longer than five parameters.
|
10
|
+
ParameterLists:
|
11
|
+
Max: 3
|
12
|
+
CountKeywordArgs: true
|
13
|
+
|
14
|
+
MethodLength:
|
15
|
+
CountComments: false
|
16
|
+
Max: 15
|
17
|
+
|
18
|
+
# Avoid more than `Max` levels of nesting.
|
19
|
+
BlockNesting:
|
20
|
+
Max: 3
|
21
|
+
|
22
|
+
# Align with the style guide.
|
23
|
+
CollectionMethods:
|
24
|
+
PreferredMethods:
|
25
|
+
collect: 'map'
|
26
|
+
inject: 'reduce'
|
27
|
+
find: 'detect'
|
28
|
+
find_all: 'select'
|
29
|
+
|
30
|
+
# Limit line length
|
31
|
+
LineLength:
|
32
|
+
Max: 113 # TODO: lower to 79 once the rubocop branch in shared/Gemfile is removed
|
33
|
+
|
34
|
+
ClassLength:
|
35
|
+
Max: 204
|
36
|
+
|
37
|
+
# Disabled because of indenting with private keyword in class bodies.
|
38
|
+
IndentationWidth:
|
39
|
+
Enabled: false
|
40
|
+
|
41
|
+
# I like raise more
|
42
|
+
SignalException:
|
43
|
+
Enabled: false
|
44
|
+
|
45
|
+
# False positive in unparser source
|
46
|
+
OneLineConditional:
|
47
|
+
Enabled: false
|
48
|
+
|
49
|
+
Documentation:
|
50
|
+
Enabled: false
|
51
|
+
|
52
|
+
# Disable documentation checking until a class needs to be documented once
|
53
|
+
Documentation:
|
54
|
+
Enabled: false
|
55
|
+
|
56
|
+
# Do not favor modifier if/unless usage when you have a single-line body
|
57
|
+
IfUnlessModifier:
|
58
|
+
Enabled: false
|
59
|
+
|
60
|
+
# Allow case equality operator (in limited use within the specs)
|
61
|
+
CaseEquality:
|
62
|
+
Enabled: false
|
63
|
+
|
64
|
+
# Constants do not always have to use SCREAMING_SNAKE_CASE
|
65
|
+
ConstantName:
|
66
|
+
Enabled: false
|
67
|
+
|
68
|
+
# Not all trivial readers/writers can be defined with attr_* methods
|
69
|
+
TrivialAccessors:
|
70
|
+
Enabled: false
|
71
|
+
|
72
|
+
# Do not prefer do/end over {} for multiline blocks
|
73
|
+
Blocks:
|
74
|
+
Enabled: false
|
75
|
+
|
76
|
+
# I like to have an empty line before closing the currently opened body
|
77
|
+
EmptyLinesAroundBody:
|
78
|
+
Enabled: false
|
79
|
+
|
80
|
+
# I like my style more
|
81
|
+
AccessModifierIndentation:
|
82
|
+
Enabled: false
|
data/lib/concord.rb
CHANGED
@@ -30,6 +30,10 @@ class Concord < Module
|
|
30
30
|
end
|
31
31
|
|
32
32
|
@names = names
|
33
|
+
@module = Module.new
|
34
|
+
define_initialize
|
35
|
+
define_readers
|
36
|
+
define_equalizer
|
33
37
|
end
|
34
38
|
|
35
39
|
# Hook run when module is included
|
@@ -41,9 +45,7 @@ class Concord < Module
|
|
41
45
|
# @api private
|
42
46
|
#
|
43
47
|
def included(descendant)
|
44
|
-
|
45
|
-
define_readers(descendant)
|
46
|
-
define_equalizer(descendant)
|
48
|
+
descendant.send(:include, @module)
|
47
49
|
end
|
48
50
|
|
49
51
|
# Define equalizer
|
@@ -54,8 +56,8 @@ class Concord < Module
|
|
54
56
|
#
|
55
57
|
# @api private
|
56
58
|
#
|
57
|
-
def define_equalizer
|
58
|
-
|
59
|
+
def define_equalizer
|
60
|
+
@module.send(:include, Equalizer.new(*@names))
|
59
61
|
end
|
60
62
|
|
61
63
|
# Define readers
|
@@ -66,9 +68,9 @@ class Concord < Module
|
|
66
68
|
#
|
67
69
|
# @api private
|
68
70
|
#
|
69
|
-
def define_readers
|
71
|
+
def define_readers
|
70
72
|
attribute_names = names
|
71
|
-
|
73
|
+
@module.class_eval do
|
72
74
|
attr_reader(*attribute_names)
|
73
75
|
protected(*attribute_names)
|
74
76
|
end
|
@@ -82,14 +84,13 @@ class Concord < Module
|
|
82
84
|
#
|
83
85
|
# @api private
|
84
86
|
#
|
85
|
-
def define_initialize
|
87
|
+
def define_initialize
|
86
88
|
ivars, size = instance_variable_names, names.size
|
87
|
-
|
89
|
+
@module.class_eval do
|
88
90
|
define_method :initialize do |*args|
|
89
91
|
args_size = args.size
|
90
92
|
if args_size != size
|
91
|
-
raise ArgumentError,
|
92
|
-
"wrong number of arguments (#{args_size} for #{size})"
|
93
|
+
raise ArgumentError, "wrong number of arguments (#{args_size} for #{size})"
|
93
94
|
end
|
94
95
|
ivars.zip(args) { |ivar, arg| instance_variable_set(ivar, arg) }
|
95
96
|
end
|
@@ -18,20 +18,56 @@ describe Concord do
|
|
18
18
|
context 'initializer lines' do
|
19
19
|
it 'creates a private #initialize method' do
|
20
20
|
mod = Module.new
|
21
|
-
expect { mod.send(:include, Concord.new) }
|
22
|
-
to change { mod.private_method_defined?(:initialize) }
|
23
|
-
from(false).to(true)
|
21
|
+
expect { mod.send(:include, Concord.new) }
|
22
|
+
.to change { mod.private_method_defined?(:initialize) }
|
23
|
+
.from(false).to(true)
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'creates an initializer that asserts the number of arguments' do
|
27
|
-
expect { class_under_test.new(1) }
|
28
|
-
to raise_error(ArgumentError, 'wrong number of arguments (1 for 2)')
|
27
|
+
expect { class_under_test.new(1) }
|
28
|
+
.to raise_error(ArgumentError, 'wrong number of arguments (1 for 2)')
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'creates an initializer that allows 2 arguments' do
|
32
32
|
expect { class_under_test.new(1, 2) }.to_not raise_error
|
33
33
|
end
|
34
34
|
|
35
|
+
it 'creates an initializer that is callable via super' do
|
36
|
+
class_under_test.class_eval do
|
37
|
+
attr_reader :baz
|
38
|
+
public :foo
|
39
|
+
public :bar
|
40
|
+
|
41
|
+
def initialize(foo, bar)
|
42
|
+
@baz = foo + bar
|
43
|
+
super(foo, bar)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
instance = class_under_test.new(1, 2)
|
48
|
+
expect(instance.foo).to eql(1)
|
49
|
+
expect(instance.bar).to eql(2)
|
50
|
+
expect(instance.baz).to eql(3)
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'creates an initializer that is callable via zsuper' do
|
54
|
+
class_under_test.class_eval do
|
55
|
+
attr_reader :baz
|
56
|
+
public :foo
|
57
|
+
public :bar
|
58
|
+
|
59
|
+
def initialize(foo, bar)
|
60
|
+
@baz = foo + bar
|
61
|
+
super
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
instance = class_under_test.new(1, 2)
|
66
|
+
expect(instance.foo).to eql(1)
|
67
|
+
expect(instance.bar).to eql(2)
|
68
|
+
expect(instance.baz).to eql(3)
|
69
|
+
end
|
70
|
+
|
35
71
|
it 'creates an initializer that sets the instance variables' do
|
36
72
|
instance = class_under_test.new(1, 2)
|
37
73
|
expect(instance.instance_variable_get(:@foo)).to be(1)
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: concord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Markus Schirp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: adamantium
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.2.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 0.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: equalizer
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.0.
|
33
|
+
version: 0.0.9
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.0.
|
40
|
+
version: 0.0.9
|
41
41
|
description: Helper for object composition
|
42
42
|
email:
|
43
43
|
- mbj@schirp-dso.com
|
@@ -45,10 +45,11 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
-
- .circle.yml
|
49
|
-
- .gitignore
|
50
|
-
- .rspec
|
51
|
-
- .
|
48
|
+
- ".circle.yml"
|
49
|
+
- ".gitignore"
|
50
|
+
- ".rspec"
|
51
|
+
- ".rubocop.yml"
|
52
|
+
- ".travis.yml"
|
52
53
|
- Changelog.md
|
53
54
|
- Gemfile
|
54
55
|
- Gemfile.devtools
|
@@ -56,18 +57,21 @@ files:
|
|
56
57
|
- LICENSE
|
57
58
|
- README.md
|
58
59
|
- Rakefile
|
60
|
+
- circle.yml
|
59
61
|
- concord.gemspec
|
60
62
|
- config/flay.yml
|
61
63
|
- config/flog.yml
|
62
64
|
- config/mutant.yml
|
63
65
|
- config/reek.yml
|
64
66
|
- config/roodi.yml
|
67
|
+
- config/rubocop.yml
|
65
68
|
- config/yardstick.yml
|
66
69
|
- lib/concord.rb
|
67
70
|
- spec/spec_helper.rb
|
68
71
|
- spec/unit/concord/universal_spec.rb
|
69
72
|
homepage: https://github.com/mbj/concord
|
70
|
-
licenses:
|
73
|
+
licenses:
|
74
|
+
- MIT
|
71
75
|
metadata: {}
|
72
76
|
post_install_message:
|
73
77
|
rdoc_options: []
|
@@ -75,19 +79,18 @@ require_paths:
|
|
75
79
|
- lib
|
76
80
|
required_ruby_version: !ruby/object:Gem::Requirement
|
77
81
|
requirements:
|
78
|
-
- -
|
82
|
+
- - ">="
|
79
83
|
- !ruby/object:Gem::Version
|
80
|
-
version:
|
84
|
+
version: 1.9.3
|
81
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
86
|
requirements:
|
83
|
-
- -
|
87
|
+
- - ">="
|
84
88
|
- !ruby/object:Gem::Version
|
85
89
|
version: '0'
|
86
90
|
requirements: []
|
87
91
|
rubyforge_project:
|
88
|
-
rubygems_version: 2.
|
92
|
+
rubygems_version: 2.2.2
|
89
93
|
signing_key:
|
90
94
|
specification_version: 4
|
91
95
|
summary: Helper for object composition
|
92
96
|
test_files: []
|
93
|
-
has_rdoc:
|