scormgen 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: db890f45a0064654ffc29ff1e1f13bfbd0ab0f3b
4
+ data.tar.gz: ed2c8a9238e4ac64ae0782ceb85c135929bf4991
5
+ SHA512:
6
+ metadata.gz: 607cfee8645d2a73620251c08ae9b822ae1c81eb829f028f0b0d51fbd55acab76cef186c317b4caefd977683c9e78f87cf948d8caabc7552043c9023593d340b
7
+ data.tar.gz: bc6ec7ad951c2b270e21fc21145b5333e04a8ed91fef104a5b0dde48dd6af92b7ce1686cff7d2357feb709d59bd8ab8c306f56a917aeb94498e5dcd5d2795f70
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.3.3
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at arnaud@semiodesign.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in scormgen.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # SCORMgen
2
+
3
+ Easy SCORM manifest generation.
4
+
5
+ ## Installation
6
+
7
+ Install with:
8
+
9
+ $ gem install scormgen
10
+
11
+ ## Usage
12
+
13
+ Go in the root folder of the module and execute:
14
+
15
+ $ scormgen
16
+
17
+ If you want to specify the identifier run:
18
+
19
+ $ scormgen identifier_of_module
20
+
21
+ If you want to specify the identifier and the namerun:
22
+
23
+ $ scormgen identifier_of_module "Name of module"
24
+
25
+ ## Development
26
+
27
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
28
+
29
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
30
+
31
+ ## Contributing
32
+
33
+ Bug reports and pull requests are welcome on GitHub at https://github.com/arnaudlevy/scormgen. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
34
+
35
+ ## Code of Conduct
36
+
37
+ Everyone interacting in the Scormgen project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/arnaudlevy/scormgen/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "scormgen"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/exe/scormgen ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require 'scormgen/cli'
3
+ Scormgen::CLI.execute ARGV
@@ -0,0 +1,11 @@
1
+ require 'scormgen/generator'
2
+
3
+ module Scormgen
4
+ class CLI
5
+ def self.execute(args)
6
+ identifier = args.count > 0 ? args[0] : nil
7
+ name = args.count > 1 ? args[1] : nil
8
+ Scormgen::Generator.new.run identifier, name
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,96 @@
1
+ require 'zip'
2
+ module Scormgen
3
+ class Generator
4
+ MANIFEST = 'imsmanifest.xml'
5
+ ZIP = 'module.zip'
6
+ IGNORED_FILES = [MANIFEST, ZIP, 'scorm_generator.rb', 'fire_app_log.txt', 'crossdomain.xml', 'config.rb']
7
+
8
+ def run(identifier=nil, name=nil)
9
+ @identifier = identifier.nil? ? default_identifier : identifier
10
+ @name = name.nil? ? @identifier : name
11
+ puts "Generating SCORM manifest for #{@name} (#{identifier})"
12
+
13
+ delete_previous_files
14
+ list_files
15
+ create_manifest
16
+ zip_files
17
+ end
18
+
19
+ protected
20
+
21
+ def delete_previous_files
22
+ File.delete MANIFEST if File.exists? MANIFEST
23
+ File.delete ZIP if File.exists? ZIP
24
+ end
25
+
26
+ def list_files
27
+ @files = []
28
+ Dir.glob("**/*").each do |path|
29
+ next if File.directory? path
30
+ next if IGNORED_FILES.include? path
31
+ @files << path
32
+ end
33
+ puts "#{@files.count} files found"
34
+ end
35
+
36
+ def default_identifier
37
+ File.basename Dir.pwd
38
+ end
39
+
40
+ def create_defaults_from(args)
41
+ @identifier = File.basename Dir.pwd
42
+ @identifier = args[0] if args.count > 0
43
+ @name = @identifier
44
+ @name = args[1] if args.count > 1
45
+ end
46
+
47
+ def create_manifest
48
+ imsmanifest = "<?xml version=\"1.0\" standalone=\"no\" ?>
49
+ <manifest identifier=\"#{@identifier}\"
50
+ xmlns=\"http://www.imsglobal.org/xsd/imscp_v1p1\"
51
+ xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
52
+ xmlns:adlcp=\"http://www.adlnet.org/xsd/adlcp_v1p3\"
53
+ xmlns:adlseq=\"http://www.adlnet.org/xsd/adlseq_v1p3\"
54
+ xmlns:adlnav=\"http://www.adlnet.org/xsd/adlnav_v1p3\"
55
+ xmlns:imsss=\"http://www.imsglobal.org/xsd/imsss\"
56
+ xsi:schemaLocation=\"http://www.imsglobal.org/xsd/imscp_v1p1 imscp_v1p1.xsd
57
+ http://www.adlnet.org/xsd/adlcp_v1p3 adlcp_v1p3.xsd
58
+ http://www.adlnet.org/xsd/adlseq_v1p3 adlseq_v1p3.xsd
59
+ http://www.adlnet.org/xsd/adlnav_v1p3 adlnav_v1p3.xsd
60
+ http://www.imsglobal.org/xsd/imsss imsss_v1p0.xsd\">
61
+ <metadata>
62
+ <schema>ADL SCORM</schema>
63
+ <schemaversion>2004 4th Edition</schemaversion>
64
+ </metadata>
65
+ <organizations default=\"#{@identifier}\">
66
+ <organization identifier=\"#{@identifier}\">
67
+ <title>#{@name}</title>
68
+ <item identifier=\"item-1\" identifierref=\"elearning\">
69
+ <title>#{@name}</title>
70
+ </item>
71
+ </organization>
72
+ </organizations>
73
+ <resources>
74
+ <resource identifier=\"elearning\" type=\"webcontent\" adlcp:scormType=\"sco\" href=\"index.html\">
75
+ "
76
+ @files.each do |file|
77
+ imsmanifest += " <file href=\"#{file}\" />
78
+ "
79
+ end
80
+ imsmanifest += " </resource>
81
+ </resources>
82
+ </manifest>"
83
+ file = File.open(MANIFEST, 'w')
84
+ file.puts imsmanifest
85
+ file.close
86
+ puts "#{MANIFEST} generated"
87
+ end
88
+
89
+ def zip_files
90
+ Zip::File.open(ZIP, Zip::File::CREATE) do |zipfile|
91
+ @files.each { |file| zipfile.add(file, File.join('.', file)) }
92
+ end
93
+ puts "#{ZIP} generated"
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,3 @@
1
+ module Scormgen
2
+ VERSION = "1.0.1"
3
+ end
data/lib/scormgen.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "scormgen/version"
2
+
3
+ module Scormgen
4
+
5
+ end
data/scormgen.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "scormgen/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "scormgen"
8
+ spec.version = Scormgen::VERSION
9
+ spec.authors = ["Arnaud Levy", "Pierre-André Boissinot"]
10
+ spec.email = ["contact@arnaudlevy.com", "pabois@lespoupees.paris"]
11
+
12
+ spec.summary = 'Easy SCORM manifest generation'
13
+ spec.homepage = 'https://github.com/semiodesign/scormgen'
14
+
15
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
16
+ f.match(%r{^(test|spec|features)/})
17
+ end
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_dependency "rubyzip"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.15"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: scormgen
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Arnaud Levy
8
+ - Pierre-André Boissinot
9
+ autorequire:
10
+ bindir: exe
11
+ cert_chain: []
12
+ date: 2017-08-04 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rubyzip
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: bundler
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '1.15'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '1.15'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rake
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '10.0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '10.0'
56
+ description:
57
+ email:
58
+ - contact@arnaudlevy.com
59
+ - pabois@lespoupees.paris
60
+ executables:
61
+ - scormgen
62
+ extensions: []
63
+ extra_rdoc_files: []
64
+ files:
65
+ - ".gitignore"
66
+ - ".ruby-version"
67
+ - CODE_OF_CONDUCT.md
68
+ - Gemfile
69
+ - README.md
70
+ - Rakefile
71
+ - bin/console
72
+ - bin/setup
73
+ - exe/scormgen
74
+ - lib/scormgen.rb
75
+ - lib/scormgen/cli.rb
76
+ - lib/scormgen/generator.rb
77
+ - lib/scormgen/version.rb
78
+ - scormgen.gemspec
79
+ homepage: https://github.com/semiodesign/scormgen
80
+ licenses: []
81
+ metadata: {}
82
+ post_install_message:
83
+ rdoc_options: []
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ requirements: []
97
+ rubyforge_project:
98
+ rubygems_version: 2.5.2
99
+ signing_key:
100
+ specification_version: 4
101
+ summary: Easy SCORM manifest generation
102
+ test_files: []