concord 0.1.0 → 0.1.1
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.
- data/Changelog.md +4 -0
- data/Rakefile +27 -0
- data/concord.gemspec +1 -1
- data/config/reek.yml +1 -1
- data/lib/concord.rb +19 -1
- data/spec/unit/concord/universal_spec.rb +14 -0
- metadata +2 -2
data/Changelog.md
CHANGED
data/Rakefile
CHANGED
@@ -1,2 +1,29 @@
|
|
1
1
|
require 'devtools'
|
2
2
|
Devtools.init_rake_tasks
|
3
|
+
|
4
|
+
class Rake::Task
|
5
|
+
def overwrite(&block)
|
6
|
+
@actions.clear
|
7
|
+
enhance(&block)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
Rake.application.load_imports
|
12
|
+
|
13
|
+
begin
|
14
|
+
require 'mutant'
|
15
|
+
rescue LoadError
|
16
|
+
end
|
17
|
+
|
18
|
+
mutant_present = defined?(Mutant)
|
19
|
+
|
20
|
+
allowed_versions = %w(mri-1.9.3 rbx-1.9.3)
|
21
|
+
|
22
|
+
if allowed_versions.include?(Devtools.rvm) and mutant_present and !ENV['DEVTOOLS_SELF']
|
23
|
+
Rake::Task['metrics:mutant'].overwrite do
|
24
|
+
status = Mutant::CLI.run(%W(--rspec-full -r ./spec/spec_helper.rb ::Concord))
|
25
|
+
unless status.zero?
|
26
|
+
fail "Not mutation covered :("
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/concord.gemspec
CHANGED
data/config/reek.yml
CHANGED
data/lib/concord.rb
CHANGED
@@ -106,4 +106,22 @@ private
|
|
106
106
|
names.join(', ')
|
107
107
|
end
|
108
108
|
|
109
|
-
|
109
|
+
# Mixin for public attribute readers
|
110
|
+
class Public < self
|
111
|
+
|
112
|
+
# Hook called when module is included
|
113
|
+
#
|
114
|
+
# @param [Class,Module] descendant
|
115
|
+
#
|
116
|
+
# @return [undefined]
|
117
|
+
#
|
118
|
+
# @api private
|
119
|
+
#
|
120
|
+
def included(descendant)
|
121
|
+
super
|
122
|
+
@names.each do |name|
|
123
|
+
descendant.send(:public, name)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end # Public
|
127
|
+
end # Concord
|
@@ -60,4 +60,18 @@ describe Concord do
|
|
60
60
|
expect { Concord.new(:a, :b, :c, :d) }.to raise_error(RuntimeError, 'Composition of more than three objects is not allowed')
|
61
61
|
end
|
62
62
|
end
|
63
|
+
|
64
|
+
context Concord::Public do
|
65
|
+
let(:class_under_test) do
|
66
|
+
Class.new do
|
67
|
+
include Concord::Public.new(:foo, :bar)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'should create public attr readers' do
|
72
|
+
object = class_under_test.new(:foo, :bar)
|
73
|
+
object.foo.should eql(:foo)
|
74
|
+
object.bar.should eql(:bar)
|
75
|
+
end
|
76
|
+
end
|
63
77
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: adamantium
|