mediawiki-testwiki 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,13 @@
1
+ namespace :docker do
2
+
3
+ docker_tasks docker_container_name, image = docker_image_name
4
+
5
+ task :build => config.config_files do
6
+ docker_build image
7
+ end
8
+
9
+ task :start do
10
+ puts "Admin user: #{config.username}, password: #{config.password}"
11
+ end
12
+
13
+ end
@@ -0,0 +1,28 @@
1
+ require 'rake/clean'
2
+ require 'erb'
3
+
4
+ directory config.build_path
5
+
6
+ config.config_files = {
7
+ setup: 'LocalSettings.php', export: config.dump_file
8
+ }.map { |task, file|
9
+ File.join(config.build_path, file).tap { |path|
10
+ file_size(path => config.build_path) { |t|
11
+ t.enhance(["setup:#{task}"]) if t.needed?
12
+ }
13
+ }
14
+ }
15
+
16
+ config.build_files = FileList[
17
+ File.join(config.template_path, "*#{ext = '.erb'}")
18
+ ].map { |template|
19
+ File.join(config.build_path, File.basename(template, ext)).tap { |path|
20
+ file(path => template) {
21
+ File.write(path, ERB.new(File.read(template)).result(binding))
22
+ File.chmod(File.stat(template).mode, path)
23
+ }
24
+ }
25
+ }
26
+
27
+ CLEAN.include(*config.build_files)
28
+ CLOBBER.include(config.build_path)
@@ -0,0 +1,17 @@
1
+ desc 'Build MediaWiki image'
2
+ task :build => 'docker:build'
3
+
4
+ desc 'Start MediaWiki server'
5
+ task :start => 'docker:start'
6
+
7
+ desc 'Stop MediaWiki server'
8
+ task :stop => 'docker:stop'
9
+
10
+ desc 'Restart MediaWiki server'
11
+ task :restart => 'docker:restart'
12
+
13
+ desc 'Shutdown MediaWiki server'
14
+ task :shut => 'docker:clean'
15
+
16
+ %w[clean clobber].each { |task| task(task =>
17
+ %w[setup docker].map { |namespace| "#{namespace}:#{task}" }) }
@@ -0,0 +1,46 @@
1
+ namespace :setup do
2
+
3
+ docker_tasks name = docker_container_name(true), image = docker_image_name(true)
4
+
5
+ task :config_files do
6
+ touch config.config_files
7
+ end
8
+
9
+ task :build => [:config_files, *config.build_files] do
10
+ docker_build image
11
+ end
12
+
13
+ task :config => :start do
14
+ url, cfg = docker_url(name), config.config_files.first
15
+
16
+ broken, args = broken_version?(ENV['STRICTVERSION']),
17
+ ["#{url}/mw-config/", config.data_path, cfg]
18
+
19
+ verified_version?(ENV['STRICTVERSION']) ?
20
+ broken ? setup_broken(cfg) : setup_manual(*args << nil << true) :
21
+ begin
22
+ require 'mechanize'
23
+ rescue LoadError => err
24
+ broken ? setup_broken(err) : setup_manual(*args << err)
25
+ else ENV['NOMECHANIZE'] ?
26
+ broken ? setup_broken(nil) : setup_manual(*args) : setup_mechanize(*args)
27
+ end
28
+
29
+ fix_config(cfg, File.basename(url))
30
+ end
31
+
32
+ task :dump => :config do
33
+ path = File.join(docker_volume(name),
34
+ config.data_directory, config.database_file)
35
+
36
+ args = %W[sqlite3 -batch -cmd .mode\ insert -cmd .dump #{path} .exit]
37
+ args.unshift('sudo') unless ENV['NOSUDO']
38
+
39
+ File.write(config.config_files.last, IO.popen(args, &:read).chomp)
40
+ end
41
+
42
+ task :setup => [:build, :config]
43
+
44
+ task :export => [:dump, :clean]
45
+
46
+ end
@@ -0,0 +1,31 @@
1
+ module MediaWiki
2
+
3
+ module TestWiki
4
+
5
+ module Version
6
+
7
+ MAJOR = 0
8
+ MINOR = 0
9
+ TINY = 1
10
+
11
+ class << self
12
+
13
+ # Returns array representation.
14
+ def to_a
15
+ [MAJOR, MINOR, TINY]
16
+ end
17
+
18
+ # Short-cut for version string.
19
+ def to_s
20
+ to_a.join('.')
21
+ end
22
+
23
+ end
24
+
25
+ end
26
+
27
+ VERSION = Version.to_s
28
+
29
+ end
30
+
31
+ end
@@ -0,0 +1 @@
1
+ require_relative 'media_wiki/test_wiki'
metadata ADDED
@@ -0,0 +1,134 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mediawiki-testwiki
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jens Wille
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-09-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: docker_helper
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.0.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.0.2
27
+ - !ruby/object:Gem::Dependency
28
+ name: mechanize
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 2.7.3
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 2.7.3
41
+ - !ruby/object:Gem::Dependency
42
+ name: hen
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Provides pre-configured MediaWiki wikis as Docker images.
70
+ email: jens.wille@gmail.com
71
+ executables: []
72
+ extensions: []
73
+ extra_rdoc_files:
74
+ - README
75
+ - COPYING
76
+ - ChangeLog
77
+ files:
78
+ - COPYING
79
+ - ChangeLog
80
+ - README
81
+ - Rakefile
82
+ - lib/media_wiki/test_wiki.rb
83
+ - lib/media_wiki/test_wiki/config.rb
84
+ - lib/media_wiki/test_wiki/docker_helper.rb
85
+ - lib/media_wiki/test_wiki/docker_pool.rb
86
+ - lib/media_wiki/test_wiki/rake_helper.rb
87
+ - lib/media_wiki/test_wiki/rake_tasks.rb
88
+ - lib/media_wiki/test_wiki/rspec_adapter.rb
89
+ - lib/media_wiki/test_wiki/tasks/docker.rake
90
+ - lib/media_wiki/test_wiki/tasks/files.rake
91
+ - lib/media_wiki/test_wiki/tasks/main.rake
92
+ - lib/media_wiki/test_wiki/tasks/setup.rake
93
+ - lib/media_wiki/test_wiki/version.rb
94
+ - lib/mediawiki-testwiki.rb
95
+ homepage: http://github.com/blackwinter/mediawiki-testwiki
96
+ licenses:
97
+ - AGPL-3.0
98
+ metadata: {}
99
+ post_install_message: |2+
100
+
101
+ mediawiki-testwiki-0.0.1 [2014-09-26]:
102
+
103
+ * First release.
104
+
105
+ rdoc_options:
106
+ - "--title"
107
+ - mediawiki-testwiki Application documentation (v0.0.1)
108
+ - "--charset"
109
+ - UTF-8
110
+ - "--line-numbers"
111
+ - "--all"
112
+ - "--main"
113
+ - README
114
+ require_paths:
115
+ - lib
116
+ required_ruby_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: 1.9.3
121
+ required_rubygems_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ requirements:
127
+ - docker.io
128
+ - sqlite3 (development)
129
+ rubyforge_project:
130
+ rubygems_version: 2.4.1
131
+ signing_key:
132
+ specification_version: 4
133
+ summary: MediaWiki test wikis based on Docker.
134
+ test_files: []