active_record_content_blob 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NzUwMzA2MjM5MDY2YTRkMWEzNzk1NjJlNjQ4YjhlN2YxYzhjNmFmNQ==
5
+ data.tar.gz: !binary |-
6
+ NTdlYmZmYTU1YjAxNjgzOTk1OGM5ZGQ2NDE0Y2VmYTliYjZmN2VlOQ==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ ZTNhMWNlODNmOWQyYjQ0MTdiYjdmNjFkNDNlNmE0ZDg3OGY0NTVhNGYzYzQ1
10
+ MzFlMWZhNTFmYmMwY2I4YWI0NjBiY2JiZTIwNWIwYTFlN2I4ZTUzMDU3ZWYx
11
+ NjljYzYxOWMxMjUzODY3OTUwZTE5MWQ2Y2ZmZTU1OTc4MTFiMjU=
12
+ data.tar.gz: !binary |-
13
+ MjQ5YTA1MjdhMzI4NzcxZDVjN2NjNmEwZWM1NDEwY2NlNmU5NDVhOWU4ZmY1
14
+ M2FkODEyYWZlMmE1Mjc3MGNhOWRhN2ZhYWQ2ZTliNzA3YzNmNDJlODgzNDQ5
15
+ N2FkOTBjY2E4NzBjNjIwODlkODVkZjlhYmU0OWI0OWY0ZmEyMWE=
data/Gemfile CHANGED
@@ -2,19 +2,12 @@ source "http://rubygems.org"
2
2
 
3
3
  group :development do
4
4
  gem 'rspec', '~> 2.14.0'
5
-
6
5
  gem "bundler"
7
- gem "jeweler", "~> 1.8.4"
8
- gem 'database_cleaner'
6
+ gem "jeweler", "~> 1.8.8"
7
+ gem 'database_cleaner', "=1.0.1"
9
8
  gem "pry"
10
- gem "rdoc", "~> 3.12"
11
- # gem "generator_spec" # wished this helped...
12
-
13
-
14
9
  end
15
10
 
16
- gem 'rails', '3.2.14'
17
-
18
11
  gem 'sqlite3'
19
- #gem 'activesupport', ">=3.2.14"
20
- #gem 'activerecord', ">=3.2.14"
12
+ gem 'activesupport', "~> 3.2.14"
13
+ gem 'activerecord', "~> 3.2.14"
data/Gemfile.lock CHANGED
@@ -1,19 +1,6 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- actionmailer (3.2.14)
5
- actionpack (= 3.2.14)
6
- mail (~> 2.5.4)
7
- actionpack (3.2.14)
8
- activemodel (= 3.2.14)
9
- activesupport (= 3.2.14)
10
- builder (~> 3.0.0)
11
- erubis (~> 2.7.0)
12
- journey (~> 1.0.4)
13
- rack (~> 1.4.5)
14
- rack-cache (~> 1.2)
15
- rack-test (~> 0.6.1)
16
- sprockets (~> 2.2.1)
17
4
  activemodel (3.2.14)
18
5
  activesupport (= 3.2.14)
19
6
  builder (~> 3.0.0)
@@ -22,9 +9,6 @@ GEM
22
9
  activesupport (= 3.2.14)
23
10
  arel (~> 3.0.2)
24
11
  tzinfo (~> 0.3.29)
25
- activeresource (3.2.14)
26
- activemodel (= 3.2.14)
27
- activesupport (= 3.2.14)
28
12
  activesupport (3.2.14)
29
13
  i18n (~> 0.6, >= 0.6.4)
30
14
  multi_json (~> 1.0)
@@ -32,12 +16,11 @@ GEM
32
16
  arel (3.0.2)
33
17
  builder (3.0.4)
34
18
  coderay (1.0.9)
35
- database_cleaner (1.1.1)
19
+ database_cleaner (1.0.1)
36
20
  diff-lcs (1.2.4)
37
- erubis (2.7.0)
38
21
  faraday (0.8.8)
39
22
  multipart-post (~> 1.2.0)
40
- git (1.2.5)
23
+ git (1.2.6)
41
24
  github_api (0.10.1)
42
25
  addressable
