kelredd-useful 0.1.25 → 0.2.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.
Files changed (61) hide show
  1. data/README.rdoc +3 -2
  2. data/Rakefile +6 -7
  3. data/lib/useful/active_record_helpers/mysql_migration_helpers.rb +64 -65
  4. data/lib/useful/active_record_helpers.rb +1 -1
  5. data/lib/useful/cap_tasks/app_role_migrations.rb +41 -0
  6. data/lib/useful/cap_tasks/disable_migrate.rb +15 -0
  7. data/lib/useful/cap_tasks/git_query_revision_remote.rb +31 -0
  8. data/lib/useful/cap_tasks/passenger_deploy.rb +44 -0
  9. data/lib/useful/cap_tasks/rack_cache.rb +17 -0
  10. data/lib/useful/cap_tasks.rb +1 -3
  11. data/lib/useful/erb_helpers/common.rb +86 -0
  12. data/lib/useful/erb_helpers/forms.rb +118 -0
  13. data/lib/useful/erb_helpers/links.rb +156 -0
  14. data/lib/useful/erb_helpers/proper.rb +109 -0
  15. data/lib/useful/erb_helpers/tags.rb +64 -0
  16. data/lib/useful/erb_helpers.rb +3 -0
  17. data/lib/useful/rails_helpers/environment_tests.rb +59 -0
  18. data/lib/useful/rails_helpers/erb.rb +3 -0
  19. data/lib/useful/rails_helpers.rb +3 -0
  20. data/lib/useful/ruby_extensions/array.rb +33 -34
  21. data/lib/useful/ruby_extensions/date.rb +11 -11
  22. data/lib/useful/ruby_extensions/false_class.rb +16 -13
  23. data/lib/useful/ruby_extensions/fixnum.rb +50 -19
  24. data/lib/useful/ruby_extensions/hash.rb +157 -91
  25. data/lib/useful/ruby_extensions/nil_class.rb +26 -0
  26. data/lib/useful/ruby_extensions/numeric.rb +239 -229
  27. data/lib/useful/ruby_extensions/object.rb +126 -11
  28. data/lib/useful/ruby_extensions/string.rb +259 -33
  29. data/lib/useful/ruby_extensions/true_class.rb +16 -13
  30. data/lib/useful/ruby_extensions.rb +1 -1
  31. data/lib/useful/ruby_extensions_with_activesupport.rb +2 -0
  32. data/lib/useful/shoulda_macros/test_unit.rb +58 -0
  33. data/lib/useful/version.rb +2 -2
  34. data/lib/useful.rb +1 -1
  35. metadata +19 -38
  36. data/lib/useful/cap_tasks/cache.rb +0 -5
  37. data/lib/useful/cap_tasks/gemsconfig.rb +0 -14
  38. data/lib/useful/rails_extensions/environment_tests.rb +0 -60
  39. data/lib/useful/rails_extensions.rb +0 -3
  40. data/lib/useful/ruby_extensions_from_rails/date.rb +0 -244
  41. data/lib/useful/ruby_extensions_from_rails/duration.rb +0 -99
  42. data/lib/useful/ruby_extensions_from_rails/fixnum.rb +0 -32
  43. data/lib/useful/ruby_extensions_from_rails/hash.rb +0 -50
  44. data/lib/useful/ruby_extensions_from_rails/numeric.rb +0 -60
  45. data/lib/useful/ruby_extensions_from_rails/object.rb +0 -79
  46. data/lib/useful/ruby_extensions_from_rails/string.rb +0 -174
  47. data/lib/useful/ruby_extensions_from_rails/time.rb +0 -320
  48. data/lib/useful/ruby_extensions_from_rails.rb +0 -3
  49. data/lib/useful/sinatra_helpers/environment_tests.rb +0 -19
  50. data/lib/useful/sinatra_helpers/erb/error_pages.rb +0 -25
  51. data/lib/useful/sinatra_helpers/erb/forms.rb +0 -131
  52. data/lib/useful/sinatra_helpers/erb/helpers.rb +0 -45
  53. data/lib/useful/sinatra_helpers/erb/links.rb +0 -79
  54. data/lib/useful/sinatra_helpers/erb/partials.rb +0 -41
  55. data/lib/useful/sinatra_helpers/erb/tags.rb +0 -56
  56. data/lib/useful/sinatra_helpers/erb.rb +0 -3
  57. data/lib/useful/sinatra_helpers/mailer/base.rb +0 -89
  58. data/lib/useful/sinatra_helpers/mailer/exceptions.rb +0 -17
  59. data/lib/useful/sinatra_helpers/mailer/tls.rb +0 -73
  60. data/lib/useful/sinatra_helpers/mailer.rb +0 -3
  61. data/lib/useful/sinatra_helpers.rb +0 -3
