rackula 1.0.0 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rackula/command/generate.rb +28 -22
- data/lib/rackula/version.rb +1 -1
- metadata +32 -27
- data/.editorconfig +0 -6
- data/.gitignore +0 -12
- data/.rspec +0 -4
- data/.travis.yml +0 -17
- data/Gemfile +0 -9
- data/README.md +0 -62
- data/Rakefile +0 -6
- data/rackula.gemspec +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0281af1617fada7ee4c90875d489a0f681c45164fb4941718ddff54754e67a30'
|
4
|
+
data.tar.gz: 727840b9497c08f9a31b13ffda2fa584c642bc00697c29370b30a04a360d4f52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b9f2d4ce3a41e1aaae806ea69d59f2673617105d874bdd42414eb2e60d8f05afcd4a2d22fd06fd560b9faee7b0ffebb685ae119ab3bf6cce8b093112172a4ab
|
7
|
+
data.tar.gz: 2a2309ce12cc4679863fe97bc0d7f209ed9f20c9b968b28b86bacf099b086ce38a7738f074d3a29afd51c89cec77b27514741b2f950c8abb6664d571536d00ce
|
@@ -21,6 +21,7 @@
|
|
21
21
|
require 'samovar'
|
22
22
|
|
23
23
|
require 'pathname'
|
24
|
+
require 'fileutils'
|
24
25
|
require 'rack'
|
25
26
|
|
26
27
|
require 'falcon/server'
|
@@ -29,6 +30,8 @@ require 'async/io'
|
|
29
30
|
require 'async/container'
|
30
31
|
require 'async/http'
|
31
32
|
|
33
|
+
require 'variant'
|
34
|
+
|
32
35
|
module Rackula
|
33
36
|
module Command
|
34
37
|
# Server setup commands.
|
@@ -41,8 +44,6 @@ module Rackula
|
|
41
44
|
option '-o/--output-path <path>', "The output path to save static site.", default: 'static'
|
42
45
|
|
43
46
|
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
47
|
end
|
47
48
|
|
48
49
|
def copy_and_fetch(port, root)
|
@@ -57,7 +58,7 @@ module Rackula
|
|
57
58
|
raise Samovar::Failure.new("Output path already exists!")
|
58
59
|
end
|
59
60
|
end
|
60
|
-
|
61
|
+
|
61
62
|
# Create output directory
|
62
63
|
Dir.mkdir(output_path)
|
63
64
|
|
@@ -72,23 +73,31 @@ module Rackula
|
|
72
73
|
end
|
73
74
|
|
74
75
|
def serve(endpoint, root)
|
75
|
-
container = Async::Container
|
76
|
+
container = Async::Container.new
|
76
77
|
|
77
78
|
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
79
|
|
83
|
-
container.run
|
84
|
-
|
80
|
+
container.run do |instance|
|
81
|
+
Async do
|
82
|
+
rack_app, _ = Rack::Builder.parse_file(config_path.to_s)
|
83
|
+
app = ::Falcon::Server.middleware(rack_app, verbose: @options[:verbose])
|
84
|
+
server = ::Falcon::Server.new(app, endpoint)
|
85
|
+
|
86
|
+
instance.ready!
|
87
|
+
|
88
|
+
server.run
|
89
|
+
end
|
85
90
|
end
|
91
|
+
|
92
|
+
container.wait_until_ready
|
93
|
+
|
94
|
+
return container
|
86
95
|
end
|
87
96
|
|
88
97
|
def run(address, root)
|
89
|
-
endpoint = Async::HTTP::
|
98
|
+
endpoint = Async::HTTP::Endpoint.parse("http://localhost", port: address.ip_port, reuse_port: true)
|
90
99
|
|
91
|
-
|
100
|
+
Console.logger.info(self) {"Setting up container to serve site on port #{address.ip_port}..."}
|
92
101
|
container = serve(endpoint, root)
|
93
102
|
|
94
103
|
# puts "Copy and fetch site to static..."
|
@@ -98,17 +107,14 @@ module Rackula
|
|
98
107
|
end
|
99
108
|
|
100
109
|
def call
|
101
|
-
|
102
|
-
ENV['RACK_ENV'] ||= 'static'
|
110
|
+
Variant.force!('static')
|
103
111
|
|
104
|
-
Async::
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
end
|
111
|
-
end
|
112
|
+
endpoint = Async::IO::Endpoint.tcp("localhost", 0, reuse_port: true)
|
113
|
+
|
114
|
+
# We bind to a socket to generate a temporary port:
|
115
|
+
socket = Sync{endpoint.each.first.bind}
|
116
|
+
|
117
|
+
run(socket.local_address, Pathname.new(parent.root))
|
112
118
|
end
|
113
119
|
end
|
114
120
|
end
|
data/lib/rackula/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rackula
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: falcon
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.34'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.34'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: samovar
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -25,21 +39,21 @@ dependencies:
|
|
25
39
|
- !ruby/object:Gem::Version
|
26
40
|
version: '2.1'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
42
|
+
name: variant
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
|
-
- - "
|
45
|
+
- - ">="
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0
|
47
|
+
version: '0'
|
34
48
|
type: :runtime
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
|
-
- - "
|
52
|
+
- - ">="
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
56
|
+
name: bake-bundler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - ">="
|
@@ -67,19 +81,19 @@ dependencies:
|
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
84
|
+
name: covered
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- - "
|
87
|
+
- - ">="
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
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: '
|
96
|
+
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: rspec
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,32 +108,23 @@ dependencies:
|
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '3.0'
|
97
|
-
description:
|
111
|
+
description:
|
98
112
|
email:
|
99
|
-
- samuel.williams@oriontransfer.co.nz
|
100
113
|
executables:
|
101
114
|
- rackula
|
102
115
|
extensions: []
|
103
116
|
extra_rdoc_files: []
|
104
117
|
files:
|
105
|
-
- ".editorconfig"
|
106
|
-
- ".gitignore"
|
107
|
-
- ".rspec"
|
108
|
-
- ".travis.yml"
|
109
|
-
- Gemfile
|
110
|
-
- README.md
|
111
|
-
- Rakefile
|
112
118
|
- bin/rackula
|
113
119
|
- lib/rackula.rb
|
114
120
|
- lib/rackula/command.rb
|
115
121
|
- lib/rackula/command/generate.rb
|
116
122
|
- lib/rackula/version.rb
|
117
|
-
- rackula.gemspec
|
118
123
|
homepage: https://github.com/socketry/rackula
|
119
124
|
licenses:
|
120
125
|
- MIT
|
121
126
|
metadata: {}
|
122
|
-
post_install_message:
|
127
|
+
post_install_message:
|
123
128
|
rdoc_options: []
|
124
129
|
require_paths:
|
125
130
|
- lib
|
@@ -134,8 +139,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
139
|
- !ruby/object:Gem::Version
|
135
140
|
version: '0'
|
136
141
|
requirements: []
|
137
|
-
rubygems_version: 3.
|
138
|
-
signing_key:
|
142
|
+
rubygems_version: 3.2.22
|
143
|
+
signing_key:
|
139
144
|
specification_version: 4
|
140
145
|
summary: Generate a static site from any rackup compatible application.
|
141
146
|
test_files: []
|
data/.editorconfig
DELETED
data/.gitignore
DELETED
data/.rspec
DELETED
data/.travis.yml
DELETED
@@ -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/Gemfile
DELETED
data/README.md
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
# Rackula
|
2
|
-
|
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
|
-
|
5
|
-
[](http://travis-ci.org/socketry/rackula)
|
6
|
-
[](https://coveralls.io/r/socketry/rackula)
|
7
|
-
|
8
|
-
## Installation
|
9
|
-
|
10
|
-
Install the gem:
|
11
|
-
|
12
|
-
$ gem install rackula
|
13
|
-
|
14
|
-
Ensure that `wget` is installed and available.
|
15
|
-
|
16
|
-
## Usage
|
17
|
-
|
18
|
-
### Rack Applications
|
19
|
-
|
20
|
-
In the root directory, simply run `rackula`. It will generate a static site in `static`. For more details about how to change the default behavior, run `rackula --help`.
|
21
|
-
|
22
|
-
### Rails Applications
|
23
|
-
|
24
|
-
Add a `config.ru` file to your rails app and follow the above instructions.
|
25
|
-
|
26
|
-
```ruby
|
27
|
-
# config.ru for rails app
|
28
|
-
require_relative 'config/environment'
|
29
|
-
run Rails.application
|
30
|
-
```
|
31
|
-
|
32
|
-
## Contributing
|
33
|
-
|
34
|
-
1. Fork it
|
35
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
36
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
37
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
38
|
-
5. Create new Pull Request
|
39
|
-
|
40
|
-
## License
|
41
|
-
|
42
|
-
Released under the MIT license.
|
43
|
-
|
44
|
-
Copyright, 2017, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
|
45
|
-
|
46
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
47
|
-
of this software and associated documentation files (the "Software"), to deal
|
48
|
-
in the Software without restriction, including without limitation the rights
|
49
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
50
|
-
copies of the Software, and to permit persons to whom the Software is
|
51
|
-
furnished to do so, subject to the following conditions:
|
52
|
-
|
53
|
-
The above copyright notice and this permission notice shall be included in
|
54
|
-
all copies or substantial portions of the Software.
|
55
|
-
|
56
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
57
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
58
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
59
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
60
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
61
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
62
|
-
THE SOFTWARE.
|
data/Rakefile
DELETED
data/rackula.gemspec
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
|
2
|
-
require_relative "lib/rackula/version"
|
3
|
-
|
4
|
-
Gem::Specification.new do |spec|
|
5
|
-
spec.name = "rackula"
|
6
|
-
spec.version = Rackula::VERSION
|
7
|
-
spec.authors = ["Samuel Williams"]
|
8
|
-
spec.email = ["samuel.williams@oriontransfer.co.nz"]
|
9
|
-
|
10
|
-
spec.summary = "Generate a static site from any rackup compatible application."
|
11
|
-
spec.homepage = "https://github.com/socketry/rackula"
|
12
|
-
spec.license = "MIT"
|
13
|
-
|
14
|
-
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
15
|
-
f.match(%r{^(test|spec|features)/})
|
16
|
-
end
|
17
|
-
|
18
|
-
spec.executables = spec.files.grep(%r{^bin/}) {|f| File.basename(f)}
|
19
|
-
spec.require_paths = ["lib"]
|
20
|
-
|
21
|
-
spec.add_dependency "samovar", "~> 2.1"
|
22
|
-
spec.add_dependency "falcon", "~> 0.27"
|
23
|
-
|
24
|
-
spec.add_development_dependency "covered"
|
25
|
-
spec.add_development_dependency "bundler"
|
26
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
28
|
-
end
|