43
26
  faraday (~> 0.8.1)
@@ -47,10 +30,9 @@ GEM
47
30
  oauth2
48
31
  hashie (2.0.5)
49
32
  highline (1.6.19)
50
- hike (1.2.3)
51
33
  httpauth (0.2.0)
52
- i18n (0.6.4)
53
- jeweler (1.8.7)
34
+ i18n (0.6.5)
35
+ jeweler (1.8.8)
54
36
  builder
55
37
  bundler (~> 1.0)
56
38
  git (>= 1.2.5)
@@ -59,16 +41,11 @@ GEM
59
41
  nokogiri (= 1.5.10)
60
42
  rake
61
43
  rdoc
62
- journey (1.0.4)
63
44
  json (1.8.0)
64
45
  jwt (0.1.8)
65
46
  multi_json (>= 1.5)
66
- mail (2.5.4)
67
- mime-types (~> 1.16)
68
- treetop (~> 1.4.8)
69
47
  method_source (0.8.2)
70
- mime-types (1.23)
71
- multi_json (1.7.9)
48
+ multi_json (1.8.1)
72
49
  multi_xml (0.5.5)
73
50
  multipart-post (1.2.0)
74
51
  nokogiri (1.5.10)
@@ -79,67 +56,35 @@ GEM
79
56
  multi_json (~> 1.0)
80
57
  multi_xml (~> 0.5)
81
58
  rack (~> 1.2)
82
- polyglot (0.3.3)
83
59
  pry (0.9.12.2)
84
60
  coderay (~> 1.0.5)
85
61
  method_source (~> 0.8)
86
62
  slop (~> 3.4)
87
- rack (1.4.5)
88
- rack-cache (1.2)
89
- rack (>= 0.4)
90
- rack-ssl (1.3.3)
91
- rack
92
- rack-test (0.6.2)
93
- rack (>= 1.0)
94
- rails (3.2.14)
95
- actionmailer (= 3.2.14)
96
- actionpack (= 3.2.14)
97
- activerecord (= 3.2.14)
98
- activeresource (= 3.2.14)
99
- activesupport (= 3.2.14)
100
- bundler (~> 1.0)
101
- railties (= 3.2.14)
102
- railties (3.2.14)
103
- actionpack (= 3.2.14)
104
- activesupport (= 3.2.14)
105
- rack-ssl (~> 1.3.2)
106
- rake (>= 0.8.7)
107
- rdoc (~> 3.4)
108
- thor (>= 0.14.6, < 2.0)
63
+ rack (1.5.2)
109
64
  rake (10.1.0)
110
- rdoc (3.12.2)
65
+ rdoc (4.0.1)
111
66
  json (~> 1.4)
112
67
  rspec (2.14.1)
113
68
  rspec-core (~> 2.14.0)
114
69
  rspec-expectations (~> 2.14.0)
115
70
  rspec-mocks (~> 2.14.0)
116
- rspec-core (2.14.4)
117
- rspec-expectations (2.14.1)
71
+ rspec-core (2.14.5)
72
+ rspec-expectations (2.14.3)
118
73
  diff-lcs (>= 1.1.3, < 2.0)
119
74
  rspec-mocks (2.14.3)
120
75
  slop (3.4.6)
121
- sprockets (2.2.2)
122
- hike (~> 1.2)
123
- multi_json (~> 1.0)
124
- rack (~> 1.0)
125
- tilt (~> 1.1, != 1.3.0)
126
- sqlite3 (1.3.7)
127
- thor (0.18.1)
128
- tilt (1.4.1)
129
- treetop (1.4.14)
130
- polyglot
131
- polyglot (>= 0.3.1)
76
+ sqlite3 (1.3.8)
132
77
  tzinfo (0.3.37)
133
78
 
134
79
  PLATFORMS
135
80
  ruby
136
81
 
137
82
  DEPENDENCIES
83
+ activerecord (~> 3.2.14)
84
+ activesupport (~> 3.2.14)
138
85
  bundler
139
- database_cleaner
140
- jeweler (~> 1.8.4)
86
+ database_cleaner (= 1.0.1)
87
+ jeweler (~> 1.8.8)
141
88
  pry