@@ -1,49 +1,275 @@
1
- module Useful
2
- module RubyExtensions
3
- module String
4
-
5
- module ClassMethods; end
6
- def self.included(klass)
7
- klass.extend(ClassMethods) if klass.kind_of?(Class)
8
- end
1
+ module Useful; end
2
+ module Useful::RubyExtensions; end
9
3
 
10
- module ClassMethods
4
+ module Useful::RubyExtensions::String
5
+
6
+ EMAIL_REGEXP = /\A([\w\.\-\+]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
11
7
 
12
- # adds the contents of a2 to a1, removing duplicates
13
- def hsub(string, hash)
14
- hash.each {|k,v| string.gsub!(":#{k}",v.to_s)}
15
- string
16
- end
17
-
18
- end
8
+ module ClassMethods
19
9
 
20
- # returns a new string, with hash values sub'd in where hash keys exist in original string
21
- def hsub(hash)
22
- self.class.hsub(self.clone, hash)
23
- end
24
- # substitutes the keys in hash that exist in the string, with values of hash
25
- def hsub!(hash)
26
- self.class.hsub(self, hash)
10
+ # adds the contents of a2 to a1, removing duplicates
11
+ def hsub(string, hash)
12
+ hash.each {|k,v| string.gsub!(":#{k}",v.to_s)}
13
+ string
14
+ end
15
+
16
+ # does some CGI escaping on a string
17
+ CGI_ESCAPE_MAP = {
18
+ '+' => '%20'
19
+ }.freeze
20
+ def cgi_escape(string)
21
+ require 'cgi' unless defined?(::CGI) && defined?(::CGI::escape)
22
+ ::CGI.escape(string).gsub(/(\+)/) { CGI_ESCAPE_MAP[$1] }
23
+ end
24
+
25
+ def match?(string, pattern)
26
+ !string.match(pattern).nil?
27
+ end
28
+
29
+ def valid_email?(string)
30
+ match?(string, EMAIL_REGEXP)
31
+ end
32
+
33
+ def show_regexp(string, re)
34
+ if string =~ re
35
+ "#{$`}<<#{$&}>>#{$'}"
36
+ else
37
+ "no match"
27
38
  end
39
+ end
28
40
 
29
- def match?(pattern)
30
- !self.match(pattern).nil?
31
- end
41
+ end
42
+
43
+ module InstanceMethods
44
+
45
+ # returns a new string, with hash values sub'd in where hash keys exist in original string
46
+ def hsub(hash)
47
+ self.class.hsub(self.clone, hash)
48
+ end
49
+ # substitutes the keys in hash that exist in the string, with values of hash
50
+ def hsub!(hash)
51
+ self.class.hsub(self, hash)
52
+ end
53
+
54
+ # will destructively empty out a string, making its value ""
55
+ def empty!
56
+ self.replace("")
57
+ end
58
+
59
+ def cgi_escape
60
+ self.class.cgi_escape(self)
61
+ end
62
+
63
+ def cgi_escape!
64
+ self.replace(self.class.cgi_escape(self))
65
+ end
66
+
67
+ def match?(pattern)
68
+ self.class.match?(self, pattern)
69
+ end
70
+
71
+ def valid_email?
72
+ self.class.valid_email?(self)
73
+ end
74
+
75
+ def show_regexp(re)
76
+ self.class.show_regexp(self, re)
77
+ end
78
+
79
+ def to_boolean
80
+ self =~ /^(false|0)$/i ? false : true
81
+ end
82
+
83
+ def from_currency_to_f
84
+ self.gsub(/[^0-9.-]/,'').to_f
85
+ end
86
+
87
+ end
88
+
89
+ module FromActivesupport
90
+
91
+ module ClassMethods
32
92
 
33
- def show_regexp(re)
34
- if self =~ re
35
- "#{$`}<<#{$&}>>#{$'}"
93
+ # By default, +camelize+ converts strings to UpperCamelCase. If the argument to +camelize+
94
+ # is set to <tt>:lower</tt> then +camelize+ produces lowerCamelCase.
95
+ #
96
+ # +camelize+ will also convert '/' to '::' which is useful for converting paths to namespaces.
97
+ #
98
+ # Examples:
99
+ # "active_record".camelize # => "ActiveRecord"
100
+ # "active_record".camelize(:lower) # => "activeRecord"
101
+ # "active_record/errors".camelize # => "ActiveRecord::Errors"
102
+ # "active_record/errors".camelize(:lower) # => "activeRecord::Errors"
103
+ def camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true)
104
+ if first_letter_in_uppercase
105
+ lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
36
106
  else
