sitepress-cli 1.0.1 → 2.0.0.beta5

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: ce35e6b81f006e0cc9fb4abc40afe2d87525003fbf21f7730c8d96003fb644c8
4
- data.tar.gz: 4075e16fdaa1eb8071da33bd8e082c3a8f5f151c00be0587ebed8c7760274a0d
3
+ metadata.gz: 3bd20de438037956871dea76b30e2a3be15e4c73a5235e404e851a526cbec56e
4
+ data.tar.gz: 4547457f7f21beeacd0950d4fda1fc0c77a3fe592bdd56f24aee6247a1ac61fe
5
5
  SHA512:
6
- metadata.gz: aa5b67f4325403fc72fbf7b07348b46e4a1d7ca43fbf38e2d5bd2ea617d03acec3b688e347e5d8af022028ecf252cc519a7b72ebde758b0508125ae229a8b968
7
- data.tar.gz: 37582ee0f4f906ead328d0c2e72ebb43b8645beb145e94d224dc8dc6a482de8309b8368adbb03e5c6e39e396bcef95c576965efa9069cab2d3bd1b4ed9d9a57a
6
+ metadata.gz: 21536f6bac9617b1978ecfd8e3c2eb5a99979c0fe63715b9438a61307e6982ca7c8e3b1f41372a91ffbe6bfca36e5a035680087a019ff644b206ae6999e75d53
7
+ data.tar.gz: bc54f1e7e4456b04738b6116216f3a54da5a4d49b88bed1d2a1ad311523975344a57fbe28666df27497f2f2182b9da7c66170bb489c02cc03e182451be5b430d
data/lib/sitepress-cli.rb CHANGED
@@ -2,9 +2,6 @@ require "sitepress-core"
2
2
 
3
3
  module Sitepress
4
4
  autoload :CLI, "sitepress/cli"
5
- autoload :Compiler, "sitepress/compiler"
6
- autoload :PreviewServer, "sitepress/preview_server"
7
- autoload :Project, "sitepress/project"
8
5
  autoload :ProjectTemplate, "sitepress/project_template"
9
6
  autoload :REPL, "sitepress/repl"
10
7
  end
@@ -0,0 +1,12 @@
1
+ ENV['BUNDLE_GEMFILE'] ||= 'Gemfile'
2
+
3
+ require "bundler/setup" # Set up gems listed in the Gemfile.
4
+ require "sitepress/server" # Load all the stuff needed setup the configuration below.
5
+
6
+ # Setup defaults for stand-alone Sitepress server in the current path. This
7
+ # can, and should, be over-ridden by the end-user in the `config/site.rb` file.
8
+ Sitepress.configure do |config|
9
+ config.routes = false
10
+ config.site = Sitepress::Site.new root_path: "."
11
+ end
12
+
data/lib/sitepress/cli.rb CHANGED
@@ -1,37 +1,52 @@
1
1
  require "thor"
2
- require "sitepress-server"
3
2
 
4
3
  module Sitepress
5
4
  # Command line interface for compiling Sitepress sites.
6
5
  class CLI < Thor
6
+ SERVER_DEFAULT_PORT = 8080
7
+ SERVER_DEFAULT_BIND_ADDRESS = "0.0.0.0".freeze
8
+ COMPILE_DEFAULT_TARGET_PATH = "./build".freeze
9
+
7
10
  include Thor::Actions
8
11
 
9
12
  source_root File.expand_path("../../../templates/default", __FILE__)
10
13
 
11
- option :config_file, default: Project::DEFAULT_CONFIG_FILE, aliases: :c
12
- option :bind_address, default: PreviewServer::DEFAULT_BIND_ADDRESS, aliases: :a
13
- option :port, default: PreviewServer::DEFAULT_PORT, aliases: :p, type: :numeric
14
+ option :bind_address, default: SERVER_DEFAULT_BIND_ADDRESS, aliases: :a
15
+ option :port, default: SERVER_DEFAULT_PORT, aliases: :p, type: :numeric
14
16
  desc "server", "Run preview server"
15
17
  def server
16
- PreviewServer.new(project: project).run port: options.fetch("port"),
17
- bind_address: options.fetch("bind_address")
18
+ initialize!
19
+ # This will use whatever server is found in the user's Gemfile.
20
+ Rack::Server.start app: Sitepress::Server,
21
+ Port: options.fetch("port"),
22
+ Host: options.fetch("bind_address")
18
23
  end
19
24
 
20
- option :config_file, default: Project::DEFAULT_CONFIG_FILE, aliases: :c
21
- option :output_path, default: "./build"
25
+ option :output_path, default: COMPILE_DEFAULT_TARGET_PATH, type: :string
22
26
  desc "compile", "Compile project into static pages"
23
27
  def compile
24
- project.compiler.compile target_path: options.fetch("output_path")
28
+ initialize!
29
+ # Sprockets compilation
30
+ logger.info "Sitepress compiling assets"
31
+ 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")
25
35
  end
26
36
 
27
- option :config_file, default: Project::DEFAULT_CONFIG_FILE, aliases: :c
28
37
  desc "console", "Interactive project shell"
29
38
  def console
30
- REPL.new(context: project).start
39
+ initialize!
40
+ # Start's an interactive console.
41
+ REPL.new(context: configuration).start
31
42
  end
32
43
 
33
44
  desc "new PATH", "Create new project at PATH"
34
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
+
35
50
  inside target do
36
51
  directory self.class.source_root, "."
37
52
  run "bundle install"
@@ -40,12 +55,40 @@ module Sitepress
40
55
 
41
56
  desc "version", "Show version"
42
57
  def version
43
- say "Sitepress #{Sitepress::VERSION}"
58
+ say Sitepress::VERSION
44
59
  end
45
60
 
46
61
  private
47
- def project
48
- @_project ||= Sitepress::Project.new config_file: options.fetch("config_file")
62
+ def configuration
63
+ Sitepress.configuration
64
+ end
65
+
66
+ def compiler
67
+ Compiler.new(site: configuration.site)
68
+ end
69
+
70
+ def sprockets_manifest(target_path: )
71
+ target_path = Pathname.new(target_path)
72
+ Sprockets::Manifest.new(rails.assets, target_path.join("assets/manifest.json")).tap do |manifest|
73
+ manifest.environment.logger = logger
74
+ end
75
+ end
76
+
77
+ def rails
78
+ configuration.parent_engine
79
+ end
80
+
81
+ def logger
82
+ rails.config.logger
83
+ end
84
+
85
+ def precompile_assets
86
+ rails.config.assets.precompile
87
+ end
88
+
89
+ def initialize!
90
+ require_relative "boot"
91
+ Sitepress::Server.initialize!
49
92
  end
