rackula 1.0.0 → 1.1.0

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: b249cc4bf0e7bb535b6ece14d8dce90b558a98c5f7921e735cb851341a36551f
4
- data.tar.gz: 2ff7b7e2ea8e11abc58a6f73aab66548e82cbcb993fcd79c3ef4218024343cfa
3
+ metadata.gz: b84258f755ce6cf699ab275ed40821c8de998d9fa5b7d4984c925defa5691709
4
+ data.tar.gz: db9d71a7ade7b25813721fd08229bb0328ac40a4d7422cc00d3fe572d5b6f5c5
5
5
  SHA512:
6
- metadata.gz: dfab9891149e0474e8b0649282a9931a96bdf3bfaa9bc72948e2e82f5b4889ede982944ae39384637b3c1da12d347ba9b772c86f01b431ef34c32642dd6b4276
7
- data.tar.gz: 38ee786386165c2e06ced60ab591b5aa1141530f6603adc14e5db7a9f2a20ef0b797ebc1a9ab157543660176cde326e9b0382f55b315cbd95a394d9b4b3fb75e
6
+ metadata.gz: 42097e227243b328f20804fa963e444e463f6945c91b657b9088253c4053caa88d2f2eebb5ee179618793312c8f53150223637af70b2eca2e831928c6b56d30b
7
+ data.tar.gz: 03c6c09e6b478f45a85fcf56e7494ee4f0df6c8c787d4a9dbef2522cff24eaecc206498f1a7acd51ea92f699dace50c6da9145585f8536eeb9267b7d101d7ba3
@@ -0,0 +1,59 @@
1
+ name: Development
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ runs-on: ${{matrix.os}}-latest
8
+ continue-on-error: ${{matrix.experimental}}
9
+
10
+ strategy:
11
+ matrix:
12
+ os:
13
+ - ubuntu
14
+ - macos
15
+
16
+ ruby:
17
+ - 2.5
18
+ - 2.6
19
+ - 2.7
20
+
21
+ experimental: [false]
22
+ env: [""]
23
+
24
+ include:
25
+ - os: ubuntu
26
+ ruby: truffleruby
27
+ experimental: true
28
+ env: JRUBY_OPTS="--debug -X+O"
29
+ - os: ubuntu
30
+ ruby: jruby
31
+ experimental: true
32
+ - os: ubuntu
33
+ ruby: head
34
+ experimental: true
35
+ - os: ubuntu
36
+ ruby: 2.6
37
+ experimental: false
38
+ env: COVERAGE=PartialSummary,Coveralls
39
+
40
+ steps:
41
+ - uses: actions/checkout@v1
42
+ - uses: ruby/setup-ruby@v1
43
+ with:
44
+ ruby-version: ${{matrix.ruby}}
45
+
46
+ - name: Install dependencies
47
+ run: ${{matrix.env}} bundle install
48
+
49
+ - name: Installing packages (ubuntu)
50
+ if: matrix.os == 'ubuntu'
51
+ run: sudo apt-get install wget
52
+
53
+ - name: Installing packages (macos)
54
+ if: matrix.os == 'macos'
55
+ run: brew install wget
56
+
57
+ - name: Run tests
58
+ timeout-minutes: 5
59
+ run: ${{matrix.env}} bundle exec rspec
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Rackula will immortalize your rackup web app by generating a static copy. It can be used to generate a static site from any rack-compatible middleware (e.g. rails, sinatra, utopia).
4
4
 
