radiant-vapor-extension 2.1.2 → 2.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/README.md +15 -0
- data/Rakefile +20 -46
- data/app/metal/vapor_flow.rb +7 -3
- data/app/views/admin/flow_meters/index.html.haml +11 -11
- data/app/views/admin/pages/_vapor_details.html.haml +3 -5
- data/config/initializers/radiant_config.rb +3 -0
- data/config/locales/en.yml +18 -0
- data/config/routes.rb +5 -0
- data/cucumber.yml +1 -0
- data/features/support/env.rb +11 -0
- data/features/support/paths.rb +22 -0
- data/lib/radiant-vapor-extension.rb +8 -0
- data/lib/tasks/vapor_extension_tasks.rake +22 -3
- data/lib/vaporizer.rb +5 -5
- data/radiant-vapor-extension.gemspec +24 -0
- data/spec/ci/before_script +23 -0
- data/spec/ci/script +2 -0
- data/spec/controllers/admin/flow_meters_controller_spec.rb +1 -1
- data/spec/metal/vapor_flow_spec.rb +21 -2
- data/spec/models/flow_meter_spec.rb +5 -5
- data/spec/models/page_spec.rb +7 -2
- data/spec/{spec_helper.rb → vapor_spec_helper.rb} +2 -3
- data/vapor_extension.rb +6 -16
- metadata +50 -37
- data/.document +0 -5
- data/.gitignore +0 -7
- data/README.rdoc +0 -11
data/LICENSE
CHANGED
data/README.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# Vapor
|
2
|
+
|
3
|
+
The Vapor extension provides an interface to redirect URLs.
|
4
|
+
|
5
|
+
Installing Vapor is as easy as any other Radiant extension. Add it to your Gemfile with:
|
6
|
+
|
7
|
+
gem "radiant-vapor-extension"
|
8
|
+
|
9
|
+
And then (after `bundle install`) add the database tables:
|
10
|
+
|
11
|
+
rake radiant:extensions:vapor:migrate
|
12
|
+
|
13
|
+
See the HELP_admin.md for more details.
|
14
|
+
|
15
|
+
built by [Saturn Flyer](http://www.saturnflyer.com)
|
data/Rakefile
CHANGED
@@ -1,23 +1,3 @@
|
|
1
|
-
require 'rake'
|
2
|
-
|
3
|
-
begin
|
4
|
-
require 'jeweler'
|
5
|
-
Jeweler::Tasks.new do |gem|
|
6
|
-
gem.name = "radiant-vapor-extension"
|
7
|
-
gem.summary = %Q{Provides an interface to redirect URLs in RadiantCMS}
|
8
|
-
gem.description = %Q{Provides an interface to redirect URLs in RadiantCMS}
|
9
|
-
gem.email = "jim@saturnflyer.com"
|
10
|
-
gem.homepage = "http://github.com/saturnflyer/radiant-vapor-extension"
|
11
|
-
gem.authors = ["Jim Gay"]
|
12
|
-
gem.add_development_dependency "radiant"
|
13
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
14
|
-
end
|
15
|
-
rescue LoadError
|
16
|
-
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
17
|
-
end
|
18
|
-
|
19
|
-
# task :test => :check_dependencies
|
20
|
-
|
21
1
|
# Determine where the RSpec plugin is by loading the boot
|
22
2
|
unless defined? RADIANT_ROOT
|
23
3
|
ENV["RAILS_ENV"] = "test"
|
@@ -27,28 +7,26 @@ unless defined? RADIANT_ROOT
|
|
27
7
|
when File.dirname(__FILE__) =~ %r{vendor/radiant/vendor/extensions}
|
28
8
|
require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../../")}/config/boot"
|
29
9
|
else
|
30
|
-
|
31
|
-
require boot_path if File.exist?(boot_path)
|
10
|
+
require "#{File.expand_path(File.dirname(__FILE__) + "/../../../")}/config/boot"
|
32
11
|
end
|
33
12
|
end
|
34
13
|
|
35
14
|
require 'rake'
|
36
|
-
require '
|
15
|
+
require 'rdoc/task'
|
37
16
|
require 'rake/testtask'
|
38
17
|
|
39
|
-
|
40
|
-
|
41
|
-
$LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base)
|
42
|
-
end
|
43
|
-
|
18
|
+
rspec_base = File.expand_path(RADIANT_ROOT + '/vendor/plugins/rspec/lib')
|
19
|
+
$LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base)
|
44
20
|
require 'spec/rake/spectask'
|
21
|
+
require 'cucumber'
|
22
|
+
require 'cucumber/rake/task'
|
45
23
|
|
46
24
|
# Cleanup the RADIANT_ROOT constant so specs will load the environment
|
47
|
-
Object.send(:remove_const, :RADIANT_ROOT)
|
25
|
+
Object.send(:remove_const, :RADIANT_ROOT)
|
48
26
|
|
49
27
|
extension_root = File.expand_path(File.dirname(__FILE__))
|
50
28
|
|
51
|
-
task :default => :spec
|
29
|
+
task :default => [:spec, :features]
|
52
30
|
task :stats => "spec:statsetup"
|
53
31
|
|
54
32
|
desc "Run all specs in spec directory"
|
@@ -57,6 +35,8 @@ Spec::Rake::SpecTask.new(:spec) do |t|
|
|
57
35
|
t.spec_files = FileList['spec/**/*_spec.rb']
|
58
36
|
end
|
59
37
|
|
38
|
+
task :features => 'spec:integration'
|
39
|
+
|
60
40
|
namespace :spec do
|
61
41
|
desc "Run all specs in spec directory with RCov"
|
62
42
|
Spec::Rake::SpecTask.new(:rcov) do |t|
|
@@ -79,6 +59,14 @@ namespace :spec do
|
|
79
59
|
t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"]
|
80
60
|
end
|
81
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
|
82
70
|
|
83
71
|
# Setup specs for stats
|
84
72
|
task :statsetup do
|
@@ -109,27 +97,13 @@ namespace :spec do
|
|
109
97
|
end
|
110
98
|
|
111
99
|
desc 'Generate documentation for the vapor extension.'
|
112
|
-
|
113
|
-
if File.exist?('VERSION')
|
114
|
-
version = File.read('VERSION')
|
115
|
-
else
|
116
|
-
version = ""
|
117
|
-
end
|
118
|
-
|
100
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
119
101
|
rdoc.rdoc_dir = 'rdoc'
|
120
|
-
rdoc.title =
|
102
|
+
rdoc.title = 'VaporExtension'
|
121
103
|
rdoc.options << '--line-numbers' << '--inline-source'
|
122
104
|
rdoc.rdoc_files.include('README')
|
123
105
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
124
106
|
end
|
125
107
|
|
126
|
-
# For extensions that are in transition
|
127
|
-
desc 'Test the vapor extension.'
|
128
|
-
Rake::TestTask.new(:test) do |t|
|
129
|
-
t.libs << 'lib'
|
130
|
-
t.pattern = 'test/**/*_test.rb'
|
131
|
-
t.verbose = true
|
132
|
-
end
|
133
|
-
|
134
108
|
# Load any custom rakefiles for extension
|
135
109
|
Dir[File.dirname(__FILE__) + '/tasks/*.rake'].sort.each { |f| require f }
|
data/app/metal/vapor_flow.rb
CHANGED
@@ -7,10 +7,14 @@ class VaporFlow
|
|
7
7
|
@@use_regexp = nil
|
8
8
|
class << self
|
9
9
|
def call(env)
|
10
|
-
|
10
|
+
url = env["PATH_INFO"]
|
11
|
+
|
12
|
+
if url.blank?
|
11
13
|
return send_to_radiant
|
12
14
|
end
|
13
|
-
|
15
|
+
|
16
|
+
url = url.sub(/^\//,'') unless url == '/' #clean off the first slash, like it is stored in the db
|
17
|
+
|
14
18
|
db_escaped_key = ActiveRecord::Base.connection.adapter_name =~ /mysql/i ? '`key`' : 'key'
|
15
19
|
sql = "SELECT * FROM config where #{db_escaped_key} = 'vapor.use_regexp'"
|
16
20
|
if @@use_regexp.nil?
|
@@ -56,4 +60,4 @@ class VaporFlow
|
|
56
60
|
[404, {'Content-Type' => 'text/html'}, ['Off to Radiant we go!']]
|
57
61
|
end
|
58
62
|
end
|
59
|
-
end
|
63
|
+
end
|
@@ -3,23 +3,23 @@
|
|
3
3
|
%table.index
|
4
4
|
%thead
|
5
5
|
%tr
|
6
|
-
%th
|
7
|
-
%th
|
8
|
-
%th
|
9
|
-
%th
|
6
|
+
%th= t('vapor.catch_url')
|
7
|
+
%th= t('vapor.redirect_url')
|
8
|
+
%th= t('status')
|
9
|
+
%th= t('vapor.action')
|
10
10
|
%tbody
|
11
11
|
- @flow_meters.each do |flow_meter|
|
12
12
|
%tr
|
13
13
|
%td= flow_meter.catch_url_for_display
|
14
14
|
%td= flow_meter.redirect_url_for_display
|
15
15
|
%td= flow_meter.status
|
16
|
-
%td= link_to
|
16
|
+
%td= link_to t('vapor.delete'), admin_flow_meter_path(flow_meter), :method => :delete
|
17
17
|
%tr
|
18
|
-
%td= f.text_field :catch_url
|
18
|
+
%td= f.text_field :catch_url, :value => params[:new_catch]
|
19
19
|
%td= f.text_field :redirect_url
|
20
|
-
%td= f.select :status, ['307
|
21
|
-
%td= submit_tag
|
22
|
-
%p
|
20
|
+
%td= f.select :status, [t('vapor.http_statuses.307'), t('vapor.http_statuses.302'), t('vapor.http_statuses.301')].reverse
|
21
|
+
%td= submit_tag t('vapor.create')
|
22
|
+
%p= t('vapor.description')
|
23
23
|
- if config['vapor.use_regexp'] == 'true'
|
24
|
-
%p
|
25
|
-
%p
|
24
|
+
%p= t('vapor.description_for_regexp')
|
25
|
+
%p= t('vapor.description_for_external_redirect')
|
@@ -1,11 +1,9 @@
|
|
1
1
|
- if !@page.new_record? && (flow_meter = @page.flow_meter)
|
2
2
|
%p
|
3
|
-
|
3
|
+
= t('vapor.visitors_redirected')
|
4
4
|
= link_to flow_meter.redirect_url_for_display, flow_meter.local_or_external_redirect_url
|
5
5
|
- if admin?
|
6
6
|
- unless config['vapor.use_regexp']
|
7
|
-
|
8
|
-
= link_to "remove", admin_flow_meter_path(flow_meter), :method => :delete
|
9
|
-
this redirect.
|
7
|
+
= link_to t('vapor.remove_this_redirect'), admin_flow_meter_path(flow_meter), :method => :delete
|
10
8
|
- else
|
11
|
-
= link_to
|
9
|
+
= link_to t('vapor.manage_traffic'), admin_flow_meters_path
|
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
en:
|
3
|
+
vapor:
|
4
|
+
catch_url: Catch URL
|
5
|
+
redirect_url: Redirect URL
|
6
|
+
action: Action
|
7
|
+
delete: Delete
|
8
|
+
create: Create
|
9
|
+
description: "With redirects you can create URLs that will point to content elsewhere on your site. Your 'Catch URL' is the part of the URL that will be processed to redirect to the final destination of your 'Redirect URL'."
|
10
|
+
description_for_regexp: "If the incoming request begins with any of your defined 'Catch URLs', the visitor will be redirected to the corresponding 'Redirect URL'. This means that you may protect an entire tree of your site simply by specifying the beginning of the URL."
|
11
|
+
description_for_external_redirect: "You may use a full url for the 'Redirect URL' to direct your visitors to another site."
|
12
|
+
http_statuses:
|
13
|
+
'307': '307 Temporary Redirect'
|
14
|
+
'302': '302 Found'
|
15
|
+
'301': '301 Moved Permanently'
|
16
|
+
visitors_redirected: 'Visitors to this page will redirected to'
|
17
|
+
manage_traffic: "Manage your traffic flow..."
|
18
|
+
remove_this_redirect: 'Remove this redirect.'
|
data/config/routes.rb
ADDED
data/cucumber.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
default: --format progress features --tags ~@proposed,~@in_progress
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# Sets up the Rails environment for Cucumber
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
# Extension root
|
4
|
+
extension_env = File.expand_path(File.dirname(__FILE__) + '/../../../../../config/environment')
|
5
|
+
require extension_env+'.rb'
|
6
|
+
|
7
|
+
Dir.glob(File.join(RADIANT_ROOT, "features", "**", "*.rb")).each {|step| require step unless step =~ /datasets_loader\.rb$/}
|
8
|
+
|
9
|
+
Cucumber::Rails::World.class_eval do
|
10
|
+
dataset :vapor
|
11
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module NavigationHelpers
|
2
|
+
|
3
|
+
# Extend the standard PathMatchers with your own paths
|
4
|
+
# to be used in your features.
|
5
|
+
#
|
6
|
+
# The keys and values here may be used in your standard web steps
|
7
|
+
# Using:
|
8
|
+
#
|
9
|
+
# When I go to the "vapor" admin page
|
10
|
+
#
|
11
|
+
# would direct the request to the path you provide in the value:
|
12
|
+
#
|
13
|
+
# admin_vapor_path
|
14
|
+
#
|
15
|
+
PathMatchers = {} unless defined?(PathMatchers)
|
16
|
+
PathMatchers.merge!({
|
17
|
+
# /vapor/i => 'admin_vapor_path'
|
18
|
+
})
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
World(NavigationHelpers)
|
@@ -7,22 +7,41 @@ namespace :radiant do
|
|
7
7
|
require 'radiant/extension_migrator'
|
8
8
|
if ENV["VERSION"]
|
9
9
|
VaporExtension.migrator.migrate(ENV["VERSION"].to_i)
|
10
|
+
Rake::Task['db:schema:dump'].invoke
|
10
11
|
else
|
11
12
|
VaporExtension.migrator.migrate
|
13
|
+
Rake::Task['db:schema:dump'].invoke
|
12
14
|
end
|
13
15
|
end
|
14
16
|
|
15
17
|
desc "Copies public assets of the Vapor to the instance public/ directory."
|
16
18
|
task :update => :environment do
|
17
19
|
is_svn_or_dir = proc {|path| path =~ /\.svn/ || File.directory?(path) }
|
20
|
+
puts "Copying assets from VaporExtension"
|
18
21
|
Dir[VaporExtension.root + "/public/**/*"].reject(&is_svn_or_dir).each do |file|
|
19
22
|
path = file.sub(VaporExtension.root, '')
|
20
23
|
directory = File.dirname(path)
|
21
|
-
|
22
|
-
|
23
|
-
cp file, RAILS_ROOT + path
|
24
|
+
mkdir_p RAILS_ROOT + directory, :verbose => false
|
25
|
+
cp file, RAILS_ROOT + path, :verbose => false
|
24
26
|
end
|
25
27
|
end
|
28
|
+
|
29
|
+
desc "Syncs all available translations for this ext to the English ext master"
|
30
|
+
task :sync => :environment do
|
31
|
+
# The main translation root, basically where English is kept
|
32
|
+
language_root = VaporExtension.root + "/config/locales"
|
33
|
+
words = TranslationSupport.get_translation_keys(language_root)
|
34
|
+
|
35
|
+
Dir["#{language_root}/*.yml"].each do |filename|
|
36
|
+
next if filename.match('_available_tags')
|
37
|
+
basename = File.basename(filename, '.yml')
|
38
|
+
puts "Syncing #{basename}"
|
39
|
+
(comments, other) = TranslationSupport.read_file(filename, basename)
|
40
|
+
words.each { |k,v| other[k] ||= words[k] } # Initializing hash variable as empty if it does not exist
|
41
|
+
other.delete_if { |k,v| !words[k] } # Remove if not defined in en.yml
|
42
|
+
TranslationSupport.write_file(filename, basename, comments, other)
|
43
|
+
end
|
44
|
+
end
|
26
45
|
end
|
27
46
|
end
|
28
47
|
end
|
data/lib/vaporizer.rb
CHANGED
@@ -45,11 +45,11 @@ module Vaporizer
|
|
45
45
|
def match_substitute(string, match)
|
46
46
|
string.gsub(/\$([`&0-9'$])/) do |sub|
|
47
47
|
case $1
|
48
|
-
when "`"
|
49
|
-
when "&"
|
50
|
-
when "0".."9"
|
51
|
-
when "'"
|
52
|
-
when "$"
|
48
|
+
when "`" then match.pre_match
|
49
|
+
when "&" then match[0]
|
50
|
+
when "0".."9" then match[$1.to_i]
|
51
|
+
when "'" then match.post_match
|
52
|
+
when "$" then '$'
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "radiant-vapor-extension"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "radiant-vapor-extension"
|
7
|
+
s.version = RadiantVaporExtension::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = RadiantVaporExtension::AUTHORS
|
10
|
+
s.email = RadiantVaporExtension::EMAIL
|
11
|
+
s.homepage = RadiantVaporExtension::URL
|
12
|
+
s.summary = RadiantVaporExtension::SUMMARY
|
13
|
+
s.description = RadiantVaporExtension::DESCRIPTION
|
14
|
+
|
15
|
+
ignores = if File.exist?('.gitignore')
|
16
|
+
File.read('.gitignore').split("\n").inject([]) {|a,p| a + Dir[p] }
|
17
|
+
else
|
18
|
+
[]
|
19
|
+
end
|
20
|
+
s.files = Dir['**/*'] - ignores
|
21
|
+
s.test_files = Dir['test/**/*','spec/**/*','features/**/*'] - ignores
|
22
|
+
# s.executables = Dir['bin/*'] - ignores
|
23
|
+
s.require_paths = ["lib"]
|
24
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
cd ~
|
2
|
+
git clone git://github.com/radiant/radiant.git
|
3
|
+
cd ~/radiant
|
4
|
+
if [[ $RADIANT_VERSION != "master" ]]
|
5
|
+
then
|
6
|
+
git checkout -b $RADIANT_VERSION $RADIANT_VERSION
|
7
|
+
fi
|
8
|
+
cp -r ~/builds/*/radiant-vapor-extension vendor/extensions/vapor
|
9
|
+
gem install bundler --pre
|
10
|
+
echo gemspec >> Gemfile
|
11
|
+
bundle install
|
12
|
+
|
13
|
+
case $DB in
|
14
|
+
"mysql" )
|
15
|
+
mysql -e 'create database radiant_test;'
|
16
|
+
cp spec/ci/database.mysql.yml config/database.yml;;
|
17
|
+
"postgres" )
|
18
|
+
psql -c 'create database radiant_test;' -U postgres
|
19
|
+
cp spec/ci/database.postgresql.yml config/database.yml;;
|
20
|
+
esac
|
21
|
+
|
22
|
+
bundle exec rake db:migrate
|
23
|
+
bundle exec rake db:migrate:extensions
|
data/spec/ci/script
ADDED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.expand_path '../../vapor_spec_helper', __FILE__
|
2
2
|
|
3
3
|
describe VaporFlow do
|
4
4
|
describe "radiant_path" do
|
@@ -25,4 +25,23 @@ describe VaporFlow do
|
|
25
25
|
VaporFlow.send_to_radiant.first.should == 404
|
26
26
|
end
|
27
27
|
end
|
28
|
-
|
28
|
+
describe "call" do
|
29
|
+
before(:each) do
|
30
|
+
@path = {'PATH_INFO' => "/"}
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should return an array" do
|
34
|
+
VaporFlow.call(@path).should be_kind_of(Array)
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should send to radaint if blank" do
|
38
|
+
@path['PATH_INFO'] = ''
|
39
|
+
VaporFlow.call(@path).should == VaporFlow.send_to_radiant
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should return /things for /" do
|
43
|
+
FlowMeter.create(:catch_url => "/", :redirect_url => "/things")
|
44
|
+
VaporFlow.call(@path).should == [307, {"Location"=>"/things"}, ["307"]]
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.expand_path '../../vapor_spec_helper', __FILE__
|
2
2
|
|
3
3
|
describe FlowMeter do
|
4
4
|
dataset :pages
|
@@ -40,7 +40,7 @@ describe FlowMeter do
|
|
40
40
|
@flow_meter.save
|
41
41
|
@flow_meter2 = FlowMeter.new(:catch_url => @flow_meter.catch_url, :redirect_url => '/other')
|
42
42
|
@flow_meter2.valid?
|
43
|
-
@flow_meter2.errors.on(:catch_url).should match(/
|
43
|
+
@flow_meter2.errors.on(:catch_url).should match(/this name is already in use/)
|
44
44
|
end
|
45
45
|
|
46
46
|
it "should remove the first character from catch_url beginning with a slash" do
|
@@ -88,7 +88,7 @@ describe FlowMeter do
|
|
88
88
|
@flow_meter.save
|
89
89
|
@flow_meter.redirect_url.should == '/'
|
90
90
|
end
|
91
|
-
|
91
|
+
|
92
92
|
it "should allow a redirect_url formatted like 'http://www.saturnflyer.com/'" do
|
93
93
|
@flow_meter.redirect_url = 'http://www.saturnflyer.com/'
|
94
94
|
@flow_meter.save!
|
@@ -137,10 +137,10 @@ describe FlowMeter do
|
|
137
137
|
end
|
138
138
|
describe "while vapor.use_regexp" do
|
139
139
|
it "should return the first flow_meter found that matches the page url" do
|
140
|
-
Radiant::Config['vapor.use_regexp'
|
140
|
+
Radiant::Config.stub!(:[]).with('vapor.use_regexp').and_return('true')
|
141
141
|
@redirector = FlowMeter.create!({:catch_url => '/fi\w', :redirect_url => '/another', :status => '307'})
|
142
142
|
FlowMeter.find_for_page(pages(:first)).should == @redirector
|
143
143
|
end
|
144
144
|
end
|
145
145
|
end
|
146
|
-
end
|
146
|
+
end
|
data/spec/models/page_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.expand_path '../../vapor_spec_helper', __FILE__
|
2
2
|
|
3
3
|
describe Page do
|
4
4
|
dataset :users_and_pages
|
@@ -14,5 +14,10 @@ describe Page do
|
|
14
14
|
it "should return the first flow_meter found which matches the page url" do
|
15
15
|
pages(:first).flow_meter.should == @redirector
|
16
16
|
end
|
17
|
+
it "should redirect '/' to '/another'" do
|
18
|
+
@redirector[:catch_url] = "/"
|
19
|
+
@redirector.save
|
20
|
+
pages(:home).flow_meter.should == @redirector
|
21
|
+
end
|
17
22
|
end
|
18
|
-
end
|
23
|
+
end
|
@@ -11,9 +11,8 @@ unless defined? RADIANT_ROOT
|
|
11
11
|
end
|
12
12
|
require "#{RADIANT_ROOT}/spec/spec_helper"
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
end
|
14
|
+
Dataset::Resolver.default << (File.dirname(__FILE__) + "/datasets")
|
15
|
+
|
17
16
|
if File.directory?(File.dirname(__FILE__) + "/matchers")
|
18
17
|
Dir[File.dirname(__FILE__) + "/matchers/*.rb"].each {|file| require file }
|
19
18
|
end
|
data/vapor_extension.rb
CHANGED
@@ -1,16 +1,11 @@
|
|
1
|
-
require_dependency
|
1
|
+
require_dependency "application_controller"
|
2
|
+
require "radiant-vapor-extension"
|
2
3
|
|
3
4
|
class VaporExtension < Radiant::Extension
|
4
|
-
version
|
5
|
-
description
|
6
|
-
url
|
7
|
-
|
8
|
-
define_routes do |map|
|
9
|
-
map.namespace :admin do |admin|
|
10
|
-
admin.resources 'flow_meters', :only => [:index, :create, :destroy]
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
5
|
+
version RadiantVaporExtension::VERSION
|
6
|
+
description RadiantVaporExtension::DESCRIPTION
|
7
|
+
url RadiantVaporExtension::URL
|
8
|
+
|
14
9
|
def activate
|
15
10
|
unless respond_to?(:tab)
|
16
11
|
admin.tabs.add "Redirects", "/admin/flow_meters", :after => "Layouts", :visibility => [:admin]
|
@@ -33,9 +28,4 @@ class VaporExtension < Radiant::Extension
|
|
33
28
|
helper Admin::PageNodeAlterationsHelper
|
34
29
|
}
|
35
30
|
end
|
36
|
-
|
37
|
-
def deactivate
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
31
|
end
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: radiant-vapor-extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 13
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 2
|
8
|
+
- 1
|
9
|
+
- 3
|
10
|
+
version: 2.1.3
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Jim Gay
|
@@ -9,36 +15,19 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
version_requirement:
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: "0"
|
24
|
-
version:
|
25
|
-
description: Provides an interface to redirect URLs in RadiantCMS
|
26
|
-
email: jim@saturnflyer.com
|
18
|
+
date: 2012-05-09 00:00:00 Z
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: User managed redirects.
|
22
|
+
email:
|
23
|
+
- jim@saturnflyer.com
|
27
24
|
executables: []
|
28
25
|
|
29
26
|
extensions: []
|
30
27
|
|
31
|
-
extra_rdoc_files:
|
32
|
-
|
33
|
-
- README.rdoc
|
28
|
+
extra_rdoc_files: []
|
29
|
+
|
34
30
|
files:
|
35
|
-
- .document
|
36
|
-
- .gitignore
|
37
|
-
- HELP_admin.md
|
38
|
-
- LICENSE
|
39
|
-
- README.rdoc
|
40
|
-
- Rakefile
|
41
|
-
- VERSION
|
42
31
|
- app/controllers/admin/flow_meters_controller.rb
|
43
32
|
- app/helpers/admin/flow_meters_helper.rb
|
44
33
|
- app/helpers/admin/page_node_alterations_helper.rb
|
@@ -47,51 +36,75 @@ files:
|
|
47
36
|
- app/views/admin/flow_meters/index.html.haml
|
48
37
|
- app/views/admin/help/_slug_redirect.html.haml
|
49
38
|
- app/views/admin/pages/_vapor_details.html.haml
|
39
|
+
- config/initializers/radiant_config.rb
|
40
|
+
- config/locales/en.yml
|
41
|
+
- config/routes.rb
|
42
|
+
- cucumber.yml
|
50
43
|
- db/migrate/001_create_flow_meters.rb
|
44
|
+
- features/support/env.rb
|
45
|
+
- features/support/paths.rb
|
46
|
+
- HELP_admin.md
|
51
47
|
- lib/page_vapor.rb
|
52
48
|
- lib/radiant-vapor-extension.rb
|
53
49
|
- lib/tasks/vapor_extension_tasks.rake
|
54
50
|
- lib/vaporizer.rb
|
51
|
+
- LICENSE
|
52
|
+
- radiant-vapor-extension.gemspec
|
53
|
+
- Rakefile
|
54
|
+
- README.md
|
55
|
+
- spec/ci/before_script
|
56
|
+
- spec/ci/script
|
55
57
|
- spec/controllers/admin/flow_meters_controller_spec.rb
|
56
58
|
- spec/metal/vapor_flow_spec.rb
|
57
59
|
- spec/models/flow_meter_spec.rb
|
58
60
|
- spec/models/page_spec.rb
|
59
61
|
- spec/spec.opts
|
60
|
-
- spec/
|
62
|
+
- spec/vapor_spec_helper.rb
|
61
63
|
- test/test_helper.rb
|
62
64
|
- vapor_extension.rb
|
63
|
-
|
64
|
-
homepage: http://
|
65
|
+
- VERSION
|
66
|
+
homepage: http://saturnflyer.com/
|
65
67
|
licenses: []
|
66
68
|
|
67
69
|
post_install_message:
|
68
|
-
rdoc_options:
|
69
|
-
|
70
|
+
rdoc_options: []
|
71
|
+
|
70
72
|
require_paths:
|
71
73
|
- lib
|
72
74
|
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
73
76
|
requirements:
|
74
77
|
- - ">="
|
75
78
|
- !ruby/object:Gem::Version
|
79
|
+
hash: 3
|
80
|
+
segments:
|
81
|
+
- 0
|
76
82
|
version: "0"
|
77
|
-
version:
|
78
83
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
79
85
|
requirements:
|
80
86
|
- - ">="
|
81
87
|
- !ruby/object:Gem::Version
|
88
|
+
hash: 3
|
89
|
+
segments:
|
90
|
+
- 0
|
82
91
|
version: "0"
|
83
|
-
version:
|
84
92
|
requirements: []
|
85
93
|
|
86
94
|
rubyforge_project:
|
87
|
-
rubygems_version: 1.
|
95
|
+
rubygems_version: 1.8.17
|
88
96
|
signing_key:
|
89
97
|
specification_version: 3
|
90
|
-
summary:
|
98
|
+
summary: User managed redirects.
|
91
99
|
test_files:
|
100
|
+
- test/test_helper.rb
|
101
|
+
- spec/ci/before_script
|
102
|
+
- spec/ci/script
|
92
103
|
- spec/controllers/admin/flow_meters_controller_spec.rb
|
93
104
|
- spec/metal/vapor_flow_spec.rb
|
94
105
|
- spec/models/flow_meter_spec.rb
|
95
106
|
- spec/models/page_spec.rb
|
96
|
-
- spec/
|
97
|
-
-
|
107
|
+
- spec/spec.opts
|
108
|
+
- spec/vapor_spec_helper.rb
|
109
|
+
- features/support/env.rb
|
110
|
+
- features/support/paths.rb
|
data/.document
DELETED
data/.gitignore
DELETED
data/README.rdoc
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
= Vapor
|
2
|
-
|
3
|
-
The Vapor extension provides an interface to redirect URLs.
|
4
|
-
|
5
|
-
Installing Vapor is as easy as any other Radiant extension. Drop it into your vendor/extensions directory and:
|
6
|
-
|
7
|
-
rake radiant:extensions:vapor:migrate
|
8
|
-
|
9
|
-
See the HELP_admin.md for more details.
|
10
|
-
|
11
|
-
built by Saturn Flyer http://www.saturnflyer.com
|