Permalink
Browse files

updated to standard extension files

  • Loading branch information...
1 parent a3fb438 commit d29469a3d58d6ba6eab1bca29e05baf398e19476 @saturnflyer saturnflyer committed Jun 1, 2011
View
@@ -1,36 +1,32 @@
-begin
- require 'jeweler'
- Jeweler::Tasks.new do |gem|
- gem.name = "radiant-assets-extension"
- gem.summary = %Q{Assets extension for Radiant CMS}
- gem.description = %Q{Assets extension based Keith Bingman's excellent Paperclipped extension.}
- gem.email = "me@johnwlong.com"
- gem.homepage = "https://github.com/radiant/radiant-assets-extension"
- gem.authors = ["Keith Bingman", "Benny Degezelle", "William Ross", "John W. Long"]
- gem.add_dependency 'radiant', ">= 0.9.1"
- gem.add_dependency 'paperclip', "~> 2.3.3"
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
+# Determine where the RSpec plugin is by loading the boot
+unless defined? RADIANT_ROOT
+ ENV["RAILS_ENV"] = "test"
+ case
+ when ENV["RADIANT_ENV_FILE"]
+ require File.dirname(ENV["RADIANT_ENV_FILE"]) + "/boot"
+ when File.dirname(__FILE__) =~ %r{vendor/radiant/vendor/extensions}
+ require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../../")}/config/boot"
+ else
+ require "#{File.expand_path(File.dirname(__FILE__) + "/../../../")}/config/boot"
end
-rescue LoadError
- puts "Jeweler (or a dependency) not available. This is only required if you plan to package assets as a gem."
end
-# I think this is the one that should be moved to the extension Rakefile template
-# In rails 1.2, plugins aren't available in the path until they're loaded.
-# Check to see if the rspec plugin is installed first and require
-# it if it is. If not, use the gem version.
-require File.join(File.dirname(__FILE__), '..', '..', '..', 'config', 'boot')
require 'rake'
require 'rake/rdoctask'
+require 'rake/testtask'
-rspec_base = File.expand_path(File.dirname(__FILE__) + '/../../radiant/vendor/plugins/rspec/lib')
+rspec_base = File.expand_path(RADIANT_ROOT + '/vendor/plugins/rspec/lib')
$LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base)
require 'spec/rake/spectask'
-# require 'spec/translator'
+require 'cucumber'
+require 'cucumber/rake/task'
+
+# Cleanup the RADIANT_ROOT constant so specs will load the environment
+Object.send(:remove_const, :RADIANT_ROOT)
extension_root = File.expand_path(File.dirname(__FILE__))
-task :default => :spec
+task :default => [:spec, :features]
task :stats => "spec:statsetup"
desc "Run all specs in spec directory"
@@ -39,6 +35,8 @@ Spec::Rake::SpecTask.new(:spec) do |t|
t.spec_files = FileList['spec/**/*_spec.rb']
end
+task :features => 'spec:integration'
+
namespace :spec do
desc "Run all specs in spec directory with RCov"
Spec::Rake::SpecTask.new(:rcov) do |t|
@@ -62,13 +60,13 @@ namespace :spec do
end
end
- # Hopefully no one has written their extensions in pre-0.9 style
- # desc "Translate specs from pre-0.9 to 0.9 style"
- # task :translate do
- # translator = ::Spec::Translator.new
- # dir = RAILS_ROOT + '/spec'
- # translator.translate(dir, dir)
- # end
+ desc "Run the Cucumber features"
+ Cucumber::Rake::Task.new(:integration) do |t|
+ t.fork = true
+ t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'pretty')]
+ # t.feature_pattern = "#{extension_root}/features/**/*.feature"
+ t.profile = "default"
+ end
# Setup specs for stats
task :statsetup do
@@ -101,7 +99,7 @@ end
desc 'Generate documentation for the assets extension.'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
- rdoc.title = 'PaperclippedExtension'
+ rdoc.title = 'AssetsExtension'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README')
rdoc.rdoc_files.include('lib/**/*.rb')
View
@@ -1,7 +1,7 @@
require_dependency 'application_controller'
-
+require 'radiant-assets-extension/version'
class AssetsExtension < Radiant::Extension
- version "1.0.0.rc1"
+ version RadiantAssetsExtension::VERSION
description "Assets extension based Keith Bingman's original Paperclipped extension."
url "http://github.com/radiant/radiant-assets-extension"
View
@@ -0,0 +1 @@
+default: --format progress features --tags ~@proposed,~@in_progress
@@ -0,0 +1,11 @@
+# Sets up the Rails environment for Cucumber
+ENV["RAILS_ENV"] = "test"
+# Extension root
+extension_env = File.expand_path(File.dirname(__FILE__) + '/../../../../../config/environment')
+require extension_env+'.rb'
+
+Dir.glob(File.join(RADIANT_ROOT, "features", "**", "*.rb")).each {|step| require step unless step =~ /datasets_loader\.rb$/}
+
+Cucumber::Rails::World.class_eval do
+ dataset :assets
+end
@@ -0,0 +1,22 @@
+module NavigationHelpers
+
+ # Extend the standard PathMatchers with your own paths
+ # to be used in your features.
+ #
+ # The keys and values here may be used in your standard web steps
+ # Using:
+ #
+ # When I go to the "assets" admin page
+ #
+ # would direct the request to the path you provide in the value:
+ #
+ # admin_assets_path
+ #
+ PathMatchers = {} unless defined?(PathMatchers)
+ PathMatchers.merge!({
+ # /assets/i => 'admin_assets_path'
+ })
+
+end
+
+World(NavigationHelpers)
@@ -0,0 +1,2 @@
+module RadiantAssetsExtension
+end
@@ -0,0 +1,3 @@
+module RadiantAssetsExtension
+ VERSION = '1.0.0.rc1'
+end
@@ -0,0 +1,33 @@
+# -*- encoding: utf-8 -*-
+$:.push File.expand_path("../lib", __FILE__)
+require "radiant-assets-extension/version"
+
+Gem::Specification.new do |s|
+ s.name = "radiant-assets-extension"
+ s.version = RadiantAssetsExtension::VERSION
+ s.platform = Gem::Platform::RUBY
+ s.authors = ["Keith Bingman", "Benny Degezelle", "William Ross", "John W. Long"]
+ s.email = ["radiant@radiantcms.org"]
+ s.homepage = "http://radiantcms.org"
+ s.summary = %q{Assets for Radiant CMS}
+ s.description = %q{Assets extension based Keith Bingman's excellent Paperclipped extension.}
+
+ ignores = if File.exist?('.gitignore')
+ File.read('.gitignore').split("\n").inject([]) {|a,p| a + Dir[p] }
+ else
+ []
+ end
+ s.files = Dir['**/*'] - ignores
+ s.test_files = Dir['test/**/*','spec/**/*','features/**/*'] - ignores
+ # s.executables = Dir['bin/*'] - ignores
+ s.require_paths = ["lib"]
+
+ s.post_install_message = %{
+ Add this to your radiant project with:
+ config.gem 'radiant-assets-extension', :version => '~>#{RadiantAssetsExtension::VERSION}'
+ }
+
+ gem.add_dependency 'acts_as_list'
+ gem.add_dependency 'paperclip', "~> 2.3.3"
+ gem.add_dependency 'uuidtools'
+end

2 comments on commit d29469a

@saturnflyer
Member

running gem build radiant-assets-extension.gemspec is failing for me, but I'm pushing this up to make it public

And I think we should still plan to rename the repo

@spanner
spanner commented on d29469a Jun 1, 2011

thanks. and yes. I've been away but can get that sorted out now.

Please sign in to comment.