radiant-help-extension 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
1
  class Admin::HelpController < ApplicationController
2
2
  include ActiveSupport::CoreExtensions::String::Inflections
3
-
3
+
4
4
  # only_allow_access_to :index, :show, :new, :create, :edit, :update, :remove, :destroy,
5
5
  # :when => :admin,
6
6
  # :denied_url => { :controller => 'help', :action => 'index' },
7
7
  # :denied_message => 'You must have administrative privileges to perform this action.'
8
-
8
+
9
9
  def index
10
10
  @role = 'all'
11
11
  @docs = HelpDoc.find_for(:all)
@@ -52,7 +52,7 @@ class Admin::HelpController < ApplicationController
52
52
  @doc_path = HelpDoc.find_for(@role,params[:extension_name]).first
53
53
  else
54
54
  @doc_path = @docs.first
55
- @doc_name = @doc_path[/[(\w+)]\/(\w+)\/HELP/, 1].titleize
55
+ @doc_name = @template.doc_extension_dir(@doc_path).titleize
56
56
  end
57
57
  @doc = HelpDoc.formatted_contents_from(@doc_path)
58
58
  end
@@ -16,7 +16,12 @@ module Admin::HelpHelper
16
16
  end
17
17
 
18
18
  def doc_extension_dir(doc)
19
- doc[/[(\w+)]\/(\w+)\/HELP/, 1]
19
+ dir = doc[/[(\w+)]\/(\w+)\/HELP/, 1] # vendored
20
+ if dir.blank? # gemified
21
+ path_ary = doc.split('/')
22
+ dir = path_ary[path_ary.count-2].sub('radiant-','').sub(/-extension-.*/,'')
23
+ end
24
+ dir
20
25
  end
21
26
 
22
27
  def all_tags
@@ -2,20 +2,16 @@ require 'rdoc'
2
2
 
3
3
  class HelpDoc
4
4
 
5
- def self.find_for(role_type, extension_dir="**")
5
+ def self.find_for(role_type, extension_dir='')
6
6
  results = []
7
- doc_name = ''
8
- doc_name = "_#{role_type.to_s}" unless role_type.to_s == 'all'
9
- Dir["#{RAILS_ROOT}/vendor/extensions/#{extension_dir}/HELP#{doc_name}*"].each do |ext_help|
10
- case role_type.to_s
11
- when 'all'
12
- re_matcher = /HELP(\.[\w]+)?$/
13
- else
14
- re_matcher = /HELP_[\S]+(\.[\w]+)?$/
7
+ if extension_dir.blank?
8
+ Radiant::ExtensionLoader.enabled_extension_paths.each do |ext_path|
9
+ results << help_docs(ext_path, role_type)
15
10
  end
16
- results << ext_help if re_matcher.match(ext_help)
11
+ else
12
+ results << help_docs(Radiant::ExtensionPath.for(extension_dir), role_type)
17
13
  end
18
- results
14
+ results.reject(&:blank?).flatten
19
15
  end
20
16
 
21
17
  def self.formatted_contents_from(doc_path)
@@ -35,8 +31,27 @@ class HelpDoc
35
31
  def self.parsed_markdown(doc_path)
36
32
  MarkdownFilter.filter(File.read(doc_path))
37
33
  end
38
-
34
+
39
35
  def self.parsed_textile(doc_path)
40
36
  ::RedCloth.new(File.read(doc_path)).to_html
41
37
  end
38
+
39
+ private
40
+
41
+ def self.help_docs(ext_path, role_type)
42
+ results = []
43
+ doc_name = ''
44
+ doc_name = "_#{role_type.to_s}" unless role_type.to_s == 'all'
45
+ Dir["#{ext_path}/HELP#{doc_name}*"].each do |ext_help|
46
+ case role_type.to_s
47
+ when 'all'
48
+ re_matcher = /HELP(\.[\w]+)?$/
49
+ else
50
+ re_matcher = /HELP_[\S]+(\.[\w]+)?$/
51
+ end
52
+ results << ext_help if re_matcher.match(ext_help)
53
+ end
54
+ results
55
+ end
56
+
42
57
  end
@@ -1,5 +1,5 @@
1
1
  module RadiantHelpExtension
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.2"
3
3
  SUMMARY = "Help for Radiant CMS"
4
4
  DESCRIPTION = "Help Documentation for Radiant CMS!"
5
5
  URL = "https://github.com/saturnflyer/radiant-help-extension"
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  $:.push File.expand_path("../lib", __FILE__)
3
- require "radiant-help-extension"
3
+ require "radiant_help_extension"
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "radiant-help-extension"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radiant-help-extension
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-06 00:00:00.000000000 Z
12
+ date: 2012-03-22 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Help Documentation for Radiant CMS!
15
15
  email:
@@ -44,7 +44,7 @@ files:
44
44
  - features/support/paths.rb
45
45
  - HELP_developer.rdoc
46
46
  - help_extension.rb
47
- - lib/radiant-help-extension.rb
47
+ - lib/radiant_help_extension.rb
48
48
  - lib/tasks/help_extension_tasks.rake
49
49
  - radiant-help-extension.gemspec
50
50
  - Rakefile