From 691f064a24983ad346260dde0142c45f6c3fd812 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 20 May 2021 20:32:53 -0300 Subject: [PATCH 1/5] =?UTF-8?q?actualizaci=C3=B3n=20de=20cuidados?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile.lock | 206 +++++++++++++++++++++------------------------------ 1 file changed, 85 insertions(+), 121 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 73c57a26..942d7d6f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -18,60 +18,60 @@ GIT GEM remote: https://gems.sutty.nl/ specs: - actioncable (6.1.3.1) - actionpack (= 6.1.3.1) - activesupport (= 6.1.3.1) + actioncable (6.1.3.2) + actionpack (= 6.1.3.2) + activesupport (= 6.1.3.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.3.1) - actionpack (= 6.1.3.1) - activejob (= 6.1.3.1) - activerecord (= 6.1.3.1) - activestorage (= 6.1.3.1) - activesupport (= 6.1.3.1) + actionmailbox (6.1.3.2) + actionpack (= 6.1.3.2) + activejob (= 6.1.3.2) + activerecord (= 6.1.3.2) + activestorage (= 6.1.3.2) + activesupport (= 6.1.3.2) mail (>= 2.7.1) - actionmailer (6.1.3.1) - actionpack (= 6.1.3.1) - actionview (= 6.1.3.1) - activejob (= 6.1.3.1) - activesupport (= 6.1.3.1) + actionmailer (6.1.3.2) + actionpack (= 6.1.3.2) + actionview (= 6.1.3.2) + activejob (= 6.1.3.2) + activesupport (= 6.1.3.2) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.1.3.1) - actionview (= 6.1.3.1) - activesupport (= 6.1.3.1) + actionpack (6.1.3.2) + actionview (= 6.1.3.2) + activesupport (= 6.1.3.2) rack (~> 2.0, >= 2.0.9) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.3.1) - actionpack (= 6.1.3.1) - activerecord (= 6.1.3.1) - activestorage (= 6.1.3.1) - activesupport (= 6.1.3.1) + actiontext (6.1.3.2) + actionpack (= 6.1.3.2) + activerecord (= 6.1.3.2) + activestorage (= 6.1.3.2) + activesupport (= 6.1.3.2) nokogiri (>= 1.8.5) - actionview (6.1.3.1) - activesupport (= 6.1.3.1) + actionview (6.1.3.2) + activesupport (= 6.1.3.2) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.1.3.1) - activesupport (= 6.1.3.1) + activejob (6.1.3.2) + activesupport (= 6.1.3.2) globalid (>= 0.3.6) - activemodel (6.1.3.1) - activesupport (= 6.1.3.1) - activerecord (6.1.3.1) - activemodel (= 6.1.3.1) - activesupport (= 6.1.3.1) - activestorage (6.1.3.1) - actionpack (= 6.1.3.1) - activejob (= 6.1.3.1) - activerecord (= 6.1.3.1) - activesupport (= 6.1.3.1) + activemodel (6.1.3.2) + activesupport (= 6.1.3.2) + activerecord (6.1.3.2) + activemodel (= 6.1.3.2) + activesupport (= 6.1.3.2) + activestorage (6.1.3.2) + actionpack (= 6.1.3.2) + activejob (= 6.1.3.2) + activerecord (= 6.1.3.2) + activesupport (= 6.1.3.2) marcel (~> 1.0.0) mini_mime (~> 1.0.2) - activesupport (6.1.3.1) + activesupport (6.1.3.2) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -89,14 +89,11 @@ GEM jekyll-relative-urls (~> 0.0) jekyll-seo-tag (~> 2.1) ast (2.4.2) - autoprefixer-rails (10.2.4.0) - execjs - bcrypt (3.1.16) + autoprefixer-rails (10.2.5.0) + execjs (< 2.8.0) bcrypt (3.1.16-x86_64-linux-musl) - bcrypt_pbkdf (1.1.0) bcrypt_pbkdf (1.1.0-x86_64-linux-musl) benchmark-ips (2.8.4) - bindex (0.8.1) bindex (0.8.1-x86_64-linux-musl) blazer (2.4.2) activerecord (>= 5) @@ -107,7 +104,7 @@ GEM autoprefixer-rails (>= 9.1.0) popper_js (>= 1.14.3, < 2) sassc-rails (>= 2.0.0) - brakeman (5.0.0) + brakeman (5.0.1) builder (3.2.4) capybara (2.18.0) addressable @@ -116,28 +113,24 @@ GEM rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (>= 2.0, < 4.0) - chartkick (4.0.3) + chartkick (4.0.4) childprocess (3.0.0) coderay (1.1.3) colorator (1.1.0) - commonmarker (0.21.2) - ruby-enum (~> 0.5) commonmarker (0.21.2-x86_64-linux-musl) ruby-enum (~> 0.5) concurrent-ruby (1.1.8) - concurrent-ruby-ext (1.1.8) - concurrent-ruby (= 1.1.8) concurrent-ruby-ext (1.1.8-x86_64-linux-musl) concurrent-ruby (= 1.1.8) crass (1.0.6) database_cleaner (2.0.1) database_cleaner-active_record (~> 2.0.0) - database_cleaner-active_record (2.0.0) + database_cleaner-active_record (2.0.1) activerecord (>= 5.a) database_cleaner-core (~> 2.0.0) database_cleaner-core (2.0.1) - dead_end (1.1.6) - derailed_benchmarks (2.0.1) + dead_end (1.1.7) + derailed_benchmarks (2.1.0) benchmark-ips (~> 2) dead_end get_process_mem (~> 0) @@ -149,26 +142,25 @@ GEM rake (> 10, < 14) ruby-statistics (>= 2.1) thor (>= 0.19, < 2) - devise (4.7.3) + devise (4.8.0) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) responders warden (~> 1.2.3) - devise-i18n (1.9.3) + devise-i18n (1.9.4) devise (>= 4.7.1) - devise_invitable (2.0.4) + devise_invitable (2.0.5) actionmailer (>= 5.0) devise (>= 4.6) dotenv (2.7.6) dotenv-rails (2.7.6) dotenv (= 2.7.6) railties (>= 3.2) - down (5.2.0) + down (5.2.1) addressable (~> 2.5) - ed25519 (1.2.4) ed25519 (1.2.4-x86_64-linux-musl) - editorial-autogestiva-jekyll-theme (0.3.0) + editorial-autogestiva-jekyll-theme (0.3.4) jekyll (~> 4) jekyll-commonmark (~> 1.3) jekyll-data (~> 1.1) @@ -192,22 +184,18 @@ GEM http_parser.rb (~> 0.6.0) errbase (0.2.1) erubi (1.10.0) - eventmachine (1.2.7) eventmachine (1.2.7-x86_64-linux-musl) exception_notification (4.4.3) actionmailer (>= 4.0, < 7) activesupport (>= 4.0, < 7) execjs (2.7.0) - factory_bot (6.1.0) + factory_bot (6.2.0) activesupport (>= 5.0.0) - factory_bot_rails (6.1.0) - factory_bot (~> 6.1.0) + factory_bot_rails (6.2.0) + factory_bot (~> 6.2.0) railties (>= 5.0.0) - fast_blank (1.0.0) fast_blank (1.0.0-x86_64-linux-musl) - fast_jsonparser (0.5.0) fast_jsonparser (0.5.0-x86_64-linux-musl) - ffi (1.15.0) ffi (1.15.0-x86_64-linux-musl) flamegraph (0.9.5) forwardable-extended (2.6.0) @@ -228,10 +216,6 @@ GEM rainbow rubocop (>= 0.50.0) sysexits (~> 1.1) - hamlit (2.15.0) - temple (>= 0.8.2) - thor - tilt hamlit (2.15.0-x86_64-linux-musl) temple (>= 0.8.2) thor @@ -243,9 +227,7 @@ GEM railties (>= 4.0.1) heapy (0.2.0) thor - hiredis (0.6.3) hiredis (0.6.3-x86_64-linux-musl) - http_parser.rb (0.6.0) http_parser.rb (0.6.0-x86_64-linux-musl) httparty (0.18.1) mime-types (~> 3.0) @@ -312,7 +294,7 @@ GEM sassc (> 2.0.1, < 3.0) jekyll-seo-tag (2.7.1) jekyll (>= 3.8, < 5.0) - jekyll-spree-client (0.1.12) + jekyll-spree-client (0.1.14) fast_blank (~> 1) spree-api-client (~> 0.2) jekyll-turbolinks (0.0.5) @@ -361,33 +343,28 @@ GEM mini_histogram (0.3.1) mini_magick (4.11.0) mini_mime (1.0.3) - mini_portile2 (2.5.0) + mini_portile2 (2.5.1) minima (2.5.1) jekyll (>= 3.5, < 5.0) jekyll-feed (~> 0.9) jekyll-seo-tag (~> 2.1) minitest (5.14.4) - mobility (1.1.1) + mobility (1.1.2) i18n (>= 0.6.10, < 2) request_store (~> 1.0) multi_xml (0.6.0) net-ssh (6.1.0) netaddr (2.0.4) - nio4r (2.5.7) nio4r (2.5.7-x86_64-linux-musl) - nokogiri (1.11.3) - mini_portile2 (~> 2.5.0) - racc (~> 1.4) - nokogiri (1.11.3-x86_64-linux-musl) + nokogiri (1.11.5-x86_64-linux-musl) mini_portile2 (~> 2.5.0) racc (~> 1.4) orm_adapter (0.5.0) parallel (1.20.1) - parser (3.0.1.0) + parser (3.0.1.1) ast (~> 2.4.1) pathutil (0.16.2) forwardable-extended (~> 2.6) - pg (1.2.3) pg (1.2.3-x86_64-linux-musl) popper_js (1.16.0) prometheus_exporter (0.7.0) @@ -396,18 +373,15 @@ GEM coderay (~> 1.1) method_source (~> 1.0) public_suffix (4.0.6) - puma (5.2.2) - nio4r (~> 2.0) - puma (5.2.2-x86_64-linux-musl) + puma (5.3.1-x86_64-linux-musl) nio4r (~> 2.0) pundit (2.1.0) activesupport (>= 3.0.0) - racc (1.5.2) racc (1.5.2-x86_64-linux-musl) rack (2.2.3) rack-cors (1.1.1) rack (>= 2.0.0) - rack-mini-profiler (2.3.1) + rack-mini-profiler (2.3.2) rack (>= 1.2.0) rack-proxy (0.6.5) rack @@ -424,20 +398,20 @@ GEM jekyll-relative-urls (~> 0.0) jekyll-seo-tag (~> 2.1) jekyll-turbolinks (~> 0) - rails (6.1.3.1) - actioncable (= 6.1.3.1) - actionmailbox (= 6.1.3.1) - actionmailer (= 6.1.3.1) - actionpack (= 6.1.3.1) - actiontext (= 6.1.3.1) - actionview (= 6.1.3.1) - activejob (= 6.1.3.1) - activemodel (= 6.1.3.1) - activerecord (= 6.1.3.1) - activestorage (= 6.1.3.1) - activesupport (= 6.1.3.1) + rails (6.1.3.2) + actioncable (= 6.1.3.2) + actionmailbox (= 6.1.3.2) + actionmailer (= 6.1.3.2) + actionpack (= 6.1.3.2) + actiontext (= 6.1.3.2) + actionview (= 6.1.3.2) + activejob (= 6.1.3.2) + activemodel (= 6.1.3.2) + activerecord (= 6.1.3.2) + activestorage (= 6.1.3.2) + activesupport (= 6.1.3.2) bundler (>= 1.15.0) - railties (= 6.1.3.1) + railties (= 6.1.3.2) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) @@ -449,15 +423,15 @@ GEM railties (>= 6.0.0, < 7) rails_warden (0.6.0) warden (>= 1.2.0) - railties (6.1.3.1) - actionpack (= 6.1.3.1) - activesupport (= 6.1.3.1) + railties (6.1.3.2) + actionpack (= 6.1.3.2) + activesupport (= 6.1.3.2) method_source rake (>= 0.8.7) thor (~> 1.0) rainbow (3.0.0) rake (13.0.3) - rb-fsevent (0.10.4) + rb-fsevent (0.11.0) rb-inotify (0.10.1) ffi (~> 1.0) recursero-jekyll-theme (0.1.3) @@ -502,38 +476,34 @@ GEM railties (>= 5.0) rexml (3.2.5) rouge (3.26.0) - rubocop (1.12.1) + rubocop (1.15.0) parallel (~> 1.10) parser (>= 3.0.0.0) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml - rubocop-ast (>= 1.2.0, < 2.0) + rubocop-ast (>= 1.5.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.4.1) - parser (>= 2.7.1.5) - rubocop-rails (2.9.1) + rubocop-ast (1.5.0) + parser (>= 3.0.1.1) + rubocop-rails (2.10.1) activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 0.90.0, < 2.0) + rubocop (>= 1.7.0, < 2.0) ruby-enum (0.9.0) i18n - ruby-filemagic (0.7.2) ruby-filemagic (0.7.2-x86_64-linux-musl) ruby-progressbar (1.11.0) ruby-statistics (2.1.3) - ruby-vips (2.1.0) + ruby-vips (2.1.2) ffi (~> 1.12) ruby_dep (1.5.0) rubyzip (2.3.0) - rugged (1.1.0) rugged (1.1.0-x86_64-linux-musl) safe_yaml (1.0.6) safely_block (0.3.0) errbase (>= 0.1.1) - sassc (2.4.0) - ffi (~> 1.9) sassc (2.4.0-x86_64-linux-musl) ffi (~> 1.9) sassc-rails (2.1.2) @@ -571,10 +541,8 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - sqlite3 (1.4.2) sqlite3 (1.4.2-x86_64-linux-musl) - stackprof (0.2.16) - stackprof (0.2.16-x86_64-linux-musl) + stackprof (0.2.17-x86_64-linux-musl) sucker_punch (3.0.1) concurrent-ruby (~> 1.0) sutty-archives (2.5.4) @@ -603,7 +571,6 @@ GEM jekyll (>= 3.5, < 5.0) jekyll-feed (~> 0.9) jekyll-seo-tag (~> 2.1) - symbol-fstring (1.0.0) symbol-fstring (1.0.0-x86_64-linux-musl) sysexits (1.2.0) temple (0.8.2) @@ -621,7 +588,6 @@ GEM execjs (>= 0.3.0, < 3) unf (0.1.4) unf_ext - unf_ext (0.0.7.7) unf_ext (0.0.7.7-x86_64-linux-musl) unicode-display_width (1.7.0) validates_hostname (1.0.11) @@ -634,14 +600,12 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webpacker (5.2.1) + webpacker (5.4.0) activesupport (>= 5.2) rack-proxy (>= 0.6.1) railties (>= 5.2) semantic_range (>= 2.3.0) webrick (1.7.0) - websocket-driver (0.7.3) - websocket-extensions (>= 0.1.0) websocket-driver (0.7.3-x86_64-linux-musl) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) From 160558470b7c783c5fba6247fdbff834169eeb93 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 24 May 2021 10:49:35 -0300 Subject: [PATCH 2/5] =?UTF-8?q?a=20veces=20el=20decifrado=20falla=20porque?= =?UTF-8?q?=20el=20valor=20todav=C3=ADa=20no=20estaba=20cifrado?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit buscamos un espacio para saber si se trata de una oración o un mensaje que realmente no se pudo decifrar. fixes #1704 fixes #1706 fixes #1708 fixes #1709 fixes #1710 fixes #1712 fixes #1713 fixes #1714 fixes #1717 fixes #1718 fixes #1719 fixes #1721 fixes #1723 fixes #1724 fixes #1725 fixes #1728 fixes #1779 fixes #1780 fixes #1785 fixes #1799 fixes #1800 fixes #1802 fixes #1803 fixes #1804 fixes #1805 fixes #1807 fixes #1809 fixes #1810 fixes #1811 fixes #1813 --- app/models/metadata_template.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/models/metadata_template.rb b/app/models/metadata_template.rb index 23df8803..cea4d009 100644 --- a/app/models/metadata_template.rb +++ b/app/models/metadata_template.rb @@ -211,9 +211,13 @@ MetadataTemplate = Struct.new(:site, :document, :name, :label, :type, box.decrypt_str value.to_s rescue Lockbox::DecryptionError => e - ExceptionNotifier.notify_exception(e, data: { site: site.name, post: post.path.absolute, name: name }) + if value.to_s.include? ' ' + value + else + ExceptionNotifier.notify_exception(e, data: { site: site.name, post: post.path.absolute, name: name }) - I18n.t('lockbox.help.decryption_error') + I18n.t('lockbox.help.decryption_error') + end end # Cifra el valor. From 9ea199876d49a74659648f3e86a3a665c5f3eaa9 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 7 Jun 2021 13:37:18 -0300 Subject: [PATCH 3/5] =?UTF-8?q?cargar=20los=20layouts=20para=20poder=20acc?= =?UTF-8?q?eder=20a=20la=20versi=C3=B3n=20preliminar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cuando separamos la lectura de datos de jekyll había faltado leer los layouts para poder aplicarlos a la version preliminar. con este cambio solo se leen cuando se los va a usar. fixes #2006 --- app/models/post.rb | 3 +++ app/models/site.rb | 7 +++++++ config/initializers/core_extensions.rb | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/app/models/post.rb b/app/models/post.rb index 31a269e7..d6baee84 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -69,6 +69,9 @@ class Post # TODO: Cambiar el locale en otro lado l = lang.value.to_s site.jekyll.config['locale'] = site.jekyll.config['lang'] = l + # XXX: Es necesario leer los layouts para poder renderizar el + # sitio + site.theme_layouts # Payload básico con traducciones. document.renderer.payload = { diff --git a/app/models/site.rb b/app/models/site.rb index a4349f57..6466384a 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -283,6 +283,13 @@ class Site < ApplicationRecord layout_keys.include? layout.to_sym end + # Lee los layouts en HTML desde el sitio + # + # @return [Hash] + def theme_layouts + @jekyll.reader.read_layouts + end + # Trae todos los valores disponibles para un campo # # TODO: Traer recursivamente, si el campo contiene Hash diff --git a/config/initializers/core_extensions.rb b/config/initializers/core_extensions.rb index d43a5116..c1e8d652 100644 --- a/config/initializers/core_extensions.rb +++ b/config/initializers/core_extensions.rb @@ -55,6 +55,11 @@ module Jekyll @site.data = DataReader.new(site).read(site.config['data_dir']) end + # Lee los layouts + def read_layouts + @site.layouts = LayoutReader.new(site).read unless @site.layouts.present? + end + # Lee todos los artículos del sitio def read_collections read_directories From 57e86f3cfbb2fa2a9719be47e42c9cd3244bc87a Mon Sep 17 00:00:00 2001 From: f Date: Tue, 8 Jun 2021 14:36:48 -0300 Subject: [PATCH 4/5] usar postgresql en desarrollo --- Makefile | 8 ++++++-- config/database.yml | 14 +++++++++----- config/puma.rb | 11 +++++++++-- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index c7f4fd39..e0da9ddc 100644 --- a/Makefile +++ b/Makefile @@ -38,8 +38,11 @@ test/%_test.rb: always test: always $(hain) 'cd /Sutty/sutty; RAILS_ENV=test bundle exec rake test' -serve: /etc/hosts - $(hain) 'cd /Sutty/sutty; bundle exec rails s -b "ssl://0.0.0.0:3000?key=../sutty.local/domain/$(SUTTY).key&cert=../sutty.local/domain/$(SUTTY).crt"' +postgresql: /etc/hosts + pgrep postgres >/dev/null || $(hain) postgresql + +serve: /etc/hosts postgresql + $(MAKE) rails args=server # make rails args="db:migrate" rails: @@ -129,5 +132,6 @@ ota-rb: @grep -q " $(SUTTY)$$" $@ || echo -e "127.0.0.1 $(SUTTY)\n::1 $(SUTTY)" | sudo tee -a $@ @grep -q " api.$(SUTTY)$$" $@ || echo -e "127.0.0.1 api.$(SUTTY)\n::1 api.$(SUTTY)" | sudo tee -a $@ @grep -q " panel.$(SUTTY)$$" $@ || echo -e "127.0.0.1 panel.$(SUTTY)\n::1 panel.$(SUTTY)" | sudo tee -a $@ + @grep -q " postgresql.$(SUTTY)$$" $@ || echo -e "127.0.0.1 postgresql.$(SUTTY)\n::1 postgresql.$(SUTTY)" | sudo tee -a $@ .PHONY: always diff --git a/config/database.yml b/config/database.yml index 7989a013..cd599a24 100644 --- a/config/database.yml +++ b/config/database.yml @@ -5,20 +5,25 @@ # gem 'sqlite3' # default: &default - adapter: sqlite3 - pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> timeout: 5000 + adapter: postgresql + pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> + encoding: unicode development: <<: *default - database: db/development.sqlite3 + database: 'sutty' + host: 'postgresql.sutty.local' + user: <%= ENV['USER'] %> # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: <<: *default - database: db/test.sqlite3 + database: 'sutty_test' + host: 'postgresql.sutty.local' + user: <%= ENV['USER'] %> production: adapter: postgresql @@ -26,4 +31,3 @@ production: database: <%= ENV.fetch('DATABASE') { 'sutty' } %> user: sutty host: postgresql - encoding: unicode diff --git a/config/puma.rb b/config/puma.rb index 48ff0e62..60ee5ecc 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -19,8 +19,15 @@ worker_timeout 3600 if ENV.fetch('RAILS_ENV', 'development') == 'development' # Specifies the `port` that Puma will listen on to receive requests; # default is 3000. # -# port ENV.fetch('PORT') { 3000 } -bind 'tcp://[::]:3100' +# XXX: Por alguna razón el puerto en el contenedor es históricamente +# 3100, aunque en desarrollo es 3000. En algún momento deberíamos +# establecer un solo puerto. +if ENV['RAILS_ENV'] == 'production' + bind 'tcp://[::]:3100' +else + sutty = ENV.fetch('SUTTY', 'sutty.local') + bind "ssl://[::]:3000?key=../sutty.local/domain/#{sutty}.key&cert=../sutty.local/domain/#{sutty}.crt" +end # Specifies the `environment` that Puma will run in. # From e014ab166aad9afbeb49c3d6390a53681271a7f2 Mon Sep 17 00:00:00 2001 From: fauno Date: Tue, 8 Jun 2021 17:52:41 +0000 Subject: [PATCH 5/5] poder traer actualizaciones desde repositorios remotos --- app/models/site/repository.rb | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/app/models/site/repository.rb b/app/models/site/repository.rb index d9695227..74db2549 100644 --- a/app/models/site/repository.rb +++ b/app/models/site/repository.rb @@ -44,8 +44,8 @@ class Site # # @return [Integer] def fetch - if origin.check_connection :fetch - rugged.fetch(origin)[:received_objects] + if origin.check_connection(:fetch, credentials: credentials) + rugged.fetch(origin, credentials: credentials)[:received_objects] else 0 end @@ -149,6 +149,26 @@ class Site private + # Si Sutty tiene una llave privada de tipo ED25519, devuelve las + # credenciales necesarias para trabajar con repositorios remotos. + # + # @return [Nil, Rugged::Credentials::SshKey] + def credentials + return unless File.exist? private_key + + @credentials ||= Rugged::Credentials::SshKey.new username: 'git', publickey: public_key, privatekey: private_key + end + + # @return [String] + def public_key + @public_key ||= Rails.root.join('.ssh', 'id_ed25519.pub').to_s + end + + # @return [String] + def private_key + @private_key ||= Rails.root.join('.ssh', 'id_ed25519').to_s + end + def relativize(file) Pathname.new(file).relative_path_from(Pathname.new(path)).to_s end