webcommand 0.1.3 → 0.1.4

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: d7af4f1c0a28aa9cc60b71f6d90d1c05c2e3bf4ea34c2a31fbac06ab26c73586
4
- data.tar.gz: 57dbe78c08bea74f2644f1409bd83b5155ba46f46cc816df19dc9f5504a069d4
3
+ metadata.gz: 0ab170912e3f5f6894da78adc829a98a2af5a244cf254c1bbce200506fcceda1
4
+ data.tar.gz: d69a2d9ce59c2d13a46d388ce20a313d3b472cdc6b5007cfb56cb1960876a427
5
5
  SHA512:
6
- metadata.gz: 378cdcb11d019bdc2b65360eae2390f37239cb23237c221cec97d939678aa06e919c581c54514e8e8a6fdd512487ee3f9f1807eda7c626854c1edde11032ec4c
7
- data.tar.gz: eae1a6f679ba2eab644e9180e5fe3ff4c07a5ad04a8ef054e58eeb84ba2b055f85ee63fb8b935430acb637808e2e63de44c799f2c6d899715ab365ee26b1302b
6
+ metadata.gz: 1c5803beb7e93505a2941cb79b055b2bc8ec98e8893994ebf7dc5e492af284b1eb31fb625b4d951816a0a4b960d4508c1df71bc7eaf8c36e67e4eca247dea7a9
7
+ data.tar.gz: 8859ab578c0fbcf0f4e39c070f27ce8191797a478736ce671d52f61f4927f64295ad71faf9b3c7ccfa8a8b2b50aaaac9bce8a95769b806336ac2941641dad64b
@@ -3,6 +3,7 @@ language: ruby
3
3
  rvm:
4
4
  - 2.5
5
5
  - 2.6
6
+ - 2.7
6
7
  before_script:
7
8
  - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
8
9
  - chmod +x ./cc-test-reporter
@@ -1,9 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- webcommand (0.1.3)
4
+ webcommand (0.1.4)
5
5
  mustache (~> 1.0)
6
- puma (>= 4.2.1, < 4.4.0)
7
6
  rack-contrib (~> 2.1.0)
8
7
  sinatra (~> 2.0.7)
9
8
  thor (~> 0.20.3)
@@ -35,7 +34,6 @@ GEM
35
34
  mustache (1.1.1)
36
35
  mustermann (1.1.1)
37
36
  ruby2_keywords (~> 0.0.1)
38
- nio4r (2.5.2)
39
37
  parser (2.6.5.0)
40
38
  ast (~> 2.4.0)
41
39
  pastel (0.7.3)
@@ -49,8 +47,6 @@ GEM
49
47
  pry (0.12.2)
50
48
  coderay (~> 1.1.0)
51
49
  method_source (~> 0.9.0)
52
- puma (4.2.1)
53
- nio4r (~> 2.0)
54
50
  rack (2.0.8)
55
51
  rack-contrib (2.1.0)
56
52
  rack (~> 2.0)
@@ -58,7 +54,7 @@ GEM
58
54
  rack
59
55
  rack-test (1.1.0)
60
56
  rack (>= 1.0, < 3)
61
- rake (10.5.0)
57
+ rake (13.0.1)
62
58
  rspec (3.9.0)
63
59
  rspec-core (~> 3.9.0)
64
60
  rspec-expectations (~> 3.9.0)
@@ -112,7 +108,7 @@ DEPENDENCIES
112
108
  byebug
113
109
  pry
114
110
  rack-test
115
- rake (~> 10.0)
111
+ rake (~> 13.0)
116
112
  rspec (~> 3.0)
117
113
  rspec-parameterized
118
114
  simplecov
@@ -10,6 +10,7 @@ require 'pathname'
10
10
  require_relative 'webcommand/extensions/hash_extension'
11
11
  require_relative 'webcommand/command'
12
12
  require_relative 'webcommand/server'
13
+ require_relative 'webcommand/server/adapters/webrick'
13
14
  require_relative 'webcommand/config'
14
15
  require_relative 'webcommand/commands'
15
16
  require_relative 'webcommand/cli'
@@ -1,16 +1,19 @@
1
1
  module Webcommand
2
2
  class CLI < Thor
