rubyfox-server 2.16.0.1 → 2.16.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/README.md +19 -0
- data/lib/rubyfox/server/cli.rb +39 -5
- data/lib/rubyfox/server/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a03a6ed51cf5ce37c8b41509aca3a77d4457c3a90e08445a9e93ea28a1bd66be
|
4
|
+
data.tar.gz: 60191e1729c8be8ae5df8cdb7308290e4826771ab56cc6131877149a0bdaea7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 794e3e0b679892b6baf2334291d21e9ef34ac1a02630c666d837bd2013630fbe42dab63facfd15dafd48b41a850a7a55d24450830f0645b8b921ec668e81599a
|
7
|
+
data.tar.gz: d18d1dcc15b0dc516ffc014d14a836f299ea6721e0b92e031df136c86405a023009c1ea3e94c3b414b8e4dc80a91c5876a55df9b6882c500b37a7c28c6cad5d4
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -19,6 +19,7 @@ See http://www.smartfoxserver.com
|
|
19
19
|
smartfox configure /path/to/smartfox /path/to/template/dir
|
20
20
|
|
21
21
|
smartfox start /path/to/smartfox
|
22
|
+
|
22
23
|
|
23
24
|
## Help
|
24
25
|
|
@@ -35,6 +36,24 @@ The version of this gem is tied to the real version of SmartFox Server.
|
|
35
36
|
|
36
37
|
Example: Gem version 2.3.0.x contains SmartFox Server version 2.3.0.
|
37
38
|
|
39
|
+
## Version check
|
40
|
+
|
41
|
+
To enable gem version verification, add a version file to your template folder.
|
42
|
+
|
43
|
+
Example: `.../version`
|
44
|
+
```
|
45
|
+
2.16.0
|
46
|
+
```
|
47
|
+
|
48
|
+
If the version is not satisfied, the following output is printed:
|
49
|
+
```
|
50
|
+
Configuration failed!
|
51
|
+
|
52
|
+
Your rubyfox-server version: 2.15.0.0
|
53
|
+
Needed version: ~>2.16.0
|
54
|
+
```
|
55
|
+
|
56
|
+
|
38
57
|
## Contributing
|
39
58
|
|
40
59
|
1. Fork it
|
data/lib/rubyfox/server/cli.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "thor"
|
2
|
+
require "mime/types"
|
3
3
|
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
4
|
+
require "rubyfox/server"
|
5
|
+
require "rubyfox/server/version"
|
6
|
+
require "rubyfox/server/environment"
|
7
7
|
|
8
8
|
module Rubyfox
|
9
9
|
module Server
|
@@ -15,6 +15,7 @@ module Rubyfox
|
|
15
15
|
end
|
16
16
|
|
17
17
|
desc "install TARGET_DIR", "Install SmartFox Server into TARGET_DIR"
|
18
|
+
|
18
19
|
def install(target_dir)
|
19
20
|
if File.exist?(target_dir)
|
20
21
|
abort "Directory #{target_dir} already exists!"
|
@@ -24,10 +25,13 @@ module Rubyfox
|
|
24
25
|
end
|
25
26
|
|
26
27
|
desc "configure TARGET_DIR TEMPLATE_DIR", "Configure SmartFox Server in TARGET_DIR via TEMPLATE_DIR"
|
28
|
+
|
27
29
|
def configure(target_dir, template_dir)
|
28
30
|
template_dir = File.expand_path(template_dir, Dir.pwd)
|
29
31
|
target_dir = File.expand_path(target_dir, Dir.pwd)
|
30
32
|
|
33
|
+
verify_version(template_dir)
|
34
|
+
|
31
35
|
Dir["#{template_dir}/**/*"].each do |file|
|
32
36
|
if File.file?(file)
|
33
37
|
part = file.partition(template_dir).last
|
@@ -39,10 +43,14 @@ module Rubyfox
|
|
39
43
|
end
|
40
44
|
end
|
41
45
|
end
|
46
|
+
rescue WrongVersionError => e
|
47
|
+
STDERR.puts e.message
|
42
48
|
end
|
49
|
+
|
43
50
|
map "config" => :configure
|
44
51
|
|
45
52
|
desc "start TARGET_DIR", "Start SmartFox Server in TARGET_DIR"
|
53
|
+
|
46
54
|
def start(target_dir)
|
47
55
|
inside(target_dir) do
|
48
56
|
system "sh ./sfs2x.sh"
|
@@ -50,6 +58,7 @@ module Rubyfox
|
|
50
58
|
end
|
51
59
|
|
52
60
|
desc "version", "Display version of this command"
|
61
|
+
|
53
62
|
def version
|
54
63
|
puts Rubyfox::Server::VERSION
|
55
64
|
end
|
@@ -66,6 +75,31 @@ module Rubyfox
|
|
66
75
|
types = MIME::Types.type_for(file)
|
67
76
|
types.empty? || types.any? { |type| type.media_type == "text" }
|
68
77
|
end
|
78
|
+
|
79
|
+
def verify_version(template_dir)
|
80
|
+
filename = "#{template_dir}/version"
|
81
|
+
if File.exist?(filename)
|
82
|
+
expected_version = File.read(filename)
|
83
|
+
version = Rubyfox::Server::VERSION
|
84
|
+
|
85
|
+
unless satisfied_version?(expected_version, version)
|
86
|
+
msg = query = <<~MSG.chomp
|
87
|
+
Configuration failed!
|
88
|
+
|
89
|
+
Your rubyfox-server version: #{version}
|
90
|
+
Needed version: ~>#{expected_version}
|
91
|
+
MSG
|
92
|
+
raise WrongVersionError.new(msg)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def satisfied_version?(expected_version, version)
|
98
|
+
requirement = Gem::Requirement.new("~> #{expected_version}")
|
99
|
+
requirement.satisfied_by?(Gem::Version.create(version))
|
100
|
+
end
|
101
|
+
|
102
|
+
class WrongVersionError < RuntimeError; end
|
69
103
|
end
|
70
104
|
end
|
71
105
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubyfox-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.16.0.
|
4
|
+
version: 2.16.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Leitzen
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-08-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -1180,7 +1180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1180
1180
|
- !ruby/object:Gem::Version
|
1181
1181
|
version: '0'
|
1182
1182
|
requirements: []
|
1183
|
-
rubygems_version: 3.
|
1183
|
+
rubygems_version: 3.1.4
|
1184
1184
|
signing_key:
|
1185
1185
|
specification_version: 4
|
1186
1186
|
summary: ''
|