50
93
  end
51
94
  end
@@ -11,6 +11,7 @@ module Sitepress
11
11
  def start
12
12
  IRB.setup nil
13
13
  IRB.conf[:MAIN_CONTEXT] = IRB::Irb.new.context
14
+ IRB.conf[:PROMPT_MODE] = :SIMPLE
14
15
  require 'irb/ext/multi-irb'
15
16
  IRB.irb nil, @context
16
17
  end
@@ -18,6 +18,6 @@ Gem::Specification.new do |spec|
18
18
  spec.require_paths = ["lib"]
19
19
 
20
20
  spec.add_runtime_dependency "sitepress-server", spec.version
21
- spec.add_runtime_dependency "thor", "~> 0.20.0"
22
- spec.add_runtime_dependency "rack", ">= 1.0"
21
+ spec.add_runtime_dependency "thor", ">= 1.0.0"
22
+ spec.add_runtime_dependency "rack", ">= 1.0.0"
23
23
  end
@@ -0,0 +1,13 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Stand-alone Sitepress server and compiler.
4
+ gem "sitepress", "~> <%= @target_sitepress_version %>"
5
+
6
+ # Server used for the Sitepress preview server.
7
+ gem "webrick"
8
+
9
+ # Templating engines. Under the hood Sitepress uses a slimmed
10
+ # down Rails, so rails templating engines should mostly work.
11
+ gem "haml-rails"
12
+ gem "sass-rails"
13
+ gem "markdown-rails"
@@ -0,0 +1,29 @@
1
+ ## Example deployment script to an Amazon Web Servie S3 bucket.
2
+ s3_bucket_name = "<replace-with-your-bucket-name>"
3
+
4
+ desc "Remove all files from the build directory"
5
+ task :clean do
6
+ sh 'rm -rf ./build'
7
+ end
8
+
9
+ desc "Compile the sitepress site"
10
+ task :compile do
11
+ sh 'bundle exec sitepress compile'
12
+ end
13
+
14
+ namespace :publish do
15
+ desc "Upload ./build/assets to S3 with cache-control headers optimized for assets"
16
+ task :assets do
17
+ sh "aws s3 sync ./build/assets s3://#{s3_bucket_name}/assets --cache-control max-age=31536000"
18
+ end
19
+
20
+ desc "Upload ./build to S3"
21
+ task :pages do
22
+ sh "aws s3 sync ./build s3://#{s3_bucket_name} --exclude 'assets/**' --cache-control max-age=60"
23
+ end
24
+ end
25
+
26
+ desc "Upload pages and assets to S3"
27
+ task publish: %w[publish:assets publish:pages]
28
+
29
+ task default: %w[clean compile publish]
@@ -0,0 +1,3 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../stylesheets .css
3
+ //= link_directory ../javascripts .js
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="895px" height="895px" viewBox="0 0 895 895" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+ <title>Sitepress logo</title>
4
+ <desc>A static and dynamic website builder</desc>
5
+ <defs></defs>
6
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
7
+ <g id="logo" fill="#573D2B">
8
+ <path d="M334.72,537.93 C325.82,530.6 313.41,526.88 297.83,526.88 L254.05,526.88 L254.05,618.4 L297.84,618.4 C313.41,618.4 325.84,614.63 334.72,607.2 C343.6,599.77 348.01,588.2 348.01,572.49 C348.01,556.78 343.54,545.2 334.72,537.93 L334.72,537.93 Z" id="Shape"></path>
9
+ <path d="M859.29,274.59 C770.211759,62.9463102 535.248488,-46.7589164 315.795351,20.8303235 C96.3422149,88.4195635 -36.1856795,311.308174 9.24445457,536.395018 C54.6745886,761.481862 263.278739,915.518494 491.767697,892.697877 C720.256655,869.87726 894.274848,677.625748 894.29,448 C894.373576,388.434111 882.470683,329.460375 859.29,274.59 L859.29,274.59 Z M573.53,155.3 C573.53,150.7 576.17,148.06 580.77,148.06 L684.32,148.06 C688.73,148.06 691.27,150.59 691.27,155.01 C691.27,159.79 688.74,162.54 684.32,162.54 L588,162.54 L588,249 L632.54,249 C636.95,249 639.48,251.74 639.48,256.53 C639.48,260.94 636.95,263.48 632.54,263.48 L588,263.48 L588,350.23 L684.32,350.23 C688.73,350.23 691.27,352.97 691.27,357.76 C691.27,362.17 688.74,364.71 684.32,364.71 L580.77,364.71 C576.17,364.71 573.53,362.07 573.53,357.47 L573.53,155.3 Z M401.53,89.3 C402.779293,87.9227726 404.571684,87.1655789 406.43,87.23 L553.75,87.23 C558.27,87.23 560.53,89.3666667 560.53,93.64 C560.53,98.4133333 558.27,100.8 553.75,100.8 L487.06,100.8 L487.06,355.91 C487.06,360.43 484.8,362.69 480.28,362.69 C475.76,362.69 473.5,360.43 473.5,355.91 L473.5,100.83 L406.43,100.83 C404.571176,100.897181 402.777669,100.139516 401.53,98.76 C399.018254,96.1222984 399.018254,91.9777016 401.53,89.34 L401.53,89.3 Z M361.08,93.63 C361.08,89.3633333 363.34,87.2266667 367.86,87.22 C372.38,87.2133333 374.64,89.35 374.64,93.63 L374.64,355.91 C374.64,360.43 372.38,362.69 367.86,362.69 C363.34,362.69 361.08,360.43 361.08,355.91 L361.08,93.63 Z M208.57,329.63 C210.15,327.79 211.7,326.89 213.29,326.89 C214.88,326.89 216.79,328.24 219.49,331.55 C221.62,334.16 224.09,337.02 226.84,340.05 C229.42,342.91 233.97,345.62 240.34,348.11 C247.586888,350.800137 255.270834,352.119225 263,352 C278.29,352 290,348.13 297.82,340.5 C305.64,332.87 309.58,321.57 309.58,306.88 C309.58,297.17 307.85,288.88 304.43,282.35 C301.410563,276.249269 296.784618,271.087433 291.05,267.42 C285.097567,263.784066 278.78788,260.768283 272.22,258.42 L251.58,251.15 C244.726443,248.889218 238.156396,245.84579 232,242.08 C225.705868,238.108684 220.588935,232.525633 217.18,225.91 C213.45,218.97 211.56,210.38 211.56,200.39 C211.56,190.23 213.44,181.39 217.16,174.03 C220.484889,167.084479 225.841413,161.312965 232.52,157.48 C238.378086,154.162981 244.677689,151.694992 251.23,150.15 C257.679927,148.734499 264.266659,148.036922 270.87,148.07 C281.863142,147.943398 292.800246,149.653588 303.23,153.13 C313.87,156.83 318.83,160.66 318.83,165.2 C318.754645,167.219913 317.98465,169.151963 316.65,170.67 C315.09,172.62 313.39,173.6 311.6,173.6 C310.78,173.6 309.49,173.37 304.51,170.6 C300.133975,168.352176 295.540237,166.556229 290.8,165.24 C284.225834,163.369844 277.414361,162.467037 270.58,162.56 C263.351008,162.469822 256.146813,163.422972 249.19,165.39 C243.12,167.2 237.67,171.04 233.01,176.8 C228.35,182.56 226.01,190.16 226.01,199.54 C226.01,207.46 227.72,214.2 231.09,219.54 C234.303387,224.772292 238.912858,229.004278 244.4,231.76 C250.482431,234.769407 256.763789,237.358797 263.2,239.51 C270.06,241.83 277.09,244.44 284.1,247.26 C291.011648,250.019216 297.587203,253.555254 303.7,257.8 C309.78,262.06 314.76,268.35 318.48,276.5 C322.2,284.65 324.04,294.5 324.04,305.98 C324.04,326.24 318.59,341.56 307.84,351.52 C297.09,361.48 282.53,366.45 264.45,366.45 C256.023647,366.517248 247.635543,365.310279 239.57,362.87 C231.93,360.49 225.72,357.61 221.11,354.3 C217.052927,351.515289 213.430344,348.145445 210.36,344.3 C207.64,340.72 206.36,337.7 206.36,335.09 C206.41612,333.079377 207.205725,331.158715 208.58,329.69 L208.57,329.63 Z M128.83,453.11 L296.96,413.11 C299.21742,412.571572 301.590658,413.277552 303.186737,414.962302 C304.782816,416.647052 305.359576,419.054959 304.7,421.28 L296,450.51 L453.2,413.11 C455.45742,412.571572 457.830658,413.277552 459.426737,414.962302 C461.022816,416.647052 461.599576,419.054959 460.94,421.28 L452.27,450.51 L609.47,413.11 C611.72742,412.571572 614.100658,413.277552 615.696737,414.962302 C617.292816,416.647052 617.869576,419.054959 617.21,421.28 L608.54,450.51 L765.74,413.11 C767.999705,412.574102 770.373657,413.284449 771.967611,414.973462 C773.561565,416.662475 774.133361,419.073551 773.467611,421.298462 C772.80186,423.523373 770.999705,425.224102 768.74,425.76 L600.61,465.76 C598.35258,466.298428 595.979342,465.592448 594.383263,463.907698 C592.787184,462.222948 592.210424,459.815041 592.87,457.59 L601.54,428.36 L444.34,465.76 C442.08258,466.298428 439.709342,465.592448 438.113263,463.907698 C436.517184,462.222948 435.940424,459.815041 436.6,457.59 L445.27,428.36 L288.07,465.76 C285.81258,466.298428 283.439342,465.592448 281.843263,463.907698 C280.247184,462.222948 279.670424,459.815041 280.33,457.59 L289,428.36 L131.8,465.76 C131.305299,465.878067 130.798593,465.93847 130.29,465.94 C126.983263,465.951866 124.194638,463.479226 123.810649,460.194838 C123.426659,456.910451 125.569705,453.861232 128.79,453.11 L128.83,453.11 Z M219.36,568.38 C219.36,586.66 214.64,600.38 205.36,609.03 C196.08,617.68 183.68,622.03 168.41,622.03 L131.51,622.03 L131.51,690.84 C131.51,695.17 128.92,697.76 124.59,697.76 C120.26,697.76 117.67,695.17 117.67,690.84 L117.67,518.64 C117.67,516.86 118.32,512.64 124.31,511.98 L124.58,511.98 L168.38,511.98 C183.63,511.98 196.06,516.32 205.32,524.89 C214.58,533.46 219.32,547.14 219.32,565.43 L219.36,568.38 Z M360.87,727.12 C361.533457,728.352283 361.903078,729.721252 361.95,731.12 C362.033205,733.000791 361.322464,734.830022 359.991243,736.161243 C358.660022,737.492464 356.830791,738.203205 354.95,738.12 C353.896221,738.11813 352.861519,737.838761 351.95,737.31 C350.899467,736.658391 350.007755,735.780345 349.34,734.74 C348.62,733.74 348.06,732.9 347.65,732.28 L347.49,731.96 L346.31,728.7 C345.91,727.92 345.65,727.45 345.49,727.17 L345.26,727.17 L344.84,726.35 L296.63,632.35 L254.05,632.35 L254.05,731.15 C254.05,735.65 251.57,738.15 247.05,738.15 C242.53,738.15 240.05,735.67 240.05,731.15 L240.05,519.6 C240.05,517.4 240.93,513.6 246.86,512.94 L297.78,512.94 C316.68,512.94 332.23,517.65 344,526.94 C355.77,536.23 361.89,551.64 361.89,572.49 C361.89,606.93 344.98,626.76 311.64,631.49 L360.87,727.12 Z M459,644.64 C463.246667,644.64 465.373333,647.016667 465.38,651.77 C465.38,656.023333 463.253333,658.15 459,658.15 L399,658.15 L399,775.22 L525.79,775.22 C530.043333,775.22 532.17,777.596667 532.17,782.35 C532.17,786.603333 530.043333,788.73 525.79,788.73 L392.2,788.73 C387.7,788.73 385.45,786.48 385.45,781.98 L385.45,521.19 C385.45,516.69 387.7,514.44 392.2,514.44 L525.79,514.44 C530.043333,514.44 532.17,516.566667 532.17,520.82 C532.17,525.573333 530.043333,527.95 525.79,527.95 L399,527.95 L399,644.65 L459,644.64 Z M643.77,724.49 C632.69,734.74 617.57,739.93 598.83,739.93 C590.082311,740.000953 581.374084,738.750178 573,736.22 C565.08,733.75 558.65,730.76 553.88,727.34 C549.685777,724.461626 545.941701,720.977041 542.77,717 C540.01,713.36 538.67,710.33 538.67,707.74 C538.734283,705.789092 539.509619,703.928997 540.85,702.51 C542.39,700.72 543.85,699.86 545.33,699.86 C546.81,699.86 548.69,701.25 551.33,704.51 C553.57,707.26 556.16,710.26 559.03,713.42 C561.9,716.58 566.61,719.36 573.36,722 C580.11,724.64 588.19,726 597.28,726 C613.41,726 625.79,721.9 634.07,713.81 C642.35,705.72 646.53,693.81 646.53,678.26 C646.53,668.02 644.7,659.26 641.08,652.36 C637.874282,645.8902 632.964805,640.41717 626.88,636.53 C620.626732,632.715387 613.998721,629.552171 607.1,627.09 L585.53,619.5 C578.407687,617.155538 571.579303,613.998039 565.18,610.09 C558.689278,605.99337 553.413379,600.234076 549.9,593.41 C546.05,586.24 544.1,577.36 544.1,567.02 C544.1,556.49 546.05,547.32 549.88,539.75 C553.71,532.18 559.06,526.39 565.69,522.75 C571.760835,519.311259 578.289388,516.752362 585.08,515.15 C591.7762,513.680181 598.61447,512.955774 605.47,512.99 C616.890766,512.856493 628.25367,514.630891 639.09,518.24 C650,522 655,525.78 655,530.24 C654.916423,532.213781 654.157409,534.098961 652.85,535.58 C651.34,537.47 649.72,538.42 648.03,538.42 C647.19,538.42 645.75,538.05 640.91,535.34 C636.30085,532.971571 631.462578,531.07848 626.47,529.69 C619.544449,527.721432 612.369222,526.771473 605.17,526.87 C597.558092,526.781289 589.97323,527.791706 582.65,529.87 C576.19,531.8 570.4,535.87 565.46,541.99 C560.52,548.11 558.04,556.19 558.04,566.12 C558.04,574.52 559.85,581.66 563.43,587.36 C566.838785,592.927174 571.736573,597.43009 577.57,600.36 C583.94981,603.517486 590.538592,606.233855 597.29,608.49 C604.46,610.91 611.79,613.63 619.1,616.57 C626.282202,619.451958 633.112871,623.142398 639.46,627.57 C645.73,631.96 650.86,638.45 654.71,646.87 C658.56,655.29 660.47,665.52 660.47,677.43 C660.51,698.35 654.87,714.21 643.76,724.49 L643.77,724.49 Z M765.92,686.38 C756.67,694.94 744.07,699.29 728.49,699.29 C721.242168,699.348298 714.027215,698.309885 707.09,696.21 C701.428334,694.592844 696.056089,692.095694 691.17,688.81 C687.654637,686.392813 684.517177,683.467661 681.86,680.13 C679.44,676.94 678.27,674.23 678.27,671.84 C678.322752,669.953085 679.062359,668.150293 680.35,666.77 C681.85,665.02 683.35,664.18 684.94,664.18 C686.53,664.18 688.35,665.41 690.81,668.43 C692.62,670.65 694.71,673.07 697.04,675.63 C699.16,677.97 702.92,680.21 708.24,682.29 C714.32226,684.514605 720.764973,685.589521 727.24,685.46 C740.04,685.46 749.82,682.24 756.33,675.89 C762.84,669.54 766.1,660.12 766.1,647.83 C766.1,639.7 764.65,632.83 761.8,627.32 C759.297736,622.247998 755.460166,617.95407 750.7,614.9 C745.678978,611.841159 740.357883,609.304592 734.82,607.33 L717.27,601.15 C711.38642,599.215288 705.745772,596.608041 700.46,593.38 C694.996887,589.94318 690.550437,585.110082 687.58,579.38 C684.35,573.38 682.71,565.93 682.71,557.3 C682.71,548.67 684.34,540.87 687.55,534.53 C690.448442,528.485526 695.11436,523.46391 700.93,520.13 C705.977623,517.274361 711.405115,515.149827 717.05,513.82 C722.592378,512.592976 728.253448,511.9826 733.93,512 C743.367043,511.889982 752.756198,513.356827 761.71,516.34 C771.11,519.61 775.49,523.1 775.49,527.34 C775.433713,529.229237 774.727297,531.041195 773.49,532.47 C772.02,534.31 770.37,535.25 768.6,535.25 C767.77,535.25 766.6,535.04 762.2,532.58 C758.525602,530.696709 754.669063,529.19229 750.69,528.09 C745.162798,526.517786 739.435902,525.759815 733.69,525.84 C727.607224,525.759866 721.544725,526.558095 715.69,528.21 C710.365486,529.922249 705.692777,533.223505 702.3,537.67 C698.48,542.39 696.54,548.74 696.54,556.53 C696.54,563.13 697.95,568.72 700.74,573.16 C703.393404,577.491303 707.202977,580.996109 711.74,583.28 C716.884382,585.823473 722.196793,588.011919 727.64,589.83 C733.5,591.83 739.5,594.04 745.46,596.44 C751.395098,598.808559 757.041415,601.844754 762.29,605.49 C767.58,609.19 771.89,614.65 775.12,621.7 C778.35,628.75 779.92,637.22 779.92,647.1 C779.95,664.54 775.23,677.76 765.92,686.38 L765.92,686.38 Z" id="Shape"></path>
10
+ <path d="M168.39,525.81 L131.51,525.81 L131.51,608.24 L168.39,608.24 C180.34,608.24 189.61,604.91 195.94,598.35 C202.27,591.79 205.52,581.68 205.52,568.35 L205.52,565.35 C205.52,552.06 202.3,542.03 195.95,535.52 C189.6,529.01 180.34,525.81 168.39,525.81 L168.39,525.81 Z" id="Shape"></path>
11
+ </g>
12
+ </g>
13
+ </svg>
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="895px" height="895px" viewBox="0 0 895 895" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+ <title>Sitepress logo</title>
4
+ <desc>A static and dynamic website builder</desc>
5
+ <defs></defs>
6
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
7
+ <g id="logo" fill="#ffffff">
8
+ <path d="M334.72,537.93 C325.82,530.6 313.41,526.88 297.83,526.88 L254.05,526.88 L254.05,618.4 L297.84,618.4 C313.41,618.4 325.84,614.63 334.72,607.2 C343.6,599.77 348.01,588.2 348.01,572.49 C348.01,556.78 343.54,545.2 334.72,537.93 L334.72,537.93 Z" id="Shape"></path>
9
+ <path d="M859.29,274.59 C770.211759,62.9463102 535.248488,-46.7589164 315.795351,20.8303235 C96.3422149,88.4195635 -36.1856795,311.308174 9.24445457,536.395018 C54.6745886,761.481862 263.278739,915.518494 491.767697,892.697877 C720.256655,869.87726 894.274848,677.625748 894.29,448 C894.373576,388.434111 882.470683,329.460375 859.29,274.59 L859.29,274.59 Z M573.53,155.3 C573.53,150.7 576.17,148.06 580.77,148.06 L684.32,148.06 C688.73,148.06 691.27,150.59 691.27,155.01 C691.27,159.79 688.74,162.54 684.32,162.54 L588,162.54 L588,249 L632.54,249 C636.95,249 639.48,251.74 639.48,256.53 C639.48,260.94 636.95,263.48 632.54,263.48 L588,263.48 L588,350.23 L684.32,350.23 C688.73,350.23 691.27,352.97 691.27,357.76 C691.27,362.17 688.74,364.71 684.32,364.71 L580.77,364.71 C576.17,364.71 573.53,362.07 573.53,357.47 L573.53,155.3 Z M401.53,89.3 C402.779293,87.9227726 404.571684,87.1655789 406.43,87.23 L553.75,87.23 C558.27,87.23 560.53,89.3666667 560.53,93.64 C560.53,98.4133333 558.27,100.8 553.75,100.8 L487.06,100.8 L487.06,355.91 C487.06,360.43 484.8,362.69 480.28,362.69 C475.76,362.69 473.5,360.43 473.5,355.91 L473.5,100.83 L406.43,100.83 C404.571176,100.897181 402.777669,100.139516 401.53,98.76 C399.018254,96.1222984 399.018254,91.9777016 401.53,89.34 L401.53,89.3 Z M361.08,93.63 C361.08,89.3633333 363.34,87.2266667 367.86,87.22 C372.38,87.2133333 374.64,89.35 374.64,93.63 L374.64,355.91 C374.64,360.43 372.38,362.69 367.86,362.69 C363.34,362.69 361.08,360.43 361.08,355.91 L361.08,93.63 Z M208.57,329.63 C210.15,327.79 211.7,326.89 213.29,326.89 C214.88,326.89 216.79,328.24 219.49,331.55 C221.62,334.16 224.09,337.02 226.84,340.05 C229.42,342.91 233.97,345.62 240.34,348.11 C247.586888,350.800137 255.270834,352.119225 263,352 C278.29,352 290,348.13 297.82,340.5 C305.64,332.87 309.58,321.57 309.58,306.88 C309.58,297.17 307.85,288.88 304.43,282.35 C301.410563,276.249269 296.784618,271.087433 291.05,267.42 C285.097567,263.784066 278.78788,260.768283 272.22,258.42 L251.58,251.15 C244.726443,248.889218 238.156396,245.84579 232,242.08 C225.705868,238.108684 220.588935,232.525633 217.18,225.91 C213.45,218.97 211.56,210.38 211.56,200.39 C211.56,190.23 213.44,181.39 217.16,174.03 C220.484889,167.084479 225.841413,161.312965 232.52,157.48 C238.378086,154.162981 244.677689,151.694992 251.23,150.15 C257.679927,148.734499 264.266659,148.036922 270.87,148.07 C281.863142,147.943398 292.800246,149.653588 303.23,153.13 C313.87,156.83 318.83,160.66 318.83,165.2 C318.754645,167.219913 317.98465,169.151963 316.65,170.67 C315.09,172.62 313.39,173.6 311.6,173.6 C310.78,173.6 309.49,173.37 304.51,170.6 C300.133975,168.352176 295.540237,166.556229 290.8,165.24 C284.225834,163.369844 277.414361,162.467037 270.58,162.56 C263.351008,162.469822 256.146813,163.422972 249.19,165.39 C243.12,167.2 237.67,171.04 233.01,176.8 C228.35,182.56 226.01,190.16 226.01,199.54 C226.01,207.46 227.72,214.2 231.09,219.54 C234.303387,224.772292 238.912858,229.004278 244.4,231.76 C250.482431,234.769407 256.763789,237.358797 263.2,239.51 C270.06,241.83 277.09,244.44 284.1,247.26 C291.011648,250.019216 297.587203,253.555254 303.7,257.8 C309.78,262.06 314.76,268.35 318.48,276.5 C322.2,284.65 324.04,294.5 324.04,305.98 C324.04,326.24 318.59,341.56 307.84,351.52 C297.09,361.48 282.53,366.45 264.45,366.45 C256.023647,366.517248 247.635543,365.310279 239.57,362.87 C231.93,360.49 225.72,357.61 221.11,354.3 C217.052927,351.515289 213.430344,348.145445 210.36,344.3 C207.64,340.72 206.36,337.7 206.36,335.09 C206.41612,333.079377 207.205725,331.158715 208.58,329.69 L208.57,329.63 Z M128.83,453.11 L296.96,413.11 C299.21742,412.571572 301.590658,413.277552 303.186737,414.962302 C304.782816,416.647052 305.359576,419.054959 304.7,421.28 L296,450.51 L453.2,413.11 C455.45742,412.571572 457.830658,413.277552 459.426737,414.962302 C461.022816,416.647052 461.599576,419.054959 460.94,421.28 L452.27,450.51 L609.47,413.11 C611.72742,412.571572 614.100658,413.277552 615.696737,414.962302 C617.292816,416.647052 617.869576,419.054959 617.21,421.28 L608.54,450.51 L765.74,413.11 C767.999705,412.574102 770.373657,413.284449 771.967611,414.973462 C773.561565,416.662475 774.133361,419.073551 773.467611,421.298462 C772.80186,423.523373 770.999705,425.224102 768.74,425.76 L600.61,465.76 C598.35258,466.298428 595.979342,465.592448 594.383263,463.907698 C592.787184,462.222948 592.210424,459.815041 592.87,457.59 L601.54,428.36 L444.34,465.76 C442.08258,466.298428 439.709342,465.592448 438.113263,463.907698 C436.517184,462.222948 435.940424,459.815041 436.6,457.59 L445.27,428.36 L288.07,465.76 C285.81258,466.298428 283.439342,465.592448 281.843263,463.907698 C280.247184,462.222948 279.670424,459.815041 280.33,457.59 L289,428.36 L131.8,465.76 C131.305299,465.878067 130.798593,465.93847 130.29,465.94 C126.983263,465.951866 124.194638,463.479226 123.810649,460.194838 C123.426659,456.910451 125.569705,453.861232 128.79,453.11 L128.83,453.11 Z M219.36,568.38 C219.36,586.66 214.64,600.38 205.36,609.03 C196.08,617.68 183.68,622.03 168.41,622.03 L131.51,622.03 L131.51,690.84 C131.51,695.17 128.92,697.76 124.59,697.76 C120.26,697.76 117.67,695.17 117.67,690.84 L117.67,518.64 C117.67,516.86 118.32,512.64 124.31,511.98 L124.58,511.98 L168.38,511.98 C183.63,511.98 196.06,516.32 205.32,524.89 C214.58,533.46 219.32,547.14 219.32,565.43 L219.36,568.38 Z M360.87,727.12 C361.533457,728.352283 361.903078,729.721252 361.95,731.12 C362.033205,733.000791 361.322464,734.830022 359.991243,736.161243 C358.660022,737.492464 356.830791,738.203205 354.95,738.12 C353.896221,738.11813 352.861519,737.838761 351.95,737.31 C350.899467,736.658391 350.007755,735.780345 349.34,734.74 C348.62,733.74 348.06,732.9 347.65,732.28 L347.49,731.96 L346.31,728.7 C345.91,727.92 345.65,727.45 345.49,727.17 L345.26,727.17 L344.84,726.35 L296.63,632.35 L254.05,632.35 L254.05,731.15 C254.05,735.65 251.57,738.15 247.05,738.15 C242.53,738.15 240.05,735.67 240.05,731.15 L240.05,519.6 C240.05,517.4 240.93,513.6 246.86,512.94 L297.78,512.94 C316.68,512.94 332.23,517.65 344,526.94 C355.77,536.23 361.89,551.64 361.89,572.49 C361.89,606.93 344.98,626.76 311.64,631.49 L360.87,727.12 Z M459,644.64 C463.246667,644.64 465.373333,647.016667 465.38,651.77 C465.38,656.023333 463.253333,658.15 459,658.15 L399,658.15 L399,775.22 L525.79,775.22 C530.043333,775.22 532.17,777.596667 532.17,782.35 C532.17,786.603333 530.043333,788.73 525.79,788.73 L392.2,788.73 C387.7,788.73 385.45,786.48 385.45,781.98 L385.45,521.19 C385.45,516.69 387.7,514.44 392.2,514.44 L525.79,514.44 C530.043333,514.44 532.17,516.566667 532.17,520.82 C532.17,525.573333 530.043333,527.95 525.79,527.95 L399,527.95 L399,644.65 L459,644.64 Z M643.77,724.49 C632.69,734.74 617.57,739.93 598.83,739.93 C590.082311,740.000953 581.374084,738.750178 573,736.22 C565.08,733.75 558.65,730.76 553.88,727.34 C549.685777,724.461626 545.941701,720.977041 542.77,717 C540.01,713.36 538.67,710.33 538.67,707.74 C538.734283,705.789092 539.509619,703.928997 540.85,702.51 C542.39,700.72 543.85,699.86 545.33,699.86 C546.81,699.86 548.69,701.25 551.33,704.51 C553.57,707.26 556.16,710.26 559.03,713.42 C561.9,716.58 566.61,719.36 573.36,722 C580.11,724.64 588.19,726 597.28,726 C613.41,726 625.79,721.9 634.07,713.81 C642.35,705.72 646.53,693.81 646.53,678.26 C646.53,668.02 644.7,659.26 641.08,652.36 C637.874282,645.8902 632.964805,640.41717 626.88,636.53 C620.626732,632.715387 613.998721,629.552171 607.1,627.09 L585.53,619.5 C578.407687,617.155538 571.579303,613.998039 565.18,610.09 C558.689278,605.99337 553.413379,600.234076 549.9,593.41 C546.05,586.24 544.1,577.36 544.1,567.02 C544.1,556.49 546.05,547.32 549.88,539.75 C553.71,532.18 559.06,526.39 565.69,522.75 C571.760835,519.311259 578.289388,516.752362 585.08,515.15 C591.7762,513.680181 598.61447,512.955774 605.47,512.99 C616.890766,512.856493 628.25367,514.630891 639.09,518.24 C650,522 655,525.78 655,530.24 C654.916423,532.213781 654.157409,534.098961 652.85,535.58 C651.34,537.47 649.72,538.42 648.03,538.42 C647.19,538.42 645.75,538.05 640.91,535.34 C636.30085,532.971571 631.462578,531.07848 626.47,529.69 C619.544449,527.721432 612.369222,526.771473 605.17,526.87 C597.558092,526.781289 589.97323,527.791706 582.65,529.87 C576.19,531.8 570.4,535.87 565.46,541.99 C560.52,548.11 558.04,556.19 558.04,566.12 C558.04,574.52 559.85,581.66 563.43,587.36 C566.838785,592.927174 571.736573,597.43009 577.57,600.36 C583.94981,603.517486 590.538592,606.233855 597.29,608.49 C604.46,610.91 611.79,613.63 619.1,616.57 C626.282202,619.451958 633.112871,623.142398 639.46,627.57 C645.73,631.96 650.86,638.45 654.71,646.87 C658.56,655.29 660.47,665.52 660.47,677.43 C660.51,698.35 654.87,714.21 643.76,724.49 L643.77,724.49 Z M765.92,686.38 C756.67,694.94 744.07,699.29 728.49,699.29 C721.242168,699.348298 714.027215,698.309885 707.09,696.21 C701.428334,694.592844 696.056089,692.095694 691.17,688.81 C687.654637,686.392813 684.517177,683.467661 681.86,680.13 C679.44,676.94 678.27,674.23 678.27,671.84 C678.322752,669.953085 679.062359,668.150293 680.35,666.77 C681.85,665.02 683.35,664.18 684.94,664.18 C686.53,664.18 688.35,665.41 690.81,668.43 C692.62,670.65 694.71,673.07 697.04,675.63 C699.16,677.97 702.92,680.21 708.24,682.29 C714.32226,684.514605 720.764973,685.589521 727.24,685.46 C740.04,685.46 749.82,682.24 756.33,675.89 C762.84,669.54 766.1,660.12 766.1,647.83 C766.1,639.7 764.65,632.83 761.8,627.32 C759.297736,622.247998 755.460166,617.95407 750.7,614.9 C745.678978,611.841159 740.357883,609.304592 734.82,607.33 L717.27,601.15 C711.38642,599.215288 705.745772,596.608041 700.46,593.38 C694.996887,589.94318 690.550437,585.110082 687.58,579.38 C684.35,573.38 682.71,565.93 682.71,557.3 C682.71,548.67 684.34,540.87 687.55,534.53 C690.448442,528.485526 695.11436,523.46391 700.93,520.13 C705.977623,517.274361 711.405115,515.149827 717.05,513.82 C722.592378,512.592976 728.253448,511.9826 733.93,512 C743.367043,511.889982 752.756198,513.356827 761.71,516.34 C771.11,519.61 775.49,523.1 775.49,527.34 C775.433713,529.229237 774.727297,531.041195 773.49,532.47 C772.02,534.31 770.37,535.25 768.6,535.25 C767.77,535.25 766.6,535.04 762.2,532.58 C758.525602,530.696709 754.669063,529.19229 750.69,528.09 C745.162798,526.517786 739.435902,525.759815 733.69,525.84 C727.607224,525.759866 721.544725,526.558095 715.69,528.21 C710.365486,529.922249 705.692777,533.223505 702.3,537.67 C698.48,542.39 696.54,548.74 696.54,556.53 C696.54,563.13 697.95,568.72 700.74,573.16 C703.393404,577.491303 707.202977,580.996109 711.74,583.28 C716.884382,585.823473 722.196793,588.011919 727.64,589.83 C733.5,591.83 739.5,594.04 745.46,596.44 C751.395098,598.808559 757.041415,601.844754 762.29,605.49 C767.58,609.19 771.89,614.65 775.12,621.7 C778.35,628.75 779.92,637.22 779.92,647.1 C779.95,664.54 775.23,677.76 765.92,686.38 L765.92,686.38 Z" id="Shape"></path>
10
+ <path d="M168.39,525.81 L131.51,525.81 L131.51,608.24 L168.39,608.24 C180.34,608.24 189.61,604.91 195.94,598.35 C202.27,591.79 205.52,581.68 205.52,568.35 L205.52,565.35 C205.52,552.06 202.3,542.03 195.95,535.52 C189.6,529.01 180.34,525.81 168.39,525.81 L168.39,525.81 Z" id="Shape"></path>
11
+ </g>
12
+ </g>
13
+ </svg>
File without changes
@@ -0,0 +1,90 @@
1
+ body {
2
+ font-family: sans-serif;
3
+ padding: 0;
4
+ color: #000;
5
+ background: #fefefe;
6
+ max-width: 40rem;
7
+ margin: 0 auto;
8
+ padding: 4rem;
9
+ line-height: 1.5rem;
10
+ }
11
+
12
+ header {
13
+ display: flex;
14
+ flex-direction: column;
15
+ align-items: center;
16
+ margin: 2rem auto;
17
+ }
18
+
19
+ .logo {
20
+ max-width: 4rem;
21
+ max-height: 4rem;
22
+ }
23
+
24
+ .logo-light {
25
+ display: block;
26
+ }
27
+
28
+ .logo-dark {
29
+ display: none;
30
+ }
31
+
32
+ #title {
33
+ margin-left: 1rem;
34
+ }
35
+
36
+ footer {
37
+ margin: 4rem auto 0;
38
+ padding: 0;
39
+ }
40
+
41
+ pre {
42
+ overflow: scroll;
43
+ }
44
+
45
+ code {
46
+ color: hsl(23,39%,7%);
47
+ font-size: 1.15rem;
48
+ }
49
+
50
+ h2, a {
51
+ color: hsl(23,39%,26%);
52
+ }
53
+
54
+ h3 {
55
+ margin-top: 2rem;
56
+ color: hsl(23,39%,5%);
57
+ }
58
+
59
+ table td, table th {
60
+ text-align: left;
61
+ padding: 0.25rem;
62
+ }
63
+
64
+ @media (prefers-color-scheme: dark) {
65
+ body {
66
+ background: hsl(23,39%,26%);
67
+ color: #fefefe;
68
+ }
69
+
70
+ h2, a {
71
+ color: hsl(23,39%,90%);
72
+ }
73
+
74
+ h3 {
75
+ color: hsl(23,39%,85%);
76
+ }
77
+
78
+ code {
79
+ color: hsl(23,39%,90%);
80
+ }
81
+
82
+ .logo-light {
83
+ display: none;
84
+ }
85
+
86
+ .logo-dark {
87
+ display: block;
88
+ }
89
+ }
90
+
@@ -0,0 +1,6 @@
1
+ # Default layout for Sitepress pages
2
+ Sitepress.configure do |config|
3
+ ## Change the root_path of the Sitepress site, or set to a different
4
+ ## Sitepress instance.
5
+ # config.site = Sitepress::Site.new root_path: "."
6
+ end
@@ -0,0 +1,13 @@
1
+ module PageHelper
2
+ def link_to_page(page)
3
+ link_to page.data.fetch("title", page.request_path), page.request_path
4
+ end
5
+
6
+ def link_to_if_current(text, page, active_class: "active")
7
+ if page == current_page
8
+ link_to text, page.request_path, class: active_class
9
+ else
10
+ link_to text, page.request_path
11
+ end
12
+ end
13
+ end
@@ -2,10 +2,20 @@
2
2
  <html>
