nginxbrew 0.0.6 → 0.0.7

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
  SHA1:
3
- metadata.gz: 2f7df4fe4a967276dae08916ee18bf23ef9e4809
4
- data.tar.gz: 19513d63f260cb095c430188f351bd67c3216261
3
+ metadata.gz: 683c60590845811ab4de45a8032f7a1c8b3d88c6
4
+ data.tar.gz: aca6e131adc5ab8fa59e2e9d6d8c3265ef6604de
5
5
  SHA512:
6
- metadata.gz: ae73e62e8c7e7d7ce6243d43c2c9a3646e46f6fbb6b7504aebbc14a12879e9833f5193a064f53b6c226dbca73eb3ee1ac54b89bea98882c9bea2d75445fad219
7
- data.tar.gz: 8e71707dd3a4580728380bbec00ec163e41ff9f483bd301e95edb4a4583a2de803efafba1738bec3c662f48aee506ce1c306ed39acc6e21fafc9d4e83a418e4c
6
+ metadata.gz: ba7f63e4f0ec209a2b61fb66119349297d940f18dc4363708de44a61db93fa60845a213c8ee128bcdf81dc0e7c49dfb0b788f537bd25b6a166bce33815c56403
7
+ data.tar.gz: 4e70c1e80a9758d86c369f9eda988c1c40bc45735f2b89e0acfb02c7f257973e258f3068eb0e87dd98c8be772c1a173ddc77e727d43e2e17ba7d9d2ffc31dbc9
@@ -1,5 +1,11 @@
1
1
  Nginxbrew changes
2
2
 
3
+ Nginxbrew 0.0.7
4
+ - Cache result of nginxes/openresties.
5
+ - Limit min version of nginx to support to upper v0.5.38.
6
+ - Bug fixes.
7
+
8
+
3
9
  Nginxbrew 0.0.6
4
10
  - You can change ngx-user/group by config file which specified in env {NGINXBREW_CONFIG}.
5
11
  - Add/update build options by hash in ruby.
@@ -61,7 +61,7 @@ begin
61
61
  when "makeconf"
62
62
  output_to = ARGV.shift
63
63
  raise Exception.new("output directory/file for config is required!") unless output_to
64
- Nginxbrew.run(:makeconf, envs={ "makeconf_OUTPUT_TO" => output_to })
64
+ Nginxbrew.run(:makeconf, envs={ "MAKECONF_OUTPUT_TO" => output_to })
65
65
  else
66
66
  raise Exception.new("Unknown command '#{command}'")
67
67
  end
@@ -1,7 +1,7 @@
1
1
  require "rake"
2
2
 
3
3
  require "nginxbrew/version"
4
- require "nginxbrew/nginxes"
4
+ require "nginxbrew/catalog"
5
5
  require "nginxbrew/local"
6
6
  require "nginxbrew/convention"
7
7
  require "nginxbrew/rake_tools"
