Skip to content

Commit

Permalink
bundler-generated gem build infrastructure
Browse files Browse the repository at this point in the history
- 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
gerrit committed Dec 3, 2011
1 parent ee448ef commit a64b7ec
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 12 deletions.
17 changes: 17 additions & 0 deletions .gitignore
@@ -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
4 changes: 4 additions & 0 deletions Gemfile
@@ -0,0 +1,4 @@
source 'http://rubygems.org'

# Specify your gem's dependencies in radiant-stereotype-extension.gemspec
gemspec
31 changes: 20 additions & 11 deletions Rakefile
@@ -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 # 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. # In rails 1.2, plugins aren't available in the path until they're loaded.
Expand All @@ -7,28 +11,33 @@
# Determine where the RSpec plugin is by loading the boot # Determine where the RSpec plugin is by loading the boot
unless defined? RADIANT_ROOT unless defined? RADIANT_ROOT
ENV["RAILS_ENV"] = "test" ENV["RAILS_ENV"] = "test"
case boot = if ENV["RADIANT_ENV_FILE"]
when ENV["RADIANT_ENV_FILE"] File.dirname(ENV["RADIANT_ENV_FILE"]) + "/boot"
require File.dirname(ENV["RADIANT_ENV_FILE"]) + "/boot" elsif File.dirname(__FILE__) =~ %r{vendor/radiant/vendor/extensions}
when File.dirname(__FILE__) =~ %r{vendor/radiant/vendor/extensions} "#{File.expand_path(File.dirname(__FILE__) + "/../../../../../")}/config/boot"
require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../../")}/config/boot"
else 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
end end


require 'rake' require 'rake'
require 'rake/rdoctask' require 'rake/rdoctask'
require 'rake/testtask' require 'rake/testtask'


rspec_base = File.expand_path(RADIANT_ROOT + '/vendor/plugins/rspec/lib') if defined? RADIANT_ROOT
$LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base) 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/rake/spectask'
# require 'spec/translator' # 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__)) extension_root = File.expand_path(File.dirname(__FILE__))


task :default => :spec task :default => :spec
Expand Down
9 changes: 9 additions & 0 deletions lib/radiant-stereotype-extension.rb
@@ -0,0 +1,9 @@
require "radiant-stereotype-extension/version"

module Radiant
module Stereotype
module Extension
# Your code goes here...
end
end
end
7 changes: 7 additions & 0 deletions lib/radiant-stereotype-extension/version.rb
@@ -0,0 +1,7 @@
module Radiant
module Stereotype
module Extension
VERSION = '0.9'
end
end
end
17 changes: 17 additions & 0 deletions radiant-stereotype-extension.gemspec
@@ -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
3 changes: 2 additions & 1 deletion stereotype_extension.rb
@@ -1,7 +1,8 @@
require_dependency 'application_controller' require_dependency 'application_controller'
require 'radiant-stereotype-extension/version'


class StereotypeExtension < Radiant::Extension 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." description "Define templates for Pages' children in Radiant CMS."
url "http://blog.aissac.ro/radiant/stereotype-extension/" url "http://blog.aissac.ro/radiant/stereotype-extension/"


Expand Down

0 comments on commit a64b7ec

Please sign in to comment.