3
3
  <head>
4
4
  <meta charset='utf-8'>
5
- <title>Welcome to Sitepress</title>
6
- <link href='/stylesheets/site.css' rel='stylesheet' type='text/css'>
5
+ <title><%= current_page.data.fetch("title", "Sitepress") %></title>
6
+ <%= stylesheet_link_tag "site" %>
7
7
  </head>
8
8
  <body>
9
- <%= yield %>
9
+ <header>
10
+ <%= image_tag "logo-brown.svg", class: "logo logo-light" %>
11
+ <%= image_tag "logo-white.svg", class: "logo logo-dark" %>
12
+ <h1 id="title"><%= current_page.data.fetch("title", "Sitepress") %></h1>
13
+ </header>
14
+ <main>
15
+ <%= yield %>
16
+ </main>
17
+ <footer>
18
+ Running version Sitepress <%= Sitepress::VERSION %>. Visit <a href="https://sitepress.cc/">sitepress.cc</a> for documentation, help, and updates.
19
+ </footer>
10
20
  </body>
11
21
  </html>
@@ -1,3 +1,18 @@
1
- <h1>Welcome to Sitepress<h1>
1
+ ---
2
+ title: Welcome to Sitepress
3
+ ---
2
4
 
3
- <p>Check out the <a href="https://sitepress.cc">Sitepress website</a> for help on getting started and documentation</p>
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>
7
+
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>
10
+
11
+ <h3>Compile</h3>
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
+
14
+ <h3>Deploy</h3>
15
+ <p>I included an example Rakefile 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
+
17
+ <h3>Documentation</h3>
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: 1.0.1
4
+ version: 2.0.0.beta5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brad Gessler
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-22 00:00:00.000000000 Z
11
+ date: 2021-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sitepress-server
@@ -16,43 +16,43 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.1
19
+ version: 2.0.0.beta5
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: 1.0.1
26
+ version: 2.0.0.beta5
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: thor
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.20.0
33
+ version: 1.0.0
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.20.0
40
+ version: 1.0.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rack
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '1.0'
47
+ version: 1.0.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '1.0'
55
- description:
54
+ version: 1.0.0
55
+ description:
56
56
  email:
