facade 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '08b1c0c5be44519fb909688d3ad92d1bae29914cd0c4ac51c2b11065b8b62cb3'
4
- data.tar.gz: 68bec70bcbf894d378afb567ba06a1db42f2b882ef1286deefc1b6b9bd56072d
3
+ metadata.gz: 6717943e139c8af4bb62fc7403ec46f4539820dde024a56b14bf7d3433e77d1b
4
+ data.tar.gz: fa4c4ed14f9369a422417a2bd688e44c7a0b6f5143e4b12f82ffbd0219e443fa
5
5
  SHA512:
6
- metadata.gz: baaabe6d6096beef49dfa2712ba206010f45eed7887549a89cae4614908c6adaa870b6cba704ae8acf531720123438756684b3ad046e05cc7d34e7cfd1e86775
7
- data.tar.gz: adc983591d2b9396081ee99b7a653dd1bfcfc44ca9a65edaa235f0c2f272663d3d9e07a7c9ff6b9152fdf57ed5b3478415b2499954d1167ed6e4f756ab0a2f14
6
+ metadata.gz: b376fc1f69f81c881772f6bccc4fad631af784d9b9f05865cc481b807ec6bf6cc03de603d62fca414e949c3c6b2e86ad17e5b83acd25085f93b84852408ee0aa
7
+ data.tar.gz: 8602a3a44236e99b90e10a38a59145f9f03f5469fd0782cbe60226b8b38a2d42f3160872e26d7585ba9e65c73efba752c79b42522bfc0c7db6be533dd555c96c
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,39 +1,46 @@
1
- == 1.1.0 - 28-Jan-2019
1
+ ## 1.2.0 - 30-Sep-2020
2
+ * Switched from test-unit to rspec, and added a Gemfile.
3
+ * Use markdown for text files.
4
+
5
+ ## 1.1.1 - 2-Jun-2020
6
+ * Added a LICENSE file as per the Apache-2.0 requirements.
7
+
8
+ ## 1.1.0 - 28-Jan-2019
2
9
  * License switched to Apache-2.0.
3
10
  * The FACADE_VERSION constant is now frozen.
4
11
  * Added some metadata to the gemspec.
5
12
  * Updated the cert, should be good for about 10 years.
6
13
 
7
- == 1.0.7 - 9-Sep-2015
14
+ ## 1.0.7 - 9-Sep-2015
8
15
  * This gem is now signed.
9
16
  * The Rakefile tasks now assume Rubygems 2.x.
10
17
 
11
- == 1.0.6 - 12-Oct-2014
18
+ ## 1.0.6 - 12-Oct-2014
12
19
  * Updates to the gemspec and Rakefile.
13
20
 
14
- == 1.0.5 - 10-Nov-2010
21
+ ## 1.0.5 - 10-Nov-2010
15
22
  * Refactored the Rakefile.
16
23
 
17
- == 1.0.4 - 3-Aug-2009
24
+ ## 1.0.4 - 3-Aug-2009
18
25
  * Fixed a symbol vs string issue for Ruby 1.9.x.
19
26
 
20
- == 1.0.3 - 21-Jul-2009
27
+ ## 1.0.3 - 21-Jul-2009
21
28
  * License changed to Artistic 2.0.
22
29
  * Documentation updates.
23
30
  * Test file renamed to test_facade.rb.
24
31
  * Some Rakefile and gemspec updates
25
32
  * One test modified so that it passes with 1.9.x as well.
26
33
 
27
- == 1.0.2 - 11-Jun-2007
34
+ ## 1.0.2 - 11-Jun-2007
28
35
  * Added a Rakefile with tasks for installation and testing.
29
36
  * Removed the install.rb file. Installation is now handled as a Rake task.
30
37
  * Some test suite refactoring.
31
38
  * Fixed the FACADE_VERSION number (now 1.0.2, was 1.1.0).
32
39
 
33
- == 1.0.1 - 8-Jun-2005
40
+ ## 1.0.1 - 8-Jun-2005
34
41
  * Moved project to RubyForge.
35
42
  * Added a .gemspec file.
36
43
  * Added a MANIFEST.
37
44
 
38
- == 1.0.0 - 18-May-2005
45
+ ## 1.0.0 - 18-May-2005
39
46
  * Initial release
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org' do
2
+ gem 'rake'
3
+ group 'test' do
4
+ gem 'rspec', '~> 3.9'
5
+ end
6
+ end
@@ -2,8 +2,9 @@
2
2
  * LICENSE
3
3
  * MANIFEST
4
4
  * README
5
+ * Gemfile
5
6
  * Rakefile
6
7
  * facade.gemspec
7
8
  * certs/djberg96_pub.pem
8
9
  * lib/facade.rb
