radiant-concurrent_draft-extension 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -34,7 +34,7 @@ unless defined? RADIANT_ROOT
34
34
  end
35
35
 
36
36
  require 'rake'
37
- require 'rake/rdoctask'
37
+ require 'rdoc/task'
38
38
  require 'rake/testtask'
39
39
 
40
40
  rspec_base = File.expand_path(RADIANT_ROOT + '/vendor/plugins/rspec/lib')
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.7
1
+ 1.0.8
@@ -7,23 +7,32 @@ class ConcurrentDraftExtension < Radiant::Extension
7
7
  url "https://github.com/avonderluft/radiant-concurrent_draft-extension"
8
8
 
9
9
  def activate
10
- [Page, Snippet, Layout, PagePart].each do |klass|
10
+ [Page, Layout, PagePart].each do |klass|
11
11
  klass.send :include, ConcurrentDraft::ModelExtensions
12
12
  end
13
13
  Page.send :include, ConcurrentDraft::PageExtensions
14
14
  Page.send :include, ConcurrentDraft::Tags
15
- [Admin::PagesController, Admin::SnippetsController, Admin::LayoutsController].each do |klass|
15
+ [Admin::PagesController, Admin::LayoutsController].each do |klass|
16
16
  klass.send :include, ConcurrentDraft::AdminControllerExtensions
17
17
  klass.class_eval do
18
18
  helper ConcurrentDraft::HelperExtensions
19
19
  end
20
20
  end
21
21
  SiteController.send :include, ConcurrentDraft::SiteControllerExtensions
22
- %w{page snippet layout}.each do |view|
22
+ %w{page layout}.each do |view|
23
23
  admin.send(view).edit.add :main, "admin/draft_controls", :before => "edit_header"
24
24
  admin.send(view).edit.form_bottom.delete 'edit_buttons'
25
25
  admin.send(view).edit.add :form_bottom, 'admin/edit_buttons'
26
26
  end
27
+ # Snippets have been extracted from core
28
+ if defined?(SnippetsExtension)
29
+ Snippet.send :include, ConcurrentDraft::ModelExtensions
30
+ Admin::SnippetsController.send :include, ConcurrentDraft::AdminControllerExtensions
31
+ Admin::SnippetsController.class_eval { helper ConcurrentDraft::HelperExtensions }
32
+ admin.snippet.edit.add :main, "admin/draft_controls", :before => "edit_header"
33
+ admin.snippet.edit.form_bottom.delete 'edit_buttons'
34
+ admin.snippet.edit.add :form_bottom, 'admin/edit_buttons'
35
+ end
27
36
  # admin.page.edit.add :extended_metadata, 'published_meta'
28
37
  Time::DATE_FORMATS[:long_civilian] = lambda {|time| time.strftime("%B %d, %Y %I:%M%p").gsub(/(\s+)0(\d+)/, '\1\2') }
29
38
  end
@@ -3,9 +3,11 @@ module ConcurrentDraft::Tags
3
3
 
4
4
  def self.included(base)
5
5
  base.class_eval do
6
- %w{content snippet}.each do |t|
7
- alias_method "tag:old_#{t}", "tag:#{t}"
8
- alias_method "tag:#{t}", "tag:concurrent_draft_#{t}"
6
+ alias_method "tag:old_content", "tag:content"
7
+ alias_method "tag:content", "tag:concurrent_draft_content"
8
+ if defined?(SnippetsExtension)
9
+ alias_method "tag:old_snippet", "tag:snippet"
10
+ alias_method "tag:snippet", "tag:concurrent_draft_snippet"
9
11
  end
10
12
  end
11
13
  end
@@ -35,22 +37,25 @@ module ConcurrentDraft::Tags
35
37
  tag.globals.page.render_snippet(part) unless part.nil?
36
38
  end
37
39
 
