radiant-assets-extension 0.0.10 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,117 +1 @@
1
- # Determine where the RSpec plugin is by loading the boot
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"
@@ -1,3 +1,4 @@
1
+ # -*- encoding: utf-8 -*-
1
2
  class Admin::AssetsController < Admin::ResourceController
2
3
  include Admin::UploadHandler
3
4
  paginate_models
@@ -1,3 +1,4 @@
1
+ # -*- encoding: utf-8 -*-
1
2
  class Admin::AttachmentsController < Admin::ResourceController
2
3
  include Admin::UploadHandler
3
4
 
@@ -1,3 +1,4 @@
1
+ # -*- encoding: utf-8 -*-
1
2
  module Admin::UploadHandler
2
3
  private
3
4
  # HACK: sending JSON as text/html
@@ -1,3 +1,4 @@
1
+ # -*- encoding: utf-8 -*-
1
2
  module AssetsHelper
2
3
  def asset_listing(asset)
3
4
  asset_icon(asset) +
@@ -1,3 +1,4 @@
1
+ # -*- encoding: utf-8 -*-
1
2
  class Asset < ActiveRecord::Base
2
3
  has_many :attachments, :as => :attachable, :dependent => :destroy
3
4
 
@@ -1,3 +1,4 @@
1
+ # -*- encoding: utf-8 -*-
1
2
  module AssetTags
2
3
  include Radiant::Taggable
3
4
  class TagError < StandardError;end
@@ -1,3 +1,4 @@
1
+ # -*- encoding: utf-8 -*-
1
2
  require 'acts_as_list'
2
3
 
3
4
  class Attachment < ActiveRecord::Base
@@ -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'] if 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,3 +1,4 @@
1
+ # -*- encoding: utf-8 -*-
1
2
  class AddImagesTable < ActiveRecord::Migration
2
3
  def self.up
3
4
  create_table :images do |table|
@@ -1,3 +1,4 @@
1
+ # -*- encoding: utf-8 -*-
1
2
  class AddCaption < ActiveRecord::Migration
2
3
  def self.up
3
4
  add_column :images, :caption, :string
@@ -1,3 +1,4 @@
1
+ # -*- encoding: utf-8 -*-
1
2
  class RenameModelClass < ActiveRecord::Migration
2
3
  def self.up
3
4
  rename_table :images, :assets
@@ -1,3 +1,4 @@
1
+ # -*- encoding: utf-8 -*-
1
2
  class AddCachingColumnsToAsset < ActiveRecord::Migration
2
3
  def self.up
3
4
  add_column :assets, :upload_name, :string
@@ -1,3 +1,4 @@
1
+ # -*- encoding: utf-8 -*-
1
2
  class AddAttachmentToPages < ActiveRecord::Migration
2
3
  def self.up
3
4
  create_table :attachments do |t|
@@ -1,3 +1,4 @@
1
+ # -*- encoding: utf-8 -*-
1
2
  class AddTimestampsAndLockingToAssets < ActiveRecord::Migration
2
3
  def self.up
3
4
  add_column :assets, :lock_version, :integer, :default => 0
@@ -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(:include => :attachments).each do |page|
5
- page.attachments.each_with_index do |attachment, index|
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
- Attachment.update_all 'parent_type = "Page"'
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
- Attachment.update_all 'attachable_type = "Asset"'
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
@@ -1,3 +1,4 @@
1
+ # -*- encoding: utf-8 -*-
1
2
  module RadiantAssetsExtension
2
- VERSION = '0.0.10'
3
+ VERSION = '0.0.12'
3
4
  end
@@ -1,3 +1,4 @@
1
+ # -*- encoding: utf-8 -*-
1
2
  require 'dragonfly'
2
3
  require 'aws/s3'
3
4
 
@@ -1,3 +1,4 @@
1
+ # -*- encoding: utf-8 -*-
1
2
  namespace :radiant do
2
3
  namespace :extensions do
3
4
  namespace :assets do
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: 11
5
- prerelease: false
4
+ hash: 7
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 10
10
- version: 0.0.10
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-04-21 00:00:00 +01:00
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.10'\n "
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.3.7
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