9
- * test/test_facade.rb
10
+ * spec/facade_spec.rb
@@ -0,0 +1,40 @@
1
+ ## Synopsis
2
+ An easy way to implement the facade pattern in your classes. In short,
3
+ this library wraps singleton methods from another class as instance
4
+ methods of the current class.
5
+
6
+ ## Installation
7
+ `gem install facade`
8
+
9
+ ## Usage
10
+ ```
11
+ require 'facade'
12
+
13
+ class MyString < String
14
+ extend Facade
15
+ facade Dir # extend all methods
16
+ facade File, :dirname, :basename # extend only specified methods
17
+ end
18
+
19
+ f = MyString.new('/home/djberge')
20
+ puts f.basename # 'djberge'
21
+ puts f.dirname # '/home'
22
+ ```
23
+
24
+ ## Acknowledgements
25
+ Eero Saynatkari, Eric Hodel and Michael Granger for ideas and code which I
26
+ shamelessly plagiarized.
27
+
28
+ ## Copyright
29
+ Copyright (c) 2005-2020 Daniel J. Berger
30
+
31
+ ## License
32
+ Apache-2.0
33
+
34
+ ## Warranty
35
+ This package is provided "as is" and without any express or
36
+ implied warranties, including, without limitation, the implied
37
+ warranties of merchantability and fitness for a particular purpose
38
+
39
+ ## Author
40
+ Daniel J. Berger
data/Rakefile CHANGED
@@ -1,8 +1,8 @@
1
1
  require 'rake'
2
2
  require 'rake/clean'
3
- require 'rake/testtask'
3
+ require 'rspec/core/rake_task'
4
4
 
5
- CLEAN.include("**/*.gem", "**/*.rbc")
5
+ CLEAN.include("**/*.gem", "**/*.rbc", "**/*.lock")
6
6
 
7
7
  namespace :gem do
8
8
  desc 'Create the facade gem'
@@ -20,10 +20,7 @@ namespace :gem do
20
20
  end
21
21
  end
22
22
 
23
- Rake::TestTask.new do |t|
24
- t.libs << 'test'
25
- t.verbose = true
26
- t.warning = true
27
- end
23
+ desc "Run the test suite"
24
+ RSpec::Core::RakeTask.new(:spec)
28
25
 
29
- task :default => :test
26
+ task :default => :spec
@@ -2,18 +2,18 @@ require 'rubygems'
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'facade'
5
- spec.version = '1.1.1'
5
+ spec.version = '1.2.0'
6
6
  spec.author = 'Daniel J. Berger'
7
7
  spec.license = 'Apache-2.0'
8
8
  spec.email = 'djberg96@gmail.com'
9
9
  spec.homepage = 'https://github.com/djberg96/facade'
10
10
  spec.summary = 'An easy way to implement the facade pattern in your class'
11
- spec.test_file = 'test/test_facade.rb'
11
+ spec.test_file = 'spec/facade_spec.rb'
12
12
  spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
13
13
  spec.cert_chain = ['certs/djberg96_pub.pem']
14
14
 
15
- spec.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
16
15
  spec.add_development_dependency('rake')
16
+ spec.add_development_dependency('rspec', '~> 3.9')
17
17
 