57
57
  - bradgessler@gmail.com
58
58
  executables: []
@@ -60,23 +60,27 @@ extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
62
  - lib/sitepress-cli.rb
63
+ - lib/sitepress/boot.rb
63
64
  - lib/sitepress/cli.rb
64
- - lib/sitepress/compiler.rb
65
- - lib/sitepress/preview_server.rb
66
- - lib/sitepress/project.rb
67
65
  - lib/sitepress/project_template.rb
68
66
  - lib/sitepress/repl.rb
69
67
  - sitepress-cli.gemspec
70
68
  - templates/default/.gitignore
71
- - templates/default/Gemfile
72
- - templates/default/helpers/page_helpers.rb
69
+ - templates/default/Gemfile.tt
70
+ - templates/default/Rakefile
71
+ - templates/default/assets/config/manifest.js
72
+ - templates/default/assets/images/logo-brown.svg
73
+ - templates/default/assets/images/logo-white.svg
74
+ - templates/default/assets/javascripts/.gitkeep
75
+ - templates/default/assets/stylesheets/site.css.scss
76
+ - templates/default/config/site.rb
77
+ - templates/default/helpers/page_helper.rb
73
78
  - templates/default/layouts/layout.html.erb
74
79
  - templates/default/pages/index.html.erb