142
- rails (= 3.2.14)
143
- rdoc (~> 3.12)
144
89
  rspec (~> 2.14.0)
145
90
  sqlite3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "active_record_content_blob"
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Dan Nguyen"]
12
- s.date = "2013-08-14"
12
+ s.date = "2013-10-13"
13
13
  s.description = "Loading up TEXT/BLOB columns can be slow"
14
14
  s.email = "dansonguyen@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -41,40 +41,40 @@ Gem::Specification.new do |s|
41
41
  s.homepage = "http://github.com/dannguyen/active_record_content_blob"
42
42
  s.licenses = ["MIT"]
43
43
  s.require_paths = ["lib"]
44
- s.rubygems_version = "1.8.23"
44
+ s.rubygems_version = "2.0.5"
45
45
  s.summary = "Attach a TEXT/BLOB column to your model as a has_one"
46
46
 
47
47
  if s.respond_to? :specification_version then
48
- s.specification_version = 3
48
+ s.specification_version = 4
49
49
 
50
50
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
51
- s.add_runtime_dependency(%q<rails>, ["= 3.2.14"])
52
51
  s.add_runtime_dependency(%q<sqlite3>, [">= 0"])
52
+ s.add_runtime_dependency(%q<activesupport>, ["~> 3.2.14"])
53
+ s.add_runtime_dependency(%q<activerecord>, ["~> 3.2.14"])
53
54
  s.add_development_dependency(%q<rspec>, ["~> 2.14.0"])
54
55
  s.add_development_dependency(%q<bundler>, [">= 0"])
55
- s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
56
- s.add_development_dependency(%q<database_cleaner>, [">= 0"])
56
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.8"])
57
+ s.add_development_dependency(%q<database_cleaner>, ["= 1.0.1"])
57
58
  s.add_development_dependency(%q<pry>, [">= 0"])
58
- s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
59
59
  else
60
- s.add_dependency(%q<rails>, ["= 3.2.14"])
61
60
  s.add_dependency(%q<sqlite3>, [">= 0"])
61
+ s.add_dependency(%q<activesupport>, ["~> 3.2.14"])
62
+ s.add_dependency(%q<activerecord>, ["~> 3.2.14"])
62
63
  s.add_dependency(%q<rspec>, ["~> 2.14.0"])
63
64
  s.add_dependency(%q<bundler>, [">= 0"])
64
- s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
65
- s.add_dependency(%q<database_cleaner>, [">= 0"])
65
+ s.add_dependency(%q<jeweler>, ["~> 1.8.8"])
66
+ s.add_dependency(%q<database_cleaner>, ["= 1.0.1"])
66
67
  s.add_dependency(%q<pry>, [">= 0"])
67
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
68
68
  end
69
69
  else
70
- s.add_dependency(%q<rails>, ["= 3.2.14"])
71
70
  s.add_dependency(%q<sqlite3>, [">= 0"])
71
+ s.add_dependency(%q<activesupport>, ["~> 3.2.14"])
72
+ s.add_dependency(%q<activerecord>, ["~> 3.2.14"])
72
73
  s.add_dependency(%q<rspec>, ["~> 2.14.0"])
73
74
  s.add_dependency(%q<bundler>, [">= 0"])
74
- s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
75
- s.add_dependency(%q<database_cleaner>, [">= 0"])
75
+ s.add_dependency(%q<jeweler>, ["~> 1.8.8"])
76
+ s.add_dependency(%q<database_cleaner>, ["= 1.0.1"])
76
77
  s.add_dependency(%q<pry>, [">= 0"])
77
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
78
78
  end
79
79
  end
80
80
 
@@ -6,6 +6,7 @@ module ActiveRecordContentBlob
6
6
  extend ActiveSupport::Concern
7
7
  included do
8
8
 
9
+ # Not sure if this is a needed scope
9
10
  scope :has_blob, ->{joins(:content_blob)}
10
11
 
11
12
  if self.instance_methods.include?(:contents) || self.column_names.include?('contents')
@@ -54,6 +55,11 @@ module ActiveRecordContentBlob
54
55
  end
55
56
 
56
57
 
58
+ def has_blob?
59
+ content_blob.exists?
60
+ end
61
+
62
+
57
63
 
58
64
  end
59
65
  end
@@ -1,21 +1,19 @@
1
1
  require 'rails/generators'
2
2
  require 'rails/generators/active_record'
3
3
 
4
- module ActiveRecordContentBlob
5
4
 
6
- class MigrationGenerator < ActiveRecord::Generators::Base
7
- argument :name, type: :string, default: 'create_content_blobs'
5
+ class ContentBlobGenerator < ActiveRecord::Generators::Base
6
+ argument :name, type: :string, default: 'create_content_blobs'
8
7
 
9
8
 
10
- source_root File.expand_path('../templates', __FILE__)
9
+ source_root File.expand_path('../templates', __FILE__)
11
10
 
12
- def self.next_migration_number(path)
13
- ActiveRecord::Generators::Base.next_migration_number(path)
14
- end
15
- # Copies the migration template to db/migrate.
16
- def copy_files
17
- migration_template 'create_content_blobs.rb', 'db/migrate/create_content_blobs_migration.rb'
18
- end
11
+ def self.next_migration_number(path)
12
+ ActiveRecord::Generators::Base.next_migration_number(path)
13
+ end
14
+ # Copies the migration template to db/migrate.
15
+ def copy_files
16
+ migration_template 'create_content_blobs.rb', 'db/migrate/create_content_blobs.rb'
19
17
  end
20
18
  end
21
19
 
@@ -5,7 +5,7 @@ require File.expand_path '../../../../lib/generators/content_blob_generator', __
5
5
 
6
6
  class MigrationGeneratorTest < Rails::Generators::TestCase
7
7
 
8
- tests ActiveRecordContentBlob::MigrationGenerator
8
+ tests ContentBlobGenerator
9
9
  destination File.expand_path("../../tmp", __FILE__)
10
10
 
11
11
  setup :prepare_destination
data/spec/spec_helper.rb CHANGED
@@ -11,9 +11,16 @@ require 'active_record_content_blob'
11
11
  # in ./support/ and its subdirectories.
12
12
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
13
13
 
14
- #DatabaseCleaner.strategy = :truncation
14
+ DatabaseCleaner.strategy = :truncation
15
15
 
16
16
  RSpec.configure do |config|
17
+
18
+ config.filter_run_excluding skip: true
19
+ config.run_all_when_everything_filtered = true
20
+ config.filter_run :focus => true
21
+
22
+ config.mock_with :rspec
23
+
17
24
  # Use color in STDOUT
18
25
  config.color_enabled = true
19
26
 
@@ -26,11 +33,13 @@ RSpec.configure do |config|
26
33
  config.before(:each) do
27
34
  DatabaseCleaner.start
28
35
  end
36
+
29
37
  config.after(:each) do
30
38
  DatabaseCleaner.clean
31
39
  end
32
40
  end
33
41
 
