vattributes 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.rspec +1 -0
  4. data/.travis.yml +23 -0
  5. data/Gemfile +14 -0
  6. data/Gemfile.lock +121 -0
  7. data/MIT-LICENSE +20 -0
  8. data/README.md +70 -0
  9. data/Rakefile +21 -0
  10. data/lib/tasks/vattributes_tasks.rake +4 -0
  11. data/lib/vattributes.rb +6 -0
  12. data/lib/vattributes/extension.rb +44 -0
  13. data/lib/vattributes/version.rb +3 -0
  14. data/spec/dummy/README.rdoc +28 -0
  15. data/spec/dummy/Rakefile +6 -0
  16. data/spec/dummy/app/assets/images/.keep +0 -0
  17. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  18. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  19. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  20. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  21. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  22. data/spec/dummy/app/mailers/.keep +0 -0
  23. data/spec/dummy/app/models/.keep +0 -0
  24. data/spec/dummy/app/models/concerns/.keep +0 -0
  25. data/spec/dummy/app/models/user.rb +3 -0
  26. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  27. data/spec/dummy/bin/bundle +3 -0
  28. data/spec/dummy/bin/rails +4 -0
  29. data/spec/dummy/bin/rake +4 -0
  30. data/spec/dummy/config.ru +4 -0
  31. data/spec/dummy/config/application.rb +28 -0
  32. data/spec/dummy/config/boot.rb +5 -0
  33. data/spec/dummy/config/database.yml +25 -0
  34. data/spec/dummy/config/environment.rb +5 -0
  35. data/spec/dummy/config/environments/development.rb +29 -0
  36. data/spec/dummy/config/environments/production.rb +80 -0
  37. data/spec/dummy/config/environments/test.rb +36 -0
  38. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  39. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  40. data/spec/dummy/config/initializers/inflections.rb +16 -0
  41. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  42. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  43. data/spec/dummy/config/initializers/session_store.rb +3 -0
  44. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  45. data/spec/dummy/config/locales/en.yml +23 -0
  46. data/spec/dummy/config/routes.rb +56 -0
  47. data/spec/dummy/db/migrate/20140307225710_create_users.rb +10 -0
  48. data/spec/dummy/db/schema.rb +23 -0
  49. data/spec/dummy/lib/assets/.keep +0 -0
  50. data/spec/dummy/log/.keep +0 -0
  51. data/spec/dummy/public/404.html +58 -0
  52. data/spec/dummy/public/422.html +58 -0
  53. data/spec/dummy/public/500.html +57 -0
  54. data/spec/dummy/public/favicon.ico +0 -0
  55. data/spec/dummy/spec/models/user_spec.rb +5 -0
  56. data/spec/spec_helper.rb +31 -0
  57. data/spec/vattributes/extension_spec.rb +45 -0
  58. data/vattributes.gemspec +27 -0
  59. metadata +221 -0
@@ -0,0 +1,23 @@
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 that you check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(version: 20140307225710) do
15
+
16
+ create_table "users", force: true do |t|
17
+ t.string "name"
18
+ t.text "vattributes"
19
+ t.datetime "created_at"
20
+ t.datetime "updated_at"
21
+ end
22
+
23
+ end
File without changes
File without changes
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/404.html -->
52
+ <div class="dialog">
53
+ <h1>The page you were looking for doesn't exist.</h1>
54
+ <p>You may have mistyped the address or the page may have moved.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/422.html -->
52
+ <div class="dialog">
53
+ <h1>The change you wanted was rejected.</h1>
54
+ <p>Maybe you tried to change something you didn't have access to.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
@@ -0,0 +1,57 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/500.html -->
52
+ <div class="dialog">
53
+ <h1>We're sorry, but something went wrong.</h1>
54
+ </div>
55
+ <p>If you are the application owner check the logs for more information.</p>
56
+ </body>
57
+ </html>
File without changes
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe User do
4
+
5
+ end
@@ -0,0 +1,31 @@
1
+ ENV["RAILS_ENV"] ||= 'test'
2
+
3
+ if ENV['TRAVIS']
4
+ require 'coveralls'
5
+ Coveralls.wear!('rails')
6
+ end
7
+
8
+ require 'simplecov'
9
+ SimpleCov.start 'rails'
10
+
11
+ require File.expand_path("../dummy/config/environment", __FILE__)
12
+ require 'rspec/rails'
13
+ require 'rspec/autorun'
14
+
15
+ # Requires supporting ruby files with custom matchers and macros, etc,
16
+ # in spec/support/ and its subdirectories.
17
+ Dir[Rails.root.join("../../spec/support/**/*.rb")].each { |f| require f }
18
+
19
+ # Checks for pending migrations before tests are run.
20
+ # If you are not using ActiveRecord, you can remove this line.
21
+ if defined?(ActiveRecord::Migration) && ActiveRecord::Migration.respond_to?(:check_pending!)
22
+ ActiveRecord::Migration.check_pending!
23
+ end
24
+
25
+ RSpec.configure do |config|
26
+ config.use_transactional_fixtures = true
27
+ config.infer_base_class_for_anonymous_controllers = false
28
+ config.treat_symbols_as_metadata_keys_with_true_values = true
29
+ config.filter_run focus: true
30
+ config.run_all_when_everything_filtered = true
31
+ end
@@ -0,0 +1,45 @@
1
+ require 'spec_helper'
2
+
3
+ describe Vattributes::Extension do
4
+ subject { User.new }
5
+
6
+ describe "getter" do
7
+ it "responds to the getter" do
8
+ expect(subject).to respond_to(:email)
9
+ expect(subject).to respond_to(:nickname)
10
+ end
11
+
12
+ it "calls the #vattribute_get with the correct param" do
13
+ expect(subject).to receive(:vattribute_get).with(:email)
14
+ subject.email
15
+ end
16
+ end
17
+
18
+ describe "setter" do
19
+ it "responds to the setter" do
20
+ expect(subject).to respond_to(:email=)
21
+ expect(subject).to respond_to(:nickname=)
22
+ end
23
+
24
+ it "calls the #vattribute_set with the correct param" do
25
+ expect(subject).to receive(:vattribute_set).with(:email, 'value')
26
+ subject.email = 'value'
27
+ end
28
+ end
29
+
30
+ describe "#virtual_attributes" do
31
+ it "returns a hash" do
32
+ expect(subject.virtual_attributes).to eq({})
33
+ end
34
+ end
35
+
36
+ describe "#vattribute_set" do
37
+ subject { User.create(name: 'name', email: 'email') }
38
+
39
+ it "sets the correct attributes and persist the data" do
40
+ subject.reload
41
+ expect(subject.name).to eq('name')
42
+ expect(subject.email).to eq('email')
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,27 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+
3
+ # Maintain your gem's version:
4
+ require "vattributes/version"
5
+
6
+ # Describe your gem and declare its dependencies:
7
+ Gem::Specification.new do |s|
8
+ s.name = "vattributes"
9
+ s.version = Vattributes::VERSION
10
+ s.authors = ["Marcelo Jacobus"]
11
+ s.email = ["marcelo.jacobus@gmail.com"]
12
+ s.description = %q{Create virtual attributes for active record. Uses serialization}
13
+ s.summary = %q{Create virtual attributes for active record}
14
+ s.homepage = "https://github.com/mjacobus/vattributes"
15
+ s.license = "MIT"
16
+
17
+ s.files = `git ls-files`.split($/)
18
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
19
+
20
+ s.add_dependency "rails", ">= 3.0", "<= 5.0"
21
+
22
+ s.add_development_dependency "sqlite3"
23
+ s.add_development_dependency "rspec-rails"
24
+ s.add_development_dependency "simplecov"
25
+ s.add_development_dependency "coveralls"
26
+ end
27
+
metadata ADDED
@@ -0,0 +1,221 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vattributes
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Marcelo Jacobus
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ - - <=
21
+ - !ruby/object:Gem::Version
22
+ version: '5.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '3.0'
30
+ - - <=
31
+ - !ruby/object:Gem::Version
32
+ version: '5.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: sqlite3
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rspec-rails
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - '>='
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: simplecov
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: coveralls
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ description: Create virtual attributes for active record. Uses serialization
90
+ email:
91
+ - marcelo.jacobus@gmail.com
92
+ executables: []
93
+ extensions: []
94
+ extra_rdoc_files: []
95
+ files:
96
+ - .gitignore
97
+ - .rspec
98
+ - .travis.yml
99
+ - Gemfile
100
+ - Gemfile.lock
101
+ - MIT-LICENSE
102
+ - README.md
103
+ - Rakefile
104
+ - lib/tasks/vattributes_tasks.rake
105
+ - lib/vattributes.rb
106
+ - lib/vattributes/extension.rb
107
+ - lib/vattributes/version.rb
108
+ - spec/dummy/README.rdoc
109
+ - spec/dummy/Rakefile
110
+ - spec/dummy/app/assets/images/.keep
111
+ - spec/dummy/app/assets/javascripts/application.js
112
+ - spec/dummy/app/assets/stylesheets/application.css
113
+ - spec/dummy/app/controllers/application_controller.rb
114
+ - spec/dummy/app/controllers/concerns/.keep
115
+ - spec/dummy/app/helpers/application_helper.rb
116
+ - spec/dummy/app/mailers/.keep
117
+ - spec/dummy/app/models/.keep
118
+ - spec/dummy/app/models/concerns/.keep
119
+ - spec/dummy/app/models/user.rb
120
+ - spec/dummy/app/views/layouts/application.html.erb
121
+ - spec/dummy/bin/bundle
122
+ - spec/dummy/bin/rails
123
+ - spec/dummy/bin/rake
124
+ - spec/dummy/config.ru
125
+ - spec/dummy/config/application.rb
126
+ - spec/dummy/config/boot.rb
127
+ - spec/dummy/config/database.yml
128
+ - spec/dummy/config/environment.rb
129
+ - spec/dummy/config/environments/development.rb
130
+ - spec/dummy/config/environments/production.rb
131
+ - spec/dummy/config/environments/test.rb
132
+ - spec/dummy/config/initializers/backtrace_silencers.rb
133
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
134
+ - spec/dummy/config/initializers/inflections.rb
135
+ - spec/dummy/config/initializers/mime_types.rb
136
+ - spec/dummy/config/initializers/secret_token.rb
137
+ - spec/dummy/config/initializers/session_store.rb
138
+ - spec/dummy/config/initializers/wrap_parameters.rb
139
+ - spec/dummy/config/locales/en.yml
140
+ - spec/dummy/config/routes.rb
141
+ - spec/dummy/db/migrate/20140307225710_create_users.rb
142
+ - spec/dummy/db/schema.rb
143
+ - spec/dummy/lib/assets/.keep
144
+ - spec/dummy/log/.keep
145
+ - spec/dummy/public/404.html
146
+ - spec/dummy/public/422.html
147
+ - spec/dummy/public/500.html
148
+ - spec/dummy/public/favicon.ico
149
+ - spec/dummy/spec/models/user_spec.rb
150
+ - spec/spec_helper.rb
151
+ - spec/vattributes/extension_spec.rb
152
+ - vattributes.gemspec
153
+ homepage: https://github.com/mjacobus/vattributes
154
+ licenses:
155
+ - MIT
156
+ metadata: {}
157
+ post_install_message:
158
+ rdoc_options: []
159
+ require_paths:
160
+ - lib
161
+ required_ruby_version: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ required_rubygems_version: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - '>='
169
+ - !ruby/object:Gem::Version
170
+ version: '0'
171
+ requirements: []
172
+ rubyforge_project:
173
+ rubygems_version: 2.0.3
174
+ signing_key:
175
+ specification_version: 4
176
+ summary: Create virtual attributes for active record
177
+ test_files:
178
+ - spec/dummy/README.rdoc
179
+ - spec/dummy/Rakefile
180
+ - spec/dummy/app/assets/images/.keep
181
+ - spec/dummy/app/assets/javascripts/application.js
182
+ - spec/dummy/app/assets/stylesheets/application.css
183
+ - spec/dummy/app/controllers/application_controller.rb
184
+ - spec/dummy/app/controllers/concerns/.keep
185
+ - spec/dummy/app/helpers/application_helper.rb
186
+ - spec/dummy/app/mailers/.keep
187
+ - spec/dummy/app/models/.keep
188
+ - spec/dummy/app/models/concerns/.keep
189
+ - spec/dummy/app/models/user.rb
190
+ - spec/dummy/app/views/layouts/application.html.erb
191
+ - spec/dummy/bin/bundle
192
+ - spec/dummy/bin/rails
193
+ - spec/dummy/bin/rake
194
+ - spec/dummy/config.ru
195
+ - spec/dummy/config/application.rb
196
+ - spec/dummy/config/boot.rb
197
+ - spec/dummy/config/database.yml
198
+ - spec/dummy/config/environment.rb
199
+ - spec/dummy/config/environments/development.rb
200
+ - spec/dummy/config/environments/production.rb
201
+ - spec/dummy/config/environments/test.rb
202
+ - spec/dummy/config/initializers/backtrace_silencers.rb
203
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
204
+ - spec/dummy/config/initializers/inflections.rb
205
+ - spec/dummy/config/initializers/mime_types.rb
206
+ - spec/dummy/config/initializers/secret_token.rb
207
+ - spec/dummy/config/initializers/session_store.rb
208
+ - spec/dummy/config/initializers/wrap_parameters.rb
209
+ - spec/dummy/config/locales/en.yml
210
+ - spec/dummy/config/routes.rb
211
+ - spec/dummy/db/migrate/20140307225710_create_users.rb
212
+ - spec/dummy/db/schema.rb
213
+ - spec/dummy/lib/assets/.keep
214
+ - spec/dummy/log/.keep
215
+ - spec/dummy/public/404.html
216
+ - spec/dummy/public/422.html
217
+ - spec/dummy/public/500.html
218
+ - spec/dummy/public/favicon.ico
219
+ - spec/dummy/spec/models/user_spec.rb
220
+ - spec/spec_helper.rb
221
+ - spec/vattributes/extension_spec.rb