5
- [![Build Status](https://secure.travis-ci.org/socketry/rackula.svg)](http://travis-ci.org/socketry/rackula)
5
+ [![Build Status](https://travis-ci.com/socketry/rackula.svg)](https://travis-ci.com/socketry/rackula)
6
6
  [![Coverage Status](https://coveralls.io/repos/socketry/rackula/badge.svg)](https://coveralls.io/r/socketry/rackula)
7
7
 
8
8
  ## Installation
@@ -29,6 +29,8 @@ require 'async/io'
29
29
  require 'async/container'
30
30
  require 'async/http'
31
31
 
32
+ require 'variant'
33
+
32
34
  module Rackula
33
35
  module Command
34
36
  # Server setup commands.
@@ -41,8 +43,6 @@ module Rackula
41
43
  option '-o/--output-path <path>', "The output path to save static site.", default: 'static'
42
44
 
43
45
  option '-f/--force', "If the output path exists, delete it.", default: false
44
-
45
- option '--count', "The number of server instances to spawn.", default: 4
46
46
  end
47
47
 
48
48
  def copy_and_fetch(port, root)
@@ -57,7 +57,7 @@ module Rackula
57
57
  raise Samovar::Failure.new("Output path already exists!")
58
58
  end
59
59
  end
60
-
60
+
61
61
  # Create output directory
62
62
  Dir.mkdir(output_path)
63
63
 
@@ -72,23 +72,31 @@ module Rackula
72
72
  end
73
73
 
74
74
  def serve(endpoint, root)
75
- container = Async::Container::Threaded.new
75
+ container = Async::Container.new
76
76
 
77
77
  config_path = root + @options[:config]
78
- rack_app, options = Rack::Builder.parse_file(config_path.to_s)
79
-
80
- app = ::Falcon::Server.middleware(rack_app, verbose: @options[:verbose])
81
- server = ::Falcon::Server.new(app, endpoint)
82
78
 
83
- container.run(count: @options[:count]) do
84
- server.run
79
+ container.run do |instance|
80
+ Async do
81
+ rack_app, _ = Rack::Builder.parse_file(config_path.to_s)
82
+ app = ::Falcon::Server.middleware(rack_app, verbose: @options[:verbose])
83
+ server = ::Falcon::Server.new(app, endpoint)
84
+
85
+ instance.ready!
86
+
87
+ server.run
88
+ end
85
89
  end
90
+
91
+ container.wait_until_ready
92
+
93
+ return container
86
94
  end
87
95
 
88
96
  def run(address, root)
89
- endpoint = Async::HTTP::URLEndpoint.parse("http://localhost", port: address.ip_port, reuse_port: true)
97
+ endpoint = Async::HTTP::Endpoint.parse("http://localhost", port: address.ip_port, reuse_port: true)
90
98
 
91
- puts "Setting up container to serve site on port #{address.ip_port}..."
99
+ Async.logger.info(self) {"Setting up container to serve site on port #{address.ip_port}..."}
92
100
  container = serve(endpoint, root)
93
101
 
94
102
  # puts "Copy and fetch site to static..."
@@ -98,16 +106,15 @@ module Rackula
98
106
  end
99
107
 
100
108
  def call
101
- # We set the default RACK_ENV to static unless it was already set to something.
102
- ENV['RACK_ENV'] ||= 'static'
109
+ Variant.force!('static')
103
110
 
104
- Async::Reactor.run do
111
+ Async do
105
112
  endpoint = Async::IO::Endpoint.tcp("localhost", 0, reuse_port: true)
106
113
 
107
114
  # We bind to a socket to generate a temporary port:
108
- endpoint.bind do |socket|
109
- run(socket.local_address, Pathname.new(parent.root))
110
- end
115
+ socket = endpoint.each.first.bind
116
+
117
+ run(socket.local_address, Pathname.new(parent.root))
111
118
  end
112
119
  end
113
120
  end
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Rackula
22
- VERSION = "1.0.0"
22
+ VERSION = "1.1.0"
23
23
  end
@@ -19,10 +19,12 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency "samovar", "~> 2.1"
22
- spec.add_dependency "falcon", "~> 0.27"
23
-
22
+ spec.add_dependency "falcon", "~> 0.34"
23
+
24
+ spec.add_dependency "variant"
25
+
24
26
  spec.add_development_dependency "covered"
25
27
  spec.add_development_dependency "bundler"
26
- spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "bake-bundler"
27
29
  spec.add_development_dependency "rspec", "~> 3.0"
28
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rackula
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-26 00:00:00.000000000 Z
11
+ date: 2020-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: samovar
@@ -30,14 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.27'
33
+ version: '0.34'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.27'
40
+ version: '0.34'
41
+ - !ruby/object:Gem::Dependency
42
+ name: variant
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: covered
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -67,19 +81,19 @@ dependencies:
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
- name: rake
84
+ name: bake-bundler
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - "~>"
87
+ - - ">="
74
88
  - !ruby/object:Gem::Version
75
- version: '10.0'
89
+ version: '0'
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
- - - "~>"
94
+ - - ">="
81
95
  - !ruby/object:Gem::Version
82
- version: '10.0'
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rspec
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -103,12 +117,11 @@ extensions: []
103
117
  extra_rdoc_files: []
104
118
  files:
105
119
  - ".editorconfig"
120
+ - ".github/workflows/development.yml"
106
121
  - ".gitignore"
107
122
  - ".rspec"
108
- - ".travis.yml"
109
123
  - Gemfile
110
124
  - README.md
111
- - Rakefile
112
125
  - bin/rackula
113
126
  - lib/rackula.rb
114
127
  - lib/rackula/command.rb
@@ -134,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
147
  - !ruby/object:Gem::Version
135
148
  version: '0'
136
149
  requirements: []
137
- rubygems_version: 3.0.3
150
+ rubygems_version: 3.1.2
138
151
  signing_key:
139
152
  specification_version: 4
140
153
  summary: Generate a static site from any rackup compatible application.
@@ -1,17 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
-
4
- matrix:
5
- include:
6
- - rvm: 2.3
7
- - rvm: 2.4
8
- - rvm: 2.5
9
- - rvm: 2.6
10
- env: COVERAGE=BriefSummary,Coveralls
11
- - rvm: ruby-head
12
- - rvm: jruby-head
13
- - rvm: truffleruby
14
- allow_failures:
15
- - rvm: ruby-head
16
- - rvm: jruby-head
17
- - rvm: truffleruby
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec