fastaccess 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +137 -0
  3. data/Rakefile +38 -0
  4. data/lib/fastaccess.rb +13 -0
  5. data/lib/fastaccess/acts_with_fastaccess_on.rb +54 -0
  6. data/lib/fastaccess/fastaccess.rb +204 -0
  7. data/lib/fastaccess/mixins.rb +13 -0
  8. data/lib/fastaccess/version.rb +4 -0
  9. data/lib/generators/fastaccess/initialize_generator.rb +12 -0
  10. data/lib/generators/fastaccess/templates/initializer.rb +3 -0
  11. data/lib/tasks/fastaccess_tasks.rake +4 -0
  12. data/test/dummy/README.rdoc +261 -0
  13. data/test/dummy/Rakefile +7 -0
  14. data/test/dummy/app/assets/javascripts/application.js +15 -0
  15. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  16. data/test/dummy/app/controllers/application_controller.rb +3 -0
  17. data/test/dummy/app/helpers/application_helper.rb +2 -0
  18. data/test/dummy/app/models/simple_string.rb +42 -0
  19. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  20. data/test/dummy/config.ru +4 -0
  21. data/test/dummy/config/application.rb +59 -0
  22. data/test/dummy/config/boot.rb +10 -0
  23. data/test/dummy/config/database.yml +25 -0
  24. data/test/dummy/config/environment.rb +5 -0
  25. data/test/dummy/config/environments/development.rb +37 -0
  26. data/test/dummy/config/environments/production.rb +67 -0
  27. data/test/dummy/config/environments/test.rb +37 -0
  28. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  29. data/test/dummy/config/initializers/fastaccess.rb +3 -0
  30. data/test/dummy/config/initializers/inflections.rb +15 -0
  31. data/test/dummy/config/initializers/mime_types.rb +5 -0
  32. data/test/dummy/config/initializers/redis.rb +1 -0
  33. data/test/dummy/config/initializers/secret_token.rb +7 -0
  34. data/test/dummy/config/initializers/session_store.rb +8 -0
  35. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  36. data/test/dummy/config/locales/en.yml +5 -0
  37. data/test/dummy/config/routes.rb +58 -0
  38. data/test/dummy/db/development.sqlite3 +0 -0
  39. data/test/dummy/db/migrate/20130123183844_create_simple_strings.rb +8 -0
  40. data/test/dummy/db/migrate/20130124180635_add_some_string_to_simple_string.rb +5 -0
  41. data/test/dummy/db/schema.rb +22 -0
  42. data/test/dummy/db/test.sqlite3 +0 -0
  43. data/test/dummy/log/development.log +58 -0
  44. data/test/dummy/log/test.log +1575 -0
  45. data/test/dummy/public/404.html +26 -0
  46. data/test/dummy/public/422.html +26 -0
  47. data/test/dummy/public/500.html +25 -0
  48. data/test/dummy/public/favicon.ico +0 -0
  49. data/test/dummy/script/rails +6 -0
  50. data/test/dummy/test/fixtures/simple_strings.yml +11 -0
  51. data/test/dummy/test/unit/simple_string_test.rb +7 -0
  52. data/test/fastaccess_test.rb +76 -0
  53. data/test/test_helper.rb +15 -0
  54. metadata +174 -0
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby1.9
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,11 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/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,7 @@
1
+ require 'test_helper'
2
+
3
+ class SimpleStringTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -0,0 +1,76 @@
1
+ require 'test_helper'
2
+
3
+ class FastaccessTest < ActiveSupport::TestCase
4
+ test "truth" do
5
+ assert_kind_of Module, Fastaccess
6
+ end
7
+
8
+ def test_simple_redis_write_and_read
9
+ string = SimpleString.create
10
+ assert_equal string.simple_string, $redis.get("simple_string_#{string.class}-#{string.id}")
11
+ end
12
+
13
+ def test_redis_write_and_read_on_parallel_methods
14
+ string = SimpleString.create
15
+ assert_equal string.simple_string, $redis.get("simple_string_#{string.class}-#{string.id}")
16
+ assert_equal string.other_string, $redis.get("other_string_#{string.class}-#{string.id}")
17
+ assert_not_equal string.simple_string, string.other_string
18
+ end
19
+
20
+ def test_fastaccess_type_guessing_feature_on_array
21
+ string = SimpleString.create
22
+ assert_equal string.simple_array.class, Array
23
+ end
24
+
25
+
26
+ def test_fastaccess_type_guessing_feature_on_hash
27
+ string = SimpleString.create
28
+ assert_equal string.simple_hash.class, Hash
29
+ end
30
+
31
+ def test_fastaccess_type_guessing_feature_on_string
32
+ string = SimpleString.create
33
+ assert_equal string.simple_string.class, String
34
+ end
35
+
36
+ def test_autoupdate_on_fastaccess
37
+ string = SimpleString.create
38
+ test_string = "foobar"
39
+ default = string.modifiable_string
40
+ string.some_string = test_string
41
+ string.save
42
+ assert_not_equal default, string.modifiable_string
43
+ assert string.modifiable_string.include?(test_string)
44
+ end
45
+
46
+ def test_manual_update_on_fastaccess
47
+ string = SimpleString.create
48
+ test_string = "foobar"
49
+ default = string.changeable_string
50
+ assert_equal default, string.changeable_string(test_string)
51
+ Fastaccess::Fastaccess.update_content string, :on => :changeable_string, :arguments => [test_string]
52
+ assert_not_equal default, string.changeable_string(test_string)
53
+ end
54
+
55
+ def test_manual_update_on_fastaccess_with_mixin
56
+ string = SimpleString.create
57
+ test_string = "foobar"
58
+ default = string.changeable_string
59
+ assert_equal default, string.changeable_string(test_string)
60
+ string.update_on :changeable_string, test_string
61
+ assert_not_equal default, string.changeable_string(test_string)
62
+ end
63
+
64
+ def test_deactivation_of_auto_update_functionality
65
+ string = SimpleString.create
66
+ test_string = "foobar"
67
+ default = string.non_autoupdateable_string
68
+ string.some_string = test_string
69
+ string.save
70
+ assert_equal default, string.non_autoupdateable_string
71
+ assert( ! string.non_autoupdateable_string.include?(test_string) )
72
+ puts
73
+ puts Fastaccess::Fastaccess.registered_options.inspect
74
+ end
75
+
76
+ end
@@ -0,0 +1,15 @@
1
+ # Configure Rails Environment
2
+ ENV["RAILS_ENV"] = "test"
3
+
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+ require "rails/test_help"
6
+
7
+ Rails.backtrace_cleaner.remove_silencers!
8
+
9
+ # Load support files
10
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
11
+
12
+ # Load fixtures from the engine
13
+ if ActiveSupport::TestCase.method_defined?(:fixture_path=)
14
+ ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
15
+ end
metadata ADDED
@@ -0,0 +1,174 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastaccess
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Tim Reddehase
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-02-01 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: &70143427385460 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 3.2.11
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70143427385460
25
+ - !ruby/object:Gem::Dependency
26
+ name: redis
27
+ requirement: &70143427384760 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 3.0.2
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70143427384760
36
+ - !ruby/object:Gem::Dependency
37
+ name: sqlite3
38
+ requirement: &70143427383980 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70143427383980
47
+ description: rails model-helper to store generated content in redis, for fastaccess
48
+ email:
49
+ - robustus@rightsrestricted.com
50
+ executables: []
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - lib/fastaccess/acts_with_fastaccess_on.rb
55
+ - lib/fastaccess/fastaccess.rb
56
+ - lib/fastaccess/mixins.rb
57
+ - lib/fastaccess/version.rb
58
+ - lib/fastaccess.rb
59
+ - lib/generators/fastaccess/initialize_generator.rb
60
+ - lib/generators/fastaccess/templates/initializer.rb
61
+ - lib/tasks/fastaccess_tasks.rake
62
+ - MIT-LICENSE
63
+ - Rakefile
64
+ - README.md
65
+ - test/dummy/app/assets/javascripts/application.js
66
+ - test/dummy/app/assets/stylesheets/application.css
67
+ - test/dummy/app/controllers/application_controller.rb
68
+ - test/dummy/app/helpers/application_helper.rb
69
+ - test/dummy/app/models/simple_string.rb
70
+ - test/dummy/app/views/layouts/application.html.erb
71
+ - test/dummy/config/application.rb
72
+ - test/dummy/config/boot.rb
73
+ - test/dummy/config/database.yml
74
+ - test/dummy/config/environment.rb
75
+ - test/dummy/config/environments/development.rb
76
+ - test/dummy/config/environments/production.rb
77
+ - test/dummy/config/environments/test.rb
78
+ - test/dummy/config/initializers/backtrace_silencers.rb
79
+ - test/dummy/config/initializers/fastaccess.rb
80
+ - test/dummy/config/initializers/inflections.rb
81
+ - test/dummy/config/initializers/mime_types.rb
82
+ - test/dummy/config/initializers/redis.rb
83
+ - test/dummy/config/initializers/secret_token.rb
84
+ - test/dummy/config/initializers/session_store.rb
85
+ - test/dummy/config/initializers/wrap_parameters.rb
86
+ - test/dummy/config/locales/en.yml
87
+ - test/dummy/config/routes.rb
88
+ - test/dummy/config.ru
89
+ - test/dummy/db/development.sqlite3
90
+ - test/dummy/db/migrate/20130123183844_create_simple_strings.rb
91
+ - test/dummy/db/migrate/20130124180635_add_some_string_to_simple_string.rb
92
+ - test/dummy/db/schema.rb
93
+ - test/dummy/db/test.sqlite3
94
+ - test/dummy/log/development.log
95
+ - test/dummy/log/test.log
96
+ - test/dummy/public/404.html
97
+ - test/dummy/public/422.html
98
+ - test/dummy/public/500.html
99
+ - test/dummy/public/favicon.ico
100
+ - test/dummy/Rakefile
101
+ - test/dummy/README.rdoc
102
+ - test/dummy/script/rails
103
+ - test/dummy/test/fixtures/simple_strings.yml
104
+ - test/dummy/test/unit/simple_string_test.rb
105
+ - test/fastaccess_test.rb
106
+ - test/test_helper.rb
107
+ homepage: https://github.com/0robustus1/fastaccess
108
+ licenses: []
109
+ post_install_message:
110
+ rdoc_options: []
111
+ require_paths:
112
+ - lib
113
+ required_ruby_version: !ruby/object:Gem::Requirement
114
+ none: false
115
+ requirements:
116
+ - - ! '>='
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ required_rubygems_version: !ruby/object:Gem::Requirement
120
+ none: false
121
+ requirements:
122
+ - - ! '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ requirements: []
126
+ rubyforge_project:
127
+ rubygems_version: 1.8.17
128
+ signing_key:
129
+ specification_version: 3
130
+ summary: allows storing of generated content via redis
131
+ test_files:
132
+ - test/dummy/app/assets/javascripts/application.js
133
+ - test/dummy/app/assets/stylesheets/application.css
134
+ - test/dummy/app/controllers/application_controller.rb
135
+ - test/dummy/app/helpers/application_helper.rb
136
+ - test/dummy/app/models/simple_string.rb
137
+ - test/dummy/app/views/layouts/application.html.erb
138
+ - test/dummy/config/application.rb
139
+ - test/dummy/config/boot.rb
140
+ - test/dummy/config/database.yml
141
+ - test/dummy/config/environment.rb
142
+ - test/dummy/config/environments/development.rb
143
+ - test/dummy/config/environments/production.rb
144
+ - test/dummy/config/environments/test.rb
145
+ - test/dummy/config/initializers/backtrace_silencers.rb
146
+ - test/dummy/config/initializers/fastaccess.rb
147
+ - test/dummy/config/initializers/inflections.rb
148
+ - test/dummy/config/initializers/mime_types.rb
149
+ - test/dummy/config/initializers/redis.rb
150
+ - test/dummy/config/initializers/secret_token.rb
151
+ - test/dummy/config/initializers/session_store.rb
152
+ - test/dummy/config/initializers/wrap_parameters.rb
153
+ - test/dummy/config/locales/en.yml
154
+ - test/dummy/config/routes.rb
155
+ - test/dummy/config.ru
156
+ - test/dummy/db/development.sqlite3
157
+ - test/dummy/db/migrate/20130123183844_create_simple_strings.rb
158
+ - test/dummy/db/migrate/20130124180635_add_some_string_to_simple_string.rb
159
+ - test/dummy/db/schema.rb
160
+ - test/dummy/db/test.sqlite3
161
+ - test/dummy/log/development.log
162
+ - test/dummy/log/test.log
163
+ - test/dummy/public/404.html
164
+ - test/dummy/public/422.html
165
+ - test/dummy/public/500.html
166
+ - test/dummy/public/favicon.ico
167
+ - test/dummy/Rakefile
168
+ - test/dummy/README.rdoc
169
+ - test/dummy/script/rails
170
+ - test/dummy/test/fixtures/simple_strings.yml
171
+ - test/dummy/test/unit/simple_string_test.rb
172
+ - test/fastaccess_test.rb
173
+ - test/test_helper.rb
174
+ has_rdoc: