concord 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ # v0.1.1 2013-05-15
2
+
3
+ + Add Concord::Public mixin defaulting to public attr_readers
4
+
1
5
  # v0.1.0 2013-05-15
2
6
 
3
7
  * [change] Set default attribute visibility to protected
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'concord'
5
- s.version = '0.1.0'
5
+ s.version = '0.1.1'
6
6
  s.authors = ['Markus Schirp']
7
7
  s.email = ['mbj@seonic.net']
8
8
  s.homepage = 'https://github.com/mbj/composition'
@@ -73,7 +73,7 @@ UncommunicativeVariableName:
73
73
  - !ruby/regexp /^.$/
74
74
  - !ruby/regexp /[0-9]$/
75
75
  - !ruby/regexp /[A-Z]/
76
- SimulatedPolymorphism:
76
+ RepeatedConditional:
77
77
  enabled: true
78
78
  max_ifs: 1
79
79
  DataClump:
@@ -106,4 +106,22 @@ private
106
106
  names.join(', ')
107
107
  end
108
108
 
109
- end
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.0
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-15 00:00:00.000000000 Z
12
+ date: 2013-05-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: adamantium