@@ -0,0 +1,141 @@
1
+ require "net/http"
2
+ require "uri"
3
+ require "fileutils"
4
+
5
+ include Nginxbrew
6
+
7
+
8
+ module Nginxbrew
9
+
10
+ class VersionNotFoundError < StandardError
11
+
12
+ def initialize(v)
13
+ super("version '#{v}' is not found in all versions of nginxes/openresties")
14
+ end
15
+
16
+ end
17
+
18
+ class Catalog
19
+
20
+ TypeNginx = "nginx"
21
+
22
+ TypeOpenresty = "openresty"
23
+
24
+ CacheExpireDays = 1
25
+
26
+ attr_reader :ngx_type, :versions
27
+
28
+ def initialize(ngx_type, versions)
29
+ unless [TypeNginx, TypeOpenresty].include?(ngx_type)
30
+ raise Exception.new("Invalid ngx_type #{ngx_type}")
31
+ end
32
+ raise Exception.new("No versions of nginx!") if versions.size == 0
33
+ @ngx_type = ngx_type
34
+ @versions = versions.uniq.map do |v|
35
+ Gem::Version.new(v) # 1.15.x <> 1.8.x should be 1.15.x > 1.8.x
36
+ end.sort.reverse.map do |v|
37
+ v.to_s
38
+ end
39
+ end
40
+
41
+ def unsupport_under!(version)
42
+ min_version = Gem::Version.new(version)
43
+ @versions = @versions.select do |v|
44
+ Gem::Version.new(v) >= min_version
45
+ end
46
+ end
47
+
48
+ def size
49
+ @versions.size
50
+ end
51
+
52
+ def filter_versions(head_of)
53
+ src_numbers = head_of.split(".")
54
+ src_numbers_size = src_numbers.size
55
+ r = @versions.select do |v|
56
+ v.split(".").slice(0, src_numbers_size) == src_numbers
57
+ end
58
+ raise VersionNotFoundError.new(head_of) if r.size == 0
59
+ r
60
+ end
61
+
62
+ def head_of(version)
63
+ src_numbers = version.split(".")
64
+ src_numbers_size = src_numbers.size
65
+ r = @versions.detect do |v|
66
+ v.split(".").slice(0, src_numbers_size) == src_numbers
67
+ end
68
+ raise VersionNotFoundError.new(version) unless r
69
+ r
70
+ end
71
+
72
+ def self.nginxes(cache_dir=nil)
73
+ catalog_cache_or(cache_dir, "nginxes") do
74
+ versions = html_body_of("http://nginx.org", "/download/").
75
+ gsub(/href="nginx\-([0-9\.]+?)\.tar\.gz"/).inject([]) do |memo, match|
76
+ memo << $1
77
+ memo
78
+ end
79
+ c = Catalog.new(TypeNginx, versions)
80
+ c.unsupport_under!("0.5.38") # can not build under this version
81
+ c
82
+ end
83
+ end
84
+
85
+ def self.openresties(cache_dir=nil)
86
+ catalog_cache_or(cache_dir, "openresties") do
87
+ versions = html_body_of("http://openresty.org", "/").
88
+ gsub(/ngx_openresty\-([0-9\.]+?)\.tar\.gz/).inject([]) do |memo, match|
89
+ memo << $1
90
+ memo
91
+ end
92
+ Catalog.new(TypeOpenresty, versions)
93
+ end
94
+ end
95
+
96
+ private
97
+
98
+ def self.catalog_cache_or(dir, key, &block)
99
+ return block.call if !dir || !key
100
+
101
+ cache_dir = File.join(dir, "catalog")
102
+ FileUtils.mkdir_p(cache_dir) unless FileTest.directory?(cache_dir)
103
+
104
+ cache_file = File.join(cache_dir, "#{key}.ca")
105
+
106
+ if FileTest.file?(cache_file)
107
+ expired = File.mtime(cache_file) + CacheExpireDays * 24 * 60 * 60
108
+ if Time.now < expired
109
+ $logger.debug("Cache file: #{cache_file}")
110
+ begin
111
+ return Marshal.load(File.binread(cache_file))
112
+ rescue Exception => e
113
+ File.delete(cache_file)
114
+ $logger.error("#{e}")
115
+ $logger.error("#{cache_file} removed")
116
+ end
117
+ else
118
+ File.delete(cache_file)
119
+ end
120
+ end
121
+
122
+ dest = block.call
123
+ File.binwrite(cache_file, Marshal.dump(dest))
124
+ $logger.debug("Cache saved to #{cache_file}")
125
+
126
+ dest
127
+ end
128
+
129
+ def self.html_body_of(host, page)
130
+ url = URI.parse(host)
131
+ res = Net::HTTP.start(url.host, url.port) {|http|
132
+ http.get(page)
133
+ }
134
+ raise Exception.new("Failed get list of nginx") if res.code.to_i != 200
135
+ res.body
136
+ end
137
+
138
+ end
139
+
140
+ end
141
+
@@ -9,15 +9,14 @@ $stdout.puts("using '#{HOME_DIR}' as nginxbrew home") if ENV["NGINXBREW_HOME"]
9
9
 
10
10
 
11
11
  CONFIG_FILE = ENV["NGINXBREW_CONFIG"]
12
- if CONFIG_FILE && !FileTest.file?(CONFIG_FILE)
13
- raise Exception.new("Specified configuration file #{CONFIG_FILE} is not found")
14
- end
12
+ $stdout.puts("using '#{CONFIG_FILE}' as nginxbrew config") if CONFIG_FILE
15
13
 
16
14
 
17
15
  SOURCE_DIR = "#{HOME_DIR}/.src"
