fedux_org-stdlib 0.11.0 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/Gemfile.lock +3 -1
- data/Rakefile +1 -0
- data/lib/fedux_org_stdlib/app_config.rb +1 -1
- data/lib/fedux_org_stdlib/rake/webserver_task.rb +67 -33
- data/lib/fedux_org_stdlib/rake_tasks/webserver.rb +7 -0
- data/lib/fedux_org_stdlib/remote_repository.rb +1 -1
- data/lib/fedux_org_stdlib/version.rb +1 -1
- data/rakefiles/default.rake +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c2e096b92bc1d2125c38615514cd90d45e16326
|
4
|
+
data.tar.gz: 079ff1edb1d88d57f32abc49f374e9b8bdd4e913
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af0bc7a4cc94d94bb1e2566c7111dfddcf27f8089a12f387063f4ac87f8a175f7592b295f48550666a9b0913186d1101ed14ae49303dbdc09f80c70017820130
|
7
|
+
data.tar.gz: f2e87f3f819133f2da4d19f5e72138a26fbdf04210bc486c2373e3ea765352d656187e79fd94b1ebff06ee90e3c20ff1a95a2174fe4b672f4d11145ecd25b190
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fedux_org-stdlib (0.
|
4
|
+
fedux_org-stdlib (0.11.0)
|
5
5
|
activesupport
|
6
6
|
|
7
7
|
PATH
|
@@ -58,6 +58,7 @@ GEM
|
|
58
58
|
diff-lcs (1.2.5)
|
59
59
|
docile (1.1.5)
|
60
60
|
erubis (2.7.0)
|
61
|
+
excon (0.41.0)
|
61
62
|
facter (2.3.0)
|
62
63
|
CFPropertyList (~> 2.2.6)
|
63
64
|
ffi (1.9.6)
|
@@ -166,6 +167,7 @@ DEPENDENCIES
|
|
166
167
|
coveralls
|
167
168
|
cucumber
|
168
169
|
erubis
|
170
|
+
excon
|
169
171
|
facter
|
170
172
|
fedux_org-stdlib!
|
171
173
|
fedux_org_stdlib-fixtures-plugin_manager-load!
|
data/Rakefile
CHANGED
@@ -5,7 +5,7 @@ require 'fedux_org_stdlib/process_environment'
|
|
5
5
|
require 'fedux_org_stdlib/core_ext/array/list'
|
6
6
|
require 'fedux_org_stdlib/core_ext/hash/list'
|
7
7
|
require 'fedux_org_stdlib/logging/logger'
|
8
|
-
require_library %w(json psych active_support/core_ext/hash/keys active_support/core_ext/string/inflections set active_support/core_ext/hash/slice active_support/core_ext/object/blank active_support/core_ext/hash/keys)
|
8
|
+
require_library %w(json psych active_support/core_ext/hash/reverse_merge active_support/core_ext/hash/keys active_support/core_ext/string/inflections set active_support/core_ext/hash/slice active_support/core_ext/object/blank active_support/core_ext/hash/keys)
|
9
9
|
|
10
10
|
module FeduxOrgStdlib
|
11
11
|
# This class makes a config file available as an object. The config file
|
@@ -1,11 +1,10 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require 'fedux_org_stdlib/require_files'
|
3
3
|
require 'fedux_org_stdlib/rake/task'
|
4
|
-
require_library %w(i18n)
|
5
|
-
require 'tmpdir'
|
6
|
-
require 'fileutils'
|
7
4
|
require 'digest/sha2'
|
8
5
|
|
6
|
+
require_library %w(active_support/core_ext/string/strip excon addressable/uri)
|
7
|
+
|
9
8
|
module FeduxOrgStdlib
|
10
9
|
module Rake
|
11
10
|
# Webserver Task
|
@@ -14,67 +13,102 @@ module FeduxOrgStdlib
|
|
14
13
|
class WebserverTask < Task
|
15
14
|
# @!attribute [r] report
|
16
15
|
# The report to be generated
|
17
|
-
attr_reader :
|
16
|
+
attr_reader :site, :directory, :index_file_content, :files, :checksums_file, :checksums
|
18
17
|
|
19
18
|
# Create a new webserver task
|
20
19
|
#
|
21
20
|
# @param [String] directory
|
22
21
|
# The directory where the generated server should be stored
|
23
|
-
# @param [String]
|
22
|
+
# @param [String] url
|
24
23
|
# The url which should be used to fetch the remote repository
|
25
|
-
# @param [Array] build_directory (/tmp/webserver.xxx)
|
26
|
-
# The directory where the executables should be build
|
27
|
-
# @param [Array] build_script (build.sh)
|
28
|
-
# The script which should be used to build the executables
|
29
|
-
#
|
30
24
|
# @example Create new task
|
31
25
|
# FeduxOrgStdlib::Rake::WebserverTask.new
|
32
26
|
def initialize(
|
33
27
|
directory: File.expand_path('utils/server'),
|
34
|
-
|
35
|
-
|
36
|
-
|
28
|
+
site: 'http://fedux.org/downloads/local_webserver',
|
29
|
+
checksums_file: 'CHECKSUMS',
|
30
|
+
index_file_content: nil,
|
31
|
+
files: %w(
|
32
|
+
private_server.darwin.amd64
|
33
|
+
private_server.linux.amd64
|
34
|
+
private_server.windows.amd64.exe
|
35
|
+
public_server.darwin.amd64
|
36
|
+
public_server.linux.amd64
|
37
|
+
public_server.windows.amd64.exe
|
38
|
+
),
|
39
|
+
redirect_to: nil,
|
37
40
|
**args
|
38
41
|
)
|
39
42
|
super(**args)
|
40
43
|
|
41
|
-
@
|
42
|
-
@
|
43
|
-
@
|
44
|
-
@
|
44
|
+
@site = Addressable::URI.heuristic_parse(site)
|
45
|
+
@files = Array(files)
|
46
|
+
@checksums_file = checksums_file
|
47
|
+
@directory = File.expand_path(directory)
|
48
|
+
@index_file_content = if index_file_content
|
49
|
+
index_file_content
|
50
|
+
elsif redirect_to
|
51
|
+
redirect_to_destination(redirect_to)
|
52
|
+
else
|
53
|
+
nil
|
54
|
+
end
|
45
55
|
end
|
46
56
|
|
47
57
|
# @private
|
48
58
|
def run_task(_verbose)
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
copy_files_to_destination_directory
|
59
|
+
fetch_checksums
|
60
|
+
fetch_files
|
61
|
+
create_index_file unless index_file_content.blank?
|
53
62
|
end
|
54
63
|
|
55
64
|
private
|
56
65
|
|
57
|
-
def
|
58
|
-
|
66
|
+
def create_index_file
|
67
|
+
File.write(File.join(directory, 'index.html'), index_file_content)
|
59
68
|
end
|
60
69
|
|
61
|
-
def
|
62
|
-
|
70
|
+
def redirect_to_destination(destination)
|
71
|
+
<<-EOS.strip_heredoc
|
72
|
+
<head>
|
73
|
+
<meta http-equiv="refresh" content="0; URL=#{destination}">
|
74
|
+
</head>
|
75
|
+
EOS
|
63
76
|
end
|
64
77
|
|
65
|
-
def
|
66
|
-
|
67
|
-
|
78
|
+
def fetch_checksums
|
79
|
+
url = site.to_s + '/' + checksums_file
|
80
|
+
response = Excon.get(url)
|
81
|
+
|
82
|
+
puts "[INFO] Fetching #{url}."
|
83
|
+
fail "[ERROR] Error while downloading #{url}." unless response.status == 200
|
84
|
+
|
85
|
+
@checksums = response.body.split("\n").each_with_object({}) do |e,a|
|
86
|
+
sum, file = e.split(/\s+/)
|
87
|
+
|
88
|
+
a[file] = sum
|
68
89
|
end
|
69
90
|
end
|
70
91
|
|
71
|
-
def
|
72
|
-
|
73
|
-
|
92
|
+
def fetch_files
|
93
|
+
files.each do |f|
|
94
|
+
url = site.to_s + '/' + f
|
95
|
+
|
96
|
+
puts "[INFO] Fetching #{url}"
|
97
|
+
response = Excon.get(url)
|
98
|
+
|
99
|
+
fail "[ERROR] Error while downloading \"#{url}\"." unless response.status == 200
|
100
|
+
puts "[INFO] Checking downloaded content against checksum \"#{checksums[f]}\"."
|
101
|
+
fail "[ERROR] Checksum error for file \"#{url}\"." unless has_checksum?(response.body, checksums[f])
|
102
|
+
|
103
|
+
path = File.join(directory, f)
|
104
|
+
puts "[INFO] Save content to #{path}."
|
105
|
+
FileUtils.mkdir_p File.dirname(path)
|
106
|
+
File.write(path, response.body)
|
107
|
+
end
|
74
108
|
end
|
75
109
|
|
76
|
-
def
|
77
|
-
|
110
|
+
def has_checksum?(file, sum)
|
111
|
+
Digest::SHA256.hexdigest(file) == sum
|
78
112
|
end
|
79
113
|
end
|
80
114
|
end
|
data/rakefiles/default.rake
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fedux_org-stdlib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max Meyer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -151,6 +151,7 @@ files:
|
|
151
151
|
- lib/fedux_org_stdlib/rake_tasks/tests/cucumber.rb
|
152
152
|
- lib/fedux_org_stdlib/rake_tasks/tests/rspec.rb
|
153
153
|
- lib/fedux_org_stdlib/rake_tasks/tests/travis.rb
|
154
|
+
- lib/fedux_org_stdlib/rake_tasks/webserver.rb
|
154
155
|
- lib/fedux_org_stdlib/recursive_file_finder.rb
|
155
156
|
- lib/fedux_org_stdlib/remote_repository.rb
|
156
157
|
- lib/fedux_org_stdlib/require_files.rb
|