raindeer 0.8.1 → 0.9.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 451e4170add3ea5fd9949709b266c0895e9c6f07ada0890c83d7bf3f9fc90a57
4
- data.tar.gz: 9d39cb5f8134a67a98fca198fd7b3b35bd9ad35eb8228d2197a09cca5dc5c6a3
3
+ metadata.gz: 9f5ab8d692028a47cd2cb2098f37d4751b28fbf782b005ea113ec818101cd247
4
+ data.tar.gz: fe6b4820b15d0dc1698aa4d0276996575869576fa89c31f5162873b9290c80be
5
5
  SHA512:
6
- metadata.gz: 4e573edce3febcce5e82f11a2ddccc85a08931ecf3dd60dabf5d1aeb8ff9cc1e8a27b985852049ac6143dcaab95dbb65026dbe1984d75a0910c167d484624b2e
7
- data.tar.gz: a1bc95cb75ed6d2a65b87cf2995f333fcc13fb2aeba3f4aa0e1da727c441ef20014a424bf4d8d8aff42b829299e0a3ee3dab04eec171c57f633b95108b788bda
6
+ metadata.gz: 5fed261d28894f9ac83fd2a90e2abb3c3eb044be6e86d05a4fd764b0dcfaf667668dbc5e9804a4352a3c2256ed3692a8dacd75dcd3bb505e9b93d5b06f911c47
7
+ data.tar.gz: d9cbb7ce353d72f68e4ca9894a400fc7f371dd3c5c3cfdc038a81b9490b93d4d9627ed8014f029d30bc61e8efb7d3c1b31610b7398106cf44bb620b4570cdae5
data/lib/cli/cli.rb CHANGED
@@ -8,19 +8,18 @@ module Rain
8
8
  extend Trees
9
9
 
10
10
  line('new :app_name') do |app_name|
11
+ summary { "Generates a Raindeer application with the specified name." }
11
12
  execute { 'TODO' }
12
13
  end
13
14
 
14
15
  line('server') do
16
+ summary { "Starts a Raindeer application. Once run visit http://127.0.0.1:4133" }
15
17
  execute { system('bin/server') }
16
18
  end
17
19
 
18
- line('static') do
19
- summary { 'Static site generation' }
20
-
21
- line('build') do
22
- execute { Static.build(application_path: Dir.pwd) }
23
- end
20
+ line('build') do
21
+ summary { 'Exports your static site at "app/pages" to the "build" folder.' }
22
+ execute { Static.build(application_path: Dir.pwd) }
24
23
  end
25
24
  end
26
25
  end
data/lib/pages/pages.rb CHANGED
@@ -8,18 +8,22 @@ module Rain
8
8
 
9
9
  attr_reader :url_paths
10
10
 
11
- Result = Struct.new(:metadata, :html)
11
+ Page = Struct.new(:metadata, :html)
12
12
 
13
13
  def initialize(metadata:)
14
14
  @url_paths = metadata.url_paths
15
15
  @raindown = Raindown.new(metadata:)
16
16
  end
17
17
 
18
- def process(file_path:)
18
+ def page(path:)
19
+ path = '/home' if path == '/'
20
+ url_path = File.expand_path("app/pages#{path}", Dir.pwd)
21
+ file_path = @url_paths[url_path] || return
22
+
19
23
  metadata, markdown = parse_file(file_path:)
20
24
  raindown = @raindown.render(markdown:)
21
25
 
22
- Result.new(metadata, raindown)
26
+ Page.new(metadata, raindown)
23
27
  end
24
28
 
25
29
  private
data/lib/raindeer/boot.rb CHANGED
@@ -45,13 +45,7 @@ end
45
45
  # FRAMEWORK EXTERNAL API
46
46
  #################################################
47
47
 
48
- module Raindeer
49
- class << self
50
- def router(&block)
51
- Providers['rain.router'].instance_eval(&block)
52
- end
53
- end
54
- end
48
+ require_relative 'raindeer'
55
49
 
56
50
  #################################################
57
51
  # APPLICATION CODE
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'boot'
4
+
5
+ module Raindeer
6
+ class << self
7
+ def router(&block)
8
+ Providers['rain.router'].instance_eval(&block)
9
+ end
10
+
11
+ def pages
12
+ Providers['rain.pages']
13
+ end
14
+ end
15
+ end
data/lib/router/router.rb CHANGED
@@ -56,7 +56,7 @@ module Rain
56
56
  response_event = nil
57
57
 
58
58
  # The last route event will render a response event which we want to return to the request event.
59
- @trie.match(path: event.request.path.delete_suffix('/')).each do |route_event|
59
+ @trie.match(path: event.request.path).each do |route_event|
60
60
  response_event = route_event.trigger
61
61
  end
62
62
  return response_event if response_event
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Raindeer
4
- VERSION = '0.8.1'
4
+ VERSION = '0.9.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: raindeer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - maedi
@@ -260,6 +260,7 @@ files:
260
260
  - lib/pages/raindown/raindown.rb
261
261
  - lib/raindeer/boot.rb
262
262
  - lib/raindeer/cli.rb
263
+ - lib/raindeer/raindeer.rb
263
264
  - lib/router/route.rb
264
265
  - lib/router/route_event.rb
265
266
  - lib/router/router.rb