acts_as_strip 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ gem "activerecord", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "bundler", "~> 1.0.0"
10
+ gem "jeweler", "~> 1.5.0.pre5"
11
+ gem "rcov", ">= 0"
12
+ end
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Marco Scholl
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.
@@ -0,0 +1,35 @@
1
+ = acts_as_strip
2
+
3
+ Plugin to remove spaces on fields
4
+
5
+ == Dependency
6
+
7
+ * ActiveRecord
8
+
9
+ == Install
10
+
11
+ Insert into Gemfile
12
+
13
+ gem 'acts_as_strip'
14
+
15
+ == Integration
16
+
17
+ class Model < ActiveRecord::Base
18
+ acts_as_strip :field1, :field2
19
+ end
20
+
21
+ == Contributing to acts_as_strip
22
+
23
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
24
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
25
+ * Fork the project
26
+ * Start a feature/bugfix branch
27
+ * Commit and push until you are happy with your contribution
28
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
29
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
30
+
31
+ == Copyright
32
+
33
+ Copyright (c) 2010 Marco Scholl. See LICENSE.txt for
34
+ further details.
35
+
@@ -0,0 +1,55 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'rake'
11
+
12
+ require 'jeweler'
13
+ Jeweler::Tasks.new do |gem|
14
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15
+ gem.name = "acts_as_strip"
16
+ gem.summary = %Q{Plugin to remove spaces on fields}
17
+ gem.description = %Q{Plugin to remove spaces on fields}
18
+ gem.email = "develop@marco-scholl.de"
19
+ gem.homepage = "http://github.com/traxanos/acts_as_strip"
20
+ gem.authors = ["Marco Scholl"]
21
+ # Include your dependencies below. Runtime dependencies are required when using your gem,
22
+ # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
23
+ gem.add_runtime_dependency 'activerecord', '>= 0'
24
+ # spec.add_development_dependency 'rspec', '> 1.2.3'
25
+ gem.add_development_dependency "bundler", "~> 1.0.0"
26
+ gem.add_development_dependency "jeweler", "~> 1.5.0.pre5"
27
+ gem.add_development_dependency "rcov", ">= 0"
28
+ end
29
+ Jeweler::RubygemsDotOrgTasks.new
30
+
31
+ require 'rake/testtask'
32
+ Rake::TestTask.new(:test) do |test|
33
+ test.libs << 'lib' << 'test'
34
+ test.pattern = 'test/**/test_*.rb'
35
+ test.verbose = true
36
+ end
37
+
38
+ require 'rcov/rcovtask'
39
+ Rcov::RcovTask.new do |test|
40
+ test.libs << 'test'
41
+ test.pattern = 'test/**/test_*.rb'
42
+ test.verbose = true
43
+ end
44
+
45
+ task :default => :test
46
+
47
+ require 'rake/rdoctask'
48
+ Rake::RDocTask.new do |rdoc|
49
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
50
+
51
+ rdoc.rdoc_dir = 'rdoc'
52
+ rdoc.title = "acts_as_strip #{version}"
53
+ rdoc.rdoc_files.include('README*')
54
+ rdoc.rdoc_files.include('lib/**/*.rb')
55
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.0
@@ -0,0 +1,32 @@
1
+ require 'rubygems'
2
+ require 'active_record'
3
+
4
+ module ActiveRecord #:nodoc:
5
+ module ActsAsStrip #:nodoc:
6
+
7
+ def self.included(base)
8
+ base.extend ClassMethods
9
+ end
10
+
11
+ module ClassMethods
12
+ # activate gem on ar-model to trim spaces on fields
13
+ #
14
+ # -----
15
+ #
16
+ # === Example:
17
+ # class User
18
+ # acts_as_strip :field1, :field2
19
+ # end
20
+ #
21
+ def acts_as_strip(*fields)
22
+ before_validation do |model|
23
+ fields.each do |n|
24
+ model[n] = model[n].strip if model[n].respond_to?('strip')
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+
32
+ ActiveRecord::Base.send(:include, ActiveRecord::ActsAsStrip)
@@ -0,0 +1,17 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+
12
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ require 'acts_as_strip'
15
+
16
+ class Test::Unit::TestCase
17
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestActsAsStrip < Test::Unit::TestCase
4
+ def test_something_for_real
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,190 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: acts_as_strip
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 0
9
+ version: 0.0.0
10
+ platform: ruby
11
+ authors:
12
+ - Marco Scholl
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-10-25 00:00:00 +02:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: activerecord
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 2
29
+ - 3
30
+ - 5
31
+ version: 2.3.5
32
+ type: :runtime
33
+ prerelease: false
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: bundler
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ~>
41
+ - !ruby/object:Gem::Version
42
+ segments:
43
+ - 1
44
+ - 0
45
+ - 0
46
+ version: 1.0.0
47
+ type: :development
48
+ prerelease: false
49
+ version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ name: jeweler
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ~>
56
+ - !ruby/object:Gem::Version
57
+ segments:
58
+ - 1
59
+ - 5
60
+ - 0
61
+ - pre5
62
+ version: 1.5.0.pre5
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: *id003
66
+ - !ruby/object:Gem::Dependency
67
+ name: rcov
68
+ requirement: &id004 !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ segments:
74
+ - 0
75
+ version: "0"
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: *id004
79
+ - !ruby/object:Gem::Dependency
80
+ name: activerecord
81
+ requirement: &id005 !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ segments:
87
+ - 0
88
+ version: "0"
89
+ type: :runtime
90
+ prerelease: false
91
+ version_requirements: *id005
92
+ - !ruby/object:Gem::Dependency
93
+ name: bundler
94
+ requirement: &id006 !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ~>
98
+ - !ruby/object:Gem::Version
99
+ segments:
100
+ - 1
101
+ - 0
102
+ - 0
103
+ version: 1.0.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: *id006
107
+ - !ruby/object:Gem::Dependency
108
+ name: jeweler
109
+ requirement: &id007 !ruby/object:Gem::Requirement
110
+ none: false
111
+ requirements:
112
+ - - ~>
113
+ - !ruby/object:Gem::Version
114
+ segments:
115
+ - 1
116
+ - 5
117
+ - 0
118
+ - pre5
119
+ version: 1.5.0.pre5
120
+ type: :development
121
+ prerelease: false
122
+ version_requirements: *id007
123
+ - !ruby/object:Gem::Dependency
124
+ name: rcov
125
+ requirement: &id008 !ruby/object:Gem::Requirement
126
+ none: false
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ segments:
131
+ - 0
132
+ version: "0"
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: *id008
136
+ description: Plugin to remove spaces on fields
137
+ email: develop@marco-scholl.de
138
+ executables: []
139
+
140
+ extensions: []
141
+
142
+ extra_rdoc_files:
143
+ - LICENSE.txt
144
+ - README.rdoc
145
+ files:
146
+ - .document
147
+ - Gemfile
148
+ - LICENSE.txt
149
+ - README.rdoc
150
+ - Rakefile
151
+ - VERSION
152
+ - lib/acts_as_strip.rb
153
+ - test/helper.rb
154
+ - test/test_acts_as_strip.rb
155
+ has_rdoc: true
156
+ homepage: http://github.com/traxanos/acts_as_strip
157
+ licenses: []
158
+
159
+ post_install_message:
160
+ rdoc_options: []
161
+
162
+ require_paths:
163
+ - lib
164
+ required_ruby_version: !ruby/object:Gem::Requirement
165
+ none: false
166
+ requirements:
167
+ - - ">="
168
+ - !ruby/object:Gem::Version
169
+ hash: 1664609187302750111
170
+ segments:
171
+ - 0
172
+ version: "0"
173
+ required_rubygems_version: !ruby/object:Gem::Requirement
174
+ none: false
175
+ requirements:
176
+ - - ">="
177
+ - !ruby/object:Gem::Version
178
+ segments:
179
+ - 0
180
+ version: "0"
181
+ requirements: []
182
+
183
+ rubyforge_project:
184
+ rubygems_version: 1.3.7
185
+ signing_key:
186
+ specification_version: 3
187
+ summary: Plugin to remove spaces on fields
188
+ test_files:
189
+ - test/helper.rb
190
+ - test/test_acts_as_strip.rb