sitepress-cli 2.0.0.beta3 → 2.0.0.beta8

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: 972c4c266631419fef552bcdef48c3c9f40d4f513f735be2b0199027a21bc95c
4
- data.tar.gz: 2cd102dd839bfc154cfc64a51171eed8b1fc6268e5ea4ba939f835757ef43680
3
+ metadata.gz: 8e88075f3146145e2ab83862152fd7f47b51900845c61e33c31feb025c33ee1a
4
+ data.tar.gz: fbe88a32965034c1552815f109eed3b9220d747c63c4c597646e30ffa64b6367
5
5
  SHA512:
6
- metadata.gz: d6cb15e1b7e6c61eb0732106bbdacbd5f25b6a4a07c0b70120796b9583d65d7432458dc654afda5467f2214dda1ce999f058a700d3d793cd197390a9f663cc14
7
- data.tar.gz: 177a3dc4388e84fb45da2bbd5f53f2c48d592941698d27e0ceef7a60705c4bd899f27318c7e2c48f5fc24fd3e63ebaabf7bd5e4c4653dd4fc3e029167e2e625e
6
+ metadata.gz: 989aa1de0a38a52686b18c91529d2c355b5223a93c6038c26c6a31c200cdb9445355ddff13268febc0581cd31fdb57f4bf77565760a895e887e25963e74f08a6
7
+ data.tar.gz: 7c0afba920b75d42e6e1379bfb198c34a9140bbf9e88ff24bdbdf3648451ef8a4f362123d82bd311465b1f98c9a9f12a23a7ff20ab1c271cf55c211a1567e9f9
data/lib/sitepress/cli.rb CHANGED
@@ -16,8 +16,13 @@ module Sitepress
16
16
  desc "server", "Run preview server"
17
17
  def server
18
18
  initialize!
19
+ # Enable Sitepress web error reporting so users have more friendly
20
+ # error messages instead of seeing a Rails exception.
21
+ controller.enable_sitepress_error_reporting = true
22
+ # Enable reloading the site between requests so we can see changes.
23
+ controller.enable_site_reloading = true
19
24
  # This will use whatever server is found in the user's Gemfile.
20
- Rack::Server.start app: Sitepress::Server,
25
+ Rack::Server.start app: app,
21
26
  Port: options.fetch("port"),
22
27
  Host: options.fetch("bind_address")
23
28
  end
@@ -26,12 +31,12 @@ module Sitepress
26
31
  desc "compile", "Compile project into static pages"
27
32
  def compile
28
33
  initialize!
34
+ # Page compilation
35
+ logger.info "Sitepress compiling pages"
36
+ Compiler.new(site: configuration.site, root_path: options.fetch("output_path")).compile
29
37
  # Sprockets compilation
30
38
  logger.info "Sitepress compiling assets"
31
39
  sprockets_manifest(target_path: options.fetch("output_path")).compile precompile_assets
32
- # Page compilation
33
- logger.info "Sitepress compiling pages"
34
- compiler.compile target_path: options.fetch("output_path")
35
40
  end
36
41
 
37
42
  desc "console", "Interactive project shell"
@@ -43,6 +48,10 @@ module Sitepress
43
48
 
44
49
  desc "new PATH", "Create new project at PATH"
45
50
  def new(target)
51
+ # Peg the generated site to roughly the released version.
52
+ *segments, _ = Gem::Version.new(Sitepress::VERSION).segments
53
+ @target_sitepress_version = segments.join(".")
54
+
46
55
  inside target do
47
56
  directory self.class.source_root, "."
48
57
  run "bundle install"
@@ -59,10 +68,6 @@ module Sitepress
59
68
  Sitepress.configuration
60
69
  end
61
70
 
62
- def compiler
63
- Compiler.new(site: configuration.site)
64
- end
65
-
66
71
  def sprockets_manifest(target_path: )
67
72
  target_path = Pathname.new(target_path)
