rubyfox-server 2.16.0.1 → 2.16.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71b5d2a3a58cb2cc1f18932f1e42567866e586151c6e8f9f5461d16c0c1e15b2
4
- data.tar.gz: 3c994763d0573bd68de34494b34741adbda1df6a70b05dcffdd96e5c653fcafa
3
+ metadata.gz: a03a6ed51cf5ce37c8b41509aca3a77d4457c3a90e08445a9e93ea28a1bd66be
4
+ data.tar.gz: 60191e1729c8be8ae5df8cdb7308290e4826771ab56cc6131877149a0bdaea7e
5
5
  SHA512:
6
- metadata.gz: be9ad06b978a7820d23acaa170483518e03f0e2b51c994fc74f693f7ef02e8dd020c674c525181992cecdf76e8649d4aa92344d3e0cb26031043d04278110b64
7
- data.tar.gz: ebe6fad363f2cd14a01c0b872c83a192b59c353b8388e134173c843737021688f03eabb1748e6a21e9d8d470a14ddf60291bd7c4e73b1eae4050fc235f9917ec
6
+ metadata.gz: 794e3e0b679892b6baf2334291d21e9ef34ac1a02630c666d837bd2013630fbe42dab63facfd15dafd48b41a850a7a55d24450830f0645b8b921ec668e81599a
7
+ data.tar.gz: d18d1dcc15b0dc516ffc014d14a836f299ea6721e0b92e031df136c86405a023009c1ea3e94c3b414b8e4dc80a91c5876a55df9b6882c500b37a7c28c6cad5d4
@@ -1,3 +1,4 @@
1
1
  rvm:
2
- - 2.3.1
2
+ - 2.7.1
3
+ - 2.6.6
3
4
  - ruby-head
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
@@ -1,9 +1,9 @@
1
- require 'thor'
2
- require 'mime/types'
1
+ require "thor"
2
+ require "mime/types"
3
3
 
4
- require 'rubyfox/server'
5
- require 'rubyfox/server/version'
6
- require 'rubyfox/server/environment'
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
@@ -1,5 +1,5 @@
1
1
  module Rubyfox
2
2
  module Server
3
- VERSION = "2.16.0.1"
3
+ VERSION = "2.16.0.2"
4
4
  end
5
5
  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.1
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-07-28 00:00:00.000000000 Z
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.0.6
1183
+ rubygems_version: 3.1.4
1184
1184
  signing_key:
1185
1185
  specification_version: 4
1186
1186
  summary: ''