Permalink
Browse files

bundler-generated gem build infrastructure

- moved version from extension definition file to version.rb
- changed Rakefile so it would run without being vendored in a radiant project (e.g. for gem distribution)
  • Loading branch information...
1 parent ee448ef commit a64b7ec8ae813df45bcf7a56bc314896c2990a43 @gerrit committed Dec 3, 2011
View
@@ -0,0 +1,17 @@
+*.gem
+*.rbc
+.bundle
+.config
+.yardoc
+Gemfile.lock
+InstalledFiles
+_yardoc
+coverage
+doc/
+lib/bundler/man
+pkg
+rdoc
+spec/reports
+test/tmp
+test/version_tmp
+tmp
View
@@ -0,0 +1,4 @@
+source 'http://rubygems.org'
+
+# Specify your gem's dependencies in radiant-stereotype-extension.gemspec
+gemspec
View
@@ -1,3 +1,7 @@
+#!/usr/bin/env rake
+# -*- encoding: utf-8 -*-
+require "bundler/gem_tasks"
+
# 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.
@@ -7,28 +11,33 @@
# 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"
+ boot = if ENV["RADIANT_ENV_FILE"]
+ File.dirname(ENV["RADIANT_ENV_FILE"]) + "/boot"
+ elsif File.dirname(__FILE__) =~ %r{vendor/radiant/vendor/extensions}
+ "#{File.expand_path(File.dirname(__FILE__) + "/../../../../../")}/config/boot"
else
- require "#{File.expand_path(File.dirname(__FILE__) + "/../../../")}/config/boot"
+ "#{File.expand_path(File.dirname(__FILE__) + "/../../../")}/config/boot"
+ end
+ begin
+ require boot
+ rescue LoadError => e
+ warn "Can’t boot radiant, #{e.message}"
end
end
require 'rake'
require 'rake/rdoctask'
require 'rake/testtask'
-rspec_base = File.expand_path(RADIANT_ROOT + '/vendor/plugins/rspec/lib')
-$LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base)
+if defined? RADIANT_ROOT
+ rspec_base = File.expand_path(RADIANT_ROOT + '/vendor/plugins/rspec/lib')
+ $LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base)
+ # Cleanup the RADIANT_ROOT constant so specs will load the environment
+ Object.send(:remove_const, :RADIANT_ROOT)
+end
require 'spec/rake/spectask'
# require 'spec/translator'
-# 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
@@ -0,0 +1,9 @@
+require "radiant-stereotype-extension/version"
+
+module Radiant
+ module Stereotype
+ module Extension
+ # Your code goes here...
+ end
+ end
+end
@@ -0,0 +1,7 @@
+module Radiant
+ module Stereotype
+ module Extension
+ VERSION = '0.9'
+ end
+ end
+end
@@ -0,0 +1,17 @@
+# -*- encoding: utf-8 -*-
+require File.expand_path('../lib/radiant-stereotype-extension/version', __FILE__)
+
+Gem::Specification.new do |gem|
+ gem.authors = ['Cristi Duma', 'Istvan Hoka']
+ gem.email = ['cristi.duma@aissac.ro']
+ gem.description = %q{Allows you to write code that determines default page types, layouts, filters etc. for newly created pages}
+ gem.summary = %q{Extension that adds templating support to Radiant CMS}
+ gem.homepage = "http://blog.aissac.ro/radiant/stereotype-extension/"
+
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ gem.files = `git ls-files`.split("\n")
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ gem.name = "radiant-stereotype-extension"
+ gem.require_paths = ["lib"]
+ gem.version = Radiant::Stereotype::Extension::VERSION
+end
View
@@ -1,7 +1,8 @@
require_dependency 'application_controller'
+require 'radiant-stereotype-extension/version'
class StereotypeExtension < Radiant::Extension
- version "0.9" # this version is compatible with Radiant 0.9
+ version Radiant::Stereotype::Extension::VERSION
description "Define templates for Pages' children in Radiant CMS."
url "http://blog.aissac.ro/radiant/stereotype-extension/"

0 comments on commit a64b7ec

Please sign in to comment.