net-http-server 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 35d57af683a4c0b327c281d5ae71f848e076b6be987e9fa4c1ee77d2aab41d68
4
+ data.tar.gz: 6cd05ef1952687d1ec6b0ac83bfe3ca7ba457fae04891a38fb32b53beee7beb7
5
+ SHA512:
6
+ metadata.gz: 87305fc9592d5cde9ab305b0a98d22f365fc6af32808aca03323f0d0140b89384a95b9e19b5ccc23552ae611b65b600d02ad526b399d4d606793d7d0cfbd308b
7
+ data.tar.gz: ad2a7320a5aeb3b2106cf4b871fb589dd2f0ad0afb86d50ad9a41b75e88f76f7ef0115c2d78b450fc42020f4da4bc58d1605de83e43df464bddf2c49f50b7cb2
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ Gemfile.lock
1
2
  doc/
2
3
  pkg/
3
4
  vendor/
data/ChangeLog.md CHANGED
@@ -1,3 +1,12 @@
1
+ ### 0.2.3 / 2022-06-18
2
+
3
+ * Add [gserver] ~> 0.0 as a dependency.
4
+ * Switched to using Ruby 2.x keyword arguments.
5
+ * Fix a bug in {Rack::Handler::HTTP} where the URI `query` string was not being
6
+ properly loaded.
7
+ * Fixed a bug in {Net::HTTP::Server::Parser} where the older `absnt?` method
8
+ was being used instead of the newer `absent?` method.
9
+
1
10
  ### 0.2.2 / 2012-09-08
2
11
 
3
12
  * Added an example `rackup` command.
@@ -32,3 +41,5 @@
32
41
  * Added {Net::HTTP::Server::Responses}.
33
42
  * Added {Net::HTTP::Server::Daemon}.
34
43
  * Added {Rack::Handler::HTTP}.
44
+
45
+ [gserver]: https://rubygems.org/gems/gserver
data/Gemfile ADDED
@@ -0,0 +1,16 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem 'rake'
7
+ gem 'rubygems-tasks', '~> 0.1'
8
+
9
+ gem 'rack'
10
+ gem 'rspec', '~> 3.0'
11
+
12
+ gem 'kramdown'
13
+ gem 'redcarpet', platform: :mri
14
+ gem 'yard', '~> 0.9'
15
+ gem 'yard-spellcheck'
16
+ end
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011 Hal Brodigan
1
+ Copyright (c) 2011-2022 Hal Brodigan
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,9 +1,8 @@
1
1
  # net-http-server
2
2
 