18
16
  DIST_DIR = "#{HOME_DIR}/versions"
19
17
  BIN_DIR = "#{HOME_DIR}/bin"
20
18
  NGINX_BIN = "#{BIN_DIR}/nginx"
19
+ CACHE_DIR = "#{HOME_DIR}/.cache"
21
20
 
22
21
 
23
22
  [HOME_DIR, SOURCE_DIR, BIN_DIR, DIST_DIR].each do |dir|
@@ -30,7 +29,10 @@ if ENV["VERSION"]
30
29
 
31
30
  $stdout.puts("checking version ...")
32
31
  raw_version, is_openresty = NamingConvention.resolve(ENV["VERSION"])
33
- nginxes = is_openresty ? Nginxbrew::Nginxes.openresties : Nginxbrew::Nginxes.nginxes
32
+
33
+ nginxes = is_openresty ? Nginxbrew::Catalog.openresties(cache_dir=CACHE_DIR) :
34
+ Nginxbrew::Catalog.nginxes(cache_dir=CACHE_DIR)
35
+
34
36
  raw_version = nginxes.head_of(raw_version)
35
37
  package_name = NamingConvention.package_name_from(raw_version, is_openresty)
36
38
  $stdout.puts("resolved version: [#{is_openresty ? 'openresty' : 'nginx'}-]#{raw_version}")
@@ -105,7 +107,6 @@ if ENV["VERSION"]
105
107
  desc "switch nginx version"
106
108
  task :use => [BIN_DIR, :chown] do
107
109
  ngx = Nginxbrew::Local.find(config)
108
- puts "ngx=#{ngx}"
109
110
  unless FileTest.directory?(config.dist_to)
110
111
  raise_abort "#{config.package_name} is not installed!"
111
112
  end
@@ -149,7 +150,7 @@ end
149
150
  desc "list nginx versions"
150
151
  task :nginxes do
151
152
  HEAD_VERSION = ENV["HEAD_VERSION"]
152
- nginxes = Nginxbrew::Nginxes.nginxes
153
+ nginxes = Nginxbrew::Catalog.nginxes(cache_dir=CACHE_DIR)
153
154
  ((HEAD_VERSION) ? nginxes.filter_versions(HEAD_VERSION) : nginxes.versions).each do |v|
154
155
  $stdout.puts("[nginx-]#{v}")
155
156
  end
@@ -158,18 +159,17 @@ end
158
159
 
159
160
  desc "list openresty versions"
160
161
  task :openresties do
161
- require "nginxbrew/nginxes"
162
162
  HEAD_VERSION = ENV["HEAD_VERSION"]
163
- nginxes = Nginxbrew::Nginxes.openresties
163
+ nginxes = Nginxbrew::Catalog.openresties(cache_dir=CACHE_DIR)
164
164
  ((HEAD_VERSION) ? nginxes.filter_versions(HEAD_VERSION) : nginxes.versions).each do |v|
165
165
  $stdout.puts("[ngx_openresty-]#{v}")
166
166
  end
167
167
  end
168
168
 
169
169
 
170
- desc "Output new configfile for nginxbrew into specified path as {makeconf_OUTPUT_TO}"
170
+ desc "Output new configfile for nginxbrew into specified path as {MAKECONF_OUTPUT_TO}"
171
171
  task :makeconf do
172
- output_to = ENV["makeconf_OUTPUT_TO"]
172
+ output_to = ENV["MAKECONF_OUTPUT_TO"]
173
173
 
174
174
  from_file = File.join(File.dirname(__FILE__), "config/default.rb")
175
175
  abort "crit, #{from_file} is not found" unless FileTest.file?(from_file)
@@ -1,3 +1,3 @@
1
1
  module Nginxbrew
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -1,31 +1,58 @@
1
1
  require "spec_helper"
2
2
  require "nginxbrew"
3
- require "nginxbrew/nginxes"
3
+ require "nginxbrew/catalog"
4
4
 
5
+ require "fileutils"
5
6
 
6
- describe Nginxbrew::Nginxes, "scraping ngx versions in their page" do
7
+
8
+ describe Nginxbrew::Catalog, "scraping ngx versions in their page" do
9
+
10
+ before(:each) do
11
+ @cache_dir = File.join("/tmp", File.dirname(__FILE__), "cache")
12
+ FileUtils.mkdir_p(@cache_dir)
13
+ end
14
+
15
+ after(:each) do
16
+ FileUtils.rm_rf(@cache_dir)
17
+ end
7
18
 