68
73
  Sprockets::Manifest.new(rails.assets, target_path.join("assets/manifest.json")).tap do |manifest|
@@ -84,7 +89,15 @@ module Sitepress
84
89
 
85
90
  def initialize!
86
91
  require_relative "boot"
87
- Sitepress::Server.initialize!
92
+ app.initialize!
93
+ end
94
+
95
+ def controller
96
+ ::SiteController
97
+ end
98
+
99
+ def app
100
+ Sitepress::Server
88
101
  end
89
102
  end
90
103
  end
@@ -1,7 +1,7 @@
1
1
  source "https://rubygems.org"
2
2
 
3
3
  # Stand-alone Sitepress server and compiler.
4
- gem "sitepress"
4
+ gem "sitepress", "~> <%= @target_sitepress_version %>"
5
5
 
6
6
  # Server used for the Sitepress preview server.
7
7
  gem "webrick"
@@ -0,0 +1,73 @@
1
+ # Getting started
2
+
3
+ Welcome to your new Sitepress site! If you know Rails, you'll feel right at home in Sitepress because it's built on top of Rails. There's a few things you'll need to know to get around:
4
+
5
+ ## Starting the preview server
6
+
7
+ First thing you'll want to do is start the preview server:
8
+
9
+ ```sh
10
+ $ sitepress server
11
+ ```
12
+
13
+ Then open http://127.0.0.1:8080 and you'll see the welcome page.
14
+
15
+ ## Layouts
16
+
17
+ To specify a layout for a page, add a `layout` key to the pages frontmatter. For example, if I create the layout `tech-support`, I'd add the following frontmatter to the top of a page in `pages/support/router.html.md`:
18
+
19
+ ```md
20
+ ---
21
+ title: How to fix a router
22
+ layout: tech-support
23
+ ---
24
+
25
+ # How to fix a router
26
+
27
+ 1. Unplug the router.
28
+ 2. Plug in the router.
29
+ ```
30
+
31
+ Sitepress will look for the layout in the `layouts` folder from the `layout` key in the file's frontmatter.
32
+
33
+ Additionally, you may use the `render_layout` function in a page, or layout, to nest the layouts. For example, you could:
34
+
35
+ ```haml
36
+ ---
37
+ title: How to fix a scanner
38
+ ---
39
+ = render_layout "tech-support" do
40
+ %h1 How to fix a scanner
41
+
42
+ %ol
43
+ %li Unplug the scanner.
44
+ %li Plug in the scanner.
45
+ ```
46
+
47
+ The `render_layout` can be used to nest a layout within a layout, which is a very powerful way to compose content pages.
48
+
49
+ ## File locations
50
+
51
+ Like Rails, Sitepress organizes files in certain directories:
52
+
53
+ * `pages` - This is where you'll edit the content. All `erb`, `haml`, and `md` files will be rendered and all other files will be served up. Support for other templating languages should work if you add them to the Gemfile and they already work with Rails.
54
+
55
+ * `layouts` - Layouts for all pages may be found in this directory. Layouts are great for headers, footer, and other content that you'd otherwise be repeating across the files in `pages`.
56
+
57
+ * `helpers` - Complex view code that you don't want to live in `page` or `layouts` can be extracted into helpers and re-used throughout the website. These are just like Rails helpers.
58
+
59
+ * `assets` - If you want Sprockets to fingerprint and manage images, stylesheets, or scripts then put them in the `assets` directory.
60
+
61
+ * `config` - All configuration files and initializers belong in this directory. The `config/site.rb` file has settings that can be changed for the Sitepress site. Changes made to this file require the `sitepress server` to be restarted.
62
+
63
+ ## Compiling & publishing the website
64
+
65
+ Once you're satisfied with your website and you're ready to compile it into static HTML files, run `sitepress compile` and the website will be built to `./build`.
66
+
67
+ ## It's just Rails
68
+
69
+ Anything you can do in Rails, you can do in Sitepress. If you find yourself needing more Rails for Sitepress, you could try adding it to the `Gemfile` and integrating it into your website. You can also embed and integrate Sitepress into a full-blown Rails app and serve up the content without statically compiling it.
70
+
71
+ ## More info
72
+
73
+ Check out https://sitepress.cc for the latest and most up-to-date Sitepress documentation.
File without changes
@@ -3,13 +3,16 @@ title: Welcome to Sitepress
3
3
  ---