3
+ SERVER_ADAPTERS = {
4
+ 'webrick' => Webcommand::Server::Adapters::Webrick
5
+ }.freeze
6
+
3
7
  desc "server", "Start the Webcommand server"
4
8
  option :port, aliases: :p, default: 9292
5
9
  option :bind, aliases: :b, default: '0.0.0.0'
6
- option :threads, aliases: :t, default: 8
7
- option :workers, aliases: :w, default: 1
10
+ option :adapter, type: :string, enum: SERVER_ADAPTERS.keys, default: 'webrick'
11
+
8
12
  def server
9
- exec "puma " \
10
- "-p #{options[:port]} " \
11
- "-t #{options[:threads]}:#{options[:threads]} " \
12
- "-w #{options[:workers]} " \
13
- "#{Webcommand.root_path.join('config.ru')}"
13
+ server_adapter = SERVER_ADAPTERS[options[:adapter]]
14
+ server = server_adapter.new(Webcommand::Server, options)
15
+
16
+ server.start
14
17
  end
15
18
  end
16
19
  end
@@ -0,0 +1,23 @@
1
+ module Webcommand
2
+ class Server
3
+ module Adapters
4
+ class Webrick
5
+ def initialize(server, options)
6
+ require 'webrick'
7
+ @server = server
8
+ @options = options
9
+ end
10
+
11
+ def start
12
+ server = WEBrick::HTTPServer.new(
13
+ Port: @options[:port],
14
+ BindAddress: @options[:bind])
15
+ server.mount "/", Rack::Handler::WEBrick, server
16
+ Signal.trap(:INT) { server.shutdown }
17
+ server.start
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+
@@ -1,3 +1,3 @@
1
1
  module Webcommand
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -29,10 +29,9 @@ Gem::Specification.new do |spec|
29
29
  spec.add_dependency "mustache", "~> 1.0"
30
30
  spec.add_dependency "rack-contrib", "~> 2.1.0"
31
31
  spec.add_dependency "tty-command", "~> 0.9.0"
32
- spec.add_dependency "puma", ">= 4.2.1", "< 4.4.0"
33
32
  spec.add_development_dependency "byebug"
34
33
  spec.add_development_dependency "pry"
35
34
  spec.add_development_dependency "bundler", "~> 2.0"
36
- spec.add_development_dependency "rake", "~> 10.0"
35
+ spec.add_development_dependency "rake", "~> 13.0"
37
36
  spec.add_development_dependency "rspec", "~> 3.0"
38
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webcommand
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Atkinson Ferreira Filho
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-10 00:00:00.000000000 Z
11
+ date: 2020-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -80,26 +80,6 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: 0.9.0
83
- - !ruby/object:Gem::Dependency
84
- name: puma
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: 4.2.1
90
- - - "<"
91
- - !ruby/object:Gem::Version
92
- version: 4.4.0
93
- type: :runtime
94
- prerelease: false
95
- version_requirements: !ruby/object:Gem::Requirement
96
- requirements:
97
- - - ">="
98
- - !ruby/object:Gem::Version
99
- version: 4.2.1
100
- - - "<"
101
- - !ruby/object:Gem::Version
102
- version: 4.4.0
103
83
  - !ruby/object:Gem::Dependency
104
84
  name: byebug
105
85
  requirement: !ruby/object:Gem::Requirement
@@ -148,14 +128,14 @@ dependencies:
148
128
  requirements:
149
129
  - - "~>"
150
130
  - !ruby/object:Gem::Version
151
- version: '10.0'
131
+ version: '13.0'
152
132
  type: :development
153
133
  prerelease: false
154
134
  version_requirements: !ruby/object:Gem::Requirement
155
135
  requirements:
156
136
  - - "~>"
157
137
  - !ruby/object:Gem::Version
158
- version: '10.0'
138
+ version: '13.0'
159
139
  - !ruby/object:Gem::Dependency
160
140
  name: rspec
161
141
  requirement: !ruby/object:Gem::Requirement
@@ -198,6 +178,7 @@ files:
198
178
  - lib/webcommand/config.rb
199
179
  - lib/webcommand/extensions/hash_extension.rb
200
180
  - lib/webcommand/server.rb
181
+ - lib/webcommand/server/adapters/webrick.rb
201
182
  - lib/webcommand/version.rb
202
183
  - webcommand.gemspec
203
184
  homepage: https://github.com/catks/webcommand