has_hashcode 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/.document +5 -0
- data/.gitignore +21 -0
- data/Gemfile +25 -0
- data/LICENSE +20 -0
- data/README.rdoc +6 -0
- data/Rakefile +53 -0
- data/VERSION +1 -0
- data/has_hashcode.gemspec +105 -0
- data/lib/has_hashcode.rb +24 -0
- data/test/helper.rb +15 -0
- data/test/rails_app/.gitignore +4 -0
- data/test/rails_app/Gemfile +25 -0
- data/test/rails_app/README +243 -0
- data/test/rails_app/Rakefile +10 -0
- data/test/rails_app/app/controllers/application_controller.rb +3 -0
- data/test/rails_app/app/helpers/application_helper.rb +2 -0
- data/test/rails_app/app/models/user.rb +3 -0
- data/test/rails_app/config/application.rb +42 -0
- data/test/rails_app/config/boot.rb +17 -0
- data/test/rails_app/config/database.yml +22 -0
- data/test/rails_app/config/environment.rb +5 -0
- data/test/rails_app/config/environments/development.rb +19 -0
- data/test/rails_app/config/environments/production.rb +33 -0
- data/test/rails_app/config/environments/test.rb +29 -0
- data/test/rails_app/config/initializers/backtrace_silencers.rb +7 -0
- data/test/rails_app/config/initializers/cookie_verification_secret.rb +7 -0
- data/test/rails_app/config/initializers/inflections.rb +10 -0
- data/test/rails_app/config/initializers/mime_types.rb +5 -0
- data/test/rails_app/config/initializers/session_store.rb +15 -0
- data/test/rails_app/config/locales/en.yml +5 -0
- data/test/rails_app/config/routes.rb +58 -0
- data/test/rails_app/config.ru +4 -0
- data/test/rails_app/db/migrate/20100314023120_create_users.rb +13 -0
- data/test/rails_app/db/schema.rb +20 -0
- data/test/rails_app/db/seeds.rb +7 -0
- data/test/rails_app/doc/README_FOR_APP +2 -0
- data/test/rails_app/lib/tasks/.gitkeep +0 -0
- data/test/rails_app/script/rails +10 -0
- data/test/rails_app/test/fixtures/users.yml +11 -0
- data/test/rails_app/test/performance/browsing_test.rb +9 -0
- data/test/rails_app/test/test_helper.rb +13 -0
- data/test/rails_app/test/unit/user_test.rb +8 -0
- data/test/rails_app/vendor/plugins/.gitkeep +0 -0
- data/test/test_has_hashcode.rb +22 -0
- metadata +129 -0
data/.document
ADDED
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Edit this Gemfile to bundle your application's dependencies.
|
2
|
+
source 'http://gemcutter.org'
|
3
|
+
|
4
|
+
|
5
|
+
# gem "rails", "3.0.0.beta"
|
6
|
+
|
7
|
+
## Bundle edge rails:
|
8
|
+
gem "rails", :git => "git://github.com/rails/rails.git"
|
9
|
+
|
10
|
+
# ActiveRecord requires a database adapter. By default,
|
11
|
+
# Rails has selected sqlite3.
|
12
|
+
gem "sqlite3-ruby", :require => "sqlite3"
|
13
|
+
|
14
|
+
## Bundle the gems you use:
|
15
|
+
# gem "bj"
|
16
|
+
# gem "hpricot", "0.6"
|
17
|
+
# gem "sqlite3-ruby", :require => "sqlite3"
|
18
|
+
# gem "aws-s3", :require => "aws/s3"
|
19
|
+
|
20
|
+
## Bundle gems used only in certain environments:
|
21
|
+
# gem "rspec", :group => :test
|
22
|
+
# group :test do
|
23
|
+
# gem "webrat"
|
24
|
+
# end
|
25
|
+
gem 'has_hashcode'
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Elomar França
|
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
data/Rakefile
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'rake'
|
5
|
+
|
6
|
+
begin
|
7
|
+
require 'jeweler'
|
8
|
+
Jeweler::Tasks.new do |gem|
|
9
|
+
gem.name = "has_hashcode"
|
10
|
+
gem.summary = "Adds a hashcode to your objects"
|
11
|
+
gem.email = "elomar+rafael@maisweb.org"
|
12
|
+
gem.homepage = "http://github.com/elomar/has_hashcode"
|
13
|
+
gem.authors = ["Elomar França", "Rafael Souza"]
|
14
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
|
+
end
|
16
|
+
Jeweler::GemcutterTasks.new
|
17
|
+
rescue LoadError
|
18
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
19
|
+
end
|
20
|
+
|
21
|
+
require 'rake/testtask'
|
22
|
+
Rake::TestTask.new(:test) do |test|
|
23
|
+
test.libs << 'lib' << 'test'
|
24
|
+
test.pattern = 'test/**/test_*.rb'
|
25
|
+
test.verbose = true
|
26
|
+
end
|
27
|
+
|
28
|
+
begin
|
29
|
+
require 'rcov/rcovtask'
|
30
|
+
Rcov::RcovTask.new do |test|
|
31
|
+
test.libs << 'test'
|
32
|
+
test.pattern = 'test/**/test_*.rb'
|
33
|
+
test.verbose = true
|
34
|
+
end
|
35
|
+
rescue LoadError
|
36
|
+
task :rcov do
|
37
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
task :test => :check_dependencies
|
42
|
+
|
43
|
+
task :default => :test
|
44
|
+
|
45
|
+
require 'rake/rdoctask'
|
46
|
+
Rake::RDocTask.new do |rdoc|
|
47
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
48
|
+
|
49
|
+
rdoc.rdoc_dir = 'rdoc'
|
50
|
+
rdoc.title = "has_hashcode #{version}"
|
51
|
+
rdoc.rdoc_files.include('README*')
|
52
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
53
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,105 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{has_hashcode}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Elomar Fran\303\247a", "Rafael Souza"]
|
12
|
+
s.date = %q{2010-03-14}
|
13
|
+
s.email = %q{elomar+rafael@maisweb.org}
|
14
|
+
s.extra_rdoc_files = [
|
15
|
+
"LICENSE",
|
16
|
+
"README.rdoc"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
".document",
|
20
|
+
".gitignore",
|
21
|
+
"Gemfile",
|
22
|
+
"LICENSE",
|
23
|
+
"README.rdoc",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"has_hashcode.gemspec",
|
27
|
+
"lib/has_hashcode.rb",
|
28
|
+
"test/helper.rb",
|
29
|
+
"test/rails_app/.gitignore",
|
30
|
+
"test/rails_app/Gemfile",
|
31
|
+
"test/rails_app/README",
|
32
|
+
"test/rails_app/Rakefile",
|
33
|
+
"test/rails_app/app/controllers/application_controller.rb",
|
34
|
+
"test/rails_app/app/helpers/application_helper.rb",
|
35
|
+
"test/rails_app/app/models/user.rb",
|
36
|
+
"test/rails_app/config.ru",
|
37
|
+
"test/rails_app/config/application.rb",
|
38
|
+
"test/rails_app/config/boot.rb",
|
39
|
+
"test/rails_app/config/database.yml",
|
40
|
+
"test/rails_app/config/environment.rb",
|
41
|
+
"test/rails_app/config/environments/development.rb",
|
42
|
+
"test/rails_app/config/environments/production.rb",
|
43
|
+
"test/rails_app/config/environments/test.rb",
|
44
|
+
"test/rails_app/config/initializers/backtrace_silencers.rb",
|
45
|
+
"test/rails_app/config/initializers/cookie_verification_secret.rb",
|
46
|
+
"test/rails_app/config/initializers/inflections.rb",
|
47
|
+
"test/rails_app/config/initializers/mime_types.rb",
|
48
|
+
"test/rails_app/config/initializers/session_store.rb",
|
49
|
+
"test/rails_app/config/locales/en.yml",
|
50
|
+
"test/rails_app/config/routes.rb",
|
51
|
+
"test/rails_app/db/migrate/20100314023120_create_users.rb",
|
52
|
+
"test/rails_app/db/schema.rb",
|
53
|
+
"test/rails_app/db/seeds.rb",
|
54
|
+
"test/rails_app/doc/README_FOR_APP",
|
55
|
+
"test/rails_app/lib/tasks/.gitkeep",
|
56
|
+
"test/rails_app/script/rails",
|
57
|
+
"test/rails_app/test/fixtures/users.yml",
|
58
|
+
"test/rails_app/test/performance/browsing_test.rb",
|
59
|
+
"test/rails_app/test/test_helper.rb",
|
60
|
+
"test/rails_app/test/unit/user_test.rb",
|
61
|
+
"test/rails_app/vendor/plugins/.gitkeep",
|
62
|
+
"test/test_has_hashcode.rb"
|
63
|
+
]
|
64
|
+
s.homepage = %q{http://github.com/elomar/has_hashcode}
|
65
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
66
|
+
s.require_paths = ["lib"]
|
67
|
+
s.rubygems_version = %q{1.3.6}
|
68
|
+
s.summary = %q{Adds a hashcode to your objects}
|
69
|
+
s.test_files = [
|
70
|
+
"test/helper.rb",
|
71
|
+
"test/rails_app/app/controllers/application_controller.rb",
|
72
|
+
"test/rails_app/app/helpers/application_helper.rb",
|
73
|
+
"test/rails_app/app/models/user.rb",
|
74
|
+
"test/rails_app/config/application.rb",
|
75
|
+
"test/rails_app/config/boot.rb",
|
76
|
+
"test/rails_app/config/environment.rb",
|
77
|
+
"test/rails_app/config/environments/development.rb",
|
78
|
+
"test/rails_app/config/environments/production.rb",
|
79
|
+
"test/rails_app/config/environments/test.rb",
|
80
|
+
"test/rails_app/config/initializers/backtrace_silencers.rb",
|
81
|
+
"test/rails_app/config/initializers/cookie_verification_secret.rb",
|
82
|
+
"test/rails_app/config/initializers/inflections.rb",
|
83
|
+
"test/rails_app/config/initializers/mime_types.rb",
|
84
|
+
"test/rails_app/config/initializers/session_store.rb",
|
85
|
+
"test/rails_app/config/routes.rb",
|
86
|
+
"test/rails_app/db/migrate/20100314023120_create_users.rb",
|
87
|
+
"test/rails_app/db/schema.rb",
|
88
|
+
"test/rails_app/db/seeds.rb",
|
89
|
+
"test/rails_app/test/performance/browsing_test.rb",
|
90
|
+
"test/rails_app/test/test_helper.rb",
|
91
|
+
"test/rails_app/test/unit/user_test.rb",
|
92
|
+
"test/test_has_hashcode.rb"
|
93
|
+
]
|
94
|
+
|
95
|
+
if s.respond_to? :specification_version then
|
96
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
97
|
+
s.specification_version = 3
|
98
|
+
|
99
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
100
|
+
else
|
101
|
+
end
|
102
|
+
else
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
data/lib/has_hashcode.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
module HasHashcode
|
2
|
+
class Railtie < Rails::Railtie
|
3
|
+
railtie_name :has_hashcode
|
4
|
+
|
5
|
+
initializer "railtie_name.hook_into_active_record" do
|
6
|
+
ActiveRecord.base_hook do
|
7
|
+
extend HasHashcode
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def has_hashcode
|
13
|
+
class_eval do
|
14
|
+
def generate_hashcode
|
15
|
+
begin
|
16
|
+
self.hashcode = ActiveSupport::SecureRandom.hex(3).upcase
|
17
|
+
end while !valid? && errors.on(:hashcode).present?
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
before_create :generate_hashcode
|
22
|
+
validates_uniqueness_of :hashcode, :allow_nil => true
|
23
|
+
end
|
24
|
+
end
|
data/test/helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
2
|
+
require File.expand_path('../rails_app/config/application', __FILE__)
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
require 'test/unit'
|
6
|
+
|
7
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
8
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
9
|
+
require 'has_hashcode'
|
10
|
+
|
11
|
+
ENV["RAILS_ENV"] = "test"
|
12
|
+
puts File.expand_path('../rails_app/config/application', __FILE__)
|
13
|
+
|
14
|
+
class Test::Unit::TestCase
|
15
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Edit this Gemfile to bundle your application's dependencies.
|
2
|
+
source 'http://gemcutter.org'
|
3
|
+
|
4
|
+
|
5
|
+
# gem "rails", "3.0.0.beta"
|
6
|
+
|
7
|
+
## Bundle edge rails:
|
8
|
+
gem "rails", :git => "git://github.com/rails/rails.git"
|
9
|
+
|
10
|
+
# ActiveRecord requires a database adapter. By default,
|
11
|
+
# Rails has selected sqlite3.
|
12
|
+
gem "sqlite3-ruby", :require => "sqlite3"
|
13
|
+
|
14
|
+
## Bundle the gems you use:
|
15
|
+
# gem "bj"
|
16
|
+
# gem "hpricot", "0.6"
|
17
|
+
# gem "sqlite3-ruby", :require => "sqlite3"
|
18
|
+
# gem "aws-s3", :require => "aws/s3"
|
19
|
+
|
20
|
+
## Bundle gems used only in certain environments:
|
21
|
+
# gem "rspec", :group => :test
|
22
|
+
# group :test do
|
23
|
+
# gem "webrat"
|
24
|
+
# end
|
25
|
+
gem 'has_hashcode'
|
@@ -0,0 +1,243 @@
|
|
1
|
+
== Welcome to Rails
|
2
|
+
|
3
|
+
Rails is a web-application framework that includes everything needed to create
|
4
|
+
database-backed web applications according to the Model-View-Control pattern.
|
5
|
+
|
6
|
+
This pattern splits the view (also called the presentation) into "dumb" templates
|
7
|
+
that are primarily responsible for inserting pre-built data in between HTML tags.
|
8
|
+
The model contains the "smart" domain objects (such as Account, Product, Person,
|
9
|
+
Post) that holds all the business logic and knows how to persist themselves to
|
10
|
+
a database. The controller handles the incoming requests (such as Save New Account,
|
11
|
+
Update Product, Show Post) by manipulating the model and directing data to the view.
|
12
|
+
|
13
|
+
In Rails, the model is handled by what's called an object-relational mapping
|
14
|
+
layer entitled Active Record. This layer allows you to present the data from
|
15
|
+
database rows as objects and embellish these data objects with business logic
|
16
|
+
methods. You can read more about Active Record in
|
17
|
+
link:files/vendor/rails/activerecord/README.html.
|
18
|
+
|
19
|
+
The controller and view are handled by the Action Pack, which handles both
|
20
|
+
layers by its two parts: Action View and Action Controller. These two layers
|
21
|
+
are bundled in a single package due to their heavy interdependence. This is
|
22
|
+
unlike the relationship between the Active Record and Action Pack that is much
|
23
|
+
more separate. Each of these packages can be used independently outside of
|
24
|
+
Rails. You can read more about Action Pack in
|
25
|
+
link:files/vendor/rails/actionpack/README.html.
|
26
|
+
|
27
|
+
|
28
|
+
== Getting Started
|
29
|
+
|
30
|
+
1. At the command prompt, start a new Rails application using the <tt>rails</tt> command
|
31
|
+
and your application name. Ex: rails myapp
|
32
|
+
2. Change directory into myapp and start the web server: <tt>script/server</tt> (run with --help for options)
|
33
|
+
3. Go to http://localhost:3000/ and get "Welcome aboard: You're riding the Rails!"
|
34
|
+
4. Follow the guidelines to start developing your application
|
35
|
+
|
36
|
+
|
37
|
+
== Web Servers
|
38
|
+
|
39
|
+
By default, Rails will try to use Mongrel if it's are installed when started with script/server, otherwise Rails will use WEBrick, the webserver that ships with Ruby. But you can also use Rails
|
40
|
+
with a variety of other web servers.
|
41
|
+
|
42
|
+
Mongrel is a Ruby-based webserver with a C component (which requires compilation) that is
|
43
|
+
suitable for development and deployment of Rails applications. If you have Ruby Gems installed,
|
44
|
+
getting up and running with mongrel is as easy as: <tt>gem install mongrel</tt>.
|
45
|
+
More info at: http://mongrel.rubyforge.org
|
46
|
+
|
47
|
+
Say other Ruby web servers like Thin and Ebb or regular web servers like Apache or LiteSpeed or
|
48
|
+
Lighttpd or IIS. The Ruby web servers are run through Rack and the latter can either be setup to use
|
49
|
+
FCGI or proxy to a pack of Mongrels/Thin/Ebb servers.
|
50
|
+
|
51
|
+
== Apache .htaccess example for FCGI/CGI
|
52
|
+
|
53
|
+
# General Apache options
|
54
|
+
AddHandler fastcgi-script .fcgi
|
55
|
+
AddHandler cgi-script .cgi
|
56
|
+
Options +FollowSymLinks +ExecCGI
|
57
|
+
|
58
|
+
# If you don't want Rails to look in certain directories,
|
59
|
+
# use the following rewrite rules so that Apache won't rewrite certain requests
|
60
|
+
#
|
61
|
+
# Example:
|
62
|
+
# RewriteCond %{REQUEST_URI} ^/notrails.*
|
63
|
+
# RewriteRule .* - [L]
|
64
|
+
|
65
|
+
# Redirect all requests not available on the filesystem to Rails
|
66
|
+
# By default the cgi dispatcher is used which is very slow
|
67
|
+
#
|
68
|
+
# For better performance replace the dispatcher with the fastcgi one
|
69
|
+
#
|
70
|
+
# Example:
|
71
|
+
# RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
|
72
|
+
RewriteEngine On
|
73
|
+
|
74
|
+
# If your Rails application is accessed via an Alias directive,
|
75
|
+
# then you MUST also set the RewriteBase in this htaccess file.
|
76
|
+
#
|
77
|
+
# Example:
|
78
|
+
# Alias /myrailsapp /path/to/myrailsapp/public
|
79
|
+
# RewriteBase /myrailsapp
|
80
|
+
|
81
|
+
RewriteRule ^$ index.html [QSA]
|
82
|
+
RewriteRule ^([^.]+)$ $1.html [QSA]
|
83
|
+
RewriteCond %{REQUEST_FILENAME} !-f
|
84
|
+
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
|
85
|
+
|
86
|
+
# In case Rails experiences terminal errors
|
87
|
+
# Instead of displaying this message you can supply a file here which will be rendered instead
|
88
|
+
#
|
89
|
+
# Example:
|
90
|
+
# ErrorDocument 500 /500.html
|
91
|
+
|
92
|
+
ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
|
93
|
+
|
94
|
+
|
95
|
+
== Debugging Rails
|
96
|
+
|
97
|
+
Sometimes your application goes wrong. Fortunately there are a lot of tools that
|
98
|
+
will help you debug it and get it back on the rails.
|
99
|
+
|
100
|
+
First area to check is the application log files. Have "tail -f" commands running
|
101
|
+
on the server.log and development.log. Rails will automatically display debugging
|
102
|
+
and runtime information to these files. Debugging info will also be shown in the
|
103
|
+
browser on requests from 127.0.0.1.
|
104
|
+
|
105
|
+
You can also log your own messages directly into the log file from your code using
|
106
|
+
the Ruby logger class from inside your controllers. Example:
|
107
|
+
|
108
|
+
class WeblogController < ActionController::Base
|
109
|
+
def destroy
|
110
|
+
@weblog = Weblog.find(params[:id])
|
111
|
+
@weblog.destroy
|
112
|
+
logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
The result will be a message in your log file along the lines of:
|
117
|
+
|
118
|
+
Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1
|
119
|
+
|
120
|
+
More information on how to use the logger is at http://www.ruby-doc.org/core/
|
121
|
+
|
122
|
+
Also, Ruby documentation can be found at http://www.ruby-lang.org/ including:
|
123
|
+
|
124
|
+
* The Learning Ruby (Pickaxe) Book: http://www.ruby-doc.org/docs/ProgrammingRuby/
|
125
|
+
* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
|
126
|
+
|
127
|
+
These two online (and free) books will bring you up to speed on the Ruby language
|
128
|
+
and also on programming in general.
|
129
|
+
|
130
|
+
|
131
|
+
== Debugger
|
132
|
+
|
133
|
+
Debugger support is available through the debugger command when you start your Mongrel or
|
134
|
+
Webrick server with --debugger. This means that you can break out of execution at any point
|
135
|
+
in the code, investigate and change the model, AND then resume execution!
|
136
|
+
You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
|
137
|
+
Example:
|
138
|
+
|
139
|
+
class WeblogController < ActionController::Base
|
140
|
+
def index
|
141
|
+
@posts = Post.find(:all)
|
142
|
+
debugger
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
So the controller will accept the action, run the first line, then present you
|
147
|
+
with a IRB prompt in the server window. Here you can do things like:
|
148
|
+
|
149
|
+
>> @posts.inspect
|
150
|
+
=> "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
|
151
|
+
#<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
|
152
|
+
>> @posts.first.title = "hello from a debugger"
|
153
|
+
=> "hello from a debugger"
|
154
|
+
|
155
|
+
...and even better is that you can examine how your runtime objects actually work:
|
156
|
+
|
157
|
+
>> f = @posts.first
|
158
|
+
=> #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
|
159
|
+
>> f.
|
160
|
+
Display all 152 possibilities? (y or n)
|
161
|
+
|
162
|
+
Finally, when you're ready to resume execution, you enter "cont"
|
163
|
+
|
164
|
+
|
165
|
+
== Console
|
166
|
+
|
167
|
+
You can interact with the domain model by starting the console through <tt>script/console</tt>.
|
168
|
+
Here you'll have all parts of the application configured, just like it is when the
|
169
|
+
application is running. You can inspect domain models, change values, and save to the
|
170
|
+
database. Starting the script without arguments will launch it in the development environment.
|
171
|
+
Passing an argument will specify a different environment, like <tt>script/console production</tt>.
|
172
|
+
|
173
|
+
To reload your controllers and models after launching the console run <tt>reload!</tt>
|
174
|
+
|
175
|
+
== dbconsole
|
176
|
+
|
177
|
+
You can go to the command line of your database directly through <tt>script/dbconsole</tt>.
|
178
|
+
You would be connected to the database with the credentials defined in database.yml.
|
179
|
+
Starting the script without arguments will connect you to the development database. Passing an
|
180
|
+
argument will connect you to a different database, like <tt>script/dbconsole production</tt>.
|
181
|
+
Currently works for mysql, postgresql and sqlite.
|
182
|
+
|
183
|
+
== Description of Contents
|
184
|
+
|
185
|
+
app
|
186
|
+
Holds all the code that's specific to this particular application.
|
187
|
+
|
188
|
+
app/controllers
|
189
|
+
Holds controllers that should be named like weblogs_controller.rb for
|
190
|
+
automated URL mapping. All controllers should descend from ApplicationController
|
191
|
+
which itself descends from ActionController::Base.
|
192
|
+
|
193
|
+
app/models
|
194
|
+
Holds models that should be named like post.rb.
|
195
|
+
Most models will descend from ActiveRecord::Base.
|
196
|
+
|
197
|
+
app/views
|
198
|
+
Holds the template files for the view that should be named like
|
199
|
+
weblogs/index.html.erb for the WeblogsController#index action. All views use eRuby
|
200
|
+
syntax.
|
201
|
+
|
202
|
+
app/views/layouts
|
203
|
+
Holds the template files for layouts to be used with views. This models the common
|
204
|
+
header/footer method of wrapping views. In your views, define a layout using the
|
205
|
+
<tt>layout :default</tt> and create a file named default.html.erb. Inside default.html.erb,
|
206
|
+
call <% yield %> to render the view using this layout.
|
207
|
+
|
208
|
+
app/helpers
|
209
|
+
Holds view helpers that should be named like weblogs_helper.rb. These are generated
|
210
|
+
for you automatically when using script/generate for controllers. Helpers can be used to
|
211
|
+
wrap functionality for your views into methods.
|
212
|
+
|
213
|
+
config
|
214
|
+
Configuration files for the Rails environment, the routing map, the database, and other dependencies.
|
215
|
+
|
216
|
+
db
|
217
|
+
Contains the database schema in schema.rb. db/migrate contains all
|
218
|
+
the sequence of Migrations for your schema.
|
219
|
+
|
220
|
+
doc
|
221
|
+
This directory is where your application documentation will be stored when generated
|
222
|
+
using <tt>rake doc:app</tt>
|
223
|
+
|
224
|
+
lib
|
225
|
+
Application specific libraries. Basically, any kind of custom code that doesn't
|
226
|
+
belong under controllers, models, or helpers. This directory is in the load path.
|
227
|
+
|
228
|
+
public
|
229
|
+
The directory available for the web server. Contains subdirectories for images, stylesheets,
|
230
|
+
and javascripts. Also contains the dispatchers and the default HTML files. This should be
|
231
|
+
set as the DOCUMENT_ROOT of your web server.
|
232
|
+
|
233
|
+
script
|
234
|
+
Helper scripts for automation and generation.
|
235
|
+
|
236
|
+
test
|
237
|
+
Unit and functional tests along with fixtures. When using the script/generate scripts, template
|
238
|
+
test files will be generated for you and placed in this directory.
|
239
|
+
|
240
|
+
vendor
|
241
|
+
External libraries that the application depends on. Also includes the plugins subdirectory.
|
242
|
+
If the app has frozen rails, those gems also go here, under vendor/rails/.
|
243
|
+
This directory is in the load path.
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
|
+
|
4
|
+
require File.expand_path('../config/application', __FILE__)
|
5
|
+
|
6
|
+
require 'rake'
|
7
|
+
require 'rake/testtask'
|
8
|
+
require 'rake/rdoctask'
|
9
|
+
|
10
|
+
Rails::Application.load_tasks
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
# Auto-require default libraries and those for the current Rails environment.
|
6
|
+
Bundler.require :default, Rails.env
|
7
|
+
|
8
|
+
module Teste
|
9
|
+
class Application < Rails::Application
|
10
|
+
# Settings in config/environments/* take precedence over those specified here.
|
11
|
+
# Application configuration should go into files in config/initializers
|
12
|
+
# -- all .rb files in that directory are automatically loaded.
|
13
|
+
|
14
|
+
# Add additional load paths for your own custom dirs
|
15
|
+
# config.load_paths += %W( #{config.root}/extras )
|
16
|
+
|
17
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
18
|
+
# :all can be used as a placeholder for all plugins not explicitly named
|
19
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
20
|
+
|
21
|
+
# Activate observers that should always be running
|
22
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
23
|
+
|
24
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
25
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
26
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
27
|
+
|
28
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
29
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
|
30
|
+
# config.i18n.default_locale = :de
|
31
|
+
|
32
|
+
# Configure generators values. Many other options are available, be sure to check the documentation.
|
33
|
+
# config.generators do |g|
|
34
|
+
# g.orm :active_record
|
35
|
+
# g.template_engine :erb
|
36
|
+
# g.test_framework :test_unit, :fixture => true
|
37
|
+
# end
|
38
|
+
|
39
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
40
|
+
config.filter_parameters << :password
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Use Bundler (preferred)
|
2
|
+
begin
|
3
|
+
require File.expand_path('../../.bundle/environment', __FILE__)
|
4
|
+
rescue LoadError
|
5
|
+
require 'rubygems'
|
6
|
+
require 'bundler'
|
7
|
+
Bundler.setup
|
8
|
+
|
9
|
+
# To use 2.x style vendor/rails and RubyGems
|
10
|
+
#
|
11
|
+
# vendor_rails = File.expand_path('../../vendor/rails', __FILE__)
|
12
|
+
# if File.exist?(vendor_rails)
|
13
|
+
# Dir["#{vendor_rails}/*/lib"].each { |path| $:.unshift(path) }
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# require 'rubygems'
|
17
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3-ruby (not necessary on OS X Leopard)
|
3
|
+
development:
|
4
|
+
adapter: sqlite3
|
5
|
+
database: db/development.sqlite3
|
6
|
+
pool: 5
|
7
|
+
timeout: 5000
|
8
|
+
|
9
|
+
# Warning: The database defined as "test" will be erased and
|
10
|
+
# re-generated from your development database when you run "rake".
|
11
|
+
# Do not set this db to the same as development or production.
|
12
|
+
test:
|
13
|
+
adapter: sqlite3
|
14
|
+
database: db/test.sqlite3
|
15
|
+
pool: 5
|
16
|
+
timeout: 5000
|
17
|
+
|
18
|
+
production:
|
19
|
+
adapter: sqlite3
|
20
|
+
database: db/production.sqlite3
|
21
|
+
pool: 5
|
22
|
+
timeout: 5000
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Teste::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the webserver when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_view.debug_rjs = true
|
15
|
+
config.action_controller.perform_caching = false
|
16
|
+
|
17
|
+
# Don't care if the mailer can't send
|
18
|
+
config.action_mailer.raise_delivery_errors = false
|
19
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
Teste::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
3
|
+
|
4
|
+
# The production environment is meant for finished, "live" apps.
|
5
|
+
# Code is not reloaded between requests
|
6
|
+
config.cache_classes = true
|
7
|
+
|
8
|
+
# Full error reports are disabled and caching is turned on
|
9
|
+
config.consider_all_requests_local = false
|
10
|
+
config.action_controller.perform_caching = true
|
11
|
+
|
12
|
+
# See everything in the log (default is :info)
|
13
|
+
# config.log_level = :debug
|
14
|
+
|
15
|
+
# Use a different logger for distributed setups
|
16
|
+
# config.logger = SyslogLogger.new
|
17
|
+
|
18
|
+
# Use a different cache store in production
|
19
|
+
# config.cache_store = :mem_cache_store
|
20
|
+
|
21
|
+
# Disable Rails's static asset server
|
22
|
+
# In production, Apache or nginx will already do this
|
23
|
+
config.serve_static_assets = false
|
24
|
+
|
25
|
+
# Enable serving of images, stylesheets, and javascripts from an asset server
|
26
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
27
|
+
|
28
|
+
# Disable delivery errors, bad email addresses will be ignored
|
29
|
+
# config.action_mailer.raise_delivery_errors = false
|
30
|
+
|
31
|
+
# Enable threaded mode
|
32
|
+
# config.threadsafe!
|
33
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
Teste::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Log error messages when you accidentally call methods on nil.
|
11
|
+
config.whiny_nils = true
|
12
|
+
|
13
|
+
# Show full error reports and disable caching
|
14
|
+
config.consider_all_requests_local = true
|
15
|
+
config.action_controller.perform_caching = false
|
16
|
+
|
17
|
+
# Disable request forgery protection in test environment
|
18
|
+
config.action_controller.allow_forgery_protection = false
|
19
|
+
|
20
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
21
|
+
# The :test delivery method accumulates sent emails in the
|
22
|
+
# ActionMailer::Base.deliveries array.
|
23
|
+
config.action_mailer.delivery_method = :test
|
24
|
+
|
25
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
26
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
27
|
+
# like if you have constraints or database-specific column types
|
28
|
+
# config.active_record.schema_format = :sql
|
29
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
+
ActionController::Base.cookie_verifier_secret = '86aad2f9661f96d4d401ff85e33b93684d1a2eb31376430c8d243463b46bbf225ffae9503307ae31bc7b605dddfea75c74b2ea155e85c323bbae6635d995d4ef'
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format
|
4
|
+
# (all these examples are active by default):
|
5
|
+
# ActiveSupport::Inflector.inflections do |inflect|
|
6
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
+
# inflect.singular /^(ox)en/i, '\1'
|
8
|
+
# inflect.irregular 'person', 'people'
|
9
|
+
# inflect.uncountable %w( fish sheep )
|
10
|
+
# end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key for verifying cookie session data integrity.
|
4
|
+
# If you change this key, all old sessions will become invalid!
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
+
ActionController::Base.session = {
|
8
|
+
:key => '_teste_session',
|
9
|
+
:secret => '0b91349d7cbd9eb3a7e3fe4a952c0c0c653c4028c44959ed3df9d15d13121614bae489d75aff789a0749a51d9de8694713733f1db592bc95494a537dbe8fe3c7'
|
10
|
+
}
|
11
|
+
|
12
|
+
# Use the database for sessions instead of the cookie-based default,
|
13
|
+
# which shouldn't be used to store highly confidential information
|
14
|
+
# (create the session table with "rake db:sessions:create")
|
15
|
+
# ActionController::Base.session_store = :active_record_store
|
@@ -0,0 +1,58 @@
|
|
1
|
+
Teste::Application.routes.draw do |map|
|
2
|
+
# The priority is based upon order of creation:
|
3
|
+
# first created -> highest priority.
|
4
|
+
|
5
|
+
# Sample of regular route:
|
6
|
+
# match 'products/:id' => 'catalog#view'
|
7
|
+
# Keep in mind you can assign values other than :controller and :action
|
8
|
+
|
9
|
+
# Sample of named route:
|
10
|
+
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
|
11
|
+
# This route can be invoked with purchase_url(:id => product.id)
|
12
|
+
|
13
|
+
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
14
|
+
# resources :products
|
15
|
+
|
16
|
+
# Sample resource route with options:
|
17
|
+
# resources :products do
|
18
|
+
# member do
|
19
|
+
# get :short
|
20
|
+
# post :toggle
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# collection do
|
24
|
+
# get :sold
|
25
|
+
# end
|
26
|
+
# end
|
27
|
+
|
28
|
+
# Sample resource route with sub-resources:
|
29
|
+
# resources :products do
|
30
|
+
# resources :comments, :sales
|
31
|
+
# resource :seller
|
32
|
+
# end
|
33
|
+
|
34
|
+
# Sample resource route with more complex sub-resources
|
35
|
+
# resources :products do
|
36
|
+
# resources :comments
|
37
|
+
# resources :sales do
|
38
|
+
# get :recent, :on => :collection
|
39
|
+
# end
|
40
|
+
# end
|
41
|
+
|
42
|
+
# Sample resource route within a namespace:
|
43
|
+
# namespace :admin do
|
44
|
+
# # Directs /admin/products/* to Admin::ProductsController
|
45
|
+
# # (app/controllers/admin/products_controller.rb)
|
46
|
+
# resources :products
|
47
|
+
# end
|
48
|
+
|
49
|
+
# You can have the root of your site routed with "root"
|
50
|
+
# just remember to delete public/index.html.
|
51
|
+
# root :to => "welcome#index"
|
52
|
+
|
53
|
+
# See how all your routes lay out with "rake routes"
|
54
|
+
|
55
|
+
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
56
|
+
# Note: This route will make all actions in every controller accessible via GET requests.
|
57
|
+
# match ':controller(/:action(/:id(.:format)))'
|
58
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# This file is auto-generated from the current state of the database. Instead of editing this file,
|
2
|
+
# please use the migrations feature of Active Record to incrementally modify your database, and
|
3
|
+
# then regenerate this schema definition.
|
4
|
+
#
|
5
|
+
# Note that this schema.rb definition is the authoritative source for your database schema. If you need
|
6
|
+
# to create the application database on another system, you should be using db:schema:load, not running
|
7
|
+
# all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
8
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
9
|
+
#
|
10
|
+
# It's strongly recommended to check this file into your version control system.
|
11
|
+
|
12
|
+
ActiveRecord::Schema.define(:version => 20100314023120) do
|
13
|
+
|
14
|
+
create_table "users", :force => true do |t|
|
15
|
+
t.string "hashcode"
|
16
|
+
t.datetime "created_at"
|
17
|
+
t.datetime "updated_at"
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
+
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
3
|
+
#
|
4
|
+
# Examples:
|
5
|
+
#
|
6
|
+
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
|
7
|
+
# Mayor.create(:name => 'Daley', :city => cities.first)
|
File without changes
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
ENV_PATH = File.expand_path('../../config/environment', __FILE__)
|
5
|
+
BOOT_PATH = File.expand_path('../../config/boot', __FILE__)
|
6
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
7
|
+
ROOT_PATH = File.expand_path('../..', __FILE__)
|
8
|
+
|
9
|
+
require BOOT_PATH
|
10
|
+
require 'rails/commands'
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
|
2
|
+
|
3
|
+
# This model initially had no columns defined. If you add columns to the
|
4
|
+
# model remove the '{}' from the fixture names and add the columns immediately
|
5
|
+
# below each fixture, per the syntax in the comments below
|
6
|
+
#
|
7
|
+
one: {}
|
8
|
+
# column: value
|
9
|
+
#
|
10
|
+
two: {}
|
11
|
+
# column: value
|
@@ -0,0 +1,13 @@
|
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
|
3
|
+
require 'rails/test_help'
|
4
|
+
|
5
|
+
class ActiveSupport::TestCase
|
6
|
+
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
|
7
|
+
#
|
8
|
+
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
9
|
+
# -- they do not yet inherit this setting
|
10
|
+
fixtures :all
|
11
|
+
|
12
|
+
# Add more helper methods to be used by all tests here...
|
13
|
+
end
|
File without changes
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestHasHashcode < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@user = User.create
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_generates_hashcode
|
9
|
+
assert @user.hashcode.present?
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_validates_uniqueness
|
13
|
+
@user.hashcode = User.create.hashcode
|
14
|
+
@user.save
|
15
|
+
assert @user.errors[:hashcode].present?
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_its_6_characters_long
|
19
|
+
assert_equal 6, @user.hashcode.length
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
metadata
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: has_hashcode
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- "Elomar Fran\xC3\xA7a"
|
13
|
+
- Rafael Souza
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-03-14 00:00:00 -03:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description:
|
23
|
+
email: elomar+rafael@maisweb.org
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files:
|
29
|
+
- LICENSE
|
30
|
+
- README.rdoc
|
31
|
+
files:
|
32
|
+
- .document
|
33
|
+
- .gitignore
|
34
|
+
- Gemfile
|
35
|
+
- LICENSE
|
36
|
+
- README.rdoc
|
37
|
+
- Rakefile
|
38
|
+
- VERSION
|
39
|
+
- has_hashcode.gemspec
|
40
|
+
- lib/has_hashcode.rb
|
41
|
+
- test/helper.rb
|
42
|
+
- test/rails_app/.gitignore
|
43
|
+
- test/rails_app/Gemfile
|
44
|
+
- test/rails_app/README
|
45
|
+
- test/rails_app/Rakefile
|
46
|
+
- test/rails_app/app/controllers/application_controller.rb
|
47
|
+
- test/rails_app/app/helpers/application_helper.rb
|
48
|
+
- test/rails_app/app/models/user.rb
|
49
|
+
- test/rails_app/config.ru
|
50
|
+
- test/rails_app/config/application.rb
|
51
|
+
- test/rails_app/config/boot.rb
|
52
|
+
- test/rails_app/config/database.yml
|
53
|
+
- test/rails_app/config/environment.rb
|
54
|
+
- test/rails_app/config/environments/development.rb
|
55
|
+
- test/rails_app/config/environments/production.rb
|
56
|
+
- test/rails_app/config/environments/test.rb
|
57
|
+
- test/rails_app/config/initializers/backtrace_silencers.rb
|
58
|
+
- test/rails_app/config/initializers/cookie_verification_secret.rb
|
59
|
+
- test/rails_app/config/initializers/inflections.rb
|
60
|
+
- test/rails_app/config/initializers/mime_types.rb
|
61
|
+
- test/rails_app/config/initializers/session_store.rb
|
62
|
+
- test/rails_app/config/locales/en.yml
|
63
|
+
- test/rails_app/config/routes.rb
|
64
|
+
- test/rails_app/db/migrate/20100314023120_create_users.rb
|
65
|
+
- test/rails_app/db/schema.rb
|
66
|
+
- test/rails_app/db/seeds.rb
|
67
|
+
- test/rails_app/doc/README_FOR_APP
|
68
|
+
- test/rails_app/lib/tasks/.gitkeep
|
69
|
+
- test/rails_app/script/rails
|
70
|
+
- test/rails_app/test/fixtures/users.yml
|
71
|
+
- test/rails_app/test/performance/browsing_test.rb
|
72
|
+
- test/rails_app/test/test_helper.rb
|
73
|
+
- test/rails_app/test/unit/user_test.rb
|
74
|
+
- test/rails_app/vendor/plugins/.gitkeep
|
75
|
+
- test/test_has_hashcode.rb
|
76
|
+
has_rdoc: true
|
77
|
+
homepage: http://github.com/elomar/has_hashcode
|
78
|
+
licenses: []
|
79
|
+
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options:
|
82
|
+
- --charset=UTF-8
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
segments:
|
90
|
+
- 0
|
91
|
+
version: "0"
|
92
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
segments:
|
97
|
+
- 0
|
98
|
+
version: "0"
|
99
|
+
requirements: []
|
100
|
+
|
101
|
+
rubyforge_project:
|
102
|
+
rubygems_version: 1.3.6
|
103
|
+
signing_key:
|
104
|
+
specification_version: 3
|
105
|
+
summary: Adds a hashcode to your objects
|
106
|
+
test_files:
|
107
|
+
- test/helper.rb
|
108
|
+
- test/rails_app/app/controllers/application_controller.rb
|
109
|
+
- test/rails_app/app/helpers/application_helper.rb
|
110
|
+
- test/rails_app/app/models/user.rb
|
111
|
+
- test/rails_app/config/application.rb
|
112
|
+
- test/rails_app/config/boot.rb
|
113
|
+
- test/rails_app/config/environment.rb
|
114
|
+
- test/rails_app/config/environments/development.rb
|
115
|
+
- test/rails_app/config/environments/production.rb
|
116
|
+
- test/rails_app/config/environments/test.rb
|
117
|
+
- test/rails_app/config/initializers/backtrace_silencers.rb
|
118
|
+
- test/rails_app/config/initializers/cookie_verification_secret.rb
|
119
|
+
- test/rails_app/config/initializers/inflections.rb
|
120
|
+
- test/rails_app/config/initializers/mime_types.rb
|
121
|
+
- test/rails_app/config/initializers/session_store.rb
|
122
|
+
- test/rails_app/config/routes.rb
|
123
|
+
- test/rails_app/db/migrate/20100314023120_create_users.rb
|
124
|
+
- test/rails_app/db/schema.rb
|
125
|
+
- test/rails_app/db/seeds.rb
|
126
|
+
- test/rails_app/test/performance/browsing_test.rb
|
127
|
+
- test/rails_app/test/test_helper.rb
|
128
|
+
- test/rails_app/test/unit/user_test.rb
|
129
|
+
- test/test_has_hashcode.rb
|