diff --git a/.ruby-version b/.ruby-version index 8e8299dcc..a603bb50a 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.4.2 +2.7.5 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index af0af42dd..000000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: ruby -sudo: false -install: bundle install --without development --jobs=3 --retry=3 -cache: bundler -branches: - only: - - build -env: - global: - - SITE_ENV=deploy -before_script: -- git config --global user.email "antondavyodv.o@gmail.com" -- git config --global user.name "Anton Davydov" -- git remote rm origin -- git remote add origin https://davydovanton:${GH_TOKEN}@github.com/hanami/hanami.github.io.git -- mkdir build -script: -- bin/site build && bundle exec middleman deploy diff --git a/Gemfile b/Gemfile old mode 100755 new mode 100644 index a6f23e8e1..40b4ce597 --- a/Gemfile +++ b/Gemfile @@ -1,15 +1,9 @@ source 'https://rubygems.org' -gem 'middleman', '~> 3.3' -gem 'middleman-blog', '~> 3.5' -gem 'middleman-syntax', '~> 2.0' -gem 'middleman-deploy', '~> 1.0' -gem 'middleman-search_engine_sitemap', '~> 1.3' -gem 'middleman-search' +gem 'middleman' +gem 'middleman-blog' +gem 'middleman-syntax' gem 'middleman-breadcrumbs' -gem 'redcarpet', '~> 3.2' +gem 'redcarpet' gem 'httparty' - -group :development do - gem 'middleman-livereload', '~> 3.1' -end +gem 'nokogiri' diff --git a/Gemfile.lock b/Gemfile.lock index 975b4fbbf..5a7e9cdbf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,182 +1,131 @@ GEM remote: https://rubygems.org/ specs: - activesupport (4.2.5.1) - i18n (~> 0.7) - json (~> 1.7, >= 1.7.7) + activesupport (5.2.6) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - addressable (2.3.8) - builder (3.2.2) - capybara (2.4.4) - mime-types (>= 1.16) - nokogiri (>= 1.3.3) - rack (>= 1.0.0) - rack-test (>= 0.5.4) - xpath (~> 2.0) - chunky_png (1.3.5) + addressable (2.8.0) + public_suffix (>= 2.0.2, < 5.0) + backports (3.23.0) coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.10.0) - compass (1.0.3) - chunky_png (~> 1.2) - compass-core (~> 1.0.2) - compass-import-once (~> 1.0.5) - rb-fsevent (>= 0.9.3) - rb-inotify (>= 0.9) - sass (>= 3.3.13, < 3.5) - compass-core (1.0.3) - multi_json (~> 1.0) - sass (>= 3.3.0, < 3.5) - compass-import-once (1.0.5) - sass (>= 3.2, < 3.5) - em-websocket (0.5.1) - eventmachine (>= 0.12.9) - http_parser.rb (~> 0.6.0) + coffee-script-source (1.12.2) + concurrent-ruby (1.1.9) + contracts (0.13.0) + dotenv (2.7.6) erubis (2.7.0) - eventmachine (1.0.9.1) - execjs (2.6.0) - ffi (1.9.10) - haml (4.0.7) + execjs (2.8.1) + fast_blank (1.0.1) + fastimage (2.2.6) + ffi (1.15.5) + haml (5.2.2) + temple (>= 0.8.0) tilt - hike (1.2.3) - hooks (0.4.1) - uber (~> 0.0.14) - http_parser.rb (0.6.0) - httparty (0.13.7) - json (~> 1.8) + hamster (3.0.0) + concurrent-ruby (~> 1.0) + hashie (3.6.0) + httparty (0.20.0) + mime-types (~> 3.0) multi_xml (>= 0.5.2) - i18n (0.7.0) - json (1.8.6) - kramdown (1.9.0) - libv8 (3.16.14.19) - listen (3.0.5) - rb-fsevent (>= 0.9.3) - rb-inotify (>= 0.9) - middleman (3.4.1) + i18n (0.9.5) + concurrent-ruby (~> 1.0) + kramdown (2.3.1) + rexml + listen (3.0.8) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + memoist (0.16.2) + middleman (4.3.11) coffee-script (~> 2.2) - compass (>= 1.0.0, < 2.0.0) - compass-import-once (= 1.0.5) - execjs (~> 2.0) haml (>= 4.0.5) - kramdown (~> 1.2) - middleman-core (= 3.4.1) - middleman-sprockets (>= 3.1.2) - sass (>= 3.4.0, < 4.0) - uglifier (~> 2.5) - middleman-blog (3.5.3) - addressable (~> 2.3.5) - middleman-core (~> 3.2) + kramdown (>= 2.3.0) + middleman-cli (= 4.3.11) + middleman-core (= 4.3.11) + middleman-blog (4.0.3) + addressable (~> 2.3) + middleman-core (>= 4.0.0) tzinfo (>= 0.3.0) - middleman-breadcrumbs (0.3.3) - middleman (>= 3.3.5) - middleman-core (3.4.1) - activesupport (~> 4.1) - bundler (~> 1.1) - capybara (~> 2.4.4) + middleman-breadcrumbs (0.4.2) + middleman (>= 4.0.0) + middleman-cli (4.3.11) + thor (>= 0.17.0, < 2.0) + middleman-core (4.3.11) + activesupport (>= 4.2, < 6.0) + addressable (~> 2.3) + backports (~> 3.6) + bundler + contracts (~> 0.13.0) + dotenv erubis - hooks (~> 0.3) - i18n (~> 0.7.0) - listen (~> 3.0.3) - padrino-helpers (~> 0.12.3) - rack (>= 1.4.5, < 2.0) - thor (>= 0.15.2, < 2.0) - tilt (~> 1.4.1, < 2.0) - middleman-deploy (1.0.0) - middleman-core (>= 3.2) - net-sftp - ptools - middleman-livereload (3.4.6) - em-websocket (~> 0.5.1) - middleman-core (>= 3.3) - rack-livereload (~> 0.3.15) - middleman-search (0.10.0) - middleman-core (>= 3.2) - nokogiri (~> 1.6) - therubyracer (~> 0.12.2) - middleman-search_engine_sitemap (1.3.0) - builder - middleman-core (~> 3.2) - middleman-sprockets (3.4.2) - middleman-core (>= 3.3) - sprockets (~> 2.12.1) - sprockets-helpers (~> 1.1.0) - sprockets-sass (~> 1.3.0) - middleman-syntax (2.1.0) + execjs (~> 2.0) + fast_blank + fastimage (~> 2.0) + hamster (~> 3.0) + hashie (~> 3.4) + i18n (~> 0.9.0) + listen (~> 3.0.0) + memoist (~> 0.14) + padrino-helpers (~> 0.13.0) + parallel + rack (>= 1.4.5, < 3) + sassc (~> 2.0) + servolux + tilt (~> 2.0.9) + uglifier (~> 3.0) + middleman-syntax (3.2.0) middleman-core (>= 3.2) - rouge (~> 1.0) - mime-types (3.0) + rouge (~> 3.2) + mime-types (3.4.1) mime-types-data (~> 3.2015) - mime-types-data (3.2015.1120) - mini_portile2 (2.0.0) - minitest (5.8.4) - multi_json (1.11.2) - multi_xml (0.5.5) - net-sftp (2.1.2) - net-ssh (>= 2.6.5) - net-ssh (3.0.2) - nokogiri (1.6.7.2) - mini_portile2 (~> 2.0.0.rc2) - padrino-helpers (0.12.5) + mime-types-data (3.2022.0105) + mini_portile2 (2.7.1) + minitest (5.15.0) + multi_xml (0.6.0) + nokogiri (1.13.1) + mini_portile2 (~> 2.7.0) + racc (~> 1.4) + padrino-helpers (0.13.3.4) i18n (~> 0.6, >= 0.6.7) - padrino-support (= 0.12.5) - tilt (~> 1.4.1) - padrino-support (0.12.5) + padrino-support (= 0.13.3.4) + tilt (>= 1.4.1, < 3) + padrino-support (0.13.3.4) activesupport (>= 3.1) - ptools (1.3.3) - rack (1.6.4) - rack-livereload (0.3.16) - rack - rack-test (0.6.3) - rack (>= 1.0) - rb-fsevent (0.9.7) - rb-inotify (0.9.5) - ffi (>= 0.5.0) - redcarpet (3.3.4) - ref (2.0.0) - rouge (1.10.1) - sass (3.4.21) - sprockets (2.12.4) - hike (~> 1.2) - multi_json (~> 1.0) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - sprockets-helpers (1.1.0) - sprockets (~> 2.0) - sprockets-sass (1.3.1) - sprockets (~> 2.0) - tilt (~> 1.1) - therubyracer (0.12.3) - libv8 (~> 3.16.14.15) - ref - thor (0.19.1) - thread_safe (0.3.5) - tilt (1.4.1) - tzinfo (1.2.2) + parallel (1.21.0) + public_suffix (4.0.6) + racc (1.6.0) + rack (2.2.3) + rb-fsevent (0.11.0) + rb-inotify (0.10.1) + ffi (~> 1.0) + redcarpet (3.5.1) + rexml (3.2.5) + rouge (3.27.0) + sassc (2.4.0) + ffi (~> 1.9) + servolux (0.13.0) + temple (0.8.2) + thor (1.2.1) + thread_safe (0.3.6) + tilt (2.0.10) + tzinfo (1.2.9) thread_safe (~> 0.1) - uber (0.0.15) - uglifier (2.7.2) - execjs (>= 0.3.0) - json (>= 1.8.0) - xpath (2.0.0) - nokogiri (~> 1.3) + uglifier (3.2.0) + execjs (>= 0.3.0, < 3) PLATFORMS ruby DEPENDENCIES httparty - middleman (~> 3.3) - middleman-blog (~> 3.5) + middleman + middleman-blog middleman-breadcrumbs - middleman-deploy (~> 1.0) - middleman-livereload (~> 3.1) - middleman-search - middleman-search_engine_sitemap (~> 1.3) - middleman-syntax (~> 2.0) - redcarpet (~> 3.2) + middleman-syntax + nokogiri + redcarpet BUNDLED WITH - 1.14.6 + 2.3.9 diff --git a/README.md b/README.md index 70c267bb8..24d49575e 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,6 @@ Usage: Available commands: develop - Start the local server to develop the site build - Build the site locally - publish - Build the site locally and publish help - Print this help ``` @@ -35,6 +34,4 @@ invoke without `./` ## Production deployment -The deployment is automated with Travis CI. Upon merging PR into `build` branch, deployment script is invoked. - -For more details, please consult `.travis.yml` file. +The deployment is automated with Netifly. diff --git a/bin/site b/bin/site index 401737c6a..7d897cb2a 100755 --- a/bin/site +++ b/bin/site @@ -1,6 +1,7 @@ #!/bin/bash command="$1" +stable_version="1.2" function _middleman { local command="$@" @@ -12,23 +13,15 @@ function start_server { } function build_site { - cp -fR ./source/guides/1.0/* ./source/guides _middleman build } -function publish_site { - build_site - _middleman deploy - git checkout build -} - function print_help { echo -e 'Usage:' echo -e '\tbin/site [command]' echo -e 'Available commands:' echo -e '\tdevelop - Start the local server to develop the site' echo -e '\tbuild - Build the site locally' - echo -e '\tpublish - Build the site locally and publish' echo -e '\thelp - Print this help' } @@ -39,9 +32,6 @@ case "$command" in 'build') build_site ;; - 'publish') - publish_site - ;; 'help') print_help ;; diff --git a/config.rb b/config.rb index 3c8c49144..11a7bfe0b 100644 --- a/config.rb +++ b/config.rb @@ -9,15 +9,6 @@ require 'lib/github_style_titles' require File.expand_path('../extensions/build_cleaner.rb', __FILE__) -activate :search do |search| - search.resources = ['guides/'] - search.fields = { - title: { boost: 100, store: true, required: true }, - content: { boost: 50, store: true }, - url: { index: false, store: true } - } -end - activate :breadcrumbs ### @@ -28,16 +19,12 @@ page '/atom.xml', layout: false page '/ml/*', layout: false -with_layout :guides do - page '/guides/*' -end - ### # Helpers ### activate :directory_indexes -activate :syntax, css_class: 'language-ruby' +activate :syntax, inline_theme: Rouge::Themes::Github.new activate :blog do |blog| blog.prefix = 'blog' @@ -50,18 +37,7 @@ # Automatic image dimensions on image_tag helper # activate :automatic_image_sizes -# Reload the browser automatically whenever files change -configure :development do - activate :livereload if defined?(::Middleman::LiveReloadExtension) -end - -activate :deploy do |deploy| - deploy.method = :git - deploy.branch = 'master' -end - -set :url_root, 'http://hanamirb.org' -activate :search_engine_sitemap +set :url_root, 'https://hanamirb.org' # Methods defined in the helpers block are available in templates helpers do @@ -69,7 +45,7 @@ # BLOG # - def articles(limit = 5) + def blog_articles(limit = 5) blog.articles.first(limit) end @@ -92,7 +68,7 @@ def article_summary(article) def article_image(article) if article.data.image - %() + %() end end @@ -103,142 +79,7 @@ def article_image_url(article) "/images" end - "#{ path }/cover.jpg" - end - - # - # GUIDES - # - - GUIDES_ROOT = 'source/guides'.freeze - GUIDES_EDIT_URL = 'https://github.com/hanami/hanami.github.io/edit/build/'.freeze - - def guides - @guides ||= {} - - version = current_page.data.version - raise "missing version for #{current_page.path}" if version.nil? - - version = version.to_s - return @guides[version] if @guides.key?(version) - - yaml = YAML.load_file("#{GUIDES_ROOT}/#{version}/guides.yml") - @guides[version] = JSON.parse(yaml.to_json, object_class: OpenStruct) - end - - def latest_stable_version_guides_path - latest_stable_version = Dir.glob("#{GUIDES_ROOT}/*").each_with_object([]) do |version, result| - next unless ::File.directory?(version) && version =~ /[\d]+\.[\d]+\z/ - result << ::File.basename(version) - end.compact.sort.last - - "/guides/#{latest_stable_version}" - end - - def guide_title(item, version = nil) - item.title || item.path.split('-').map(&:capitalize).join(' ') - end - - def guide_url(category, page, version = nil) - path = version == 'head' ? '/guides/head' : "/guides/#{version}" - path = '/guides' if %w[head 1.0].include?(page.path) - File.join(path, category.path, page.path) - end - - def guide_pager(current_page, guides, version = nil) - current_url = current_page.url.tr('/', '') - flat_guides = guides.categories.flat_map { |category| - category.pages.map { |page| - OpenStruct.new( - category: category, - page: page, - ) - } - } - current_guide_index = flat_guides.index { |guide_page| - guide_url(guide_page.category, guide_page.page).tr('/', '') == current_url - } - if current_guide_index - links = [] - prev_guide = flat_guides[current_guide_index - 1] - if 0 < current_guide_index && prev_guide - prev_url = guide_url(prev_guide.category, prev_guide.page, version) - prev_title = "#{guide_title(prev_guide.category)} - #{guide_title(prev_guide.page)}" - links << %(
Prev: #{prev_title}
) - end - - next_guide = flat_guides[current_guide_index + 1] - if next_guide - next_url = guide_url(next_guide.category, next_guide.page, version) - next_title = "#{guide_title(next_guide.category)} - #{guide_title(next_guide.page)}" - links << %(
Next: #{next_title}
) - end - links.join - end - end - - def guides_navigation - result = '' - - Dir.glob("#{ GUIDES_ROOT }/*").each do |section| - next unless ::File.directory?(section) - result << guides_section(section) - end - - result - end - - def guides_section(section) - title = section.sub("#{ GUIDES_ROOT }/", '').titleize - - %(
  • - #{ title } - -
  • ) - end - - def guides_section_articles(section) - result = '' - Dir.glob("#{ section }/*").each do |article| - article = article.gsub("#{ section }/", '').gsub(/\.md\z/, '') - url = section.sub("#{ GUIDES_ROOT }", '') + article - - result << %(
  • #{ article.titleize }
  • ) - end - - result - end - - def guides_edit_article(source) - url = GUIDES_EDIT_URL + source.gsub("#{ Dir.pwd }/", '') - %() - end - - ROOT_GUIDE_PAGE_REGEXP = %r(\A/guides/([\d\.|head]+/)?\z) - - def breadcrumbs(page, guides) - metadata = page.metadata - version = metadata[:page]['version'] - version_text = version == 'head' ? nil : "/ #{link_to(version, "/guides/#{version}")} " - page_title = metadata[:page]['title'].split(' - ').last - - category = guides.categories.select do |c| - c['pages'].map { |p| p['path'] }.include?(page.url.split('/').last) - end.first - - if page.url[ROOT_GUIDE_PAGE_REGEXP] - full_page_title = '' - else - full_page_title = "/ #{category_title(category)} / #{page_title}" - end - - "#{link_to('Guides', '/guides')} #{version_text} #{full_page_title}" - end - - def category_title(category) - category['title'] || category['path'].split('-').map(&:capitalize).join(' ') + "#{ path }cover.jpg" end # @@ -259,12 +100,16 @@ def encode_text(text) ::Rack::Utils.escape(text) end + def current_ruby_version + "3.2.0" + end + def hanami_version - '1.1.0' + "2.2.0" end def hanami_release_date - Date.parse("2017-10-25").strftime("%B %-d, %Y") + Date.parse("2024-11-05").strftime("%B %-d, %Y") end end diff --git a/netlify.toml b/netlify.toml new file mode 100644 index 000000000..335a56615 --- /dev/null +++ b/netlify.toml @@ -0,0 +1,4 @@ +[[headers]] + for = "/*" + [headers.values] + X-Frame-Options = "DENY" diff --git a/source/_footer.erb b/source/_footer.erb index 793b74581..76c1bf29e 100644 --- a/source/_footer.erb +++ b/source/_footer.erb @@ -1,5 +1,3 @@ -<%= partial 'lotus' %> - - - - - - - diff --git a/source/_hanami2.erb b/source/_hanami2.erb new file mode 100644 index 000000000..914bfae3d --- /dev/null +++ b/source/_hanami2.erb @@ -0,0 +1,9 @@ +
    +
    +
    + We have just released Hanami 2.2! + + Read the announcement. +
    +
    +
    diff --git a/source/_head.erb b/source/_head.erb index 592bd8ec2..480e4c961 100644 --- a/source/_head.erb +++ b/source/_head.erb @@ -9,9 +9,10 @@ Hanami | <%= current_page.data.title || "The web, with simplicity" %> - <%= stylesheet_link_tag 'toolkit-minimal' %> <%= stylesheet_link_tag 'search' %> <%= stylesheet_link_tag 'application-minimal' %> + + diff --git a/source/_lotus.erb b/source/_lotus.erb deleted file mode 100644 index 333666be1..000000000 --- a/source/_lotus.erb +++ /dev/null @@ -1,7 +0,0 @@ -
    -
    -
    - Looking for Lotus? We renamed the project and it's now called Hanami. Read the announcement. -
    -
    -
    diff --git a/source/_mailing_list.erb b/source/_mailing_list.erb index 26006e52b..8485c8872 100644 --- a/source/_mailing_list.erb +++ b/source/_mailing_list.erb @@ -3,7 +3,7 @@

    Join a community of over 2,300+ developers.

    -
    + diff --git a/source/_navbar.erb b/source/_navbar.erb index 37aa30b1b..d7a1bc11a 100644 --- a/source/_navbar.erb +++ b/source/_navbar.erb @@ -1,4 +1,4 @@ -