18
18
  spec.metadata = {
19
19
  'homepage_uri' => 'https://github.com/djberg96/facade',
@@ -1,6 +1,6 @@
1
1
  module Facade
2
2
  # The version of the facade library
3
- FACADE_VERSION = '1.1.1'.freeze
3
+ FACADE_VERSION = '1.2.0'.freeze
4
4
 
5
5
  # The facade method will forward a singleton method as an instance
6
6
  # method of the extending class. If no arguments are provided, then all
@@ -0,0 +1,61 @@
1
+ ########################################################################
2
+ # facade_spec.rb
3
+ #
4
+ # Specs for the Facade module. This test suite should be run via the
5
+ # the 'rake spec' task.
6
+ ########################################################################
7
+ require 'rspec'
8
+ require 'facade'
9
+
10
+ RSpec.describe Facade do
11
+ let(:facade) do
12
+ module FooModule
13
+ def testme(str); str; end
14
+ end
15
+
16
+ Class.new(String) do |klass|
17
+ klass.extend Facade
18
+ facade File, :basename, 'dirname'
19
+ facade Dir
20
+ facade FooModule
21
+
22
+ def blockdev?
23
+ 'test'
24
+ end
25
+ end
26
+ end
27
+
28
+ let(:string) { facade.new('/home/whatever') }
29
+
30
+ example "facade module has expected version set and it's frozen" do
31
+ expect(Facade::FACADE_VERSION).to eq('1.2.0')
32
+ expect(Facade::FACADE_VERSION).to be_frozen
33
+ end
34
+
35
+ example "facade instance responds only to specified singleton methods" do
36
+ expect(string).to respond_to(:basename)
37
+ expect(string).to respond_to(:dirname)
38
+ expect{ string.executable? }.to raise_error(NoMethodError)
39
+ expect{ string.chardev? }.to raise_error(NoMethodError)
40
+ end
41
+
42
+ example "File singleton methods are implemented as instance methods and return the expected value" do
43
+ expect(string.basename).to eq('whatever')
44
+ expect(string.dirname).to eq('/home')
45
+ end
46
+
47
+ example "all Dir singleton methods are implemented as instance methods" do
48
+ expect(string).to respond_to(:pwd)
49
+ expect(string).to respond_to(:entries)
50
+ end
51
+
52
+ example "facade does not clobber predefined methods" do
53
+ expect(string).to respond_to(:blockdev?)
54
+ expect(string.blockdev?).to eq('test')
55
+ end
56
+
57
+ example "module_methods" do
58
+ expect(string).to respond_to(:testme)
59
+ expect(string.testme).to eq('/home/whatever')
60
+ end
61
+ end
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facade
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
11
  - |
@@ -35,7 +35,7 @@ cert_chain:
35
35
  ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
36
36
  WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
37
37
  -----END CERTIFICATE-----
38
- date: 2020-06-02 00:00:00.000000000 Z
38
+ date: 2020-09-30 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: rake
@@ -51,25 +51,38 @@ dependencies:
51
51
  - - ">="
52
52
  - !ruby/object:Gem::Version
53
53
  version: '0'
54
+ - !ruby/object:Gem::Dependency
55
+ name: rspec
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '3.9'
61
+ type: :development
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '3.9'
54
68
  description: |2
55
69
  The facade library allows you to mixin singleton methods from classes
56
70
  or modules as instance methods of the extending class.
57
71
  email: djberg96@gmail.com
58
72
  executables: []
59
73
  extensions: []
60
- extra_rdoc_files:
61
- - README
62
- - CHANGES
63
- - MANIFEST
74
+ extra_rdoc_files: []
64
75
  files:
65
- - CHANGES
76
+ - CHANGES.md
77
+ - Gemfile
66
78
  - LICENSE
67
- - MANIFEST
68
- - README
79
+ - MANIFEST.md
80
+ - README.md
69
81
  - Rakefile
70
82
  - certs/djberg96_pub.pem
71
83
  - facade.gemspec
72
84
  - lib/facade.rb
85
+ - spec/facade_spec.rb
73
86
  - test/test_facade.rb
74
87
  homepage: https://github.com/djberg96/facade
75
88
  licenses:
@@ -81,7 +94,7 @@ metadata:
81
94
  documentation_uri: https://github.com/djberg96/facade/wiki
82
95
  source_code_uri: https://github.com/djberg96/facade
83
96
  wiki_uri: https://github.com/djberg96/facade/wiki
84
- post_install_message:
97
+ post_install_message:
85
98
  rdoc_options: []
86
99
  require_paths:
87
100
  - lib
@@ -96,9 +109,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
109
  - !ruby/object:Gem::Version
97
110
  version: '0'
98
111
  requirements: []
99
- rubygems_version: 3.0.8
100
- signing_key:
112
+ rubygems_version: 3.1.4
113
+ signing_key:
101
114
  specification_version: 4
102
115
  summary: An easy way to implement the facade pattern in your class
103
116
  test_files:
104
- - test/test_facade.rb
117
+ - spec/facade_spec.rb
metadata.gz.sig CHANGED
Binary file
data/README DELETED
@@ -1,37 +0,0 @@
1
- == Synopsis
2
- An easy way to implement the facade pattern in your classes. In short,
3
- this library wraps singleton methods from another class as instance
4
- methods of the current class.
5
-
6
- == Installation
7
- gem install facade
8
-
9
- == Usage
10
- require 'facade'
11
-
12
- class MyString < String
13
- extend Facade
14
- facade File, :dirname, :basename
15
- end
16
-
17
- f = MyString.new('/home/djberge')
18
- puts f.basename # 'djberge'
19
- puts f.dirname # '/home'
20
-
21
- == Acknowledgements
22
- Eero Saynatkari, Eric Hodel and Michael Granger for ideas and code which I
23
- shamelessly plagiarized.
24
-
25
- == Copyright
26
- Copyright (c) 2005-2019 Daniel J. Berger
27
-
28
- == License
29
- Apache-2.0
30
-
31
- == Warranty
32
- This package is provided "as is" and without any express or
33
- implied warranties, including, without limitation, the implied
34
- warranties of merchantability and fitness for a particular purpose
35
-
36
- == Author
37
- Daniel J. Berger