4
4
 
5
5
  <h3>Website files</h3>
6
- <p>All your website files are in <code><%= site.root_path.expand_path %></code>. If you've built stuff on Rails, you'll feel right at home because Sitepress was built on top of Rails.</p>
6
+ <p>All the website files are in <code><%= site.root_path.expand_path %></code>. If you've built stuff on <a href="https://rubyonrails.org">Rails</a>, you'll feel right at home because Sitepress is actually running on Rails.</p>
7
7
 
8
8
  <h3>Assets</h3>
9
- <p>There's an asset pipeline at <code><%= site.assets_path.expand_path %></code> where you can put all of your images, stylesheets, and JavaScripts, which will be compiled and fingerprinted for your deployment.</p>
9
+ <p>There's an asset pipeline at <code><%= site.assets_path.expand_path %></code> where you can put all of your images, stylesheets, and scripts, which will be compiled and fingerprinted for your deployment via Sprockets.</p>
10
10
 
11
11
  <h3>Compile</h3>
12
12
  <p>When you're ready to build the website, run <code>sitepress compile</code> and the website files and assets will all be built and compiled into the <code><%= site.root_path.join("build").expand_path %></code> path.</p>
13
13
 
14
+ <h3>Deploy</h3>
15
+ <p>An example Rakefile is included at <code><%= site.root_path.join("Rakefile").expand_path %></code> that deploys the build to an AWS S3 bucket. You can customize it to fit your needs or use a completely different deployment pipeline. Whatever floats your boat.</p>
16
+
14
17
  <h3>Documentation</h3>
15
18
  <p>Check out the <a href="https://sitepress.cc">Sitepress website</a> for help on getting started and documentation. Since Sitepress is also built on top of Rails, most of the <a href="https://guides.rubyonrails.org/action_view_helpers.html">Rails view helpers</a> work too.</p>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sitepress-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.beta3
4
+ version: 2.0.0.beta8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brad Gessler
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-24 00:00:00.000000000 Z
11
+ date: 2021-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sitepress-server
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.0.beta3
19
+ version: 2.0.0.beta8
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 2.0.0.beta3
26
+ version: 2.0.0.beta8
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: thor
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -66,7 +66,8 @@ files:
66
66
  - lib/sitepress/repl.rb
67
67
  - sitepress-cli.gemspec
68
68
  - templates/default/.gitignore
69
- - templates/default/Gemfile
69
+ - templates/default/Gemfile.tt
70
+ - templates/default/README.md
70
71
  - templates/default/Rakefile
71
72
  - templates/default/assets/config/manifest.js
72
73
  - templates/default/assets/images/logo-brown.svg
@@ -76,6 +77,7 @@ files:
76
77
  - templates/default/config/site.rb
77
78
  - templates/default/helpers/page_helper.rb
78
79
  - templates/default/layouts/layout.html.erb
80
+ - templates/default/pages/favicon.ico
79
81
  - templates/default/pages/index.html.erb
80
82
  homepage: https://github.com/sitepress/sitepress
81
83
  licenses: []
@@ -95,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
97
  - !ruby/object:Gem::Version
96
98
  version: 1.3.1
97
99
  requirements: []
98
- rubygems_version: 3.2.3
100
+ rubygems_version: 3.1.4
99
101
  signing_key:
100
102
  specification_version: 4
101
103
  summary: Sitepress command line interface and compilation tools for static site.