yogo-support 0.1.0

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/.gitignore ADDED
@@ -0,0 +1,24 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+ .bundle
21
+ .yardoc
22
+
23
+ ## PROJECT::SPECIFIC
24
+ spec/tmp
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source :rubygems
2
+
3
+
4
+ group :development do
5
+ gem "rake"
6
+ gem "jeweler"
7
+ gem "rspec"
8
+ gem "cucumber"
9
+ gem "yard"
10
+ gem "ruby-debug"
11
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,45 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ builder (2.1.2)
5
+ columnize (0.3.1)
6
+ cucumber (0.8.5)
7
+ builder (~> 2.1.2)
8
+ diff-lcs (~> 1.1.2)
9
+ gherkin (~> 2.1.4)
10
+ json_pure (~> 1.4.3)
11
+ term-ansicolor (~> 1.0.4)
12
+ diff-lcs (1.1.2)
13
+ gemcutter (0.6.1)
14
+ gherkin (2.1.5)
15
+ trollop (~> 1.16.2)
16
+ git (1.2.5)
17
+ jeweler (1.4.0)
18
+ gemcutter (>= 0.1.0)
19
+ git (>= 1.2.5)
20
+ rubyforge (>= 2.0.0)
21
+ json_pure (1.4.6)
22
+ linecache (0.43)
23
+ rake (0.8.7)
24
+ rspec (1.3.0)
25
+ ruby-debug (0.10.3)
26
+ columnize (>= 0.1)
27
+ ruby-debug-base (~> 0.10.3.0)
28
+ ruby-debug-base (0.10.3)
29
+ linecache (>= 0.3)
30
+ rubyforge (2.0.4)
31
+ json_pure (>= 1.1.7)
32
+ term-ansicolor (1.0.5)
33
+ trollop (1.16.2)
34
+ yard (0.6.1)
35
+
36
+ PLATFORMS
37
+ ruby
38
+
39
+ DEPENDENCIES
40
+ cucumber
41
+ jeweler
42
+ rake
43
+ rspec
44
+ ruby-debug
45
+ yard
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Ryan Heimbuch, Montana State University
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,17 @@
1
+ = yogo-support
2
+
3
+ This is a bundle of common libs and extensions used by other yogo libraries.
4
+
5
+ == Note on Patches/Pull Requests
6
+
7
+ * Fork the project.
8
+ * Make your feature addition or bug fix.
9
+ * Add tests for it. This is important so I don't break it in a
10
+ future version unintentionally.
11
+ * Commit, do not mess with rakefile, version, or history.
12
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
13
+ * Send me a pull request. Bonus points for topic branches.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2010 Ryan Heimbuch, Montana State University. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,63 @@
1
+ require 'rubygems'
2
+
3
+ begin
4
+ require 'bundler'
5
+ Bundler.setup
6
+ rescue LoadError
7
+ puts "Bundler is not intalled. Install with: gem install bundler"
8
+ end
9
+
10
+ require 'rake'
11
+
12
+ begin
13
+ require 'jeweler'
14
+ Jeweler::Tasks.new do |gem|
15
+ gem.name = "yogo-support"
16
+ gem.summary = "Supporting extensions for yogo libraries."
17
+ gem.description = "Supporting extensions for yogo libraries."
18
+ gem.email = "rheimbuch@gmail.com"
19
+ gem.homepage = "http://github.com/yogo/yogo-support"
20
+ gem.authors = ["Ryan Heimbuch"]
21
+ gem.add_bundler_dependencies
22
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
23
+ end
24
+ Jeweler::GemcutterTasks.new
25
+ rescue LoadError
26
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
27
+ end
28
+
29
+ require 'spec/rake/spectask'
30
+ Spec::Rake::SpecTask.new(:spec) do |spec|
31
+ spec.libs << 'lib' << 'spec'
32
+ spec.spec_files = FileList['spec/**/*_spec.rb']
33
+ end
34
+
35
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
36
+ spec.libs << 'lib' << 'spec'
37
+ spec.pattern = 'spec/**/*_spec.rb'
38
+ spec.rcov = true
39
+ end
40
+
41
+ task :spec => :check_dependencies
42
+
43
+ begin
44
+ require 'cucumber/rake/task'
45
+ Cucumber::Rake::Task.new(:features)
46
+
47
+ task :features => :check_dependencies
48
+ rescue LoadError
49
+ task :features do
50
+ abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
51
+ end
52
+ end
53
+
54
+ task :default => :spec
55
+
56
+ begin
57
+ require 'yard'
58
+ YARD::Rake::YardocTask.new
59
+ rescue LoadError
60
+ task :yardoc do
61
+ abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
62
+ end
63
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
File without changes
@@ -0,0 +1,4 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
2
+ require 'yogo-support'
3
+
4
+ require 'spec/expectations'
@@ -0,0 +1,9 @@
1
+ Feature: something something
2
+ In order to something something
3
+ A user something something
4
+ something something something
5
+
6
+ Scenario: something something
7
+ Given inspiration
8
+ When I create a sweet new gem
9
+ Then everyone should see how awesome I am
@@ -0,0 +1,33 @@
1
+
2
+ module Yogo
3
+ module ExtensionModule
4
+ def extended(base)
5
+ case(base)
6
+ when Class, Module
7
+ base.class_eval(&class_extensions)
8
+ else
9
+ base.instance_eval(&instance_extensions)
10
+ end
11
+ end
12
+
13
+ def included(base)
14
+ extended(base)
15
+ end
16
+
17
+ def instance_extensions(&block)
18
+ @_instance_extensions ||= lambda {}
19
+ if block_given?
20
+ @_instance_extensions = block
21
+ end
22
+ @_instance_extensions
23
+ end
24
+
25
+ def class_extensions(&block)
26
+ @_class_extensions ||= lambda {}
27
+ if block_given?
28
+ @_class_extensions = block
29
+ end
30
+ @_class_extensions
31
+ end
32
+ end # ExtensionModule
33
+ end # Yogo
@@ -0,0 +1,5 @@
1
+ class ::Object
2
+ def apply(&block)
3
+ block.call(self)
4
+ end
5
+ end
@@ -0,0 +1,15 @@
1
+ require 'yogo/support/proc/call'
2
+ require 'yogo/support/proc/partial'
3
+ require 'yogo/support/proc/compose'
4
+
5
+ module Yogo
6
+ module Support
7
+
8
+ class ::Proc
9
+ include Proc::Call
10
+ include Proc::Partial
11
+ include Proc::Compose
12
+ end # ::Proc
13
+
14
+ end # Support
15
+ end # Yogo
@@ -0,0 +1,11 @@
1
+ module Yogo
2
+ module Support
3
+ module Proc
4
+ module Call
5
+ def [](*args)
6
+ call(*args)
7
+ end
8
+ end # Call
9
+ end # Proc
10
+ end # Support
11
+ end # Yogo
@@ -0,0 +1,22 @@
1
+ module Yogo
2
+ module Support
3
+ module Proc
4
+ module Compose
5
+ def compose(g)
6
+ raise ArgumentError, "arity count mismatch" unless arity == g.arity
7
+ lambda{|*args| self[*g[*args]] }
8
+ end
9
+
10
+ def *(x)
11
+ if Integer===x
12
+ c = []
13
+ x.times{|i| c << call(i)}
14
+ c
15
+ else
16
+ compose(x)
17
+ end
18
+ end
19
+ end # Compose
20
+ end # Proc
21
+ end # Support
22
+ end # Yogo
@@ -0,0 +1,18 @@
1
+ X = :partial_unspecified_argument
2
+
3
+ module Yogo
4
+ module Support
5
+ module Proc
6
+ module Partial
7
+ def partial(*args)
8
+ ::Proc.new do |*spice|
9
+ result = args.collect do |a|
10
+ X == a ? spice.shift : a
11
+ end
12
+ call(*result)
13
+ end
14
+ end
15
+ end # Partial
16
+ end # Proc
17
+ end # Support
18
+ end # Yogo
@@ -0,0 +1,85 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+ require 'yogo/support/extension_module'
3
+
4
+ module ExampleModule
5
+ extend Yogo::ExtensionModule
6
+ end
7
+
8
+ module ClassModule
9
+ def class_method_one
10
+ end
11
+
12
+ def class_method_two
13
+ end
14
+ end
15
+
16
+ module InstanceModule
17
+ def inst_method_one
18
+ end
19
+
20
+ def inst_method_two
21
+ end
22
+ end
23
+
24
+ describe "ExtensionModule" do
25
+ it "should have instance_extensions" do
26
+ ExampleModule.should respond_to(:instance_extensions)
27
+ end
28
+
29
+ it "should have class_extensions" do
30
+ ExampleModule.should respond_to(:class_extensions)
31
+ end
32
+
33
+ describe "instance_extensions" do
34
+ it "should return a block" do
35
+ ExampleModule.instance_extensions.should be_a_kind_of(Proc)
36
+ end
37
+ end
38
+
39
+ describe "class_extensions" do
40
+ it "should return a block" do
41
+ ExampleModule.class_extensions.should be_a_kind_of(Proc)
42
+ end
43
+ end
44
+
45
+ describe "adding extensions" do
46
+ it "should accept a class_extensions block" do
47
+ ExampleModule.class_extensions do
48
+ extend ClassModule
49
+ end
50
+ end
51
+
52
+ it "should accept a instance_extensions block" do
53
+ ExampleModule.instance_extensions do
54
+ extend InstanceModule
55
+ end
56
+ end
57
+ end
58
+
59
+ describe "a Class extended with an ExtensionModule" do
60
+ before(:all) do
61
+ @c1 = Class.new { extend ExampleModule }
62
+ end
63
+
64
+ it "should have ClassModule methods as class methods" do
65
+ @c1.should respond_to(:class_method_one)
66
+ @c1.should respond_to(:class_method_two)
67
+ @c1.should_not respond_to(:inst_method_one)
68
+ @c1.should_not respond_to(:inst_method_two)
69
+ end
70
+ end
71
+
72
+ describe "a non-Class/Module object extended with an ExtensionModule" do
73
+ before(:all) do
74
+ @o1 = Object.new
75
+ @o1.extend(ExampleModule)
76
+ end
77
+
78
+ it "should give InstanceModule methods on its instances" do
79
+ @o1.should respond_to(:inst_method_one)
80
+ @o1.should respond_to(:inst_method_two)
81
+ @o1.should_not respond_to(:class_method_one)
82
+ @o1.should_not respond_to(:class_method_two)
83
+ end
84
+ end
85
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,8 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+ require 'spec'
4
+ require 'spec/autorun'
5
+
6
+ Spec::Runner.configure do |config|
7
+
8
+ end
metadata ADDED
@@ -0,0 +1,170 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yogo-support
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Ryan Heimbuch
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-09-08 00:00:00 -06:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ type: :development
23
+ prerelease: false
24
+ name: rake
25
+ version_requirements: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ hash: 3
31
+ segments:
32
+ - 0
33
+ version: "0"
34
+ requirement: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ type: :development
37
+ prerelease: false
38
+ name: jeweler
39
+ version_requirements: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 3
45
+ segments:
46
+ - 0
47
+ version: "0"
48
+ requirement: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ type: :development
51
+ prerelease: false
52
+ name: rspec
53
+ version_requirements: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ hash: 3
59
+ segments:
60
+ - 0
61
+ version: "0"
62
+ requirement: *id003
63
+ - !ruby/object:Gem::Dependency
64
+ type: :development
65
+ prerelease: false
66
+ name: cucumber
67
+ version_requirements: &id004 !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ hash: 3
73
+ segments:
74
+ - 0
75
+ version: "0"
76
+ requirement: *id004
77
+ - !ruby/object:Gem::Dependency
78
+ type: :development
79
+ prerelease: false
80
+ name: yard
81
+ version_requirements: &id005 !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ hash: 3
87
+ segments:
88
+ - 0
89
+ version: "0"
90
+ requirement: *id005
91
+ - !ruby/object:Gem::Dependency
92
+ type: :development
93
+ prerelease: false
94
+ name: ruby-debug
95
+ version_requirements: &id006 !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ hash: 3
101
+ segments:
102
+ - 0
103
+ version: "0"
104
+ requirement: *id006
105
+ description: Supporting extensions for yogo libraries.
106
+ email: rheimbuch@gmail.com
107
+ executables: []
108
+
109
+ extensions: []
110
+
111
+ extra_rdoc_files:
112
+ - LICENSE
113
+ - README.rdoc
114
+ files:
115
+ - .gitignore
116
+ - Gemfile
117
+ - Gemfile.lock
118
+ - LICENSE
119
+ - README.rdoc
120
+ - Rakefile
121
+ - VERSION
122
+ - features/step_definitions/yogo-support_steps.rb
123
+ - features/support/env.rb
124
+ - features/yogo-support.feature
125
+ - lib/yogo/support/extension_module.rb
126
+ - lib/yogo/support/object/apply.rb
127
+ - lib/yogo/support/proc.rb
128
+ - lib/yogo/support/proc/call.rb
129
+ - lib/yogo/support/proc/compose.rb
130
+ - lib/yogo/support/proc/partial.rb
131
+ - spec/extension_module_spec.rb
132
+ - spec/spec.opts
133
+ - spec/spec_helper.rb
134
+ has_rdoc: true
135
+ homepage: http://github.com/yogo/yogo-support
136
+ licenses: []
137
+
138
+ post_install_message:
139
+ rdoc_options:
140
+ - --charset=UTF-8
141
+ require_paths:
142
+ - lib
143
+ required_ruby_version: !ruby/object:Gem::Requirement
144
+ none: false
145
+ requirements:
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ hash: 3
149
+ segments:
150
+ - 0
151
+ version: "0"
152
+ required_rubygems_version: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ hash: 3
158
+ segments:
159
+ - 0
160
+ version: "0"
161
+ requirements: []
162
+
163
+ rubyforge_project:
164
+ rubygems_version: 1.3.7
165
+ signing_key:
166
+ specification_version: 3
167
+ summary: Supporting extensions for yogo libraries.
168
+ test_files:
169
+ - spec/extension_module_spec.rb
170
+ - spec/spec_helper.rb