tiny_mce_helper 0.1.0 → 0.1.1

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.
data/CHANGELOG.rdoc CHANGED
@@ -1,5 +1,10 @@
1
1
  == master
2
2
 
3
+ == 0.1.1 / 2008-10-19
4
+
5
+ * Fix TinyMCE temp file getting closed/deleted too soon after being downloaded [Brandon Goodin]
6
+ * Add more descriptive output during installation
7
+
3
8
  == 0.1.0 / 2008-08-30
4
9
 
5
10
  * Remove references to system wget/unzip calls for cross-platform compatibility
data/Rakefile CHANGED
@@ -5,11 +5,11 @@ require 'rake/contrib/sshpublisher'
5
5
 
6
6
  spec = Gem::Specification.new do |s|
7
7
  s.name = 'tiny_mce_helper'
8
- s.version = '0.1.0'
8
+ s.version = '0.1.1'
9
9
  s.platform = Gem::Platform::RUBY
10
10
  s.summary = 'Adds helper methods for creating the TinyMCE initialization script.'
11
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)
12
+ s.files = FileList['{lib,tasks,test}/**/*'] + %w(CHANGELOG.rdoc init.rb install.rb Rakefile README.rdoc uninstall.rb) - FileList['test/app_root/{log,log/*,script,script/*}']
13
13
  s.require_path = 'lib'
14
14
  s.has_rdoc = true
15
15
  s.test_files = Dir['test/**/*_test.rb']
@@ -75,39 +75,44 @@ module PluginAWeek #:nodoc:
75
75
  require 'hpricot'
76
76
  require 'open-uri'
77
77
 
78
+ puts "Finding url of TinyMCE-#{version || 'latest'} download..." if verbose
78
79
  doc = Hpricot(open('http://sourceforge.net/project/showfiles.php?group_id=103281&package_id=111430'))
79
80
  if version
