dbchecker 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +20 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/README.md +93 -0
- data/Rakefile +7 -0
- data/TODO.md +6 -0
- data/dbchecker.gemspec +29 -0
- data/lib/dbchecker.rb +8 -0
- data/lib/dbchecker/base.rb +14 -0
- data/lib/dbchecker/checker.rb +14 -0
- data/lib/dbchecker/dsl.rb +107 -0
- data/lib/dbchecker/railtie.rb +5 -0
- data/lib/dbchecker/version.rb +3 -0
- data/lib/tasks/db_check.rake +6 -0
- data/spec/dsl/check_duplicates_spec.rb +41 -0
- data/spec/dsl/check_equal_spec.rb +36 -0
- data/spec/dsl/check_negatives_spec.rb +36 -0
- data/spec/dsl/check_nil_spec.rb +35 -0
- data/spec/dsl/check_references_spec.rb +37 -0
- data/spec/dsl/check_zero_spec.rb +36 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/models/profile.rb +5 -0
- data/spec/dummy/app/models/provider.rb +3 -0
- data/spec/dummy/app/models/user.rb +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +59 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +10 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +37 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/routes.rb +58 -0
- data/spec/dummy/db/migrate/20130703094110_create_users.rb +11 -0
- data/spec/dummy/db/migrate/20130703094241_create_profiles.rb +15 -0
- data/spec/dummy/db/migrate/20130703102715_create_providers.rb +9 -0
- data/spec/dummy/db/schema.rb +41 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/factories.rb +12 -0
- data/spec/spec_helper.rb +30 -0
- metadata +228 -0
@@ -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
|
+
Dummy::Application.config.secret_token = '99f00a31c2c1599835df7ac6afbd5235a1bc21988aaba81b7414930e464963474dd79b11bfad3b03824f7e13e61e4ae64e8442a3f7ee8ae0435754d0e2a2ffd1'
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
|
4
|
+
|
5
|
+
# Use the database for sessions instead of the cookie-based default,
|
6
|
+
# which shouldn't be used to store highly confidential information
|
7
|
+
# (create the session table with "rails generate session_migration")
|
8
|
+
# Dummy::Application.config.session_store :active_record_store
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
#
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
+
# is enabled by default.
|
5
|
+
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
8
|
+
wrap_parameters format: [:json]
|
9
|
+
end
|
10
|
+
|
11
|
+
# Disable root element in JSON by default.
|
12
|
+
ActiveSupport.on_load(:active_record) do
|
13
|
+
self.include_root_in_json = false
|
14
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
Dummy::Application.routes.draw do
|
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,15 @@
|
|
1
|
+
class CreateProfiles < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :profiles do |t|
|
4
|
+
t.integer :user_id
|
5
|
+
t.integer :provider_id
|
6
|
+
|
7
|
+
t.string :url
|
8
|
+
t.string :bio
|
9
|
+
t.integer :number_of_friends
|
10
|
+
t.integer :number_of_points
|
11
|
+
|
12
|
+
t.timestamps
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# This file is auto-generated from the current state of the database. Instead
|
3
|
+
# of editing this file, please use the migrations feature of Active Record to
|
4
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
+
#
|
6
|
+
# Note that this schema.rb definition is the authoritative source for your
|
7
|
+
# database schema. If you need to create the application database on another
|
8
|
+
# system, you should be using db:schema:load, not running all the migrations
|
9
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
+
#
|
12
|
+
# It's strongly recommended to check this file into your version control system.
|
13
|
+
|
14
|
+
ActiveRecord::Schema.define(:version => 20130703102715) do
|
15
|
+
|
16
|
+
create_table "profiles", :force => true do |t|
|
17
|
+
t.integer "user_id"
|
18
|
+
t.integer "provider_id"
|
19
|
+
t.string "url"
|
20
|
+
t.string "bio"
|
21
|
+
t.integer "number_of_friends"
|
22
|
+
t.integer "number_of_points"
|
23
|
+
t.datetime "created_at", :null => false
|
24
|
+
t.datetime "updated_at", :null => false
|
25
|
+
end
|
26
|
+
|
27
|
+
create_table "providers", :force => true do |t|
|
28
|
+
t.integer "uid"
|
29
|
+
t.datetime "created_at", :null => false
|
30
|
+
t.datetime "updated_at", :null => false
|
31
|
+
end
|
32
|
+
|
33
|
+
create_table "users", :force => true do |t|
|
34
|
+
t.string "name"
|
35
|
+
t.string "email"
|
36
|
+
t.integer "number_of_logins"
|
37
|
+
t.datetime "created_at", :null => false
|
38
|
+
t.datetime "updated_at", :null => false
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
Binary file
|
data/spec/factories.rb
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
2
|
+
|
3
|
+
require 'dbchecker'
|
4
|
+
require 'database_cleaner'
|
5
|
+
|
6
|
+
require File.expand_path("../factories.rb", __FILE__)
|
7
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
8
|
+
|
9
|
+
Rails.backtrace_cleaner.remove_silencers!
|
10
|
+
RSpec.configure do |config|
|
11
|
+
config.include FactoryGirl::Syntax::Methods
|
12
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
13
|
+
config.run_all_when_everything_filtered = true
|
14
|
+
config.filter_run :focus
|
15
|
+
config.order = 'random'
|
16
|
+
|
17
|
+
config.before(:suite) do
|
18
|
+
DatabaseCleaner.strategy = :truncation
|
19
|
+
end
|
20
|
+
config.before(:each) do
|
21
|
+
DatabaseCleaner.start
|
22
|
+
end
|
23
|
+
config.after(:each) do
|
24
|
+
DatabaseCleaner.clean
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class UserSubject < Dbchecker::Checker;model :user;end
|
29
|
+
class ProfileSubject < Dbchecker::Checker;model :profile;end
|
30
|
+
class ProviderSubject < Dbchecker::Checker;model :provider;end
|
metadata
ADDED
@@ -0,0 +1,228 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dbchecker
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alejandro Andres
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-07-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: factory_girl
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: sqlite3
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: database_cleaner
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rails
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ~>
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 3.2.13
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ~>
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 3.2.13
|
111
|
+
description: Check your database consistency
|
112
|
+
email:
|
113
|
+
- alej@redradix.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- .gitignore
|
119
|
+
- .rspec
|
120
|
+
- Gemfile
|
121
|
+
- README.md
|
122
|
+
- Rakefile
|
123
|
+
- TODO.md
|
124
|
+
- dbchecker.gemspec
|
125
|
+
- lib/dbchecker.rb
|
126
|
+
- lib/dbchecker/base.rb
|
127
|
+
- lib/dbchecker/checker.rb
|
128
|
+
- lib/dbchecker/dsl.rb
|
129
|
+
- lib/dbchecker/railtie.rb
|
130
|
+
- lib/dbchecker/version.rb
|
131
|
+
- lib/tasks/db_check.rake
|
132
|
+
- spec/dsl/check_duplicates_spec.rb
|
133
|
+
- spec/dsl/check_equal_spec.rb
|
134
|
+
- spec/dsl/check_negatives_spec.rb
|
135
|
+
- spec/dsl/check_nil_spec.rb
|
136
|
+
- spec/dsl/check_references_spec.rb
|
137
|
+
- spec/dsl/check_zero_spec.rb
|
138
|
+
- spec/dummy/Rakefile
|
139
|
+
- spec/dummy/app/assets/javascripts/application.js
|
140
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
141
|
+
- spec/dummy/app/controllers/application_controller.rb
|
142
|
+
- spec/dummy/app/models/.gitkeep
|
143
|
+
- spec/dummy/app/models/profile.rb
|
144
|
+
- spec/dummy/app/models/provider.rb
|
145
|
+
- spec/dummy/app/models/user.rb
|
146
|
+
- spec/dummy/config.ru
|
147
|
+
- spec/dummy/config/application.rb
|
148
|
+
- spec/dummy/config/boot.rb
|
149
|
+
- spec/dummy/config/database.yml
|
150
|
+
- spec/dummy/config/environment.rb
|
151
|
+
- spec/dummy/config/environments/development.rb
|
152
|
+
- spec/dummy/config/environments/production.rb
|
153
|
+
- spec/dummy/config/environments/test.rb
|
154
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
155
|
+
- spec/dummy/config/initializers/inflections.rb
|
156
|
+
- spec/dummy/config/initializers/mime_types.rb
|
157
|
+
- spec/dummy/config/initializers/secret_token.rb
|
158
|
+
- spec/dummy/config/initializers/session_store.rb
|
159
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
160
|
+
- spec/dummy/config/routes.rb
|
161
|
+
- spec/dummy/db/migrate/20130703094110_create_users.rb
|
162
|
+
- spec/dummy/db/migrate/20130703094241_create_profiles.rb
|
163
|
+
- spec/dummy/db/migrate/20130703102715_create_providers.rb
|
164
|
+
- spec/dummy/db/schema.rb
|
165
|
+
- spec/dummy/db/test.sqlite3
|
166
|
+
- spec/factories.rb
|
167
|
+
- spec/spec_helper.rb
|
168
|
+
homepage: http://github.com/redradix/dbchecker
|
169
|
+
licenses:
|
170
|
+
- MIT
|
171
|
+
metadata: {}
|
172
|
+
post_install_message:
|
173
|
+
rdoc_options: []
|
174
|
+
require_paths:
|
175
|
+
- lib
|
176
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - '>='
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
181
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
|
+
requirements:
|
183
|
+
- - '>='
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: '0'
|
186
|
+
requirements: []
|
187
|
+
rubyforge_project:
|
188
|
+
rubygems_version: 2.0.0
|
189
|
+
signing_key:
|
190
|
+
specification_version: 4
|
191
|
+
summary: This gem offers a set of tools to check the consistency of your database
|
192
|
+
test_files:
|
193
|
+
- spec/dsl/check_duplicates_spec.rb
|
194
|
+
- spec/dsl/check_equal_spec.rb
|
195
|
+
- spec/dsl/check_negatives_spec.rb
|
196
|
+
- spec/dsl/check_nil_spec.rb
|
197
|
+
- spec/dsl/check_references_spec.rb
|
198
|
+
- spec/dsl/check_zero_spec.rb
|
199
|
+
- spec/dummy/Rakefile
|
200
|
+
- spec/dummy/app/assets/javascripts/application.js
|
201
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
202
|
+
- spec/dummy/app/controllers/application_controller.rb
|
203
|
+
- spec/dummy/app/models/.gitkeep
|
204
|
+
- spec/dummy/app/models/profile.rb
|
205
|
+
- spec/dummy/app/models/provider.rb
|
206
|
+
- spec/dummy/app/models/user.rb
|
207
|
+
- spec/dummy/config.ru
|
208
|
+
- spec/dummy/config/application.rb
|
209
|
+
- spec/dummy/config/boot.rb
|
210
|
+
- spec/dummy/config/database.yml
|
211
|
+
- spec/dummy/config/environment.rb
|
212
|
+
- spec/dummy/config/environments/development.rb
|
213
|
+
- spec/dummy/config/environments/production.rb
|
214
|
+
- spec/dummy/config/environments/test.rb
|
215
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
216
|
+
- spec/dummy/config/initializers/inflections.rb
|
217
|
+
- spec/dummy/config/initializers/mime_types.rb
|
218
|
+
- spec/dummy/config/initializers/secret_token.rb
|
219
|
+
- spec/dummy/config/initializers/session_store.rb
|
220
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
221
|
+
- spec/dummy/config/routes.rb
|
222
|
+
- spec/dummy/db/migrate/20130703094110_create_users.rb
|
223
|
+
- spec/dummy/db/migrate/20130703094241_create_profiles.rb
|
224
|
+
- spec/dummy/db/migrate/20130703102715_create_providers.rb
|
225
|
+
- spec/dummy/db/schema.rb
|
226
|
+
- spec/dummy/db/test.sqlite3
|
227
|
+
- spec/factories.rb
|
228
|
+
- spec/spec_helper.rb
|