8
19
  it "should return list of nginx versions" do
9
- ret = Nginxbrew::Nginxes.nginxes
20
+ ret = Nginxbrew::Catalog.nginxes
10
21
  expect(ret.size).to be > 0
11
- expect(ret.ngx_type).to eq Nginxbrew::Nginxes::TypeNginx
22
+ expect(ret.ngx_type).to eq Nginxbrew::Catalog::TypeNginx
12
23
  end
13
24
 
14
25
  it "version text in nginxes is [0-9.]+" do
15
- ret = Nginxbrew::Nginxes.nginxes
26
+ ret = Nginxbrew::Catalog.nginxes
16
27
  ret.versions.each do |v|
17
28
  expect(v).to match(/[0-9.]+/)
18
29
  end
19
30
  end
20
31
 
32
+ it "cache of nginxes should be created and can read it" do
33
+ Nginxbrew::Catalog.nginxes(cache_dir=@cache_dir)
34
+ expect(FileTest.file?(File.join(@cache_dir, "catalog/nginxes.ca"))).to be_truthy
35
+
36
+ ret = Nginxbrew::Catalog.nginxes
37
+ expect(ret.size).to be > 0
38
+ end
39
+
40
+ it "cache of openresties should be created and can read it" do
41
+ Nginxbrew::Catalog.openresties(cache_dir=@cache_dir)
42
+ expect(FileTest.file?(File.join(@cache_dir, "catalog/openresties.ca"))).to be_truthy
43
+
44
+ ret = Nginxbrew::Catalog.openresties
45
+ expect(ret.size).to be > 0
46
+ end
47
+
21
48
  it "should return list of openresty versions" do
22
- ret = Nginxbrew::Nginxes.openresties
49
+ ret = Nginxbrew::Catalog.openresties
23
50
  expect(ret.size).to be > 0
24
- expect(ret.ngx_type).to eq Nginxbrew::Nginxes::TypeOpenresty
51
+ expect(ret.ngx_type).to eq Nginxbrew::Catalog::TypeOpenresty
25
52
  end
26
53
 
27
54
  it "version text in openresties is [0-9.]+" do
28
- ret = Nginxbrew::Nginxes.openresties
55
+ ret = Nginxbrew::Catalog.openresties
29
56
  ret.versions.each do |v|
30
57
  expect(v).to match(/[0-9.]+/)
31
58
  end
@@ -34,40 +61,40 @@ describe Nginxbrew::Nginxes, "scraping ngx versions in their page" do
34
61
  end
35
62
 
36
63
 
37
- describe Nginxbrew::Nginxes, "version control" do
64
+ describe Nginxbrew::Catalog, "version control" do
38
65
 
39
66
  it "should be raised exception when input invalid ngx type" do
40
67
  expect {
41
- Nginxbrew::Nginxes.new("INVALID_NGX_TYPE", ["1", "2", "3"])
68
+ Nginxbrew::Catalog.new("INVALID_NGX_TYPE", ["1", "2", "3"])
42
69
  }.to raise_error
43
70
  end
44
71
 
45
72
  it "should be raised exception when version list is empty" do
46
73
  expect {
47
- Nginxbrew::Nginxes.new(Nginxbrew::Nginxes::TypeNginx, [])
74
+ Nginxbrew::Catalog.new(Nginxbrew::Catalog::TypeNginx, [])
48
75
  }.to raise_error
49
76
  end
50
77
 
51
78
  it "should be raised exception when version is not found in head_of" do
52
79
  expect {
53
- Nginxbrew::Nginxes.new(Nginxbrew::Nginxes::TypeNginx, ["1", "2", "3"]).head_of("INVALID_VERSION")
80
+ Nginxbrew::Catalog.new(Nginxbrew::Catalog::TypeNginx, ["1", "2", "3"]).head_of("INVALID_VERSION")
54
81
  }.to raise_error
55
82
  end
56
83
 
57
84
  it "should be raised exception when version is not found in filter_versions" do
