foxpage 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/.rspec +3 -0
  4. data/.rubocop.yml +9 -0
  5. data/.ruby-version +1 -0
  6. data/CODE_OF_CONDUCT.md +74 -0
  7. data/Gemfile +6 -0
  8. data/Gemfile.lock +84 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +76 -0
  11. data/Rakefile +8 -0
  12. data/bin/console +15 -0
  13. data/bin/setup +8 -0
  14. data/exe/foxpage +6 -0
  15. data/foxpage.gemspec +59 -0
  16. data/lib/fox_page/app_parts/base.rb +15 -0
  17. data/lib/fox_page/app_parts/builder.rb +13 -0
  18. data/lib/fox_page/app_parts/configuration.rb +46 -0
  19. data/lib/fox_page/app_parts/routes.rb +25 -0
  20. data/lib/fox_page/app_parts/server.rb +13 -0
  21. data/lib/fox_page/app_parts/sprockets.rb +28 -0
  22. data/lib/fox_page/app_parts.rb +24 -0
  23. data/lib/fox_page/app_template/__dot__gitignore.tt +2 -0
  24. data/lib/fox_page/app_template/__dot__rubocop.yml.tt +9 -0
  25. data/lib/fox_page/app_template/app/assets/images/__dot__keep.tt +0 -0
  26. data/lib/fox_page/app_template/app/assets/stylesheets/application.scss.tt +8 -0
  27. data/lib/fox_page/app_template/app/controllers/application_controller.rb.tt +4 -0
  28. data/lib/fox_page/app_template/app/controllers/home_controller.rb.tt +13 -0
  29. data/lib/fox_page/app_template/app/helpers/application_helper.rb.tt +5 -0
  30. data/lib/fox_page/app_template/app/views/home/index.haml.tt +4 -0
  31. data/lib/fox_page/app_template/app/views/layouts/_footer.haml.tt +5 -0
  32. data/lib/fox_page/app_template/app/views/layouts/default.haml.tt +15 -0
  33. data/lib/fox_page/app_template/config/application.rb.tt +6 -0
  34. data/lib/fox_page/app_template/config/boot.rb.tt +6 -0
  35. data/lib/fox_page/app_template/config/environment.rb.tt +5 -0
  36. data/lib/fox_page/app_template/config/routes.rb.tt +12 -0
  37. data/lib/fox_page/app_template/config/site.yml.tt +41 -0
  38. data/lib/fox_page/app_template/gems.rb.tt +9 -0
  39. data/lib/fox_page/app_template/public/__dot__keep.tt +0 -0
  40. data/lib/fox_page/application.rb +31 -0
  41. data/lib/fox_page/builders/assets.rb +28 -0
  42. data/lib/fox_page/builders/file_copy.rb +22 -0
  43. data/lib/fox_page/builders/pages.rb +124 -0
  44. data/lib/fox_page/cli.rb +35 -0
  45. data/lib/fox_page/controller.rb +17 -0
  46. data/lib/fox_page/generator.rb +40 -0
  47. data/lib/fox_page/helpers/app_helper.rb +20 -0
  48. data/lib/fox_page/helpers/assets_helper.rb +17 -0
  49. data/lib/fox_page/helpers/render_helper.rb +17 -0
  50. data/lib/fox_page/refinements/camelize.rb +13 -0
  51. data/lib/fox_page/refinements/to_deep_open_struct.rb +33 -0
  52. data/lib/fox_page/router.rb +56 -0
  53. data/lib/fox_page/server.rb +47 -0
  54. data/lib/fox_page/site_builder.rb +32 -0
  55. data/lib/fox_page/version.rb +5 -0
  56. data/lib/fox_page.rb +20 -0
  57. data/lib/foxpage.rb +3 -0
  58. data/misc/foxpage.png +0 -0
  59. data/misc/foxpage.svg +28 -0
  60. metadata +272 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a7eb6f55b4154a03fc2be9a3a623bedfbf03b4436fab184377b66d11310df899