80
- version.gsub!('.', '_')
81
- file_element = (doc/'tr[@id*="rel0_"] a').detect {|file| file.innerHTML =~ /#{version}.zip$/}
81
+ url_version = version.gsub('.', '_')
82
+ file_element = (doc/'tr[@id*="rel0_"] a').detect {|file| file.innerHTML =~ /#{url_version}.zip$/}
82
83
  raise ArgumentError, "Could not find TinyMCE version #{version}" if !file_element
83
84
  else
84
- file_element = (doc/'tr[@id^="pkg0_1rel0_"] a').detect {|file| file.innerHTML.to_s =~ /\d\.zip$/}
85
+ file_element = (doc/'tr[@id^="pkg0_1rel0_"] a').detect {|file| file.innerHTML.to_s =~ /tinymce_([\d_]+).zip$/}
85
86
  raise ArgumentError, 'Could not find latest TinyMCE version' if !file_element
87
+
88
+ version = $1.gsub('_', '.')
86
89
  end
87
90
 
88
91
  filename = file_element.innerHTML
89
92
  file_url = file_element['href']
90
93
 
91
94
  # 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 }
95
+ puts "Downloading TinyMCE-#{version} source from #{file_url}..." if verbose
96
+ open(file_url) do |file|
97
+ file_path = file.path
98
+
99
+ # Extract and install
100
+ puts "Extracting source from #{file_path}..." if verbose
101
+
102
+ require 'zip/zip'
103
+ require 'zip/zipfilesystem'
104
+
105
+ Zip::ZipFile.open(file_path) do |zipfile|
106
+ zipfile.entries.each do |entry|
107
+ if match = /tinymce\/jscripts\/tiny_mce\/(.*)/.match(entry.name)
108
+ FileUtils.mkdir_p("#{target_path}/#{File.dirname(match[1])}")
109
+ entry.extract("#{target_path}/#{match[1]}") { true }
110
+ end
106
111
  end
107
112
  end
113
+
114
+ puts 'Done!' if verbose
108
115
  end
109
-
110
- puts 'Done!' if verbose
111
116
  end
112
117
 
113
118
  # Uninstalls the TinyMCE installation and optional configuration file
data/test/test_helper.rb CHANGED
@@ -1,3 +1,8 @@
1
+ # Setup default folders
2
+ require 'fileutils'
3
+ FileUtils.rm_rf('test/app_root/config')
4
+ FileUtils.cp_r('test/app_root/config_bak', 'test/app_root/config')
5
+
1
6
  # Load the plugin testing framework
2
7
  $:.unshift("#{File.dirname(__FILE__)}/../../plugin_test_helper/lib")
3
8
  require 'rubygems'
@@ -41,7 +41,6 @@ end
41
41
  class TinyMceInstallerTest < Test::Unit::TestCase
42
42
  def setup
43
43
  # Set up public path
44
- @public_root = "#{Rails.root}/public"
45
44
  FileUtils.mkdir_p("#{Rails.root}/public/javascripts")
46
45
 
47
46
  # Set default STDIN value
@@ -128,17 +127,12 @@ class TinyMceInstallerTest < Test::Unit::TestCase
128
127
  end
129
128
 
130
129
  def teardown
131
- FileUtils.rm_rf(@public_root)
130
+ FileUtils.rm_rf("#{Rails.root}/public")
132
131
  end
133
132
  end
134
133
 
135
134
  class TinyMceUpdaterTest < Test::Unit::TestCase
136
135
  def setup
137
- # Set up config path
138
- @config_root = "#{Rails.root}/config"
139
- FileUtils.cp("#{Rails.root}/config_bak/tiny_mce_options.yml", @config_root)
140
- @original_config_files = Dir["#{Rails.root}/config/**/*"].sort
141
-
142
136
  # Track valid options
143
137
  @original_valid_options = PluginAWeek::TinyMCEHelper.valid_options.dup
144
138
  end
@@ -163,19 +157,14 @@ class TinyMceUpdaterTest < Test::Unit::TestCase
163
157
 
164
158
  def teardown
165
159
  PluginAWeek::TinyMCEHelper.valid_options = @original_valid_options
160
+ FileUtils.cp("#{Rails.root}/config_bak/tiny_mce_options.yml", "#{Rails.root}/config")
166
161
  end
167
162
  end
168
163
 
169
164
  class TinyMceUninstallerTest < Test::Unit::TestCase
170
165
  def setup
171
166
  # Set up public path
172
- @public_root = "#{Rails.root}/public"
173
167
  FileUtils.mkdir_p("#{Rails.root}/public/javascripts")
174
-
175
- # Set up config path
176
- @config_root = "#{Rails.root}/config"
177
- FileUtils.cp("#{Rails.root}/config_bak/tiny_mce_options.yml", @config_root)
178
- @original_config_files = Dir["#{Rails.root}/config/**/*"].sort
179
168
  end
180
169
 
181
170
  def test_uninstall_should_remove_options_configuration
@@ -191,7 +180,8 @@ class TinyMceUninstallerTest < Test::Unit::TestCase
191
180
  end
192
181
 
193
182
  def teardown
194
- FileUtils.rm_rf(@public_root)
183
+ FileUtils.rm_rf("#{Rails.root}/public")
184
+ FileUtils.cp("#{Rails.root}/config_bak/tiny_mce_options.yml", "#{Rails.root}/config")
195
185
  end
196
186
  end
197
187
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiny_mce_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Pfeifer
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-08-30 00:00:00 -04:00
12
+ date: 2008-10-19 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -27,12 +27,8 @@ 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
33
30
  - test/app_root/config
34
31
  - test/app_root/config/tiny_mce_options.yml
35
- - test/app_root/log
36
32
  - test/files
37
33
  - test/files/wiki.html
38
34
  - test/files/tinymce_3_0_6_2.zip
@@ -1,8 +0,0 @@
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"
@@ -1 +0,0 @@
1
- RAILS_FRAMEWORK_ROOT = '/home/aaron/Projects/Vendor/rails'