rails-uploader 0.5.7 → 0.5.9
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.
- checksums.yaml +4 -4
- data/README.md +7 -7
- data/lib/generators/uploader/install/templates/20130905144515_create_assets.rb +1 -1
- data/lib/uploader/fileupload_glue.rb +22 -0
- data/lib/uploader/fileuploads.rb +2 -1
- data/lib/uploader/helpers/field_tag.rb +4 -8
- data/lib/uploader/version.rb +1 -1
- data/spec/dummy/Rakefile +2 -3
- data/spec/dummy/app/assets/config/manifest.js +1 -1
- data/spec/dummy/app/assets/stylesheets/application.css +7 -5
- data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
- data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
- data/spec/dummy/app/controllers/application_controller.rb +2 -1
- data/spec/dummy/app/jobs/application_job.rb +7 -0
- data/spec/dummy/app/mailers/application_mailer.rb +4 -0
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/models/article.rb +1 -1
- data/spec/dummy/app/models/asset.rb +1 -1
- data/spec/dummy/app/views/layouts/application.html.erb +18 -9
- data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/spec/dummy/app/views/pwa/manifest.json.erb +22 -0
- data/spec/dummy/app/views/pwa/service-worker.js +26 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +37 -0
- data/spec/dummy/config/application.rb +39 -47
- data/spec/dummy/config/boot.rb +4 -9
- data/spec/dummy/config/cable.yml +10 -0
- data/spec/dummy/config/database.yml +20 -13
- data/spec/dummy/config/environment.rb +4 -4
- data/spec/dummy/config/environments/development.rb +64 -22
- data/spec/dummy/config/environments/production.rb +74 -41
- data/spec/dummy/config/environments/test.rb +51 -20
- data/spec/dummy/config/initializers/assets.rb +12 -0
- data/spec/dummy/config/initializers/content_security_policy.rb +25 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +8 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -9
- data/spec/dummy/config/initializers/permissions_policy.rb +13 -0
- data/spec/dummy/config/locales/en.yml +28 -2
- data/spec/dummy/config/puma.rb +34 -0
- data/spec/dummy/config/storage.yml +34 -0
- data/spec/dummy/config.ru +4 -2
- data/spec/dummy/db/migrate/20120508093830_create_articles.rb +1 -1
- data/spec/dummy/db/migrate/20130905144515_create_assets.rb +34 -0
- data/spec/dummy/log/test.log +1677 -0
- data/spec/dummy/public/404.html +55 -14
- data/spec/dummy/public/406-unsupported-browser.html +66 -0
- data/spec/dummy/public/422.html +55 -14
- data/spec/dummy/public/500.html +54 -13
- data/spec/dummy/public/icon.png +0 -0
- data/spec/dummy/public/icon.svg +3 -0
- data/spec/dummy/public/uploads/picture/data/1/rails.png +0 -0
- data/spec/dummy/public/uploads/picture/data/1/thumb_rails.png +0 -0
- data/spec/dummy/storage/test.sqlite3 +0 -0
- data/spec/dummy/tmp/local_secret.txt +1 -0
- data/spec/factories/factories.rb +16 -0
- data/spec/fileuploads_spec.rb +30 -30
- data/spec/mongoid_spec.rb +5 -3
- data/spec/rails_helper.rb +80 -0
- data/spec/requests/attachments_controller_spec.rb +4 -4
- data/spec/spec_helper.rb +84 -45
- data/spec/uploader_spec.rb +5 -3
- metadata +88 -91
- data/spec/dummy/README.rdoc +0 -261
- data/spec/dummy/app/assets/javascripts/application.js +0 -15
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/mime_types.rb +0 -5
- data/spec/dummy/config/initializers/secret_token.rb +0 -7
- data/spec/dummy/config/initializers/session_store.rb +0 -8
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/script/rails +0 -6
- data/spec/factories/articles.rb +0 -9
- data/spec/factories/assets.rb +0 -11
- /data/spec/dummy/{public/favicon.ico → log/development.log} +0 -0
data/spec/spec_helper.rb
CHANGED
@@ -1,55 +1,94 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
#
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
1
|
+
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
4
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
5
|
+
# files.
|
6
|
+
#
|
7
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
8
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
9
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
10
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
11
|
+
# a separate helper file that requires the additional dependencies and performs
|
12
|
+
# the additional setup, and require it from the spec files that actually need
|
13
|
+
# it.
|
14
|
+
#
|
15
|
+
# See https://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
16
|
+
RSpec.configure do |config|
|
17
|
+
# rspec-expectations config goes here. You can use an alternate
|
18
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
19
|
+
# assertions if you prefer.
|
20
|
+
config.expect_with :rspec do |expectations|
|
21
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
22
|
+
# and `failure_message` of custom matchers include text for helper methods
|
23
|
+
# defined using `chain`, e.g.:
|
24
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
25
|
+
# # => "be bigger than 2 and smaller than 4"
|
26
|
+
# ...rather than:
|
27
|
+
# # => "be bigger than 2"
|
28
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
29
|
+
end
|
17
30
|
|
18
|
-
#
|
19
|
-
|
20
|
-
|
21
|
-
|
31
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
32
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
33
|
+
config.mock_with :rspec do |mocks|
|
34
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
35
|
+
# a real object. This is generally recommended, and will default to
|
36
|
+
# `true` in RSpec 4.
|
37
|
+
mocks.verify_partial_doubles = true
|
38
|
+
end
|
22
39
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
40
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
41
|
+
# have no way to turn it off -- the option exists only for backwards
|
42
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
43
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
44
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
45
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
28
46
|
|
29
|
-
#
|
30
|
-
|
47
|
+
# The settings below are suggested to provide a good initial experience
|
48
|
+
# with RSpec, but feel free to customize to your heart's content.
|
49
|
+
=begin
|
50
|
+
# This allows you to limit a spec run to individual examples or groups
|
51
|
+
# you care about by tagging them with `:focus` metadata. When nothing
|
52
|
+
# is tagged with `:focus`, all examples get run. RSpec also provides
|
53
|
+
# aliases for `it`, `describe`, and `context` that include `:focus`
|
54
|
+
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
55
|
+
config.filter_run_when_matching :focus
|
31
56
|
|
32
|
-
RSpec
|
33
|
-
#
|
34
|
-
#
|
35
|
-
|
36
|
-
config.include RSpec::Matchers
|
57
|
+
# Allows RSpec to persist some state between runs in order to support
|
58
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
59
|
+
# you configure your source control system to ignore this file.
|
60
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
37
61
|
|
38
|
-
#
|
39
|
-
|
62
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
63
|
+
# recommended. For more details, see:
|
64
|
+
# https://rspec.info/features/3-12/rspec-core/configuration/zero-monkey-patching-mode/
|
65
|
+
config.disable_monkey_patching!
|
40
66
|
|
41
|
-
|
42
|
-
|
43
|
-
|
67
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
68
|
+
# file, and it's useful to allow more verbose output when running an
|
69
|
+
# individual spec file.
|
70
|
+
if config.files_to_run.one?
|
71
|
+
# Use the documentation formatter for detailed output,
|
72
|
+
# unless a formatter has already been configured
|
73
|
+
# (e.g. via a command-line flag).
|
74
|
+
config.default_formatter = "doc"
|
44
75
|
end
|
45
76
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
77
|
+
# Print the 10 slowest examples and example groups at the
|
78
|
+
# end of the spec run, to help surface which specs are running
|
79
|
+
# particularly slow.
|
80
|
+
config.profile_examples = 10
|
50
81
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
82
|
+
# Run specs in random order to surface order dependencies. If you find an
|
83
|
+
# order dependency and want to debug it, you can fix the order by providing
|
84
|
+
# the seed, which is printed after each run.
|
85
|
+
# --seed 1234
|
86
|
+
config.order = :random
|
87
|
+
|
88
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
89
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
90
|
+
# test failures related to randomization by passing the same `--seed` value
|
91
|
+
# as the one that triggered the failure.
|
92
|
+
Kernel.srand config.seed
|
93
|
+
=end
|
55
94
|
end
|
data/spec/uploader_spec.rb
CHANGED
@@ -1,17 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Uploader do
|
4
|
-
it
|
6
|
+
it 'should be a Module' do
|
5
7
|
Uploader.should be_a(Module)
|
6
8
|
end
|
7
9
|
|
8
|
-
it
|
10
|
+
it 'should generate random string' do
|
9
11
|
value = Uploader.guid
|
10
12
|
value.should_not be_blank
|
11
13
|
value.size.should == 22
|
12
14
|
end
|
13
15
|
|
14
|
-
it
|
16
|
+
it 'should find all precompile assets' do
|
15
17
|
Uploader.assets.should_not be_nil
|
16
18
|
Uploader.assets.should include('uploader/jquery.fileupload.js')
|
17
19
|
end
|
metadata
CHANGED
@@ -1,58 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-uploader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Galeta
|
8
8
|
- Pavlo Galeta
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: carrierwave
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - ">="
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: '0'
|
21
|
-
type: :development
|
22
|
-
prerelease: false
|
23
|
-
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - ">="
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: '0'
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: mongoid
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - ">="
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '0'
|
35
|
-
type: :development
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - ">="
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '0'
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: sqlite3
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - ">="
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: '0'
|
49
|
-
type: :development
|
50
|
-
prerelease: false
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - ">="
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: '0'
|
12
|
+
date: 2024-10-07 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
56
14
|
description: Rails HTML5 FileUpload helpers
|
57
15
|
email: superp1987@gmail.com
|
58
16
|
executables: []
|
@@ -96,46 +54,66 @@ files:
|
|
96
54
|
- lib/uploader/json_rendering.rb
|
97
55
|
- lib/uploader/upload_request.rb
|
98
56
|
- lib/uploader/version.rb
|
99
|
-
- spec/dummy/README.rdoc
|
100
57
|
- spec/dummy/Rakefile
|
101
58
|
- spec/dummy/app/assets/config/manifest.js
|
102
|
-
- spec/dummy/app/assets/javascripts/application.js
|
103
59
|
- spec/dummy/app/assets/stylesheets/application.css
|
60
|
+
- spec/dummy/app/channels/application_cable/channel.rb
|
61
|
+
- spec/dummy/app/channels/application_cable/connection.rb
|
104
62
|
- spec/dummy/app/controllers/application_controller.rb
|
105
63
|
- spec/dummy/app/helpers/application_helper.rb
|
64
|
+
- spec/dummy/app/jobs/application_job.rb
|
65
|
+
- spec/dummy/app/mailers/application_mailer.rb
|
66
|
+
- spec/dummy/app/models/application_record.rb
|
106
67
|
- spec/dummy/app/models/article.rb
|
107
68
|
- spec/dummy/app/models/asset.rb
|
108
69
|
- spec/dummy/app/models/picture.rb
|
109
70
|
- spec/dummy/app/uploaders/picture_uploader.rb
|
110
71
|
- spec/dummy/app/views/layouts/application.html.erb
|
72
|
+
- spec/dummy/app/views/layouts/mailer.html.erb
|
73
|
+
- spec/dummy/app/views/layouts/mailer.text.erb
|
74
|
+
- spec/dummy/app/views/pwa/manifest.json.erb
|
75
|
+
- spec/dummy/app/views/pwa/service-worker.js
|
76
|
+
- spec/dummy/bin/rails
|
77
|
+
- spec/dummy/bin/rake
|
78
|
+
- spec/dummy/bin/setup
|
111
79
|
- spec/dummy/config.ru
|
112
80
|
- spec/dummy/config/application.rb
|
113
81
|
- spec/dummy/config/boot.rb
|
82
|
+
- spec/dummy/config/cable.yml
|
114
83
|
- spec/dummy/config/database.yml
|
115
84
|
- spec/dummy/config/environment.rb
|
116
85
|
- spec/dummy/config/environments/development.rb
|
117
86
|
- spec/dummy/config/environments/production.rb
|
118
87
|
- spec/dummy/config/environments/test.rb
|
119
|
-
- spec/dummy/config/initializers/
|
88
|
+
- spec/dummy/config/initializers/assets.rb
|
89
|
+
- spec/dummy/config/initializers/content_security_policy.rb
|
90
|
+
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
120
91
|
- spec/dummy/config/initializers/inflections.rb
|
121
|
-
- spec/dummy/config/initializers/
|
122
|
-
- spec/dummy/config/initializers/secret_token.rb
|
123
|
-
- spec/dummy/config/initializers/session_store.rb
|
124
|
-
- spec/dummy/config/initializers/wrap_parameters.rb
|
92
|
+
- spec/dummy/config/initializers/permissions_policy.rb
|
125
93
|
- spec/dummy/config/locales/en.yml
|
94
|
+
- spec/dummy/config/puma.rb
|
126
95
|
- spec/dummy/config/routes.rb
|
96
|
+
- spec/dummy/config/storage.yml
|
127
97
|
- spec/dummy/db/migrate/20120508093830_create_articles.rb
|
98
|
+
- spec/dummy/db/migrate/20130905144515_create_assets.rb
|
99
|
+
- spec/dummy/log/development.log
|
100
|
+
- spec/dummy/log/test.log
|
128
101
|
- spec/dummy/public/404.html
|
102
|
+
- spec/dummy/public/406-unsupported-browser.html
|
129
103
|
- spec/dummy/public/422.html
|
130
104
|
- spec/dummy/public/500.html
|
131
|
-
- spec/dummy/public/
|
132
|
-
- spec/dummy/
|
133
|
-
- spec/
|
134
|
-
- spec/
|
105
|
+
- spec/dummy/public/icon.png
|
106
|
+
- spec/dummy/public/icon.svg
|
107
|
+
- spec/dummy/public/uploads/picture/data/1/rails.png
|
108
|
+
- spec/dummy/public/uploads/picture/data/1/thumb_rails.png
|
109
|
+
- spec/dummy/storage/test.sqlite3
|
110
|
+
- spec/dummy/tmp/local_secret.txt
|
111
|
+
- spec/factories/factories.rb
|
135
112
|
- spec/factories/files/rails.png
|
136
113
|
- spec/fileuploads_spec.rb
|
137
114
|
- spec/mongoid.yml
|
138
115
|
- spec/mongoid_spec.rb
|
116
|
+
- spec/rails_helper.rb
|
139
117
|
- spec/requests/attachments_controller_spec.rb
|
140
118
|
- spec/spec_helper.rb
|
141
119
|
- spec/uploader_spec.rb
|
@@ -155,7 +133,7 @@ files:
|
|
155
133
|
homepage: https://github.com/superp/rails-uploader
|
156
134
|
licenses: []
|
157
135
|
metadata: {}
|
158
|
-
post_install_message:
|
136
|
+
post_install_message:
|
159
137
|
rdoc_options: []
|
160
138
|
require_paths:
|
161
139
|
- lib
|
@@ -170,52 +148,71 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
148
|
- !ruby/object:Gem::Version
|
171
149
|
version: '0'
|
172
150
|
requirements: []
|
173
|
-
|
174
|
-
|
175
|
-
signing_key:
|
151
|
+
rubygems_version: 3.4.10
|
152
|
+
signing_key:
|
176
153
|
specification_version: 4
|
177
154
|
summary: Rails file upload implementation with jQuery-File-Upload
|
178
155
|
test_files:
|
179
|
-
- spec/
|
180
|
-
- spec/requests/attachments_controller_spec.rb
|
181
|
-
- spec/mongoid_spec.rb
|
182
|
-
- spec/factories/assets.rb
|
183
|
-
- spec/factories/articles.rb
|
184
|
-
- spec/factories/files/rails.png
|
185
|
-
- spec/spec_helper.rb
|
186
|
-
- spec/uploader_spec.rb
|
187
|
-
- spec/mongoid.yml
|
188
|
-
- spec/dummy/app/views/layouts/application.html.erb
|
189
|
-
- spec/dummy/app/uploaders/picture_uploader.rb
|
190
|
-
- spec/dummy/app/helpers/application_helper.rb
|
191
|
-
- spec/dummy/app/controllers/application_controller.rb
|
156
|
+
- spec/dummy/Rakefile
|
192
157
|
- spec/dummy/app/assets/config/manifest.js
|
193
|
-
- spec/dummy/app/assets/javascripts/application.js
|
194
158
|
- spec/dummy/app/assets/stylesheets/application.css
|
195
|
-
- spec/dummy/app/
|
159
|
+
- spec/dummy/app/channels/application_cable/channel.rb
|
160
|
+
- spec/dummy/app/channels/application_cable/connection.rb
|
161
|
+
- spec/dummy/app/controllers/application_controller.rb
|
162
|
+
- spec/dummy/app/helpers/application_helper.rb
|
163
|
+
- spec/dummy/app/jobs/application_job.rb
|
164
|
+
- spec/dummy/app/mailers/application_mailer.rb
|
165
|
+
- spec/dummy/app/models/application_record.rb
|
196
166
|
- spec/dummy/app/models/article.rb
|
197
167
|
- spec/dummy/app/models/asset.rb
|
198
|
-
- spec/dummy/
|
199
|
-
- spec/dummy/
|
200
|
-
- spec/dummy/
|
201
|
-
- spec/dummy/
|
202
|
-
- spec/dummy/
|
203
|
-
- spec/dummy/
|
168
|
+
- spec/dummy/app/models/picture.rb
|
169
|
+
- spec/dummy/app/uploaders/picture_uploader.rb
|
170
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
171
|
+
- spec/dummy/app/views/layouts/mailer.html.erb
|
172
|
+
- spec/dummy/app/views/layouts/mailer.text.erb
|
173
|
+
- spec/dummy/app/views/pwa/manifest.json.erb
|
174
|
+
- spec/dummy/app/views/pwa/service-worker.js
|
175
|
+
- spec/dummy/bin/rails
|
176
|
+
- spec/dummy/bin/rake
|
177
|
+
- spec/dummy/bin/setup
|
204
178
|
- spec/dummy/config/application.rb
|
205
179
|
- spec/dummy/config/boot.rb
|
206
|
-
- spec/dummy/config/
|
207
|
-
- spec/dummy/config/initializers/inflections.rb
|
208
|
-
- spec/dummy/config/initializers/backtrace_silencers.rb
|
209
|
-
- spec/dummy/config/initializers/session_store.rb
|
210
|
-
- spec/dummy/config/initializers/mime_types.rb
|
211
|
-
- spec/dummy/config/initializers/wrap_parameters.rb
|
212
|
-
- spec/dummy/config/environment.rb
|
180
|
+
- spec/dummy/config/cable.yml
|
213
181
|
- spec/dummy/config/database.yml
|
182
|
+
- spec/dummy/config/environment.rb
|
214
183
|
- spec/dummy/config/environments/development.rb
|
215
184
|
- spec/dummy/config/environments/production.rb
|
216
185
|
- spec/dummy/config/environments/test.rb
|
186
|
+
- spec/dummy/config/initializers/assets.rb
|
187
|
+
- spec/dummy/config/initializers/content_security_policy.rb
|
188
|
+
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
189
|
+
- spec/dummy/config/initializers/inflections.rb
|
190
|
+
- spec/dummy/config/initializers/permissions_policy.rb
|
217
191
|
- spec/dummy/config/locales/en.yml
|
192
|
+
- spec/dummy/config/puma.rb
|
218
193
|
- spec/dummy/config/routes.rb
|
219
|
-
- spec/dummy/
|
194
|
+
- spec/dummy/config/storage.yml
|
220
195
|
- spec/dummy/config.ru
|
221
|
-
- spec/dummy/
|
196
|
+
- spec/dummy/db/migrate/20120508093830_create_articles.rb
|
197
|
+
- spec/dummy/db/migrate/20130905144515_create_assets.rb
|
198
|
+
- spec/dummy/log/development.log
|
199
|
+
- spec/dummy/log/test.log
|
200
|
+
- spec/dummy/public/404.html
|
201
|
+
- spec/dummy/public/406-unsupported-browser.html
|
202
|
+
- spec/dummy/public/422.html
|
203
|
+
- spec/dummy/public/500.html
|
204
|
+
- spec/dummy/public/icon.png
|
205
|
+
- spec/dummy/public/icon.svg
|
206
|
+
- spec/dummy/public/uploads/picture/data/1/rails.png
|
207
|
+
- spec/dummy/public/uploads/picture/data/1/thumb_rails.png
|
208
|
+
- spec/dummy/storage/test.sqlite3
|
209
|
+
- spec/dummy/tmp/local_secret.txt
|
210
|
+
- spec/factories/factories.rb
|
211
|
+
- spec/factories/files/rails.png
|
212
|
+
- spec/fileuploads_spec.rb
|
213
|
+
- spec/mongoid.yml
|
214
|
+
- spec/mongoid_spec.rb
|
215
|
+
- spec/rails_helper.rb
|
216
|
+
- spec/requests/attachments_controller_spec.rb
|
217
|
+
- spec/spec_helper.rb
|
218
|
+
- spec/uploader_spec.rb
|
data/spec/dummy/README.rdoc
DELETED
@@ -1,261 +0,0 @@
|
|
1
|
-
== Welcome to Rails
|
2
|
-
|
3
|
-
Rails is a web-application framework that includes everything needed to create
|
4
|
-
database-backed web applications according to the Model-View-Control pattern.
|
5
|
-
|
6
|
-
This pattern splits the view (also called the presentation) into "dumb"
|
7
|
-
templates that are primarily responsible for inserting pre-built data in between
|
8
|
-
HTML tags. The model contains the "smart" domain objects (such as Account,
|
9
|
-
Product, Person, Post) that holds all the business logic and knows how to
|
10
|
-
persist themselves to a database. The controller handles the incoming requests
|
11
|
-
(such as Save New Account, Update Product, Show Post) by manipulating the model
|
12
|
-
and directing data to the view.
|
13
|
-
|
14
|
-
In Rails, the model is handled by what's called an object-relational mapping
|
15
|
-
layer entitled Active Record. This layer allows you to present the data from
|
16
|
-
database rows as objects and embellish these data objects with business logic
|
17
|
-
methods. You can read more about Active Record in
|
18
|
-
link:files/vendor/rails/activerecord/README.html.
|
19
|
-
|
20
|
-
The controller and view are handled by the Action Pack, which handles both
|
21
|
-
layers by its two parts: Action View and Action Controller. These two layers
|
22
|
-
are bundled in a single package due to their heavy interdependence. This is
|
23
|
-
unlike the relationship between the Active Record and Action Pack that is much
|
24
|
-
more separate. Each of these packages can be used independently outside of
|
25
|
-
Rails. You can read more about Action Pack in
|
26
|
-
link:files/vendor/rails/actionpack/README.html.
|
27
|
-
|
28
|
-
|
29
|
-
== Getting Started
|
30
|
-
|
31
|
-
1. At the command prompt, create a new Rails application:
|
32
|
-
<tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
|
33
|
-
|
34
|
-
2. Change directory to <tt>myapp</tt> and start the web server:
|
35
|
-
<tt>cd myapp; rails server</tt> (run with --help for options)
|
36
|
-
|
37
|
-
3. Go to http://localhost:3000/ and you'll see:
|
38
|
-
"Welcome aboard: You're riding Ruby on Rails!"
|
39
|
-
|
40
|
-
4. Follow the guidelines to start developing your application. You can find
|
41
|
-
the following resources handy:
|
42
|
-
|
43
|
-
* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
|
44
|
-
* Ruby on Rails Tutorial Book: http://www.railstutorial.org/
|
45
|
-
|
46
|
-
|
47
|
-
== Debugging Rails
|
48
|
-
|
49
|
-
Sometimes your application goes wrong. Fortunately there are a lot of tools that
|
50
|
-
will help you debug it and get it back on the rails.
|
51
|
-
|
52
|
-
First area to check is the application log files. Have "tail -f" commands
|
53
|
-
running on the server.log and development.log. Rails will automatically display
|
54
|
-
debugging and runtime information to these files. Debugging info will also be
|
55
|
-
shown in the browser on requests from 127.0.0.1.
|
56
|
-
|
57
|
-
You can also log your own messages directly into the log file from your code
|
58
|
-
using the Ruby logger class from inside your controllers. Example:
|
59
|
-
|
60
|
-
class WeblogController < ActionController::Base
|
61
|
-
def destroy
|
62
|
-
@weblog = Weblog.find(params[:id])
|
63
|
-
@weblog.destroy
|
64
|
-
logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
The result will be a message in your log file along the lines of:
|
69
|
-
|
70
|
-
Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
|
71
|
-
|
72
|
-
More information on how to use the logger is at http://www.ruby-doc.org/core/
|
73
|
-
|
74
|
-
Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
|
75
|
-
several books available online as well:
|
76
|
-
|
77
|
-
* Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
|
78
|
-
* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
|
79
|
-
|
80
|
-
These two books will bring you up to speed on the Ruby language and also on
|
81
|
-
programming in general.
|
82
|
-
|
83
|
-
|
84
|
-
== Debugger
|
85
|
-
|
86
|
-
Debugger support is available through the debugger command when you start your
|
87
|
-
Mongrel or WEBrick server with --debugger. This means that you can break out of
|
88
|
-
execution at any point in the code, investigate and change the model, and then,
|
89
|
-
resume execution! You need to install ruby-debug to run the server in debugging
|
90
|
-
mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
|
91
|
-
|
92
|
-
class WeblogController < ActionController::Base
|
93
|
-
def index
|
94
|
-
@posts = Post.all
|
95
|
-
debugger
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
So the controller will accept the action, run the first line, then present you
|
100
|
-
with a IRB prompt in the server window. Here you can do things like:
|
101
|
-
|
102
|
-
>> @posts.inspect
|
103
|
-
=> "[#<Post:0x14a6be8
|
104
|
-
@attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
|
105
|
-
#<Post:0x14a6620
|
106
|
-
@attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
|
107
|
-
>> @posts.first.title = "hello from a debugger"
|
108
|
-
=> "hello from a debugger"
|
109
|
-
|
110
|
-
...and even better, you can examine how your runtime objects actually work:
|
111
|
-
|
112
|
-
>> f = @posts.first
|
113
|
-
=> #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
|
114
|
-
>> f.
|
115
|
-
Display all 152 possibilities? (y or n)
|
116
|
-
|
117
|
-
Finally, when you're ready to resume execution, you can enter "cont".
|
118
|
-
|
119
|
-
|
120
|
-
== Console
|
121
|
-
|
122
|
-
The console is a Ruby shell, which allows you to interact with your
|
123
|
-
application's domain model. Here you'll have all parts of the application
|
124
|
-
configured, just like it is when the application is running. You can inspect
|
125
|
-
domain models, change values, and save to the database. Starting the script
|
126
|
-
without arguments will launch it in the development environment.
|
127
|
-
|
128
|
-
To start the console, run <tt>rails console</tt> from the application
|
129
|
-
directory.
|
130
|
-
|
131
|
-
Options:
|
132
|
-
|
133
|
-
* Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications
|
134
|
-
made to the database.
|
135
|
-
* Passing an environment name as an argument will load the corresponding
|
136
|
-
environment. Example: <tt>rails console production</tt>.
|
137
|
-
|
138
|
-
To reload your controllers and models after launching the console run
|
139
|
-
<tt>reload!</tt>
|
140
|
-
|
141
|
-
More information about irb can be found at:
|
142
|
-
link:http://www.rubycentral.org/pickaxe/irb.html
|
143
|
-
|
144
|
-
|
145
|
-
== dbconsole
|
146
|
-
|
147
|
-
You can go to the command line of your database directly through <tt>rails
|
148
|
-
dbconsole</tt>. You would be connected to the database with the credentials
|
149
|
-
defined in database.yml. Starting the script without arguments will connect you
|
150
|
-
to the development database. Passing an argument will connect you to a different
|
151
|
-
database, like <tt>rails dbconsole production</tt>. Currently works for MySQL,
|
152
|
-
PostgreSQL and SQLite 3.
|
153
|
-
|
154
|
-
== Description of Contents
|
155
|
-
|
156
|
-
The default directory structure of a generated Ruby on Rails application:
|
157
|
-
|
158
|
-
|-- app
|
159
|
-
| |-- assets
|
160
|
-
| |-- images
|
161
|
-
| |-- javascripts
|
162
|
-
| `-- stylesheets
|
163
|
-
| |-- controllers
|
164
|
-
| |-- helpers
|
165
|
-
| |-- mailers
|
166
|
-
| |-- models
|
167
|
-
| `-- views
|
168
|
-
| `-- layouts
|
169
|
-
|-- config
|
170
|
-
| |-- environments
|
171
|
-
| |-- initializers
|
172
|
-
| `-- locales
|
173
|
-
|-- db
|
174
|
-
|-- doc
|
175
|
-
|-- lib
|
176
|
-
| `-- tasks
|
177
|
-
|-- log
|
178
|
-
|-- public
|
179
|
-
|-- script
|
180
|
-
|-- test
|
181
|
-
| |-- fixtures
|
182
|
-
| |-- functional
|
183
|
-
| |-- integration
|
184
|
-
| |-- performance
|
185
|
-
| `-- unit
|
186
|
-
|-- tmp
|
187
|
-
| |-- cache
|
188
|
-
| |-- pids
|
189
|
-
| |-- sessions
|
190
|
-
| `-- sockets
|
191
|
-
`-- vendor
|
192
|
-
|-- assets
|
193
|
-
`-- stylesheets
|
194
|
-
`-- plugins
|
195
|
-
|
196
|
-
app
|
197
|
-
Holds all the code that's specific to this particular application.
|
198
|
-
|
199
|
-
app/assets
|
200
|
-
Contains subdirectories for images, stylesheets, and JavaScript files.
|
201
|
-
|
202
|
-
app/controllers
|
203
|
-
Holds controllers that should be named like weblogs_controller.rb for
|
204
|
-
automated URL mapping. All controllers should descend from
|
205
|
-
ApplicationController which itself descends from ActionController::Base.
|
206
|
-
|
207
|
-
app/models
|
208
|
-
Holds models that should be named like post.rb. Models descend from
|
209
|
-
ActiveRecord::Base by default.
|
210
|
-
|
211
|
-
app/views
|
212
|
-
Holds the template files for the view that should be named like
|
213
|
-
weblogs/index.html.erb for the WeblogsController#index action. All views use
|
214
|
-
eRuby syntax by default.
|
215
|
-
|
216
|
-
app/views/layouts
|
217
|
-
Holds the template files for layouts to be used with views. This models the
|
218
|
-
common header/footer method of wrapping views. In your views, define a layout
|
219
|
-
using the <tt>layout :default</tt> and create a file named default.html.erb.
|
220
|
-
Inside default.html.erb, call <% yield %> to render the view using this
|
221
|
-
layout.
|
222
|
-
|
223
|
-
app/helpers
|
224
|
-
Holds view helpers that should be named like weblogs_helper.rb. These are
|
225
|
-
generated for you automatically when using generators for controllers.
|
226
|
-
Helpers can be used to wrap functionality for your views into methods.
|
227
|
-
|
228
|
-
config
|
229
|
-
Configuration files for the Rails environment, the routing map, the database,
|
230
|
-
and other dependencies.
|
231
|
-
|
232
|
-
db
|
233
|
-
Contains the database schema in schema.rb. db/migrate contains all the
|
234
|
-
sequence of Migrations for your schema.
|
235
|
-
|
236
|
-
doc
|
237
|
-
This directory is where your application documentation will be stored when
|
238
|
-
generated using <tt>rake doc:app</tt>
|
239
|
-
|
240
|
-
lib
|
241
|
-
Application specific libraries. Basically, any kind of custom code that
|
242
|
-
doesn't belong under controllers, models, or helpers. This directory is in
|
243
|
-
the load path.
|
244
|
-
|
245
|
-
public
|
246
|
-
The directory available for the web server. Also contains the dispatchers and the
|
247
|
-
default HTML files. This should be set as the DOCUMENT_ROOT of your web
|
248
|
-
server.
|
249
|
-
|
250
|
-
script
|
251
|
-
Helper scripts for automation and generation.
|
252
|
-
|
253
|
-
test
|
254
|
-
Unit and functional tests along with fixtures. When using the rails generate
|
255
|
-
command, template test files will be generated for you and placed in this
|
256
|
-
directory.
|
257
|
-
|
258
|
-
vendor
|
259
|
-
External libraries that the application depends on. Also includes the plugins
|
260
|
-
subdirectory. If the app has frozen rails, those gems also go here, under
|
261
|
-
vendor/rails/. This directory is in the load path.
|