38
- tag 'concurrent_draft_snippet' do |tag|
39
- if name = tag.attr['name']
40
- if snippet = Snippet.find_by_name(name.strip)
41
- tag.locals.yield = tag.expand if tag.double?
42
- ### CONCURRENT DRAFTS CHANGE ###
43
- # Show the draft content on the dev site #
44
- # Promote the snippet if it needs to be #
45
- snippet.promote_draft! if snippet.draft_should_be_promoted?
46
- snippet.content = snippet.draft_content if dev?(tag.globals.page.request)
47
- ### END CONCURRENT DRAFTS CHANGE ###
48
- tag.globals.page.render_snippet(snippet)
40
+ if defined?(SnippetsExtension)
41
+ tag 'concurrent_draft_snippet' do |tag|
42
+ if name = tag.attr['name']
43
+ if snippet = Snippet.find_by_name(name.strip)
44
+ tag.locals.yield = tag.expand if tag.double?
45
+ ### CONCURRENT DRAFTS CHANGE ###
46
+ # Show the draft content on the dev site #
47
+ # Promote the snippet if it needs to be #
48
+ snippet.promote_draft! if snippet.draft_should_be_promoted?
49
+ snippet.content = snippet.draft_content if dev?(tag.globals.page.request)
50
+ ### END CONCURRENT DRAFTS CHANGE ###
51
+ tag.globals.page.render_snippet(snippet)
52
+ else
53
+ raise StandardTags::TagError.new("snippet not found: #{name}")
54
+ end
49
55
  else
50
- raise StandardTags::TagError.new("snippet not found: #{name}")
56
+ raise StandardTags::TagError.new("`snippet' tag must contain `name' attribute")
51
57
  end
52
- else
53
- raise StandardTags::TagError.new("`snippet' tag must contain `name' attribute")
54
58
  end
55
59
  end
60
+
56
61
  end
@@ -4,14 +4,14 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{radiant-concurrent_draft-extension}
8
- s.version = "1.0.7"
7
+ s.name = "radiant-concurrent_draft-extension"
8
+ s.version = "1.0.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andrew vonderLuft", "Sean Cribbs"]
12
- s.date = %q{2011-07-11}
13
- s.description = %q{Enables draft versions of pages, snippets and layouts, which can be scheduled for promotion.}
14
- s.email = %q{avonderluft@avlux.net}
12
+ s.date = "2013-01-29"
13
+ s.description = "Enables draft versions of pages, snippets and layouts, which can be scheduled for promotion."
14
+ s.email = "avonderluft@avlux.net"
15
15
  s.extra_rdoc_files = [
16
16
  "README.textile"
17
17
  ]
@@ -67,19 +67,10 @@ Gem::Specification.new do |s|
67
67
  "vendor/plugins/12_hour_time/test/12_hour_time_test.rb",
68
68
  "vendor/plugins/12_hour_time/test/test_helper.rb"
69
69
  ]
