sitepress-cli 2.0.0.beta2 → 2.0.0.beta7

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: 7d93d966280bc5ea9c909ece7b952312515b2871488be52bb787aa094ca82abc
4
- data.tar.gz: 91b8f6423d15d5c7b7e3bfb58d87132207b906d821acc1ebdb8db91cec8c9190
3
+ metadata.gz: f7c2555bfa5a3aaeb17b33521a2583aeea366082c00ee011ffd216dc7f6fb848
4
+ data.tar.gz: ec9f1eddd9aebd824f17d788277c079cc01ec03eabb025fdcbe3ebcbd5595c4f
5
5
  SHA512:
6
- metadata.gz: b562eee6d252afd5c7e7f1e3efe64d6a7d9f35987443ff02d07ba5600376d599adf29bd29e8570c272615f9bb4336a08f63e0511a99a256e4ad4cd1cae24f832
7
- data.tar.gz: 80d01e38bb791983db26e1e8e92a7c6ffa4cd5c6a6543f46662ea442585077a55269c50fff32f6698a0df6a1a3a7494e28286ef5a86802e58782c3cae18a85a8
6
+ metadata.gz: d4635e94087861bf3d20512ec9d821c284ee92a79f35d1410ee6070b1f0bfae1e246d57ec89ebd698e539ccc00d96621dbc6664ce877bacf48782af634e1842d
7
+ data.tar.gz: 4fa9758a918aa4ec1f0f96e3507d9a68568030323d517104b2d26189a7209fda23c44a0dde11b3414df6f94203b82fdf328320e475124cdb656cebfa031e9d82
data/lib/sitepress/cli.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require "thor"
2
- require_relative "boot"
3
2
 
4
3
  module Sitepress
5
4
  # Command line interface for compiling Sitepress sites.
@@ -16,7 +15,7 @@ module Sitepress
16
15
  option :port, default: SERVER_DEFAULT_PORT, aliases: :p, type: :numeric
17
16
  desc "server", "Run preview server"
18
17
  def server
19
- Sitepress::Server.initialize!
18
+ initialize!
20
19
  # This will use whatever server is found in the user's Gemfile.
21
20
  Rack::Server.start app: Sitepress::Server,
22
21
  Port: options.fetch("port"),
@@ -26,7 +25,7 @@ module Sitepress
26
25
  option :output_path, default: COMPILE_DEFAULT_TARGET_PATH, type: :string
27
26
  desc "compile", "Compile project into static pages"
28
27
  def compile
29
- Sitepress::Server.initialize!
28
+ initialize!
30
29
  # Sprockets compilation
31
30
  logger.info "Sitepress compiling assets"
32
31
  sprockets_manifest(target_path: options.fetch("output_path")).compile precompile_assets
@@ -37,13 +36,17 @@ module Sitepress
37
36
 
38
37
  desc "console", "Interactive project shell"
39
38
  def console
40
- Sitepress::Server.initialize!
39
+ initialize!
41
40
  # Start's an interactive console.
42
41
  REPL.new(context: configuration).start
43
42
  end
44
43
 
45
44
  desc "new PATH", "Create new project at PATH"
46
45
  def new(target)
46
+ # Peg the generated site to roughly the released version.
47
+ *segments, _ = Gem::Version.new(Sitepress::VERSION).segments
48
+ @target_sitepress_version = segments.join(".")
49
+
47
50
  inside target do
48
51
  directory self.class.source_root, "."
49
52
  run "bundle install"
@@ -52,7 +55,7 @@ module Sitepress
52
55
 
53
56
  desc "version", "Show version"
54
57
  def version
55
- say "Sitepress #{Sitepress::VERSION}"
58
+ say Sitepress::VERSION
56
59
  end
57
60
 
58
61
  private
@@ -82,5 +85,10 @@ module Sitepress
82
85
  def precompile_assets
83
86
  rails.config.assets.precompile
84
87
  end
88
+
89
+ def initialize!
90
+ require_relative "boot"
91
+ Sitepress::Server.initialize!
92
+ end
85
93
  end
86
94
  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.
@@ -1,7 +1,5 @@
1
1
  ## Example deployment script to an Amazon Web Servie S3 bucket.
2
-
3
- # Change the s3_url to whatever bucket you'd like to deploy to.
4
- s3_url = "s3://<insert-your-s3-bucket-here>/"
2
+ s3_bucket_name = "<replace-with-your-bucket-name>"
5
3
 
6
4
  desc "Remove all files from the build directory"
7
5
  task :clean do
@@ -16,12 +14,12 @@ end
16
14
  namespace :publish do
17
15
  desc "Upload ./build/assets to S3 with cache-control headers optimized for assets"
18
16
  task :assets do
19
- sh "aws s3 sync ./build/assets #{s3_url} --cache-control max-age=31536000"
17
+ sh "aws s3 sync ./build/assets s3://#{s3_bucket_name}/assets --cache-control max-age=31536000"
20
18
  end
21
19
 
22
20
  desc "Upload ./build to S3"
23
21
  task :pages do
24
- sh "aws s3 sync ./build #{s3_url} --exclude 'assets/**' --cache-control max-age=60"
22
+ sh "aws s3 sync ./build s3://#{s3_bucket_name} --exclude 'assets/**' --cache-control max-age=60"
25
23
  end
26
24
  end
27
25
 
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.beta2
4
+ version: 2.0.0.beta7
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-23 00:00:00.000000000 Z
11
+ date: 2021-03-15 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.beta2
19
+ version: 2.0.0.beta7
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.beta2
26
+ version: 2.0.0.beta7
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.