8000 8046 - Back. Добавление SCORM-пакетов при создании курса by oleg-khil · Pull Request #1 · SecretAgents/scorm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

8046 - Back. Добавление SCORM-пакетов при создании курса #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/scorm/package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -152,7 +152,7 @@ def package?
# set to +true+ when opening the package the file will <em>not</em> 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|
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scorm.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ Gem::Specification.new do |s|
s.executables = ['scorm']
s.default_executable = 'scorm'

s.add_dependency('rubyzip', '~> 0.9.4')
s.add_dependency('rubyzip', '~> 2')
end
0