70
- s.homepage = %q{https://github.com/avonderluft/radiant-concurrent_draft-extension}
70
+ s.homepage = "https://github.com/avonderluft/radiant-concurrent_draft-extension"
71
71
  s.require_paths = ["lib"]
72
- s.rubygems_version = %q{1.5.2}
73
- s.summary = %q{Concurrent Draft Extension for Radiant CMS}
74
- s.test_files = [
75
- "spec/controllers/admin_controller_extensions_spec.rb",
76
- "spec/controllers/site_controller_extensions_spec.rb",
77
- "spec/matchers/concurrent_draft_matcher.rb",
78
- "spec/models/model_extensions_spec.rb",
79
- "spec/models/page_extensions_spec.rb",
80
- "spec/models/tags_spec.rb",
81
- "spec/spec_helper.rb"
82
- ]
72
+ s.rubygems_version = "1.8.24"
73
+ s.summary = "Concurrent Draft Extension for Radiant CMS"
83
74
 
84
75
  if s.respond_to? :specification_version then
85
76
  s.specification_version = 3
@@ -1,4 +1,5 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ # require File.dirname(__FILE__) + '/../spec_helper'
2
+ require 'spec_helper'
2
3
 
3
4
  shared_examples_for 'controller with scheduled draft promotion' do
4
5
  dataset :users
@@ -181,8 +182,10 @@ describe Admin::PagesController, "with concurrent_draft functions" do
181
182
  it_should_behave_like 'controller with scheduled draft promotion'
182
183
  end
183
184
 
184
- describe Admin::SnippetsController, "with concurrent_draft functions" do
185
- it_should_behave_like 'controller with scheduled draft promotion'
185
+ if defined?(SnippetsExtension)
186
+ describe Admin::SnippetsController, "with concurrent_draft functions" do
187
+ it_should_behave_like 'controller with scheduled draft promotion'
188
+ end
186
189
  end
187
190
 
188
191
  describe Admin::LayoutsController, "with concurrent_draft functions" do
@@ -1,4 +1,6 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ # require File.dirname(__FILE__) + '/../spec_helper'
2
+ require 'spec_helper'
3
+
2
4
  require 'site_controller'
3
5
  SiteController.module_eval { def rescue_action(e); raise e; end }
4
6
 
@@ -1,4 +1,5 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ # require File.dirname(__FILE__) + '/../spec_helper'
2
+ require 'spec_helper'
2
3
 
3
4
  share_examples_for "model with concurrent draft" do
4
5
  it "should be invalid with a draft promotion schedule date in the past" do
@@ -60,16 +61,18 @@ share_examples_for "model with concurrent draft" do
60
61
  end
61
62
  end
62
63
 
63
- describe Snippet, "with concurrent draft" do
64
- dataset :snippets
65
- before :each do
66
- @object = snippets(:first)
67
- @object.update_attributes(:content => 'content test', :draft_content => 'draft content')
68
- end
69
- it "should not be publishable" do
70
- @object.publishable?.should_not be_true
64
+ if defined?(SnippetsExtension)
65
+ describe Snippet, "with concurrent draft" do
66
+ dataset :snippets
67
+ before :each do
68
+ @object = snippets(:first)
69
+ @object.update_attributes(:content => 'content test', :draft_content => 'draft content')
70
+ end
71
+ it "should not be publishable" do
72
+ @object.publishable?.should_not be_true
73
+ end
74
+ it_should_behave_like 'model with concurrent draft'
71
75
  end
72
- it_should_behave_like 'model with concurrent draft'
73
76
  end
74
77
 
75
78
  describe Layout, "with concurrent draft" do
@@ -1,4 +1,5 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ # require File.dirname(__FILE__) + '/../spec_helper'
2
+ require 'spec_helper'
2
3
 
3
4
  describe Page, "with concurrent draft" do
4
5
  dataset :pages_with_layouts
@@ -1,7 +1,8 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ # require File.dirname(__FILE__) + '/../spec_helper'
2
+ require 'spec_helper'
2
3
 
3
4
  describe "ConcurrentDraft::Tags" do
4
- dataset :pages, :snippets
5
+ dataset :pages
5
6
  describe '<r:content>' do
6
7
  before :each do
7
8
  @page = pages(:home)
@@ -17,27 +18,30 @@ describe "ConcurrentDraft::Tags" do
17
18
  end
18
19
  end
19
20
 
20
- describe "<r:snippet>" do
21
- before :each do
22
- @snippet = snippets(:first)
23
- @snippet.update_attribute(:draft_content, 'Draft content.')
24
- @page = pages(:home)
25
- end
21
+ if defined?(SnippetsExtension)
22
+ describe "<r:snippet>" do
23
+ dataset :snippets
24
+ before :each do
25
+ @snippet = snippets(:first)
26
+ @snippet.update_attribute(:draft_content, 'Draft content.')
27
+ @page = pages(:home)
28
+ end
26
29
 
27
- it "should render published snippet content on the live site" do
28
- @page.should render('<r:snippet name="first" />').as('test')
29
- end
30
+ it "should render published snippet content on the live site" do
31
+ @page.should render('<r:snippet name="first" />').as('test')
32
+ end
30
33
 
31
- it "should render draft snippet content on the dev site" do
32
- @page.should render('<r:snippet name="first" />').as('Draft content.').on('dev.host')
33
- end
34
+ it "should render draft snippet content on the dev site" do
35
+ @page.should render('<r:snippet name="first" />').as('Draft content.').on('dev.host')
36
+ end
34
37
 
35
- it "should promote the draft body if it is scheduled" do
36
- @snippet.update_attribute(:draft_promotion_scheduled_at, 1.second.from_now)
37
- sleep 2
38
- @page.should render('<r:snippet name="first" />').as('Draft content.')
39
- @snippet.reload
40
- @snippet.should be_has_draft_promoted
38
+ it "should promote the draft body if it is scheduled" do
39
+ @snippet.update_attribute(:draft_promotion_scheduled_at, 1.second.from_now)
40
+ sleep 2
41
+ @page.should render('<r:snippet name="first" />').as('Draft content.')
42
+ @snippet.reload
43
+ @snippet.should be_has_draft_promoted
44
+ end
41
45
  end
42
46
  end
43
47
  end
@@ -12,6 +12,7 @@ end
12
12
  require "#{RADIANT_ROOT}/spec/spec_helper"
13
13
 
14
14
  Dataset::Resolver.default << (File.dirname(__FILE__) + "/datasets")
15
+ Dataset::Resolver.default << (SnippetsExtension.root + "/spec/datasets") if defined?(SnippetsExtension)
15
16
  if File.directory?(File.dirname(__FILE__) + "/scenarios")
16
17
  Scenario.load_paths.unshift File.dirname(__FILE__) + "/scenarios"
17
18
  end
metadata CHANGED
@@ -1,51 +1,41 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: radiant-concurrent_draft-extension
3
- version: !ruby/object:Gem::Version
4
- hash: 25
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.8
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 0
9
- - 7
10
- version: 1.0.7
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Andrew vonderLuft
14
9
  - Sean Cribbs
15
10
  autorequire:
16
11
  bindir: bin
17
12
  cert_chain: []
18
-
19
- date: 2011-07-11 00:00:00 -07:00
20
- default_executable:
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
23
- type: :runtime
24
- requirement: &id001 !ruby/object:Gem::Requirement
13
+ date: 2013-01-29 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: radiant
17
+ requirement: !ruby/object:Gem::Requirement
25
18
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 15424049
30
- segments:
31
- - 1
32
- - 0
33
- - 0
34
- - rc
35
- - 2
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
36
22
  version: 1.0.0.rc2
37
- name: radiant
38
- version_requirements: *id001
23
+ type: :runtime
39
24
  prerelease: false
40
- description: Enables draft versions of pages, snippets and layouts, which can be scheduled for promotion.
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: 1.0.0.rc2
31
+ description: Enables draft versions of pages, snippets and layouts, which can be scheduled
32
+ for promotion.
41
33
  email: avonderluft@avlux.net
42
34
  executables: []
43
-
44
35
  extensions: []
45
-
46
- extra_rdoc_files:
36
+ extra_rdoc_files:
47
37
  - README.textile
48
- files:
38
+ files:
49
39
  - HELP.rdoc
50
40
  - README.textile
51
41
  - Rakefile
@@ -96,45 +86,31 @@ files:
96
86
  - vendor/plugins/12_hour_time/lib/12_hour_time.rb
97
87
  - vendor/plugins/12_hour_time/test/12_hour_time_test.rb
98
88
  - vendor/plugins/12_hour_time/test/test_helper.rb
99
- has_rdoc: true
100
89
  homepage: https://github.com/avonderluft/radiant-concurrent_draft-extension
101
90
  licenses: []
102
-
103
91
  post_install_message:
104
92
  rdoc_options: []
105
-
106
- require_paths:
93
+ require_paths:
107
94
  - lib
108
- required_ruby_version: !ruby/object:Gem::Requirement
95
+ required_ruby_version: !ruby/object:Gem::Requirement
109
96
  none: false
110
- requirements:
111
- - - ">="
112
- - !ruby/object:Gem::Version
113
- hash: 3
114
- segments:
97
+ requirements:
98
+ - - ! '>='
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ segments:
115
102
  - 0
116
- version: "0"
117
- required_rubygems_version: !ruby/object:Gem::Requirement
103
+ hash: 1967068690405520845
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
118
105
  none: false
119
- requirements:
120
- - - ">="
121
- - !ruby/object:Gem::Version
122
- hash: 3
123
- segments:
124
- - 0
125
- version: "0"
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
126
110
  requirements: []
127
-
128
111
  rubyforge_project:
129
- rubygems_version: 1.5.2
112
+ rubygems_version: 1.8.24
130
113
  signing_key:
131
114
  specification_version: 3
132
115
  summary: Concurrent Draft Extension for Radiant CMS
133
- test_files:
134
- - spec/controllers/admin_controller_extensions_spec.rb
135
- - spec/controllers/site_controller_extensions_spec.rb
136
- - spec/matchers/concurrent_draft_matcher.rb
137
- - spec/models/model_extensions_spec.rb
138
- - spec/models/page_extensions_spec.rb
139
- - spec/models/tags_spec.rb
140
- - spec/spec_helper.rb
116
+ test_files: []