radiant-assets-extension 0.0.10 → 0.0.12
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/Rakefile +1 -117
- data/app/controllers/admin/assets_controller.rb +1 -0
- data/app/controllers/admin/attachments_controller.rb +1 -0
- data/app/controllers/admin/upload_handler.rb +1 -0
- data/app/helpers/assets_helper.rb +1 -0
- data/app/models/asset.rb +1 -0
- data/app/models/asset_tags.rb +1 -0
- data/app/models/attachment.rb +1 -0
- data/assets_extension.rb +2 -1
- data/db/migrate/20110224001246_add_images_table.rb +1 -0
- data/db/migrate/20110225021327_add_caption.rb +1 -0
- data/db/migrate/20110225023017_rename_model_class.rb +1 -0
- data/db/migrate/20110225174217_add_caching_columns_to_asset.rb +1 -0
- data/db/migrate/20110225210821_add_attachment_to_pages.rb +1 -0
- data/db/migrate/20110225210912_add_timestamps_and_locking_to_assets.rb +1 -0
- data/db/migrate/20110320152044_add_position_to_attachments.rb +4 -2
- data/db/migrate/20110321005357_make_attachments_polymorphic.rb +5 -2
- data/lib/radiant-assets-extension.rb +2 -1
- data/lib/radiant-assets-extension/s3_store.rb +1 -0
- data/lib/tasks/assets_extension_tasks.rake +1 -0
- metadata +7 -7
data/Rakefile
CHANGED
@@ -1,117 +1 @@
|
|
1
|
-
|
2
|
-
unless defined? RADIANT_ROOT
|
3
|
-
ENV["RAILS_ENV"] = "test"
|
4
|
-
case
|
5
|
-
when ENV["RADIANT_ENV_FILE"]
|
6
|
-
require File.dirname(ENV["RADIANT_ENV_FILE"]) + "/boot"
|
7
|
-
when File.dirname(__FILE__) =~ %r{vendor/radiant/vendor/extensions}
|
8
|
-
require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../../")}/config/boot"
|
9
|
-
else
|
10
|
-
require "#{File.expand_path(File.dirname(__FILE__) + "/../../../")}/config/boot"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
require 'rake'
|
15
|
-
require 'rake/rdoctask'
|
16
|
-
require 'rake/testtask'
|
17
|
-
|
18
|
-
rspec_base = File.expand_path(RADIANT_ROOT + '/vendor/plugins/rspec/lib')
|
19
|
-
$LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base)
|
20
|
-
require 'spec/rake/spectask'
|
21
|
-
require 'cucumber'
|
22
|
-
require 'cucumber/rake/task'
|
23
|
-
|
24
|
-
# Cleanup the RADIANT_ROOT constant so specs will load the environment
|
25
|
-
Object.send(:remove_const, :RADIANT_ROOT)
|
26
|
-
|
27
|
-
extension_root = File.expand_path(File.dirname(__FILE__))
|
28
|
-
|
29
|
-
task :default => :spec
|
30
|
-
task :stats => "spec:statsetup"
|
31
|
-
|
32
|
-
desc "Run all specs in spec directory"
|
33
|
-
Spec::Rake::SpecTask.new(:spec) do |t|
|
34
|
-
t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""]
|
35
|
-
t.spec_files = FileList['spec/**/*_spec.rb']
|
36
|
-
end
|
37
|
-
|
38
|
-
task :features => 'spec:integration'
|
39
|
-
|
40
|
-
namespace :spec do
|
41
|
-
desc "Run all specs in spec directory with RCov"
|
42
|
-
Spec::Rake::SpecTask.new(:rcov) do |t|
|
43
|
-
t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""]
|
44
|
-
t.spec_files = FileList['spec/**/*_spec.rb']
|
45
|
-
t.rcov = true
|
46
|
-
t.rcov_opts = ['--exclude', 'spec', '--rails']
|
47
|
-
end
|
48
|
-
|
49
|
-
desc "Print Specdoc for all specs"
|
50
|
-
Spec::Rake::SpecTask.new(:doc) do |t|
|
51
|
-
t.spec_opts = ["--format", "specdoc", "--dry-run"]
|
52
|
-
t.spec_files = FileList['spec/**/*_spec.rb']
|
53
|
-
end
|
54
|
-
|
55
|
-
[:models, :controllers, :views, :helpers].each do |sub|
|
56
|
-
desc "Run the specs under spec/#{sub}"
|
57
|
-
Spec::Rake::SpecTask.new(sub) do |t|
|
58
|
-
t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""]
|
59
|
-
t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"]
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
desc "Run the Cucumber features"
|
64
|
-
Cucumber::Rake::Task.new(:integration) do |t|
|
65
|
-
t.fork = true
|
66
|
-
t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'pretty')]
|
67
|
-
# t.feature_pattern = "#{extension_root}/features/**/*.feature"
|
68
|
-
t.profile = "default"
|
69
|
-
end
|
70
|
-
|
71
|
-
# Setup specs for stats
|
72
|
-
task :statsetup do
|
73
|
-
require 'code_statistics'
|
74
|
-
::STATS_DIRECTORIES << %w(Model\ specs spec/models)
|
75
|
-
::STATS_DIRECTORIES << %w(View\ specs spec/views)
|
76
|
-
::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers)
|
77
|
-
::STATS_DIRECTORIES << %w(Helper\ specs spec/views)
|
78
|
-
::CodeStatistics::TEST_TYPES << "Model specs"
|
79
|
-
::CodeStatistics::TEST_TYPES << "View specs"
|
80
|
-
::CodeStatistics::TEST_TYPES << "Controller specs"
|
81
|
-
::CodeStatistics::TEST_TYPES << "Helper specs"
|
82
|
-
::STATS_DIRECTORIES.delete_if {|a| a[0] =~ /test/}
|
83
|
-
end
|
84
|
-
|
85
|
-
namespace :db do
|
86
|
-
namespace :fixtures do
|
87
|
-
desc "Load fixtures (from spec/fixtures) into the current environment's database. Load specific fixtures using FIXTURES=x,y"
|
88
|
-
task :load => :environment do
|
89
|
-
require 'active_record/fixtures'
|
90
|
-
ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym)
|
91
|
-
(ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(RAILS_ROOT, 'spec', 'fixtures', '*.{yml,csv}'))).each do |fixture_file|
|
92
|
-
Fixtures.create_fixtures('spec/fixtures', File.basename(fixture_file, '.*'))
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
desc 'Generate documentation for the assets extension.'
|
100
|
-
Rake::RDocTask.new(:rdoc) do |rdoc|
|
101
|
-
rdoc.rdoc_dir = 'rdoc'
|
102
|
-
rdoc.title = 'AssetsExtension'
|
103
|
-
rdoc.options << '--line-numbers' << '--inline-source'
|
104
|
-
rdoc.rdoc_files.include('README')
|
105
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
106
|
-
end
|
107
|
-
|
108
|
-
# For extensions that are in transition
|
109
|
-
desc 'Test the assets extension.'
|
110
|
-
Rake::TestTask.new(:test) do |t|
|
111
|
-
t.libs << 'lib'
|
112
|
-
t.pattern = 'test/**/*_test.rb'
|
113
|
-
t.verbose = true
|
114
|
-
end
|
115
|
-
|
116
|
-
# Load any custom rakefiles for extension
|
117
|
-
Dir[File.dirname(__FILE__) + '/tasks/*.rake'].sort.each { |f| require f }
|
1
|
+
require "bundler/gem_tasks"
|
data/app/models/asset.rb
CHANGED
data/app/models/asset_tags.rb
CHANGED
data/app/models/attachment.rb
CHANGED
data/assets_extension.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
1
2
|
# Uncomment this if you reference any of your controllers in activate
|
2
3
|
# require_dependency 'application_controller'
|
3
4
|
require 'radiant-assets-extension'
|
@@ -20,7 +21,7 @@ class AssetsExtension < Radiant::Extension
|
|
20
21
|
dragonfly.define_macro(ActiveRecord::Base, :image_accessor)
|
21
22
|
dragonfly.url_path_prefix = path
|
22
23
|
# TODO: optional SSL support for url_host. could protocol-relative urls be used?
|
23
|
-
dragonfly.url_host = 'http://' + Radiant::Config['assets.host']
|
24
|
+
dragonfly.url_host = 'http://' + Radiant::Config['assets.host'] unless Radiant::Config['assets.host'].blank?
|
24
25
|
if RadiantAssetsExtension::S3Store.enabled?
|
25
26
|
dragonfly.datastore = RadiantAssetsExtension::S3Store.new
|
26
27
|
dragonfly.datastore.configure do |c|
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
1
2
|
class AddPositionToAttachments < ActiveRecord::Migration
|
2
3
|
def self.up
|
3
4
|
add_column :attachments, :position, :integer
|
4
|
-
Page.all
|
5
|
-
|
5
|
+
Page.all.each do |page|
|
6
|
+
page_attachments = Attachment.find_all_by_page_id page.id
|
7
|
+
page_attachments.each_with_index do |attachment, index|
|
6
8
|
attachment.update_attributes :position => index+1
|
7
9
|
end
|
8
10
|
end
|
@@ -1,12 +1,15 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
1
2
|
class MakeAttachmentsPolymorphic < ActiveRecord::Migration
|
2
3
|
def self.up
|
3
4
|
rename_column :attachments, :page_id, :parent_id
|
4
5
|
add_column :attachments, :parent_type, :string
|
5
|
-
|
6
|
+
# use single quotes in query to be compatible with postgres
|
7
|
+
Attachment.update_all "parent_type = 'Page'"
|
6
8
|
|
7
9
|
rename_column :attachments, :asset_id, :attachable_id
|
8
10
|
add_column :attachments, :attachable_type, :string
|
9
|
-
|
11
|
+
# use single quotes in query to be compatible with postgres
|
12
|
+
Attachment.update_all "attachable_type = 'Asset'"
|
10
13
|
end
|
11
14
|
|
12
15
|
def self.down
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: radiant-assets-extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 7
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 12
|
10
|
+
version: 0.0.12
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Gerrit Kaiser
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-11-10 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -127,7 +127,7 @@ has_rdoc: true
|
|
127
127
|
homepage: http://ext.radiantcms.org/extensions/269-assets
|
128
128
|
licenses: []
|
129
129
|
|
130
|
-
post_install_message: "\n Add this to your radiant project with:\n config.gem 'radiant-assets-extension', :version => '0.0.
|
130
|
+
post_install_message: "\n Add this to your radiant project with:\n config.gem 'radiant-assets-extension', :version => '0.0.12'\n "
|
131
131
|
rdoc_options: []
|
132
132
|
|
133
133
|
require_paths:
|
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
153
|
requirements: []
|
154
154
|
|
155
155
|
rubyforge_project:
|
156
|
-
rubygems_version: 1.
|
156
|
+
rubygems_version: 1.4.2
|
157
157
|
signing_key:
|
158
158
|
specification_version: 3
|
159
159
|
summary: Simple asset management (images and other uploads) for Radiant CMS
|