balloon 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,41 @@
1
+ require 'active_model/validator'
2
+
3
+ module Balloon
4
+ module Validate
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+ extend HelperMethods
9
+ include HelperMethods
10
+ end
11
+
12
+ class DownloadValidator < ActiveModel::EachValidator
13
+ def validate_each(record, attr_name, value)
14
+ if e = record.send(:download_error)
15
+ message = (e.message == e.class.to_s) ? :download_error : e.message
16
+ record.errors.add(attr_name, message)
17
+ end
18
+ end
19
+ end
20
+
21
+ class ProcessValidator < ActiveModel::EachValidator
22
+ def validate_each(record, attr_name, value)
23
+ if e = record.send(:process_error)
24
+ message = (e.message == e.class.to_s) ? :process_error : e.message
25
+ record.errors.add(attr_name, message)
26
+ end
27
+ end
28
+ end
29
+
30
+ module HelperMethods
31
+ def validates_download_of(*attr_names)
32
+ validates_with DownloadValidator, _merge_attributes(attr_names)
33
+ end
34
+
35
+ def validates_process_of(*attr_names)
36
+ validates_with ProcessValidator, _merge_attributes(attr_names)
37
+ end
38
+ end
39
+ end
40
+ end
41
+
@@ -0,0 +1,3 @@
1
+ module Balloon
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,15 @@
1
+ module Balloon
2
+ module Generators
3
+ class ConfigGenerator < Rails::Generators::Base
4
+ desc "create the Balloon configuration at config/balloon.yml"
5
+
6
+ def self.source_root
7
+ @source_root ||= File.expand_path("../templates", __FILE__)
8
+ end
9
+
10
+ def create_config_file
11
+ template 'balloon.yml', File.join('config', 'balloon.yml')
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,11 @@
1
+ defaults: &defaults
2
+ store_storage: 'file'
3
+
4
+ development:
5
+ <<: *defaults
6
+
7
+ test:
8
+ <<: *defaults
9
+
10
+ production:
11
+ <<: *defaults
Binary file
data/spec/fixtures/egg ADDED
Binary file
@@ -0,0 +1 @@
1
+ this is stuff
Binary file
Binary file
@@ -0,0 +1 @@
1
+ test html
metadata ADDED
@@ -0,0 +1,237 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: balloon
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - yeeli
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-05-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
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: mini_magick
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: faraday
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: mime-types
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rails
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: mysql2
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: mongo_mapper
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: mongoid
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: bson_ext
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: activerecord
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ description: Ruby image upload libary
168
+ email:
169
+ - yeeli@outlook.com
170
+ executables: []
171
+ extensions: []
172
+ extra_rdoc_files: []
173
+ files:
174
+ - ".gitignore"
175
+ - ".rspec"
176
+ - Gemfile
177
+ - README.md
178
+ - README_EN.md
179
+ - Rakefile
180
+ - balloon.gemspec
181
+ - lib/balloon.rb
182
+ - lib/balloon/base.rb
183
+ - lib/balloon/cache.rb
184
+ - lib/balloon/configuration.rb
185
+ - lib/balloon/download.rb
186
+ - lib/balloon/error.rb
187
+ - lib/balloon/file_extension.rb
188
+ - lib/balloon/http/client.rb
189
+ - lib/balloon/http/response.rb
190
+ - lib/balloon/load.rb
191
+ - lib/balloon/locale/en.yml
192
+ - lib/balloon/processing.rb
193
+ - lib/balloon/storage/file.rb
194
+ - lib/balloon/storage/store.rb
195
+ - lib/balloon/storage/upyun.rb
196
+ - lib/balloon/up.rb
197
+ - lib/balloon/uploader.rb
198
+ - lib/balloon/validate.rb
199
+ - lib/balloon/version.rb
200
+ - lib/rails/generators/balloon/config/config_generator.rb
201
+ - lib/rails/generators/balloon/config/templates/balloon.yml
202
+ - spec/fixtures/UPCASE.JPG
203
+ - spec/fixtures/egg
204
+ - spec/fixtures/invalid.jpg
205
+ - spec/fixtures/kid.gif
206
+ - spec/fixtures/kids.gif
207
+ - spec/fixtures/word.txt
208
+ homepage: ''
209
+ licenses: []
210
+ metadata: {}
211
+ post_install_message:
212
+ rdoc_options: []
213
+ require_paths:
214
+ - lib
215
+ required_ruby_version: !ruby/object:Gem::Requirement
216
+ requirements:
217
+ - - ">="
218
+ - !ruby/object:Gem::Version
219
+ version: '0'
220
+ required_rubygems_version: !ruby/object:Gem::Requirement
221
+ requirements:
222
+ - - ">="
223
+ - !ruby/object:Gem::Version
224
+ version: '0'
225
+ requirements: []
226
+ rubyforge_project: balloon
227
+ rubygems_version: 2.6.11
228
+ signing_key:
229
+ specification_version: 4
230
+ summary: Ruby image upload libary
231
+ test_files:
232
+ - spec/fixtures/UPCASE.JPG
233
+ - spec/fixtures/egg
234
+ - spec/fixtures/invalid.jpg
235
+ - spec/fixtures/kid.gif
236
+ - spec/fixtures/kids.gif
237
+ - spec/fixtures/word.txt