58
85
  expect {
59
- Nginxbrew::Nginxes.new(Nginxbrew::Nginxes::TypeNginx, ["1", "2", "3"]).filter_versions("INVALID_VERSION")
86
+ Nginxbrew::Catalog.new(Nginxbrew::Catalog::TypeNginx, ["1", "2", "3"]).filter_versions("INVALID_VERSION")
60
87
  }.to raise_error
61
88
  end
62
89
 
63
90
  it "can know size of versions" do
64
- nginxes = Nginxbrew::Nginxes.new(Nginxbrew::Nginxes::TypeNginx, ["0.0.0", "0.0.1"])
91
+ nginxes = Nginxbrew::Catalog.new(Nginxbrew::Catalog::TypeNginx, ["0.0.0", "0.0.1"])
65
92
  expect(nginxes.size).to eq 2
66
93
  end
67
94
 
68
95
  it "filter_versions should return list of active versions" do
69
- nginxes = Nginxbrew::Nginxes.new(
70
- Nginxbrew::Nginxes::TypeNginx,
96
+ nginxes = Nginxbrew::Catalog.new(
97
+ Nginxbrew::Catalog::TypeNginx,
71
98
  %w(0.1 0.2 0.3 1.1 1.2 1.3 2.0.0 2.0.1 2.1.0 2.1.1)
72
99
  )
73
100
  expect(nginxes.filter_versions("1")).to eq ["1.3", "1.2", "1.1"]
@@ -75,16 +102,16 @@ describe Nginxbrew::Nginxes, "version control" do
75
102
  end
76
103
 
77
104
  it "versions should be sorted order by version-number desc" do
78
- nginxes = Nginxbrew::Nginxes.new(
79
- Nginxbrew::Nginxes::TypeNginx,
105
+ nginxes = Nginxbrew::Catalog.new(
106
+ Nginxbrew::Catalog::TypeNginx,
80
107
  %w(0.0.1 0.0.2 0.1.0 0.1.1 1.0.0 1.0.1 1.1.0 2.15.1 2.8.15)
81
108
  )
82
109
  expect(nginxes.versions).to eq %w(2.15.1 2.8.15 1.1.0 1.0.1 1.0.0 0.1.1 0.1.0 0.0.2 0.0.1)
83
110
  end
84
111
 
85
112
  it "head_of should returns head of versions" do
86
- nginxes = Nginxbrew::Nginxes.new(
87
- Nginxbrew::Nginxes::TypeNginx,
113
+ nginxes = Nginxbrew::Catalog.new(
114
+ Nginxbrew::Catalog::TypeNginx,
88
115
  %w(0.0.0 0.0.1 0.1.0 0.1.1 1.0.0 2.0.0)
89
116
  )
90
117
  expect(nginxes.head_of("0.0")).to eq "0.0.1"
@@ -93,12 +120,21 @@ describe Nginxbrew::Nginxes, "version control" do
93
120
  end
94
121
 
95
122
  it "head_of is first element of versions which sorted by version number" do
96
- nginxes = Nginxbrew::Nginxes.new(
97
- Nginxbrew::Nginxes::TypeNginx,
123
+ nginxes = Nginxbrew::Catalog.new(
124
+ Nginxbrew::Catalog::TypeNginx,
98
125
  %w(1.5.8.1 1.5.12.1 1.5.11.1)
99
126
  )
100
127
  expect(nginxes.head_of("1.5")).to eq "1.5.12.1"
101
128
  expect(nginxes.head_of("1")).to eq "1.5.12.1"
102
129
  end
103
130
 
131
+ it "limit the active version" do
132
+ catalog = Nginxbrew::Catalog.new(
133
+ Nginxbrew::Catalog::TypeNginx,
134
+ %w(0.1 0.2 0.3)
135
+ )
136
+ catalog.unsupport_under!("0.2")
137
+ expect(catalog.versions).to eq %w(0.3 0.2)
138
+ end
139
+
104
140
  end
@@ -1,2 +1,6 @@
1
1
  require "rubygems"
2
2
 
3
+ require "logger"
4
+
5
+ $logger = Logger.new(STDOUT)
6
+ $logger.level = Logger::DEBUG
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nginxbrew
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - takumakanari
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-17 00:00:00.000000000 Z
11
+ date: 2014-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -69,17 +69,17 @@ files:
69
69
  - Rakefile
70
70
  - bin/nginxbrew
71
71
  - lib/nginxbrew.rb
72
+ - lib/nginxbrew/catalog.rb
72
73
  - lib/nginxbrew/config/base.rb
73
74
  - lib/nginxbrew/config/default.rb
74
75
  - lib/nginxbrew/convention.rb
75
76
  - lib/nginxbrew/local.rb
76
- - lib/nginxbrew/nginxes.rb
77
77
  - lib/nginxbrew/rake_tools.rb
78
78
  - lib/nginxbrew/tasks.rb
79
79
  - lib/nginxbrew/version.rb
80
80
  - nginxbrew.gemspec
81
+ - spec/catalog_spec.rb
81
82
  - spec/convention_spec.rb
82
- - spec/nginxes_spec.rb
83
83
  - spec/spec_helper.rb
84
84
  homepage: ''
85
85
  licenses:
@@ -106,6 +106,6 @@ signing_key:
106
106
  specification_version: 4
107
107
  summary: Multi installation for nginx.
108
108
  test_files:
109
+ - spec/catalog_spec.rb
109
110
  - spec/convention_spec.rb
110
- - spec/nginxes_spec.rb
111
111
  - spec/spec_helper.rb
@@ -1,93 +0,0 @@
1
- require "net/http"
2
- require "uri"
3
-
4
- include Nginxbrew
5
-
6
-
7
- module Nginxbrew
8
-
9
- class VersionNotFoundError < StandardError
10
-
11
- def initialize(v)
12
- super("version '#{v}' is not found in all versions of nginxes/openresties")
13
- end
14
-
15
- end
16
-
17
- class Nginxes
18
-
19
- TypeNginx = "nginx"
20
- TypeOpenresty = "openresty"
21
-
22
- attr_reader :ngx_type, :versions
23
-
24
- def initialize(ngx_type, versions)
25
- unless [TypeNginx, TypeOpenresty].include?(ngx_type)
26
- raise Exception.new("Invalid ngx_type #{ngx_type}")
27
- end
28
- raise Exception.new("No versions of nginx!") if versions.size == 0
29
- @ngx_type = ngx_type
30
- @versions = versions.uniq.map do |v|
31
- Gem::Version.new(v) # 1.15.x <> 1.8.x should be 1.15.x > 1.8.x
32
- end.sort.reverse.map do |v|
33
- v.to_s
34
- end
35
- end
36
-
37
- def size
38
- @versions.size
39
- end
40
-
41
- def filter_versions(head_of)
42
- src_numbers = head_of.split(".")
43
- src_numbers_size = src_numbers.size
44
- r = @versions.select do |v|
45
- v.split(".").slice(0, src_numbers_size) == src_numbers
46
- end
47
- raise VersionNotFoundError.new(head_of) if r.size == 0
48
- r
49
- end
50
-
51
- def head_of(version)
52
- src_numbers = version.split(".")
53
- src_numbers_size = src_numbers.size
54
- r = @versions.detect do |v|
55
- v.split(".").slice(0, src_numbers_size) == src_numbers
56
- end
57
- raise VersionNotFoundError.new(version) unless r
58
- r
59
- end
60
-
61
- def self.nginxes
62
- versions = html_body_of("http://nginx.org", "/download/").
63
- gsub(/href="nginx\-([0-9\.]+?)\.tar\.gz"/).inject([]) do |memo, match|
64
- memo << $1
65
- memo
66
- end
67
- Nginxes.new(TypeNginx, versions)
68
- end
69
-
70
- def self.openresties
71
- versions = html_body_of("http://openresty.org", "/").
72
- gsub(/ngx_openresty\-([0-9\.]+?)\.tar\.gz/).inject([]) do |memo, match|
73
- memo << $1
74
- memo
75
- end
76
- Nginxes.new(TypeOpenresty, versions)
77
- end
78
-
79
- private
80
-
81
- def self.html_body_of(host, page)
82
- url = URI.parse(host)
83
- res = Net::HTTP.start(url.host, url.port) {|http|
84
- http.get(page)
85
- }
86
- raise Exception.new("Failed get list of nginx") if res.code.to_i != 200
87
- res.body
88
- end
89
-
90
- end
91
-
92
- end
93
-