42
+
34
43
  ActiveRecord::Base.establish_connection(
35
44
  :adapter => "sqlite3",
36
45
  :database => ":memory:"
metadata CHANGED
@@ -1,52 +1,60 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_content_blob
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
5
- prerelease:
4
+ version: 0.1.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Dan Nguyen
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-08-14 00:00:00.000000000 Z
11
+ date: 2013-10-13 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- name: rails
14
+ name: sqlite3
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - '='
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
20
32
  - !ruby/object:Gem::Version
21
33
  version: 3.2.14
22
34
  type: :runtime
23
35
  prerelease: false
24
36
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
37
  requirements:
27
- - - '='
38
+ - - ~>
28
39
  - !ruby/object:Gem::Version
29
40
  version: 3.2.14
30
41
  - !ruby/object:Gem::Dependency
31
- name: sqlite3
42
+ name: activerecord
32
43
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
44
  requirements:
35
- - - ! '>='
45
+ - - ~>
36
46
  - !ruby/object:Gem::Version
37
- version: '0'
47
+ version: 3.2.14
38
48
  type: :runtime
39
49
  prerelease: false
40
50
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
51
  requirements:
43
- - - ! '>='
52
+ - - ~>
44
53
  - !ruby/object:Gem::Version
45
- version: '0'
54
+ version: 3.2.14
46
55
  - !ruby/object:Gem::Dependency
47
56
  name: rspec
48
57
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
58
  requirements:
51
59
  - - ~>
52
60
  - !ruby/object:Gem::Version
@@ -54,7 +62,6 @@ dependencies:
54
62
  type: :development
55
63
  prerelease: false
56
64
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
65
  requirements:
59
66
  - - ~>
60
67
  - !ruby/object:Gem::Version
@@ -62,7 +69,6 @@ dependencies:
62
69
  - !ruby/object:Gem::Dependency
63
70
  name: bundler
64
71
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
72
  requirements:
67
73
  - - ! '>='
68
74
  - !ruby/object:Gem::Version
@@ -70,7 +76,6 @@ dependencies:
70
76
  type: :development
71
77
  prerelease: false
72
78
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
79
  requirements:
75
80
  - - ! '>='
76
81
  - !ruby/object:Gem::Version
@@ -78,39 +83,34 @@ dependencies:
78
83
  - !ruby/object:Gem::Dependency
79
84
  name: jeweler
80
85
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
86
  requirements:
83
87
  - - ~>
84
88
  - !ruby/object:Gem::Version
85
- version: 1.8.4
89
+ version: 1.8.8
86
90
  type: :development
87
91
  prerelease: false
88
92
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
93
  requirements:
91
94
  - - ~>
92
95
  - !ruby/object:Gem::Version
93
- version: 1.8.4
96
+ version: 1.8.8
94
97
  - !ruby/object:Gem::Dependency
95
98
  name: database_cleaner
96
99
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
100
  requirements:
99
- - - ! '>='
101
+ - - '='
100
102
  - !ruby/object:Gem::Version
101
- version: '0'
103
+ version: 1.0.1
102
104
  type: :development
103
105
  prerelease: false
104
106
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
107
  requirements:
107
- - - ! '>='
108
+ - - '='
108
109
  - !ruby/object:Gem::Version
109
- version: '0'
110
+ version: 1.0.1
110
111
  - !ruby/object:Gem::Dependency
111
112
  name: pry
112
113
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
114
  requirements:
115
115
  - - ! '>='
116
116
  - !ruby/object:Gem::Version
@@ -118,27 +118,10 @@ dependencies:
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
121
  requirements:
123
122
  - - ! '>='
124
123
  - !ruby/object:Gem::Version
125
124
  version: '0'
126
- - !ruby/object:Gem::Dependency
127
- name: rdoc
128
- requirement: !ruby/object:Gem::Requirement
129
- none: false
130
- requirements:
131
- - - ~>
132
- - !ruby/object:Gem::Version
133
- version: '3.12'
134
- type: :development
135
- prerelease: false
136
- version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
- requirements:
139
- - - ~>
140
- - !ruby/object:Gem::Version
141
- version: '3.12'
142
125
  description: Loading up TEXT/BLOB columns can be slow
143
126
  email: dansonguyen@gmail.com
144
127
  executables: []
@@ -170,29 +153,25 @@ files:
170
153
  homepage: http://github.com/dannguyen/active_record_content_blob
171
154
  licenses:
172
155
  - MIT
156
+ metadata: {}
173
157
  post_install_message:
174
158
  rdoc_options: []
175
159
  require_paths:
176
160
  - lib
177
161
  required_ruby_version: !ruby/object:Gem::Requirement
178
- none: false
179
162
  requirements:
180
163
  - - ! '>='
181
164
  - !ruby/object:Gem::Version
182
165
  version: '0'
183
- segments:
184
- - 0
185
- hash: 246038623770777040
186
166
  required_rubygems_version: !ruby/object:Gem::Requirement
187
- none: false
188
167
  requirements:
189
168
  - - ! '>='
190
169
  - !ruby/object:Gem::Version
191
170
  version: '0'
192
171
  requirements: []
193
172
  rubyforge_project:
194
- rubygems_version: 1.8.23
173
+ rubygems_version: 2.0.5
195
174
  signing_key:
196
- specification_version: 3
175
+ specification_version: 4
197
176
  summary: Attach a TEXT/BLOB column to your model as a has_one
198
177
  test_files: []