dolzenko 0.0.18 → 0.0.19

Sign up to get free protection for your applications and to get access to all the features.
data/dolzenko.gemspec CHANGED
@@ -8,8 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.email = ["dolzenko@gmail.com"]
9
9
  s.homepage = "http://github.com/dolzenko/dolzenko-gem"
10
10
  s.summary = "Tiny meta gem which makes dolzenko happy"
11
- s.files = Dir.glob("{bin,lib}/**/*") + %w(dolzenko.gemspec)
12
- s.executables = Dir.glob("bin/*").to_a.map { |path| File.basename(path) }
11
+ s.files = Dir.glob("lib/**/*") + %w(dolzenko.gemspec)
13
12
  s.add_dependency("facets", "2.8.3")
14
13
  s.add_dependency("activesupport", "3.0.0.beta3")
15
14
  end
@@ -0,0 +1,40 @@
1
+ module Kernel
2
+
3
+ # Yield self -or- return self.
4
+ #
5
+ # "a".ergo.upcase #=> "A"
6
+ # nil.ergo.foobar #=> nil
7
+ #
8
+ # "a".ergo{ |o| o.upcase } #=> "A"
9
+ # nil.ergo{ |o| o.foobar } #=> nil
10
+ #
11
+ # This is like #tap, but tap yields self -and- returns self.
12
+ #
13
+ # CREDIT: Daniel DeLorme
14
+
15
+ def ergo &b
16
+ if block_given?
17
+ b.arity == 1 ? yield(self) : instance_eval(&b)
18
+ else
19
+ self
20
+ end
21
+ end
22
+
23
+ end
24
+
25
+ class NilClass
26
+
27
+ # Compliments Kernel#ergo.
28
+ #
29
+ # "a".ergo{ |o| o.upcase } #=> "A"
30
+ # nil.ergo{ |o| o.bar } #=> nil
31
+ #
32
+ # CREDIT: Daniel DeLorme
33
+
34
+ def ergo
35
+ @_ergo ||= Functor.new{ nil }
36
+ @_ergo unless block_given?
37
+ end
38
+
39
+ end
40
+
@@ -0,0 +1,11 @@
1
+ module Kernel
2
+ # Is self included in other?
3
+ #
4
+ # 5.in?(0..10) #=> true
5
+ # 5.in?([0,1,2,3]) #=> false
6
+ #
7
+ def in?(arrayish, *more)
8
+ arrayish = more.unshift(arrayish) unless more.empty?
9
+ arrayish.include?(self)
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ class Object
2
+ alias :is_an? :is_a?
3
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 18
9
- version: 0.0.18
8
+ - 19
9
+ version: 0.0.19
10
10
  platform: ruby
11
11
  authors:
12
12
  - Evgeniy Dolzhenko
@@ -14,13 +14,14 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-31 00:00:00 -07:00
17
+ date: 2010-06-01 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: facets
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
24
25
  requirements:
25
26
  - - "="
26
27
  - !ruby/object:Gem::Version
@@ -35,6 +36,7 @@ dependencies:
35
36
  name: activesupport
36
37
  prerelease: false
37
38
  requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
38
40
  requirements:
39
41
  - - "="
40
42
  - !ruby/object:Gem::Version
@@ -49,22 +51,18 @@ dependencies:
49
51
  description:
50
52
  email:
51
53
  - dolzenko@gmail.com
52
- executables:
53
- - camelize
54
- - generate_binary.rb
55
- - generate_spec
56
- - underscore
54
+ executables: []
55
+
57
56
  extensions: []
58
57
 
59
58
  extra_rdoc_files: []
60
59
 
61
60
  files:
62
- - bin/camelize
63
- - bin/generate_binary.rb
64
- - bin/generate_spec
65
- - bin/underscore
66
61
  - lib/dolzenko/acts_as.rb
67
62
  - lib/dolzenko/alias_method_chain_once.rb
63
+ - lib/dolzenko/core_ext/kernel/ergo.rb
64
+ - lib/dolzenko/core_ext/kernel/in.rb
65
+ - lib/dolzenko/core_ext/object/is_an.rb
68
66
  - lib/dolzenko/django_f_object.rb
69
67
  - lib/dolzenko/django_q_object.rb
70
68
  - lib/dolzenko/error_print.rb
@@ -88,6 +86,7 @@ rdoc_options: []
88
86
  require_paths:
89
87
  - lib
90
88
  required_ruby_version: !ruby/object:Gem::Requirement
89
+ none: false
91
90
  requirements:
92
91
  - - ">="
93
92
  - !ruby/object:Gem::Version
@@ -95,6 +94,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
95
94
  - 0
96
95
  version: "0"
97
96
  required_rubygems_version: !ruby/object:Gem::Requirement
97
+ none: false
98
98
  requirements:
99
99
  - - ">="
100
100
  - !ruby/object:Gem::Version
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  requirements: []
105
105
 
106
106
  rubyforge_project:
107
- rubygems_version: 1.3.6
107
+ rubygems_version: 1.3.7
108
108
  signing_key:
109
109
  specification_version: 3
110
110
  summary: Tiny meta gem which makes dolzenko happy
data/bin/camelize DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- puts ARGV[0].gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
File without changes
data/bin/generate_spec DELETED
@@ -1,49 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'fileutils'
4
-
5
- parts = ARGV[0].split(/[\\\/]/)
6
-
7
- def camelize(s)
8
- s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
9
- end
10
-
11
- def underscore(camel_cased_word)
12
- word = camel_cased_word.to_s.dup
13
- word.gsub!(/::/, '/')
14
- word.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
15
- word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
16
- word.tr!("-", "_")
17
- word.downcase!
18
- word
19
- end
20
-
21
-
22
- if parts.include?("lib")
23
- project_root = parts[0 .. parts.index('lib') - 1].join("/")
24
-
25
- class_path = parts[parts.index('lib') .. -2].join("/")
26
-
27
- class_file_path = parts[parts.index('lib') + 1 .. -1].join("/")
28
-
29
- spec_name = File.basename(parts[-1]).sub(/\.rb$/, "_spec.rb")
30
-
31
- FileUtils.mkdir_p(File.join(project_root, "spec", class_path))
32
-
33
- spec_path = File.join(project_root, "spec", class_path, spec_name)
34
-
35
- raise "#{ spec_path } already exists" if File.exist?(spec_path)
36
-
37
- spec_class_name = camelize class_file_path.sub(/\.rb$/, "")
38
-
39
- File.open(spec_path, "w") do |f|
40
- f.puts "require \"#{ class_file_path.sub(/\.rb$/, "") }\""
41
- f.puts ""
42
- f.puts "describe #{ spec_class_name } do"
43
- f.puts "end"
44
- end
45
-
46
- puts "#{ spec_path } generated"
47
- else
48
- raise "Don't know how to generate spec for #{ ARGV[0] }"
49
- end
data/bin/underscore DELETED
@@ -1,20 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # The reverse of +camelize+. Makes an underscored, lowercase form from the expression in the string.
4
- #
5
- # Changes '::' to '/' to convert namespaces to paths.
6
- #
7
- # Examples:
8
- # "ActiveRecord".underscore # => "active_record"
9
- # "ActiveRecord::Errors".underscore # => active_record/errors
10
- def underscore(camel_cased_word)
11
- word = camel_cased_word.to_s.dup
12
- word.gsub!(/::/, '/')
13
- word.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
14
- word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
15
- word.tr!("-", "_")
16
- word.downcase!
17
- word
18
- end
19
-
20
- puts underscore(ARGV[0])