diff --git a/lib/scorm/package.rb b/lib/scorm/package.rb index 4f3ab8d..30527b9 100644 --- a/lib/scorm/package.rb +++ b/lib/scorm/package.rb @@ -74,7 +74,7 @@ def initialize(filename, options = {}, &block) i = (i || 0) + 1 # Make sure the generated path is unique. - end while File.exists?(@path) + end while File.exist?(@path) end # Extract the package @@ -112,7 +112,7 @@ def close # Cleans up by deleting all extracted files. Called when an error occurs. def cleanup - FileUtils.rmtree(@path) if @options[:cleanup] && !@options[:dry_run] && @path && File.exists?(@path) && package? + FileUtils.rmtree(@path) if @options[:cleanup] && !@options[:dry_run] && @path && File.exist?(@path) && package? end # Extracts the content of the package to the course repository. This will be @@ -134,7 +134,7 @@ def extract!(force = false) Zip::ZipFile::foreach(@package) do |entry| entry_path = File.join(@path, entry.name) entry_dir = File.dirname(entry_path) - FileUtils.mkdir_p(entry_dir) unless File.exists?(entry_dir) + FileUtils.mkdir_p(entry_dir) unless File.exist?(entry_dir) entry.extract(entry_path) end end @@ -152,7 +152,7 @@ def package? # set to +true+ when opening the package the file will not be # extracted to the file system, but read directly into memory. def file(filename) - if File.exists?(@path) + if File.exist?(@path) File.read(path_to(filename)) else Zip::ZipFile.foreach(@package) do |entry| @@ -163,8 +163,8 @@ def file(filename) # Returns +true+ if the specified file (or directory) exists in the package. def exists?(filename) - if File.exists?(@path) - File.exists?(path_to(filename)) + if File.exist?(@path) + File.exist?(path_to(filename)) else Zip::ZipFile::foreach(@package) do |entry| return true if entry.name == filename @@ -205,4 +205,4 @@ def files end end end -end \ No newline at end of file +end diff --git a/scorm.gemspec b/scorm.gemspec index dd86e97..ffb32b3 100644 --- a/scorm.gemspec +++ b/scorm.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'scorm' - s.version = '1.0.2' + s.version = '2.0.0' s.summary = 'Ruby library for reading, extracting and generating SCORM files.' s.description = 'SCORM is a Ruby library for reading and extracting Shareable Content Object Reference Model (SCORM) files. SCORM is a standardized package format used mainly by e-learning software to help with the exchange of course material between systems in an interoperable way. This gem supports SCORM 1.2 and SCORM 2004.' @@ -15,5 +15,6 @@ Gem::Specification.new do |s| s.executables = ['scorm'] s.default_executable = 'scorm' - s.add_dependency('rubyzip', '~> 0.9.4') -end \ No newline at end of file + s.add_dependency('rubyzip', '~> 2.3.2') + s.add_dependency('zip-zip', '= 0.3') +end