37
- "no match"
107
+ lower_case_and_underscored_word[0..0].downcase + camelize(lower_case_and_underscored_word)[1..-1]
38
108
  end
109
+ end unless ::String.respond_to?('camelize')
110
+
111
+ # Capitalizes the first word and turns underscores into spaces and strips a
112
+ # trailing "_id", if any. Like +titleize+, this is meant for creating pretty output.
113
+ #
114
+ # Examples:
115
+ # "employee_salary" # => "Employee salary"
116
+ # "author_id" # => "Author"
117
+ def humanize(lower_case_and_underscored_word)
118
+ result = lower_case_and_underscored_word.to_s.dup
119
+ result.gsub(/_id$/, "").gsub(/_/, " ").capitalize
39
120
  end
40
-
41
- def to_boolean
42
- self =~ /^(true|1)$/i ? true : false
121
+
122
+ # Capitalizes all the words and replaces some characters in the string to create
123
+ # a nicer looking title. +titleize+ is meant for creating pretty output. It is not
124
+ # used in the Rails internals.
125
+ #
126
+ # Examples:
127
+ # "man from the boondocks".titleize # => "Man From The Boondocks"
128
+ # "x-men: the last stand".titleize # => "X Men: The Last Stand"
129
+ def titleize(word)
130
+ humanize(underscore(word)).gsub(/\b('?[a-z])/) { $1.capitalize }
131
+ end
132
+
133
+ # The reverse of +camelize+. Makes an underscored, lowercase form from the expression in the string.
134
+ #
135
+ # Changes '::' to '/' to convert namespaces to paths.
136
+ #
137
+ # Examples:
138
+ # "ActiveRecord".underscore # => "active_record"
139
+ # "ActiveRecord::Errors".underscore # => active_record/errors
140
+ def underscore(camel_cased_word)
141
+ camel_cased_word.to_s.gsub(/::/, '/').
142
+ gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
143
+ gsub(/([a-z\d])([A-Z])/,'\1_\2').
144
+ tr("-", "_").
145
+ downcase
146
+ end unless ::String.respond_to?('underscore')
147
+
148
+ # Replaces underscores with dashes in the string.
149
+ #
150
+ # Example:
151
+ # "puni_puni" # => "puni-puni"
152
+ def dasherize(underscored_word)
153
+ underscored_word.gsub(/_/, '-')
154
+ end unless ::String.respond_to?('dasherize')
155
+
156
+ # Removes the module part from the expression in the string.
157
+ #
158
+ # Examples:
159
+ # "ActiveRecord::CoreExtensions::String::Inflections".demodulize # => "Inflections"
160
+ # "Inflections".demodulize # => "Inflections"
161
+ def demodulize(class_name_in_module)
162
+ class_name_in_module.to_s.gsub(/^.*::/, '')
163
+ end unless ::String.respond_to?('demodulize')
164
+
165
+ # Ruby 1.9 introduces an inherit argument for Module#const_get and
166
+ # #const_defined? and changes their default behavior.
167
+ if Module.method(:const_get).arity == 1
168
+ # Tries to find a constant with the name specified in the argument string:
169
+ #
170
+ # "Module".constantize # => Module
171
+ # "Test::Unit".constantize # => Test::Unit
172
+ #
173
+ # The name is assumed to be the one of a top-level constant, no matter whether
174
+ # it starts with "::" or not. No lexical context is taken into account:
175
+ #
176
+ # C = 'outside'
177
+ # module M
178
+ # C = 'inside'
179
+ # C # => 'inside'
180
+ # "C".constantize # => 'outside', same as ::C
181
+ # end
182
+ #
183
+ # NameError is raised when the name is not in CamelCase or the constant is
184
+ # unknown.
185
+ def constantize(camel_cased_word)
186
+ names = camel_cased_word.split('::')
187
+ names.shift if names.empty? || names.first.empty?
188
+
189
+ constant = ::Object
190
+ names.each do |name|
191
+ constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
192
+ end
193
+ constant
194
+ end unless ::String.respond_to?('constantize')
195
+ else
196
+ def constantize(camel_cased_word) #:nodoc:
197
+ names = camel_cased_word.split('::')
198
+ names.shift if names.empty? || names.first.empty?
199
+
200
+ constant = ::Object
201
+ names.each do |name|
202
+ constant = constant.const_get(name, false) || constant.const_missing(name)
203
+ end
204
+ constant
205
+ end unless ::String.respond_to?('constantize')
43
206
  end
207
+
208
+ end
209
+
210
+ module InstanceMethods
44
211
 
212
+ def camelize(first_letter = :upper)
213
+ case first_letter
214
+ when :upper then ::String.camelize(self, true)
215
+ when :lower then ::String.camelize(self, false)
216
+ end
217
+ end unless "".respond_to?('camelize')
218
+ alias_method :camelcase, :camelize unless "".respond_to?('camelcase')
219
+
220
+ def humanize
221
+ self.class.humanize(self)
222
+ end unless "".respond_to?('humanize')
223
+
224
+ def titleize
225
+ self.class.titleize(self)
226
+ end unless "".respond_to?('titleize')
227
+
228
+ def underscore
229
+ self.class.underscore(self)
230
+ end unless "".respond_to?('underscore')
231
+
232
+ def dasherize
233
+ self.class.dasherize(self)
234
+ end unless "".respond_to?('dasherize')
235
+
236
+ def demodulize
237
+ self.class.demodulize(self)
238
+ end unless "".respond_to?('demodulize')
239
+
240
+ def constantize
241
+ self.class.constantize(self)
242
+ end unless "".respond_to?('constantize')
243
+
244
+ def ends_with?(suffix)
245
+ suffix = suffix.to_s
246
+ self[-suffix.length, suffix.length] == suffix
247
+ end unless "".respond_to?('ends_with?')
248
+
249
+ def starts_with?(prefix)
250
+ prefix = prefix.to_s
251
+ self[0, prefix.length] == prefix
252
+ end unless "".respond_to?('starts_with?')
253
+
254
+ def to_datetime
255
+ ::DateTime.civil(*::Date._parse(self, false).values_at(:year, :mon, :mday, :hour, :min, :sec).map { |arg| arg || 0 }) rescue nil
256
+ end unless "".respond_to?('to_datetime')
257
+
258
+ def to_date
259
+ ::Date.civil(*::Date._parse(self, false).values_at(:year, :mon, :mday).map { |arg| arg || 0 }) rescue nil
260
+ end unless "".respond_to?('to_date')
261
+
45
262
  end
263
+
264
+ end
265
+
266
+ def self.included(receiver)
267
+ receiver.extend ClassMethods
268
+ receiver.extend FromActivesupport::ClassMethods
269
+ receiver.send :include, InstanceMethods
270
+ receiver.send :include, FromActivesupport::InstanceMethods
46
271
  end
272
+
47
273
  end
48
274
 
49
275
  class String
@@ -1,18 +1,21 @@
1
- module Useful
2
- module RubyExtensions
3
- module TrueClass
4
-
5
- def to_affirmative
6
- "Yes"
7
- end
8
- alias :to_casual_s :to_affirmative
1
+ module Useful; end
2
+ module Useful::RubyExtensions; end
9
3
 
10
- def to_i
11
- 1
12
- end
13
-
14
- end
4
+ module Useful::RubyExtensions::TrueClass
5
+
6
+ def to_affirmative(abbreviate=false)
7
+ abbreviate ? "Y" : "Yes"
15
8
  end
9
+ alias :to_casual_s :to_affirmative
10
+
11
+ def to_i
12
+ 1
13
+ end
14
+
15
+ def to_boolean
16
+ true
17
+ end
18
+
16
19
  end
17
20
 
18
21
  class TrueClass
@@ -1,3 +1,3 @@
1
1
  Dir[File.join(File.dirname(__FILE__), "ruby_extensions" ,"*.rb")].each do |file|
2
- require file
2
+ require "useful/ruby_extensions/#{File.basename(file, ".rb")}"
3
3
  end
@@ -0,0 +1,2 @@
1
+ require 'activesupport'
2
+ require 'useful/ruby_extensions'
@@ -0,0 +1,58 @@
1
+ require 'useful/ruby_extensions/string' unless String.new.respond_to?(:constantize)
2
+
3
+ module Useful; end
4
+ module Useful::ShouldaMacros; end
5
+
6
+ module Useful::ShouldaMacros::TestUnit
7
+
8
+ protected
9
+
10
+ # Ripped from Shoulda::ActiveRecord::Macros
11
+ def should_have_instance_methods(*methods)
12
+ get_options!(methods)
13
+ klass = described_type
14
+ methods.each do |method|
15
+ should "respond to instance method ##{method}" do
16
+ assert_respond_to((klass.new rescue subject), method, "#{klass.name} does not have instance method #{method}")
17
+ end
18
+ end
19
+ end unless Test::Unit::TestCase.method_defined? :should_have_instance_methods
20
+
21
+ # Ripped from Shoulda::ActiveRecord::Macros
22
+ def should_have_class_methods(*methods)
23
+ get_options!(methods)
24
+ klass = described_type
25
+ methods.each do |method|
26
+ should "respond to class method ##{method}" do
27
+ assert_respond_to klass, method, "#{klass.name} does not have class method #{method}"
28
+ end
29
+ end
30
+ end unless Test::Unit::TestCase.method_defined? :should_have_class_methods
31
+
32
+ def should_have_readers(*readers)
33
+ get_options!(readers)
34
+ klass = described_type
35
+ readers.each do |reader|
36
+ should_have_instance_methods reader
37
+ end
38
+ end unless Test::Unit::TestCase.method_defined? :should_have_readers
39
+
40
+ def should_have_writers(*writers)
41
+ get_options!(writers)
42
+ klass = described_type
43
+ writers.each do |writer|
44
+ should_have_instance_methods "#{writer}="
45
+ end
46
+ end unless Test::Unit::TestCase.method_defined? :should_have_writers
47
+
48
+ def should_have_accessors(*accessors)
49
+ get_options!(accessors)
50
+ klass = described_type
51
+ accessors.each do |accessor|
52
+ should_have_instance_methods accessor, "#{accessor}="
53
+ end
54
+ end unless Test::Unit::TestCase.method_defined? :should_have_accessors
55
+
56
+ end
57
+
58
+ Test::Unit::TestCase.extend(Useful::ShouldaMacros::TestUnit) if defined? Test::Unit::TestCase
@@ -2,8 +2,8 @@ module Useful
2
2
  module Version
3
3
 
4
4
  MAJOR = 0
5
- MINOR = 1
6
- TINY = 25
5
+ MINOR = 2
6
+ TINY = 0
7
7
 
8
8
  def self.to_s # :nodoc:
9
9
  [MAJOR, MINOR, TINY].join('.')
data/lib/useful.rb CHANGED
@@ -1,2 +1,2 @@
1
- $:.unshift File.dirname(__FILE__)
1
+ module Useful; end
2
2
  p "don't require this file, require in sub modules as needed."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kelredd-useful
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.25
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kelly Redding
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-06 00:00:00 -05:00
12
+ date: 2009-11-06 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -22,16 +22,6 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: "0"
24
24
  version:
25
- - !ruby/object:Gem::Dependency
26
- name: tmail
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: "0"
34
- version:
35
25
  description:
36
26
  email: kelly@kelredd.com
37
27
  executables: []
@@ -45,44 +35,35 @@ files:
45
35
  - Rakefile
46
36
  - lib/useful/active_record_helpers/mysql_migration_helpers.rb
47
37
  - lib/useful/active_record_helpers.rb
48
- - lib/useful/cap_tasks/cache.rb
49
- - lib/useful/cap_tasks/gemsconfig.rb
38
+ - lib/useful/cap_tasks/app_role_migrations.rb
39
+ - lib/useful/cap_tasks/disable_migrate.rb
40
+ - lib/useful/cap_tasks/git_query_revision_remote.rb
50
41
  - lib/useful/cap_tasks/globals.rb
42
+ - lib/useful/cap_tasks/passenger_deploy.rb
43
+ - lib/useful/cap_tasks/rack_cache.rb
51
44
  - lib/useful/cap_tasks.rb
52
- - lib/useful/rails_extensions/environment_tests.rb
53
- - lib/useful/rails_extensions.rb
45
+ - lib/useful/erb_helpers/common.rb
46
+ - lib/useful/erb_helpers/forms.rb
47
+ - lib/useful/erb_helpers/links.rb
48
+ - lib/useful/erb_helpers/proper.rb
49
+ - lib/useful/erb_helpers/tags.rb
50
+ - lib/useful/erb_helpers.rb
51
+ - lib/useful/rails_helpers/environment_tests.rb
52
+ - lib/useful/rails_helpers/erb.rb
53
+ - lib/useful/rails_helpers.rb
54
54
  - lib/useful/ruby_extensions/array.rb
55
55
  - lib/useful/ruby_extensions/date.rb
56
56
  - lib/useful/ruby_extensions/false_class.rb
57
57
  - lib/useful/ruby_extensions/fixnum.rb
58
58
  - lib/useful/ruby_extensions/hash.rb
59
+ - lib/useful/ruby_extensions/nil_class.rb
59
60
  - lib/useful/ruby_extensions/numeric.rb
60
61
  - lib/useful/ruby_extensions/object.rb
61
62
  - lib/useful/ruby_extensions/string.rb
62
63
  - lib/useful/ruby_extensions/true_class.rb
63
64
  - lib/useful/ruby_extensions.rb
64
- - lib/useful/ruby_extensions_from_rails/date.rb
65
- - lib/useful/ruby_extensions_from_rails/duration.rb
66
- - lib/useful/ruby_extensions_from_rails/fixnum.rb
67
- - lib/useful/ruby_extensions_from_rails/hash.rb
68
- - lib/useful/ruby_extensions_from_rails/numeric.rb
69
- - lib/useful/ruby_extensions_from_rails/object.rb
70
- - lib/useful/ruby_extensions_from_rails/string.rb
71
- - lib/useful/ruby_extensions_from_rails/time.rb
72
- - lib/useful/ruby_extensions_from_rails.rb
73
- - lib/useful/sinatra_helpers/environment_tests.rb
74
- - lib/useful/sinatra_helpers/erb/error_pages.rb
75
- - lib/useful/sinatra_helpers/erb/forms.rb
76
- - lib/useful/sinatra_helpers/erb/helpers.rb
77
- - lib/useful/sinatra_helpers/erb/links.rb
78
- - lib/useful/sinatra_helpers/erb/partials.rb
79
- - lib/useful/sinatra_helpers/erb/tags.rb
80
- - lib/useful/sinatra_helpers/erb.rb
81
- - lib/useful/sinatra_helpers/mailer/base.rb
82
- - lib/useful/sinatra_helpers/mailer/exceptions.rb
83
- - lib/useful/sinatra_helpers/mailer/tls.rb
84
- - lib/useful/sinatra_helpers/mailer.rb
85
- - lib/useful/sinatra_helpers.rb
65
+ - lib/useful/ruby_extensions_with_activesupport.rb
66
+ - lib/useful/shoulda_macros/test_unit.rb
86
67
  - lib/useful/version.rb
87
68
  - lib/useful.rb
88
69
  has_rdoc: true
@@ -1,5 +0,0 @@
1
- Capistrano::Configuration.instance.load do
2
- namespace :cache do
3
-
4
- end
5
- end
@@ -1,14 +0,0 @@
1
- Capistrano::Configuration.instance.load do
2
- namespace :gemsconfig do
3
-
4
- desc "Update code, run 'rake gemsconfig:install'"
5
- task :install, :roles => fetch(:install_roles, :app) do
6
- deploy.update_code
7
- run_with_password("sudo #{fetch(:rake, "rake")} -f #{current_release}/Rakefile #{"RAILS_ENV=#{rails_env}" if rails_env} #{fetch(:gemsconfig, "gemsconfig")}:install", {
8
- :prompt => "Enter sudo pw: ",
9
- :pty => false
10
- })
11
- end
12
-
13
- end
14
- end
@@ -1,60 +0,0 @@
1
- module Useful
2
- module RailsExtensions
3
- module EnvironmentTests
4
-
5
- module ClassMethods
6
-
7
- def production?
8
- RAILS_ENV == 'production'
9
- end
10
-
11
- def development?
12
- RAILS_ENV == 'development'
13
- end
14
-
15
- end
16
-
17
- module InstanceMethods
18
-
19
- def production?
20
- self.class.production?
21
- end
22
-
23
- def development?
24
- self.class.development?
25
- end
26
-
27
- end
28
-
29
- def self.included(receiver)
30
- receiver.extend ClassMethods
31
- receiver.send :include, InstanceMethods
32
- end
33
-
34
- end
35
- end
36
- end
37
-
38
- module ActiveRecord
39
- class Base
40
- include Useful::RailsExtensions::EnvironmentTests
41
- end
42
- class Observer
43
- include Useful::RailsExtensions::EnvironmentTests
44
- end
45
- end
46
- module ActionController
47
- class Base
48
- include Useful::RailsExtensions::EnvironmentTests
49
- end
50
- end
51
- module ActionView
52
- class Base
53
- include Useful::RailsExtensions::EnvironmentTests
54
- end
55
- end
56
- module ActionMailer
57
- class Base
58
- include Useful::RailsExtensions::EnvironmentTests
59
- end
60
- end
@@ -1,3 +0,0 @@
1
- Dir[File.join(File.dirname(__FILE__), "rails_extensions" ,"*.rb")].each do |file|
2
- require file
3
- end