carrierwave-elastictastic 0.0.1

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.
@@ -0,0 +1,7 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
4
+ spec/public
5
+ .rvmrc
6
+ Gemfile.lock
7
+ log/*
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :rubygems
2
+
3
+ gemspec
@@ -0,0 +1,58 @@
1
+ # Elastictastic support for CarrierWave
2
+
3
+ [CarrierWave](https://github.com/jnicklas/carrierwave/)
4
+
5
+ [Elastictastic](https://github.com/brewster/elastictastic/)
6
+
7
+ ## Installation
8
+
9
+ ```ruby
10
+ gem 'carrierwave-elastictastic', require: 'carrierwave/orm/elastictastic'
11
+ ```
12
+
13
+ ## Getting Started
14
+
15
+ Follow the "Getting Started" directions in the main
16
+ [Carrierwave repository](https://raw.github.com/jnicklas/carrierwave/).
17
+
18
+ Add the field to the list for mass assignment protection:
19
+
20
+ ```ruby
21
+ class User
22
+ include Elastictastic::Document
23
+
24
+ attr_accessible :avatar
25
+ end
26
+ ```
27
+
28
+ Now you can cache files by assigning them to the attribute; they will
29
+ automatically be stored when the record is saved. Ex:
30
+
31
+ ```ruby
32
+ u = User.new
33
+ u.avatar = File.open 'somewhere'
34
+ u.save!
35
+ ```
36
+
37
+ ## License
38
+
39
+ Copyright (c) 2008-2012 Kostiantyn Kahanskyi
40
+
41
+ Permission is hereby granted, free of charge, to any person obtaining
42
+ a copy of this software and associated documentation files (the
43
+ "Software"), to deal in the Software without restriction, including
44
+ without limitation the rights to use, copy, modify, merge, publish,
45
+ distribute, sublicense, and/or sell copies of the Software, and to
46
+ permit persons to whom the Software is furnished to do so, subject to
47
+ the following conditions:
48
+
49
+ The above copyright notice and this permission notice shall be
50
+ included in all copies or substantial portions of the Software.
51
+
52
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
53
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
54
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
55
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
56
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
57
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
58
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,3 @@
1
+ require 'bundler/setup'
2
+
3
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,18 @@
1
+ $:.push File.expand_path('../lib', __FILE__)
2
+
3
+ require 'carrierwave/orm/elastictastic/version'
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.name = 'carrierwave-elastictastic'
7
+ gem.version = CarrierWave::Elastictastic::VERSION
8
+ gem.summary = 'Elastictastic support for CarrierWave'
9
+ gem.description = gem.summary
10
+ gem.homepage = 'https://github.com/kostia/carrierwave-elastictastic'
11
+ gem.authors = ['Kostiantyn Kahanskyi']
12
+ gem.email = %w[kostiantyn.kahanskyi@googlemail.com]
13
+ gem.require_paths = %w[lib]
14
+ gem.files = `git ls-files`.split "\n"
15
+ gem.add_dependency 'carrierwave'
16
+ gem.add_dependency 'elastictastic'
17
+ gem.add_development_dependency 'rake'
18
+ end
@@ -0,0 +1,29 @@
1
+ require 'carrierwave'
2
+ require 'carrierwave/validations/active_model'
3
+
4
+ module CarrierWave
5
+ module Elastictastic
6
+ include CarrierWave::Mount
7
+
8
+ def mount_uploader(column, uploader=nil, options={}, &block)
9
+ field options[:mount_on] || column
10
+
11
+ super
12
+
13
+ alias_method :read_uploader, :read_attribute
14
+ alias_method :write_uploader, :write_attribute
15
+
16
+ public :read_uploader
17
+ public :write_uploader
18
+
19
+ include CarrierWave::Validations::ActiveModel
20
+
21
+ validates_integrity_of column if uploader_option column.to_sym, :validate_integrity
22
+ validates_processing_of column if uploader_option column.to_sym, :validate_processing
23
+
24
+ after_save :"store_#{column}!"
25
+ before_save :"write_#{column}_identifier"
26
+ after_destroy :"remove_#{column}!"
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,5 @@
1
+ module CarrierWave
2
+ module Elastictastic
3
+ VERSION = '0.0.1'
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: carrierwave-elastictastic
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Kostiantyn Kahanskyi
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-21 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: carrierwave
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: elastictastic
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rake
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
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
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ description: Elastictastic support for CarrierWave
63
+ email:
64
+ - kostiantyn.kahanskyi@googlemail.com
65
+ executables: []
66
+ extensions: []
67
+ extra_rdoc_files: []
68
+ files:
69
+ - .gitignore
70
+ - Gemfile
71
+ - README.md
72
+ - Rakefile
73
+ - carrierwave-elastictastic.gemspec
74
+ - lib/carrierwave/orm/elastictastic.rb
75
+ - lib/carrierwave/orm/elastictastic/version.rb
76
+ homepage: https://github.com/kostia/carrierwave-elastictastic
77
+ licenses: []
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ segments:
89
+ - 0
90
+ hash: -3291892197898105070
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
+ none: false
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ segments:
98
+ - 0
99
+ hash: -3291892197898105070
100
+ requirements: []
101
+ rubyforge_project:
102
+ rubygems_version: 1.8.23
103
+ signing_key:
104
+ specification_version: 3
105
+ summary: Elastictastic support for CarrierWave
106
+ test_files: []