mumukit-sync 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +12 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +49 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/mumukit/sync.rb +28 -0
- data/lib/mumukit/sync/inflator.rb +14 -0
- data/lib/mumukit/sync/inflator/choice.rb +11 -0
- data/lib/mumukit/sync/inflator/exercise.rb +11 -0
- data/lib/mumukit/sync/inflator/gobstones_kids_boards.rb +35 -0
- data/lib/mumukit/sync/inflator/multiple_choice.rb +15 -0
- data/lib/mumukit/sync/inflator/single_choice.rb +12 -0
- data/lib/mumukit/sync/store.rb +12 -0
- data/lib/mumukit/sync/store/bibliotheca.rb +23 -0
- data/lib/mumukit/sync/store/github.rb +59 -0
- data/lib/mumukit/sync/store/github/bot.rb +76 -0
- data/lib/mumukit/sync/store/github/exercise_builder.rb +19 -0
- data/lib/mumukit/sync/store/github/git_lib.rb +14 -0
- data/lib/mumukit/sync/store/github/guide_builder.rb +43 -0
- data/lib/mumukit/sync/store/github/guide_export.rb +50 -0
- data/lib/mumukit/sync/store/github/guide_import.rb +14 -0
- data/lib/mumukit/sync/store/github/guide_reader.rb +88 -0
- data/lib/mumukit/sync/store/github/guide_writer.rb +89 -0
- data/lib/mumukit/sync/store/github/licenses/COPYRIGHT.txt.erb +5 -0
- data/lib/mumukit/sync/store/github/licenses/LICENSE.txt +428 -0
- data/lib/mumukit/sync/store/github/licenses/README.md.erb +6 -0
- data/lib/mumukit/sync/store/github/operation.rb +47 -0
- data/lib/mumukit/sync/store/github/ordering.rb +23 -0
- data/lib/mumukit/sync/store/github/schema.rb +123 -0
- data/lib/mumukit/sync/store/github/schema/exercise.rb +37 -0
- data/lib/mumukit/sync/store/github/schema/guide.rb +28 -0
- data/lib/mumukit/sync/store/github/with_file_reading.rb +19 -0
- data/lib/mumukit/sync/store/json.rb +27 -0
- data/lib/mumukit/sync/store/thesaurus.rb +19 -0
- data/lib/mumukit/sync/syncer.rb +63 -0
- data/lib/mumukit/sync/version.rb +5 -0
- data/mumukit-sync.gemspec +34 -0
- metadata +198 -0
@@ -0,0 +1,76 @@
|
|
1
|
+
class Mumukit::Sync::Store::Github
|
2
|
+
class Bot
|
3
|
+
attr_accessor :token, :name, :email
|
4
|
+
|
5
|
+
def initialize(name, email, token)
|
6
|
+
ensure_present! name, email
|
7
|
+
@name = name
|
8
|
+
@email = email
|
9
|
+
@token = token
|
10
|
+
end
|
11
|
+
|
12
|
+
def ensure_exists!(slug, private)
|
13
|
+
create!(slug, private) unless exists?(slug)
|
14
|
+
end
|
15
|
+
|
16
|
+
def clone_into(repo, dir, &block)
|
17
|
+
local_repo = Git.clone(writable_github_url_for(repo), '.', path: dir)
|
18
|
+
local_repo.config('user.name', name)
|
19
|
+
local_repo.config('user.email', email)
|
20
|
+
yield dir, local_repo
|
21
|
+
rescue Git::GitExecuteError => e
|
22
|
+
raise 'Repository is private or does not exist' if private_repo_error(e.message)
|
23
|
+
raise e
|
24
|
+
end
|
25
|
+
|
26
|
+
def register_post_commit_hook!(slug, web_hook_base_url)
|
27
|
+
octokit.create_hook(
|
28
|
+
slug.to_s, 'web',
|
29
|
+
{url: "#{web_hook_base_url}/#{to_s}", content_type: 'json'},
|
30
|
+
{events: ['push'],
|
31
|
+
active: true})
|
32
|
+
rescue => e
|
33
|
+
puts "not registering post commit hook: #{e.message}"
|
34
|
+
end
|
35
|
+
|
36
|
+
def authenticated?
|
37
|
+
!!token
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.from_env
|
41
|
+
new ENV['MUMUKI_BOT_USERNAME'], ENV['MUMUKI_BOT_EMAIL'], ENV['MUMUKI_API_TOKEN']
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def exists?(slug)
|
47
|
+
Git.ls_remote(writable_github_url_for(slug))
|
48
|
+
true
|
49
|
+
rescue Git::GitExecuteError
|
50
|
+
false
|
51
|
+
end
|
52
|
+
|
53
|
+
def create!(slug, private)
|
54
|
+
octokit.create_repository(slug.repository, organization: slug.organization)
|
55
|
+
try_set_private!(slug) if private
|
56
|
+
end
|
57
|
+
|
58
|
+
def try_set_private!(slug)
|
59
|
+
octokit.set_private(slug.to_s)
|
60
|
+
rescue Octokit::NotFound
|
61
|
+
puts "#{slug.to_s} repository can't be set as private"
|
62
|
+
end
|
63
|
+
|
64
|
+
def writable_github_url_for(slug)
|
65
|
+
"https://#{token}:@github.com/#{slug}"
|
66
|
+
end
|
67
|
+
|
68
|
+
def octokit
|
69
|
+
Octokit::Client.new(access_token: token)
|
70
|
+
end
|
71
|
+
|
72
|
+
def private_repo_error(message)
|
73
|
+
['could not read Username', 'Invalid username or password'].any? { |it| message.include? it }
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class Mumukit::Sync::Store::Github
|
2
|
+
class ExerciseBuilder < OpenStruct
|
3
|
+
def locale
|
4
|
+
meta['locale']
|
5
|
+
end
|
6
|
+
|
7
|
+
def build
|
8
|
+
build_metadata.merge(build_simple_fields).compact
|
9
|
+
end
|
10
|
+
|
11
|
+
def build_simple_fields
|
12
|
+
Mumukit::Sync::Store::Github::Schema::Exercise.simple_fields.map { |field| [field.reverse_name, self.send(field.reverse_name)] }.to_h
|
13
|
+
end
|
14
|
+
|
15
|
+
def build_metadata
|
16
|
+
Mumukit::Sync::Store::Github::Schema::Exercise.metadata_fields.map { |field| [field.reverse_name, meta[field.name.to_s]] }.to_h
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class Git::Lib
|
2
|
+
# Monkey patch to add --ignore-unmatch option
|
3
|
+
def remove(path = '.', opts = {})
|
4
|
+
arr_opts = %w(-f --ignore-unmatch)
|
5
|
+
arr_opts << ['-r'] if opts[:recursive]
|
6
|
+
arr_opts << '--'
|
7
|
+
if path.is_a?(Array)
|
8
|
+
arr_opts += path
|
9
|
+
else
|
10
|
+
arr_opts << path
|
11
|
+
end
|
12
|
+
command('rm', arr_opts)
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
class Mumukit::Sync::Store::Github
|
2
|
+
class GuideBuilder < OpenStruct
|
3
|
+
attr_writer :exercises
|
4
|
+
|
5
|
+
def initialize(slug)
|
6
|
+
super()
|
7
|
+
self.slug = slug
|
8
|
+
end
|
9
|
+
|
10
|
+
def exercises
|
11
|
+
@exercises ||= []
|
12
|
+
end
|
13
|
+
|
14
|
+
def build
|
15
|
+
build_json.compact
|
16
|
+
end
|
17
|
+
|
18
|
+
def add_exercise(exercise)
|
19
|
+
self.exercises << exercise
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def build_json
|
25
|
+
{name: name,
|
26
|
+
description: description,
|
27
|
+
corollary: corollary,
|
28
|
+
language: language,
|
29
|
+
locale: locale,
|
30
|
+
type: type,
|
31
|
+
extra: extra,
|
32
|
+
beta: beta,
|
33
|
+
authors: authors,
|
34
|
+
collaborators: collaborators,
|
35
|
+
teacher_info: teacher_info,
|
36
|
+
id_format: id_format,
|
37
|
+
slug: slug,
|
38
|
+
expectations: expectations.to_a,
|
39
|
+
exercises: exercises.sort_by { |e| order.position_for(e[:id]) }}
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
class Mumukit::Sync::Store::Github
|
2
|
+
class GuideExport < Mumukit::Sync::Store::Github::Operation
|
3
|
+
|
4
|
+
attr_accessor :guide_resource_h, :bot, :author_email
|
5
|
+
|
6
|
+
def initialize(options)
|
7
|
+
super(options)
|
8
|
+
@guide_resource_h = options[:document]
|
9
|
+
@author_email = options[:author_email]
|
10
|
+
end
|
11
|
+
|
12
|
+
def repo
|
13
|
+
@repo ||= Mumukit::Auth::Slug.parse(guide_resource_h[:slug])
|
14
|
+
end
|
15
|
+
|
16
|
+
def can_run?
|
17
|
+
bot.authenticated?
|
18
|
+
end
|
19
|
+
|
20
|
+
def before_run_in_local_repo
|
21
|
+
bot.ensure_exists! repo, guide_resource_h[:private]
|
22
|
+
end
|
23
|
+
|
24
|
+
def run_in_local_repo(dir, local_repo)
|
25
|
+
clear_repo local_repo
|
26
|
+
GuideWriter.new(dir, log).write_guide! guide_resource_h
|
27
|
+
local_repo.add(all: true)
|
28
|
+
local_repo.commit("Mumuki Export on #{Time.now}", commit_options)
|
29
|
+
local_repo.push
|
30
|
+
rescue Git::GitExecuteError => e
|
31
|
+
puts "Could not export guide #{guide_resource_h[:slug]} to git #{e}"
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def commit_options
|
38
|
+
author_email.present? ? {author: "#{author_email} <#{author_email}>"} : {}
|
39
|
+
end
|
40
|
+
|
41
|
+
def clear_repo(local_repo)
|
42
|
+
local_repo.remove %w(LICENSE.txt README.md COPYRIGHT.txt AUTHORS.txt COLLABORATORS.txt description.md corollary.md meta.yml extra.yml expectations.* *_*/*)
|
43
|
+
rescue Git::GitExecuteError => e
|
44
|
+
puts 'Nothing to clean, repo seems to be empty'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
class OrganizationNotFoundError < StandardError
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class Mumukit::Sync::Store::Github
|
2
|
+
class GuideImport < Mumukit::Sync::Store::Github::Operation
|
3
|
+
attr_accessor :repo, :guide
|
4
|
+
|
5
|
+
def initialize(options)
|
6
|
+
super(options)
|
7
|
+
@repo = options[:repo]
|
8
|
+
end
|
9
|
+
|
10
|
+
def run_in_local_repo(dir, local_repo)
|
11
|
+
GuideReader.new(dir, repo).read_guide!
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
class Mumukit::Sync::Store::Github
|
2
|
+
class GuideReader
|
3
|
+
include Mumukit::Sync::Store::Github::WithFileReading
|
4
|
+
|
5
|
+
attr_reader :dir
|
6
|
+
|
7
|
+
def initialize(dir, repo)
|
8
|
+
@dir = File.expand_path(dir)
|
9
|
+
@slug = repo.to_s
|
10
|
+
end
|
11
|
+
|
12
|
+
def read_guide!
|
13
|
+
builder = GuideBuilder.new(@slug)
|
14
|
+
|
15
|
+
read_meta! builder
|
16
|
+
Mumukit::Sync::Store::Github::Schema::Guide.file_fields.each do |it|
|
17
|
+
value = it.read_field_file(dir)
|
18
|
+
builder[it.reverse_name] = value
|
19
|
+
end
|
20
|
+
read_exercises! builder
|
21
|
+
|
22
|
+
builder.build
|
23
|
+
end
|
24
|
+
|
25
|
+
def read_meta!(builder)
|
26
|
+
meta = read_yaml_file(File.join(dir, 'meta.yml'))
|
27
|
+
|
28
|
+
raise 'Missing meta.yml' unless meta
|
29
|
+
|
30
|
+
builder.language = { name: meta['language'] }
|
31
|
+
builder.locale = meta['locale']
|
32
|
+
|
33
|
+
read! 'name', builder, meta
|
34
|
+
read! 'id_format', builder, meta
|
35
|
+
read! 'type', builder, meta
|
36
|
+
read! 'beta', builder, meta
|
37
|
+
read! 'teacher_info', builder, meta
|
38
|
+
|
39
|
+
read_legacy! builder, meta
|
40
|
+
|
41
|
+
builder.order = Mumukit::Sync::Store::Github::Ordering.from meta['order']
|
42
|
+
end
|
43
|
+
|
44
|
+
def read_legacy!(builder, meta)
|
45
|
+
builder.id_format ||= meta['original_id_format']
|
46
|
+
builder.type ||= meta['learning'] ? 'learning' : 'practice'
|
47
|
+
end
|
48
|
+
|
49
|
+
def read!(key, builder, meta)
|
50
|
+
builder[key] = meta[key]
|
51
|
+
end
|
52
|
+
|
53
|
+
def read_exercises!(builder)
|
54
|
+
read_exercises do |exercise_builder|
|
55
|
+
builder.add_exercise exercise_builder.build
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def read_exercises
|
60
|
+
each_exercise_file do |root, position, id, name|
|
61
|
+
builder = ExerciseBuilder.new
|
62
|
+
|
63
|
+
meta = read_yaml_file(File.join(root, 'meta.yml'))
|
64
|
+
|
65
|
+
builder.meta = meta
|
66
|
+
builder.id = id
|
67
|
+
builder.name = meta['name'] || name
|
68
|
+
|
69
|
+
Mumukit::Sync::Store::Github::Schema::Exercise.file_fields.each do |it|
|
70
|
+
value = it.read_field_file(root)
|
71
|
+
builder[it.reverse_name] = value
|
72
|
+
end
|
73
|
+
yield builder
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
private
|
78
|
+
|
79
|
+
def each_exercise_file
|
80
|
+
Dir.glob("#{@dir}/**").sort.each_with_index do |file, index|
|
81
|
+
basename = File.basename(file)
|
82
|
+
match = /(\d*)_(.+)/.match basename
|
83
|
+
next unless match
|
84
|
+
yield file, index + 1, match[1].to_i, match[2]
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
class Mumukit::Sync::Store::Github
|
2
|
+
class GuideWriter
|
3
|
+
attr_accessor :dir
|
4
|
+
|
5
|
+
def initialize(dir)
|
6
|
+
@dir = dir
|
7
|
+
end
|
8
|
+
|
9
|
+
def write_file_fields!(base_path, schema, element, language)
|
10
|
+
schema.file_fields.each do |it|
|
11
|
+
file_name = it.get_file_name(language)
|
12
|
+
write_file! base_path, file_name, it.get_field_value(element) if it.field_value_present?(element)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def write_metadata_fields!(base_path, schema, e)
|
17
|
+
metadata = schema.metadata_fields.map do |field|
|
18
|
+
[field.name.to_s, field.get_field_value(e)]
|
19
|
+
end.to_h.compact.merge('name' => e[:name]).to_yaml
|
20
|
+
write_file! base_path, 'meta.yml', metadata
|
21
|
+
end
|
22
|
+
|
23
|
+
def write_guide!(guide)
|
24
|
+
guide[:exercises].each do |e|
|
25
|
+
write_exercise! guide, e
|
26
|
+
end
|
27
|
+
write_licenses!(guide)
|
28
|
+
|
29
|
+
write_metadata_fields! dir, Mumukit::Sync::Store::Github::Schema::Guide, guide
|
30
|
+
write_file_fields! dir, Mumukit::Sync::Store::Github::Schema::Guide, guide, guide[:language]
|
31
|
+
end
|
32
|
+
|
33
|
+
def format_id(guide, exercise)
|
34
|
+
guide[:id_format] % exercise[:id]
|
35
|
+
end
|
36
|
+
|
37
|
+
def write_exercise!(guide, e)
|
38
|
+
dirname = File.join dir, to_fs_friendly_name("#{format_id(guide, e)}_#{e[:name]}")
|
39
|
+
|
40
|
+
FileUtils.mkdir_p dirname
|
41
|
+
|
42
|
+
write_metadata_fields! dirname, Mumukit::Sync::Store::Github::Schema::Exercise, e
|
43
|
+
write_file_fields! dirname, Mumukit::Sync::Store::Github::Schema::Exercise, e, (e[:language] || guide[:language])
|
44
|
+
end
|
45
|
+
|
46
|
+
def write_licenses!(guide)
|
47
|
+
write_file! dir, 'COPYRIGHT.txt', copyright_content(guide)
|
48
|
+
write_file! dir, 'README.md', readme_content(guide)
|
49
|
+
copy_file! 'LICENSE.txt'
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def default_filename(guide)
|
55
|
+
"default.#{guide[:language][:extension]}"
|
56
|
+
end
|
57
|
+
|
58
|
+
def write_file!(dirname, name, content)
|
59
|
+
File.write(File.join(dirname, name), content)
|
60
|
+
end
|
61
|
+
|
62
|
+
def copyright_content(guide)
|
63
|
+
@guide_authors = guide[:authors]
|
64
|
+
@guide_repo_url = "https://github.com/#{guide[:slug]}"
|
65
|
+
ERB.new(read_file 'COPYRIGHT.txt.erb').result binding
|
66
|
+
end
|
67
|
+
|
68
|
+
def readme_content(guide)
|
69
|
+
@copyright = copyright_content guide
|
70
|
+
ERB.new(read_file 'README.md.erb').result binding
|
71
|
+
end
|
72
|
+
|
73
|
+
def copy_file!(name)
|
74
|
+
FileUtils.cp licenses_dir(name), dir
|
75
|
+
end
|
76
|
+
|
77
|
+
def read_file(name)
|
78
|
+
File.read licenses_dir(name)
|
79
|
+
end
|
80
|
+
|
81
|
+
def licenses_dir(name)
|
82
|
+
File.join __dir__, 'licenses', name
|
83
|
+
end
|
84
|
+
|
85
|
+
def to_fs_friendly_name(dirname)
|
86
|
+
dirname.gsub /[\x00\/\\:\*\.\?\"<>\|]/, '_'
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,428 @@
|
|
1
|
+
Attribution-ShareAlike 4.0 International
|
2
|
+
|
3
|
+
=======================================================================
|
4
|
+
|
5
|
+
Creative Commons Corporation ("Creative Commons") is not a law firm and
|
6
|
+
does not provide legal services or legal advice. Distribution of
|
7
|
+
Creative Commons public licenses does not create a lawyer-client or
|
8
|
+
other relationship. Creative Commons makes its licenses and related
|
9
|
+
information available on an "as-is" basis. Creative Commons gives no
|
10
|
+
warranties regarding its licenses, any material licensed under their
|
11
|
+
terms and conditions, or any related information. Creative Commons
|
12
|
+
disclaims all liability for damages resulting from their use to the
|
13
|
+
fullest extent possible.
|
14
|
+
|
15
|
+
Using Creative Commons Public Licenses
|
16
|
+
|
17
|
+
Creative Commons public licenses provide a standard set of terms and
|
18
|
+
conditions that creators and other rights holders may use to share
|
19
|
+
original works of authorship and other material subject to copyright
|
20
|
+
and certain other rights specified in the public license below. The
|
21
|
+
following considerations are for informational purposes only, are not
|
22
|
+
exhaustive, and do not form part of our licenses.
|
23
|
+
|
24
|
+
Considerations for licensors: Our public licenses are
|
25
|
+
intended for use by those authorized to give the public
|
26
|
+
permission to use material in ways otherwise restricted by
|
27
|
+
copyright and certain other rights. Our licenses are
|
28
|
+
irrevocable. Licensors should read and understand the terms
|
29
|
+
and conditions of the license they choose before applying it.
|
30
|
+
Licensors should also secure all rights necessary before
|
31
|
+
applying our licenses so that the public can reuse the
|
32
|
+
material as expected. Licensors should clearly mark any
|
33
|
+
material not subject to the license. This includes other CC-
|
34
|
+
licensed material, or material used under an exception or
|
35
|
+
limitation to copyright. More considerations for licensors:
|
36
|
+
wiki.creativecommons.org/Considerations_for_licensors
|
37
|
+
|
38
|
+
Considerations for the public: By using one of our public
|
39
|
+
licenses, a licensor grants the public permission to use the
|
40
|
+
licensed material under specified terms and conditions. If
|
41
|
+
the licensor's permission is not necessary for any reason--for
|
42
|
+
example, because of any applicable exception or limitation to
|
43
|
+
copyright--then that use is not regulated by the license. Our
|
44
|
+
licenses grant only permissions under copyright and certain
|
45
|
+
other rights that a licensor has authority to grant. Use of
|
46
|
+
the licensed material may still be restricted for other
|
47
|
+
reasons, including because others have copyright or other
|
48
|
+
rights in the material. A licensor may make special requests,
|
49
|
+
such as asking that all changes be marked or described.
|
50
|
+
Although not required by our licenses, you are encouraged to
|
51
|
+
respect those requests where reasonable. More_considerations
|
52
|
+
for the public:
|
53
|
+
wiki.creativecommons.org/Considerations_for_licensees
|
54
|
+
|
55
|
+
=======================================================================
|
56
|
+
|
57
|
+
Creative Commons Attribution-ShareAlike 4.0 International Public
|
58
|
+
License
|
59
|
+
|
60
|
+
By exercising the Licensed Rights (defined below), You accept and agree
|
61
|
+
to be bound by the terms and conditions of this Creative Commons
|
62
|
+
Attribution-ShareAlike 4.0 International Public License ("Public
|
63
|
+
License"). To the extent this Public License may be interpreted as a
|
64
|
+
contract, You are granted the Licensed Rights in consideration of Your
|
65
|
+
acceptance of these terms and conditions, and the Licensor grants You
|
66
|
+
such rights in consideration of benefits the Licensor receives from
|
67
|
+
making the Licensed Material available under these terms and
|
68
|
+
conditions.
|
69
|
+
|
70
|
+
|
71
|
+
Section 1 -- Definitions.
|
72
|
+
|
73
|
+
a. Adapted Material means material subject to Copyright and Similar
|
74
|
+
Rights that is derived from or based upon the Licensed Material
|
75
|
+
and in which the Licensed Material is translated, altered,
|
76
|
+
arranged, transformed, or otherwise modified in a manner requiring
|
77
|
+
permission under the Copyright and Similar Rights held by the
|
78
|
+
Licensor. For purposes of this Public License, where the Licensed
|
79
|
+
Material is a musical work, performance, or sound recording,
|
80
|
+
Adapted Material is always produced where the Licensed Material is
|
81
|
+
synched in timed relation with a moving image.
|
82
|
+
|
83
|
+
b. Adapter's License means the license You apply to Your Copyright
|
84
|
+
and Similar Rights in Your contributions to Adapted Material in
|
85
|
+
accordance with the terms and conditions of this Public License.
|
86
|
+
|
87
|
+
c. BY-SA Compatible License means a license listed at
|
88
|
+
creativecommons.org/compatiblelicenses, approved by Creative
|
89
|
+
Commons as essentially the equivalent of this Public License.
|
90
|
+
|
91
|
+
d. Copyright and Similar Rights means copyright and/or similar rights
|
92
|
+
closely related to copyright including, without limitation,
|
93
|
+
performance, broadcast, sound recording, and Sui Generis Database
|
94
|
+
Rights, without regard to how the rights are labeled or
|
95
|
+
categorized. For purposes of this Public License, the rights
|
96
|
+
specified in Section 2(b)(1)-(2) are not Copyright and Similar
|
97
|
+
Rights.
|
98
|
+
|
99
|
+
e. Effective Technological Measures means those measures that, in the
|
100
|
+
absence of proper authority, may not be circumvented under laws
|
101
|
+
fulfilling obligations under Article 11 of the WIPO Copyright
|
102
|
+
Treaty adopted on December 20, 1996, and/or similar international
|
103
|
+
agreements.
|
104
|
+
|
105
|
+
f. Exceptions and Limitations means fair use, fair dealing, and/or
|
106
|
+
any other exception or limitation to Copyright and Similar Rights
|
107
|
+
that applies to Your use of the Licensed Material.
|
108
|
+
|
109
|
+
g. License Elements means the license attributes listed in the name
|
110
|
+
of a Creative Commons Public License. The License Elements of this
|
111
|
+
Public License are Attribution and ShareAlike.
|
112
|
+
|
113
|
+
h. Licensed Material means the artistic or literary work, database,
|
114
|
+
or other material to which the Licensor applied this Public
|
115
|
+
License.
|
116
|
+
|
117
|
+
i. Licensed Rights means the rights granted to You subject to the
|
118
|
+
terms and conditions of this Public License, which are limited to
|
119
|
+
all Copyright and Similar Rights that apply to Your use of the
|
120
|
+
Licensed Material and that the Licensor has authority to license.
|
121
|
+
|
122
|
+
j. Licensor means the individual(s) or entity(ies) granting rights
|
123
|
+
under this Public License.
|
124
|
+
|
125
|
+
k. Share means to provide material to the public by any means or
|
126
|
+
process that requires permission under the Licensed Rights, such
|
127
|
+
as reproduction, public display, public performance, distribution,
|
128
|
+
dissemination, communication, or importation, and to make material
|
129
|
+
available to the public including in ways that members of the
|
130
|
+
public may access the material from a place and at a time
|
131
|
+
individually chosen by them.
|
132
|
+
|
133
|
+
l. Sui Generis Database Rights means rights other than copyright
|
134
|
+
resulting from Directive 96/9/EC of the European Parliament and of
|
135
|
+
the Council of 11 March 1996 on the legal protection of databases,
|
136
|
+
as amended and/or succeeded, as well as other essentially
|
137
|
+
equivalent rights anywhere in the world.
|
138
|
+
|
139
|
+
m. You means the individual or entity exercising the Licensed Rights
|
140
|
+
under this Public License. Your has a corresponding meaning.
|
141
|
+
|
142
|
+
|
143
|
+
Section 2 -- Scope.
|
144
|
+
|
145
|
+
a. License grant.
|
146
|
+
|
147
|
+
1. Subject to the terms and conditions of this Public License,
|
148
|
+
the Licensor hereby grants You a worldwide, royalty-free,
|
149
|
+
non-sublicensable, non-exclusive, irrevocable license to
|
150
|
+
exercise the Licensed Rights in the Licensed Material to:
|
151
|
+
|
152
|
+
a. reproduce and Share the Licensed Material, in whole or
|
153
|
+
in part; and
|
154
|
+
|
155
|
+
b. produce, reproduce, and Share Adapted Material.
|
156
|
+
|
157
|
+
2. Exceptions and Limitations. For the avoidance of doubt, where
|
158
|
+
Exceptions and Limitations apply to Your use, this Public
|
159
|
+
License does not apply, and You do not need to comply with
|
160
|
+
its terms and conditions.
|
161
|
+
|
162
|
+
3. Term. The term of this Public License is specified in Section
|
163
|
+
6(a).
|
164
|
+
|
165
|
+
4. Media and formats; technical modifications allowed. The
|
166
|
+
Licensor authorizes You to exercise the Licensed Rights in
|
167
|
+
all media and formats whether now known or hereafter created,
|
168
|
+
and to make technical modifications necessary to do so. The
|
169
|
+
Licensor waives and/or agrees not to assert any right or
|
170
|
+
authority to forbid You from making technical modifications
|
171
|
+
necessary to exercise the Licensed Rights, including
|
172
|
+
technical modifications necessary to circumvent Effective
|
173
|
+
Technological Measures. For purposes of this Public License,
|
174
|
+
simply making modifications authorized by this Section 2(a)
|
175
|
+
(4) never produces Adapted Material.
|
176
|
+
|
177
|
+
5. Downstream recipients.
|
178
|
+
|
179
|
+
a. Offer from the Licensor -- Licensed Material. Every
|
180
|
+
recipient of the Licensed Material automatically
|
181
|
+
receives an offer from the Licensor to exercise the
|
182
|
+
Licensed Rights under the terms and conditions of this
|
183
|
+
Public License.
|
184
|
+
|
185
|
+
b. Additional offer from the Licensor -- Adapted Material.
|
186
|
+
Every recipient of Adapted Material from You
|
187
|
+
automatically receives an offer from the Licensor to
|
188
|
+
exercise the Licensed Rights in the Adapted Material
|
189
|
+
under the conditions of the Adapter's License You apply.
|
190
|
+
|
191
|
+
c. No downstream restrictions. You may not offer or impose
|
192
|
+
any additional or different terms or conditions on, or
|
193
|
+
apply any Effective Technological Measures to, the
|
194
|
+
Licensed Material if doing so restricts exercise of the
|
195
|
+
Licensed Rights by any recipient of the Licensed
|
196
|
+
Material.
|
197
|
+
|
198
|
+
6. No endorsement. Nothing in this Public License constitutes or
|
199
|
+
may be construed as permission to assert or imply that You
|
200
|
+
are, or that Your use of the Licensed Material is, connected
|
201
|
+
with, or sponsored, endorsed, or granted official status by,
|
202
|
+
the Licensor or others designated to receive attribution as
|
203
|
+
provided in Section 3(a)(1)(A)(i).
|
204
|
+
|
205
|
+
b. Other rights.
|
206
|
+
|
207
|
+
1. Moral rights, such as the right of integrity, are not
|
208
|
+
licensed under this Public License, nor are publicity,
|
209
|
+
privacy, and/or other similar personality rights; however, to
|
210
|
+
the extent possible, the Licensor waives and/or agrees not to
|
211
|
+
assert any such rights held by the Licensor to the limited
|
212
|
+
extent necessary to allow You to exercise the Licensed
|
213
|
+
Rights, but not otherwise.
|
214
|
+
|
215
|
+
2. Patent and trademark rights are not licensed under this
|
216
|
+
Public License.
|
217
|
+
|
218
|
+
3. To the extent possible, the Licensor waives any right to
|
219
|
+
collect royalties from You for the exercise of the Licensed
|
220
|
+
Rights, whether directly or through a collecting society
|
221
|
+
under any voluntary or waivable statutory or compulsory
|
222
|
+
licensing scheme. In all other cases the Licensor expressly
|
223
|
+
reserves any right to collect such royalties.
|
224
|
+
|
225
|
+
|
226
|
+
Section 3 -- License Conditions.
|
227
|
+
|
228
|
+
Your exercise of the Licensed Rights is expressly made subject to the
|
229
|
+
following conditions.
|
230
|
+
|
231
|
+
a. Attribution.
|
232
|
+
|
233
|
+
1. If You Share the Licensed Material (including in modified
|
234
|
+
form), You must:
|
235
|
+
|
236
|
+
a. retain the following if it is supplied by the Licensor
|
237
|
+
with the Licensed Material:
|
238
|
+
|
239
|
+
i. identification of the creator(s) of the Licensed
|
240
|
+
Material and any others designated to receive
|
241
|
+
attribution, in any reasonable manner requested by
|
242
|
+
the Licensor (including by pseudonym if
|
243
|
+
designated);
|
244
|
+
|
245
|
+
ii. a copyright notice;
|
246
|
+
|
247
|
+
iii. a notice that refers to this Public License;
|
248
|
+
|
249
|
+
iv. a notice that refers to the disclaimer of
|
250
|
+
warranties;
|
251
|
+
|
252
|
+
v. a URI or hyperlink to the Licensed Material to the
|
253
|
+
extent reasonably practicable;
|
254
|
+
|
255
|
+
b. indicate if You modified the Licensed Material and
|
256
|
+
retain an indication of any previous modifications; and
|
257
|
+
|
258
|
+
c. indicate the Licensed Material is licensed under this
|
259
|
+
Public License, and include the text of, or the URI or
|
260
|
+
hyperlink to, this Public License.
|
261
|
+
|
262
|
+
2. You may satisfy the conditions in Section 3(a)(1) in any
|
263
|
+
reasonable manner based on the medium, means, and context in
|
264
|
+
which You Share the Licensed Material. For example, it may be
|
265
|
+
reasonable to satisfy the conditions by providing a URI or
|
266
|
+
hyperlink to a resource that includes the required
|
267
|
+
information.
|
268
|
+
|
269
|
+
3. If requested by the Licensor, You must remove any of the
|
270
|
+
information required by Section 3(a)(1)(A) to the extent
|
271
|
+
reasonably practicable.
|
272
|
+
|
273
|
+
b. ShareAlike.
|
274
|
+
|
275
|
+
In addition to the conditions in Section 3(a), if You Share
|
276
|
+
Adapted Material You produce, the following conditions also apply.
|
277
|
+
|
278
|
+
1. The Adapter's License You apply must be a Creative Commons
|
279
|
+
license with the same License Elements, this version or
|
280
|
+
later, or a BY-SA Compatible License.
|
281
|
+
|
282
|
+
2. You must include the text of, or the URI or hyperlink to, the
|
283
|
+
Adapter's License You apply. You may satisfy this condition
|
284
|
+
in any reasonable manner based on the medium, means, and
|
285
|
+
context in which You Share Adapted Material.
|
286
|
+
|
287
|
+
3. You may not offer or impose any additional or different terms
|
288
|
+
or conditions on, or apply any Effective Technological
|
289
|
+
Measures to, Adapted Material that restrict exercise of the
|
290
|
+
rights granted under the Adapter's License You apply.
|
291
|
+
|
292
|
+
|
293
|
+
Section 4 -- Sui Generis Database Rights.
|
294
|
+
|
295
|
+
Where the Licensed Rights include Sui Generis Database Rights that
|
296
|
+
apply to Your use of the Licensed Material:
|
297
|
+
|
298
|
+
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
|
299
|
+
to extract, reuse, reproduce, and Share all or a substantial
|
300
|
+
portion of the contents of the database;
|
301
|
+
|
302
|
+
b. if You include all or a substantial portion of the database
|
303
|
+
contents in a database in which You have Sui Generis Database
|
304
|
+
Rights, then the database in which You have Sui Generis Database
|
305
|
+
Rights (but not its individual contents) is Adapted Material,
|
306
|
+
|
307
|
+
including for purposes of Section 3(b); and
|
308
|
+
c. You must comply with the conditions in Section 3(a) if You Share
|
309
|
+
all or a substantial portion of the contents of the database.
|
310
|
+
|
311
|
+
For the avoidance of doubt, this Section 4 supplements and does not
|
312
|
+
replace Your obligations under this Public License where the Licensed
|
313
|
+
Rights include other Copyright and Similar Rights.
|
314
|
+
|
315
|
+
|
316
|
+
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
|
317
|
+
|
318
|
+
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
|
319
|
+
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
|
320
|
+
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
|
321
|
+
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
|
322
|
+
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
|
323
|
+
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
324
|
+
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
|
325
|
+
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
|
326
|
+
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
|
327
|
+
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
|
328
|
+
|
329
|
+
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
|
330
|
+
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
|
331
|
+
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
|
332
|
+
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
|
333
|
+
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
|
334
|
+
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
|
335
|
+
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
|
336
|
+
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
|
337
|
+
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
|
338
|
+
|
339
|
+
c. The disclaimer of warranties and limitation of liability provided
|
340
|
+
above shall be interpreted in a manner that, to the extent
|
341
|
+
possible, most closely approximates an absolute disclaimer and
|
342
|
+
waiver of all liability.
|
343
|
+
|
344
|
+
|
345
|
+
Section 6 -- Term and Termination.
|
346
|
+
|
347
|
+
a. This Public License applies for the term of the Copyright and
|
348
|
+
Similar Rights licensed here. However, if You fail to comply with
|
349
|
+
this Public License, then Your rights under this Public License
|
350
|
+
terminate automatically.
|
351
|
+
|
352
|
+
b. Where Your right to use the Licensed Material has terminated under
|
353
|
+
Section 6(a), it reinstates:
|
354
|
+
|
355
|
+
1. automatically as of the date the violation is cured, provided
|
356
|
+
it is cured within 30 days of Your discovery of the
|
357
|
+
violation; or
|
358
|
+
|
359
|
+
2. upon express reinstatement by the Licensor.
|
360
|
+
|
361
|
+
For the avoidance of doubt, this Section 6(b) does not affect any
|
362
|
+
right the Licensor may have to seek remedies for Your violations
|
363
|
+
of this Public License.
|
364
|
+
|
365
|
+
c. For the avoidance of doubt, the Licensor may also offer the
|
366
|
+
Licensed Material under separate terms or conditions or stop
|
367
|
+
distributing the Licensed Material at any time; however, doing so
|
368
|
+
will not terminate this Public License.
|
369
|
+
|
370
|
+
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
|
371
|
+
License.
|
372
|
+
|
373
|
+
|
374
|
+
Section 7 -- Other Terms and Conditions.
|
375
|
+
|
376
|
+
a. The Licensor shall not be bound by any additional or different
|
377
|
+
terms or conditions communicated by You unless expressly agreed.
|
378
|
+
|
379
|
+
b. Any arrangements, understandings, or agreements regarding the
|
380
|
+
Licensed Material not stated herein are separate from and
|
381
|
+
independent of the terms and conditions of this Public License.
|
382
|
+
|
383
|
+
|
384
|
+
Section 8 -- Interpretation.
|
385
|
+
|
386
|
+
a. For the avoidance of doubt, this Public License does not, and
|
387
|
+
shall not be interpreted to, reduce, limit, restrict, or impose
|
388
|
+
conditions on any use of the Licensed Material that could lawfully
|
389
|
+
be made without permission under this Public License.
|
390
|
+
|
391
|
+
b. To the extent possible, if any provision of this Public License is
|
392
|
+
deemed unenforceable, it shall be automatically reformed to the
|
393
|
+
minimum extent necessary to make it enforceable. If the provision
|
394
|
+
cannot be reformed, it shall be severed from this Public License
|
395
|
+
without affecting the enforceability of the remaining terms and
|
396
|
+
conditions.
|
397
|
+
|
398
|
+
c. No term or condition of this Public License will be waived and no
|
399
|
+
failure to comply consented to unless expressly agreed to by the
|
400
|
+
Licensor.
|
401
|
+
|
402
|
+
d. Nothing in this Public License constitutes or may be interpreted
|
403
|
+
as a limitation upon, or waiver of, any privileges and immunities
|
404
|
+
that apply to the Licensor or You, including from the legal
|
405
|
+
processes of any jurisdiction or authority.
|
406
|
+
|
407
|
+
|
408
|
+
=======================================================================
|
409
|
+
|
410
|
+
Creative Commons is not a party to its public
|
411
|
+
licenses. Notwithstanding, Creative Commons may elect to apply one of
|
412
|
+
its public licenses to material it publishes and in those instances
|
413
|
+
will be considered the “Licensor.” The text of the Creative Commons
|
414
|
+
public licenses is dedicated to the public domain under the CC0 Public
|
415
|
+
Domain Dedication. Except for the limited purpose of indicating that
|
416
|
+
material is shared under a Creative Commons public license or as
|
417
|
+
otherwise permitted by the Creative Commons policies published at
|
418
|
+
creativecommons.org/policies, Creative Commons does not authorize the
|
419
|
+
use of the trademark "Creative Commons" or any other trademark or logo
|
420
|
+
of Creative Commons without its prior written consent including,
|
421
|
+
without limitation, in connection with any unauthorized modifications
|
422
|
+
to any of its public licenses or any other arrangements,
|
423
|
+
understandings, or agreements concerning use of licensed material. For
|
424
|
+
the avoidance of doubt, this paragraph does not form part of the
|
425
|
+
public licenses.
|
426
|
+
|
427
|
+
Creative Commons may be contacted at creativecommons.org.
|
428
|
+
|