This repository has been archived by the owner on May 9, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created extension with basic configuration
- Loading branch information
0 parents
commit b1c66b7
Showing
15 changed files
with
327 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
*.gem | ||
*.rbc | ||
.bundle | ||
.config | ||
coverage | ||
InstalledFiles | ||
lib/bundler/man | ||
pkg | ||
rdoc | ||
spec/reports | ||
test/tmp | ||
test/version_tmp | ||
tmp | ||
|
||
# YARD artifacts | ||
.yardoc | ||
_yardoc | ||
doc/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# DT Config | ||
|
||
Some basic settings for the [DramaTech Theat(er|re)](http://dramatech.org) | ||
website. There's not much to see here. Move along now. | ||
|
||
Created by [Sam Whited](https://samwhited.com). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
# 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 | ||
end | ||
|
||
require 'rake' | ||
require 'rdoc/task' | ||
require 'rake/testtask' | ||
|
||
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 '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, :features] | ||
task :stats => "spec:statsetup" | ||
|
||
desc "Run all specs in spec directory" | ||
Spec::Rake::SpecTask.new(:spec) do |t| | ||
t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""] | ||
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| | ||
t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""] | ||
t.spec_files = FileList['spec/**/*_spec.rb'] | ||
t.rcov = true | ||
t.rcov_opts = ['--exclude', 'spec', '--rails'] | ||
end | ||
|
||
desc "Print Specdoc for all specs" | ||
Spec::Rake::SpecTask.new(:doc) do |t| | ||
t.spec_opts = ["--format", "specdoc", "--dry-run"] | ||
t.spec_files = FileList['spec/**/*_spec.rb'] | ||
end | ||
|
||
[:models, :controllers, :views, :helpers].each do |sub| | ||
desc "Run the specs under spec/#{sub}" | ||
Spec::Rake::SpecTask.new(sub) do |t| | ||
t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""] | ||
t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"] | ||
end | ||
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 | ||
require 'code_statistics' | ||
::STATS_DIRECTORIES << %w(Model\ specs spec/models) | ||
::STATS_DIRECTORIES << %w(View\ specs spec/views) | ||
::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers) | ||
::STATS_DIRECTORIES << %w(Helper\ specs spec/views) | ||
::CodeStatistics::TEST_TYPES << "Model specs" | ||
::CodeStatistics::TEST_TYPES << "View specs" | ||
::CodeStatistics::TEST_TYPES << "Controller specs" | ||
::CodeStatistics::TEST_TYPES << "Helper specs" | ||
::STATS_DIRECTORIES.delete_if {|a| a[0] =~ /test/} | ||
end | ||
|
||
namespace :db do | ||
namespace :fixtures do | ||
desc "Load fixtures (from spec/fixtures) into the current environment's database. Load specific fixtures using FIXTURES=x,y" | ||
task :load => :environment do | ||
require 'active_record/fixtures' | ||
ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym) | ||
(ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(RAILS_ROOT, 'spec', 'fixtures', '*.{yml,csv}'))).each do |fixture_file| | ||
Fixtures.create_fixtures('spec/fixtures', File.basename(fixture_file, '.*')) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
desc 'Generate documentation for the dtconfig extension.' | ||
RDoc::Task.new(:rdoc) do |rdoc| | ||
rdoc.rdoc_dir = 'rdoc' | ||
rdoc.title = 'DtconfigExtension' | ||
rdoc.options << '--line-numbers' << '--inline-source' | ||
rdoc.rdoc_files.include('README') | ||
rdoc.rdoc_files.include('lib/**/*.rb') | ||
end | ||
|
||
# Load any custom rakefiles for extension | ||
Dir[File.dirname(__FILE__) + '/tasks/*.rake'].sort.each { |f| require f } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Radiant.config do |config| | ||
# config.define "setting.name", :default => 'value', :select_from => ['foo', 'bar'] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
en: | ||
dtconfig: Dtconfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
ActionController::Routing::Routes.draw do |map| | ||
# map.namespace :admin, :member => { :remove => :get } do |admin| | ||
# admin.resources :dtconfig | ||
# end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
default: --format progress features --tags ~@proposed,~@in_progress |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Uncomment this if you reference any of your controllers in activate | ||
# require_dependency "application_controller" | ||
require "radiant-dtconfig-extension" | ||
|
||
class DtconfigExtension < Radiant::Extension | ||
version RadiantDtconfigExtension::VERSION | ||
description RadiantDtconfigExtension::DESCRIPTION | ||
url RadiantDtconfigExtension::URL | ||
|
||
# See your config/routes.rb file in this extension to define custom routes | ||
|
||
extension_config do |config| | ||
end | ||
|
||
def activate | ||
# Set the types of meetings that the minutes extension should display | ||
MinutesExtension.meeting_types = ['Club', 'EC', 'PPM', 'Open House', 'Banquet', 'Historian', 'Social', 'Other'] unless not defined? MinutesExtension | ||
|
||
# Set the title of the admin interface | ||
Radiant::Config['admin.title'] = 'DramaTech Theat(er|re)' if Radiant::Config['admin.title'] =~ /Radiant CMS/ | ||
Radiant::Config['admin.subtitle'] = 'Music, theater, toasters' if Radiant::Config['admin.subtitle'] =~ /Publishing for Small Teams/ | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 :dtconfig | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 "dtconfig" admin page | ||
# | ||
# would direct the request to the path you provide in the value: | ||
# | ||
# admin_dtconfig_path | ||
# | ||
PathMatchers = {} unless defined?(PathMatchers) | ||
PathMatchers.merge!({ | ||
# /dtconfig/i => 'admin_dtconfig_path' | ||
}) | ||
|
||
end | ||
|
||
World(NavigationHelpers) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module RadiantDtconfigExtension | ||
VERSION = "1.0.0" | ||
SUMMARY = "Custom RadiantCMS configuration for DT" | ||
DESCRIPTION = "Custom RadiantCMS config for DramaTech" | ||
URL = "http://dramatech.org" | ||
AUTHORS = ["Sam Whited"] | ||
EMAIL = ["[email protected]"] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
namespace :radiant do | ||
namespace :extensions do | ||
namespace :dtconfig do | ||
|
||
desc "Runs the migration of the Dtconfig extension" | ||
task :migrate => :environment do | ||
require 'radiant/extension_migrator' | ||
if ENV["VERSION"] | ||
DtconfigExtension.migrator.migrate(ENV["VERSION"].to_i) | ||
Rake::Task['db:schema:dump'].invoke | ||
else | ||
DtconfigExtension.migrator.migrate | ||
Rake::Task['db:schema:dump'].invoke | ||
end | ||
end | ||
|
||
desc "Copies public assets of the Dtconfig to the instance public/ directory." | ||
task :update => :environment do | ||
is_svn_or_dir = proc {|path| path =~ /\.svn/ || File.directory?(path) } | ||
puts "Copying assets from DtconfigExtension" | ||
Dir[DtconfigExtension.root + "/public/**/*"].reject(&is_svn_or_dir).each do |file| | ||
path = file.sub(DtconfigExtension.root, '') | ||
directory = File.dirname(path) | ||
mkdir_p RAILS_ROOT + directory, :verbose => false | ||
cp file, RAILS_ROOT + path, :verbose => false | ||
end | ||
end | ||
|
||
desc "Syncs all available translations for this ext to the English ext master" | ||
task :sync => :environment do | ||
# The main translation root, basically where English is kept | ||
language_root = DtconfigExtension.root + "/config/locales" | ||
words = TranslationSupport.get_translation_keys(language_root) | ||
|
||
Dir["#{language_root}/*.yml"].each do |filename| | ||
next if filename.match('_available_tags') | ||
basename = File.basename(filename, '.yml') | ||
puts "Syncing #{basename}" | ||
(comments, other) = TranslationSupport.read_file(filename, basename) | ||
words.each { |k,v| other[k] ||= words[k] } # Initializing hash variable as empty if it does not exist | ||
other.delete_if { |k,v| !words[k] } # Remove if not defined in en.yml | ||
TranslationSupport.write_file(filename, basename, comments, other) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# -*- encoding: utf-8 -*- | ||
$:.push File.expand_path("../lib", __FILE__) | ||
require "radiant-dtconfig-extension" | ||
|
||
Gem::Specification.new do |s| | ||
s.name = "radiant-dtconfig-extension" | ||
s.version = RadiantDtconfigExtension::VERSION | ||
s.platform = Gem::Platform::RUBY | ||
s.authors = RadiantDtconfigExtension::AUTHORS | ||
s.email = RadiantDtconfigExtension::EMAIL | ||
s.homepage = RadiantDtconfigExtension::URL | ||
s.summary = RadiantDtconfigExtension::SUMMARY | ||
s.description = RadiantDtconfigExtension::DESCRIPTION | ||
|
||
# Define gem dependencies here. | ||
# Don't include a dependency on radiant itself: it causes problems when radiant is in vendor/radiant. | ||
# s.add_dependency "something", "~> 1.0.0" | ||
# s.add_dependency "radiant-some-extension", "~> 1.0.0" | ||
|
||
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"] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--colour | ||
--format | ||
progress | ||
--loadby | ||
mtime | ||
--reverse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
unless defined? RADIANT_ROOT | ||
ENV["RAILS_ENV"] = "test" | ||
case | ||
when ENV["RADIANT_ENV_FILE"] | ||
require ENV["RADIANT_ENV_FILE"] | ||
when File.dirname(__FILE__) =~ %r{vendor/radiant/vendor/extensions} | ||
require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../../../")}/config/environment" | ||
else | ||
require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../")}/config/environment" | ||
end | ||
end | ||
require "#{RADIANT_ROOT}/spec/spec_helper" | ||
|
||
Dataset::Resolver.default << (File.dirname(__FILE__) + "/datasets") | ||
|
||
if File.directory?(File.dirname(__FILE__) + "/matchers") | ||
Dir[File.dirname(__FILE__) + "/matchers/*.rb"].each {|file| require file } | ||
end | ||
|
||
Spec::Runner.configure do |config| | ||
# config.use_transactional_fixtures = true | ||
# config.use_instantiated_fixtures = false | ||
# config.fixture_path = RAILS_ROOT + '/spec/fixtures' | ||
|
||
# You can declare fixtures for each behaviour like this: | ||
# describe "...." do | ||
# fixtures :table_a, :table_b | ||
# | ||
# Alternatively, if you prefer to declare them only once, you can | ||
# do so here, like so ... | ||
# | ||
# config.global_fixtures = :table_a, :table_b | ||
# | ||
# If you declare global fixtures, be aware that they will be declared | ||
# for all of your examples, even those that don't use them. | ||
end |