tiny_mce_helper 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/{CHANGELOG → CHANGELOG.rdoc} +10 -11
- data/{README → README.rdoc} +9 -12
- data/Rakefile +44 -36
- data/lib/tiny_mce_helper.rb +44 -26
- data/tasks/tiny_mce_helper_tasks.rake +1 -1
- data/test/app_root/script/console +8 -0
- data/test/app_root/script/rails_framework_root.rb +1 -0
- data/test/test_helper.rb +5 -1
- data/test/unit/tiny_mce_helper_test.rb +54 -48
- metadata +10 -7
@@ -1,29 +1,28 @@
|
|
1
|
-
|
1
|
+
== master
|
2
2
|
|
3
|
-
|
3
|
+
== 0.1.0 / 2008-08-30
|
4
|
+
|
5
|
+
* Remove references to system wget/unzip calls for cross-platform compatibility
|
6
|
+
* Add dependency on RubyZip
|
7
|
+
|
8
|
+
== 0.0.4 / 2008-06-22
|
4
9
|
|
5
10
|
* Remove log files from gems
|
6
11
|
|
7
|
-
|
12
|
+
== 0.0.3 / 2008-05-05
|
8
13
|
|
9
14
|
* Updated documentation
|
10
|
-
|
11
15
|
* Change references from RAILS_ROOT to Rails.root
|
12
|
-
|
13
16
|
* Use zipped version of TinyMCE instead of tar
|
14
17
|
|
15
|
-
|
18
|
+
== 0.0.2 / 2007-09-26
|
16
19
|
|
17
20
|
* Remove gem dependency on actionpack
|
18
21
|
|
19
|
-
|
22
|
+
== 0.0.1 / 2007-08-20
|
20
23
|
|
21
24
|
* Add README documentation
|
22
|
-
|
23
25
|
* Add tiny_mce:uninstall and tiny_mce:update rake tasks
|
24
|
-
|
25
26
|
* Add working unit tests
|
26
|
-
|
27
27
|
* Add installation and uninstallation scripts
|
28
|
-
|
29
28
|
* Add rake tasks tiny_mce:install and tiny_mce:update_options
|
data/{README → README.rdoc}
RENAMED
@@ -5,21 +5,21 @@ script.
|
|
5
5
|
|
6
6
|
== Resources
|
7
7
|
|
8
|
-
Wiki
|
9
|
-
|
10
|
-
* http://wiki.pluginaweek.org/Tiny_mce_helper
|
11
|
-
|
12
8
|
API
|
13
9
|
|
14
10
|
* http://api.pluginaweek.org/tiny_mce_helper
|
15
11
|
|
12
|
+
Bugs
|
13
|
+
|
14
|
+
* http://pluginaweek.lighthouseapp.com/projects/13291-tiny_mce_helper
|
15
|
+
|
16
16
|
Development
|
17
17
|
|
18
|
-
* http://
|
18
|
+
* http://github.com/pluginaweek/tiny_mce_helper
|
19
19
|
|
20
20
|
Source
|
21
21
|
|
22
|
-
*
|
22
|
+
* git://github.com/pluginaweek/tiny_mce_helper.git
|
23
23
|
|
24
24
|
== Description
|
25
25
|
|
@@ -29,11 +29,6 @@ script. It also provides various tasks for installing/updating TinyMCE.
|
|
29
29
|
|
30
30
|
=== Usage
|
31
31
|
|
32
|
-
=== Requirements
|
33
|
-
|
34
|
-
Currently, you must be running a version of Linux in order to run the rake
|
35
|
-
tasks.
|
36
|
-
|
37
32
|
=== Installing TinyMCE
|
38
33
|
|
39
34
|
To install TinyMCE, you can use the tiny_mce:install task. This will download
|
@@ -159,7 +154,7 @@ To see additional initialization helpers, see the API for PluginAWeek::TinyMCEHe
|
|
159
154
|
== Testing
|
160
155
|
|
161
156
|
Before you can run any tests, the following gem must be installed:
|
162
|
-
* plugin_test_helper[http://
|
157
|
+
* plugin_test_helper[http://github.com/pluginaweek/plugin_test_helper]
|
163
158
|
|
164
159
|
Since the rake tasks for installing TinyMCE and updating the configuration
|
165
160
|
options are part of the unit tests, already-downloaded files are included with
|
@@ -176,6 +171,8 @@ To run against a specific version of Rails:
|
|
176
171
|
== Dependencies
|
177
172
|
|
178
173
|
* Rails 2.0 or later
|
174
|
+
* hpricot[http://code.whytheluckystiff.net/hpricot]
|
175
|
+
* rubyzip[http://rubyzip.sourceforge.net]
|
179
176
|
|
180
177
|
== References
|
181
178
|
|
data/Rakefile
CHANGED
@@ -3,46 +3,54 @@ require 'rake/rdoctask'
|
|
3
3
|
require 'rake/gempackagetask'
|
4
4
|
require 'rake/contrib/sshpublisher'
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
spec = Gem::Specification.new do |s|
|
7
|
+
s.name = 'tiny_mce_helper'
|
8
|
+
s.version = '0.1.0'
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
s.summary = 'Adds helper methods for creating the TinyMCE initialization script.'
|
11
|
+
|
12
|
+
s.files = FileList['{lib,tasks,test}/**/*'].to_a - FileList['test/app_root/log/*'].to_a + %w(CHANGELOG.rdoc init.rb install.rb Rakefile README.rdoc uninstall.rb)
|
13
|
+
s.require_path = 'lib'
|
14
|
+
s.has_rdoc = true
|
15
|
+
s.test_files = Dir['test/**/*_test.rb']
|
16
|
+
|
17
|
+
s.author = 'Aaron Pfeifer'
|
18
|
+
s.email = 'aaron@pluginaweek.org'
|
19
|
+
s.homepage = 'http://www.pluginaweek.org'
|
20
|
+
s.rubyforge_project = 'pluginaweek'
|
21
|
+
end
|
22
|
+
|
23
|
+
desc 'Default: run all tests.'
|
12
24
|
task :default => :test
|
13
25
|
|
14
|
-
desc
|
26
|
+
desc "Test the #{spec.name} plugin."
|
15
27
|
Rake::TestTask.new(:test) do |t|
|
16
28
|
t.libs << 'lib'
|
17
|
-
t.
|
29
|
+
t.test_files = spec.test_files
|
18
30
|
t.verbose = true
|
19
31
|
end
|
20
32
|
|
21
|
-
|
33
|
+
begin
|
34
|
+
require 'rcov/rcovtask'
|
35
|
+
namespace :test do
|
36
|
+
desc "Test the #{spec.name} plugin with Rcov."
|
37
|
+
Rcov::RcovTask.new(:rcov) do |t|
|
38
|
+
t.libs << 'lib'
|
39
|
+
t.test_files = spec.test_files
|
40
|
+
t.rcov_opts << '--exclude="^(?!lib/)"'
|
41
|
+
t.verbose = true
|
42
|
+
end
|
43
|
+
end
|
44
|
+
rescue LoadError
|
45
|
+
end
|
46
|
+
|
47
|
+
desc "Generate documentation for the #{spec.name} plugin."
|
22
48
|
Rake::RDocTask.new(:rdoc) do |rdoc|
|
23
49
|
rdoc.rdoc_dir = 'rdoc'
|
24
|
-
rdoc.title =
|
50
|
+
rdoc.title = spec.name
|
25
51
|
rdoc.template = '../rdoc_template.rb'
|
26
52
|
rdoc.options << '--line-numbers' << '--inline-source'
|
27
|
-
rdoc.rdoc_files.include('README')
|
28
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
29
|
-
end
|
30
|
-
|
31
|
-
spec = Gem::Specification.new do |s|
|
32
|
-
s.name = PKG_NAME
|
33
|
-
s.version = PKG_VERSION
|
34
|
-
s.platform = Gem::Platform::RUBY
|
35
|
-
s.summary = 'Adds helper methods for creating the TinyMCE initialization script.'
|
36
|
-
|
37
|
-
s.files = FileList['{lib,tasks,test}/**/*'].to_a - FileList['test/app_root/log/*'].to_a + %w(CHANGELOG init.rb install.rb Rakefile README uninstall.rb)
|
38
|
-
s.require_path = 'lib'
|
39
|
-
s.autorequire = 'tiny_mce_helper'
|
40
|
-
s.has_rdoc = true
|
41
|
-
s.test_files = Dir['test/**/*_test.rb']
|
42
|
-
|
43
|
-
s.author = 'Aaron Pfeifer'
|
44
|
-
s.email = 'aaron@pluginaweek.org'
|
45
|
-
s.homepage = 'http://www.pluginaweek.org'
|
53
|
+
rdoc.rdoc_files.include('README.rdoc', 'CHANGELOG.rdoc', 'lib/**/*.rb')
|
46
54
|
end
|
47
55
|
|
48
56
|
Rake::GemPackageTask.new(spec) do |p|
|
@@ -51,14 +59,14 @@ Rake::GemPackageTask.new(spec) do |p|
|
|
51
59
|
p.need_zip = true
|
52
60
|
end
|
53
61
|
|
54
|
-
desc 'Publish the beta gem'
|
62
|
+
desc 'Publish the beta gem.'
|
55
63
|
task :pgem => [:package] do
|
56
|
-
Rake::SshFilePublisher.new('aaron@pluginaweek.org', '/home/aaron/gems.pluginaweek.org/public/gems', 'pkg', "#{
|
64
|
+
Rake::SshFilePublisher.new('aaron@pluginaweek.org', '/home/aaron/gems.pluginaweek.org/public/gems', 'pkg', "#{spec.name}-#{spec.version}.gem").upload
|
57
65
|
end
|
58
66
|
|
59
|
-
desc 'Publish the API documentation'
|
67
|
+
desc 'Publish the API documentation.'
|
60
68
|
task :pdoc => [:rdoc] do
|
61
|
-
Rake::SshDirPublisher.new('aaron@pluginaweek.org', "/home/aaron/api.pluginaweek.org/public/#{
|
69
|
+
Rake::SshDirPublisher.new('aaron@pluginaweek.org', "/home/aaron/api.pluginaweek.org/public/#{spec.name}", 'rdoc').upload
|
62
70
|
end
|
63
71
|
|
64
72
|
desc 'Publish the API docs and gem'
|
@@ -71,10 +79,10 @@ task :release => [:gem, :package] do
|
|
71
79
|
ruby_forge = RubyForge.new.configure
|
72
80
|
ruby_forge.login
|
73
81
|
|
74
|
-
%w(
|
75
|
-
file = "pkg/#{
|
82
|
+
%w(gem tgz zip).each do |ext|
|
83
|
+
file = "pkg/#{spec.name}-#{spec.version}.#{ext}"
|
76
84
|
puts "Releasing #{File.basename(file)}..."
|
77
85
|
|
78
|
-
ruby_forge.add_release(
|
86
|
+
ruby_forge.add_release(spec.rubyforge_project, spec.name, spec.version, file)
|
79
87
|
end
|
80
88
|
end
|
data/lib/tiny_mce_helper.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module PluginAWeek #:nodoc:
|
2
2
|
# Adds helper methods for generating the TinyMCE initialization script
|
3
|
-
# within your
|
3
|
+
# within your views
|
4
4
|
module TinyMCEHelper
|
5
5
|
# The path to the file which contains all valid options that can be used
|
6
6
|
# to configure TinyMCE
|
@@ -22,6 +22,11 @@ module PluginAWeek #:nodoc:
|
|
22
22
|
# Installs TinyMCE by downloading it and adding it to your application's
|
23
23
|
# javascripts folder.
|
24
24
|
#
|
25
|
+
# Configuration options:
|
26
|
+
# * +version+ - The version of TinyMCE to install. Default is the latest version.
|
27
|
+
# * +target+ - The path to install TinyMCE to, relative to the project root. Default is "public/javascripts/tiny_mce"
|
28
|
+
# * +force+ - Whether to install TinyMCE, regardless of whether it already exists on the filesystem.
|
29
|
+
#
|
25
30
|
# == Versions
|
26
31
|
#
|
27
32
|
# By default, this will install the latest version of TinyMCE. You can
|
@@ -29,19 +34,25 @@ module PluginAWeek #:nodoc:
|
|
29
34
|
# passing in the version number.
|
30
35
|
#
|
31
36
|
# For example,
|
32
|
-
# PluginAWeek::TinyMCEHelper.install
|
33
|
-
# PluginAWeek::TinyMCEHelper.install('2.0.8')
|
37
|
+
# PluginAWeek::TinyMCEHelper.install # Installs the latest version
|
38
|
+
# PluginAWeek::TinyMCEHelper.install(:version => '2.0.8') # Installs version 2.0.8
|
34
39
|
#
|
35
40
|
# An exception will be raised if the specified version cannot be found.
|
36
41
|
#
|
37
42
|
# == Target path
|
38
43
|
#
|
39
44
|
# By default, this will install TinyMCE into Rails.root/public/javascripts/tiny_mce.
|
40
|
-
# If you want to install it to a different directory, you can pass in
|
41
|
-
#
|
45
|
+
# If you want to install it to a different directory, you can pass in a
|
46
|
+
# parameter with the relative path from Rails.root.
|
42
47
|
#
|
43
48
|
# For example,
|
44
|
-
# PluginAWeek::TinyMCEHelper.install(
|
49
|
+
# PluginAWeek::TinyMCEHelper.install(:target => 'public/javascripts/richtext')
|
50
|
+
#
|
51
|
+
# == Conflicting paths
|
52
|
+
#
|
53
|
+
# If TinyMCE is found to already be installed on the filesystem, a prompt
|
54
|
+
# will be displayed for whether to overwrite the existing directory. This
|
55
|
+
# prompt can be automatically skipped by passing in the :force option.
|
45
56
|
def install(options = {})
|
46
57
|
options.assert_valid_keys(:version, :target, :force)
|
47
58
|
options.reverse_merge!(:force => false)
|
@@ -60,10 +71,10 @@ module PluginAWeek #:nodoc:
|
|
60
71
|
return if option == 'n'
|
61
72
|
end
|
62
73
|
|
74
|
+
# Get the url of the TinyMCE version
|
63
75
|
require 'hpricot'
|
64
76
|
require 'open-uri'
|
65
77
|
|
66
|
-
# Get the url of the TinyMCE version
|
67
78
|
doc = Hpricot(open('http://sourceforge.net/project/showfiles.php?group_id=103281&package_id=111430'))
|
68
79
|
if version
|
69
80
|
version.gsub!('.', '_')
|
@@ -77,31 +88,38 @@ module PluginAWeek #:nodoc:
|
|
77
88
|
filename = file_element.innerHTML
|
78
89
|
file_url = file_element['href']
|
79
90
|
|
80
|
-
# Download
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
91
|
+
# Download the file
|
92
|
+
puts 'Downloading TinyMCE source...' if verbose
|
93
|
+
file = open(file_url).path
|
94
|
+
|
95
|
+
# Extract and install
|
96
|
+
puts 'Extracting...' if verbose
|
97
|
+
|
98
|
+
require 'zip/zip'
|
99
|
+
require 'zip/zipfilesystem'
|
100
|
+
|
101
|
+
Zip::ZipFile::open(file) do |zipfile|
|
102
|
+
zipfile.entries.each do |entry|
|
103
|
+
if match = /tinymce\/jscripts\/tiny_mce\/(.*)/.match(entry.name)
|
104
|
+
FileUtils.mkdir_p("#{target_path}/#{File.dirname(match[1])}")
|
105
|
+
entry.extract("#{target_path}/#{match[1]}") { true }
|
106
|
+
end
|
94
107
|
end
|
95
108
|
end
|
109
|
+
|
110
|
+
puts 'Done!' if verbose
|
96
111
|
end
|
97
112
|
|
98
113
|
# Uninstalls the TinyMCE installation and optional configuration file
|
99
|
-
|
114
|
+
#
|
115
|
+
# Configuration options:
|
116
|
+
# * +target+ - The path that TinyMCE was installed to. Default is "public/javascripts/tiny_mce"
|
117
|
+
def uninstall(options = {})
|
100
118
|
# Remove the TinyMCE configuration file
|
101
119
|
File.delete(OPTIONS_FILE_PATH)
|
102
120
|
|
103
121
|
# Remove the TinyMCE installation
|
104
|
-
FileUtils.rm_rf("#{Rails.root}/public/javascripts/tiny_mce")
|
122
|
+
FileUtils.rm_rf(options[:target] || "#{Rails.root}/public/javascripts/tiny_mce")
|
105
123
|
end
|
106
124
|
|
107
125
|
# Updates the list of possible configuration options that can be used
|
@@ -119,14 +137,14 @@ module PluginAWeek #:nodoc:
|
|
119
137
|
options = (doc/'a[@title*="Configuration/"]/').collect {|option| option.to_s}.sort
|
120
138
|
options.reject! {|option| option =~ DYNAMIC_OPTIONS}
|
121
139
|
|
122
|
-
File.open(
|
140
|
+
File.open(OPTIONS_FILE_PATH, 'w') do |out|
|
123
141
|
YAML.dump(options, out)
|
124
142
|
end
|
125
143
|
puts 'Done!' if verbose
|
126
144
|
end
|
127
145
|
end
|
128
146
|
|
129
|
-
#
|
147
|
+
# Is TinyMCE being used?
|
130
148
|
def using_tiny_mce?
|
131
149
|
@uses_tiny_mce
|
132
150
|
end
|
@@ -204,7 +222,7 @@ module PluginAWeek #:nodoc:
|
|
204
222
|
init_script.chop << "\n});"
|
205
223
|
end
|
206
224
|
|
207
|
-
# Generate the TinyMCE
|
225
|
+
# Generate the TinyMCE. Any arguments will be passed to tiny_mce_init_script.
|
208
226
|
def tiny_mce(*args)
|
209
227
|
javascript_tag tiny_mce_init_script(*args)
|
210
228
|
end
|
@@ -11,7 +11,7 @@ namespace :tiny_mce do
|
|
11
11
|
|
12
12
|
desc 'Uninstalls TinyMCE and removes any associated configuration files.'
|
13
13
|
task :uninstall => :environment do
|
14
|
-
PluginAWeek::TinyMCEHelper.uninstall
|
14
|
+
PluginAWeek::TinyMCEHelper.uninstall(:target => ENV['TARGET'])
|
15
15
|
end
|
16
16
|
|
17
17
|
desc 'Updates the list of TinyMCE options and stores them in config/tiny_mce_options.yml.'
|
@@ -0,0 +1,8 @@
|
|
1
|
+
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
2
|
+
libs = " -r irb/completion"
|
3
|
+
libs << " -r test/app_root/script/rails_framework_root"
|
4
|
+
libs << " -r test/test_helper"
|
5
|
+
libs << " -r plugin_test_helper/console_with_fixtures"
|
6
|
+
libs << " -r console_app"
|
7
|
+
libs << " -r console_with_helpers"
|
8
|
+
exec "#{irb} #{libs} --simple-prompt"
|
@@ -0,0 +1 @@
|
|
1
|
+
RAILS_FRAMEWORK_ROOT = '/home/aaron/Projects/Vendor/rails'
|
data/test/test_helper.rb
CHANGED
@@ -6,7 +6,11 @@ require 'plugin_test_helper'
|
|
6
6
|
EXPANDED_RAILS_ROOT = File.expand_path(Rails.root)
|
7
7
|
|
8
8
|
class Test::Unit::TestCase #:nodoc:
|
9
|
-
|
9
|
+
protected
|
10
|
+
def live?
|
11
|
+
ENV['LIVE']
|
12
|
+
end
|
13
|
+
|
10
14
|
def assert_html_equal(expected, actual)
|
11
15
|
assert_equal expected.strip.gsub(/\n\s*/, ''), actual.strip.gsub(/\n\s*/, '')
|
12
16
|
end
|
@@ -1,35 +1,28 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../test_helper'
|
2
2
|
|
3
3
|
# Don't go out to the Internet if we're not live
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
if cmd == 'wget'
|
20
|
-
if args.first =~ /3_0_8/
|
21
|
-
FileUtils.cp("#{EXPANDED_RAILS_ROOT}/../files/tinymce_3_0_8.zip", '/tmp/')
|
22
|
-
elsif args.first =~ /3_0_6_2/
|
23
|
-
FileUtils.cp("#{EXPANDED_RAILS_ROOT}/../files/tinymce_3_0_6_2.zip", '/tmp/')
|
24
|
-
else
|
25
|
-
super
|
26
|
-
end
|
4
|
+
class << PluginAWeek::TinyMCEHelper
|
5
|
+
# Whether or not an IO failure should be caused
|
6
|
+
attr_accessor :fail_io
|
7
|
+
|
8
|
+
# Use pages we've already downloaded for Sourceforge and Wiki information
|
9
|
+
def open(name, *rest, &block)
|
10
|
+
name = case name
|
11
|
+
when /showfiles/
|
12
|
+
'test/files/sourceforge.html'
|
13
|
+
when /wiki/
|
14
|
+
'test/files/wiki.html'
|
15
|
+
when /3_0_8/
|
16
|
+
"#{EXPANDED_RAILS_ROOT}/../files/tinymce_3_0_8.zip"
|
17
|
+
when /3_0_6_2/
|
18
|
+
"#{EXPANDED_RAILS_ROOT}/../files/tinymce_3_0_6_2.zip"
|
27
19
|
else
|
28
|
-
|
29
|
-
end
|
20
|
+
name
|
30
21
|
end
|
22
|
+
|
23
|
+
super
|
31
24
|
end
|
32
|
-
end
|
25
|
+
end unless ENV['LIVE']
|
33
26
|
|
34
27
|
# Simulate user input
|
35
28
|
class << STDIN
|
@@ -61,9 +54,14 @@ class TinyMceInstallerTest < Test::Unit::TestCase
|
|
61
54
|
|
62
55
|
assert File.exists?("#{Rails.root}/public/javascripts/tiny_mce")
|
63
56
|
|
64
|
-
source = File.
|
65
|
-
|
66
|
-
|
57
|
+
source = File.read("#{Rails.root}/public/javascripts/tiny_mce/tiny_mce_src.js")
|
58
|
+
|
59
|
+
if live?
|
60
|
+
assert source.include?('tinymce')
|
61
|
+
else
|
62
|
+
assert source.include?("majorVersion : '3'");
|
63
|
+
assert source.include?("minorVersion : '0.8'");
|
64
|
+
end
|
67
65
|
end
|
68
66
|
|
69
67
|
def test_should_allow_custom_version
|
@@ -71,7 +69,7 @@ class TinyMceInstallerTest < Test::Unit::TestCase
|
|
71
69
|
|
72
70
|
assert File.exists?("#{Rails.root}/public/javascripts/tiny_mce")
|
73
71
|
|
74
|
-
source = File.
|
72
|
+
source = File.read("#{Rails.root}/public/javascripts/tiny_mce/tiny_mce_src.js")
|
75
73
|
assert source.include?("majorVersion : '3'");
|
76
74
|
assert source.include?("minorVersion : '0.6.2'");
|
77
75
|
end
|
@@ -121,8 +119,16 @@ class TinyMceInstallerTest < Test::Unit::TestCase
|
|
121
119
|
assert File.exists?("#{Rails.root}/public/javascripts/tiny_mce/tiny_mce_src.js")
|
122
120
|
end
|
123
121
|
|
122
|
+
def test_should_not_raise_exception_if_error_occurs_during_io_operation
|
123
|
+
PluginAWeek::TinyMCEHelper.fail_io = true unless live?
|
124
|
+
|
125
|
+
assert_nothing_raised {PluginAWeek::TinyMCEHelper.install(:force => true)}
|
126
|
+
ensure
|
127
|
+
PluginAWeek::TinyMCEHelper.fail_io = false unless live?
|
128
|
+
end
|
129
|
+
|
124
130
|
def teardown
|
125
|
-
FileUtils.
|
131
|
+
FileUtils.rm_rf(@public_root)
|
126
132
|
end
|
127
133
|
end
|
128
134
|
|
@@ -142,7 +148,7 @@ class TinyMceUpdaterTest < Test::Unit::TestCase
|
|
142
148
|
PluginAWeek::TinyMCEHelper.update_options
|
143
149
|
|
144
150
|
assert File.exists?("#{Rails.root}/config/tiny_mce_options.yml")
|
145
|
-
options = File.
|
151
|
+
options = YAML.load(File.read(PluginAWeek::TinyMCEHelper::OPTIONS_FILE_PATH))
|
146
152
|
assert_instance_of Array, options
|
147
153
|
end
|
148
154
|
|
@@ -151,7 +157,7 @@ class TinyMceUpdaterTest < Test::Unit::TestCase
|
|
151
157
|
PluginAWeek::TinyMCEHelper.update_options
|
152
158
|
|
153
159
|
assert File.exists?("#{Rails.root}/config/tiny_mce_options.yml")
|
154
|
-
options = File.open(PluginAWeek::TinyMCEHelper::OPTIONS_FILE_PATH)
|
160
|
+
options = YAML.load(File.open(PluginAWeek::TinyMCEHelper::OPTIONS_FILE_PATH))
|
155
161
|
assert_instance_of Array, options
|
156
162
|
end
|
157
163
|
|
@@ -185,7 +191,7 @@ class TinyMceUninstallerTest < Test::Unit::TestCase
|
|
185
191
|
end
|
186
192
|
|
187
193
|
def teardown
|
188
|
-
FileUtils.
|
194
|
+
FileUtils.rm_rf(@public_root)
|
189
195
|
end
|
190
196
|
end
|
191
197
|
|
@@ -268,12 +274,12 @@ class TinyMceHelperScriptTest < Test::Unit::TestCase
|
|
268
274
|
end
|
269
275
|
|
270
276
|
def test_script_should_use_textareas_mode_and_simple_theme_by_default
|
271
|
-
expected = <<-
|
277
|
+
expected = <<-end_str
|
272
278
|
tinyMCE.init({
|
273
279
|
mode : 'textareas',
|
274
280
|
theme : 'simple'
|
275
281
|
});
|
276
|
-
|
282
|
+
end_str
|
277
283
|
assert_html_equal expected, tiny_mce_init_script
|
278
284
|
end
|
279
285
|
|
@@ -296,56 +302,56 @@ class TinyMceHelperScriptTest < Test::Unit::TestCase
|
|
296
302
|
end
|
297
303
|
|
298
304
|
def test_script_should_convert_symbols
|
299
|
-
expected = <<-
|
305
|
+
expected = <<-end_str
|
300
306
|
tinyMCE.init({
|
301
307
|
mode : 'textareas',
|
302
308
|
theme : 'simple'
|
303
309
|
});
|
304
|
-
|
310
|
+
end_str
|
305
311
|
assert_html_equal expected, tiny_mce_init_script(:mode => :textareas)
|
306
312
|
end
|
307
313
|
|
308
314
|
def test_script_should_convert_numbers
|
309
|
-
expected = <<-
|
315
|
+
expected = <<-end_str
|
310
316
|
tinyMCE.init({
|
311
317
|
mode : 'textareas',
|
312
318
|
theme : 'simple',
|
313
319
|
width : '640'
|
314
320
|
});
|
315
|
-
|
321
|
+
end_str
|
316
322
|
assert_html_equal expected, tiny_mce_init_script(:width => 640)
|
317
323
|
end
|
318
324
|
|
319
325
|
def test_script_should_convert_arrays
|
320
|
-
expected = <<-
|
326
|
+
expected = <<-end_str
|
321
327
|
tinyMCE.init({
|
322
328
|
mode : 'textareas',
|
323
329
|
theme : 'simple',
|
324
330
|
valid_elements : 'b,p,br,i,u'
|
325
331
|
});
|
326
|
-
|
332
|
+
end_str
|
327
333
|
assert_html_equal expected, tiny_mce_init_script(:valid_elements => %w(b p br i u))
|
328
334
|
end
|
329
335
|
|
330
336
|
def test_script_should_convert_boolean_true
|
331
|
-
expected = <<-
|
337
|
+
expected = <<-end_str
|
332
338
|
tinyMCE.init({
|
333
339
|
auto_reset_designmode : true,
|
334
340
|
mode : 'textareas',
|
335
341
|
theme : 'simple'
|
336
342
|
});
|
337
|
-
|
343
|
+
end_str
|
338
344
|
assert_html_equal expected, tiny_mce_init_script(:auto_reset_designmode => true)
|
339
345
|
end
|
340
346
|
|
341
347
|
def test_script_should_convert_boolean_false
|
342
|
-
expected = <<-
|
348
|
+
expected = <<-end_str
|
343
349
|
tinyMCE.init({
|
344
350
|
auto_reset_designmode : false,
|
345
351
|
mode : 'textareas',
|
346
352
|
theme : 'simple'
|
347
353
|
});
|
348
|
-
|
354
|
+
end_str
|
349
355
|
assert_html_equal expected, tiny_mce_init_script(:auto_reset_designmode => false)
|
350
356
|
end
|
351
357
|
|
@@ -354,7 +360,7 @@ class TinyMceHelperScriptTest < Test::Unit::TestCase
|
|
354
360
|
end
|
355
361
|
|
356
362
|
def test_tiny_mce_should_wrap_script_in_javascript_tag
|
357
|
-
expected = <<-
|
363
|
+
expected = <<-end_str
|
358
364
|
<script type="text/javascript">
|
359
365
|
//<![CDATA[
|
360
366
|
tinyMCE.init({
|
@@ -363,7 +369,7 @@ class TinyMceHelperScriptTest < Test::Unit::TestCase
|
|
363
369
|
});
|
364
370
|
//]]>
|
365
371
|
</script>
|
366
|
-
|
372
|
+
end_str
|
367
373
|
assert_html_equal expected, tiny_mce
|
368
374
|
end
|
369
375
|
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tiny_mce_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Pfeifer
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-08-30 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -27,6 +27,9 @@ files:
|
|
27
27
|
- test/app_root
|
28
28
|
- test/app_root/config_bak
|
29
29
|
- test/app_root/config_bak/tiny_mce_options.yml
|
30
|
+
- test/app_root/script
|
31
|
+
- test/app_root/script/rails_framework_root.rb
|
32
|
+
- test/app_root/script/console
|
30
33
|
- test/app_root/config
|
31
34
|
- test/app_root/config/tiny_mce_options.yml
|
32
35
|
- test/app_root/log
|
@@ -38,11 +41,11 @@ files:
|
|
38
41
|
- test/test_helper.rb
|
39
42
|
- test/unit
|
40
43
|
- test/unit/tiny_mce_helper_test.rb
|
41
|
-
- CHANGELOG
|
44
|
+
- CHANGELOG.rdoc
|
42
45
|
- init.rb
|
43
46
|
- install.rb
|
44
47
|
- Rakefile
|
45
|
-
- README
|
48
|
+
- README.rdoc
|
46
49
|
- uninstall.rb
|
47
50
|
has_rdoc: true
|
48
51
|
homepage: http://www.pluginaweek.org
|
@@ -65,8 +68,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
65
68
|
version:
|
66
69
|
requirements: []
|
67
70
|
|
68
|
-
rubyforge_project:
|
69
|
-
rubygems_version: 1.
|
71
|
+
rubyforge_project: pluginaweek
|
72
|
+
rubygems_version: 1.2.0
|
70
73
|
signing_key:
|
71
74
|
specification_version: 2
|
72
75
|
summary: Adds helper methods for creating the TinyMCE initialization script.
|