4
+ data.tar.gz: 20b6e0f2ee86a2064afc07eb84ac812347895db02638be7ce9441c16ae1c675c
5
+ SHA512:
6
+ metadata.gz: a1ca9bb683c35b9b3bc661b288072a2cfe73d5e4eb01f517ea0e48cd0ee3fa1ccc31954c0028237cc490fb903ed227eadd01548edcf3e2161df40ff4ae768e2d
7
+ data.tar.gz: ff733675525bf7fc4f31c593a6bc13670e71fea8349e7c1ae9ba06979e2476bff2104968990970be7c0aca03365dd965a0d0de80e2ca614992ab7d0c972c9754
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,9 @@
1
+ ---
2
+ AllCops:
3
+ TargetRubyVersion: 2.5
4
+
5
+ Style/StringLiterals:
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/Documentation:
9
+ Enabled: false
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.6.3
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at nilsding@nilsding.org. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in foxpage.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,84 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ foxpage (0.1.0)
5
+ haml (~> 5.1)
6
+ listen (~> 3.1)
7
+ sassc (~> 2.0)
8
+ sprockets (~> 4.0.0.beta9)
9
+ thor (~> 0.20)
10
+ tilt (~> 2.0)
11
+ webrick (~> 1.4)
12
+ zeitwerk (~> 2.1)
13
+
14
+ GEM
15
+ remote: https://rubygems.org/
16
+ specs:
17
+ ast (2.4.0)
18
+ concurrent-ruby (1.1.5)
19
+ diff-lcs (1.3)
20
+ ffi (1.11.1)
21
+ haml (5.1.1)
22
+ temple (>= 0.8.0)
23
+ tilt
24
+ jaro_winkler (1.5.2)
25
+ listen (3.1.5)
26
+ rb-fsevent (~> 0.9, >= 0.9.4)
27
+ rb-inotify (~> 0.9, >= 0.9.7)
28
+ ruby_dep (~> 1.2)
29
+ parallel (1.17.0)
30
+ parser (2.6.3.0)
31
+ ast (~> 2.4.0)
32
+ rack (2.0.7)
33
+ rainbow (3.0.0)
34
+ rake (12.3.2)
35
+ rb-fsevent (0.10.3)
36
+ rb-inotify (0.10.0)
37
+ ffi (~> 1.0)
38
+ rspec (3.8.0)
39
+ rspec-core (~> 3.8.0)
40
+ rspec-expectations (~> 3.8.0)
41
+ rspec-mocks (~> 3.8.0)
42
+ rspec-core (3.8.0)
43
+ rspec-support (~> 3.8.0)
44
+ rspec-expectations (3.8.3)
45
+ diff-lcs (>= 1.2.0, < 2.0)
46
+ rspec-support (~> 3.8.0)
47
+ rspec-mocks (3.8.0)
48
+ diff-lcs (>= 1.2.0, < 2.0)
49
+ rspec-support (~> 3.8.0)
50
+ rspec-support (3.8.0)
51
+ rubocop (0.68.1)
52
+ jaro_winkler (~> 1.5.1)
53
+ parallel (~> 1.10)
54
+ parser (>= 2.5, != 2.5.1.1)
55
+ rainbow (>= 2.2.2, < 4.0)
56
+ ruby-progressbar (~> 1.7)
57
+ unicode-display_width (>= 1.4.0, < 1.6)
58
+ ruby-progressbar (1.10.1)
59
+ ruby_dep (1.5.0)
60
+ sassc (2.0.1)
61
+ ffi (~> 1.9)
62
+ rake
63
+ sprockets (4.0.0.beta9)
64
+ concurrent-ruby (~> 1.0)
65
+ rack (> 1, < 3)
66
+ temple (0.8.1)
67
+ thor (0.20.3)
68
+ tilt (2.0.9)
69
+ unicode-display_width (1.5.0)
70
+ webrick (1.4.2)
71
+ zeitwerk (2.1.6)
72
+
73
+ PLATFORMS
74
+ ruby
75
+
76
+ DEPENDENCIES
77
+ bundler (~> 2.0)
78
+ foxpage!
79
+ rake (~> 12.3)
80
+ rspec (~> 3.0)
81
+ rubocop (~> 0.68.1)
82
+
83
+ BUNDLED WITH
84
+ 2.0.1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Georg Gadinger
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,76 @@
1
+ # ![](./misc/foxpage.png) FoxPage™
2
+
3
+ The hopelessly over-engineered static page generator.
4
+
5
+ ## Installation
6
+
7
+ $ gem install foxpage
8
+
9
+ ## Usage
10
+
11
+ ### Creating a new site
12
+
13
+ It's as easy as
14
+
15
+ $ foxpage new my_cool_website
16
+ $ cd my_cool_website
17
+
18
+ Adapt the site config in `./config/site.yml`, and edit some files in `./app`.
19
+ If you know Rails, you might feel right at home ;-)
20
+
21
+ ### Building the web site
22
+
23
+ You can build your web site to `./_site` by running
24
+
25
+ $ ./bin/foxpage build
26
+
27
+ or
28
+
29
+ $ bundle exec foxpage build
30
+
31
+ ### Running a development server
32
+
33
+ To run a local web server for development, you can do the following:
34
+
35
+ $ ./bin/foxpage server
36
+
37
+ This server looks for changes in `./app` and rebuilds the site if something has
38
+ changed. Changes in routes are also considered.
39
+
40
+ To make the server run on a different port, you can export the `APP_PORT`
41
+ environment variable.
42
+
43
+ ## But... why?
44
+
45
+ I wanted to rebuild my website, so I built this on a Sunday afternoon.
46
+ ¯\\\_(ツ)\_/¯
47
+
48
+ ## Development
49
+
50
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run
51
+ `rake spec` to run the tests. You can also run `bin/console` for an interactive
52
+ prompt that will allow you to experiment.
53
+
54
+ To install this gem onto your local machine, run `bundle exec rake install`. To
55
+ release a new version, update the version number in `version.rb`, and then run
56
+ `bundle exec rake release`, which will create a git tag for the version, push
57
+ git commits and tags, and push the `.gem` file to
58
+ [rubygems.org](https://rubygems.org).
59
+
60
+ ## Contributing
61
+
62
+ Bug reports and pull requests are welcome on GitHub at
63
+ https://github.com/nilsding/foxpage. This project is intended to be a safe,
64
+ welcoming space for collaboration, and contributors are expected to adhere to
65
+ the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
66
+
67
+ ## License
68
+
69
+ The gem is available as open source under the terms of the [MIT
70
+ License](https://opensource.org/licenses/MIT).
71
+
72
+ ## Code of Conduct
73
+
74
+ Everyone interacting in the FoxPage project’s codebases, issue trackers, chat
75
+ rooms and mailing lists is expected to follow the [code of
76
+ conduct](https://github.com/nilsding/foxpage/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "foxpage"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/exe/foxpage ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "foxpage"
5
+
6
+ FoxPage::Cli.start(ARGV)
data/foxpage.gemspec ADDED
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path("./lib", __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require "fox_page/version"
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "foxpage"
9
+ spec.version = FoxPage::VERSION
10
+ spec.authors = ["Georg Gadinger"]
11
+ spec.email = ["nilsding@nilsding.org"]
12
+
13
+ spec.summary = "A Rails-like static page generator"
14
+ spec.description = "A very overengineered static-page generator"
15
+ spec.homepage = "https://github.com/nilsding/foxpage"
16
+ spec.license = "MIT"
17
+
18
+ if spec.respond_to?(:metadata)
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ spec.metadata["source_code_uri"] = "https://github.com/nilsding/foxpage"
21
+ # spec.metadata["changelog_uri"] = "... changelog.md ..."
22
+ else
23
+ raise "RubyGems 2.0 or newer is required to protect against " \
24
+ "public gem pushes."
25
+ end
26
+
27
+ # Specify which files should be added to the gem when it is released.
28
+ # The `git ls-files -z` loads the files in the RubyGem that have been added
29
+ # into git.
30
+ spec.files = Dir.chdir(__dir__) do
31
+ `git ls-files -z`
32
+ .split("\x0")
33
+ .reject { |f| f.match(%r{^(test|spec|features)/}) }
34
+ end
35
+ spec.bindir = "exe"
36
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
37
+ spec.require_paths = ["lib"]
38
+
39
+ # core
40
+ spec.add_dependency "thor", "~> 0.20"
41
+ spec.add_dependency "zeitwerk", "~> 2.1"
42
+
43
+ # templating
44
+ spec.add_dependency "haml", "~> 5.1"
45
+ spec.add_dependency "tilt", "~> 2.0"
46
+
47
+ # assets
48
+ spec.add_dependency "sassc", "~> 2.0"
49
+ spec.add_dependency "sprockets", "~> 4.0.0.beta9"
50
+
51
+ # interactive development server
52
+ spec.add_dependency "listen", "~> 3.1"
53
+ spec.add_dependency "webrick", "~> 1.4"
54
+
55
+ spec.add_development_dependency "bundler", "~> 2.0"
56
+ spec.add_development_dependency "rake", "~> 12.3"
57
+ spec.add_development_dependency "rspec", "~> 3.0"
58
+ spec.add_development_dependency "rubocop", "~> 0.68.1"
59
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FoxPage
4
+ module AppParts
5
+ module Base
6
+ def priority(priority)
7
+ AppParts[self][:priority] ||= priority
8
+ end
9
+
10
+ def init(&block)
11
+ AppParts[self][:block] ||= block
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FoxPage
4
+ module AppParts
5
+ module Builder
6
+ extend Base
7
+
8
+ def build
9
+ SiteBuilder.build(self)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FoxPage
4
+ module AppParts
5
+ module Configuration
6
+ extend Base
7
+
8
+ using Refinements::ToDeepOpenStruct
9
+
10
+ attr_reader :root, :code_loader, :config
11
+
12
+ priority 0
13
+
14
+ init do
15
+ # Set up the app root
16
+ @root = Bundler.root
17
+
18
+ # Convenience method for yours truly.
19
+ # It's much easier to write `App.root.join(...)` instead
20
+ # of `File.join(App.root, ...)`
21
+ def @root.join(*path)
22
+ File.join(self, *path)
23
+ end
24
+
25
+ # Set up application code loader
26
+ @code_loader = Zeitwerk::Loader.new.tap do |loader|
27
+ loader.push_dir(@root.join("app/controllers"))
28
+ loader.push_dir(@root.join("app/helpers"))
29
+ loader.enable_reloading
30
+ loader.setup
31
+ end
32
+
33
+ # Finally, load the config.
34
+ @config = load_config
35
+ end
36
+
37
+ private
38
+
39
+ def load_config
40
+ YAML
41
+ .load_file(root.join("config", "site.yml"))
42
+ .to_deep_ostruct
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FoxPage
4
+ module AppParts
5
+ module Routes
6
+ extend Base
7
+
8
+ init do
9
+ reload_routes!
10
+ end
11
+
12
+ attr_reader :routes
13
+
14
+ def draw_routes(&block)
15
+ @routes ||= {}
16
+ @routes.merge!(Router.draw_routes(&block))
17
+ end
18
+
19
+ def reload_routes!
20
+ @routes = {}
21
+ load root.join("config", "routes.rb")
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FoxPage
4
+ module AppParts
5
+ module Server
6
+ extend Base
7
+
8
+ def server
9
+ @server ||= FoxPage::Server.new(self)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "sprockets"
4
+
5
+ module FoxPage
6
+ module AppParts
7
+ module Sprockets
8
+ extend Base
9
+
10
+ attr_reader :sprockets
11
+
12
+ init do
13
+ env = ::Sprockets::Environment.new(root)
14
+ env.append_path("app/assets/stylesheets")
15
+ env.append_path("app/assets/images")
16
+
17
+ manifest = ::Sprockets::Manifest.new(
18
+ env, "./#{OUTPUT_DIRECTORY}/assets/.sprockets_manifest.json"
19
+ )
20
+
21
+ @sprockets = OpenStruct.new(
22
+ env: env,
23
+ manifest: manifest
24
+ )
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FoxPage
4
+ module AppParts
5
+ def self.initializers_for(klass)
6
+ app_parts
7
+ .select { |mod, _| klass.ancestors.include?(mod) }
8
+ .values
9
+ .sort { |a, b| (a[:priority] || 99) <=> (b[:priority] || 99) }
10
+ .map { |x| x[:block] }
11
+ .compact
12
+ end
13
+
14
+ def self.[](klass)
15
+ app_parts[klass] ||= {}
16
+ app_parts[klass]
17
+ end
18
+
19
+ def self.app_parts
20
+ @app_parts ||= {}
21
+ end
22
+ private_class_method :app_parts
23
+ end
24
+ end
@@ -0,0 +1,2 @@
1
+ # Discourage committing the built site to a git repo
2
+ /_site
@@ -0,0 +1,9 @@
1
+ ---
2
+ AllCops:
3
+ TargetRubyVersion: 2.5
4
+
5
+ Style/StringLiterals:
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/Documentation:
9
+ Enabled: false
@@ -0,0 +1,8 @@
1
+ // Your (S)CSS goes here :-)
2
+
3
+ body {
4
+ color: #000000;
5
+ // Anyone else remember the FrontPage "Blends" theme? Yeah, me neither.
6
+ background: linear-gradient(to right, #9fcfff 0px, #ffffff 90px);
7
+ font-family: sans-serif;
8
+ }
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationController < FoxPage::Controller
4
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ class HomeController < ApplicationController
4
+ before_action :set_build_time
5
+
6
+ def index; end
7
+
8
+ private
9
+
10
+ def set_build_time
11
+ @build_time = Time.now
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ApplicationHelper
4
+ # All methods defined here can be used in views.
5
+ end
@@ -0,0 +1,4 @@
1
+ %h1 Welcome to FoxPage!
2
+
3
+ %p
4
+ This is the default template page for a new FoxPage app. Yay!
@@ -0,0 +1,5 @@
1
+ %hr/
2
+ %em
3
+ This site was generated with
4
+ %a{href: "https://github.com/nilsding/foxpage"}
5
+ FoxPage #{FoxPage::VERSION}
@@ -0,0 +1,15 @@
1
+ !!! 5
2
+ %html
3
+ %head
4
+ %meta{charset: "utf-8"}
5
+ %meta{http_equiv: "X-UA-Compatible", content: "IE=edge"}
6
+ %meta{name: "viewport", content: "width=device-width"}
7
+
8
+ %title= App.config.site.title
9
+ %meta{name: "description", content: App.config.site.description}
10
+
11
+ = stylesheet_link_tag("application.css")
12
+ %link{rel: "canonical", href: App.config.site.url}
13
+ %body
14
+ = yield
15
+ = render("layouts/_footer")
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "./boot"
4
+
5
+ class App < FoxPage::Application
6
+ end