3
- * [Homepage](http://github.com/postmodern/net-http-server)
4
- * [Issues](http://github.com/postmodern/net-http-server/issues)
5
- * [Documentation](http://rubydoc.info/gems/net-http-server)
6
- * [Email](mailto:postmodern.mod3 at gmail.com)
3
+ * [Homepage](https://github.com/postmodern/net-http-server#readme)
4
+ * [Issues](https://github.com/postmodern/net-http-server/issues)
5
+ * [Documentation](https://rubydoc.info/gems/net-http-server)
7
6
 
8
7
  ## Description
9
8
 
@@ -14,41 +13,50 @@
14
13
  * Pure Ruby.
15
14
  * Supports Streamed Request/Response Bodies.
16
15
  * Supports Chunked Transfer-Encoding.
17
- * Provides a [Rack](http://rack.rubyforge.org/) Handler.
16
+ * Provides a [Rack](https://github.com/rack/rack#readme) Handler.
18
17
 
19
18
  ## Examples
20
19
 
21
20
  Simple HTTP Server:
22
21
 
23
- require 'net/http/server'
24
- require 'pp'
22
+ ```ruby
23
+ require 'net/http/server'
24
+ require 'pp'
25
25
 
26
- Net::HTTP::Server.run(:port => 8080) do |request,stream|
27
- pp request
26
+ Net::HTTP::Server.run(:port => 8080) do |request,stream|
27
+ pp request
28
28
 
29
- [200, {'Content-Type' => 'text/html'}, ['Hello World']]
30
- end
29
+ [200, {'Content-Type' => 'text/html'}, ['Hello World']]
30
+ end
31
+ ```
31
32
 
32
33
  Use it with Rack:
33
34
 
34
- require 'rack/handler/http'
35
-
36
- Rack::Handler::HTTP.run app
35
+ ```ruby
36
+ require 'rack/handler/http'
37
+
38
+ Rack::Handler::HTTP.run app
39
+ ```
37
40
 
38
41
  Using it with `rackup`:
39
42
 
40
- $ rackup -s HTTP
43
+ ```shell
44
+ $ rackup -s HTTP
45
+ ```
41
46
 
42
47
  ## Requirements
43
48
 
44
- * [parslet](http://rubygems.org/gems/parslet) ~> 1.0
49
+ * [parslet](http://kschiess.github.io/parslet/) ~> 1.0
50
+ * [gserver](https://rubygems.org/gems/gserver) ~> 0.0
45
51
 
46
52
  ## Install
47
53
 
48
- $ gem install net-http-server
54
+ ```shell
55
+ $ gem install net-http-server
56
+ ```
49
57
 
50
58
  ## Copyright
51
59
 
52
- Copyright (c) 2011 Hal Brodigan
60
+ Copyright (c) 2011-2022 Hal Brodigan
53
61
 
54
62
  See {file:LICENSE.txt} for details.
data/Rakefile CHANGED
@@ -1,36 +1,19 @@
1
- require 'rubygems'
2
- require 'rake'
3
-
4
1
  begin
5
- gem 'rubygems-tasks', '~> 0.1'
6
- require 'rubygems/tasks'
7
-
8
- Gem::Tasks.new
2
+ require 'bundler/setup'
9
3
  rescue LoadError => e
10
4
  warn e.message
11
- warn "Run `gem install rubygems-tasks` to install 'rubygems/tasks'."
5
+ warn "Run `gem install bundler` to install Bundler"
6
+ exit -1
12
7
  end
13
8
 
14
- begin
15
- gem 'rspec', '~> 2.4'
16
- require 'rspec/core/rake_task'
9
+ require 'rubygems/tasks'
10
+ Gem::Tasks.new
17
11
 
18
- RSpec::Core::RakeTask.new
19
- rescue LoadError => e
20
- task :spec do
21
- abort "Please run `gem install rspec` to install RSpec."
22
- end
23
- end
24
- task :test => :spec
25
- task :default => :spec
12
+ require 'rspec/core/rake_task'
13
+ RSpec::Core::RakeTask.new
26
14
 
27
- begin
28
- gem 'yard', '~> 0.8'
29
- require 'yard'
15
+ task :test => :spec
16
+ task :default => :spec
30
17
 
31
- YARD::Rake::YardocTask.new
32
- rescue LoadError => e
33
- task :yard do
34
- abort "Please run `gem install yard` to install YARD."
35
- end
36
- end
18
+ require 'yard'
19
+ YARD::Rake::YardocTask.new
data/gemspec.yml CHANGED
@@ -4,13 +4,19 @@ description: A Rack compatible pure Ruby HTTP Server.
4
4
  license: MIT
5
5
  authors: Postmodern
6
6
  email: postmodern.mod3@gmail.com
7
- homepage: http://github.com/postmodern/net-http-server
7
+ homepage: https://github.com/postmodern/net-http-server#readme
8
8
  has_yard: true
9
9
 
10
+ metadata:
11
+ documentation_uri: https://rubydoc.info/gems/net-http-server
12
+ source_code_uri: https://github.com/postmodern/net-http-server
13
+ bug_tracker_uri: https://github.com/postmodern/net-http-server/issues
14
+ changelog_uri: https://github.com/postmodern/net-http-server/blob/master/ChangeLog.md
15
+ rubygems_mfa_required: 'true'
16
+
10
17
  dependencies:
11
18
  parslet: ~> 1.0
19
+ gserver: ~> 0.0
12
20
 
13
21
  development_dependencies:
14
- rubygems-tasks: ~> 0.1
15
- rspec: ~> 2.4
16
- yard: ~> 0.8
22
+ bundler: ~> 2.0
@@ -14,7 +14,7 @@ module Net
14
14
  class ChunkedStream < Stream
15
15
 
16
16
  #
17
- # Initializes the chuked stream.
17
+ # Initializes the chunked stream.
18
18
  #
19
19
  # @param [#read, #write, #flush] socket
20
20
  # The socket to read from and write to.
@@ -47,9 +47,8 @@ module Net
47
47
  end
48
48
 
49
49
  until @buffer.length >= length
50
- length_line = @socket.readline("\r\n").chomp
51
- chunk_length, chunk_extension = length_line.split(';',2)
52
- chunk_length = chunk_length.to_i(16)
50
+ length_line = @socket.readline("\r\n").chomp
51
+ chunk_length = length_line.split(';',2).first.to_i(16)
53
52
 
54
53
  # read the chunk
55
54
  @buffer << @socket.read(chunk_length)
@@ -26,22 +26,19 @@ module Net
26
26
 
27
27
  # Creates a new HTTP Daemon.
28
28
  #
29
- # @param [Hash] options
30
- # Options for the daemon.
31
- #
32
- # @option options [String] :host (DEFAULT_HOST)
29
+ # @param [String] host
33
30
  # The host to run on.
34
31
  #
35
- # @option options [String] :port (DEFAULT_PORT)
32
+ # @param [String] port
36
33
  # The port to listen on.
37
34
  #
38
- # @option options [Integer] :max_connections (MAX_CONNECTIONS)
35
+ # @param [Integer] max_connections
39
36
  # The maximum number of simultaneous connections.
40
37
  #
41
- # @option options [IO] :log ($stderr)
38
+ # @param [IO] log
42
39
  # The log to write errors to.
43
40
  #
44
- # @option options [#call] :handler
41
+ # @param [#call] handler
45
42
  # The HTTP Request Handler object.
46
43
  #
47
44
  # @yield [request, socket]
@@ -53,15 +50,18 @@ module Net
53
50
  # @yieldparam [TCPSocket] socket
54
51
  # The TCP socket of the client.
55
52
  #
56
- def initialize(options={},&block)
57
- host = options.fetch(:host,DEFAULT_HOST)
58
- port = options.fetch(:port,DEFAULT_PORT).to_i
59
- max_connections = options.fetch(:max_connections,MAX_CONNECTIONS)
60
- log = options.fetch(:log,$stderr)
61
-
62
- super(port,host,max_connections,log,false,true)
53
+ # @raise [ArgumentError]
54
+ # No `handler:` value was given.
55
+ #
56
+ def initialize(host: DEFAULT_HOST,
57
+ port: DEFAULT_PORT,
58
+ max_connections: MAX_CONNECTIONS,
59
+ log: $stderr,
60
+ handler: nil,
61
+ &block)
62
+ super(port.to_i,host,max_connections,log,false,true)
63
63
 
64
- handler(options[:handler],&block)
64
+ handler(handler,&block)
65
65
  end
66
66
 
67
67
  #
@@ -106,7 +106,7 @@ module Net
106
106
 
107
107
  begin
108
108
  request = parser.parse(raw_request)
109
- rescue Parslet::ParseFailed => error
109
+ rescue Parslet::ParseFailed
110
110
  return Responses::BAD_REQUEST
111
111
  end
112
112
 
@@ -9,7 +9,7 @@ module Net
9
9
  #
10
10
  # * [Thin](https://github.com/macournoyer/thin/blob/master/ext/thin_parser/common.rl)
11
11
  # * [Unicorn](https://github.com/defunkt/unicorn/blob/master/ext/unicorn_http/unicorn_http_common.rl)
12
- # * [RFC 2616](http://www.w3.org/Protocols/rfc2616/rfc2616.html)
12
+ # * [RFC 9110](https://www.rfc-editor.org/rfc/rfc9110.html)
13
13
  #
14
14
  class Parser < Parslet::Parser
15
15
 
@@ -30,7 +30,7 @@ module Net
30
30
  rule(:crlf) { str("\r\n") }
31
31
 
32
32
  rule(:ctl) { cntrl | str("\x7f") }
33
- rule(:text) { lws | (ctl.absnt? >> ascii) }
33
+ rule(:text) { lws | (ctl.absent? >> ascii) }
34
34
 
35
35
  rule(:safe) { charset('$', '-', '_', '.') }
36
36
  rule(:extra) { charset('!', '*', "'", '(', ')', ',') }
@@ -39,7 +39,7 @@ module Net
39
39
 
40
40
  rule(:unsafe) { ctl | charset(' ', '#', '%') | sorta_safe }
41
41
  rule(:national) {
42
- (alpha | digit | reserved | extra | safe | unsafe).absnt? >> any
42
+ (alpha | digit | reserved | extra | safe | unsafe).absent? >> any
43
43
  }
44
44
 
45
45
  rule(:unreserved) { alpha | digit | safe | extra | national }
@@ -57,13 +57,13 @@ module Net
57
57
  #
58
58
  # Elements
59
59
  #
60
- rule(:token) { (ctl | separators).absnt? >> ascii }
60
+ rule(:token) { (ctl | separators).absent? >> ascii }
61
61
 
62
- rule(:comment_text) { (str('(') | str(')')).absnt? >> text }
62
+ rule(:comment_text) { (str('(') | str(')')).absent? >> text }
63
63
  rule(:comment) { str('(') >> comment_text.repeat >> str(')') }
64
64
 
65
65
  rule(:quoted_pair) { str("\\") >> ascii }
66
- rule(:quoted_text) { quoted_pair | str('"').absnt? >> text }
66
+ rule(:quoted_text) { quoted_pair | str('"').absent? >> text }
67
67
  rule(:quoted_string) { str('"') >> quoted_text >> str('"') }
68
68
 
69
69
  #
@@ -117,7 +117,7 @@ module Net
117
117
  http_version
118
118
  }
119
119
 
120
- rule(:header_name) { (str(':').absnt? >> token).repeat(1) }
120
+ rule(:header_name) { (str(':').absent? >> token).repeat(1) }
121
121
  rule(:header_value) {
122
122
  (text | token | separators | quoted_string).repeat(1)
123
123
  }
@@ -8,23 +8,23 @@ module Net
8
8
  #
9
9
  # Starts the HTTP Server.
10
10
  #
11
- # @param [Hash] options
12
- # Options for the server.
11
+ # @param [Boolean] background
12
+ # Specifies whether to run the server in the background or
13
+ # foreground.
13
14
  #
14
- # @option options [String] :host (DEFAULT_HOST)
15
+ # @param [Hash{Symbol => Object}] kwargs
16
+ # Additional keyword arguments for {Daemon#initialize}.
17
+ #
18
+ # @option kwargs [String] :host (DEFAULT_HOST)
15
19
  # The host to run on.
16
20
  #
17
- # @option options [String] :port (DEFAULT_PORT)
21
+ # @option kwargs [String] :port (DEFAULT_PORT)
18
22
  # The port to listen on.
19
23
  #
20
- # @option options [Integer] :max_connections (MAX_CONNECTIONS)
24
+ # @option kwargs [Integer] :max_connections (MAX_CONNECTIONS)
21
25
  # The maximum number of simultaneous connections.
22
26
  #
23
- # @option options [Boolean] :background (false)
24
- # Specifies whether to run the server in the background or
25
- # foreground.
26
- #
27
- # @option options [#call] :handler
27
+ # @option kwargs [#call] :handler
28
28
  # The HTTP Request Handler object.
29
29
  #
30
30
  # @yield [request, socket]
@@ -36,11 +36,14 @@ module Net
36
36
  # @yieldparam [TCPSocket] socket
37
37
  # The TCP socket of the client.
38
38
  #
39
- def Server.run(options={},&block)
40
- daemon = Daemon.new(options,&block)
39
+ # @raise [ArgumentError]
40
+ # No `handler:` value was given.
41
+ #
42
+ def Server.run(background: false, **kwargs,&block)
43
+ daemon = Daemon.new(**kwargs,&block)
41
44
 
42
45
  daemon.start
43
- daemon.join unless options[:background]
46
+ daemon.join unless background
44
47
  return daemon
45
48
  end
46
49
 
@@ -4,7 +4,7 @@ module Net
4
4
  class HTTP < Protocol
5
5
  module Server
6
6
  # net-http-server version.
7
- VERSION = '0.2.2'
7
+ VERSION = '0.2.3'
8
8
  end
9
9
  end
10
10
  end
@@ -37,7 +37,7 @@ module Rack
37
37
  # @param [#call] app
38
38
  # The application the handler will be passing requests to.
39
39
  #
40
- # @param [Hash] options
40
+ # @param [Hash{Symbol => Object}] options
41
41
  # Additional options.
42
42
  #
43
43
  # @option options [String] :Host
@@ -46,7 +46,7 @@ module Rack
46
46
  # @option options [Integer] :Port
47
47
  # The port to listen on.
48
48
  #
49
- def initialize(app,options={})
49
+ def initialize(app,**options)
50
50
  @app = app
51
51
  @options = options
52
52
  @server = nil
@@ -57,8 +57,8 @@ module Rack
57
57
  #
58
58
  # @see #initialize
59
59
  #
60
- def self.run(app,options={})
61
- new(app,options).run
60
+ def self.run(app,**options)
61
+ new(app,**options).run
62
62
  end
63
63
 
64
64
  #
@@ -66,9 +66,9 @@ module Rack
66
66
  #
67
67
  def run
68
68
  @server = Net::HTTP::Server::Daemon.new(
69
- :host => @options[:Host],
70
- :port => @options[:Port],
71
- :handler => self
69
+ host: @options[:Host],
70
+ port: @options[:Port],
71
+ handler: self
72
72
  )
73
73
 
74
74
  @server.start
@@ -113,12 +113,12 @@ module Rack
113
113
 
114
114
  env['REQUEST_METHOD'] = request[:method].to_s
115
115
  env['PATH_INFO'] = request_uri.fetch(:path,'*').to_s
116
- env['QUERY_STRING'] = request_uri[:query_string].to_s
116
+ env['QUERY_STRING'] = request_uri[:query].to_s
117
117
 
118
118
  # add the headers
119
119
  request[:headers].each do |name,value|
120
120
  key = name.dup
121
-
121
+
122
122
  key.upcase!
123
123
  key.tr!('-','_')
124
124
 
@@ -2,130 +2,61 @@
2
2
 
3
3
  require 'yaml'
4
4
 
5
- Gem::Specification.new do |gemspec|
6
- root = File.dirname(__FILE__)
7
- lib_dir = File.join(root,'lib')
8
- files = if File.directory?('.git')
9
- `git ls-files`.split($/)
10
- elsif File.directory?('.hg')
11
- `hg manifest`.split($/)
12
- elsif File.directory?('.svn')
13
- `svn ls -R`.split($/).select { |path| File.file?(path) }
14
- else
15
- Dir['{**/}{.*,*}'].select { |path| File.file?(path) }
16
- end
5
+ Gem::Specification.new do |gem|
6
+ gemspec = YAML.load_file('gemspec.yml')
17
7
 
18
- filter_files = lambda { |paths|
19
- case paths
20
- when Array
21
- (files & paths)
22
- when String
23
- (files & Dir[paths])
24
- end
25
- }
26
-
27
- version = {
28
- :file => 'net/http/server/version.rb',
29
- :constant => 'Net::HTTP::Server::VERSION'
30
- }
31
-
32
- defaults = {
33
- 'name' => File.basename(File.dirname(__FILE__)),
34
- 'files' => files,
35
- 'executables' => filter_files['bin/*'].map { |path| File.basename(path) },
36
- 'test_files' => filter_files['{test/{**/}*_test.rb,spec/{**/}*_spec.rb}'],
37
- 'extra_doc_files' => filter_files['*.{txt,rdoc,md,markdown,tt,textile}'],
38
- }
8
+ gem.name = gemspec.fetch('name')
9
+ gem.version = gemspec.fetch('version') do
10
+ lib_dir = File.join(File.dirname(__FILE__),'lib')
11
+ $LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)
39
12
 
40
- metadata = defaults.merge(YAML.load_file('gemspec.yml'))
13
+ require 'net/http/server/version'
14
+ Net::HTTP::Server::VERSION
15
+ end
41
16
 
42
- gemspec.name = metadata.fetch('name',defaults[:name])
43
- gemspec.version = if metadata['version']
44
- metadata['version']
45
- else
46
- $LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)
17
+ gem.summary = gemspec['summary']
18
+ gem.description = gemspec['description']
19
+ gem.licenses = Array(gemspec['license'])
20
+ gem.authors = Array(gemspec['authors'])
21
+ gem.email = gemspec['email']
22
+ gem.homepage = gemspec['homepage']
23
+ gem.metadata = gemspec['metadata'] if gemspec['metadata']
47
24
 
48
- require version[:file]
49
- eval(version[:constant])
50
- end
25
+ glob = lambda { |patterns| gem.files & Dir[*patterns] }
51
26
 
52
- gemspec.summary = metadata.fetch('summary',metadata['description'])
53
- gemspec.description = metadata.fetch('description',metadata['summary'])
27
+ gem.files = `git ls-files`.split($/)
28
+ gem.files = glob[gemspec['files']] if gemspec['files']
54
29
 
55
- case metadata['license']
56
- when Array
57
- gemspec.licenses = metadata['license']
58
- when String
59
- gemspec.license = metadata['license']
30
+ gem.executables = gemspec.fetch('executables') do
31
+ glob['bin/*'].map { |path| File.basename(path) }
60
32
  end
33
+ gem.default_executable = gem.executables.first if Gem::VERSION < '1.7.'
61
34
 
62
- case metadata['authors']
63
- when Array
64
- gemspec.authors = metadata['authors']
65
- when String
66
- gemspec.author = metadata['authors']
67
- end
68
-
69
- gemspec.email = metadata['email']
70
- gemspec.homepage = metadata['homepage']
35
+ gem.extensions = glob[gemspec['extensions'] || 'ext/**/extconf.rb']
36
+ gem.test_files = glob[gemspec['test_files'] || \
37
+ '{test/{**/}*_test.rb,spec/{**/}*_spec.rb}']
38
+ gem.extra_rdoc_files = glob[gemspec['extra_doc_files'] || '*.{txt,md}']
71
39
 
72
- case metadata['require_paths']
73
- when Array
74
- gemspec.require_paths = metadata['require_paths']
75
- when String
76
- gemspec.require_path = metadata['require_paths']
77
- end
40
+ gem.require_paths = Array(gemspec.fetch('require_paths') {
41
+ %w[ext lib].select { |dir| File.directory?(dir) }
42
+ })
78
43
 
79
- gemspec.files = filter_files[metadata['files']]
44
+ gem.requirements = gemspec['requirements']
45
+ gem.required_ruby_version = gemspec['required_ruby_version']
46
+ gem.required_rubygems_version = gemspec['required_rubygems_version']
47
+ gem.post_install_message = gemspec['post_install_message']
80
48
 
81
- gemspec.executables = metadata['executables']
82
- gemspec.extensions = metadata['extensions']
83
-
84
- if Gem::VERSION < '1.7.'
85
- gemspec.default_executable = gemspec.executables.first
86
- end
87
-
88
- gemspec.test_files = filter_files[metadata['test_files']]
89
-
90
- unless gemspec.files.include?('.document')
91
- gemspec.extra_rdoc_files = metadata['extra_doc_files']
92
- end
93
-
94
- gemspec.post_install_message = metadata['post_install_message']
95
- gemspec.requirements = metadata['requirements']
96
-
97
- if gemspec.respond_to?(:required_ruby_version=)
98
- gemspec.required_ruby_version = metadata['required_ruby_version']
99
- end
100
-
101
- if gemspec.respond_to?(:required_rubygems_version=)
102
- gemspec.required_rubygems_version = metadata['required_ruby_version']
103
- end
104
-
105
- parse_versions = lambda { |versions|
106
- case versions
107
- when Array
108
- versions.map { |v| v.to_s }
109
- when String
110
- versions.split(/,\s*/)
111
- end
112
- }
113
-
114
- if metadata['dependencies']
115
- metadata['dependencies'].each do |name,versions|
116
- gemspec.add_dependency(name,parse_versions[versions])
117
- end
118
- end
49
+ split = lambda { |string| string.split(/,\s*/) }
119
50
 
120
- if metadata['runtime_dependencies']
121
- metadata['runtime_dependencies'].each do |name,versions|
122
- gemspec.add_runtime_dependency(name,parse_versions[versions])
51
+ if gemspec['dependencies']
52
+ gemspec['dependencies'].each do |name,versions|
53
+ gem.add_dependency(name,split[versions])
123
54
  end
124
55
  end
125
56
 
126
- if metadata['development_dependencies']
127
- metadata['development_dependencies'].each do |name,versions|
128
- gemspec.add_development_dependency(name,parse_versions[versions])
57
+ if gemspec['development_dependencies']
58
+ gemspec['development_dependencies'].each do |name,versions|
59
+ gem.add_development_dependency(name,split[versions])
129
60
  end
130
61
  end
131
62
  end