radiant-downloads-extension 0.5.0 → 0.5.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.
- data/README.markdown +1 -3
- data/Rakefile +1 -0
- data/VERSION +1 -0
- data/app/models/download.rb +2 -2
- data/config/routes.rb +6 -0
- data/downloads_extension.rb +3 -15
- data/radiant-downloads-extension.gemspec +86 -0
- metadata +27 -10
data/README.markdown
CHANGED
@@ -28,15 +28,13 @@ Also requires [paperclip](http://www.thoughtbot.com/projects/paperclip) gem, or
|
|
28
28
|
|
29
29
|
(We thought about just applying access control to paperclipped assets but the machinery there is too specialised for images: most of what goes in here will be pdfs and office documents. The separate store is tricky too.)
|
30
30
|
|
31
|
-
This should be straightforwardly `multi_site` compatible. If you use our [fork of multi_site](https://github.com/spanner/radiant-multi-site-extension/) then downloads (and readers and groups) will be site-scoped.
|
32
|
-
|
33
31
|
## Configuration
|
34
32
|
|
35
33
|
### In nginx
|
36
34
|
|
37
35
|
This is what I use:
|
38
36
|
|
39
|
-
location /
|
37
|
+
location /secure_downloads/ {
|
40
38
|
internal;
|
41
39
|
root /your/site/directory/current/secure_downloads;
|
42
40
|
default_type application/pdf;
|
data/Rakefile
CHANGED
@@ -9,6 +9,7 @@ begin
|
|
9
9
|
gem.authors = ["spanner"]
|
10
10
|
gem.add_dependency "radiant", ">= 0.9.0"
|
11
11
|
gem.add_dependency 'radiant-reader_group-extension'
|
12
|
+
gem.add_dependency 'paperclip'
|
12
13
|
end
|
13
14
|
rescue LoadError
|
14
15
|
puts "Jeweler (or a dependency) not available. This is only required if you plan to package downloads as a gem."
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.5.1
|
data/app/models/download.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
class Download < ActiveRecord::Base
|
2
|
-
|
2
|
+
|
3
3
|
is_site_scoped if defined? ActiveRecord::SiteNotFound
|
4
4
|
belongs_to :created_by, :class_name => 'User'
|
5
5
|
belongs_to :updated_by, :class_name => 'User'
|
@@ -7,7 +7,7 @@ class Download < ActiveRecord::Base
|
|
7
7
|
default_scope :order => 'updated_at DESC, created_at DESC'
|
8
8
|
|
9
9
|
has_attached_file :document,
|
10
|
-
:url => "/
|
10
|
+
:url => "/secure_downloads/:id/:basename:no_original_style.:extension",
|
11
11
|
:path => ":rails_root/secure_downloads/:id/:basename:no_original_style.:extension"
|
12
12
|
|
13
13
|
validates_attachment_presence :document
|
data/config/routes.rb
ADDED
data/downloads_extension.rb
CHANGED
@@ -1,24 +1,12 @@
|
|
1
1
|
# Uncomment this if you reference any of your controllers in activate
|
2
2
|
# require_dependency 'application'
|
3
|
+
require 'paperclip'
|
3
4
|
|
4
5
|
class DownloadsExtension < Radiant::Extension
|
5
|
-
version "0.5"
|
6
|
+
version "0.5.1"
|
6
7
|
description "Controlled file access using nginx's local redirects. Requires reader and reader_group extensions."
|
7
8
|
url "http://www.spanner.org/radiant/downloads"
|
8
|
-
|
9
|
-
define_routes do |map|
|
10
|
-
map.resources :downloads, :only => :show
|
11
|
-
map.namespace :admin, :path_prefix => 'admin/readers' do |admin|
|
12
|
-
admin.resources :downloads
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
extension_config do |config|
|
17
|
-
config.gem 'paperclip'
|
18
|
-
config.extension 'reader'
|
19
|
-
config.extension 'reader_group'
|
20
|
-
end
|
21
|
-
|
9
|
+
|
22
10
|
def activate
|
23
11
|
Group.send :include, DownloadGroup
|
24
12
|
Page.send :include, DownloadTags
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{radiant-downloads-extension}
|
8
|
+
s.version = "0.5.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["spanner"]
|
12
|
+
s.date = %q{2010-10-20}
|
13
|
+
s.description = %q{Controlled, secure file access with group-based access control.}
|
14
|
+
s.email = %q{will@spanner.org}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README.markdown"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
".gitignore",
|
20
|
+
"README.markdown",
|
21
|
+
"Rakefile",
|
22
|
+
"VERSION",
|
23
|
+
"app/controllers/admin/downloads_controller.rb",
|
24
|
+
"app/controllers/downloads_controller.rb",
|
25
|
+
"app/models/download.rb",
|
26
|
+
"app/views/admin/downloads/_form.html.haml",
|
27
|
+
"app/views/admin/downloads/edit.html.haml",
|
28
|
+
"app/views/admin/downloads/index.html.haml",
|
29
|
+
"app/views/admin/downloads/new.html.haml",
|
30
|
+
"config/routes.rb",
|
31
|
+
"db/migrate/001_create_downloads.rb",
|
32
|
+
"downloads_extension.rb",
|
33
|
+
"lib/download_group.rb",
|
34
|
+
"lib/download_tags.rb",
|
35
|
+
"lib/download_ui.rb",
|
36
|
+
"lib/tasks/downloads_extension_tasks.rake",
|
37
|
+
"public/stylesheets/admin/downloads.css",
|
38
|
+
"radiant-downloads-extension.gemspec",
|
39
|
+
"spec/controllers/downloads_controller_spec.rb",
|
40
|
+
"spec/datasets/download_groups_dataset.rb",
|
41
|
+
"spec/datasets/download_readers_dataset.rb",
|
42
|
+
"spec/datasets/download_sites_dataset.rb",
|
43
|
+
"spec/datasets/downloads_dataset.rb",
|
44
|
+
"spec/files/test.pdf",
|
45
|
+
"spec/files/test.txt",
|
46
|
+
"spec/models/download_spec.rb",
|
47
|
+
"spec/models/group_spec.rb",
|
48
|
+
"spec/spec.opts",
|
49
|
+
"spec/spec_helper.rb"
|
50
|
+
]
|
51
|
+
s.homepage = %q{http://github.com/spanner/radiant-downloads-extension}
|
52
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
53
|
+
s.require_paths = ["lib"]
|
54
|
+
s.rubygems_version = %q{1.3.7}
|
55
|
+
s.summary = %q{Controlled, secure file access for Radiant CMS with group-based access control.}
|
56
|
+
s.test_files = [
|
57
|
+
"spec/controllers/downloads_controller_spec.rb",
|
58
|
+
"spec/datasets/download_groups_dataset.rb",
|
59
|
+
"spec/datasets/download_readers_dataset.rb",
|
60
|
+
"spec/datasets/download_sites_dataset.rb",
|
61
|
+
"spec/datasets/downloads_dataset.rb",
|
62
|
+
"spec/models/download_spec.rb",
|
63
|
+
"spec/models/group_spec.rb",
|
64
|
+
"spec/spec_helper.rb"
|
65
|
+
]
|
66
|
+
|
67
|
+
if s.respond_to? :specification_version then
|
68
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
69
|
+
s.specification_version = 3
|
70
|
+
|
71
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
72
|
+
s.add_runtime_dependency(%q<radiant>, [">= 0.9.0"])
|
73
|
+
s.add_runtime_dependency(%q<radiant-reader_group-extension>, [">= 0"])
|
74
|
+
s.add_runtime_dependency(%q<paperclip>, [">= 0"])
|
75
|
+
else
|
76
|
+
s.add_dependency(%q<radiant>, [">= 0.9.0"])
|
77
|
+
s.add_dependency(%q<radiant-reader_group-extension>, [">= 0"])
|
78
|
+
s.add_dependency(%q<paperclip>, [">= 0"])
|
79
|
+
end
|
80
|
+
else
|
81
|
+
s.add_dependency(%q<radiant>, [">= 0.9.0"])
|
82
|
+
s.add_dependency(%q<radiant-reader_group-extension>, [">= 0"])
|
83
|
+
s.add_dependency(%q<paperclip>, [">= 0"])
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: radiant-downloads-extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 1
|
10
|
+
version: 0.5.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- spanner
|
@@ -15,12 +15,13 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-10-20 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
+
name: radiant
|
22
23
|
prerelease: false
|
23
|
-
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
25
|
none: false
|
25
26
|
requirements:
|
26
27
|
- - ">="
|
@@ -31,12 +32,26 @@ dependencies:
|
|
31
32
|
- 9
|
32
33
|
- 0
|
33
34
|
version: 0.9.0
|
34
|
-
name: radiant
|
35
|
-
requirement: *id001
|
36
35
|
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
|
+
name: radiant-reader_group-extension
|
38
39
|
prerelease: false
|
39
|
-
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 3
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
version: "0"
|
49
|
+
type: :runtime
|
50
|
+
version_requirements: *id002
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
name: paperclip
|
53
|
+
prerelease: false
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
40
55
|
none: false
|
41
56
|
requirements:
|
42
57
|
- - ">="
|
@@ -45,9 +60,8 @@ dependencies:
|
|
45
60
|
segments:
|
46
61
|
- 0
|
47
62
|
version: "0"
|
48
|
-
name: radiant-reader_group-extension
|
49
|
-
requirement: *id002
|
50
63
|
type: :runtime
|
64
|
+
version_requirements: *id003
|
51
65
|
description: Controlled, secure file access with group-based access control.
|
52
66
|
email: will@spanner.org
|
53
67
|
executables: []
|
@@ -60,6 +74,7 @@ files:
|
|
60
74
|
- .gitignore
|
61
75
|
- README.markdown
|
62
76
|
- Rakefile
|
77
|
+
- VERSION
|
63
78
|
- app/controllers/admin/downloads_controller.rb
|
64
79
|
- app/controllers/downloads_controller.rb
|
65
80
|
- app/models/download.rb
|
@@ -67,6 +82,7 @@ files:
|
|
67
82
|
- app/views/admin/downloads/edit.html.haml
|
68
83
|
- app/views/admin/downloads/index.html.haml
|
69
84
|
- app/views/admin/downloads/new.html.haml
|
85
|
+
- config/routes.rb
|
70
86
|
- db/migrate/001_create_downloads.rb
|
71
87
|
- downloads_extension.rb
|
72
88
|
- lib/download_group.rb
|
@@ -74,6 +90,7 @@ files:
|
|
74
90
|
- lib/download_ui.rb
|
75
91
|
- lib/tasks/downloads_extension_tasks.rake
|
76
92
|
- public/stylesheets/admin/downloads.css
|
93
|
+
- radiant-downloads-extension.gemspec
|
77
94
|
- spec/controllers/downloads_controller_spec.rb
|
78
95
|
- spec/datasets/download_groups_dataset.rb
|
79
96
|
- spec/datasets/download_readers_dataset.rb
|