docile 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/.coveralls.yml ADDED
@@ -0,0 +1,2 @@
1
+ service_name: travis-pro
2
+
data/.gitignore CHANGED
@@ -5,3 +5,4 @@ pkg
5
5
  .idea
6
6
  doc
7
7
  .yardoc
8
+ coverage
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ docile
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.0.0-p247
data/.travis.yml CHANGED
@@ -1,6 +1,7 @@
1
1
  language: ruby
2
2
  bundler_args: --without development
3
3
  rvm:
4
+ - 2.0.0
4
5
  - 1.9.3
5
6
  - 1.9.2
6
7
  - 1.8.7
@@ -8,4 +9,4 @@ rvm:
8
9
  - jruby-18mode
9
10
  - jruby-19mode
10
11
  - rbx-18mode
11
- - rbx-19mode
12
+ - rbx-19mode
data/Gemfile CHANGED
@@ -7,4 +7,5 @@ gemspec
7
7
  group :test do
8
8
  gem "rake", ">= 0.9.2"
9
9
  gem "rspec", ">= 2.11.0"
10
- end
10
+ gem "coveralls", :require => false
11
+ end
data/HISTORY.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # HISTORY
2
2
 
3
+ ## [v1.0.3 (Jul 6, 2013)](http://github.com/ms-ati/docile/compare/v1.0.2...v1.0.3)
4
+
5
+ - instrument code coverage via SimpleCov and publish to Coveralls.io
6
+
3
7
  ## [v1.0.2 (Apr 1, 2013)](http://github.com/ms-ati/docile/compare/v1.0.1...v1.0.2)
4
8
 
5
9
  - allow passing parameters to DSL blocks (thanks @dslh!)
data/README.md CHANGED
@@ -8,8 +8,11 @@ Let's make our Ruby DSLs more docile...
8
8
 
9
9
  [1]: http://www.google.com/search?q=docile+definition "Google"
10
10
 
