voight_kampff 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +7 -0
  2. data/.autotest +22 -0
  3. data/.gitignore +7 -0
  4. data/CHANGELOG.rdoc +16 -0
  5. data/Gemfile +7 -0
  6. data/Gemfile.lock +28 -0
  7. data/README.markdown +63 -0
  8. data/Rakefile +20 -0
  9. data/config/initializers/extend_action_dispatch_requset.rb +4 -4
  10. data/lib/tasks/voight_kampff.rake +1 -0
  11. data/lib/voight_kampff/base.rb +7 -0
  12. data/lib/voight_kampff/test.rb +8 -8
  13. data/lib/voight_kampff/user_agents_parser.rb +1 -1
  14. data/lib/voight_kampff/version.rb +1 -3
  15. data/lib/voight_kampff.rb +4 -4
  16. data/tests/spec/minitest_helper.rb +2 -0
  17. data/tests/spec/voight_kampff_spec.rb +10 -0
  18. data/tests/test_app/.gitignore +15 -0
  19. data/tests/test_app/Gemfile +39 -0
  20. data/tests/test_app/Gemfile.lock +123 -0
  21. data/tests/test_app/Rakefile +7 -0
  22. data/tests/test_app/app/controllers/application_controller.rb +3 -0
  23. data/tests/test_app/app/helpers/application_helper.rb +2 -0
  24. data/tests/test_app/app/mailers/.gitkeep +0 -0
  25. data/tests/test_app/app/models/.gitkeep +0 -0
  26. data/tests/test_app/app/views/layouts/application.html.erb +14 -0
  27. data/tests/test_app/config/application.rb +62 -0
  28. data/tests/test_app/config/boot.rb +6 -0
  29. data/tests/test_app/config/database.yml +25 -0
  30. data/tests/test_app/config/environment.rb +5 -0
  31. data/tests/test_app/config/environments/development.rb +37 -0
  32. data/tests/test_app/config/environments/production.rb +67 -0
  33. data/tests/test_app/config/environments/test.rb +37 -0
  34. data/tests/test_app/config/initializers/backtrace_silencers.rb +7 -0
  35. data/tests/test_app/config/initializers/inflections.rb +15 -0
  36. data/tests/test_app/config/initializers/mime_types.rb +5 -0
  37. data/tests/test_app/config/initializers/secret_token.rb +7 -0
  38. data/tests/test_app/config/initializers/session_store.rb +8 -0
  39. data/tests/test_app/config/initializers/wrap_parameters.rb +14 -0
  40. data/tests/test_app/config/locales/en.yml +5 -0
  41. data/tests/test_app/config/routes.rb +58 -0
  42. data/tests/test_app/config.ru +4 -0
  43. data/tests/test_app/doc/README_FOR_APP +2 -0
  44. data/tests/test_app/lib/assets/.gitkeep +0 -0
  45. data/tests/test_app/lib/tasks/.gitkeep +0 -0
  46. data/tests/test_app/log/.gitkeep +0 -0
  47. data/tests/test_app/public/404.html +26 -0
  48. data/tests/test_app/public/422.html +26 -0
  49. data/tests/test_app/public/500.html +25 -0
  50. data/tests/test_app/public/favicon.ico +0 -0
  51. data/tests/test_app/public/index.html +241 -0
  52. data/tests/test_app/public/robots.txt +5 -0
  53. data/tests/test_app/script/rails +6 -0
  54. data/tests/test_app/test/fixtures/.gitkeep +0 -0
  55. data/tests/test_app/test/functional/.gitkeep +0 -0
  56. data/tests/test_app/test/integration/.gitkeep +0 -0
  57. data/tests/test_app/test/performance/browsing_test.rb +12 -0
  58. data/tests/test_app/test/test_helper.rb +13 -0
  59. data/tests/test_app/test/unit/.gitkeep +0 -0
  60. data/tests/test_app/vendor/assets/javascripts/.gitkeep +0 -0
  61. data/tests/test_app/vendor/assets/stylesheets/.gitkeep +0 -0
  62. data/tests/test_app/vendor/plugins/.gitkeep +0 -0
  63. data/voight_kampff.gemspec +30 -0
  64. metadata +116 -22
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2fda1e6dfa4eb9d13fc6e97ed8a017e6c3e0a75a
4
+ data.tar.gz: 82792de66dc04e759c31937bd098839ba6841e10
5
+ SHA512:
6
+ metadata.gz: f10cf36a22e05ad573a979fd7e3ded7aa77a9da4fc1ea5b912e4548bab8719509f8d564bd68bea8807c5e78b623c75edc04d4188498ac8ab58dae47780c99127
7
+ data.tar.gz: 0d3500dd716f6ff8310d2ffede85bc3c813d6d370a1993fe075c90052212b270d56964bc1b7fdaf8f6bc9cb0e564a7a0d37025c187fe2943c4b50cfb5b04c396
data/.autotest ADDED
@@ -0,0 +1,22 @@
1
+ #-*- ruby -*-
2
+ # For more doc, see http://docs.seattlerb.org/ZenTest/Autotest.html
3
+
4
+ require 'autotest/restart'
5
+
6
+ Autotest.add_hook :initialize do |at|
7
+
8
+ at.clear_mappings
9
+
10
+ # hardcoded lib and tests path
11
+ at.libs = '.:lib:tests/spec'
12
+
13
+ # test lib being tested against
14
+ at.testlib = 'tests/spec/minitest_helper'
15
+
16
+ at.order = :random
17
+
18
+ # matches lib/test_here.rb => tests/spec/test_here.rb
19
+ at.add_mapping(%r%^lib/(.*)\.rb$%) { |_, m|
20
+ ["tests/spec/#{m[1]}_spec.rb"]
21
+ }
22
+ end
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ .DS_Store
2
+ *~
3
+ Gemfile.lock
4
+ .bundle
5
+ *.rbc
6
+ coverage
7
+ doc
data/CHANGELOG.rdoc ADDED
@@ -0,0 +1,16 @@
1
+ == 0.1.4 (2011-09-06)
2
+ * Handle nil user agent string
3
+ * (@adamcrown)
4
+
5
+ == 0.1.3 (2011-09-06)
6
+ * Added httpclient dependency
7
+ * fixed broken links in README
8
+ * (@halloffame)
9
+
10
+ == 0.1.1 (2011-05-16)
11
+ * Added Rails Support
12
+ * (@adamcrown)
13
+
14
+ == 0.0.0 (2011-05-11)
15
+ * First commit
16
+ * (@adamcrown)
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://www.rubygems.org'
2
+
3
+ gem 'rake'
4
+
5
+ gemspec
6
+
7
+
data/Gemfile.lock ADDED
@@ -0,0 +1,28 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ voight_kampff (0.1.4)
5
+ httpclient (~> 2.2)
6
+ nokogiri (~> 1.6.0)
7
+
8
+ GEM
9
+ remote: https://www.rubygems.org/
10
+ specs:
11
+ httpclient (2.3.3)
12
+ json (1.8.0)
13
+ mini_portile (0.5.1)
14
+ minitest (4.7.5)
15
+ nokogiri (1.6.0)
16
+ mini_portile (~> 0.5.0)
17
+ rake (10.1.0)
18
+ rdoc (4.0.1)
19
+ json (~> 1.4)
20
+
21
+ PLATFORMS
22
+ ruby
23
+
24
+ DEPENDENCIES
25
+ minitest (~> 4.7)
26
+ rake
27
+ rdoc (>= 2.4.2)
28
+ voight_kampff!
data/README.markdown ADDED
@@ -0,0 +1,63 @@
1
+ Voight-Kampff
2
+ =============
3
+ [![Build Status](https://travis-ci.org/nbit001/voight-kampff.png?branch=master)](https://travis-ci.org/nbit001/voight-kampff)
4
+
5
+ Voight-Kampff relies on [user agent](http://en.wikipedia.org/wiki/User_agent) list for its detection. It can easily tell you if a request is coming from a crawler, spider or bot. This can be especially helpful in analytics such as page hit tracking.
6
+
7
+ Installation
8
+ ============
9
+ `gem install voight_kampff`
10
+
11
+ Configuration
12
+ =============
13
+
14
+ A YAML file is used to match [user agent strings](http://simplyfast.info/browser) to their types.
15
+
16
+ If you'd like to use an [updated list](http://www.user-agents.org/) or make your own customizations, run `rake voight_kampff:import_user_agents`. This will download a user_agents.yml file into your Rails `/config` directory.
17
+
18
+ To use [Regular Expression](http://en.wikipedia.org/wiki/Regular_expression) matching, just set `string_match: regex` in your user_agent entry. The first match will be used so you should probably put your Regular Expression entries toward the bottom of the file.
19
+
20
+ Usage
21
+ =====
22
+ There are three ways to use Voight-Kampff
23
+
24
+ 1. In your [Ruby on Rails](http://rubyonrails.org) controllers:
25
+ `request.bot?`
26
+
27
+ 2. Through the `VoightKampff` module:
28
+ `VoightKampff.bot? 'your user agent string'`
29
+
30
+ 3. Through a `VoightKampff::Test` instance:
31
+ `VoightKampff::Test.new('your user agent string').bot?`
32
+
33
+ All of the above examples accept `human?`, `bot?`, `browser?`, `checker?`, `downloader?`, `proxy?`, `crawler?` and `spam?` methods. All of these methods will return `true`, `false`, or `nil` (if it doesn't recognize the user agent).
34
+
35
+ FAQ
36
+ ===
37
+ __Q:__ __What's with the name?__
38
+ __A:__ It's the [machine in Blade Runner](http://en.wikipedia.org/wiki/Blade_Runner#Voight-Kampff_machine) that is used to test whether someone is a human or a replicant.
39
+
40
+ __Q:__ __My browser isn't being matched__
41
+ __A:__ The list is being pulled from [user-agents.org](http://www.user-agents.org).
42
+ If you'd like to have entries added to the list please [create a new issue](https://github.com/biola/Voight-Kampff/issues/new) or send me a [pull request](https://github.com/biola/Voight-Kampff/pulls). And if you know of a better source for this sort of data, please [let me know](mailto:adam@obledesign.com).
43
+
44
+ CONTRIBUTING
45
+ ===========
46
+ PR without tests will not get merged, Make sure you write tests for api and rails app.
47
+ Feel free to ask for help, if you do not know how to write a determined test.
48
+
49
+ RUNNING TESTS?
50
+ =============
51
+
52
+ * bundle install
53
+ * rake
54
+ * rake test #code tests
55
+ * rake spec #app tests
56
+
57
+ AUTOMATE TESTS? Fear not
58
+ =======================
59
+ * gem install autotest-standalone
60
+ * autotest
61
+ * that's it
62
+ * wq
63
+
data/Rakefile ADDED
@@ -0,0 +1,20 @@
1
+ #require 'bundler/setup'
2
+ require 'rake/testtask'
3
+
4
+ _PATTERN_ = 'tests/spec/**/*_spec.rb'
5
+
6
+ Bundler::GemHelper.install_tasks
7
+
8
+ task :default => :test
9
+
10
+ ##
11
+ # Setup rake test in order to
12
+ # run minitest speclike tests
13
+ # libs << path.. to load {minitest, spec, test}_helper.rb
14
+ Rake::TestTask.new do |t|
15
+ t.libs << 'tests/spec'
16
+ t.pattern = _PATTERN_
17
+ t.test_files = FileList[_PATTERN_]
18
+ t.verbose = false
19
+ end
20
+
@@ -5,7 +5,7 @@ module ActionDispatch
5
5
  def human?
6
6
  voight_kampff_test.human?
7
7
  end
8
-
8
+
9
9
  def bot?
10
10
  voight_kampff_test.bot?
11
11
  end
@@ -18,11 +18,11 @@ module ActionDispatch
18
18
  def checker?
19
19
  voight_kampff_test.checker?
20
20
  end
21
-
21
+
22
22
  def downloader?
23
23
  voight_kampff_test.downloader?
24
24
  end
25
-
25
+
26
26
  def proxy?
27
27
  voight_kampff_test.proxy?
28
28
  end
@@ -36,7 +36,7 @@ module ActionDispatch
36
36
  end
37
37
 
38
38
  private
39
-
39
+
40
40
  def voight_kampff_test
41
41
  @voight_kampff ||= VoightKampff::Test.new(user_agent)
42
42
  end
@@ -4,6 +4,7 @@ namespace :voight_kampff do
4
4
  task :import_user_agents, :url do |t, args|
5
5
  args.with_defaults :url => 'http://www.user-agents.org/allagents.xml'
6
6
  agents = VoightKampff::UserAgentsParser.new(args[:url])
7
+
7
8
  file = File.open(Rails.root.join('config','user_agents.yml'), 'w')
8
9
  file.write(agents.to_yaml)
9
10
  end
@@ -0,0 +1,7 @@
1
+ module VoightKampff
2
+
3
+
4
+
5
+
6
+
7
+ end
@@ -4,7 +4,7 @@ module VoightKampff
4
4
 
5
5
  attr_accessor :user_agent_string
6
6
  attr_accessor :types
7
-
7
+
8
8
  def initialize(user_agent_string)
9
9
  load_agents
10
10
  @user_agent_string = user_agent_string
@@ -24,7 +24,7 @@ module VoightKampff
24
24
 
25
25
  def has_type?(*types)
26
26
  return nil if agent.empty?
27
-
27
+
28
28
  types.any? do |type|
29
29
  @types.include? type
30
30
  end
@@ -46,11 +46,11 @@ module VoightKampff
46
46
  def checker?
47
47
  has_type? :checker
48
48
  end
49
-
49
+
50
50
  def downloader?
51
51
  has_type? :downloader
52
52
  end
53
-
53
+
54
54
  def proxy?
55
55
  has_type? :proxy
56
56
  end
@@ -64,21 +64,21 @@ module VoightKampff
64
64
  end
65
65
 
66
66
  private
67
-
67
+
68
68
  def load_agents
69
69
  @@agents ||= []
70
70
  if @@agents.empty?
71
-
71
+
72
72
  base_paths = [VoightKampff.root]
73
73
  base_paths << Rails.root if defined? Rails
74
74
  rel_path = ['config', 'user_agents.yml']
75
-
75
+
76
76
  base_paths.any? do |base_path|
77
77
  if File.exists? base_path.join(*rel_path)
78
78
  @@agents = YAML.load(File.open(base_path.join(*rel_path), 'r'))
79
79
  end
80
80
  end
81
-
81
+
82
82
  end
83
83
  end
84
84
 
@@ -37,7 +37,7 @@ module VoightKampff
37
37
  end
38
38
 
39
39
  private
40
-
40
+
41
41
  def clarify_type(type)
42
42
  case type.downcase.to_sym
43
43
  when :b then 'browser'
@@ -1,5 +1,3 @@
1
1
  module VoightKampff
2
-
3
- VERSION = '0.1.4'
4
-
2
+ VERSION = '0.2.0'
5
3
  end
data/lib/voight_kampff.rb CHANGED
@@ -14,7 +14,7 @@ module VoightKampff
14
14
  def human?(user_agent_string)
15
15
  test(user_agent_string).human?
16
16
  end
17
-
17
+
18
18
  def bot?(user_agent_string)
19
19
  test(user_agent_string).bot?
20
20
  end
@@ -27,11 +27,11 @@ module VoightKampff
27
27
  def checker?(user_agent_string)
28
28
  test(user_agent_string).checker?
29
29
  end
30
-
30
+
31
31
  def downloader?(user_agent_string)
32
32
  test(user_agent_string).downloader?
33
33
  end
34
-
34
+
35
35
  def proxy?(user_agent_string)
36
36
  test(user_agent_string).proxy?
37
37
  end
@@ -45,7 +45,7 @@ module VoightKampff
45
45
  end
46
46
 
47
47
  private
48
-
48
+
49
49
  def test(user_agent_string)
50
50
  VoightKampff::Test.new(user_agent_string)
51
51
  end
@@ -0,0 +1,2 @@
1
+ require 'minitest/autorun'
2
+ require 'minitest/pride'
@@ -0,0 +1,10 @@
1
+ require 'minitest_helper'
2
+ require 'voight_kampff/base.rb'
3
+
4
+ class Test
5
+ include VoightKampff
6
+ end
7
+
8
+ describe VoightKampff do
9
+
10
+ end
@@ -0,0 +1,15 @@
1
+ # See http://help.github.com/ignore-files/ for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile ~/.gitignore_global
6
+
7
+ # Ignore bundler config
8
+ /.bundle
9
+
10
+ # Ignore the default SQLite database.
11
+ /db/*.sqlite3
12
+
13
+ # Ignore all logfiles and tempfiles.
14
+ /log/*.log
15
+ /tmp
@@ -0,0 +1,39 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rails', '3.2.13'
4
+
5
+ # Bundle edge Rails instead:
6
+ # gem 'rails', :git => 'git://github.com/rails/rails.git'
7
+
8
+ gem 'sqlite3'
9
+
10
+ gem 'voight_kampff', :path => '../../'
11
+
12
+ # Gems used only for assets and not required
13
+ # in production environments by default.
14
+ group :assets do
15
+ gem 'sass-rails', '~> 3.2.3'
16
+ gem 'coffee-rails', '~> 3.2.1'
17
+
18
+ # See https://github.com/sstephenson/execjs#readme for more supported runtimes
19
+ # gem 'therubyracer', :platforms => :ruby
20
+
21
+ gem 'uglifier', '>= 1.0.3'
22
+ end
23
+
24
+ gem 'jquery-rails'
25
+
26
+ # To use ActiveModel has_secure_password
27
+ # gem 'bcrypt-ruby', '~> 3.0.0'
28
+
29
+ # To use Jbuilder templates for JSON
30
+ # gem 'jbuilder'
31
+
32
+ # Use unicorn as the app server
33
+ # gem 'unicorn'
34
+
35
+ # Deploy with Capistrano
36
+ # gem 'capistrano'
37
+
38
+ # To use debugger
39
+ # gem 'debugger'
@@ -0,0 +1,123 @@
1
+ PATH
2
+ remote: ../../
3
+ specs:
4
+ voight_kampff (0.1.4)
5
+ httpclient (~> 2.2)
6
+ nokogiri
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actionmailer (3.2.13)
12
+ actionpack (= 3.2.13)
13
+ mail (~> 2.5.3)
14
+ actionpack (3.2.13)
15
+ activemodel (= 3.2.13)
16
+ activesupport (= 3.2.13)
17
+ builder (~> 3.0.0)
18
+ erubis (~> 2.7.0)
19
+ journey (~> 1.0.4)
20
+ rack (~> 1.4.5)
21
+ rack-cache (~> 1.2)
22
+ rack-test (~> 0.6.1)
23
+ sprockets (~> 2.2.1)
24
+ activemodel (3.2.13)
25
+ activesupport (= 3.2.13)
26
+ builder (~> 3.0.0)
27
+ activerecord (3.2.13)
28
+ activemodel (= 3.2.13)
29
+ activesupport (= 3.2.13)
30
+ arel (~> 3.0.2)
31
+ tzinfo (~> 0.3.29)
32
+ activeresource (3.2.13)
33
+ activemodel (= 3.2.13)
34
+ activesupport (= 3.2.13)
35
+ activesupport (3.2.13)
36
+ i18n (= 0.6.1)
37
+ multi_json (~> 1.0)
38
+ arel (3.0.2)
39
+ builder (3.0.4)
40
+ coffee-rails (3.2.2)
41
+ coffee-script (>= 2.2.0)
42
+ railties (~> 3.2.0)
43
+ coffee-script (2.2.0)
44
+ coffee-script-source
45
+ execjs
46
+ coffee-script-source (1.6.3)
47
+ erubis (2.7.0)
48
+ execjs (1.4.0)
49
+ multi_json (~> 1.0)
50
+ hike (1.2.3)
51
+ httpclient (2.3.3)
52
+ i18n (0.6.1)
53
+ journey (1.0.4)
54
+ jquery-rails (3.0.4)
55
+ railties (>= 3.0, < 5.0)
56
+ thor (>= 0.14, < 2.0)
57
+ json (1.8.0)
58
+ mail (2.5.4)
59
+ mime-types (~> 1.16)
60
+ treetop (~> 1.4.8)
61
+ mime-types (1.23)
62
+ mini_portile (0.5.1)
63
+ multi_json (1.7.7)
64
+ nokogiri (1.6.0)
65
+ mini_portile (~> 0.5.0)
66
+ polyglot (0.3.3)
67
+ rack (1.4.5)
68
+ rack-cache (1.2)
69
+ rack (>= 0.4)
70
+ rack-ssl (1.3.3)
71
+ rack
72
+ rack-test (0.6.2)
73
+ rack (>= 1.0)
74
+ rails (3.2.13)
75
+ actionmailer (= 3.2.13)
76
+ actionpack (= 3.2.13)
77
+ activerecord (= 3.2.13)
78
+ activeresource (= 3.2.13)
79
+ activesupport (= 3.2.13)
80
+ bundler (~> 1.0)
81
+ railties (= 3.2.13)
82
+ railties (3.2.13)
83
+ actionpack (= 3.2.13)
84
+ activesupport (= 3.2.13)
85
+ rack-ssl (~> 1.3.2)
86
+ rake (>= 0.8.7)
87
+ rdoc (~> 3.4)
88
+ thor (>= 0.14.6, < 2.0)
89
+ rake (10.1.0)
90
+ rdoc (3.12.2)
91
+ json (~> 1.4)
92
+ sass (3.2.9)
93
+ sass-rails (3.2.6)
94
+ railties (~> 3.2.0)
95
+ sass (>= 3.1.10)
96
+ tilt (~> 1.3)
97
+ sprockets (2.2.2)
98
+ hike (~> 1.2)
99
+ multi_json (~> 1.0)
100
+ rack (~> 1.0)
101
+ tilt (~> 1.1, != 1.3.0)
102
+ sqlite3 (1.3.7)
103
+ thor (0.18.1)
104
+ tilt (1.4.1)
105
+ treetop (1.4.14)
106
+ polyglot
107
+ polyglot (>= 0.3.1)
108
+ tzinfo (0.3.37)
109
+ uglifier (2.1.2)
110
+ execjs (>= 0.3.0)
111
+ multi_json (~> 1.0, >= 1.0.2)
112
+
113
+ PLATFORMS
114
+ ruby
115
+
116
+ DEPENDENCIES
117
+ coffee-rails (~> 3.2.1)
118
+ jquery-rails
119
+ rails (= 3.2.13)
120
+ sass-rails (~> 3.2.3)
121
+ sqlite3
122
+ uglifier (>= 1.0.3)
123
+ voight_kampff!
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
3
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
+
5
+ require File.expand_path('../config/application', __FILE__)
6
+
7
+ TestApp::Application.load_tasks
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
File without changes
File without changes
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>TestApp</title>
5
+ <%= stylesheet_link_tag "application", :media => "all" %>
6
+ <%= javascript_include_tag "application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,62 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ if defined?(Bundler)
6
+ # If you precompile assets before deploying to production, use this line
7
+ Bundler.require(*Rails.groups(:assets => %w(development test)))
8
+ # If you want your assets lazily compiled in production, use this line
9
+ # Bundler.require(:default, :assets, Rails.env)
10
+ end
11
+
12
+ module TestApp
13
+ class Application < Rails::Application
14
+ # Settings in config/environments/* take precedence over those specified here.
15
+ # Application configuration should go into files in config/initializers
16
+ # -- all .rb files in that directory are automatically loaded.
17
+
18
+ # Custom directories with classes and modules you want to be autoloadable.
19
+ # config.autoload_paths += %W(#{config.root}/extras)
20
+
21
+ # Only load the plugins named here, in the order given (default is alphabetical).
22
+ # :all can be used as a placeholder for all plugins not explicitly named.
23
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
24
+
25
+ # Activate observers that should always be running.
26
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
27
+
28
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
29
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
30
+ # config.time_zone = 'Central Time (US & Canada)'
31
+
32
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
33
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
34
+ # config.i18n.default_locale = :de
35
+
36
+ # Configure the default encoding used in templates for Ruby 1.9.
37
+ config.encoding = "utf-8"
38
+
39
+ # Configure sensitive parameters which will be filtered from the log file.
40
+ config.filter_parameters += [:password]
41
+
42
+ # Enable escaping HTML in JSON.
43
+ config.active_support.escape_html_entities_in_json = true
44
+
45
+ # Use SQL instead of Active Record's schema dumper when creating the database.
46
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
47
+ # like if you have constraints or database-specific column types
48
+ # config.active_record.schema_format = :sql
49
+
50
+ # Enforce whitelist mode for mass assignment.
51
+ # This will create an empty whitelist of attributes available for mass-assignment for all models
52
+ # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
53
+ # parameters by using an attr_accessible or attr_protected declaration.
54
+ config.active_record.whitelist_attributes = true
55
+
56
+ # Enable the asset pipeline
57
+ config.assets.enabled = true
58
+
59
+ # Version of your assets, change this if you want to expire all your assets
60
+ config.assets.version = '1.0'
61
+ end
62
+ end
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5
+
6
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -0,0 +1,25 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ development:
7
+ adapter: sqlite3
8
+ database: db/development.sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ # Warning: The database defined as "test" will be erased and
13
+ # re-generated from your development database when you run "rake".
14
+ # Do not set this db to the same as development or production.
15
+ test:
16
+ adapter: sqlite3
17
+ database: db/test.sqlite3
18
+ pool: 5
19
+ timeout: 5000
20
+
21
+ production:
22
+ adapter: sqlite3
23
+ database: db/production.sqlite3
24
+ pool: 5
25
+ timeout: 5000
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ TestApp::Application.initialize!