75
- - templates/default/site.rb
76
80
  homepage: https://github.com/sitepress/sitepress
77
81
  licenses: []
78
82
  metadata: {}
79
- post_install_message:
83
+ post_install_message:
80
84
  rdoc_options: []
81
85
  require_paths:
82
86
  - lib
@@ -87,12 +91,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
87
91
  version: '0'
88
92
  required_rubygems_version: !ruby/object:Gem::Requirement
89
93
  requirements:
90
- - - ">="
94
+ - - ">"
91
95
  - !ruby/object:Gem::Version
92
- version: '0'
96
+ version: 1.3.1
93
97
  requirements: []
94
- rubygems_version: 3.1.2
95
- signing_key:
98
+ rubygems_version: 3.2.3
99
+ signing_key:
96
100
  specification_version: 4
97
101
  summary: Sitepress command line interface and compilation tools for static site.
98
102
  test_files: []
@@ -1,41 +0,0 @@
1
- require "pathname"
2
- require "fileutils"
3
-
4
- module Sitepress
5
- # Compile all resources from a Sitepress site into static pages.
6
- class Compiler
7
- include FileUtils
8
-
9
- def initialize(site:, stdout: $stdout)
10
- @site = site
11
- @stdout = stdout
12
- end
13
-
14
- # Iterates through all pages and writes them to disk
15
- def compile(target_path:)
16
- target_path = Pathname.new(target_path)
17
- mkdir_p target_path
18
- root = Pathname.new("/")
19
- cache_resources = @site.cache_resources
20
- @stdout.puts "Compiling #{@site.root_path.expand_path}"
21
- begin
22
- @site.cache_resources = true
23
- @site.resources.each do |resource|
24
- derooted = Pathname.new(resource.request_path).relative_path_from(root)
25
- path = target_path.join(derooted)
26
- mkdir_p path.dirname
27
- @stdout.puts " #{path}"
28
- File.open(path.expand_path, "w"){ |f| f.write render(resource) }
29
- end
30
- @stdout.puts "Successful compilation to #{target_path.expand_path}"
31
- ensure
32
- @site.cache_resources = cache_resources
33
- end
34
- end
35
-
36
- private
37
- def render(resource)
38
- RenderingContext.new(resource: resource, site: @site).render
39
- end
40
- end
41
- end
@@ -1,32 +0,0 @@
1
- require "rack"
2
-
3
- module Sitepress
4
- # Evaluates a configuration file on each site request, then delegates to
5
- # a sitepres server for rednering. In a production environment, you'd want
6
- # to run `Sitepress::Server` directly.
7
- class PreviewServer
8
- DEFAULT_PORT = 8080
9
- DEFAULT_BIND_ADDRESS = "0.0.0.0".freeze
10
-
11
- def initialize(project:)
12
- @project = project
13
- end
14
-
15
- def run(port: DEFAULT_PORT, bind_address: DEFAULT_BIND_ADDRESS)
16
- # TODO: Move all of this junk into the PreviewServer class. Move
17
- # what's in there now into PreviewServer::Rack
18
- Rack::Handler::WEBrick.run rack_app,
19
- BindAddress: bind_address,
20
- Port: port do |server|
21
- Signal.trap "SIGINT" do
22
- server.stop
23
- end
24
- end
25
- end
26
-
27
- private
28
- def rack_app
29
- Proc.new { |env| @project.server.call(env) }
30
- end
31
- end
32
- end
@@ -1,43 +0,0 @@
1
- require "pathname"
2
- require "forwardable"
3
-
4
- module Sitepress
5
- # Configures a site server, compiler, etc from a single configuration
6
- # file. Useful for static sites or anything that's running outside of
7
- # a framework like Rails.
8
- class Project
9
- # Default path of project configuration file.
10
- DEFAULT_CONFIG_FILE = "site.rb".freeze
11
-
12
- def initialize(config_file: DEFAULT_CONFIG_FILE)
13
- @config_file = config_file
14
- end
15
-
16
- def compiler
17
- Compiler.new(site: site)
18
- end
19
-
20
- def server
21
- Server.new(site: site)
22
- end
23
-
24
- def site
25
- ConfigurationFile.new(path: @config_file).parse
26
- end
27
- end
28
-
29
- # Evaluates a configuration file to configure a site.
30
- class ConfigurationFile
31
- Context = Struct.new(:site)
32
-
33
- def initialize(path: Project::DEFAULT_CONFIG_FILE)
34
- @path = Pathname.new(path)
35
- end
36
-
37
- def parse(site: Sitepress::Site.new)
38
- site.tap do |s|
39
- Context.new(s).instance_eval File.read(@path), @path.to_s
40
- end
41
- end
42
- end
43
- end
@@ -1,5 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "sitepress-cli"
4
- gem "haml"
5
- gem "sass"
@@ -1,2 +0,0 @@
1
- # module PageHelpers
2
- # end
@@ -1,4 +0,0 @@
1
- # Default layout for Sitepress pages
2
- site.manipulate do |resource|
3
- resource.data["layout"] = "layouts/layout.html.erb" if resource.mime_type == "text/html"
4
- end