11
+ [![Gem Version](https://badge.fury.io/rb/docile.png)](http://badge.fury.io/rb/docile)
11
12
  [![Build Status](https://travis-ci.org/ms-ati/docile.png)](https://travis-ci.org/ms-ati/docile)
12
13
  [![Dependency Status](https://gemnasium.com/ms-ati/docile.png)](https://gemnasium.com/ms-ati/docile)
14
+ [![Code Climate](https://codeclimate.com/github/ms-ati/docile.png)](https://codeclimate.com/github/ms-ati/docile)
15
+ [![Coverage Status](https://coveralls.io/repos/ms-ati/docile/badge.png)](https://coveralls.io/r/ms-ati/docile)
13
16
 
14
17
  ## Basic Usage
15
18
 
data/docile.gemspec CHANGED
@@ -27,4 +27,7 @@ Gem::Specification.new do |s|
27
27
  s.add_development_dependency "yard"
28
28
  s.add_development_dependency "redcarpet"
29
29
  s.add_development_dependency "github-markup"
30
+
31
+ # Coveralls test coverage tool
32
+ s.add_development_dependency "coveralls"
30
33
  end
@@ -19,15 +19,6 @@ module Docile
19
19
  @__fallback__ = fallback
20
20
  end
21
21
 
22
- def id
23
- @__receiver__.__send__(:id)
24
- end
25
-
26
- # Special case due to `Kernel#sub`'s existence
27
- def sub(*args, &block)
28
- __proxy_method__(:sub, *args, &block)
29
- end
30
-
31
22
  # Special case to allow proxy instance variables
32
23
  def instance_variables
33
24
  # Ruby 1.8.x returns string names, convert to symbols
@@ -42,11 +33,7 @@ module Docile
42
33
  begin
43
34
  @__receiver__.__send__(method.to_sym, *args, &block)
44
35
  rescue ::NoMethodError => e
45
- begin
46
- @__fallback__.__send__(method.to_sym, *args, &block)
47
- rescue ::NoMethodError
48
- raise(e)
49
- end
36
+ @__fallback__.__send__(method.to_sym, *args, &block)
50
37
  end
51
38
  end
52
39
  end
@@ -1,3 +1,3 @@
1
1
  module Docile
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
data/spec/docile_spec.rb CHANGED
@@ -13,6 +13,15 @@ describe Docile do
13
13
  end.should == [1, 3]
14
14
  end
15
15
 
16
+ it "should use the __id__ method of the proxy object" do
17
+ arr = []
18
+ Docile.dsl_eval(arr) { __id__.should_not == arr.__id__ }
19
+ end
20
+
21
+ it "should raise NoMethodError if the DSL object doesn't implement the method" do
22
+ expect { Docile.dsl_eval([]) { no_such_method } }.to raise_error(NoMethodError)
23
+ end
24
+
16
25
  Pizza = Struct.new(:cheese, :pepperoni, :bacon, :sauce)
17
26
 
18
27
  class PizzaBuilder
@@ -42,11 +51,12 @@ describe Docile do
42
51
  class OuterDSL
43
52
  def initialize; @a = 'a'; end
44
53
  attr_accessor :a
54
+
45
55
  def inner(&block)
46
56
  Docile.dsl_eval(InnerDSL.new, &block)
47
57
  end
48
58
 
49
- def inner_with_params(param,&block)
59
+ def inner_with_params(param, &block)
50
60
  Docile.dsl_eval(InnerDSL.new, param, :foo, &block)
51
61
  end
52
62
  end
@@ -55,7 +65,7 @@ describe Docile do
55
65
  Docile.dsl_eval(OuterDSL.new, &block)
56
66
  end
57
67
 
58
- def parameterized(*args,&block)
68
+ def parameterized(*args, &block)
59
69
  Docile.dsl_eval(OuterDSL.new, *args, &block)
60
70
  end
61
71
 
@@ -204,6 +214,7 @@ describe Docile do
204
214
  @second.should == 'Got a new ten speed'
205
215
  fourth.should == 2
206
216
  end
217
+
207
218
  end
208
219
 
209
220
  end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,15 @@
1
1
  require 'rubygems'
2
2
  require 'rspec'
3
3
  require 'singleton'
4
+ require 'simplecov'
5
+ require 'coveralls'
6
+
7
+ # Both local SimpleCov and publish to Coveralls.io
8
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
9
+ SimpleCov::Formatter::HTMLFormatter,
10
+ Coveralls::SimpleCov::Formatter
11
+ ]
12
+ SimpleCov.start
4
13
 
5
14
  test_dir = File.dirname(__FILE__)
6
15
  $LOAD_PATH.unshift test_dir unless $LOAD_PATH.include?(test_dir)
metadata CHANGED
@@ -1,106 +1,124 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: docile
3
- version: !ruby/object:Gem::Version
4
- version: 1.0.2
3
+ version: !ruby/object:Gem::Version
4
+ hash: 17
5
5
  prerelease:
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 3
10
+ version: 1.0.3
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Marc Siegel
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2013-04-01 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2013-07-06 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
15
21
  name: rake
16
- requirement: !ruby/object:Gem::Requirement
22
+ version_requirements: &id001 !ruby/object:Gem::Requirement
17
23
  none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ hash: 63
28
+ segments:
29
+ - 0
30
+ - 9
31
+ - 2
21
32
  version: 0.9.2
22
- type: :development
23
33
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: 0.9.2
30
- - !ruby/object:Gem::Dependency
34
+ type: :development
35
+ requirement: *id001
36
+ - !ruby/object:Gem::Dependency
31
37
  name: rspec
32
- requirement: !ruby/object:Gem::Requirement
38
+ version_requirements: &id002 !ruby/object:Gem::Requirement
33
39
  none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 35
44
+ segments:
45
+ - 2
46
+ - 11
47
+ - 0
37
48
  version: 2.11.0
38
- type: :development
39
49
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: 2.11.0
46
- - !ruby/object:Gem::Dependency
50
+ type: :development
51
+ requirement: *id002
52
+ - !ruby/object:Gem::Dependency
47
53
  name: yard
48
- requirement: !ruby/object:Gem::Requirement
54
+ version_requirements: &id003 !ruby/object:Gem::Requirement
49
55
  none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
54
- type: :development
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 3
60
+ segments:
61
+ - 0
62
+ version: "0"
55
63
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- - !ruby/object:Gem::Dependency
64
+ type: :development
65
+ requirement: *id003
66
+ - !ruby/object:Gem::Dependency
63
67
  name: redcarpet
64
- requirement: !ruby/object:Gem::Requirement
68
+ version_requirements: &id004 !ruby/object:Gem::Requirement
65
69
  none: false
66
- requirements:
67
- - - ! '>='
68
- - !ruby/object:Gem::Version
69
- version: '0'
70
- type: :development
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ version: "0"
71
77
  prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
78
- - !ruby/object:Gem::Dependency
78
+ type: :development
79
+ requirement: *id004
80
+ - !ruby/object:Gem::Dependency
79
81
  name: github-markup
80
- requirement: !ruby/object:Gem::Requirement
82
+ version_requirements: &id005 !ruby/object:Gem::Requirement
81
83
  none: false
82
- requirements:
83
- - - ! '>='
84
- - !ruby/object:Gem::Version
85
- version: '0'
86
- type: :development
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ hash: 3
88
+ segments:
89
+ - 0
90
+ version: "0"
87
91
  prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
92
+ type: :development
93
+ requirement: *id005
94
+ - !ruby/object:Gem::Dependency
95
+ name: coveralls
96
+ version_requirements: &id006 !ruby/object:Gem::Requirement
89
97
  none: false
90
- requirements:
91
- - - ! '>='
92
- - !ruby/object:Gem::Version
93
- version: '0'
94
- description: Docile turns any Ruby object into a DSL. Especially useful with the Builder
95
- pattern.
96
- email:
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ hash: 3
102
+ segments:
103
+ - 0
104
+ version: "0"
105
+ prerelease: false
106
+ type: :development
107
+ requirement: *id006
108
+ description: Docile turns any Ruby object into a DSL. Especially useful with the Builder pattern.
109
+ email:
97
110
  - msiegel@usainnov.com
98
111
  executables: []
112
+
99
113
  extensions: []
114
+
100
115
  extra_rdoc_files: []
101
- files:
116
+
117
+ files:
118
+ - .coveralls.yml
102
119
  - .gitignore
103
- - .rvmrc
120
+ - .ruby-gemset
121
+ - .ruby-version
104
122
  - .travis.yml
105
123
  - .yardopts
106
124
  - Gemfile
@@ -116,35 +134,38 @@ files:
116
134
  - spec/spec_helper.rb
117
135
  homepage: http://ms-ati.github.com/docile/
118
136
  licenses: []
137
+
119
138
  post_install_message:
120
139
  rdoc_options: []
121
- require_paths:
140
+
141
+ require_paths:
122
142
  - lib
123
- required_ruby_version: !ruby/object:Gem::Requirement
143
+ required_ruby_version: !ruby/object:Gem::Requirement
124
144
  none: false
125
- requirements:
126
- - - ! '>='
127
- - !ruby/object:Gem::Version
128
- version: '0'
129
- segments:
145
+ requirements:
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ hash: 3
149
+ segments:
130
150
  - 0
131
- hash: -106941105642538059
132
- required_rubygems_version: !ruby/object:Gem::Requirement
151
+ version: "0"
152
+ required_rubygems_version: !ruby/object:Gem::Requirement
133
153
  none: false
134
- requirements:
135
- - - ! '>='
136
- - !ruby/object:Gem::Version
137
- version: '0'
138
- segments:
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ hash: 3
158
+ segments:
139
159
  - 0
140
- hash: -106941105642538059
160
+ version: "0"
141
161
  requirements: []
162
+
142
163
  rubyforge_project: docile
143
164
  rubygems_version: 1.8.25
144
165
  signing_key:
145
166
  specification_version: 3
146
167
  summary: Docile keeps your Ruby DSL's tame and well-behaved
147
- test_files:
168
+ test_files:
148
169
  - spec/docile_spec.rb
149
170
  - spec/spec_helper.rb
150
171
  has_rdoc:
data/.rvmrc DELETED
@@ -1,48 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
- # development environment upon cd'ing into the directory
5
-
6
- # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
7
- # Only full ruby name is supported here, for short names use:
8
- # echo "rvm use 1.9.3" > .rvmrc
9
- environment_id="ruby-1.9.3-p385@docile"
10
-
11
- # Uncomment the following lines if you want to verify rvm version per project
12
- # rvmrc_rvm_version="1.18.8 (stable)" # 1.10.1 seams as a safe start
13
- # eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
14
- # echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
15
- # return 1
16
- # }
17
-
18
- # First we attempt to load the desired environment directly from the environment
19
- # file. This is very fast and efficient compared to running through the entire
20
- # CLI and selector. If you want feedback on which environment was used then
21
- # insert the word 'use' after --create as this triggers verbose mode.
22
- if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
23
- && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
24
- then
25
- \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
26
- [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
27
- \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
28
- else
29
- # If the environment file has not yet been created, use the RVM CLI to select.
30
- rvm --create "$environment_id" || {
31
- echo "Failed to create RVM environment '${environment_id}'."
32
- return 1
33
- }
34
- fi
35
-
36
- # If you use bundler, this might be useful to you:
37
- # if [[ -s Gemfile ]] && {
38
- # ! builtin command -v bundle >/dev/null ||
39
- # builtin command -v bundle | GREP_OPTIONS= \grep $rvm_path/bin/bundle >/dev/null
40
- # }
41
- # then
42
- # printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
43
- # gem install bundler
44
- # fi
45
- # if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
46
- # then
47
- # bundle install | GREP_OPTIONS= \grep -vE '^Using|Your bundle is complete'
48
- # fi