From 166b549d63f44cd9b1f8cd417b9f4df2cb43eb7e Mon Sep 17 00:00:00 2001 From: f Date: Wed, 10 Jul 2019 19:50:24 -0300 Subject: [PATCH 01/44] oops --- app/views/devise/mailer/invitation_instructions.haml | 1 - 1 file changed, 1 deletion(-) diff --git a/app/views/devise/mailer/invitation_instructions.haml b/app/views/devise/mailer/invitation_instructions.haml index 7455123..bd0f144 100644 --- a/app/views/devise/mailer/invitation_instructions.haml +++ b/app/views/devise/mailer/invitation_instructions.haml @@ -1,4 +1,3 @@ -- binding.pry %p= t("devise.mailer.invitation_instructions.hello", email: @resource.email) %p= t("devise.mailer.invitation_instructions.someone_invited_you", url: @resource.sites.first.name) %p= link_to t("devise.mailer.invitation_instructions.accept"), accept_invitation_url(@resource, invitation_token: @token) From 237cfb4a5e6f092698e6bd1f9df61037c57a573f Mon Sep 17 00:00:00 2001 From: f Date: Thu, 11 Jul 2019 16:00:28 -0300 Subject: [PATCH 02/44] =?UTF-8?q?WIP=20creaci=C3=B3n=20de=20sitios?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 1 + Gemfile | 7 ++ Gemfile.lock | 14 +++ app/models/site.rb | 2 + .../20190711183726_add_unique_to_site_name.rb | 9 ++ db/schema.rb | 4 +- doc/crear_sitios.md | 107 ++++++++++++++++++ test/factories/rol.rb | 14 +++ test/factories/site.rb | 7 ++ test/factories/usuarie.rb | 9 ++ test/test_helper.rb | 5 + 11 files changed, 177 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20190711183726_add_unique_to_site_name.rb create mode 100644 doc/crear_sitios.md create mode 100644 test/factories/rol.rb create mode 100644 test/factories/site.rb create mode 100644 test/factories/usuarie.rb diff --git a/.env.example b/.env.example index cf01e61..2661f00 100644 --- a/.env.example +++ b/.env.example @@ -2,3 +2,4 @@ SECRET_KEY_BASE= IMAP_SERVER= DEFAULT_FROM= DEVISE_PEPPER= +SKEL_SUTTY=https://0xacab.org/sutty/skel.sutty.nl diff --git a/Gemfile b/Gemfile index f9edac6..dbf7ad1 100644 --- a/Gemfile +++ b/Gemfile @@ -53,6 +53,8 @@ gem 'mini_magick' gem 'pundit' gem 'rails-i18n' gem 'rails_warden' +gem 'rugged' +gem 'validates_hostname' gem 'whenever', require: false group :development, :test do @@ -82,3 +84,8 @@ group :development do gem 'spring' gem 'spring-watcher-listen', '~> 2.0.0' end + +group :test do + gem 'database_cleaner' + gem 'factory_bot_rails' +end diff --git a/Gemfile.lock b/Gemfile.lock index 5be9949..f9da67d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -98,6 +98,7 @@ GEM ruby-enum (~> 0.5) concurrent-ruby (1.1.5) crass (1.0.4) + database_cleaner (1.7.0) devise (4.6.2) bcrypt (~> 3.0) orm_adapter (~> 0.1) @@ -127,6 +128,11 @@ GEM actionmailer (>= 4.0, < 6) activesupport (>= 4.0, < 6) execjs (2.7.0) + factory_bot (5.0.2) + activesupport (>= 4.2.0) + factory_bot_rails (5.0.2) + factory_bot (~> 5.0.2) + railties (>= 4.2.0) fastimage (2.1.5) ffi (1.11.1) font-awesome-rails (4.7.0.4) @@ -286,6 +292,7 @@ GEM ruby_parser (3.13.1) sexp_processor (~> 4.9) rubyzip (1.2.2) + rugged (0.28.2) safe_yaml (1.0.5) sass (3.7.4) sass-listen (~> 4.0.0) @@ -344,6 +351,9 @@ GEM unf_ext unf_ext (0.0.7.5) unicode-display_width (1.5.0) + validates_hostname (1.0.8) + activerecord (>= 3.0) + activesupport (>= 3.0) warden (1.2.8) rack (>= 2.0.6) web-console (3.7.0) @@ -376,6 +386,7 @@ DEPENDENCIES carrierwave-bombshelter carrierwave-i18n commonmarker + database_cleaner devise devise-i18n devise_invitable @@ -383,6 +394,7 @@ DEPENDENCIES ed25519 email_address exception_notification + factory_bot_rails font-awesome-rails friendly_id haml-rails @@ -400,6 +412,7 @@ DEPENDENCIES rails_warden rbnacl (< 5.0) rubocop + rugged sass-rails (~> 5.0) selenium-webdriver spring @@ -407,6 +420,7 @@ DEPENDENCIES sqlite3 (~> 1.3.6) turbolinks (~> 5) uglifier (>= 1.3.0) + validates_hostname web-console (>= 3.3.0) whenever diff --git a/app/models/site.rb b/app/models/site.rb index bb85d2a..a7d6869 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -5,6 +5,8 @@ class Site < ApplicationRecord include FriendlyId + validates :name, uniqueness: true, hostname: true + friendly_id :name, use: %i[finders] has_many :roles diff --git a/db/migrate/20190711183726_add_unique_to_site_name.rb b/db/migrate/20190711183726_add_unique_to_site_name.rb new file mode 100644 index 0000000..8fd5a9f --- /dev/null +++ b/db/migrate/20190711183726_add_unique_to_site_name.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# Los nombres de los sitios son únicos +class AddUniqueToSiteName < ActiveRecord::Migration[5.2] + def change + remove_index :sites, :name + add_index :sites, :name, unique: true + end +end diff --git a/db/schema.rb b/db/schema.rb index 6e3c298..c01df6a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -12,7 +12,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20_190_706_002_615) do +ActiveRecord::Schema.define(version: 20_190_711_183_726) do create_table 'roles', force: :cascade do |t| t.datetime 'created_at', null: false t.datetime 'updated_at', null: false @@ -29,7 +29,7 @@ ActiveRecord::Schema.define(version: 20_190_706_002_615) do t.datetime 'created_at', null: false t.datetime 'updated_at', null: false t.string 'name' - t.index ['name'], name: 'index_sites_on_name' + t.index ['name'], name: 'index_sites_on_name', unique: true end create_table 'usuaries', force: :cascade do |t| diff --git a/doc/crear_sitios.md b/doc/crear_sitios.md new file mode 100644 index 0000000..f953d88 --- /dev/null +++ b/doc/crear_sitios.md @@ -0,0 +1,107 @@ +# Crear sitios + +Para que les usuaries puedan crear sitios, vamos a tener el siguiente +flujo: + +* Nombre del sitio, en minúsculas, sin puntos. + +* Descripción, una descripción de qué hace el sitio para Sutty y otres + usuaries del sitio. + +* Plantilla. Lista de plantillas disponibles, con captura, nombre, link + a vista previa, link a autore, licencia y usos posibles (blogs, medios + alternativos, denuncias, etc.) + + Tengo mi propio diseño! Explicar que vamos a dar esta posibilidad más + adelante, pero que necesitamos financiamiento. Esto permitiría + agregar un repositorio o gema de plantilla. + +* Licencia. Elegir la licencia del contenido de un listado con + licencias piolas: + + * PPL + * CC-BY + * CC-BY-SA + * CC-0 + +* Lugares donde se van a subir los sitios. Por defecto nombre.sutty.nl, + otras opciones en un desplegable: + + * Tengo mi propio dominio: Explica que todavía no tenemos esto + autogestionado pero que si quieren apoyar el trabajo que hacemos + pueden donarnos o ponerse en contacto. + + Más adelante pide los dominios, explica cómo comprarlos en njal.la y + qué información poner los DNS para poder alojarlos. Cuando Sutty + tenga su propio DNS, indica los NS. + + * Neocities: Explicar qué es neocities y permitir agregar una cuenta. + Podríamos varias pero queremos estar bien con neocities y además no + tiene mucho sentido tener varias páginas en el mismo host. + + Pedir usuarie y contraseña o API key. Dar link directo a dónde + sacar la API key y explicar para qué es. + + **En realidad esta sería nuestra primera opción?** + + * Zip: Descargar el sitio en un archivo zip, proponiendo posibles usos + offline (raspberries, etc!) + + Da una URL desde donde se puede descargar el sitio. + + * SSH/SFTP: Explicar que permite enviar el sitio a servidores propios. + Permite agregar varios servidores, pide usuario, dominio y puerto. + Da la llave pública SSH de Sutty y explica cómo agregarla al + servidor remoto. También da un link de descarga para que puedan + hacer ssh-copy-id. + + **Esto todavía no** + + * IPFS: Da la opción de activar/desactivar soporte para IPFS. + Explica qué es y para qué sirve. Vincula a documentación sobre + instalar IPFS de escritorio y cómo pinear el hash de sutty, instalar + el companion, etc. + + **Esto todavía no** + + * Torrent: Genera un torrent y lo siembra. + + **Esto todavía no** + + * Syncthing: Explica qué es y da la ID del nodo introductor de Sutty. + + **Esto todavía no** + + * Zeronet: Idem syncthing? + + **Esto todavía no** + + * Archive.org + + **Esto todavía no** + +* Crear sitio! + +## Sitios + +Tenemos un sitio esqueleto que tiene lo básico para salir andando: + +* Gemas de Jekyll +* Gemas de Sutty +* Gemas de Temas +* Esqueleto de la configuración +* Directorios base (con i18n también) + +El sitio esqueleto es un repositorio Git que se clona al directorio del +sitio. Esto permite luego pullear actualizaciones desde el esqueleto a +los sitios, esperamos que sin conflictos! + +## Plantillas + +Las plantillas son plantillas Jekyll adaptadas a Sutty. Vamos a empezar +adaptando las que estén disponibles en y +otras fuentes, agregando features de Sutty y simplificando donde haga +falta (algunas plantillas tienen requisitos extraños). + +Las plantillas se instalan como gemas en los sitios, de forma que +podemos cambiarla desde las opciones del sitio luego. diff --git a/test/factories/rol.rb b/test/factories/rol.rb new file mode 100644 index 0000000..103f12a --- /dev/null +++ b/test/factories/rol.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +FactoryBot.define do + factory :rol do + usuarie + site + rol { 'usuarie' } + temporal { false } + + factory :rol_invitade do + rol { 'invitade' } + end + end +end diff --git a/test/factories/site.rb b/test/factories/site.rb new file mode 100644 index 0000000..7947e8a --- /dev/null +++ b/test/factories/site.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +FactoryBot.define do + factory :site do + name { SecureRandom.hex } + end +end diff --git a/test/factories/usuarie.rb b/test/factories/usuarie.rb new file mode 100644 index 0000000..18a4042 --- /dev/null +++ b/test/factories/usuarie.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +FactoryBot.define do + factory :usuarie do + email { SecureRandom.hex + '@sutty.nl' } + password { SecureRandom.hex } + confirmed_at { Date.today } + end +end diff --git a/test/test_helper.rb b/test/test_helper.rb index 8a5709e..49ac63e 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -4,8 +4,12 @@ require File.expand_path('../config/environment', __dir__) require 'rails/test_help' require 'open3' +# rubocop:disable Style/ClassAndModuleChildren class ActiveSupport::TestCase + include FactoryBot::Syntax::Methods # Resetear el repositorio a su estado original antes de leerlo + # + # TODO mover a Site.reset! cuando empecemos a trabajar con git def reset_git_repo(path) Dir.chdir(path) do Open3.popen3('git reset --hard') do |_, _, _, thread| @@ -15,3 +19,4 @@ class ActiveSupport::TestCase end end end +# rubocop:enable Style/ClassAndModuleChildren From 3171ca7177b7ab632d69b6492f3c6abd793dc48b Mon Sep 17 00:00:00 2001 From: f Date: Fri, 12 Jul 2019 14:11:24 -0300 Subject: [PATCH 03/44] serializar booleanos en sqlite3 --- config/application.rb | 15 +++++++---- db/migrate/20190703200455_create_sitios.rb | 9 +++++-- db/migrate/20190712165059_sqlite_boolean.rb | 28 +++++++++++++++++++++ db/schema.rb | 2 +- 4 files changed, 46 insertions(+), 8 deletions(-) create mode 100644 db/migrate/20190712165059_sqlite_boolean.rb diff --git a/config/application.rb b/config/application.rb index 2cc92e8..579177e 100644 --- a/config/application.rb +++ b/config/application.rb @@ -19,13 +19,18 @@ require 'rails/test_unit/railtie' Bundler.require(*Rails.groups) module Sutty + # Sutty! class Application < Rails::Application - # Initialize configuration defaults for originally generated Rails version. + # Initialize configuration defaults for originally generated Rails + # version. config.load_defaults 5.1 - # Settings in config/environments/* take precedence over those specified here. - # Application configuration should go into files in config/initializers - # -- all .rb files in that directory are automatically loaded. - config.action_dispatch.rescue_responses['Pundit::NotAuthorizedError'] = :forbidden + # Settings in config/environments/* take precedence over those + # specified here. Application configuration should go into files in + # config/initializers -- all .rb files in that directory are + # automatically loaded. + config.action_dispatch + .rescue_responses['Pundit::NotAuthorizedError'] = :forbidden + config.active_record.sqlite3.represent_boolean_as_integer = true end end diff --git a/db/migrate/20190703200455_create_sitios.rb b/db/migrate/20190703200455_create_sitios.rb index c8e45d3..7f8ae8f 100644 --- a/db/migrate/20190703200455_create_sitios.rb +++ b/db/migrate/20190703200455_create_sitios.rb @@ -44,7 +44,10 @@ class CreateSitios < ActiveRecord::Migration[5.2] usuarie ||= Usuarie.create(email: email, password: SecureRandom.hex, confirmed_at: Date.today) - site.usuaries << usuarie + + sql = "insert into sites_usuaries (site_id, usuarie_id) + values (#{site.id}, #{usuarie.id});" + ActiveRecord::Base.connection.execute(sql) end invitadxs.each do |email| @@ -52,7 +55,9 @@ class CreateSitios < ActiveRecord::Migration[5.2] usuarie ||= Usuarie.create(email: email, password: SecureRandom.hex, confirmed_at: Date.today) - site.invitades << usuarie + sql = "insert into invitades_sites (site_id, usuarie_id) + values (#{site.id}, #{usuarie.id});" + ActiveRecord::Base.connection.execute(sql) end end end diff --git a/db/migrate/20190712165059_sqlite_boolean.rb b/db/migrate/20190712165059_sqlite_boolean.rb new file mode 100644 index 0000000..7f41afd --- /dev/null +++ b/db/migrate/20190712165059_sqlite_boolean.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# Convertir los valores binarios de sqlite +class SqliteBoolean < ActiveRecord::Migration[5.2] + def up + return unless adapter_name == 'SQLite' + + Usuarie.where("acepta_politicas_de_privacidad = 't'") + .update_all(acepta_politicas_de_privacidad: 1) + Usuarie.where("acepta_politicas_de_privacidad = 'f'") + .update_all(acepta_politicas_de_privacidad: 0) + + change_column :usuaries, :acepta_politicas_de_privacidad, :boolean, + default: 0 + end + + def down + return unless adapter_name == 'SQLite' + + Usuarie.where('acepta_politicas_de_privacidad = 1') + .update_all(acepta_politicas_de_privacidad: 't') + Usuarie.where('acepta_politicas_de_privacidad = 0') + .update_all(acepta_politicas_de_privacidad: 'f') + + change_column :usuaries, :acepta_politicas_de_privacidad, :boolean, + default: 'f' + end +end diff --git a/db/schema.rb b/db/schema.rb index c01df6a..98e398c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -12,7 +12,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20_190_711_183_726) do +ActiveRecord::Schema.define(version: 20_190_712_165_059) do create_table 'roles', force: :cascade do |t| t.datetime 'created_at', null: false t.datetime 'updated_at', null: false From 4b87501709473b1b6302c99044968b1d35a51579 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 12 Jul 2019 14:13:51 -0300 Subject: [PATCH 04/44] usar rubocop-rails --- .rubocop.yml | 4 ---- Gemfile | 2 +- Gemfile.lock | 23 ++++++++++++----------- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index a42adca..f9765ba 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -45,10 +45,6 @@ Metrics/ClassLength: - 'app/models/site.rb' - 'app/controllers/posts_controller.rb' -Performance/TimesMap: - Exclude: - - 'app/models/site.rb' - Lint/HandleExceptions: Exclude: - 'app/controllers/posts_controller.rb' diff --git a/Gemfile b/Gemfile index dbf7ad1..3bf8e93 100644 --- a/Gemfile +++ b/Gemfile @@ -80,7 +80,7 @@ group :development do gem 'ed25519' gem 'letter_opener' gem 'rbnacl', '< 5.0' - gem 'rubocop' + gem 'rubocop-rails' gem 'spring' gem 'spring-watcher-listen', '~> 2.0.0' end diff --git a/Gemfile.lock b/Gemfile.lock index f9da67d..872f4c9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -159,7 +159,7 @@ GEM http_parser.rb (0.6.0) i18n (0.9.5) concurrent-ruby (~> 1.0) - jaro_winkler (1.5.2) + jaro_winkler (1.5.3) jbuilder (2.8.0) activesupport (>= 4.2.0) multi_json (>= 1.2) @@ -220,8 +220,8 @@ GEM nokogiri (1.10.3) mini_portile2 (~> 2.4.0) orm_adapter (0.5.0) - parallel (1.16.0) - parser (2.6.2.0) + parallel (1.17.0) + parser (2.6.3.0) ast (~> 2.4.0) pathutil (0.16.2) forwardable-extended (~> 2.6) @@ -229,7 +229,6 @@ GEM pry (0.12.2) coderay (~> 1.1.0) method_source (~> 0.9.0) - psych (3.1.0) public_suffix (3.0.3) puma (3.12.1) pundit (2.0.1) @@ -277,17 +276,19 @@ GEM actionpack (>= 5.0) railties (>= 5.0) rouge (3.3.0) - rubocop (0.66.0) + rubocop (0.72.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) - parser (>= 2.5, != 2.5.1.1) - psych (>= 3.1.0) + parser (>= 2.6) rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 1.6) + unicode-display_width (>= 1.4.0, < 1.7) + rubocop-rails (2.2.0) + rack (>= 1.1) + rubocop (>= 0.72.0) ruby-enum (0.7.2) i18n - ruby-progressbar (1.10.0) + ruby-progressbar (1.10.1) ruby_dep (1.5.0) ruby_parser (3.13.1) sexp_processor (~> 4.9) @@ -350,7 +351,7 @@ GEM unf (0.1.4) unf_ext unf_ext (0.0.7.5) - unicode-display_width (1.5.0) + unicode-display_width (1.6.0) validates_hostname (1.0.8) activerecord (>= 3.0) activesupport (>= 3.0) @@ -411,7 +412,7 @@ DEPENDENCIES rails-i18n rails_warden rbnacl (< 5.0) - rubocop + rubocop-rails rugged sass-rails (~> 5.0) selenium-webdriver From 1c18064a247a4edc6d8ef57fc8f152c1bd13cc80 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 12 Jul 2019 15:22:37 -0300 Subject: [PATCH 05/44] crear sitios clonando el repositorio skel --- app/models/site.rb | 16 +++++++- test/models/site_test.rb | 84 ++++++---------------------------------- 2 files changed, 26 insertions(+), 74 deletions(-) diff --git a/app/models/site.rb b/app/models/site.rb index a7d6869..71cb7bc 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -15,8 +15,12 @@ class Site < ApplicationRecord has_many :invitades, -> { where('roles.rol = ?', 'invitade') }, through: :roles, source: :usuarie - # Carga el sitio Jekyll una vez que se inicializa el modelo + # Clonar el directorio de esqueleto antes de crear el sitio + before_create :clone_skel! + # Carga el sitio Jekyll una vez que se inicializa el modelo o después + # de crearlo after_initialize :load_jekyll! + after_create :load_jekyll! attr_accessor :jekyll, :collections @@ -343,8 +347,18 @@ class Site < ApplicationRecord private + # Clona el esqueleto de Sutty para crear el sitio nuevo, no pasa nada + # si el sitio ya existe + def clone_skel! + return if File.directory? path + + Rugged::Repository.clone_at ENV['SKEL_SUTTY'], path + end + # Carga el sitio Jekyll def load_jekyll! + return unless name + Dir.chdir(path) do @jekyll ||= Site.load_jekyll(Dir.pwd) end diff --git a/test/models/site_test.rb b/test/models/site_test.rb index ce6e475..98e9940 100644 --- a/test/models/site_test.rb +++ b/test/models/site_test.rb @@ -3,81 +3,19 @@ require 'test_helper' class SiteTest < ActiveSupport::TestCase - setup do - @user = Usuaria.find('f@kefir.red') - @path = File.join(@user.path, 'cyber-women.com') - reset_git_repo(@path) - @site = @user.sites.select { |s| s.name == 'cyber-women.com' }.first - @site.read + test 'se puede crear un sitio' do + site = create :site + + assert site.valid? + # TODO: Mover a la validación del sitio o hacer algo similar + assert File.directory?(site.path) + assert File.directory?(File.join(site.path, '.git')) end - test 'El directorio es un sitio jekyll' do - assert Site.jekyll?(@path) - end + test 'se puede leer un sitio' do + site = create :site, name: 'sutty.nl' - test 'Un directorio se puede cargar como un sitio Jekyll' do - jekyll = Site.load_jekyll @path - - assert_equal Jekyll::Site, jekyll.class - end - - test 'Los artículos no están ordenados si a alguno le falta orden' do - assert_not @site.ordered? - assert @site.reorder_collection! - assert @site.ordered? - end - - test 'No podemos poner órdenes arbitrarios' do - total = @site.posts.count - new_order = Hash[total.times.map { |i| [i.to_s, rand(total)] }] - - assert_not @site.reorder_collection('posts', new_order) - end - - test 'Si les damos un orden alternativo los reordenamos' do - total = @site.posts.count - order = total.times.map(&:to_s) - new_order = Hash[order.zip(order.shuffle)] - - assert @site.reorder_collection('posts', new_order) - - # podemos hacer este test porque reordenar los posts no ordena el - # array - new_order.each do |k, v| - v = v.to_i - k = k.to_i - assert_equal v, @site.posts[k].order - end - end - - test 'Podemos reordenar solo una parte de los artículos' do - total = @site.posts.count - order = (total - rand(total - 1)).times.map(&:to_s) - new_order = Hash[order.zip(order.shuffle)] - - assert @site.reorder_collection('posts', new_order) - - # podemos hacer este test porque reordenar los posts no ordena el - # array - new_order.each do |k, v| - v = v.to_i - k = k.to_i - assert_equal v, @site.posts[k].order - end - end - - test 'Un sitio tiene traducciones' do - assert_equal %w[ar es en], @site.translations - assert @site.i18n? - end - - test 'El idioma por defecto es el idioma actual de la plataforma' do - assert_equal 'es', @site.default_lang - end - - test 'El sitio tiene layouts' do - assert_equal %w[anexo archive default feed header.ar header.en - header.es header license.ar license.en license.es license pandoc - politicas sesion simple style ].sort, @site.layouts + assert site.valid? + assert !site.posts.empty? end end From afb68bfcbd9bdb7042172ccb00c1928a1cc9093c Mon Sep 17 00:00:00 2001 From: f Date: Fri, 12 Jul 2019 15:34:16 -0300 Subject: [PATCH 06/44] se pueden eliminar sitios --- app/models/site.rb | 6 ++++++ test/factories/site.rb | 2 +- test/models/site_test.rb | 7 +++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/models/site.rb b/app/models/site.rb index 71cb7bc..d2e7d0b 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -17,6 +17,8 @@ class Site < ApplicationRecord # Clonar el directorio de esqueleto antes de crear el sitio before_create :clone_skel! + # Elimina el directorio al destruir un sitio + before_destroy :remove_directories! # Carga el sitio Jekyll una vez que se inicializa el modelo o después # de crearlo after_initialize :load_jekyll! @@ -363,4 +365,8 @@ class Site < ApplicationRecord @jekyll ||= Site.load_jekyll(Dir.pwd) end end + + def remove_directories! + FileUtils.rm_rf path + end end diff --git a/test/factories/site.rb b/test/factories/site.rb index 7947e8a..9d80180 100644 --- a/test/factories/site.rb +++ b/test/factories/site.rb @@ -2,6 +2,6 @@ FactoryBot.define do factory :site do - name { SecureRandom.hex } + name { "test-#{SecureRandom.hex}" } end end diff --git a/test/models/site_test.rb b/test/models/site_test.rb index 98e9940..66ad25b 100644 --- a/test/models/site_test.rb +++ b/test/models/site_test.rb @@ -10,6 +10,13 @@ class SiteTest < ActiveSupport::TestCase # TODO: Mover a la validación del sitio o hacer algo similar assert File.directory?(site.path) assert File.directory?(File.join(site.path, '.git')) + assert site.destroy + end + + test 'al destruir un sitio se eliminan los archivos' do + site = create :site + assert site.destroy + assert !File.directory?(site.path) end test 'se puede leer un sitio' do From af68d93a6cfb498e945f4904c4ff15da2bbfb0d7 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 12 Jul 2019 15:37:11 -0300 Subject: [PATCH 07/44] =?UTF-8?q?el=20nombre=20del=20sitio=20es=20=C3=BAni?= =?UTF-8?q?co?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/models/site_test.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/models/site_test.rb b/test/models/site_test.rb index 66ad25b..3cc695d 100644 --- a/test/models/site_test.rb +++ b/test/models/site_test.rb @@ -13,6 +13,13 @@ class SiteTest < ActiveSupport::TestCase assert site.destroy end + test 'el nombre tiene que ser único' do + site = create :site + site2 = build :site, name: site.name + + assert_not site2.valid? + end + test 'al destruir un sitio se eliminan los archivos' do site = create :site assert site.destroy From 5d4c7971328a18a9f38745f88793468e70fa4db3 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 12 Jul 2019 16:11:07 -0300 Subject: [PATCH 08/44] validar el nombre del sitio --- app/models/site.rb | 1 + test/models/site_test.rb | 33 +++++++++++++++++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/app/models/site.rb b/app/models/site.rb index d2e7d0b..da3838e 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -366,6 +366,7 @@ class Site < ApplicationRecord end end + # Elimina el directorio del sitio def remove_directories! FileUtils.rm_rf path end diff --git a/test/models/site_test.rb b/test/models/site_test.rb index 3cc695d..8d73a2b 100644 --- a/test/models/site_test.rb +++ b/test/models/site_test.rb @@ -3,6 +3,11 @@ require 'test_helper' class SiteTest < ActiveSupport::TestCase + # Asegurarse que el sitio se destruye al terminar de usarlo + teardown do + @site&.destroy + end + test 'se puede crear un sitio' do site = create :site @@ -14,12 +19,36 @@ class SiteTest < ActiveSupport::TestCase end test 'el nombre tiene que ser único' do - site = create :site - site2 = build :site, name: site.name + @site = create :site + site2 = build :site, name: @site.name assert_not site2.valid? end + test 'el nombre del sitio puede contener subdominios' do + site = build :site, name: 'hola.chau' + + assert site.valid? + end + + test 'el nombre del sitio no puede terminar con punto' do + site = build :site, name: 'hola.chau.' + + assert_not site.valid? + end + + test 'el nombre del sitio no puede contener wildcard' do + site = build :site, name: '*.chau' + + assert_not site.valid? + end + + test 'el nombre del sitio solo tiene letras, numeros y guiones' do + site = build :site, name: 'A_Z!' + + assert_not site.valid? + end + test 'al destruir un sitio se eliminan los archivos' do site = create :site assert site.destroy From 3a3dd7a2de6ffed96ec779c8a5c6108a7990d52a Mon Sep 17 00:00:00 2001 From: f Date: Fri, 12 Jul 2019 20:40:44 -0300 Subject: [PATCH 09/44] crear sitios! --- app/controllers/sites_controller.rb | 26 ++++++++++++- app/models/site.rb | 2 +- app/policies/site_policy.rb | 40 +++++++++++++++++++- app/views/layouts/_breadcrumb.haml | 2 +- app/views/layouts/application.html.haml | 2 +- app/views/sites/index.haml | 6 ++- app/views/sites/new.haml | 14 +++++++ config/initializers/devise.rb | 2 +- config/locales/en.yml | 3 ++ config/locales/es.yml | 5 +++ config/routes.rb | 4 +- doc/crear_sitios.md | 8 ++++ test/controllers/sites_controller_test.rb | 45 +++++++++++++++++++++++ 13 files changed, 148 insertions(+), 11 deletions(-) create mode 100644 app/views/sites/new.haml create mode 100644 test/controllers/sites_controller_test.rb diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb index 6ca91f1..3f280dd 100644 --- a/app/controllers/sites_controller.rb +++ b/app/controllers/sites_controller.rb @@ -14,12 +14,30 @@ class SitesController < ApplicationController # No tenemos propiedades de un sitio aún, así que vamos al listado de # artículos def show - authorize Site site = find_site + authorize site redirect_to site_posts_path(site) end + def new + @site = Site.new + authorize @site + end + + def create + @site = Site.new(site_params) + current_usuarie.roles << Rol.new(site: @site, + temporal: false, + rol: 'usuarie') + + if current_usuarie.save + redirect_to site_path(@site) + else + render 'new' + end + end + # Envía un archivo del directorio público de Jekyll def send_public_file authorize Site @@ -79,4 +97,10 @@ class SitesController < ApplicationController redirect_to site_posts_path @site end + + private + + def site_params + params.require(:site).permit(:name) + end end diff --git a/app/models/site.rb b/app/models/site.rb index da3838e..00d1483 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -359,7 +359,7 @@ class Site < ApplicationRecord # Carga el sitio Jekyll def load_jekyll! - return unless name + return unless name.present? && File.directory?(path) Dir.chdir(path) do @jekyll ||= Site.load_jekyll(Dir.pwd) diff --git a/app/policies/site_policy.rb b/app/policies/site_policy.rb index 1042f52..900c8f5 100644 --- a/app/policies/site_policy.rb +++ b/app/policies/site_policy.rb @@ -16,13 +16,35 @@ class SitePolicy # Todes les usuaries pueden ver el sitio si aceptaron la invitación def show? - !@usuarie.rol_for_site(@site).temporal + !current_role.temporal + end + + # Todes pueden crear nuevos sitios + def new? + true + end + + def create? + new? + end + + # Para poder editarlos también tienen que haber aceptado la invitación + def edit? + show? && usuarie? + end + + def update? + edit? + end + + def destroy? + edit? end # Les invitades no pueden generar el sitio y les usuaries solo hasta # que aceptan la invitación def build? - show? && !site.invitade?(usuarie) + show? && usuarie? end def send_public_file? @@ -40,4 +62,18 @@ class SitePolicy def reorder_posts? build? end + + private + + def current_role + usuarie.rol_for_site(site) + end + + def usuarie? + site.usuarie? usuarie + end + + def invitade? + site.invitade? usuarie + end end diff --git a/app/views/layouts/_breadcrumb.haml b/app/views/layouts/_breadcrumb.haml index c879376..01484ac 100644 --- a/app/views/layouts/_breadcrumb.haml +++ b/app/views/layouts/_breadcrumb.haml @@ -5,7 +5,7 @@ data: { toggle: 'tooltip' }, title: t('help.logout'), role: 'button', class: 'btn-text' do = fa_icon 'sign-out', title: t('help.logout') - - if help = @site.try(:config).try(:dig, 'help') + - if @site.try(:persisted?) && (help = @site.try(:config).try(:dig, 'help')) %li.breadcrumb-item= link_to t('.help'), help, target: '_blank' - crumbs.compact.each do |crumb| - if current_user.is_a? Invitadx diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index e5f5fc5..384ce10 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -6,7 +6,7 @@ = csrf_meta_tags = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' = javascript_include_tag 'application', 'data-turbolinks-track': 'reload' - - if @site.try(:config).try(:dig, 'css') + - if @site.try(:persisted?) && @site.try(:config).try(:dig, 'css') %link{rel: 'stylesheet', type: 'text/css', href: @site.get_url_from_site(@site.config.dig('css'))} - style = "background-image: url(#{@site.try(:cover) || image_url('background.jpg')})" %body{class: @has_cover ? 'background-cover' : '', style: @has_cover ? style : ''} diff --git a/app/views/sites/index.haml b/app/views/sites/index.haml index d953b8c..b1085ca 100644 --- a/app/views/sites/index.haml +++ b/app/views/sites/index.haml @@ -4,7 +4,11 @@ = render 'layouts/breadcrumb', crumbs: [ t('sites.index') ] .row .col - %h1= t('sites.title') + %h1 + = t('sites.title') + - if policy(Site).new? + = link_to t('sites.new.title'), new_site_path, + class: 'btn btn-info' = render 'layouts/help', help: t('help.sites.index') diff --git a/app/views/sites/new.haml b/app/views/sites/new.haml new file mode 100644 index 0000000..2e28dcd --- /dev/null +++ b/app/views/sites/new.haml @@ -0,0 +1,14 @@ +.row + .col + = render 'layouts/breadcrumb', + crumbs: [ link_to(t('sites.index'), sites_path), t('.title') ] +.row + .col + %h1= t('.title') + + = form_for @site do |f| + .form-group + = f.label :name + = f.text_field :name, class: 'form-control' + .form-group + = f.submit t('.submit'), class: 'btn btn-success' diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index f7e7acd..e3dce7c 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -78,7 +78,7 @@ Devise.setup do |config| # `config.http_authenticatable = [:database]` will enable it only for # database authentication. The supported strategies are: :database # = Support basic authentication with authentication key + password - # config.http_authenticatable = false + config.http_authenticatable = true # If 401 status code should be returned for AJAX requests. True by # default. diff --git a/config/locales/en.yml b/config/locales/en.yml index 3475e70..3e0ecc2 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -152,6 +152,9 @@ en: invitations: accept: 'Accept invitation' reject: 'No, thanks' + new: + title: 'Create site' + submit: 'Create site' footer: powered_by: 'is developed by' templates: diff --git a/config/locales/es.yml b/config/locales/es.yml index 77899ae..9608618 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -7,6 +7,8 @@ es: email: 'Correo electrónico' password: 'Contraseña' password_confirmation: 'Confirmación de contraseña' + site: + name: 'Nombre' errors: models: invitadx: @@ -155,6 +157,9 @@ es: invitations: accept: 'Aceptar la invitación' reject: 'No, gracias' + new: + title: 'Crear un sitio' + submit: 'Crear sitio' footer: powered_by: 'es desarrollada por' i18n: diff --git a/config/routes.rb b/config/routes.rb index 35bdd76..086fe8c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -11,9 +11,7 @@ Rails.application.routes.draw do # como un objeto válido resources :invitadxs, only: [:create] - resources :sites, only: %i[index show], - constraints: { site_id: %r{[^/]+}, id: %r{[^/]+} } do - + resources :sites, constraints: { site_id: %r{[^/]+}, id: %r{[^/]+} } do get 'public/:type/:basename', to: 'sites#send_public_file' # Gestionar usuaries diff --git a/doc/crear_sitios.md b/doc/crear_sitios.md index f953d88..e7cc3ed 100644 --- a/doc/crear_sitios.md +++ b/doc/crear_sitios.md @@ -105,3 +105,11 @@ falta (algunas plantillas tienen requisitos extraños). Las plantillas se instalan como gemas en los sitios, de forma que podemos cambiarla desde las opciones del sitio luego. + +## Internamente + +Al crear un sitio, clonar el esqueleto en el lugar correcto. Al +eliminarlo, eliminar el directorio. + +Lo correcto sería preguntar a todes les usuaries si están de acuerdo en +borrar el sitio. Si una no está de acuerdo, el borrado se cancela. diff --git a/test/controllers/sites_controller_test.rb b/test/controllers/sites_controller_test.rb new file mode 100644 index 0000000..2c3c334 --- /dev/null +++ b/test/controllers/sites_controller_test.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +class SitesControllerTest < ActionDispatch::IntegrationTest + setup do + @rol = create :rol + @site = @rol.site + @usuarie = @rol.usuarie + + @authorization = { + Authorization: ActionController::HttpAuthentication::Basic + .encode_credentials(@usuarie.email, @usuarie.password) + } + end + + teardown do + @site.destroy + end + + test 'se pueden ver' do + get sites_url, headers: @authorization + + assert_match @site.name, response.body + end + + test 'se puede ver el formulario de creación' do + get new_site_url, headers: @authorization + + assert_match(/ Date: Fri, 12 Jul 2019 21:20:36 -0300 Subject: [PATCH 10/44] actualizar sitios --- app/controllers/sites_controller.rb | 16 ++++++++++++++++ app/models/site.rb | 14 +++++++++++++- app/views/sites/_form.haml | 6 ++++++ app/views/sites/edit.haml | 10 ++++++++++ app/views/sites/new.haml | 9 ++------- config/locales/en.yml | 3 +++ config/locales/es.yml | 3 +++ test/models/site_test.rb | 11 +++++++++++ 8 files changed, 64 insertions(+), 8 deletions(-) create mode 100644 app/views/sites/_form.haml create mode 100644 app/views/sites/edit.haml diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb index 3f280dd..42fbaba 100644 --- a/app/controllers/sites_controller.rb +++ b/app/controllers/sites_controller.rb @@ -38,6 +38,22 @@ class SitesController < ApplicationController end end + def edit + @site = find_site + authorize @site + end + + def update + @site = find_site + authorize @site + + if @site.update(site_params) + redirect_to sites_path + else + render 'edit' + end + end + # Envía un archivo del directorio público de Jekyll def send_public_file authorize Site diff --git a/app/models/site.rb b/app/models/site.rb index 00d1483..ac449f9 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -23,6 +23,8 @@ class Site < ApplicationRecord # de crearlo after_initialize :load_jekyll! after_create :load_jekyll! + # Cambiar el nombre del directorio + before_update :update_name! attr_accessor :jekyll, :collections @@ -38,7 +40,11 @@ class Site < ApplicationRecord # # Equivale a _sites + nombre def path - @path ||= File.join(Site.site_path, name) + File.join(Site.site_path, name) + end + + def old_path + File.join(Site.site_path, name_was) end # Este sitio acepta invitadxs? @@ -370,4 +376,10 @@ class Site < ApplicationRecord def remove_directories! FileUtils.rm_rf path end + + def update_name! + return unless name_changed? + + FileUtils.mv old_path, path + end end diff --git a/app/views/sites/_form.haml b/app/views/sites/_form.haml new file mode 100644 index 0000000..1f5650b --- /dev/null +++ b/app/views/sites/_form.haml @@ -0,0 +1,6 @@ += form_for @site do |f| + .form-group + = f.label :name + = f.text_field :name, class: 'form-control' + .form-group + = f.submit submit, class: 'btn btn-success' diff --git a/app/views/sites/edit.haml b/app/views/sites/edit.haml new file mode 100644 index 0000000..a7e96a1 --- /dev/null +++ b/app/views/sites/edit.haml @@ -0,0 +1,10 @@ +.row + .col + = render 'layouts/breadcrumb', + crumbs: [link_to(t('sites.index'), sites_path), + t('.title', site: @site.name)] +.row + .col + %h1= t('.title', site: @site.name) + + = render 'form', submit: t('.submit') diff --git a/app/views/sites/new.haml b/app/views/sites/new.haml index 2e28dcd..0b883c1 100644 --- a/app/views/sites/new.haml +++ b/app/views/sites/new.haml @@ -1,14 +1,9 @@ .row .col = render 'layouts/breadcrumb', - crumbs: [ link_to(t('sites.index'), sites_path), t('.title') ] + crumbs: [link_to(t('sites.index'), sites_path), t('.title')] .row .col %h1= t('.title') - = form_for @site do |f| - .form-group - = f.label :name - = f.text_field :name, class: 'form-control' - .form-group - = f.submit t('.submit'), class: 'btn btn-success' + = render 'form', submit: t('.submit') diff --git a/config/locales/en.yml b/config/locales/en.yml index 3e0ecc2..64bde6b 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -155,6 +155,9 @@ en: new: title: 'Create site' submit: 'Create site' + edit: + title: 'Edit %{site}' + submit: 'Save changes' footer: powered_by: 'is developed by' templates: diff --git a/config/locales/es.yml b/config/locales/es.yml index 9608618..b0fa8ef 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -160,6 +160,9 @@ es: new: title: 'Crear un sitio' submit: 'Crear sitio' + edit: + title: 'Editar %{site}' + submit: 'Guardar cambios' footer: powered_by: 'es desarrollada por' i18n: diff --git a/test/models/site_test.rb b/test/models/site_test.rb index 8d73a2b..2040bd9 100644 --- a/test/models/site_test.rb +++ b/test/models/site_test.rb @@ -61,4 +61,15 @@ class SiteTest < ActiveSupport::TestCase assert site.valid? assert !site.posts.empty? end + + test 'se pueden renombrar' do + @site = create :site + path = @site.path + + @site.update_attribute :name, SecureRandom.hex + + assert_not_equal path, @site.path + assert File.directory?(@site.path) + assert_not File.directory?(path) + end end From f7ca99a7a4ba10416ef7de24c98393132c847272 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 13 Jul 2019 13:33:49 -0300 Subject: [PATCH 11/44] aumentar la performance con hamlit --- Gemfile | 3 ++- Gemfile.lock | 30 +++++++++++++++++------------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/Gemfile b/Gemfile index 3bf8e93..672b002 100644 --- a/Gemfile +++ b/Gemfile @@ -46,7 +46,7 @@ gem 'email_address' gem 'exception_notification' gem 'font-awesome-rails' gem 'friendly_id' -gem 'haml-rails' +gem 'hamlit-rails' gem 'jekyll' gem 'jquery-rails' gem 'mini_magick' @@ -78,6 +78,7 @@ group :development do gem 'capistrano-rails' gem 'capistrano-rbenv' gem 'ed25519' + gem 'haml-lint', require: false gem 'letter_opener' gem 'rbnacl', '< 5.0' gem 'rubocop-rails' diff --git a/Gemfile.lock b/Gemfile.lock index 872f4c9..bef6cfc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -122,7 +122,6 @@ GEM netaddr (~> 2.0) simpleidn erubi (1.8.0) - erubis (2.7.0) eventmachine (1.2.7) exception_notification (4.3.0) actionmailer (>= 4.0, < 6) @@ -145,17 +144,23 @@ GEM haml (5.0.4) temple (>= 0.8.0) tilt - haml-rails (1.0.0) + haml-lint (0.999.999) + haml_lint + haml_lint (0.32.0) + haml (>= 4.0, < 5.2) + rainbow + rake (>= 10, < 13) + rubocop (>= 0.50.0) + sysexits (~> 1.1) + hamlit (2.9.3) + temple (>= 0.8.0) + thor + tilt + hamlit-rails (0.2.3) actionpack (>= 4.0.1) activesupport (>= 4.0.1) - haml (>= 4.0.6, < 6.0) - html2haml (>= 1.0.1) + hamlit (>= 1.2.0) railties (>= 4.0.1) - html2haml (2.2.0) - erubis (~> 2.7.0) - haml (>= 4.0, < 6) - nokogiri (>= 1.6.0) - ruby_parser (~> 3.5) http_parser.rb (0.6.0) i18n (0.9.5) concurrent-ruby (~> 1.0) @@ -290,8 +295,6 @@ GEM i18n ruby-progressbar (1.10.1) ruby_dep (1.5.0) - ruby_parser (3.13.1) - sexp_processor (~> 4.9) rubyzip (1.2.2) rugged (0.28.2) safe_yaml (1.0.5) @@ -318,7 +321,6 @@ GEM selenium-webdriver (3.141.0) childprocess (~> 0.5) rubyzip (~> 1.2, >= 1.2.2) - sexp_processor (4.12.0) simpleidn (0.1.1) unf (~> 0.1.4) spring (2.0.2) @@ -337,6 +339,7 @@ GEM sshkit (1.18.2) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) + sysexits (1.2.0) temple (0.8.1) thor (0.20.3) thread_safe (0.3.6) @@ -398,7 +401,8 @@ DEPENDENCIES factory_bot_rails font-awesome-rails friendly_id - haml-rails + haml-lint + hamlit-rails jbuilder (~> 2.5) jekyll jquery-rails From cff18bf8612920b5ba9eb634c86b0329e8b1ad5d Mon Sep 17 00:00:00 2001 From: f Date: Tue, 16 Jul 2019 16:47:44 -0300 Subject: [PATCH 12/44] poder actualizar el sitio a partir del skel --- app/controllers/sites_controller.rb | 20 ++++++++ app/models/site.rb | 12 +++++ app/models/site/repository.rb | 78 +++++++++++++++++++++++++++++ app/models/usuarie.rb | 4 ++ app/policies/site_policy.rb | 12 +++++ app/views/layouts/_time.haml | 1 + app/views/sites/fetch.haml | 34 +++++++++++++ app/views/sites/index.haml | 21 +++++--- config/locales/en.yml | 10 ++++ config/locales/es.yml | 10 ++++ config/routes.rb | 6 +++ doc/crear_sitios.md | 53 +++++++++++++++++++- test/models/site/repository_test.rb | 37 ++++++++++++++ 13 files changed, 289 insertions(+), 9 deletions(-) create mode 100644 app/models/site/repository.rb create mode 100644 app/views/layouts/_time.haml create mode 100644 app/views/sites/fetch.haml create mode 100644 test/models/site/repository_test.rb diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb index 42fbaba..ec7ad31 100644 --- a/app/controllers/sites_controller.rb +++ b/app/controllers/sites_controller.rb @@ -114,6 +114,26 @@ class SitesController < ApplicationController redirect_to site_posts_path @site end + def fetch + @site = find_site + authorize @site + + @commits = @site.repository.commits + end + + def merge + @site = find_site + authorize @site + + if @site.repository.merge(current_usuarie) + flash[:success] = I18n.t('sites.fetch.merge.success') + else + flash[:error] = I18n.t('sites.fetch.merge.error') + end + + redirect_to sites_path + end + private def site_params diff --git a/app/models/site.rb b/app/models/site.rb index ac449f9..24f80b0 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -28,6 +28,18 @@ class Site < ApplicationRecord attr_accessor :jekyll, :collections + # El repositorio git para este sitio + def repository + @repository ||= Site::Repository.new path + end + + # Trae los cambios del skel y verifica que haya cambios + def needs_pull? + !repository.commits.empty? + end + + # TODO: Mover esta consulta a la base de datos para no traer un montón + # de cosas a la memoria def invitade?(usuarie) invitades.pluck(:id).include? usuarie.id end diff --git a/app/models/site/repository.rb b/app/models/site/repository.rb new file mode 100644 index 0000000..e8d49c0 --- /dev/null +++ b/app/models/site/repository.rb @@ -0,0 +1,78 @@ +# frozen_string_literal: true + +class Site + # Acciones para el repositorio Git de un sitio. Por ahora hacemos un + # uso muy básico de Git, con lo que asumimos varias cosas, por ejemplo + # que un sitio tiene un solo origen, que siempre se trabaja con la + # rama master, etc. + class Repository + attr_reader :rugged, :changes + + def initialize(path) + @rugged = Rugged::Repository.new(path) + @changes = 0 + end + + def remote + @remote ||= rugged.remotes.first + end + + # Trae los cambios del repositorio de origen sin aplicarlos y + def fetch + if remote.check_connection :fetch + @changes = rugged.fetch(remote)[:received_objects] + else + 0 + end + end + + # Incorpora los cambios en el repositorio actual + # + # rubocop:disable Metrics/AbcSize + # rubocop:disable Metrics/MethodLength + def merge(author) + master = rugged.branches['master'].target + origin = rugged.branches['origin/master'].target + merge = rugged.merge_commits(master, origin) + + # No hacemos nada si hay conflictos + # + # TODO: Enviar un correo a administración para poder revisar + # manualmente. Idealmente no deberíamos tener conflictos pero + # quién sabe. + return if merge.conflicts? + + author = { name: author.name, email: author.email } + commit = Rugged::Commit + .create(rugged, + parents: [master, origin], + tree: merge.write_tree(rugged), + message: I18n.t('sites.fetch.merge.message'), + author: author, + committer: author, + update_ref: 'HEAD') + + # Forzamos el checkout para mover el HEAD al último commit y + # escribir los cambios + rugged.checkout 'HEAD', strategy: :force + commit + end + # rubocop:enable Metrics/AbcSize + # rubocop:enable Metrics/MethodLength + + # Compara los commits entre el repositorio remoto y el actual para + # que luego los podamos mostrar. + def commits + walker = Rugged::Walker.new rugged + + # Obtenemos todos los commits que existen en origin/master que no + # están en la rama master local + # + # XXX: monitorear esto por performance + walker.push 'refs/remotes/origin/master' + walker.hide 'refs/heads/master' + + walker.each.to_a + end + end +end diff --git a/app/models/usuarie.rb b/app/models/usuarie.rb index a1a2be7..c2704a1 100644 --- a/app/models/usuarie.rb +++ b/app/models/usuarie.rb @@ -11,6 +11,10 @@ class Usuarie < ApplicationRecord has_many :roles has_many :sites, through: :roles + def name + email.split('@', 2).first + end + def rol_for_site(site) site.roles.merge(roles).first end diff --git a/app/policies/site_policy.rb b/app/policies/site_policy.rb index 900c8f5..702d41c 100644 --- a/app/policies/site_policy.rb +++ b/app/policies/site_policy.rb @@ -63,6 +63,18 @@ class SitePolicy build? end + def pull? + build? + end + + def fetch? + pull? + end + + def merge? + pull? + end + private def current_role diff --git a/app/views/layouts/_time.haml b/app/views/layouts/_time.haml new file mode 100644 index 0000000..4fa3151 --- /dev/null +++ b/app/views/layouts/_time.haml @@ -0,0 +1 @@ +%time{ datetime: time, title: time }= time_ago_in_words time diff --git a/app/views/sites/fetch.haml b/app/views/sites/fetch.haml new file mode 100644 index 0000000..ac6c66b --- /dev/null +++ b/app/views/sites/fetch.haml @@ -0,0 +1,34 @@ +.row + .col + = render 'layouts/breadcrumb', + crumbs: [link_to(t('sites.index'), sites_path), t('.title')] +.row.justify-content-center + .col-md-8#pull + %h1= t('.title') + %p.lead= sanitize_markdown t('.help.fetch'), tags: %w[em strong a] + + %h2= t('.toc') + %ul.toc + - @commits.each do |commit| + %li= link_to commit.summary, "##{commit.oid}" + +- @commits.each do |commit| + .row.justify-content-center + .col-md-8{ id: commit.oid } + %h1= commit.summary + %p.lead= render 'layouts/time', time: commit.time + + -# + No hay forma de obtener el cuerpo del commit separado del + resumen, cortamos por el primer salto de línea doble y obtenemos + todo lo demás + = sanitize_markdown commit.message.split("\n\n", 2).last, + tags: %w[p a h1 h2 h3 h4 h5 h6 ol ul li strong em] + + %hr + +- unless @commits.empty? + .row.justify-content-center + .col-md-8 + = link_to t('.merge.request'), site_pull_path(@site), + method: 'post', class: 'btn btn-lg btn-success' diff --git a/app/views/sites/index.haml b/app/views/sites/index.haml index b1085ca..d082408 100644 --- a/app/views/sites/index.haml +++ b/app/views/sites/index.haml @@ -1,7 +1,6 @@ - .row .col - = render 'layouts/breadcrumb', crumbs: [ t('sites.index') ] + = render 'layouts/breadcrumb', crumbs: [t('sites.index')] .row .col %h1 @@ -20,14 +19,15 @@ %h2 - if policy(site).show? = link_to site.name, site_path(site) - - else + - else = site.name - if site.invitade? current_usuarie - %span.badge.badge-warning{data: { toggle: 'tooltip' }, - title: t('help.sites.invitade')} + %span.badge.badge-warning{ data: { toggle: 'tooltip' }, + title: t('help.sites.invitade') } = t('.invitade') %br - .btn-group{role: 'group', 'aria-label': t('sites.actions')} + .btn-group{ role: 'group', + 'aria-label': t('sites.actions') } - if current_usuarie.rol_for_site(site).temporal = button_to t('sites.invitations.accept'), site_usuaries_accept_invitation_path(site), @@ -68,7 +68,8 @@ type: 'secondary', link: nil - else - = form_tag site_enqueue_path(site), method: :post, class: 'form-inline' do + = form_tag site_enqueue_path(site), + method: :post, class: 'form-inline' do = button_tag type: 'submit', class: 'btn btn-success', title: t('help.sites.enqueue'), @@ -85,3 +86,9 @@ text: t('sites.build_log'), type: 'warning', link: site_build_log_path(site) + - if policy(site).pull? && site.needs_pull? + = render 'layouts/btn_with_tooltip', + tooltip: t('help.sites.pull'), + text: t('.pull'), + type: 'info', + link: site_pull_path(site) diff --git a/config/locales/en.yml b/config/locales/en.yml index 64bde6b..8f64db9 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -158,6 +158,16 @@ en: edit: title: 'Edit %{site}' submit: 'Save changes' + fetch: + title: 'Upgrade the site' + help: + fetch: 'Any changes made to the site are saved into a _git_ repository. Git saves the differences between previous and current versions of files so we can explore them as the history of the project. Also, we can bring and send changes between repositories. In this case, every site managed with Sutty share a common root that we call [skeleton](https://0xacab.org/sutty/skel.sutty.nl). When we upgrade this skeleton, you can explore the changes here and accept them to make your site better.' + toc: 'Table of contents' + merge: + request: 'Upgrade my site with these changes' + success: 'Site upgrade has been completed. Your next build will run this upgrade :)' + error: "There was an error when we were trying to upgrade your site. This could be due to conflicts that couldn't be solved automatically. We've sent a report of the issue to Sutty's admins so they already know about it. Sorry! :(" + message: 'Skeleton upgrade' footer: powered_by: 'is developed by' templates: diff --git a/config/locales/es.yml b/config/locales/es.yml index b0fa8ef..fc37c16 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -163,6 +163,16 @@ es: edit: title: 'Editar %{site}' submit: 'Guardar cambios' + fetch: + title: 'Actualizar el sitio' + help: + fetch: 'Todos los cambios en el sitio se guardan en un repositorio _git_. En git, se guarda la diferencia entre una versión anterior y la actual de todos los archivos y podemos explorar la historia de un proyecto. Además, podemos traer y enviar cambios con otros repositorios. En este caso, todos los sitios gestionados desde Sutty tienen una raíz común, que llamamos [esqueleto](https://0xacab.org/sutty/skel.sutty.nl). Cuando hacemos cambios en el esqueleto para mejorar los sitios, podés explorar los cambios aquí y aceptarlos.' + toc: 'Tabla de contenidos' + merge: + request: 'Incorporar los cambios en mi sitio' + success: 'Ya se incorporaron los cambios en el sitio, se aplicarán en la próxima compilación que hagas :)' + error: 'Hubo un error al incorporar los cambios en el sitio. Esto puede deberse a conflictos entre cambios que no se pueden resolver automáticamente. Hemos enviado un reporte del problema a les administradores de Sutty para que estén al tanto de la situación. ¡Lo sentimos! :(' + message: 'Actualización del esqueleto' footer: powered_by: 'es desarrollada por' i18n: diff --git a/config/routes.rb b/config/routes.rb index 086fe8c..3b70187 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +# rubocop:disable Metrics/BlockLength Rails.application.routes.draw do devise_for :usuaries @@ -14,6 +15,10 @@ Rails.application.routes.draw do resources :sites, constraints: { site_id: %r{[^/]+}, id: %r{[^/]+} } do get 'public/:type/:basename', to: 'sites#send_public_file' + # Gestionar actualizaciones del sitio + get 'pull', to: 'sites#fetch' + post 'pull', to: 'sites#merge' + # Gestionar usuaries get 'usuaries/invite', to: 'usuaries#invite' post 'usuaries/invite', to: 'usuaries#send_invitations' @@ -41,3 +46,4 @@ Rails.application.routes.draw do post 'reorder_posts', to: 'sites#reorder_posts' end end +# rubocop:enable Metrics/BlockLength diff --git a/doc/crear_sitios.md b/doc/crear_sitios.md index e7cc3ed..b89e192 100644 --- a/doc/crear_sitios.md +++ b/doc/crear_sitios.md @@ -96,9 +96,9 @@ El sitio esqueleto es un repositorio Git que se clona al directorio del sitio. Esto permite luego pullear actualizaciones desde el esqueleto a los sitios, esperamos que sin conflictos! -## Plantillas +## Diseño -Las plantillas son plantillas Jekyll adaptadas a Sutty. Vamos a empezar +Los diseños son plantillas Jekyll adaptadas a Sutty. Vamos a empezar adaptando las que estén disponibles en y otras fuentes, agregando features de Sutty y simplificando donde haga falta (algunas plantillas tienen requisitos extraños). @@ -113,3 +113,52 @@ eliminarlo, eliminar el directorio. Lo correcto sería preguntar a todes les usuaries si están de acuerdo en borrar el sitio. Si una no está de acuerdo, el borrado se cancela. + +### Licencias + +Las licencias disponibles se pueden gestionar desde la base de datos. +Los atributos son: + +* Titulo +* URL +* Descripción, por qué la recomendamos, etc. + +El problema que tenemos es que las queremos tener traducidas, entonces +hay varias opciones: + +* Incorporar columna idioma en la base de datos y cada vez que se + muestren las licencias filtrar por idioma actual (o idioma por + defecto). + + Esto nos permitiría ofrecer licencias por jurisdicción también, aunque + empezaríamos con las internacionales... + +* Incorporar la gema de traducción y poner las traducciones en la base + de datos. Esto permite tener una sola licencia con sus distintas + traducciones en un solo registro. + + Pensábamos que necesitábamos cambiar a PostgreSQL, pero la gema + [Mobility](https://github.com/shioyama/mobility) permite usar + distintas estrategias. + +* Incorporar las traducciones a los locales de sutty. Esta es la opción + menos flexible, porque implica agregar licencias a la base de datos y + al mismo tiempo actualizar los archivos y re-deployear Sutty... mejor + no. + +Pero es importante que estén asociadas entre sí por idioma. + +Permitir que les usuaries elijan licencia+privacidad+codigo de +convivencia e informarles que van a ser los primeros artículos dentro de +su sitio y que los pueden modificar después. Que esta es nuestra +propuesta tecnopolítica para que los espacios digitales y analógicos +sean espacios amables siguiente una lógica de cuidados colectivos. + +## Actualizar skel + +Cuando actualizamos el skel, sutty pide a todos los sitios +consentimiento para aplicar las actualizaciones. Antes de aplicar las +actualizaciones muestra el historial para que les usuaries vean cuales +son los cambios que se van a aplicar. Este historial viene del +repositorio git con lo que tenemos que tomarnos la costumbre de escribir +commits completos con explicación. diff --git a/test/models/site/repository_test.rb b/test/models/site/repository_test.rb new file mode 100644 index 0000000..f23925a --- /dev/null +++ b/test/models/site/repository_test.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +class RepositoryTest < ActiveSupport::TestCase + setup do + @rol = create :rol + @site = @rol.site + @usuarie = @rol.usuarie + + # Volver al principio para poder traer cambios + Dir.chdir(@site.path) do + `git reset --hard e0627e34c6ef6ae2592d7f289b82def20ba56685` + end + end + + teardown do + @site.destroy + end + + test 'se pueden traer cambios' do + assert @site.repository.fetch.is_a?(Integer) + end + + test 'se pueden mergear los cambios' do + assert !@site.repository.commits.empty? + assert @site.repository.merge(@usuarie) + assert @site.repository.commits.empty? + + assert_equal @usuarie.name, + @site.repository.rugged + .branches['master'].target.committer[:name] + + Dir.chdir(@site.path) do + assert_equal 'nothing to commit, working tree clean', + `LC_ALL=C git status`.strip.split("\n").last + end + end +end From 1cc4c4de643867f91aa75351ed7bb2d14697bee2 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 17 Jul 2019 19:18:48 -0300 Subject: [PATCH 13/44] =?UTF-8?q?WIP:=20elegir=20el=20dise=C3=B1o=20del=20?= =?UTF-8?q?sitio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 1 + Gemfile.lock | 8 +- app/controllers/sites_controller.rb | 2 +- app/models/design.rb | 19 ++++ app/models/site.rb | 3 + app/views/sites/_form.haml | 27 +++++- app/views/sites/edit.haml | 2 +- app/views/sites/new.haml | 2 +- config/initializers/mobility.rb | 97 +++++++++++++++++++ config/locales/en.yml | 9 ++ config/locales/es.yml | 9 ++ db/migrate/20190716195155_create_designs.rb | 15 +++ .../20190716195449_add_lang_to_usuaries.rb | 9 ++ ...20190716195811_create_text_translations.rb | 16 +++ ...190716195812_create_string_translations.rb | 17 ++++ .../20190716202024_add_design_to_sites.rb | 8 ++ .../20190717214308_add_disabled_to_designs.rb | 8 ++ db/schema.rb | 41 +++++++- db/seeds.rb | 14 +-- db/seeds/designs.yml | 22 +++++ test/controllers/sites_controller_test.rb | 3 +- test/factories/design.rb | 12 +++ test/factories/site.rb | 1 + test/models/design_test.rb | 10 ++ test/models/site_test.rb | 12 ++- 25 files changed, 348 insertions(+), 19 deletions(-) create mode 100644 app/models/design.rb create mode 100644 config/initializers/mobility.rb create mode 100644 db/migrate/20190716195155_create_designs.rb create mode 100644 db/migrate/20190716195449_add_lang_to_usuaries.rb create mode 100644 db/migrate/20190716195811_create_text_translations.rb create mode 100644 db/migrate/20190716195812_create_string_translations.rb create mode 100644 db/migrate/20190716202024_add_design_to_sites.rb create mode 100644 db/migrate/20190717214308_add_disabled_to_designs.rb create mode 100644 db/seeds/designs.yml create mode 100644 test/factories/design.rb create mode 100644 test/models/design_test.rb diff --git a/Gemfile b/Gemfile index 672b002..537cabc 100644 --- a/Gemfile +++ b/Gemfile @@ -50,6 +50,7 @@ gem 'hamlit-rails' gem 'jekyll' gem 'jquery-rails' gem 'mini_magick' +gem 'mobility' gem 'pundit' gem 'rails-i18n' gem 'rails_warden' diff --git a/Gemfile.lock b/Gemfile.lock index bef6cfc..7941b03 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -212,10 +212,13 @@ GEM mime-types-data (~> 3.2015) mime-types-data (3.2018.0812) mimemagic (0.3.3) - mini_magick (4.9.3) + mini_magick (4.9.4) mini_mime (1.0.1) mini_portile2 (2.4.0) minitest (5.11.3) + mobility (0.8.7) + i18n (>= 0.6.10, < 2) + request_store (~> 1.0) multi_json (1.13.1) net-scp (2.0.0) net-ssh (>= 2.6.5, < 6.0.0) @@ -277,6 +280,8 @@ GEM ffi (~> 1.0) rbnacl (4.0.2) ffi + request_store (1.4.1) + rack (>= 1.4) responders (3.0.0) actionpack (>= 5.0) railties (>= 5.0) @@ -409,6 +414,7 @@ DEPENDENCIES letter_opener listen (>= 3.0.5, < 3.2) mini_magick + mobility pry puma (~> 3.7) pundit diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb index ec7ad31..f3e2a6d 100644 --- a/app/controllers/sites_controller.rb +++ b/app/controllers/sites_controller.rb @@ -137,6 +137,6 @@ class SitesController < ApplicationController private def site_params - params.require(:site).permit(:name) + params.require(:site).permit(:name, :design_id) end end diff --git a/app/models/design.rb b/app/models/design.rb new file mode 100644 index 0000000..aeacb79 --- /dev/null +++ b/app/models/design.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +# El diseño de un sitio es la plantilla/tema. En este modelo cargamos +# las propiedades para poder verlas desde el panel y elegir un diseño +# para el sitio. +# +# TODO: Agregar captura de pantalla con ActiveStorage +class Design < ApplicationRecord + extend Mobility + + translates :name, type: :string, locale_accessors: true + translates :description, type: :text, locale_accessors: true + + has_many :sites + + validates :name, presence: true, uniqueness: true + validates :gem, presence: true, uniqueness: true + validates :description, presence: true +end diff --git a/app/models/site.rb b/app/models/site.rb index 24f80b0..0ed363a 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -6,9 +6,12 @@ class Site < ApplicationRecord include FriendlyId validates :name, uniqueness: true, hostname: true + validates :design_id, presence: true friendly_id :name, use: %i[finders] + belongs_to :design + has_many :roles has_many :usuaries, -> { where('roles.rol = ?', 'usuarie') }, through: :roles diff --git a/app/views/sites/_form.haml b/app/views/sites/_form.haml index 1f5650b..927cd2e 100644 --- a/app/views/sites/_form.haml +++ b/app/views/sites/_form.haml @@ -1,6 +1,29 @@ -= form_for @site do |f| += form_for site do |f| .form-group - = f.label :name + %h2= f.label :name + %p.lead= t('.help.name') = f.text_field :name, class: 'form-control' + .form-group + %h2= t('.design.title') + %p.lead= t('.help.design') + .row + -# Demasiado complejo para un f.collection_radio_buttons + - Design.all.each do |design| + .col + %h3 + = f.radio_button :design_id, design.id, + checked: design.id == site.design_id, + disabled: design.disabled + = f.label "design_id_#{design.id}", design.name + = sanitize_markdown design.description, + tags: %w[p a strong em] + + .btn-group{ role: 'group', 'aria-label': t('.design.actions') } + - if design.url + = link_to t('.design.url'), design.url, + target: '_blank', class: 'btn btn-info' + - if design.license + = link_to t('.design.license'), design.license, + target: '_blank', class: 'btn btn-info' .form-group = f.submit submit, class: 'btn btn-success' diff --git a/app/views/sites/edit.haml b/app/views/sites/edit.haml index a7e96a1..a461bb5 100644 --- a/app/views/sites/edit.haml +++ b/app/views/sites/edit.haml @@ -7,4 +7,4 @@ .col %h1= t('.title', site: @site.name) - = render 'form', submit: t('.submit') + = render 'form', site: @site, submit: t('.submit') diff --git a/app/views/sites/new.haml b/app/views/sites/new.haml index 0b883c1..b5760f3 100644 --- a/app/views/sites/new.haml +++ b/app/views/sites/new.haml @@ -6,4 +6,4 @@ .col %h1= t('.title') - = render 'form', submit: t('.submit') + = render 'form', site: @site, submit: t('.submit') diff --git a/config/initializers/mobility.rb b/config/initializers/mobility.rb new file mode 100644 index 0000000..8176045 --- /dev/null +++ b/config/initializers/mobility.rb @@ -0,0 +1,97 @@ +# frozen_string_literal: true + +Mobility.configure do |config| + # Sets the default backend to use in models. This can be overridden in + # models by passing +backend: ...+ to +translates+. + config.default_backend = :key_value + + # By default, Mobility uses the +translates+ class method in models to + # describe translated attributes, but you can configure this method to + # be whatever you like. This may be useful if using Mobility alongside + # another translation gem which uses the same method name. + config.accessor_method = :translates + + # To query on translated attributes, you need to append a scope to + # your model. The name of this scope is +i18n+ by default, but this + # can be changed to something else. + config.query_method = :i18n + + # Uncomment and remove (or add) items to (from) this list to + # completely disable/enable plugins globally (so they cannot be used + # and are never even loaded). Note that if you remove an item from the + # list, you will not be able to use the plugin at all, and any options + # for the plugin will be ignored by models. (In most cases, you + # probably don't want to change this.) + # + # config.plugins = %i[ + # query + # cache + # dirty + # fallbacks + # presence + # default + # attribute_methods + # fallthrough_accessors + # locale_accessors + # ] + + # The translation cache is on by default, but you can turn it off by + # uncommenting this line. (This may be helpful in debugging.) + # + # config.default_options[:cache] = false + + # Dirty tracking is disabled by default. Uncomment this line to enable + # it. If you enable this, you should also enable +locale_accessors+ + # by default (see below). + # + # config.default_options[:dirty] = true + + # No fallbacks are used by default. To define default fallbacks, + # uncomment and set the default fallback option value here. A "true" + # value will use whatever is defined by +I18n.fallbacks+ (if defined), + # or alternatively will fallback to your +I18n.default_locale+. + # + config.default_options[:fallbacks] = true + + # The Presence plugin converts empty strings to nil when fetching and + # setting translations. By default it is on, uncomment this line to + # turn it off. + # + # config.default_options[:presence] = false + + # Set a default value to use if the translation is nil. By default + # this is off, uncomment and set a default to use it across all models + # (you probably don't want to do that). + # + # config.default_options[:default] = ... + + # Uncomment to enable locale_accessors by default on models. A true + # value will use the locales defined either in + # Rails.application.config.i18n.available_locales or + # I18n.available_locales. If you want something else, pass an array + # of locales instead. + # + # config.default_options[:locale_accessors] = true + + # Uncomment to enable fallthrough accessors by default on models. This + # will allow you to call any method with a suffix like _en or _pt_br, + # and Mobility will catch the suffix and convert it into a locale in + # +method_missing+. If you don't need this kind of open-ended + # fallthrough behavior, it's better to use locale_accessors instead + # (which define methods) since method_missing is very slow. (You can + # use both fallthrough and locale accessor plugins together without + # conflict.) + # + # Note: The dirty plugin enables fallthrough_accessors by default. + # + # config.default_options[:fallthrough_accessors] = true + + # You can also include backend-specific default options. For example, + # if you want to default to using the text-type translation table with + # the KeyValue backend, you can set that as a default by uncommenting + # this line, or change it to :string to default to the string-type + # translation table instead. (For other backends, this option is + # ignored.) + # + # config.default_options[:type] = :text +end diff --git a/config/locales/en.yml b/config/locales/en.yml index 8f64db9..cdb5a45 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -158,6 +158,15 @@ en: edit: title: 'Edit %{site}' submit: 'Save changes' + form: + help: + name: "Your site's name. It can only contain numbers and letters." + design: 'Select the design for your site. You can change it later. We add more designs from time to time.' + design: + title: 'Design' + actions: 'Information about this design' + url: 'Preview' + licencia: 'Read the license' fetch: title: 'Upgrade the site' help: diff --git a/config/locales/es.yml b/config/locales/es.yml index fc37c16..5cf84bd 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -163,6 +163,15 @@ es: edit: title: 'Editar %{site}' submit: 'Guardar cambios' + form: + help: + name: 'El nombre de tu sitio. Solo puede contener letras y números.' + design: 'Elegí el diseño que va a tener tu sitio aquí. Podés cambiarlo luego. De tanto en tanto vamos sumando diseños nuevos.' + design: + title: 'Diseño' + actions: 'Información sobre este diseño' + url: 'Vista previa' + licencia: 'Leer la licencia' fetch: title: 'Actualizar el sitio' help: diff --git a/db/migrate/20190716195155_create_designs.rb b/db/migrate/20190716195155_create_designs.rb new file mode 100644 index 0000000..b040749 --- /dev/null +++ b/db/migrate/20190716195155_create_designs.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +# Crea la tabla de diseños +class CreateDesigns < ActiveRecord::Migration[5.2] + def change + create_table :designs do |t| + t.timestamps + t.string :name, unique: true + t.text :description + t.string :gem, unique: true + t.string :url + t.string :license + end + end +end diff --git a/db/migrate/20190716195449_add_lang_to_usuaries.rb b/db/migrate/20190716195449_add_lang_to_usuaries.rb new file mode 100644 index 0000000..598de77 --- /dev/null +++ b/db/migrate/20190716195449_add_lang_to_usuaries.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# Agrega la columna de idioma a cada usuarie para que pueda ver el sitio +# y escribir artículos en su idioma. +class AddLangToUsuaries < ActiveRecord::Migration[5.2] + def change + add_column :usuaries, :lang, :string, default: 'es' + end +end diff --git a/db/migrate/20190716195811_create_text_translations.rb b/db/migrate/20190716195811_create_text_translations.rb new file mode 100644 index 0000000..caa129f --- /dev/null +++ b/db/migrate/20190716195811_create_text_translations.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +# Tabla de traducción de textos utilizada por Mobility +class CreateTextTranslations < ActiveRecord::Migration[5.2] + def change + create_table :mobility_text_translations do |t| + t.string :locale, null: false + t.string :key, null: false + t.text :value + t.references :translatable, polymorphic: true, index: false + t.timestamps null: false + end + add_index :mobility_text_translations, %i[translatable_id translatable_type locale key], unique: true, name: :index_mobility_text_translations_on_keys + add_index :mobility_text_translations, %i[translatable_id translatable_type key], name: :index_mobility_text_translations_on_translatable_attribute + end +end diff --git a/db/migrate/20190716195812_create_string_translations.rb b/db/migrate/20190716195812_create_string_translations.rb new file mode 100644 index 0000000..5389e02 --- /dev/null +++ b/db/migrate/20190716195812_create_string_translations.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +# Tabla de traducción de cadenas usada por Mobility +class CreateStringTranslations < ActiveRecord::Migration[5.2] + def change + create_table :mobility_string_translations do |t| + t.string :locale, null: false + t.string :key, null: false + t.string :value + t.references :translatable, polymorphic: true, index: false + t.timestamps null: false + end + add_index :mobility_string_translations, %i[translatable_id translatable_type locale key], unique: true, name: :index_mobility_string_translations_on_keys + add_index :mobility_string_translations, %i[translatable_id translatable_type key], name: :index_mobility_string_translations_on_translatable_attribute + add_index :mobility_string_translations, %i[translatable_type key value locale], name: :index_mobility_string_translations_on_query_keys + end +end diff --git a/db/migrate/20190716202024_add_design_to_sites.rb b/db/migrate/20190716202024_add_design_to_sites.rb new file mode 100644 index 0000000..44958ea --- /dev/null +++ b/db/migrate/20190716202024_add_design_to_sites.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +# Los sitios tienen un diseño +class AddDesignToSites < ActiveRecord::Migration[5.2] + def change + add_belongs_to :sites, :design, index: true + end +end diff --git a/db/migrate/20190717214308_add_disabled_to_designs.rb b/db/migrate/20190717214308_add_disabled_to_designs.rb new file mode 100644 index 0000000..6432e34 --- /dev/null +++ b/db/migrate/20190717214308_add_disabled_to_designs.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +# Algunos diseños están deshabilitados +class AddDisabledToDesigns < ActiveRecord::Migration[5.2] + def change + add_column :designs, :disabled, :boolean, default: false + end +end diff --git a/db/schema.rb b/db/schema.rb index 98e398c..0d9fb79 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -12,7 +12,43 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20_190_712_165_059) do +ActiveRecord::Schema.define(version: 20_190_717_214_308) do + create_table 'designs', force: :cascade do |t| + t.datetime 'created_at', null: false + t.datetime 'updated_at', null: false + t.string 'name' + t.text 'description' + t.string 'gem' + t.string 'url' + t.string 'license' + t.boolean 'disabled', default: false + end + + create_table 'mobility_string_translations', force: :cascade do |t| + t.string 'locale', null: false + t.string 'key', null: false + t.string 'value' + t.string 'translatable_type' + t.integer 'translatable_id' + t.datetime 'created_at', null: false + t.datetime 'updated_at', null: false + t.index %w[translatable_id translatable_type key], name: 'index_mobility_string_translations_on_translatable_attribute' + t.index %w[translatable_id translatable_type locale key], name: 'index_mobility_string_translations_on_keys', unique: true + t.index %w[translatable_type key value locale], name: 'index_mobility_string_translations_on_query_keys' + end + + create_table 'mobility_text_translations', force: :cascade do |t| + t.string 'locale', null: false + t.string 'key', null: false + t.text 'value' + t.string 'translatable_type' + t.integer 'translatable_id' + t.datetime 'created_at', null: false + t.datetime 'updated_at', null: false + t.index %w[translatable_id translatable_type key], name: 'index_mobility_text_translations_on_translatable_attribute' + t.index %w[translatable_id translatable_type locale key], name: 'index_mobility_text_translations_on_keys', unique: true + end + create_table 'roles', force: :cascade do |t| t.datetime 'created_at', null: false t.datetime 'updated_at', null: false @@ -29,6 +65,8 @@ ActiveRecord::Schema.define(version: 20_190_712_165_059) do t.datetime 'created_at', null: false t.datetime 'updated_at', null: false t.string 'name' + t.integer 'design_id' + t.index ['design_id'], name: 'index_sites_on_design_id' t.index ['name'], name: 'index_sites_on_name', unique: true end @@ -56,6 +94,7 @@ ActiveRecord::Schema.define(version: 20_190_712_165_059) do t.string 'invited_by_type' t.integer 'invited_by_id' t.integer 'invitations_count', default: 0 + t.string 'lang', default: 'es' t.index ['confirmation_token'], name: 'index_usuaries_on_confirmation_token', unique: true t.index ['email'], name: 'index_usuaries_on_email', unique: true t.index ['invitation_token'], name: 'index_usuaries_on_invitation_token', unique: true diff --git a/db/seeds.rb b/db/seeds.rb index ebd1889..9e3d2c5 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,9 +1,9 @@ # frozen_string_literal: true -# This file should contain all the record creation needed to seed the database with its default values. -# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). -# -# Examples: -# -# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) -# Character.create(name: 'Luke', movie: movies.first) +designs = YAML.safe_load(File.read('db/seeds/designs.yml')) + +designs.each do |d| + design = Design.find_or_create_by(gem: d['gem']) + + design.update_attributes d +end diff --git a/db/seeds/designs.yml b/db/seeds/designs.yml new file mode 100644 index 0000000..26f2e9a --- /dev/null +++ b/db/seeds/designs.yml @@ -0,0 +1,22 @@ +--- +- name_en: 'My own design' + name_es: 'Mi propio diseño' + gem: 'sutty-theme-none' + url: 'https://sutty.nl' + disabled: true + description_en: "Your own design. [This feature is in development, help us!]()" + description_es: "Tu propio diseño. [Esta posibilidad está en desarrollo, ¡ayudanos!]()" +- name_en: 'Minima' + name_es: 'Mínima' + gem: 'minima' + url: 'https://jekyll.github.io/minima/' + description_en: "Minima is the default design for Jekyll sites. It's made for general-purpose writing." + description_es: 'Mínima es el diseño oficial de los sitios Jekyll, hecho para escritura de propósitos generales.' + license: 'https://github.com/jekyll/minima/blob/master/LICENSE.txt' +- name_en: 'EDSL' + name_es: 'EDSL' + gem: 'sutty-theme-edsl' + url: 'https://endefensadelsl.org/' + description_en: "_En defensa del software libre_'s design" + description_es: 'El diseño de En defensa del software libre' + license: 'https://endefensadelsl.org/ppl_deed_es.html' diff --git a/test/controllers/sites_controller_test.rb b/test/controllers/sites_controller_test.rb index 2c3c334..058d20b 100644 --- a/test/controllers/sites_controller_test.rb +++ b/test/controllers/sites_controller_test.rb @@ -33,7 +33,8 @@ class SitesControllerTest < ActionDispatch::IntegrationTest post sites_url, headers: @authorization, params: { site: { - name: name + name: name, + design_id: create(:design).id } } diff --git a/test/factories/design.rb b/test/factories/design.rb new file mode 100644 index 0000000..b210b3a --- /dev/null +++ b/test/factories/design.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +FactoryBot.define do + factory :design do + name { SecureRandom.hex } + description { SecureRandom.hex } + license { SecureRandom.hex } + gem { SecureRandom.hex } + url { SecureRandom.hex } + disabled { false } + end +end diff --git a/test/factories/site.rb b/test/factories/site.rb index 9d80180..3593c9f 100644 --- a/test/factories/site.rb +++ b/test/factories/site.rb @@ -3,5 +3,6 @@ FactoryBot.define do factory :site do name { "test-#{SecureRandom.hex}" } + design end end diff --git a/test/models/design_test.rb b/test/models/design_test.rb new file mode 100644 index 0000000..000be74 --- /dev/null +++ b/test/models/design_test.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class DesignTest < ActiveSupport::TestCase + test 'se pueden crear' do + design = create :design + + assert design.valid? + assert design.persisted? + end +end diff --git a/test/models/site_test.rb b/test/models/site_test.rb index 2040bd9..b74daaf 100644 --- a/test/models/site_test.rb +++ b/test/models/site_test.rb @@ -27,26 +27,30 @@ class SiteTest < ActiveSupport::TestCase test 'el nombre del sitio puede contener subdominios' do site = build :site, name: 'hola.chau' + site.validate - assert site.valid? + assert_not site.errors.messages[:name].present? end test 'el nombre del sitio no puede terminar con punto' do site = build :site, name: 'hola.chau.' + site.validate - assert_not site.valid? + assert site.errors.messages[:name].present? end test 'el nombre del sitio no puede contener wildcard' do site = build :site, name: '*.chau' + site.validate - assert_not site.valid? + assert site.errors.messages[:name].present? end test 'el nombre del sitio solo tiene letras, numeros y guiones' do site = build :site, name: 'A_Z!' + site.validate - assert_not site.valid? + assert site.errors.messages[:name].present? end test 'al destruir un sitio se eliminan los archivos' do From 1dd8c7399125b59ca4a57d830e532bf519ea0272 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 19 Jul 2019 19:37:53 -0300 Subject: [PATCH 14/44] WIP: licencias --- app/controllers/sites_controller.rb | 2 +- app/models/licencia.rb | 18 ++ app/models/site.rb | 1 + config/initializers/inflections.rb | 4 + db/migrate/20190718185817_create_licencias.rb | 16 + .../20190719221653_add_icons_to_licenses.rb | 9 + db/schema.rb | 14 +- db/seeds.rb | 8 + db/seeds/licencias.yml | 290 ++++++++++++++++++ test/controllers/sites_controller_test.rb | 3 +- test/factories/licencia.rb | 11 + test/factories/site.rb | 1 + test/models/licencia_test.rb | 9 + 13 files changed, 383 insertions(+), 3 deletions(-) create mode 100644 app/models/licencia.rb create mode 100644 db/migrate/20190718185817_create_licencias.rb create mode 100644 db/migrate/20190719221653_add_icons_to_licenses.rb create mode 100644 db/seeds/licencias.yml create mode 100644 test/factories/licencia.rb create mode 100644 test/models/licencia_test.rb diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb index f3e2a6d..d13d303 100644 --- a/app/controllers/sites_controller.rb +++ b/app/controllers/sites_controller.rb @@ -137,6 +137,6 @@ class SitesController < ApplicationController private def site_params - params.require(:site).permit(:name, :design_id) + params.require(:site).permit(:name, :design_id, :licencia_id) end end diff --git a/app/models/licencia.rb b/app/models/licencia.rb new file mode 100644 index 0000000..c0eb1c8 --- /dev/null +++ b/app/models/licencia.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# Las licencias son completamente traducibles +class Licencia < ApplicationRecord + extend Mobility + + translates :name, type: :string, locale_accessors: true + translates :url, type: :string, locale_accessors: true + translates :description, type: :text, locale_accessors: true + translates :deed, type: :text, locale_accessors: true + + has_many :sites + + validates :name, presence: true, uniqueness: true + validates :url, presence: true + validates :description, presence: true + validates :deed, presence: true +end diff --git a/app/models/site.rb b/app/models/site.rb index 0ed363a..607bbbf 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -11,6 +11,7 @@ class Site < ApplicationRecord friendly_id :name, use: %i[finders] belongs_to :design + belongs_to :licencia has_many :roles has_many :usuaries, -> { where('roles.rol = ?', 'usuarie') }, diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 62a4533..35b309e 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -7,6 +7,8 @@ ActiveSupport::Inflector.inflections(:en) do |inflect| inflect.singular 'invitades', 'invitade' inflect.plural 'usuarie', 'usuaries' inflect.singular 'usuaries', 'usuarie' + inflect.plural 'licencia', 'licencias' + inflect.singular 'licencias', 'licencia' inflect.plural 'rol', 'roles' inflect.singular 'roles', 'rol' end @@ -20,4 +22,6 @@ ActiveSupport::Inflector.inflections(:es) do |inflect| inflect.singular 'usuaries', 'usuarie' inflect.plural 'rol', 'roles' inflect.singular 'roles', 'rol' + inflect.plural 'licencia', 'licencias' + inflect.singular 'licencias', 'licencia' end diff --git a/db/migrate/20190718185817_create_licencias.rb b/db/migrate/20190718185817_create_licencias.rb new file mode 100644 index 0000000..11232d5 --- /dev/null +++ b/db/migrate/20190718185817_create_licencias.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +# Crea la tabla de licencias +class CreateLicencias < ActiveRecord::Migration[5.2] + def change + create_table :licencias do |t| + t.timestamps + t.string :name, unique: true + t.text :description + t.text :deed + t.string :url + end + + add_belongs_to :sites, :licencia, index: true + end +end diff --git a/db/migrate/20190719221653_add_icons_to_licenses.rb b/db/migrate/20190719221653_add_icons_to_licenses.rb new file mode 100644 index 0000000..650b148 --- /dev/null +++ b/db/migrate/20190719221653_add_icons_to_licenses.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# Agrega íconos a las licencias +class AddIconsToLicenses < ActiveRecord::Migration[5.2] + def change + # XXX: Cambiar por ActiveStorage? + add_column :licencias, :icons, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 0d9fb79..edcf00e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -12,7 +12,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20_190_717_214_308) do +ActiveRecord::Schema.define(version: 20_190_719_221_653) do create_table 'designs', force: :cascade do |t| t.datetime 'created_at', null: false t.datetime 'updated_at', null: false @@ -24,6 +24,16 @@ ActiveRecord::Schema.define(version: 20_190_717_214_308) do t.boolean 'disabled', default: false end + create_table 'licencias', force: :cascade do |t| + t.datetime 'created_at', null: false + t.datetime 'updated_at', null: false + t.string 'name' + t.text 'description' + t.text 'deed' + t.string 'url' + t.string 'icons' + end + create_table 'mobility_string_translations', force: :cascade do |t| t.string 'locale', null: false t.string 'key', null: false @@ -66,7 +76,9 @@ ActiveRecord::Schema.define(version: 20_190_717_214_308) do t.datetime 'updated_at', null: false t.string 'name' t.integer 'design_id' + t.integer 'licencia_id' t.index ['design_id'], name: 'index_sites_on_design_id' + t.index ['licencia_id'], name: 'index_sites_on_licencia_id' t.index ['name'], name: 'index_sites_on_name', unique: true end diff --git a/db/seeds.rb b/db/seeds.rb index 9e3d2c5..2e91b9d 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -7,3 +7,11 @@ designs.each do |d| design.update_attributes d end + +licencias = YAML.safe_load(File.read('db/seeds/licencias.yml')) + +licencias.each do |l| + licencia = Licencia.find_or_create_by(icons: l['icons']) + + licencia.update_attributes l +end diff --git a/db/seeds/licencias.yml b/db/seeds/licencias.yml new file mode 100644 index 0000000..6995ab0 --- /dev/null +++ b/db/seeds/licencias.yml @@ -0,0 +1,290 @@ +--- +- name_en: 'Peer Production License' + name_es: 'Licencia de Producción de Pares' + icons: "/public/ppl.png" + url_en: 'https://wiki.p2pfoundation.net/Peer_Production_License' + url_es: 'https://endefensadelsl.org/ppl_es.html' + description_en: 'The Peer Production License is a license that allows use for any purpose under the same terms, except for commercial purposes, which are only allowed for collectives, cooperatives and other worker-owned "enterprises". We recommend this license if you are inclined towards non-profit terms, since it allows the development of more ethical economies while fending off capitalistic for-profit uses. If you want to know more about it, we invite you to read [The Telekommunist Manifesto](http://networkcultures.org/blog/publication/no-03-the-telekommunist-manifesto-dmytri-kleiner/)' + description_es: 'La licencia de Producción de Pares permite el uso con cualquier propósito bajo la misma licencia, a excepción de los usos comerciales que solo están permitidos a colectivos, cooperativas y otras "empresas" en manos de sus trabajadorxs. Recomendamos esta licencia si te estabas inclinando hacia términos sin fines de lucro, ya que permite el desarrollo de economías más éticas al mismo tiempo que impide la explotación capitalista. Si te interesa saber más, te invitamos a leer [El manifiesto telecomunista](https://endefensadelsl.org/manifiesto_telecomunista.html).' + deed_en: | + # Peer Production License (human-readable version) + + This is a human-readable summary of the [full + license](https://wiki.p2pfoundation.net/Peer_Production_License). + + ## You are free to + + * **Share** -- copy and redistribute the material in any medium or + format + + * **Adapt** -- remix, transform, and build upon the material + + ## Under the following terms: + + * **Attribution** -- You must give appropriate credit, provide a link + to the license, and indicate if changes were made. You may do so in + any reasonable manner, but not in any way that suggests the licensor + endorses you or your use. + + * **ShareAlike** -- If you remix, transform, or build upon the + material, you must distribute your contributions under the same + license as the original. + + * **Non-Capitalist** -- Commercial exploitation of this work is only + allowed to cooperatives, non-profit organizations and collectives, + worker-owned organizations, and any organization without exploitation + relations. Any surplus value obtained by the exercise of the rights + given by this work's license must be distributed by and amongst + workers.' + + ## Notices: + + * You do not have to comply with the license for elements of the + material in the public domain or where your use is permitted by an + applicable exception or limitation. + + * No warranties are given. The license may not give you all of the + permissions necessary for your intended use. For example, other rights + such as publicity, privacy, or moral rights may limit how you use the + material. + deed_es: | + # Licencia de producción de pares (versión legible por humanas) + + Esto es un resumen legible por humanas del [texto legal (la licencia + completa)](http://endefensadelsl.org/ppl_es.html) + + ## Ud. es libre de + + * Compartir - copiar, distribuir, ejecutar y comunicar públicamente la obra + * Hacer obras derivadas + + ## Bajo las condiciones siguientes: + + * Atribución - Debe reconocer los créditos de la obra de la manera + especificada por el autor o el licenciante (pero no de una manera que + sugiera que tiene su apoyo o que apoyan el uso que hace de su obra). + + * Compartir bajo la Misma Licencia - Si altera o transforma esta obra, + o genera una obra derivada, sólo puede distribuir la obra generada + bajo una licencia idéntica a ésta. + + * No Capitalista - La explotación comercial de esta obra sólo está + permitida a cooperativas, organizaciones y colectivos sin fines de + lucro, a organizaciones de trabajadores autogestionados, y donde no + existan relaciones de explotación. Todo excedente o plusvalía + obtenidos por el ejercicio de los derechos concedidos por esta + Licencia sobre la Obra deben ser distribuidos por y entre los + trabajadores. + + ## Entendiendo que + + * Renuncia - Alguna de estas condiciones puede no aplicarse si se + obtiene el permiso del titular de los derechos de autor. + + * Dominio Público - Cuando la obra o alguno de sus elementos se halle + en el dominio público según la ley vigente aplicable, esta situación + no quedará afectada por la licencia. + + * Otros derechos - Los derechos siguientes no quedan afectados por la + licencia de ninguna manera: + + * Los derechos derivados de usos legítimos u otras limitaciones + reconocidas por ley no se ven afectados por lo anterior; + + * Los derechos morales del autor; + + * Derechos que pueden ostentar otras personas sobre la propia obra o + su uso, como por ejemplo derechos de imagen o de privacidad. + + * Aviso - Al reutilizar o distribuir la obra, tiene que dejar muy en + claro los términos de la licencia de esta obra. La mejor forma de + hacerlo es enlazar a esta página. + +- icons: "/public/by.png" + name_en: 'Attribution 4.0 International (CC BY 4.0)' + description_en: "This license gives everyone the freedom to use, + adapt, and redistribute the contents of your site by requiring + attribution only. We recommend this license if you're publishing + articles that require maximum diffusion, even in commercial media, but + you want to be attributed. Users of the site will have to mention the + source and indicate if they made changes to it." + url_en: 'https://creativecommons.org/licenses/by/4.0/' + name_es: 'Atribución 4.0 Internacional (CC BY 4.0)' + description_es: "Esta licencia permite a todes la libertad de usar, + adaptar/modificar y redistribuir los contenidos de tu sitio con la + única condición de atribuirte la autoría original. Recomendamos esta + licencia si vas a publicar artículos que requieran máxima difusión, + incluso en medios comerciales, pero querés que te atribuyan el + trabajo. Les usuaries de este sitio deberán mencionar la fuente e + indicar si hicieron cambios." + url_es: 'https://creativecommons.org/licenses/by/4.0/deed.es' + deed_en: | + This is a human-readable summary of (and not a substitute for) the + [license](https://creativecommons.org/licenses/by/4.0/legalcode). + + # You are free to: + + * **Share** -- copy and redistribute the material in any medium or + format + + * **Adapt** -- remix, transform, and build upon the material for any + purpose, even commercially. + + The licensor cannot revoke these freedoms as long as you follow the + license terms. + + # Under the following terms: + + * **Attribution** -- You must give appropriate credit, provide a link to + the license, and indicate if changes were made. You may do so in any + reasonable manner, but not in any way that suggests the licensor + endorses you or your use. + + * **No additional restrictions** -- You may not apply legal terms or + technological measures that legally restrict others from doing + anything the license permits. + + # Notices: + + You do not have to comply with the license for elements of the material + in the public domain or where your use is permitted by an applicable + exception or limitation. + + No warranties are given. The license may not give you all of the + permissions necessary for your intended use. For example, other rights + such as publicity, privacy, or moral rights may limit how you use the + material. + deed_es: | + Este es un resumen legible por humanes (y no un sustituto) de la + [licencia](https://creativecommons.org/licenses/by/4.0/legalcode). + + # Usted es libre de: + + * **Compartir** -- copiar y redistribuir el material en cualquier medio o + formato. + + * **Adaptar** -- remezclar, transformar y construir a partir del material + para cualquier propósito, incluso comercialmente. + + La licenciante no puede revocar estas libertades en tanto usted siga los + términos de la licencia. + + # Bajo los siguientes términos: + + * **Atribución** -- Usted debe dar crédito de manera adecuada, brindar + un enlace a la licencia, e indicar si se han realizado cambios. Puede + hacerlo en cualquier forma razonable, pero no de forma tal que sugiera + que usted o su uso tienen el apoyo de la licenciante. + + * **No hay restricciones adicionales** -- No puede aplicar términos + legales ni medidas tecnológicas que restrinjan legalmente a otras a + hacer cualquier uso permitido por la licencia. + + # Avisos: + + No tiene que cumplir con la licencia para elementos del materiale en el + dominio público o cuando su uso esté permitido por una excepción o + limitación aplicable. + + No se dan garantías. La licencia podría no darle todos los permisos que + necesita para el uso que tenga previsto. Por ejemplo, otros derechos como + publicidad, privacidad, o derechos morales pueden limitar la forma en que + utilice el material. +- icons: "/public/bysa.png" + name_en: "Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)" + name_es: "Atribución-CompartirIgual 4.0 Internacional (CC BY-SA 4.0)" + url_en: 'https://creativecommons.org/licenses/by-sa/4.0/' + url_es: 'https://creativecommons.org/licenses/by-sa/4.0/deed.es' + description_en: "This license is the same as the CC-BY 4.0 but it adds + a requirement of sharing the work and its derivatives under the same + license. This is a reciprocitary, _copyleft_, license that keeps + culture free. Though commercial uses are allowed, they must be shared + under the same license, so any modifications done for profit are free + as well." + description_es: "Esta licencia es igual que la CC-BY 4.0 con el + requisito agregado de compartir la obra y sus obras derivadas con la + misma licencia. Esta es una licencia reciprocitaria, _copyleft_, que + mantiene y profundiza la cultura libre. Aunque los usos comerciales + están permitidos, las mejoras hechas con fines de lucro deben ser + compartidas bajo la misma licencia." + deed_en: | + This is a human-readable summary of (and not a substitute for) the + [license](https://creativecommons.org/licenses/by-sa/4.0/legalcode). + + # You are free to: + + * **Share** -- copy and redistribute the material in any medium or + format + + * **Adapt** -- remix, transform, and build upon the material for any + purpose, even commercially. + + The licensor cannot revoke these freedoms as long as you follow the + license terms. + + # Under the following terms: + + * **Attribution** -- You must give appropriate credit, provide a link to + the license, and indicate if changes were made. You may do so in any + reasonable manner, but not in any way that suggests the licensor + endorses you or your use. + + * **ShareAlike** -- If you remix, transform, or build upon the + material, you must distribute your contributions under the same + license as the original. + + + * **No additional restrictions** -- You may not apply legal terms or + technological measures that legally restrict others from doing + anything the license permits. + + # Notices: + + You do not have to comply with the license for elements of the material + in the public domain or where your use is permitted by an applicable + exception or limitation. + + No warranties are given. The license may not give you all of the + permissions necessary for your intended use. For example, other rights + such as publicity, privacy, or moral rights may limit how you use the + material. + deed_es: | + Este es un resumen legible por humanes (y no un sustituto) de la + [licencia](https://creativecommons.org/licenses/by/4.0/legalcode). + + # Usted es libre de: + + * **Compartir** -- copiar y redistribuir el material en cualquier medio o + formato. + + * **Adaptar** -- remezclar, transformar y construir a partir del material + para cualquier propósito, incluso comercialmente. + + La licenciante no puede revocar estas libertades en tanto usted siga los + términos de la licencia. + + # Bajo los siguientes términos: + + * **Atribución** -- Usted debe dar crédito de manera adecuada, brindar + un enlace a la licencia, e indicar si se han realizado cambios. Puede + hacerlo en cualquier forma razonable, pero no de forma tal que sugiera + que usted o su uso tienen el apoyo de la licenciante. + + * **CompartirIgual** -- Si remezcla, transforma o crea a partir del + material, debe distribuir su contribución bajo la lamisma licencia del + original. + + * **No hay restricciones adicionales** -- No puede aplicar términos + legales ni medidas tecnológicas que restrinjan legalmente a otras a + hacer cualquier uso permitido por la licencia. + + # Avisos: + + No tiene que cumplir con la licencia para elementos del materiale en el + dominio público o cuando su uso esté permitido por una excepción o + limitación aplicable. + + No se dan garantías. La licencia podría no darle todos los permisos que + necesita para el uso que tenga previsto. Por ejemplo, otros derechos como + publicidad, privacidad, o derechos morales pueden limitar la forma en que + utilice el material. diff --git a/test/controllers/sites_controller_test.rb b/test/controllers/sites_controller_test.rb index 058d20b..5796ea9 100644 --- a/test/controllers/sites_controller_test.rb +++ b/test/controllers/sites_controller_test.rb @@ -34,7 +34,8 @@ class SitesControllerTest < ActionDispatch::IntegrationTest post sites_url, headers: @authorization, params: { site: { name: name, - design_id: create(:design).id + design_id: create(:design).id, + licencia_id: create(:licencia).id } } diff --git a/test/factories/licencia.rb b/test/factories/licencia.rb new file mode 100644 index 0000000..e221e61 --- /dev/null +++ b/test/factories/licencia.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +FactoryBot.define do + factory :licencia do + name { SecureRandom.hex } + description { SecureRandom.hex } + url { SecureRandom.hex } + deed { SecureRandom.hex } + icons { SecureRandom.hex } + end +end diff --git a/test/factories/site.rb b/test/factories/site.rb index 3593c9f..95cce4e 100644 --- a/test/factories/site.rb +++ b/test/factories/site.rb @@ -4,5 +4,6 @@ FactoryBot.define do factory :site do name { "test-#{SecureRandom.hex}" } design + licencia end end diff --git a/test/models/licencia_test.rb b/test/models/licencia_test.rb new file mode 100644 index 0000000..949606a --- /dev/null +++ b/test/models/licencia_test.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class LicenciaTest < ActiveSupport::TestCase + test 'se pueden crear' do + licencia = build :licencia + + assert licencia.valid? + end +end From 0b7531ffa8f1e5871ff255ad798b06856f9dd984 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 19 Jul 2019 21:33:10 -0300 Subject: [PATCH 15/44] elegir licencia --- app/views/sites/_form.haml | 21 +++++++++++++++++++++ config/locales/en.yml | 7 +++++++ config/locales/es.yml | 7 +++++++ db/seeds/licencias.yml | 6 +++--- public/images/by.png | Bin 0 -> 1377 bytes public/images/ppl.png | Bin 0 -> 1933 bytes public/images/sa.png | Bin 0 -> 1704 bytes test/factories/licencia.rb | 2 +- 8 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 public/images/by.png create mode 100644 public/images/ppl.png create mode 100644 public/images/sa.png diff --git a/app/views/sites/_form.haml b/app/views/sites/_form.haml index 927cd2e..db9808c 100644 --- a/app/views/sites/_form.haml +++ b/app/views/sites/_form.haml @@ -25,5 +25,26 @@ - if design.license = link_to t('.design.license'), design.license, target: '_blank', class: 'btn btn-info' + .form-group + %h2= t('.licencia.title') + %p.lead= t('.help.licencia') + - Licencia.all.each do |licencia| + .row + .col + %h3 + = f.radio_button :licencia_id, licencia.id, + checked: licencia.id == site.licencia_id + = f.label "licencia_id_#{licencia.id}" do + = image_tag licencia.icons, alt: licencia.name + = licencia.name + = sanitize_markdown licencia.description, + tags: %w[p a strong em ul ol li h1 h2 h3 h4 h5 h6] + + .btn-group{ role: 'group', 'aria-label': t('.licencia.actions') } + = link_to t('.licencia.url'), licencia.url, + target: '_blank', class: 'btn btn-info' + + %hr/ + .form-group = f.submit submit, class: 'btn btn-success' diff --git a/config/locales/en.yml b/config/locales/en.yml index cdb5a45..f081e82 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -162,11 +162,18 @@ en: help: name: "Your site's name. It can only contain numbers and letters." design: 'Select the design for your site. You can change it later. We add more designs from time to time.' + licencia: 'Everything we publish has automatic copyright. This + means nobody can use our works without explicit permission. By + using licenses, we stablish conditions by which we want to share + them.' design: title: 'Design' actions: 'Information about this design' url: 'Preview' licencia: 'Read the license' + licencia: + title: 'License for the site and everything in it' + url: 'Read the license' fetch: title: 'Upgrade the site' help: diff --git a/config/locales/es.yml b/config/locales/es.yml index 5cf84bd..fd5a8c2 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -167,11 +167,18 @@ es: help: name: 'El nombre de tu sitio. Solo puede contener letras y números.' design: 'Elegí el diseño que va a tener tu sitio aquí. Podés cambiarlo luego. De tanto en tanto vamos sumando diseños nuevos.' + licencia: 'Todo lo que publicamos posee automáticamente derechos + de autore. Esto significa que nadie puede hacer uso de nuestras + obras sin permiso explícito. Con las licencias establecemos + condiciones bajo las que queremos compartir.' design: title: 'Diseño' actions: 'Información sobre este diseño' url: 'Vista previa' licencia: 'Leer la licencia' + licencia: + title: 'Licencia del sitio y todo lo que se publique' + url: 'Leer la licencia' fetch: title: 'Actualizar el sitio' help: diff --git a/db/seeds/licencias.yml b/db/seeds/licencias.yml index 6995ab0..7e04067 100644 --- a/db/seeds/licencias.yml +++ b/db/seeds/licencias.yml @@ -1,7 +1,7 @@ --- - name_en: 'Peer Production License' name_es: 'Licencia de Producción de Pares' - icons: "/public/ppl.png" + icons: "/images/ppl.png" url_en: 'https://wiki.p2pfoundation.net/Peer_Production_License' url_es: 'https://endefensadelsl.org/ppl_es.html' description_en: 'The Peer Production License is a license that allows use for any purpose under the same terms, except for commercial purposes, which are only allowed for collectives, cooperatives and other worker-owned "enterprises". We recommend this license if you are inclined towards non-profit terms, since it allows the development of more ethical economies while fending off capitalistic for-profit uses. If you want to know more about it, we invite you to read [The Telekommunist Manifesto](http://networkcultures.org/blog/publication/no-03-the-telekommunist-manifesto-dmytri-kleiner/)' @@ -100,7 +100,7 @@ claro los términos de la licencia de esta obra. La mejor forma de hacerlo es enlazar a esta página. -- icons: "/public/by.png" +- icons: "/images/by.png" name_en: 'Attribution 4.0 International (CC BY 4.0)' description_en: "This license gives everyone the freedom to use, adapt, and redistribute the contents of your site by requiring @@ -190,7 +190,7 @@ necesita para el uso que tenga previsto. Por ejemplo, otros derechos como publicidad, privacidad, o derechos morales pueden limitar la forma en que utilice el material. -- icons: "/public/bysa.png" +- icons: "/images/sa.png" name_en: "Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)" name_es: "Atribución-CompartirIgual 4.0 Internacional (CC BY-SA 4.0)" url_en: 'https://creativecommons.org/licenses/by-sa/4.0/' diff --git a/public/images/by.png b/public/images/by.png new file mode 100644 index 0000000000000000000000000000000000000000..5ddc7400294d15080396b1b34e43c9a3079bf620 GIT binary patch literal 1377 zcmV-n1)lneP)cL{CFqybw9`tVJ@hc9{+&paIYfSP5bOURgz~p1t z7;HA*Vk<|fVy9TncypvOMA<=^f)9*Arn8v6v}Xe>;q7KXpJRq9Of>fE)LgSiJ6-RV3>cZz*blQiUDl7iS!@gi*(JBXj z#Ugn3t(MV-e77Z#u6-`}+KgjR{VT zrD|9|sJ%!v;_MWw%;YJB>Dy?6)2N{9(@*=)^f33zGwKVa)uhV=r%Q1i(k+a-0limz zxQwc{S_kv2vQjsKj)*X6;`SPlpsS`Ft9aZ~j-!(#*T_QO5#21^ww^A!Sl*~kKJ@aY9Sz!8Nw<#PLs?-RF(A0D+o z3{AaAAjisQ#(2IDa6_&pIj4x zY%#W7V zRT03+7Bz=}c6&=;uyI}$H66eut+*`$INLVtM4$-J1^H=$e`1+^`Yhu&jN_!G0&0 zI7PBH$-!oD{n!iD2PW$;!-$bJl6`ob^|ja0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XdIB~jq)f-~&^ed4!cElNzVO$;H z3%>LEFbwJyo%FYr?jfyeE5~%rp9G4%zlX;!0%9L>y8ab5#FR1-~yu1O))xqm987h)Jbeh-%QJ) z-vvJKg%07+VFWrW-bR?WMcIl$&o&9$?p3Ny*77P1`-s(E^v=Nt?ESwTX=`0Ef1jZN z(@J99bjgj4>QI^)XP=C9Wm?O|u0e_Y@*V8}al+u7c?p|3u)32?okHVAK5Am+OSPyR zlODD`#+|(!(Kn2U2-%}MJ^6-jX0Jkz@+QU(Wqk@pKJvdd`{cs-$WS{XE|LEMZZXMM TGVYXO00000NkvXXu0mjfQ`&-r literal 0 HcmV?d00001 diff --git a/public/images/sa.png b/public/images/sa.png new file mode 100644 index 0000000000000000000000000000000000000000..bb23f8c624d9e064a8c62168f7f7f55e380c3ba3 GIT binary patch literal 1704 zcmV;Z23PrsP)j6nvqMLnTX3~ ztj(t72TG=^VN218WYbJ7L=;UFKVCqt{$TW;^PF>@=XpQuK7Tzg*SXKn=i|Qba~}c! zEEcJlgB2*mUK~d?>QRL<>_!1TL>4BX6aFWA91Bs3CeU`=Ln+?FAcWjMkil4szZ@{E zqY@i1GWaNc@U`O|F^`=X7(A3%e1-Wb2_t`&m7L=%N)Vp47Wo%ivj+^3`LdRX;-H6Th>u;9`0oZdzpZ4V2nR7lW<3M z7RiM?!X~=03g$9S{~o>V8%hY4sBYSDHf!jc-C_(X$EdJ9Hj!ybAm~*MwvujWpK>H*VLDKoE=Oj zoRcR^Wj%vwxeSqk>X2Z9X^TTL%&QE(t+3vq3#MWuOBN2{9hXa7X9cU+;8H!!3ba-S z6Nws8)QuM%+#cq~oX$jc`EO1X2k~A0#Cx{$>X|6xG@y@)vs9FX^H*D!+d14OGj-&0 z-nN;2m3`zH+pI8MaZ40zv2k{p$u9DDS8lLLCKYTWs+%xa##t}A8fgRb3u9fE6sf#x z^fOD=?h|49$>mk4(McJjeX4Or8lzSWu*5vEAHSZ8K%6~AFIKjK6~(PjEDmdUyyn($X* z#Cc9rjOFo`MYTkO6U7@^kL9v1rx~Zj`%|yJtCLc3A+XzfnQU;a1G0x9`zbTN)9O-0%^u*Gn-FLP za)Kd~T)xb2ikjoVCGX`T8}}lRGYpxg;H=c@7KxfmK)v@e-*$l(AU81NI||Nxtu9~G z)VsbrEkN#IEDwPoxWM`DRJ(k4yg=??$T2RXxP*Pe)tBXu4ODOnoxiMoF5-@V7Ny|q z(&|Qtnype)jt?5l6;0UGZXA>m9j2Tv(I{f=M0mVYO9_ICh>LVa0y?~#G2-Pgns9Co83iS zE!t>zp_2_b4NUN3(-*=W27k+CWszZz9>OCA2gj6(*?BBA_^M%~tdx53>%>2eHh#iC z>zmew5z2K&PqSt1A-SOvCwEMXjBZNV-z7|hAxn|uN$VzZxV7OVwf)=ksL@pe*D%Hb zr8U#}w@pT~M5gU(GcE#`MM*bS+Qi*|n5EhJwtW6mc*-9;nyc>XarEaUPvbjqYgt zE{n$*57GRwMr+En?YcK7jBE0Q1YQUd%ym9*g=s>v(;>;z;#LO)yYO%jU{3Q<^|fE% z<_Ia>IxUO^0mAHL2NmW^x2Js{=(6%bKT*o~tS%rFBh3Br<236d1HqSg(npl@OjGJe z5X2gU`gT0~6t3u^?PP9uh)2!l;a<*=n@QfS?+o~1@i?K6yI~x|^~MvOtK7l~=G Date: Fri, 19 Jul 2019 21:34:37 -0300 Subject: [PATCH 16/44] no usar lenguaje capacitista --- config/locales/en.yml | 2 +- config/locales/es.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index f081e82..cbc036a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -169,7 +169,7 @@ en: design: title: 'Design' actions: 'Information about this design' - url: 'Preview' + url: 'Demo' licencia: 'Read the license' licencia: title: 'License for the site and everything in it' diff --git a/config/locales/es.yml b/config/locales/es.yml index fd5a8c2..b3a248c 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -174,8 +174,8 @@ es: design: title: 'Diseño' actions: 'Información sobre este diseño' - url: 'Vista previa' - licencia: 'Leer la licencia' + url: 'Demostración' + license: 'Leer la licencia' licencia: title: 'Licencia del sitio y todo lo que se publique' url: 'Leer la licencia' From 11cf2cb08bc124336204e64ae3ec8dee1f2f663b Mon Sep 17 00:00:00 2001 From: f Date: Wed, 24 Jul 2019 20:51:29 -0300 Subject: [PATCH 17/44] deployear los sitios de distintas formas --- Gemfile | 1 + Gemfile.lock | 1 + app/models/deploy.rb | 33 +++++++++ app/models/deploy_local.rb | 77 +++++++++++++++++++++ app/models/deploy_zip.rb | 47 +++++++++++++ app/models/site.rb | 1 + db/migrate/20190723220002_create_deploys.rb | 13 ++++ db/schema.rb | 12 +++- doc/crear_sitios.md | 50 +++++++++++++ test/factories/deploy_local.rb | 7 ++ test/factories/deploy_zip.rb | 7 ++ test/models/deploy_local_test.rb | 13 ++++ test/models/deploy_zip_test.rb | 21 ++++++ 13 files changed, 282 insertions(+), 1 deletion(-) create mode 100644 app/models/deploy.rb create mode 100644 app/models/deploy_local.rb create mode 100644 app/models/deploy_zip.rb create mode 100644 db/migrate/20190723220002_create_deploys.rb create mode 100644 test/factories/deploy_local.rb create mode 100644 test/factories/deploy_zip.rb create mode 100644 test/models/deploy_local_test.rb create mode 100644 test/models/deploy_zip_test.rb diff --git a/Gemfile b/Gemfile index 537cabc..67a8c4d 100644 --- a/Gemfile +++ b/Gemfile @@ -54,6 +54,7 @@ gem 'mobility' gem 'pundit' gem 'rails-i18n' gem 'rails_warden' +gem 'rubyzip' gem 'rugged' gem 'validates_hostname' gem 'whenever', require: false diff --git a/Gemfile.lock b/Gemfile.lock index 7941b03..4a2c2ff 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -423,6 +423,7 @@ DEPENDENCIES rails_warden rbnacl (< 5.0) rubocop-rails + rubyzip rugged sass-rails (~> 5.0) selenium-webdriver diff --git a/app/models/deploy.rb b/app/models/deploy.rb new file mode 100644 index 0000000..2fe5396 --- /dev/null +++ b/app/models/deploy.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +require 'open3' +# Este modelo implementa los distintos tipos de alojamiento que provee +# Sutty. +# +# Los datos se guardan en la tabla `deploys`. Para guardar los +# atributos, cada modelo tiene que definir su propio `store +# :attributes`. +class Deploy < ApplicationRecord + belongs_to :site + + def deploy + raise NotImplementedError + end + + def limit + raise NotImplementedError + end + + # Corre un comando y devuelve true si terminó correctamente + def run(cmd) + r = 1 + + Dir.chdir(site.path) do + Open3.popen2(env, cmd, unsetenv_others: true) do |_, _o, t| + r = t.value + end + end + + r.exited? + end +end diff --git a/app/models/deploy_local.rb b/app/models/deploy_local.rb new file mode 100644 index 0000000..330bd02 --- /dev/null +++ b/app/models/deploy_local.rb @@ -0,0 +1,77 @@ +# frozen_string_literal: true + +# Alojamiento local, solo genera el sitio, con lo que no necesita hacer +# nada más +class DeployLocal < Deploy + store :values, accessors: %i[fqdn destination], coder: YAML + + before_create :fqdn!, :destination! + before_destroy :remove_destination! + + # Realizamos la construcción del sitio usando Jekyll y un entorno + # limpio para no pasarle secretos + # + # Pasamos variables de entorno mínimas para no filtrar secretos de + # Sutty + # + # TODO: Recolectar estadísticas y enviarlas a la base de datos + def deploy + yarn && bundle && jekyll_build + end + + # Sólo permitimos un deploy local + def limit + 1 + end + + private + + # Un entorno que solo tiene lo que necesitamos + def env + paths = [File.dirname(`which bundle`), '/usr/bin'] + + { 'PATH' => paths.join(':'), 'JEKYLL_ENV' => 'production' } + end + + def yarn_lock + File.join(site.path, 'yarn.lock') + end + + def yarn_lock? + File.exist? yarn_lock + end + + # Corre yarn dentro del repositorio + def yarn + return unless yarn_lock? + + run 'yarn' + end + + def bundle + run 'bundle' + end + + def jekyll_build + run "bundle exec jekyll build --destination \"#{escaped_destination}\"" + end + + def fqdn! + self.fqdn ||= "#{site.name}.#{ENV.fetch('SUTTY', 'sutty.nl')}" + end + + def destination! + self.destination ||= File.join(Rails.root, '_deploy', fqdn) + end + + # no debería haber espacios ni caracteres especiales, pero por si + # acaso... + def escaped_destination + Shellwords.escape destination + end + + # Eliminar el destino si se elimina el deploy + def remove_destination! + FileUtils.rm_rf destination + end +end diff --git a/app/models/deploy_zip.rb b/app/models/deploy_zip.rb new file mode 100644 index 0000000..15c81e1 --- /dev/null +++ b/app/models/deploy_zip.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Genera un ZIP a partir del sitio ya construido +# +# TODO: Firmar con minisign +class DeployZip < Deploy + store :values, accessors: %i[fqdn destination file path], coder: YAML + + before_create :fqdn!, :destination! + before_create :file!, :path! + + # Una vez que el sitio está generado, tomar todos los archivos y + # y generar un zip accesible públicamente. + # + # TODO: Recolectar estadísticas y enviarlas a la base de datos + def deploy + Dir.chdir(destination) do + Zip::File.open(path, Zip::File::CREATE) do |z| + Dir.glob('./**/**').each do |f| + File.directory?(f) ? z.mkdir(f) : z.add(f, f) + end + end + end + + File.exist? path + end + + private + + # Copiamos de DeployLocal para no cargar todos los métodos de + # compilación... + def fqdn! + self.fqdn ||= "#{site.name}.#{ENV.fetch('SUTTY', 'sutty.nl')}" + end + + def destination! + self.destination ||= File.join(Rails.root, '_deploy', fqdn) + end + + def file! + self.file ||= "#{fqdn}.zip" + end + + def path! + self.path = File.join(destination, file) + end +end diff --git a/app/models/site.rb b/app/models/site.rb index 607bbbf..bd3f01e 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -13,6 +13,7 @@ class Site < ApplicationRecord belongs_to :design belongs_to :licencia + has_many :deploys has_many :roles has_many :usuaries, -> { where('roles.rol = ?', 'usuarie') }, through: :roles diff --git a/db/migrate/20190723220002_create_deploys.rb b/db/migrate/20190723220002_create_deploys.rb new file mode 100644 index 0000000..85a2025 --- /dev/null +++ b/db/migrate/20190723220002_create_deploys.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +# Crea la tabla de deploys posibles para un sitio +class CreateDeploys < ActiveRecord::Migration[5.2] + def change + create_table :deploys do |t| + t.timestamps + t.belongs_to :site, index: true + t.string :type, index: true + t.text :values + end + end +end diff --git a/db/schema.rb b/db/schema.rb index edcf00e..28ca10a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -12,7 +12,17 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20_190_719_221_653) do +ActiveRecord::Schema.define(version: 20_190_723_220_002) do + create_table 'deploys', force: :cascade do |t| + t.datetime 'created_at', null: false + t.datetime 'updated_at', null: false + t.integer 'site_id' + t.string 'type' + t.text 'values' + t.index ['site_id'], name: 'index_deploys_on_site_id' + t.index ['type'], name: 'index_deploys_on_type' + end + create_table 'designs', force: :cascade do |t| t.datetime 'created_at', null: false t.datetime 'updated_at', null: false diff --git a/doc/crear_sitios.md b/doc/crear_sitios.md index b89e192..92a309c 100644 --- a/doc/crear_sitios.md +++ b/doc/crear_sitios.md @@ -106,6 +106,9 @@ falta (algunas plantillas tienen requisitos extraños). Las plantillas se instalan como gemas en los sitios, de forma que podemos cambiarla desde las opciones del sitio luego. +Para poder cambiar el diseño, necesitamos poder editar la configuración +del sitio en _config.yml y colocar el nombre de la gema en `theme:` + ## Internamente Al crear un sitio, clonar el esqueleto en el lugar correcto. Al @@ -162,3 +165,50 @@ actualizaciones muestra el historial para que les usuaries vean cuales son los cambios que se van a aplicar. Este historial viene del repositorio git con lo que tenemos que tomarnos la costumbre de escribir commits completos con explicación. + +## Alojamiento + +Para elegir las opciones de alojamiento, agregamos clases que +implementan el nombre del alojamiento y sus opciones específicas: + +* Local (sitio.sutty.nl): Deploy local. Genera el sitio en + _deploy/name.sutty.nl y lo pone a disposición del servidor web (es + como veniamos trabajando hasta ahora). También admite dominios + propios. + + Solo se puede tener uno y no es opcional porque lo necesitamos para + poder hacer el resto de deploys + +* Neocities: Deploy a neocities.org, necesita API key. Se conecta con + neocities usando la API y envía los archivos. + + Solo se puede tener uno (pendiente hablar con neocities si podemos + hacer esto). + +* Zip: genera un zip con el contenido del sitio y provee una url de + descarga estilo https://sutty.nl/sites/site.zip + + Solo se puede tener uno + +* SSH: Deploy al servidor SSH que especifiquemos. Necesita que le + pasemos user@host, puerto y ruta (quizás la ruta no es necesaria y + vaya junto con user@host). Informar a les usuaries la llave pública + de Sutty para que la agreguen. + + No hay límite a los servidores SSH que se pueden agregar. + +La clase Deploy::* tiene que implementar estas interfaces: + + * `#limit` devuelve un entero que es la cantidad de deploys de este + tipo que se pueden agregar, `nil` significa sin límite + * `#deploy` el método que realiza el deploy. En realidad este método + hay que correrlo por fuera de Sutty... + * `#attributes` los valores serializados que acepta el Deploy + +Son modelos que pueden guardar atributos en la base y a través de los +que se pueden tomar los datos a través de la API (cuando tengamos un +método de deployment). + +El plan es migrar todo esto a de forma que la compilación se +haga por separado de sutty. Este es un plan intermedio hasta que +tengamos tiempo de hacerlo realmente. diff --git a/test/factories/deploy_local.rb b/test/factories/deploy_local.rb new file mode 100644 index 0000000..e7441c3 --- /dev/null +++ b/test/factories/deploy_local.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +FactoryBot.define do + factory :deploy_local do + site + end +end diff --git a/test/factories/deploy_zip.rb b/test/factories/deploy_zip.rb new file mode 100644 index 0000000..756be34 --- /dev/null +++ b/test/factories/deploy_zip.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +FactoryBot.define do + factory :deploy_zip do + site + end +end diff --git a/test/models/deploy_local_test.rb b/test/models/deploy_local_test.rb new file mode 100644 index 0000000..39ba701 --- /dev/null +++ b/test/models/deploy_local_test.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class DeployZipTest < ActiveSupport::TestCase + test 'se puede deployear' do + deploy_local = create :deploy_local + + assert deploy_local.deploy + assert File.directory?(deploy_local.destination) + + assert deploy_local.destroy + assert_not File.directory?(deploy_local.destination) + end +end diff --git a/test/models/deploy_zip_test.rb b/test/models/deploy_zip_test.rb new file mode 100644 index 0000000..cbe5559 --- /dev/null +++ b/test/models/deploy_zip_test.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class DeployLocalTest < ActiveSupport::TestCase + test 'se puede deployear' do + site = create :site + local = create :deploy_local, site: site + deploy = create :deploy_zip, site: site + + # Primero tenemos que generar el sitio + local.deploy + + escaped_path = Shellwords.escape(deploy.path) + + assert deploy.deploy + assert File.file?(deploy.path) + assert_equal 'application/zip', + `file --mime-type "#{escaped_path}"`.split(' ').last + + local.destroy + end +end From 7570abaf1aaffba7ee3ae798519614239ed85635 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 25 Jul 2019 14:25:00 -0300 Subject: [PATCH 18/44] serializar con json porque yaml es mas verborragico --- app/models/deploy_local.rb | 2 +- app/models/deploy_zip.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/deploy_local.rb b/app/models/deploy_local.rb index 330bd02..8ff40db 100644 --- a/app/models/deploy_local.rb +++ b/app/models/deploy_local.rb @@ -3,7 +3,7 @@ # Alojamiento local, solo genera el sitio, con lo que no necesita hacer # nada más class DeployLocal < Deploy - store :values, accessors: %i[fqdn destination], coder: YAML + store :values, accessors: %i[fqdn destination], coder: JSON before_create :fqdn!, :destination! before_destroy :remove_destination! diff --git a/app/models/deploy_zip.rb b/app/models/deploy_zip.rb index 15c81e1..6804bb2 100644 --- a/app/models/deploy_zip.rb +++ b/app/models/deploy_zip.rb @@ -4,7 +4,7 @@ # # TODO: Firmar con minisign class DeployZip < Deploy - store :values, accessors: %i[fqdn destination file path], coder: YAML + store :values, accessors: %i[fqdn destination file path], coder: JSON before_create :fqdn!, :destination! before_create :file!, :path! From b561cacda4338b08d599ad0cf7546b53bbfe672e Mon Sep 17 00:00:00 2001 From: f Date: Thu, 25 Jul 2019 15:51:32 -0300 Subject: [PATCH 19/44] agregar distintas formas de deploy a un sitio --- .rubocop.yml | 1 + app/controllers/sites_controller.rb | 9 +++++- app/models/deploy_local.rb | 2 +- app/models/deploy_zip.rb | 2 +- app/models/site.rb | 21 ++++++++++++++ app/views/deploys/_deploy_local.haml | 14 +++++++++ app/views/deploys/_deploy_zip.haml | 21 ++++++++++++++ app/views/sites/_form.haml | 9 ++++++ config/locales/es.yml | 30 +++++++++++++++++++ test/controllers/sites_controller_test.rb | 35 ++++++++++++++++++++--- test/factories/site.rb | 8 ++++++ 11 files changed, 145 insertions(+), 7 deletions(-) create mode 100644 app/views/deploys/_deploy_local.haml create mode 100644 app/views/deploys/_deploy_zip.haml diff --git a/.rubocop.yml b/.rubocop.yml index f9765ba..8df0329 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -44,6 +44,7 @@ Metrics/ClassLength: Exclude: - 'app/models/site.rb' - 'app/controllers/posts_controller.rb' + - 'app/controllers/sites_controller.rb' Lint/HandleExceptions: Exclude: diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb index d13d303..c5008ab 100644 --- a/app/controllers/sites_controller.rb +++ b/app/controllers/sites_controller.rb @@ -23,6 +23,9 @@ class SitesController < ApplicationController def new @site = Site.new authorize @site + + @site.deploys.build type: 'DeployLocal' + @site.deploys.build type: 'DeployZip' end def create @@ -137,6 +140,10 @@ class SitesController < ApplicationController private def site_params - params.require(:site).permit(:name, :design_id, :licencia_id) + params.require(:site) + .permit(:name, :design_id, :licencia_id, + deploys_attributes: %i[ + type id _destroy + ]) end end diff --git a/app/models/deploy_local.rb b/app/models/deploy_local.rb index 8ff40db..10c21bd 100644 --- a/app/models/deploy_local.rb +++ b/app/models/deploy_local.rb @@ -57,7 +57,7 @@ class DeployLocal < Deploy end def fqdn! - self.fqdn ||= "#{site.name}.#{ENV.fetch('SUTTY', 'sutty.nl')}" + self.fqdn ||= "#{site.name}.#{Site.domain}" end def destination! diff --git a/app/models/deploy_zip.rb b/app/models/deploy_zip.rb index 6804bb2..0ec8afc 100644 --- a/app/models/deploy_zip.rb +++ b/app/models/deploy_zip.rb @@ -30,7 +30,7 @@ class DeployZip < Deploy # Copiamos de DeployLocal para no cargar todos los métodos de # compilación... def fqdn! - self.fqdn ||= "#{site.name}.#{ENV.fetch('SUTTY', 'sutty.nl')}" + self.fqdn ||= "#{site.name}.#{Site.domain}" end def destination! diff --git a/app/models/site.rb b/app/models/site.rb index bd3f01e..3235f3a 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -8,6 +8,8 @@ class Site < ApplicationRecord validates :name, uniqueness: true, hostname: true validates :design_id, presence: true + validate :deploy_local_presence + friendly_id :name, use: %i[finders] belongs_to :design @@ -33,6 +35,8 @@ class Site < ApplicationRecord attr_accessor :jekyll, :collections + accepts_nested_attributes_for :deploys, allow_destroy: true + # El repositorio git para este sitio def repository @repository ||= Site::Repository.new path @@ -370,6 +374,10 @@ class Site < ApplicationRecord Jekyll::Site.new(config) end + def self.domain + ENV.fetch('SUTTY', 'sutty.nl') + end + private # Clona el esqueleto de Sutty para crear el sitio nuevo, no pasa nada @@ -399,4 +407,17 @@ class Site < ApplicationRecord FileUtils.mv old_path, path end + + # Valida si el sitio tiene al menos una forma de alojamiento asociada + # y es la local + # + # TODO: Volver opcional el alojamiento local, pero ahora mismo está + # atado a la generación del sitio así que no puede faltar + def deploy_local_presence + # Usamos size porque queremos saber la cantidad de deploys sin + # guardar también + return if deploys.size.positive? && deploys.map(&:type).include?('DeployLocal') + + errors.add(:deploys, I18n.t('activerecord.errors.models.site.attributes.deploys.deploy_local_presence')) + end end diff --git a/app/views/deploys/_deploy_local.haml b/app/views/deploys/_deploy_local.haml new file mode 100644 index 0000000..8c5f34e --- /dev/null +++ b/app/views/deploys/_deploy_local.haml @@ -0,0 +1,14 @@ +-# + Formulario para alojamiento local. Como el alojamiento local no es + opcional aun, solo enviamos el tipo con el formulario, no necesitamos + nada más. + +.row + .col + %h3= t('.title') + - name = site.name || t('.ejemplo') + = sanitize_markdown t('.help', + fqdn: deploy.object.fqdn || "#{name}.#{Site.domain}"), + tags: %w[p strong em a] + + = deploy.hidden_field :type diff --git a/app/views/deploys/_deploy_zip.haml b/app/views/deploys/_deploy_zip.haml new file mode 100644 index 0000000..11996b0 --- /dev/null +++ b/app/views/deploys/_deploy_zip.haml @@ -0,0 +1,21 @@ +-# Formulario para "alojar" en un zip + +.row + .col + = deploy.hidden_field :id + = deploy.hidden_field :type + %h3 + -# + El checkbox invierte la lógica de destrucción porque queremos + crear el deploy si está activado y destruirlo si está + desactivado. + = deploy.check_box :_destroy, + { checked: deploy.object.persisted? }, + '0', '1' + = deploy.label :_destroy, t('.title') + -# TODO: secar la generación de URLs + - name = site.name || t('.ejemplo') + = sanitize_markdown t('.help', + fqdn: deploy.object.fqdn || "#{name}.#{Site.domain}", + file: deploy.object.file || "#{name}.zip"), + tags: %w[p strong em a] diff --git a/app/views/sites/_form.haml b/app/views/sites/_form.haml index db9808c..734e1e2 100644 --- a/app/views/sites/_form.haml +++ b/app/views/sites/_form.haml @@ -46,5 +46,14 @@ %hr/ + .form-group + %h2= t('.deploys.title') + %p.lead= t('.help.deploys') + + = f.fields_for :deploys do |deploy| + = render "deploys/#{deploy.object.type.underscore}", + deploy: deploy, site: site + %hr/ + .form-group = f.submit submit, class: 'btn btn-success' diff --git a/config/locales/es.yml b/config/locales/es.yml index b3a248c..5878d28 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -11,6 +11,10 @@ es: name: 'Nombre' errors: models: + site: + attributes: + deploys: + deploy_local_presence: '¡Necesitamos poder generar el sitio!' invitadx: attributes: email: @@ -145,6 +149,25 @@ es: lang: 'Idioma' logout: 'Salir' error: 'Hubo un error al iniciar la sesión. ¿Escribiste bien tus credenciales?' + deploys: + deploy_local: + title: 'Alojar en Sutty' + help: | + El sitio estará disponible en . + + Estamos desarrollando la posibilidad de agregar tus propios + dominios, ¡ayudanos! + ejemplo: 'ejemplo' + deploy_zip: + title: 'Generar un archivo ZIP' + help: | + Los archivos ZIP contienen y comprimen todos los archivos de tu + sitio. Con esta opción podrás descargar y compartir tu sitio + entero a través de la dirección y + guardarla como copia de seguridad o una estrategia de + alojamiento solidario, donde muchas personas comparten una copia + de tu sitio. + ejemplo: 'ejemplo' sites: actions: 'Acciones' posts: 'Ver y editar artículos' @@ -171,6 +194,11 @@ es: de autore. Esto significa que nadie puede hacer uso de nuestras obras sin permiso explícito. Con las licencias establecemos condiciones bajo las que queremos compartir.' + deploys: | + Sutty te permite alojar tu sitio en distintos lugares al mismo + tiempo. Esta estrategia facilita que el sitio esté disponible + aun cuando algunos de los alojamientos no funcionen. + design: title: 'Diseño' actions: 'Información sobre este diseño' @@ -179,6 +207,8 @@ es: licencia: title: 'Licencia del sitio y todo lo que se publique' url: 'Leer la licencia' + deploys: + title: '¿Dónde querés alojar tu sitio?' fetch: title: 'Actualizar el sitio' help: diff --git a/test/controllers/sites_controller_test.rb b/test/controllers/sites_controller_test.rb index 5796ea9..72d3ebc 100644 --- a/test/controllers/sites_controller_test.rb +++ b/test/controllers/sites_controller_test.rb @@ -35,13 +35,40 @@ class SitesControllerTest < ActionDispatch::IntegrationTest site: { name: name, design_id: create(:design).id, - licencia_id: create(:licencia).id + licencia_id: create(:licencia).id, + deploys_attributes: { + '0' => { + type: 'DeployLocal' + } + } } } - assert_nothing_raised do - site = Site.find_by_name(name) - site.destroy + site = Site.find_by_name(name) + + assert site + assert_equal @usuarie.email, site.roles.first.usuarie.email + assert_equal 'usuarie', site.roles.first.rol + + site.destroy + end + + test 'no se pueden crear con cualquier deploy' do + name = SecureRandom.hex + + assert_raise ActiveRecord::SubclassNotFound do + post sites_url, headers: @authorization, params: { + site: { + name: name, + design_id: create(:design).id, + licencia_id: create(:licencia).id, + deploys_attributes: { + '0' => { + type: 'DeployNoExiste' + } + } + } + } end end end diff --git a/test/factories/site.rb b/test/factories/site.rb index 95cce4e..f59221e 100644 --- a/test/factories/site.rb +++ b/test/factories/site.rb @@ -5,5 +5,13 @@ FactoryBot.define do name { "test-#{SecureRandom.hex}" } design licencia + + after :build do |site| + site.deploys << build(:deploy_local, site: site) + end + + after :create do |site| + site.deploys << create(:deploy_local, site: site) + end end end From c282870db61784d5482e3f1e8b64ef86e457aa6c Mon Sep 17 00:00:00 2001 From: f Date: Thu, 25 Jul 2019 20:57:21 -0300 Subject: [PATCH 20/44] traducciones faltantes --- config/locales/en.yml | 32 ++++++++++++++++++++++++++++++++ config/locales/es.yml | 2 ++ 2 files changed, 34 insertions(+) diff --git a/config/locales/en.yml b/config/locales/en.yml index cbc036a..957ac21 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2,6 +2,10 @@ en: activerecord: errors: models: + site: + attributes: + deploys: + deploy_local_presence: 'We need to be build the site!' invitadx: attributes: email: @@ -75,6 +79,27 @@ en: sesiones: 'Sessions' anexo: 'Appendix' simple: 'Simple' + deploys: + deploy_local: + title: 'Host at Sutty' + help: | + The site will be available at . + + We're working out the details for allowing your own site + domains, you can help us! + ejemplo: 'example' + deploy_zip: + title: 'Generate a ZIP file' + help: | + ZIP files contain and compress all the files of your site. With + this option you can download and also share your whole site + through the address, keep it as backup + or have an strategy of solidarity hosting, were many people + shares a copy of your site. + + It also helps with site archival for historical purposes :) + + ejemplo: 'ejemplo' sites: index: 'This is the list of sites you can edit.' edit_translations: "You can edit texts from your site other than @@ -166,6 +191,11 @@ en: means nobody can use our works without explicit permission. By using licenses, we stablish conditions by which we want to share them.' + deploys: | + Sutty allows you to host your site in different places at the + same time. This strategy makes your site available even when + some of them become unavailable. + design: title: 'Design' actions: 'Information about this design' @@ -174,6 +204,8 @@ en: licencia: title: 'License for the site and everything in it' url: 'Read the license' + deploys: + title: 'Where do you want your site to be hosted?' fetch: title: 'Upgrade the site' help: diff --git a/config/locales/es.yml b/config/locales/es.yml index 5878d28..4ddd36e 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -167,6 +167,8 @@ es: guardarla como copia de seguridad o una estrategia de alojamiento solidario, donde muchas personas comparten una copia de tu sitio. + + También sirve para archivo histórico :) ejemplo: 'ejemplo' sites: actions: 'Acciones' From 25160186d851b78f36f1e3196f8c457ef5b063d3 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 25 Jul 2019 21:07:53 -0300 Subject: [PATCH 21/44] =?UTF-8?q?recopilar=20estadisticas=20de=20generaci?= =?UTF-8?q?=C3=B3n=20de=20sitios?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/build_stat.rb | 6 +++ app/models/deploy.rb | 42 ++++++++++++++++--- app/models/deploy_local.rb | 11 +++++ app/models/deploy_zip.rb | 19 ++++++++- .../20190725185427_create_build_stats.rb | 14 +++++++ db/schema.rb | 13 +++++- test/models/deploy_local_test.rb | 4 ++ test/models/deploy_zip_test.rb | 3 ++ 8 files changed, 105 insertions(+), 7 deletions(-) create mode 100644 app/models/build_stat.rb create mode 100644 db/migrate/20190725185427_create_build_stats.rb diff --git a/app/models/build_stat.rb b/app/models/build_stat.rb new file mode 100644 index 0000000..c99bf2c --- /dev/null +++ b/app/models/build_stat.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +# Recolecta estadísticas durante la generación del sitio +class BuildStat < ApplicationRecord + belongs_to :deploy +end diff --git a/app/models/deploy.rb b/app/models/deploy.rb index 2fe5396..e91a9d1 100644 --- a/app/models/deploy.rb +++ b/app/models/deploy.rb @@ -9,6 +9,7 @@ require 'open3' # :attributes`. class Deploy < ApplicationRecord belongs_to :site + has_many :build_stats def deploy raise NotImplementedError @@ -18,16 +19,47 @@ class Deploy < ApplicationRecord raise NotImplementedError end - # Corre un comando y devuelve true si terminó correctamente - def run(cmd) - r = 1 + def size + raise NotImplementedError + end + def time_start + @start = Time.now + end + + def time_stop + @stop = Time.now + end + + def time_spent_in_seconds + (@stop - @start).round(3) + end + + # Corre un comando y devuelve true si terminó correctamente + # rubocop:disable Metrics/MethodLength + # rubocop:disable Metrics/AbcSize + def run(cmd) + # XXX: prestar atención a la concurrencia de sqlite3, se podría + # enviar los datos directamente a una API para que se manejen desde + # el proceso principal de rails y evitar problemas. + stat = build_stats.build action: cmd.split('-', 2).first.tr(' ', '_') + r = nil + + time_start Dir.chdir(site.path) do - Open3.popen2(env, cmd, unsetenv_others: true) do |_, _o, t| + Open3.popen2e(env, cmd, unsetenv_others: true) do |_, o, t| r = t.value + stat.log = o.read end end + time_stop - r.exited? + stat.seconds = time_spent_in_seconds + stat.bytes = size + stat.save + + r.try :exited? end + # rubocop:enable Metrics/MethodLength + # rubocop:enable Metrics/AbcSize end diff --git a/app/models/deploy_local.rb b/app/models/deploy_local.rb index 10c21bd..8622973 100644 --- a/app/models/deploy_local.rb +++ b/app/models/deploy_local.rb @@ -24,10 +24,21 @@ class DeployLocal < Deploy 1 end + # Obtener el tamaño de todos los archivos y directorios (los + # directorios son archivos :) + def size + paths = [destination, File.join(destination, '**', '**')] + + Dir.glob(paths).map do |file| + File.size file + end.inject(:+) + end + private # Un entorno que solo tiene lo que necesitamos def env + # XXX: This doesn't support Windows paths :B paths = [File.dirname(`which bundle`), '/usr/bin'] { 'PATH' => paths.join(':'), 'JEKYLL_ENV' => 'production' } diff --git a/app/models/deploy_zip.rb b/app/models/deploy_zip.rb index 0ec8afc..b514152 100644 --- a/app/models/deploy_zip.rb +++ b/app/models/deploy_zip.rb @@ -12,8 +12,10 @@ class DeployZip < Deploy # Una vez que el sitio está generado, tomar todos los archivos y # y generar un zip accesible públicamente. # - # TODO: Recolectar estadísticas y enviarlas a la base de datos + # rubocop:disable Metrics/MethodLength + # rubocop:disable Metrics/AbcSize def deploy + time_start Dir.chdir(destination) do Zip::File.open(path, Zip::File::CREATE) do |z| Dir.glob('./**/**').each do |f| @@ -21,9 +23,24 @@ class DeployZip < Deploy end end end + time_stop + + build_stats.create action: 'zip', + seconds: time_spent_in_seconds, + bytes: size File.exist? path end + # rubocop:enable Metrics/MethodLength + # rubocop:enable Metrics/AbcSize + + def limit + 1 + end + + def size + File.size path + end private diff --git a/db/migrate/20190725185427_create_build_stats.rb b/db/migrate/20190725185427_create_build_stats.rb new file mode 100644 index 0000000..255ea28 --- /dev/null +++ b/db/migrate/20190725185427_create_build_stats.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class CreateBuildStats < ActiveRecord::Migration[5.2] + def change + create_table :build_stats do |t| + t.timestamps + t.belongs_to :deploy, index: true + t.integer :bytes + t.float :seconds + t.string :action, null: false + t.text :log + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 28ca10a..7e76955 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -12,7 +12,18 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20_190_723_220_002) do +ActiveRecord::Schema.define(version: 20_190_725_185_427) do + create_table 'build_stats', force: :cascade do |t| + t.datetime 'created_at', null: false + t.datetime 'updated_at', null: false + t.integer 'deploy_id' + t.integer 'bytes' + t.float 'seconds' + t.string 'action', null: false + t.text 'log' + t.index ['deploy_id'], name: 'index_build_stats_on_deploy_id' + end + create_table 'deploys', force: :cascade do |t| t.datetime 'created_at', null: false t.datetime 'updated_at', null: false diff --git a/test/models/deploy_local_test.rb b/test/models/deploy_local_test.rb index 39ba701..b992d8c 100644 --- a/test/models/deploy_local_test.rb +++ b/test/models/deploy_local_test.rb @@ -6,6 +6,10 @@ class DeployZipTest < ActiveSupport::TestCase assert deploy_local.deploy assert File.directory?(deploy_local.destination) + assert_equal 3, deploy_local.build_stats.count + + assert deploy_local.build_stats.map(&:bytes).compact.inject(:+).positive? + assert deploy_local.build_stats.map(&:seconds).compact.inject(:+).positive? assert deploy_local.destroy assert_not File.directory?(deploy_local.destination) diff --git a/test/models/deploy_zip_test.rb b/test/models/deploy_zip_test.rb index cbe5559..7e8712d 100644 --- a/test/models/deploy_zip_test.rb +++ b/test/models/deploy_zip_test.rb @@ -15,6 +15,9 @@ class DeployLocalTest < ActiveSupport::TestCase assert File.file?(deploy.path) assert_equal 'application/zip', `file --mime-type "#{escaped_path}"`.split(' ').last + assert_equal 1, deploy.build_stats.count + assert deploy.build_stats.map(&:bytes).inject(:+).positive? + assert deploy.build_stats.map(&:seconds).inject(:+).positive? local.destroy end From 7ed08f8a0dea9e2781fbf3f291397625914972f9 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 25 Jul 2019 21:08:37 -0300 Subject: [PATCH 22/44] de yapa ya no queremos esto --- app/assets/images/background.jpg | Bin 94225 -> 0 bytes app/assets/stylesheets/application.scss | 1 - app/views/layouts/application.html.haml | 26 +++++++++++++++++------- 3 files changed, 19 insertions(+), 8 deletions(-) delete mode 100644 app/assets/images/background.jpg diff --git a/app/assets/images/background.jpg b/app/assets/images/background.jpg deleted file mode 100644 index 0e6c2d0dba7b9b68f0306466a156f3dfb9db0fd8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 94225 zcmeFYbx>SEw=X)l1qc!#c#x0;C%6+lSO~!_z+f3PgAWiSNN@@6u7k@A?t{C#ySwxF zzVqrk@7;UOAMc)1uj*Fa-c?<__gb~ONA_B)f9uyz(@)EQm!DNC3I#3-B}t zkOW|%V_;&SV_{-oVq;_B;F93uzIcI4LHz0^2`v>J9W50N4Z}Nb7KXQ+Of)pCBCMP| ze1d|4^vq&XV*HZa0)l-1FoJ}Qjg9*PmmD9ToR5))k?;R=dujm?V4|p_0Z@?W0LTPL zC4H>iZ1692G&jArj0nNi+K&o#0_eDd)V`m3+T zPqTm*&zi^tC5|LOkEckqAy2mgP*2Hj{~iCAJd*mk|!De!7X zy?j_4fAn~I8y)TY7BW-Ygqv@wsy1IjCg?r$1#c8{mt-8Cw91N`Da)u@7>x4)xwjS7QR=leE+ddT0I)3U`KcUDI-7+# zsGuz<3$s$fNL)$^t?~t@D2Bjbo`)MNP~x}L^CQ&%4LWU$3SUeplF>l5v_)V#;B)Ly z4DCCX!Vh$@uL3fETRT)#yqndhpC_LT%TD!{PkF&Ezg&v{QKv6TZ&Gpooerhm$R}CD zjpm#Mwy6MjloS%6+K-bp%z&akE*l2l;i=9m!%z1w?2KLc_g`4tLn)Dt+O8XIXXE!C zgu(r{u=SoDO~15z(XsWu$m3nEP9(=bUzA|k>ge8W>E$E*)%6NZ$;fvho|=T)OYT1f zqiVP)7}Nynla;1TWWP3&{2igE*i3bc^bnIiyGv*ZCU$|$EH1jh6{Wf_IcP%}gx$u@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AX!5wR9-mFmUae|KQT3Y zB1q!i27PI$@u0iN^|NfH+f50oN4!LBsY%fi%_Tr`j_o9;0c%o-N15h2Zeg+(P@Qyh z;_E!B1+|;ojDx3WVBX^YS;6c1yqDSdTNlrG<$@88NtN(NIBegRQkhKI=O%D zTN>-9Jlg_$NllnQL53ZU{STLqlcJkJ@E573ZjRVoVASM~(hwB8cgpbN?FNk0j|? z7(N#g80tad^ol)SOwNpADb0UA&(&Oqa?A`w)`o7LU0AGD3xu)n#^T}HC*kHpcx#NJ zH567;Dfk%~sZlDu$l*`GG_cVWyFdnuX-W!%yx4yEdfw9z zftzc9Q|}M~wL8OGva)Y~OcJ}UH5VRL#`^Z$u+23-r%6=Ft0_3}7Z3>JVEY{)@!X&) zs46vDZWdbZSQ#O&xS%g=3^ppTeuPb_@NvyFt8X1Z=4Z|YNcpff5)0UX)L|D}>TbeZ z(uT~cY(m&@2^OjO$E(2EEy9(;rWi^H@2!f&+YoZuK13z)b?rWD?{K)P{KE z1<)G#Q!hAGOxMLo!b*NW6&V?3`ls>uM`a-YeUZq&a1>l65T{h#_^%>MkM4Ux7XjLc(Rm3uwk|e+p@F(Oj-!277aze~ih3Y( zOXAOoygzJdsEtPQC&I+=znI{g1e6d&Bo$7w7T2u8*xz*7dD-!6KwK4^gn0O(*_~_; zP&YSz&eSgHpdBvvHZZdx?UKZ@&H6B@;tN4EkZp{(u8Z1A`wg}&UX;LJF7W51`M>a$ z5@7hd+=d?C Date: Thu, 25 Jul 2019 21:36:33 -0300 Subject: [PATCH 23/44] generar el sitio utilizando sidekiq --- .env.example | 3 + Gemfile | 5 ++ Gemfile.lock | 33 ++++++++ app/assets/images/logo.png | Bin 0 -> 2001 bytes app/mailers/application_mailer.rb | 13 ++- app/mailers/deploy_mailer.rb | 28 +++++++ app/views/deploy_mailer/deployed.html.haml | 17 ++++ app/views/deploy_mailer/deployed.text.haml | 12 +++ app/views/layouts/mailer.haml | 8 -- app/views/layouts/mailer.html.haml | 9 ++ app/views/layouts/mailer.text.haml | 2 + app/workers/deploy_worker.rb | 39 +++++++++ config/initializers/sidekiq.rb | 13 +++ config/locales/en.yml | 91 ++++++++++++--------- config/locales/es.yml | 24 +++++- test/test_helper.rb | 3 + test/workers/deploy_worker_test.rb | 21 +++++ 17 files changed, 273 insertions(+), 48 deletions(-) create mode 100644 app/assets/images/logo.png create mode 100644 app/mailers/deploy_mailer.rb create mode 100644 app/views/deploy_mailer/deployed.html.haml create mode 100644 app/views/deploy_mailer/deployed.text.haml delete mode 100644 app/views/layouts/mailer.haml create mode 100644 app/workers/deploy_worker.rb create mode 100644 config/initializers/sidekiq.rb create mode 100644 test/workers/deploy_worker_test.rb diff --git a/.env.example b/.env.example index 2661f00..70475f6 100644 --- a/.env.example +++ b/.env.example @@ -3,3 +3,6 @@ IMAP_SERVER= DEFAULT_FROM= DEVISE_PEPPER= SKEL_SUTTY=https://0xacab.org/sutty/skel.sutty.nl +SUTTY=sutty.nl +REDIS_SERVER= +REDIS_CLIENT= diff --git a/Gemfile b/Gemfile index 67a8c4d..25c7a69 100644 --- a/Gemfile +++ b/Gemfile @@ -47,6 +47,7 @@ gem 'exception_notification' gem 'font-awesome-rails' gem 'friendly_id' gem 'hamlit-rails' +gem 'hiredis' gem 'jekyll' gem 'jquery-rails' gem 'mini_magick' @@ -54,8 +55,12 @@ gem 'mobility' gem 'pundit' gem 'rails-i18n' gem 'rails_warden' +gem 'redis', require: %w[redis redis/connection/hiredis] +gem 'redis-rails' gem 'rubyzip' gem 'rugged' +gem 'sidekiq' +gem 'terminal-table' gem 'validates_hostname' gem 'whenever', require: false diff --git a/Gemfile.lock b/Gemfile.lock index 4a2c2ff..b378733 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -97,6 +97,7 @@ GEM commonmarker (0.18.2) ruby-enum (~> 0.5) concurrent-ruby (1.1.5) + connection_pool (2.2.2) crass (1.0.4) database_cleaner (1.7.0) devise (4.6.2) @@ -161,6 +162,7 @@ GEM activesupport (>= 4.0.1) hamlit (>= 1.2.0) railties (>= 4.0.1) + hiredis (0.6.3) http_parser.rb (0.6.0) i18n (0.9.5) concurrent-ruby (~> 1.0) @@ -242,6 +244,8 @@ GEM pundit (2.0.1) activesupport (>= 3.0.0) rack (2.0.6) + rack-protection (2.0.5) + rack rack-test (1.1.0) rack (>= 1.0, < 3) rails (5.2.3) @@ -280,6 +284,23 @@ GEM ffi (~> 1.0) rbnacl (4.0.2) ffi + redis (4.1.2) + redis-actionpack (5.0.2) + actionpack (>= 4.0, < 6) + redis-rack (>= 1, < 3) + redis-store (>= 1.1.0, < 2) + redis-activesupport (5.0.7) + activesupport (>= 3, < 6) + redis-store (>= 1.3, < 2) + redis-rack (2.0.5) + rack (>= 1.5, < 3) + redis-store (>= 1.2, < 2) + redis-rails (5.0.2) + redis-actionpack (>= 5.0, < 6) + redis-activesupport (>= 5.0, < 6) + redis-store (>= 1.2, < 2) + redis-store (1.6.0) + redis (>= 2.2, < 5) request_store (1.4.1) rack (>= 1.4) responders (3.0.0) @@ -326,6 +347,11 @@ GEM selenium-webdriver (3.141.0) childprocess (~> 0.5) rubyzip (~> 1.2, >= 1.2.2) + sidekiq (5.2.7) + connection_pool (~> 2.2, >= 2.2.2) + rack (>= 1.5.0) + rack-protection (>= 1.5.0) + redis (>= 3.3.5, < 5) simpleidn (0.1.1) unf (~> 0.1.4) spring (2.0.2) @@ -346,6 +372,8 @@ GEM net-ssh (>= 2.8.0) sysexits (1.2.0) temple (0.8.1) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) thor (0.20.3) thread_safe (0.3.6) tilt (2.0.9) @@ -408,6 +436,7 @@ DEPENDENCIES friendly_id haml-lint hamlit-rails + hiredis jbuilder (~> 2.5) jekyll jquery-rails @@ -422,14 +451,18 @@ DEPENDENCIES rails-i18n rails_warden rbnacl (< 5.0) + redis + redis-rails rubocop-rails rubyzip rugged sass-rails (~> 5.0) selenium-webdriver + sidekiq spring spring-watcher-listen (~> 2.0.0) sqlite3 (~> 1.3.6) + terminal-table turbolinks (~> 5) uglifier (>= 1.3.0) validates_hostname diff --git a/app/assets/images/logo.png b/app/assets/images/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..234d6d248ec5a652ce1b660f2a29448900bfe4de GIT binary patch literal 2001 zcmV;?2QK)DP)LIoe~A}j!cbF5A~>T0-xq~wFTJ@&dpjip)&j-c zSIVvzAWm=_BL=av=%H*WsP|1O`#P^B(VCAC-BF4aa&j0>)Ij4owb0ntDN4O?A~R78 zHHlJ!j*lXl%KVd*qMDSP8-o$atW`MUVo$q+=;$?19U-E)jbqo)!jAKd29X9sGI>ZU zO-+>{0?Tl=}Sp=AI>-fSXlCcc+j5s9fa*%Oe8^OOn<;yTa+<@}9 zLV9WvsY2na>LVadNxPvI%<+l|{p>J&C$FP!TOtyH4B`~KBU0w%<+AJ1CPn`B&T<|} zh*7wd?UITRo?DT_5bNWzN&;&4lkTpPr z=2_@XUd##L#lL8jM*hST+wDxGHbf+fKFQ=piLAk>)V{TU%vlP**HgVsYdk8#;SGB< zkG(4ofH;wf)CPzo#0VtQ0;vdbteXR~m0fX;`xSG4)7O}(7x#=!dKqo=N6ev|$wbO= zBI)ZiRh3V~NOit{0;dvnv}dZ(Ak$Vq`z9vRaUzlsWy;O~OkPr&hqf&WAHNf7Y&$9S zoFt0h-UDWp zLZ44EszVe+FU%!<>CyqPn2FQ|h?GojlP+&d;~&cPiC>j@JwS9oV}7StNB8I%&?-~h zza@Y^om_fl&SfG=$uyuGulU>(drZvqPp9_me*4QoT{^rPIS8C+70E6F6o4w^q!lu7mA3F4ww=-_SDFG ziK{`J#6xziR3y~gWlHGn!T-4X1O34S;qd6pZU?O>- zuQ33|S&Lw7x=aJ}wlI@g7{Y;#c>j$-#>M0NV3$rjzw!qqO*7-sh(FP3GILJOUn1G9LJis47T6VkW0?=< zMZ%trj)Ims{LVFgmsmO}QZx;dd@M8~!9;VGG#Zu1KllPf*9;obD5WRd#ep&W|5bS1 zd6|D&nlsfa?04r}yEJk9Mf7xK!`Asqq-~VvyT*7`wl{(v!Mk2vLBE4U1y(fb^Em0( zsRfgcyv>c!}MQ)k^3g%hVWDPNHA( zkjQ=6niuulD;|()Kfm9=C}ecQB=6p)-=%q@`>kofVCY~zMs!&gyEm9~a1H1Q42BoV za1*^5%paU}HIiMpA7l$L^f1|aOj_-aB@aNKhBMee3{OzKaxs>{j`ke2lt-{`$rfU0 z;T0^jQ}?4&mV^0um@ZOAK|!>G?M+*x%i8ipIWQPH_zUxXvJE!M_ElgGVhb@eAd0$x zA#Gfn0p@JB4?_>vCvH~0Sv%Ak%m!j;!EOkY)$-P{br_mx7$PmqqP&)&A53Eu0_Mi& jK~-W?np7q#vN7DhAAy!sSiN@?00000NkvXXu0mjfBwMrq literal 0 HcmV?d00001 diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index d84cb6e..94ffc99 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,6 +1,17 @@ # frozen_string_literal: true +# Configuración base del correo class ApplicationMailer < ActionMailer::Base - default from: 'from@example.com' + helper :application + before_action :inline_logo! + + default from: ENV.fetch('DEFAULT_FROM', "noreply@#{Site.domain}") layout 'mailer' + + private + + def inline_logo! + attachments.inline['logo.png'] ||= + File.read('app/assets/images/logo.png') + end end diff --git a/app/mailers/deploy_mailer.rb b/app/mailers/deploy_mailer.rb new file mode 100644 index 0000000..3383104 --- /dev/null +++ b/app/mailers/deploy_mailer.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# Notifica a les usuaries cuando un sitio se generó con éxito +# +# XXX: No será mejor enviarles un correo con copia? +# TODO: Agregar headers de desuscripción de notificaciones cuando +# tengamos opciones de usuarie +# TODO: Agregar firma GPG y header Autocrypt +# TODO: Cifrar con GPG si le usuarie nos dio su llave +class DeployMailer < ApplicationMailer + # rubocop:disable Metrics/AbcSize + def deployed(which_ones) + @usuarie = Usuarie.find(params[:usuarie]) + @site = @usuarie.sites.find(params[:site]) + @deploys = which_ones + @deploy_local = @site.deploys.find_by(type: 'DeployLocal') + + # Informamos a cada quien en su idioma y damos una dirección de + # respuesta porque a veces les usuaries nos escriben + I18n.with_locale(@usuarie.lang) do + mail(to: @usuarie.email, + reply_to: "sutty@#{Site.domain}", + subject: I18n.t('mailers.deploy_mailer.deployed.subject', + site: @site.name)) + end + end + # rubocop:enable Metrics/AbcSize +end diff --git a/app/views/deploy_mailer/deployed.html.haml b/app/views/deploy_mailer/deployed.html.haml new file mode 100644 index 0000000..66cba36 --- /dev/null +++ b/app/views/deploy_mailer/deployed.html.haml @@ -0,0 +1,17 @@ +%h1= t('.hi') + += sanitize_markdown t('.explanation', fqdn: @deploy_local.fqdn), + tags: %w[p a strong em] + +%table + %thead + %tr + %th= t('.th.type') + %th= t('.th.status') + %tbody + - @deploys.each do |deploy, value| + %tr + %td= t(".#{deploy}.title") + %td= value ? t(".#{deploy}.success") : t(".#{deploy}.error") + += sanitize_markdown t('.help'), tags: %w[p a strong em] diff --git a/app/views/deploy_mailer/deployed.text.haml b/app/views/deploy_mailer/deployed.text.haml new file mode 100644 index 0000000..619d83e --- /dev/null +++ b/app/views/deploy_mailer/deployed.text.haml @@ -0,0 +1,12 @@ += "# #{t('.hi')}" +\ += t('.explanation', fqdn: @deploy_local.fqdn) +\ += Terminal::Table.new do |table| + - table << [t('.th.type'), t('.th.status')] + - table.add_separator + - @deploys.each do |deploy, value| + - table << [t(".#{deploy}.title"), + value ? t(".#{deploy}.success") : t(".#{deploy}.error")] +\ += t('.help') diff --git a/app/views/layouts/mailer.haml b/app/views/layouts/mailer.haml deleted file mode 100644 index cbf6b8e..0000000 --- a/app/views/layouts/mailer.haml +++ /dev/null @@ -1,8 +0,0 @@ -!!! -%html - %head - %meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-Type"}/ - :css - /* Email styles need to be inline */ - %body - = yield diff --git a/app/views/layouts/mailer.html.haml b/app/views/layouts/mailer.html.haml index 5ef091a..9aad3a0 100644 --- a/app/views/layouts/mailer.html.haml +++ b/app/views/layouts/mailer.html.haml @@ -1,3 +1,12 @@ +!!! %html + %head + %meta{ content: 'text/html; charset=utf-8', + 'http-equiv': 'Content-Type' }/ + :css + /* Inline */ %body = yield + + = image_tag attachments['logo.png'].url, alt: 'Logo de Sutty' + = t('.signature') diff --git a/app/views/layouts/mailer.text.haml b/app/views/layouts/mailer.text.haml index 0a90f09..36d87bd 100644 --- a/app/views/layouts/mailer.text.haml +++ b/app/views/layouts/mailer.text.haml @@ -1 +1,3 @@ = yield + += t('.signature') diff --git a/app/workers/deploy_worker.rb b/app/workers/deploy_worker.rb new file mode 100644 index 0000000..1b4ef9c --- /dev/null +++ b/app/workers/deploy_worker.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# Realiza el deploy de un sitio +class DeployWorker + include Sidekiq::Worker + + def perform(site) + site = Site.find(site) + # Asegurarse que DeployLocal sea el primero! + deployed = { deploy_local: deploy_local(site) } + + # No es opcional + raise unless deployed[:deploy_local] + + deploy_others site, deployed + notify_usuaries site, deployed + end + + private + + def deploy_local(site) + site.deploys.find_by(type: 'DeployLocal').deploy + end + + def deploy_others(site, deployed) + site.deploys.where.not(type: 'DeployLocal').find_each do |d| + deployed[d.type.underscore.to_sym] = d.deploy + end + end + + def notify_usuaries(site, deployed) + # TODO: existe site.usuaries_ids? + site.usuaries.find_each do |usuarie| + DeployMailer.with(usuarie: usuarie.id, site: site.id) + .deployed(deployed) + .deliver_now + end + end +end diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb new file mode 100644 index 0000000..0ebf8b8 --- /dev/null +++ b/config/initializers/sidekiq.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +Sidekiq.configure_server do |config| + config.redis = { + url: ENV.fetch('REDIS_SERVER', 'redis://localhost:6379/1') + } +end + +Sidekiq.configure_client do |config| + config.redis = { + url: ENV.fetch('REDIS_CLIENT', 'redis://localhost:6379/1') + } +end diff --git a/config/locales/en.yml b/config/locales/en.yml index 957ac21..157eaf6 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1,5 +1,35 @@ en: + deploy_mailer: + deployed: + subject: "[Sutty] The site %{site} has been built" + hi: "Hi!" + explanation: | + This e-mail is to notify you that Sutty has built your site and + it's available at . + + You'll find details bellow. + th: + type: Type + status: Status + deploy_local: + title: Build the site + success: Success! + error: Error + deploy_zip: + title: Build ZIP file + success: Available for download + error: Error + help: You can contact us by replying this e-mail activerecord: + models: + usuarie: User + attributes: + usuarie: + email: 'E-mail address' + password: 'Password' + password_confirmation: 'Password confirmation' + site: + name: 'Name' errors: models: site: @@ -22,6 +52,8 @@ en: disordered: "The posts are disordered, this will prevent you from reordering them!" disordered_button: 'Reorder!' layouts: + mailer: + signature: 'With love, Sutty' breadcrumb: help: Help collaborations: @@ -29,19 +61,6 @@ en: submit: Register password: incorrect: 'Wrong password, please try again.' - invitadxs: - index: - title: 'Guests' - new: - email: 'E-Mail' - password: 'Password' - password_confirmation: 'Repeat password' - submit: 'Register' - acepta_politicas_de_privacidad: 'I accept the Privacy policy.' - confirmation: - confirmed: 'Your account is confirmed, please log in to continue' - show: - confirmation_sent: "We've sent a confirmation link to your e-mail address. Please open that link to continue." info: posts: reorder: 'The articles have been reordered!' @@ -79,27 +98,6 @@ en: sesiones: 'Sessions' anexo: 'Appendix' simple: 'Simple' - deploys: - deploy_local: - title: 'Host at Sutty' - help: | - The site will be available at . - - We're working out the details for allowing your own site - domains, you can help us! - ejemplo: 'example' - deploy_zip: - title: 'Generate a ZIP file' - help: | - ZIP files contain and compress all the files of your site. With - this option you can download and also share your whole site - through the address, keep it as backup - or have an strategy of solidarity hosting, were many people - shares a copy of your site. - - It also helps with site archival for historical purposes :) - - ejemplo: 'ejemplo' sites: index: 'This is the list of sites you can edit.' edit_translations: "You can edit texts from your site other than @@ -165,6 +163,27 @@ en: logout: 'Log out' lang: 'Language' error: 'There was an error during log in. Did you type your credentials correctly?' + deploys: + deploy_local: + title: 'Host at Sutty' + help: | + The site will be available at . + + We're working out the details for allowing your own site + domains, you can help us! + ejemplo: 'example' + deploy_zip: + title: 'Generate a ZIP file' + help: | + ZIP files contain and compress all the files of your site. With + this option you can download and also share your whole site + through the address, keep it as backup + or have an strategy of solidarity hosting, were many people + shares a copy of your site. + + It also helps with site archival for historical purposes :) + + ejemplo: 'example' sites: actions: 'Actions' posts: 'View and edit posts' @@ -218,10 +237,6 @@ en: message: 'Skeleton upgrade' footer: powered_by: 'is developed by' - templates: - index: 'Templates' - edit: 'Edit' - save: 'Save' i18n: index: 'Translations' edit: 'Edit texts and translations' diff --git a/config/locales/es.yml b/config/locales/es.yml index 4ddd36e..f2f4359 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -1,4 +1,25 @@ es: + deploy_mailer: + deployed: + subject: "[Sutty] El sitio %{site} ha sido generado" + hi: "¡Hola!" + explanation: | + Este correo es para notificarte que Sutty ha generado tu sitio y + ya está disponible en la dirección . + + A continuación encontrarás el detalle de lo que hicimos. + th: + type: Tipo + status: Estado + deploy_local: + title: Generar el sitio + success: ¡Éxito! + error: Hubo un error + deploy_zip: + title: Generar archivo ZIP + success: Disponible para descargar + error: Hubo un error + help: Por cualquier duda, responde este correo para contactarte con nosotres. activerecord: models: usuarie: Usuarie @@ -31,6 +52,8 @@ es: disordered: 'Los artículos no tienen número de orden, esto impedirá que los puedas reordenar' disordered_button: '¡Reordenar!' layouts: + mailer: + signature: 'Con cariño, Sutty' breadcrumb: help: Ayuda collaborations: @@ -200,7 +223,6 @@ es: Sutty te permite alojar tu sitio en distintos lugares al mismo tiempo. Esta estrategia facilita que el sitio esté disponible aun cuando algunos de los alojamientos no funcionen. - design: title: 'Diseño' actions: 'Información sobre este diseño' diff --git a/test/test_helper.rb b/test/test_helper.rb index 49ac63e..437b0da 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -4,6 +4,9 @@ require File.expand_path('../config/environment', __dir__) require 'rails/test_help' require 'open3' +require 'sidekiq/testing' +Sidekiq::Testing.inline! + # rubocop:disable Style/ClassAndModuleChildren class ActiveSupport::TestCase include FactoryBot::Syntax::Methods diff --git a/test/workers/deploy_worker_test.rb b/test/workers/deploy_worker_test.rb new file mode 100644 index 0000000..53e44d9 --- /dev/null +++ b/test/workers/deploy_worker_test.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class DeployWorkerTest < ActiveSupport::TestCase + test 'se puede compilar' do + rol = create :rol + site = rol.site + site.deploys << create(:deploy_zip, site: site) + + site.save + + DeployWorker.perform_async(site.id) + + assert_not ActionMailer::Base.deliveries.empty? + + site.deploys.each do |d| + assert File.exist?(d.try(:path) || d.try(:destination)) + end + + site.destroy + end +end From 15b6493c089ac82b14a882207377da45572dba17 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 25 Jul 2019 22:11:01 -0300 Subject: [PATCH 24/44] poder compilar el sitio con sidekiq --- Capfile | 1 - Gemfile | 1 - Gemfile.lock | 4 - app/controllers/sites_controller.rb | 18 ++--- app/models/site.rb | 60 +------------- app/policies/site_policy.rb | 4 - app/views/sites/index.haml | 9 --- app/workers/deploy_worker.rb | 8 +- bin/jekyll_build_all | 80 ------------------- config/routes.rb | 3 - config/schedule.rb | 8 -- .../20190725185427_create_build_stats.rb | 1 + .../20190726003756_add_status_to_site.rb | 8 ++ db/schema.rb | 3 +- test/controllers/sites_controller_test.rb | 11 +++ 15 files changed, 38 insertions(+), 181 deletions(-) delete mode 100755 bin/jekyll_build_all delete mode 100644 config/schedule.rb create mode 100644 db/migrate/20190726003756_add_status_to_site.rb diff --git a/Capfile b/Capfile index 5abc2d8..1992cec 100644 --- a/Capfile +++ b/Capfile @@ -11,7 +11,6 @@ require 'capistrano/passenger' require 'capistrano/bundler' require 'capistrano/rbenv' require 'capistrano/rails' -require 'whenever/capistrano' require 'capistrano/scm/git' install_plugin Capistrano::SCM::Git diff --git a/Gemfile b/Gemfile index 25c7a69..ffd3d77 100644 --- a/Gemfile +++ b/Gemfile @@ -62,7 +62,6 @@ gem 'rugged' gem 'sidekiq' gem 'terminal-table' gem 'validates_hostname' -gem 'whenever', require: false group :development, :test do gem 'pry' diff --git a/Gemfile.lock b/Gemfile.lock index b378733..7250ed9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -91,7 +91,6 @@ GEM carrierwave-i18n (0.2.0) childprocess (0.9.0) ffi (~> 1.0, >= 1.0.11) - chronic (0.10.2) coderay (1.1.2) colorator (1.1.0) commonmarker (0.18.2) @@ -401,8 +400,6 @@ GEM websocket-driver (0.7.0) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.3) - whenever (0.10.0) - chronic (>= 0.6.3) xpath (3.2.0) nokogiri (~> 1.8) @@ -467,7 +464,6 @@ DEPENDENCIES uglifier (>= 1.3.0) validates_hostname web-console (>= 3.3.0) - whenever BUNDLED WITH 1.17.3 diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb index c5008ab..3b2f672 100644 --- a/app/controllers/sites_controller.rb +++ b/app/controllers/sites_controller.rb @@ -79,23 +79,15 @@ class SitesController < ApplicationController end def enqueue - @site = find_site - authorize @site - @site.enqueue! + site = find_site + authorize site + + # XXX: Convertir en una máquina de estados? + DeployWorker.perform_async site.id if site.enqueue! redirect_to sites_path end - def build_log - @site = find_site - authorize @site - - # TODO: eliminar ANSI - render file: @site.build_log, - layout: false, - content_type: 'text/plain; charset=utf-8' - end - def reorder_posts @site = find_site authorize @site diff --git a/app/models/site.rb b/app/models/site.rb index 3235f3a..7b26024 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -7,8 +7,8 @@ class Site < ApplicationRecord validates :name, uniqueness: true, hostname: true validates :design_id, presence: true - validate :deploy_local_presence + validates_inclusion_of :status, in: %w[waiting enqueued building] friendly_id :name, use: %i[finders] @@ -217,65 +217,13 @@ class Site < ApplicationRecord end.flatten.uniq.compact end - def failed_file - File.join(path, '.failed') - end - - def failed? - File.exist? failed_file - end - - def defail - FileUtils.rm failed_file if failed? - end - alias defail! defail - - def build_log - File.join(path, 'build.log') - end - - def build_log? - File.exist? build_log - end - - def queue_file - File.join(path, '.generate') + def enqueue! + !enqueued? && update_attribute(:status, 'enqueued') end def enqueued? - File.exist? queue_file + status == 'enqueued' end - alias queued? enqueued? - - # El sitio se genera cuando se coloca en una cola de generación, para - # que luego lo construya un cronjob - def enqueue - defail! - # TODO: ya van tres métodos donde usamos esta idea, convertir en un - # helper o algo - File.open(queue_file, File::RDWR | File::CREAT, 0o640) do |f| - # Bloquear el archivo para que no sea accedido por otro - # proceso u otra editora - f.flock(File::LOCK_EX) - - # Empezar por el principio - f.rewind - - # Escribir la fecha de creación - f.write(Time.now.to_i.to_s) - - # Eliminar el resto - f.flush - f.truncate(f.pos) - end - end - alias enqueue! enqueue - - # Eliminar de la cola - def dequeue - FileUtils.rm(queue_file) if enqueued? - end - alias dequeue! dequeue # Verifica si los posts están ordenados def ordered?(collection = 'posts') diff --git a/app/policies/site_policy.rb b/app/policies/site_policy.rb index 702d41c..8e4aceb 100644 --- a/app/policies/site_policy.rb +++ b/app/policies/site_policy.rb @@ -55,10 +55,6 @@ class SitePolicy build? end - def build_log? - build? - end - def reorder_posts? build? end diff --git a/app/views/sites/index.haml b/app/views/sites/index.haml index d082408..464a616 100644 --- a/app/views/sites/index.haml +++ b/app/views/sites/index.haml @@ -77,15 +77,6 @@ = fa_icon 'building' = t('sites.enqueue') - - if policy(site).build_log? - - if site.failed? - %button.btn.btn-danger= t('sites.failed') - - if site.build_log? - = render 'layouts/btn_with_tooltip', - tooltip: t('help.sites.build_log'), - text: t('sites.build_log'), - type: 'warning', - link: site_build_log_path(site) - if policy(site).pull? && site.needs_pull? = render 'layouts/btn_with_tooltip', tooltip: t('help.sites.pull'), diff --git a/app/workers/deploy_worker.rb b/app/workers/deploy_worker.rb index 1b4ef9c..15a3154 100644 --- a/app/workers/deploy_worker.rb +++ b/app/workers/deploy_worker.rb @@ -6,14 +6,20 @@ class DeployWorker def perform(site) site = Site.find(site) + site.update_attribute :status, 'building' # Asegurarse que DeployLocal sea el primero! deployed = { deploy_local: deploy_local(site) } # No es opcional - raise unless deployed[:deploy_local] + unless deployed[:deploy_local] + site.update_attribute :status, 'waiting' + raise + end deploy_others site, deployed notify_usuaries site, deployed + + site.update_attribute :status, 'waiting' end private diff --git a/bin/jekyll_build_all b/bin/jekyll_build_all deleted file mode 100755 index daba038..0000000 --- a/bin/jekyll_build_all +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash -# TODO convertir a ruby! -set -e - -rails_root="${PWD}" - -# Encontrar todos los sitios únicos con el archivo `.generate`. Esto -# significa que la usuaria quiso generar el sitio. -find -L ./_sites -mindepth 2 -maxdepth 2 -name .generate \ -| sed "s/\/\.generate$//" \ -| while read _path ; do - # Como seguimos todos los symlinks y los sitios pueden estar - # vinculados entre sí, volvemos a chequear si existe el archivo para - # no generarlo dos veces - test -f "${_path}/.generate" || continue - test -f "${_path}/.generating" && continue - - # Obtenemos las direcciones de correo de las responsables - _mail=($(cat "${_path}/.usuarias")) - _site="$(echo "${_path}" | xargs basename)" - _deploy="${rails_root}/_deploy/${_site}" - - # Entrar al directorio del sitio - pushd "${_path}" &>/dev/null - - # Reiniciar el log con la fecha - date > build.log - - # Instalar las gemas si no están - test -f .bundle/config \ - || bundle install --path=/srv/http/gems.kefir.red \ - >> build.log - - # Actualizar las gemas - bundle >> build.log - # Instalar los assets - test -f yarn.lock \ - && yarn >> build.log - - # Crear el sitio con lujo de detalles y guardar un log, pero a la vez - # tenerlo en la salida estándar para poder enviar al MAILTO del - # cronjob. - # - # Ya que estamos, eliminamos la ruta donde estamos paradas para no dar - # información sobre la servidora. - touch .generating - # Correr en baja prioridad - nice -n 19 \ - bundle exec \ - jekyll build --trace --destination "${_deploy}" 2>&1 \ - | sed -re "s,${_path},,g" \ - >> "build.log" - - # Acciones posteriores - # TODO convertir en un plugin de cada sitio? - if test $? -eq 0; then - # Si funciona, enviar un mail - # TODO enviar un mail más completo y no hardcodear direcciones - echo "Everything was good! You can see your changes in https://${_site}" \ - | mail -b "sysadmin@kefir.red" \ - -s "${_site}: :)" \ - ${_mail[@]} - else - echo "There was an error, please check build log at https://sutty.kefir.red/" \ - | mail -b "sysadmin@kefir.red" \ - -s "${_site}: :(" \ - ${_mail[@]} - date +%s >.failed - fi - - # Eliminar el archivo para sacar el sitio de la cola de compilación - rm -f .generate .generating - # TODO descubrir el grupo según la distro? - chgrp -R http "${_deploy}" - find "${_deploy}" -type f -print0 | xargs -r -0 chmod 640 - find "${_deploy}" -type d -print0 | xargs -r -0 chmod 2750 - - # Volver al principio para continuar con el siguiente sitio - popd &>/dev/null -done diff --git a/config/routes.rb b/config/routes.rb index 3b70187..7e66c76 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true -# rubocop:disable Metrics/BlockLength Rails.application.routes.draw do devise_for :usuaries @@ -42,8 +41,6 @@ Rails.application.routes.draw do # Compilar el sitio post 'enqueue', to: 'sites#enqueue' - get 'build_log', to: 'sites#build_log' post 'reorder_posts', to: 'sites#reorder_posts' end end -# rubocop:enable Metrics/BlockLength diff --git a/config/schedule.rb b/config/schedule.rb deleted file mode 100644 index c17dbfd..0000000 --- a/config/schedule.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -env 'MAILTO', 'sysadmin@kefir.red' -job_type :bash, 'cd :path && ./bin/:task' - -every 3.minutes do - bash 'jekyll_build_all' -end diff --git a/db/migrate/20190725185427_create_build_stats.rb b/db/migrate/20190725185427_create_build_stats.rb index 255ea28..1f41e42 100644 --- a/db/migrate/20190725185427_create_build_stats.rb +++ b/db/migrate/20190725185427_create_build_stats.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +# Crea la tabla de estadísticas de compilación class CreateBuildStats < ActiveRecord::Migration[5.2] def change create_table :build_stats do |t| diff --git a/db/migrate/20190726003756_add_status_to_site.rb b/db/migrate/20190726003756_add_status_to_site.rb new file mode 100644 index 0000000..3697542 --- /dev/null +++ b/db/migrate/20190726003756_add_status_to_site.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +# El status de un sitio +class AddStatusToSite < ActiveRecord::Migration[5.2] + def change + add_column :sites, :status, :string, default: 'waiting' + end +end diff --git a/db/schema.rb b/db/schema.rb index 7e76955..f7c0bd7 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -12,7 +12,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20_190_725_185_427) do +ActiveRecord::Schema.define(version: 20_190_726_003_756) do create_table 'build_stats', force: :cascade do |t| t.datetime 'created_at', null: false t.datetime 'updated_at', null: false @@ -98,6 +98,7 @@ ActiveRecord::Schema.define(version: 20_190_725_185_427) do t.string 'name' t.integer 'design_id' t.integer 'licencia_id' + t.string 'status', default: 'waiting' t.index ['design_id'], name: 'index_sites_on_design_id' t.index ['licencia_id'], name: 'index_sites_on_licencia_id' t.index ['name'], name: 'index_sites_on_name', unique: true diff --git a/test/controllers/sites_controller_test.rb b/test/controllers/sites_controller_test.rb index 72d3ebc..1c5d30e 100644 --- a/test/controllers/sites_controller_test.rb +++ b/test/controllers/sites_controller_test.rb @@ -71,4 +71,15 @@ class SitesControllerTest < ActionDispatch::IntegrationTest } end end + + test 'se pueden encolar' do + Sidekiq::Testing.fake! + + post site_enqueue_url(@site), headers: @authorization + + assert DeployWorker.jobs.count.positive? + assert @site.reload.enqueued? + + Sidekiq::Testing.inline! + end end From 199d86688cc1c71299d58f703da5b549ada3a321 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 26 Jul 2019 20:57:11 -0300 Subject: [PATCH 25/44] WIP de deploy --- Dockerfile | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++ Gemfile.lock | 2 +- Procfile | 3 ++ monit.conf | 8 ++--- 4 files changed, 106 insertions(+), 7 deletions(-) create mode 100644 Dockerfile create mode 100644 Procfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..faa5672 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,100 @@ +# Este Dockerfile está armado pensando en una compilación lanzada desde +# el mismo repositorio de trabajo. Cuando tengamos CI/CD algunas cosas +# como el tarball van a tener que cambiar porque ya vamos a haber hecho +# un clone/pull limpio. +FROM sutty/sdk-ruby:latest as build +MAINTAINER "f " + +# Un entorno base +ENV NOKOGIRI_USE_SYSTEM_LIBRARIES=1 +ENV SECRET_KEY_BASE solo_es_necesaria_para_correr_rake +ENV RAILS_ENV production + +# Para compilar los assets en brotli +RUN apk add --no-cache brotli + +# Empezamos con la usuaria app creada por sdk-ruby +USER app +# Vamos a trabajar dentro de este directorio +WORKDIR /home/app/sutty + +# Copiamos solo el Gemfile para poder instalar las gemas necesarias +COPY --chown=app:www-data ./Gemfile . +COPY --chown=app:www-data ./Gemfile.lock . +# Instalar las gemas de producción +# XXX: No usamos la flag --production porque luego no nos deja +# desinstalar las gemas de los assets +RUN bundle install --path=./vendor --without test development +# Vaciar la caché +RUN rm vendor/ruby/2.5.0/cache/*.gem +# Limpiar las librerías nativas, esto ahorra más espacio y uso de +# memoria ya que no hay que cargar símbolos que no se van a usar. +RUN find vendor -name "*.so" | xargs -rn 1 strip --strip-unneeded + +# Copiar el repositorio git +COPY --chown=app:www-data ./.git/ ./.git/ +# Hacer un tarball de los archivos desde el repositorio +RUN git archive -o ../sutty.tar.gz HEAD + +# Extraer archivos necesarios para compilar los assets +RUN tar xvf ../sutty.tar.gz Rakefile config app yarn.lock package.json +# Instalar los paquetes JS +RUN yarn +# Pre-compilar los assets +RUN bundle exec rake assets:precompile +# Comprimirlos usando brotli +RUN find public/assets -type f | grep -v ".gz$" | xargs -r brotli -k -9 + +# Eliminar la necesidad de un runtime JS en producción, porque los +# assets ya están pre-compilados. +RUN sed -re "/(uglifier|bootstrap|coffee-rails)/d" -i Gemfile +RUN bundle clean + +# Contenedor final +FROM sutty/monit:latest + +# Instalar las dependencias, separamos la librería de base de datos para +# poder reutilizar este primer paso desde otros contenedores +RUN apk add --no-cache libxslt libxml2 tzdata ruby ruby-bundler ruby-json ruby-bigdecimal ruby-rake +RUN apk add --no-cache sqlite-libs +# Necesitamos yarn para que Jekyll pueda generar los sitios +# XXX: Eliminarlo cuando extraigamos la generación de sitios del proceso +# principal +RUN apk add --no-cache yarn +# Instalar foreman para poder correr los servicios +RUN gem install --no-rdoc --no-ri --no-user-install foreman + +# Agregar el grupo del servidor web +RUN addgroup -g 82 -S www-data +# Agregar la usuaria +RUN adduser -s /bin/sh -G www-data -h /srv/http -D app + +# Convertirse en app para instalar +USER app +WORKDIR /srv/http + +# Traer los archivos y colocarlos donde van definitivamente +COPY --from=build --chown=app:www-data /home/app/sutty.tar.gz /tmp/ +# XXX: No vale la pena borrarlo porque sigue ocupando espacio en la capa +# anterior +RUN tar xf /tmp/sutty.tar.gz && rm /tmp/sutty.tar.gz + +# Traer los assets compilados y las gemas +COPY --from=build --chown=app:www-data /home/app/web/public/assets public/assets +COPY --from=build --chown=app:www-data /home/app/web/vendor vendor +COPY --from=build --chown=app:www-data /home/app/web/.bundle .bundle + +# Volver a root para cerrar la compilación +USER root + +# Instalar la configuración de monit y comprobarla +RUN install -m 640 -o root -g root ./monit.conf /etc/monit.d/sutty.conf +RUN monit -t + +# Mantener estos directorios! +VOLUME "/srv/http/_deploy" +VOLUME "/srv/http/_sites" +VOLUME "/srv/http/public" + +# El puerto de puma +EXPOSE 3000 diff --git a/Gemfile.lock b/Gemfile.lock index 7250ed9..9d61132 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -466,4 +466,4 @@ DEPENDENCIES web-console (>= 3.3.0) BUNDLED WITH - 1.17.3 + 2.0.2 diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..367b027 --- /dev/null +++ b/Procfile @@ -0,0 +1,3 @@ +migrate: bundle exec rake db:migrate db:seed +sutty: bundle exec puma -d config.ru +sidekiq: bundle exec sidekiq -t 1 diff --git a/monit.conf b/monit.conf index 3d68634..211b03a 100644 --- a/monit.conf +++ b/monit.conf @@ -1,7 +1,3 @@ -check process rails with pidfile /srv/http/tmp/puma.pid - start program = "/usr/bin/entrypoint rails" as uid app +check process sutty with pidfile /srv/http/tmp/puma.pid + start program = "/bin/sh -c 'cd /srv/http && foreman start migrate && foreman start sutty'" as uid app stop program = "/bin/sh -c 'cat /srv/http/tmp/puma.pid | xargs kill'" - -check process static with pidfile /tmp/darkhttpd.pid - start program = "/usr/bin/entrypoint darkhttpd" - stop program = "/bin/sh -c 'cat /tmp/darkhttpd.pid | xargs kill'" From 59ab20b887e34d99e04b10a57e7531cb767144bd Mon Sep 17 00:00:00 2001 From: f Date: Sat, 27 Jul 2019 12:25:05 -0300 Subject: [PATCH 26/44] el filtro de commonmark para haml arroja un error --- app/views/posts/show.haml | 8 ++++---- config/initializers/commonmarker.rb | 17 ----------------- 2 files changed, 4 insertions(+), 21 deletions(-) delete mode 100644 config/initializers/commonmarker.rb diff --git a/app/views/posts/show.haml b/app/views/posts/show.haml index 32f3951..1c0324a 100644 --- a/app/views/posts/show.haml +++ b/app/views/posts/show.haml @@ -25,8 +25,8 @@ .row .col .content{class: @post.get_front_matter(:dir)} - :markdown - #{@post.content} + = sanitized_markdown @post.content, + tags: %w[h1 h2 h3 h4 h5 h6 p a ul ol li table tr td th tbody thead tfoot em strong sup blockquote cite pre] -# Representar los datos en una tabla: -# Texto: tal cual en una celda @@ -73,8 +73,8 @@ %td= v - elsif data.respond_to? :content -# Contenido del artículo - :markdown - #{data.content} + = sanitized_markdown data.content, + tags: %w[h1 h2 h3 h4 h5 h6 p a ul ol li table tr td th tbody thead tfoot em strong sup blockquote cite pre] - elsif data.respond_to? :strftime -# Fecha = data.strftime('%F') diff --git a/config/initializers/commonmarker.rb b/config/initializers/commonmarker.rb deleted file mode 100644 index 4d6743f..0000000 --- a/config/initializers/commonmarker.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -require 'commonmarker' - -module Haml::Filters - remove_filter('Markdown') # remove the existing Markdown filter - - module Markdown - include Haml::Filters::Base - - def render(text) - CommonMarker.render_html(text, - [:TABLE_PREFER_STYLE_ATTRIBUTES], - %i[table strikethrough autolink tagfilter]) - end - end -end From dc726fdbe04885f159850529d3f839537408c4b4 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 29 Jul 2019 15:15:23 -0300 Subject: [PATCH 27/44] deploy en docker --- .env.example | 1 + .gitignore | 4 ++-- Dockerfile | 31 ++++++++++++++++++++++--------- bin/rails | 35 ++++++++++++++++++++++++++++------- bin/sidekiq | 32 ++++++++++++++++++++++++++++++++ bin/sidekiqctl | 32 ++++++++++++++++++++++++++++++++ config/database.yml | 2 +- monit.conf | 4 ++++ sync_assets.sh | 5 +++++ 9 files changed, 127 insertions(+), 19 deletions(-) create mode 100755 bin/sidekiq create mode 100755 bin/sidekiqctl create mode 100644 sync_assets.sh diff --git a/.env.example b/.env.example index 70475f6..0a8c05d 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,4 @@ +RAILS_ENV=production SECRET_KEY_BASE= IMAP_SERVER= DEFAULT_FROM= diff --git a/.gitignore b/.gitignore index 483c916..5cf7616 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,6 @@ /_sites/* /_deploy/* -/_usuarias/* -/_invitadxs/* +/data/* + .env diff --git a/Dockerfile b/Dockerfile index faa5672..ddf957c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ ENV SECRET_KEY_BASE solo_es_necesaria_para_correr_rake ENV RAILS_ENV production # Para compilar los assets en brotli -RUN apk add --no-cache brotli +RUN apk add --no-cache brotli libgit2-dev rsync cmake # Empezamos con la usuaria app creada por sdk-ruby USER app @@ -21,10 +21,16 @@ WORKDIR /home/app/sutty # Copiamos solo el Gemfile para poder instalar las gemas necesarias COPY --chown=app:www-data ./Gemfile . COPY --chown=app:www-data ./Gemfile.lock . -# Instalar las gemas de producción +# XXX: Esto va a tener permisos de 1000, idealmente el usuario que lanza +# la compilación +RUN rsync -a 172.17.0.1::ccache/ /home/app/.ccache/ +# Instalar las gemas de producción usando ccache para no recompilar +# gemas nativas # XXX: No usamos la flag --production porque luego no nos deja # desinstalar las gemas de los assets -RUN bundle install --path=./vendor --without test development +# RUN --mount=type=cache,target=/home/app/.ccache \ +RUN if ! bundle install --path=./vendor --without test development ; then rsync -a /home/app/.ccache/ 172.17.0.1::ccache/ ; exit 1 ; fi +RUN rsync -a /home/app/.ccache/ 172.17.0.1::ccache/ # Vaciar la caché RUN rm vendor/ruby/2.5.0/cache/*.gem # Limpiar las librerías nativas, esto ahorra más espacio y uso de @@ -37,7 +43,7 @@ COPY --chown=app:www-data ./.git/ ./.git/ RUN git archive -o ../sutty.tar.gz HEAD # Extraer archivos necesarios para compilar los assets -RUN tar xvf ../sutty.tar.gz Rakefile config app yarn.lock package.json +RUN tar xf ../sutty.tar.gz Rakefile config app yarn.lock package.json # Instalar los paquetes JS RUN yarn # Pre-compilar los assets @@ -50,8 +56,10 @@ RUN find public/assets -type f | grep -v ".gz$" | xargs -r brotli -k -9 RUN sed -re "/(uglifier|bootstrap|coffee-rails)/d" -i Gemfile RUN bundle clean + # Contenedor final FROM sutty/monit:latest +ENV RAILS_ENV production # Instalar las dependencias, separamos la librería de base de datos para # poder reutilizar este primer paso desde otros contenedores @@ -61,8 +69,9 @@ RUN apk add --no-cache sqlite-libs # XXX: Eliminarlo cuando extraigamos la generación de sitios del proceso # principal RUN apk add --no-cache yarn +RUN apk add --no-cache libgit2 # Instalar foreman para poder correr los servicios -RUN gem install --no-rdoc --no-ri --no-user-install foreman +RUN gem install --no-document --no-user-install foreman # Agregar el grupo del servidor web RUN addgroup -g 82 -S www-data @@ -80,9 +89,9 @@ COPY --from=build --chown=app:www-data /home/app/sutty.tar.gz /tmp/ RUN tar xf /tmp/sutty.tar.gz && rm /tmp/sutty.tar.gz # Traer los assets compilados y las gemas -COPY --from=build --chown=app:www-data /home/app/web/public/assets public/assets -COPY --from=build --chown=app:www-data /home/app/web/vendor vendor -COPY --from=build --chown=app:www-data /home/app/web/.bundle .bundle +COPY --from=build --chown=app:www-data /home/app/sutty/public/assets public/assets +COPY --from=build --chown=app:www-data /home/app/sutty/vendor vendor +COPY --from=build --chown=app:www-data /home/app/sutty/.bundle .bundle # Volver a root para cerrar la compilación USER root @@ -90,11 +99,15 @@ USER root # Instalar la configuración de monit y comprobarla RUN install -m 640 -o root -g root ./monit.conf /etc/monit.d/sutty.conf RUN monit -t +# Sincronizar los assets a un directorio compartido +RUN apk add --no-cache rsync +COPY ./sync_assets.sh /usr/local/bin/sync_assets +RUN chmod 755 /usr/local/bin/sync_assets # Mantener estos directorios! VOLUME "/srv/http/_deploy" VOLUME "/srv/http/_sites" -VOLUME "/srv/http/public" +VOLUME "/srv/http/_public" # El puerto de puma EXPOSE 3000 diff --git a/bin/rails b/bin/rails index 3504c3f..088d75d 100755 --- a/bin/rails +++ b/bin/rails @@ -1,11 +1,32 @@ #!/usr/bin/env ruby # frozen_string_literal: true -begin - load File.expand_path('spring', __dir__) -rescue LoadError => e - raise unless e.message.include?('spring') +# +# This file was generated by Bundler. +# +# The application 'rails' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require 'pathname' +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path('bundle', __dir__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort( + 'Your `bin/bundle` was not generated by Bundler, so this binstub + cannot run. Replace `bin/bundle` by running `bundle binstubs + bundler --force`, then run this command again.' + ) + end end -APP_PATH = File.expand_path('../config/application', __dir__) -require_relative '../config/boot' -require 'rails/commands' + +require 'rubygems' +require 'bundler/setup' + +load Gem.bin_path('railties', 'rails') diff --git a/bin/sidekiq b/bin/sidekiq new file mode 100755 index 0000000..5d97d88 --- /dev/null +++ b/bin/sidekiq @@ -0,0 +1,32 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'sidekiq' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require 'pathname' +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path('bundle', __dir__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort( + 'Your `bin/bundle` was not generated by Bundler, so this binstub + cannot run. Replace `bin/bundle` by running `bundle binstubs + bundler --force`, then run this command again.' + ) + end +end + +require 'rubygems' +require 'bundler/setup' + +load Gem.bin_path('sidekiq', 'sidekiq') diff --git a/bin/sidekiqctl b/bin/sidekiqctl new file mode 100755 index 0000000..10eb2f4 --- /dev/null +++ b/bin/sidekiqctl @@ -0,0 +1,32 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'sidekiqctl' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require 'pathname' +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path('bundle', __dir__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort( + 'Your `bin/bundle` was not generated by Bundler, so this binstub + cannot run. Replace `bin/bundle` by running `bundle binstubs + bundler --force`, then run this command again.' + ) + end +end + +require 'rubygems' +require 'bundler/setup' + +load Gem.bin_path('sidekiq', 'sidekiqctl') diff --git a/config/database.yml b/config/database.yml index 0d02f24..f7a3238 100644 --- a/config/database.yml +++ b/config/database.yml @@ -22,4 +22,4 @@ test: production: <<: *default - database: db/production.sqlite3 + database: data/production.sqlite3 diff --git a/monit.conf b/monit.conf index 211b03a..4d34d69 100644 --- a/monit.conf +++ b/monit.conf @@ -1,3 +1,7 @@ check process sutty with pidfile /srv/http/tmp/puma.pid start program = "/bin/sh -c 'cd /srv/http && foreman start migrate && foreman start sutty'" as uid app stop program = "/bin/sh -c 'cat /srv/http/tmp/puma.pid | xargs kill'" + +check program sync_assets + with path /usr/local/bin/sync_assets + if status = 0 then unmonitor diff --git a/sync_assets.sh b/sync_assets.sh new file mode 100644 index 0000000..167d620 --- /dev/null +++ b/sync_assets.sh @@ -0,0 +1,5 @@ +#!/bin/sh +# Sincronizar assets desde public a _public para que estén disponibles +# en el contenedor web. + +rsync -a --delete-after public/ _public/ From bb5555126631d75985b905f2b69ced5ea1a058d8 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 29 Jul 2019 15:20:19 -0300 Subject: [PATCH 28/44] bugs --- app/controllers/posts_controller.rb | 4 +-- app/views/posts/show.haml | 45 +++++++++++++++-------------- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 4205ecf..b2ba6f8 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -56,7 +56,7 @@ class PostsController < ApplicationController # Las usuarias pueden especificar una autora, de la contrario por # defecto es la usuaria actual - if current_user.is_a? Usuaria + if @site.usuarie? current_usuarie @post.update_attributes(author: params[:post][:author]) else # Todo lo que crean lxs invitadxs es borrador @@ -99,7 +99,7 @@ class PostsController < ApplicationController @post.update_attributes(repair_nested_params(post_params)) # Solo las usuarias pueden modificar la autoría - if current_user.is_a? Usuaria + if @site.usuarie? current_usuarie if params[:post][:author].present? @post.update_attributes(author: params[:post][:author]) end diff --git a/app/views/posts/show.haml b/app/views/posts/show.haml index 1c0324a..fccf15e 100644 --- a/app/views/posts/show.haml +++ b/app/views/posts/show.haml @@ -1,19 +1,22 @@ +- tags = %w[h1 h2 h3 h4 h5 h6 p a ul ol li table tr td th tbody thead tfoot em strong sup blockquote cite pre] + .row .col = render 'layouts/breadcrumb', - crumbs: [ link_to(t('sites.index'), sites_path), - @site.name, - link_to(t('posts.index'), - site_posts_path(@site)), - @post.title ] + crumbs: [link_to(t('sites.index'), sites_path), + @site.name, + link_to(t('posts.index'), + site_posts_path(@site)), + @post.title] .row .col - %h1{class: @post.get_front_matter(:dir)}= @post.title + %h1{ class: @post.get_front_matter(:dir) }= @post.title %p - translations = @post.translations.map do |translation| - - link_to translation.title, site_post_path(@site, translation, lang: translation.lang) + - link_to translation.title, + site_post_path(@site, translation, lang: translation.lang) = raw translations.join(' / ') .row @@ -24,16 +27,17 @@ .row .col - .content{class: @post.get_front_matter(:dir)} - = sanitized_markdown @post.content, - tags: %w[h1 h2 h3 h4 h5 h6 p a ul ol li table tr td th tbody thead tfoot em strong sup blockquote cite pre] + .content{ class: @post.get_front_matter(:dir) } + = sanitize_markdown @post.content, + tags: tags - -# Representar los datos en una tabla: - -# Texto: tal cual en una celda - -# Array: píldoras - -# Array de Hashes: Tabla - -# Hash: Tabla - -# TODO DRY + -# + Representar los datos en una tabla: + Texto: tal cual en una celda + Array: píldoras + Array de Hashes: Tabla + Hash: Tabla + TODO DRY %table.table.table-condensed.table-striped.table-responsive %tbody - @post.front_matter.each do |key, data| @@ -51,7 +55,7 @@ %tbody - data.each do |r| %tr - - r.each do |_,v| + - r.each do |_, v| %td - if v.is_a? Array - v.each do |s| @@ -73,16 +77,15 @@ %td= v - elsif data.respond_to? :content -# Contenido del artículo - = sanitized_markdown data.content, - tags: %w[h1 h2 h3 h4 h5 h6 p a ul ol li table tr td th tbody thead tfoot em strong sup blockquote cite pre] + = sanitize_markdown data.content, tags: tags - elsif data.respond_to? :strftime -# Fecha = data.strftime('%F') - else -# Texto - if @post.image? key - %img.img-fluid{src: @site.get_url_for_sutty(data)} + %img.img-fluid{ src: @site.get_url_for_sutty(data) } - elsif @post.url? key - %a{href: @site.get_url_for_sutty(data)}= data + %a{ href: @site.get_url_for_sutty(data) }= data - else = data From 5045ec81739c80fd2619d46d0cf1493660c05b5d Mon Sep 17 00:00:00 2001 From: f Date: Mon, 29 Jul 2019 15:28:09 -0300 Subject: [PATCH 29/44] no vamos a testear esto por ahora --- test/models/post_test.rb | 44 ------------------------------------- test/models/usuaria_test.rb | 20 ----------------- 2 files changed, 64 deletions(-) delete mode 100644 test/models/post_test.rb delete mode 100644 test/models/usuaria_test.rb diff --git a/test/models/post_test.rb b/test/models/post_test.rb deleted file mode 100644 index de1a7ae..0000000 --- a/test/models/post_test.rb +++ /dev/null @@ -1,44 +0,0 @@ -# frozen_string_literal: true - -require 'test_helper' - -class PostTest < ActiveSupport::TestCase - setup do - @user = Usuaria.find('f@kefir.red') - @site = @user.sites.select { |s| s.name == 'cyber-women.com' }.first - @post = @site.posts.sample - end - - test 'El post no es nuevo si ya existe' do - assert_not @post.new? - end - - test 'El post está traducido' do - assert @post.translated? - end - - test 'El post tiene un título' do - assert String, @post.title.class - end - - test 'El post tiene una fecha' do - assert DateTime, @post.date.class - end - - test 'Es obvio que un post recién cargado es válido' do - assert @post.valid? - end - - test 'El post se puede borrar' do - path = @post.path - - assert @post.destroy - assert_not File.exist?(path) - - post = @site.posts_for(@post.collection).find do |p| - p.path == @post.path - end - - assert_not post - end -end diff --git a/test/models/usuaria_test.rb b/test/models/usuaria_test.rb deleted file mode 100644 index 1bff620..0000000 --- a/test/models/usuaria_test.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -require 'test_helper' - -class UsuariaTest < ActiveSupport::TestCase - setup do - @mail = 'f@kefir.red' - @usuaria = Usuaria.find(@mail) - end - - test 'La usuaria puede encontrarse por su mail' do - assert_equal @mail, @usuaria.username - end - - test 'La usuaria tiene sitios' do - @usuaria.sites.each do |s| - assert_equal Site, s.class - end - end -end From 45568bbb1214084f5be6304d0b49afe4a8722c3a Mon Sep 17 00:00:00 2001 From: f Date: Mon, 29 Jul 2019 15:51:09 -0300 Subject: [PATCH 30/44] usar redis como cache --- .rubocop.yml | 1 + config/environments/development.rb | 24 ++++++++++++++---------- config/environments/production.rb | 6 +++--- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 8df0329..8b614a3 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -36,6 +36,7 @@ Metrics/MethodLength: Metrics/BlockLength: Exclude: + - 'config/environments/development.rb' - 'config/environments/production.rb' - 'config/initializers/devise.rb' - 'db/schema.rb' diff --git a/config/environments/development.rb b/config/environments/development.rb index ad1c4d9..68c0679 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,11 +1,13 @@ # frozen_string_literal: true Rails.application.configure do - # Settings specified here will take precedence over those in config/application.rb. + # Settings specified here will take precedence over those in + # config/application.rb. - # In the development environment your application's code is reloaded on - # every request. This slows down response time but is perfect for development - # since you don't have to restart the web server when you make code changes. + # In the development environment your application's code is reloaded + # on every request. This slows down response time but is perfect for + # development since you don't have to restart the web server when you + # make code changes. config.cache_classes = false # Do not eager load code on boot. @@ -18,7 +20,7 @@ Rails.application.configure do if Rails.root.join('tmp/caching-dev.txt').exist? config.action_controller.perform_caching = true - config.cache_store = :memory_store + config.cache_store = :redis_cache_store config.public_file_server.headers = { 'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}" } @@ -39,8 +41,8 @@ Rails.application.configure do # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load - # Debug mode disables concatenation and preprocessing of assets. - # This option may cause significant delays in view rendering with a large + # Debug mode disables concatenation and preprocessing of assets. This + # option may cause significant delays in view rendering with a large # number of complex assets. config.assets.debug = true @@ -50,8 +52,9 @@ Rails.application.configure do # Raises error for missing translations # config.action_view.raise_on_missing_translations = true - # Use an evented file watcher to asynchronously detect changes in source code, - # routes, locales, etc. This feature depends on the listen gem. + # Use an evented file watcher to asynchronously detect changes in + # source code, routes, locales, etc. This feature depends on the + # listen gem. config.file_watcher = ActiveSupport::EventedFileUpdateChecker CarrierWave.configure do |config| @@ -63,5 +66,6 @@ Rails.application.configure do config.action_mailer.perform_caching = false config.action_mailer.delivery_method = :letter_opener config.action_mailer.perform_deliveries = true - config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } + config.action_mailer.default_url_options = { host: 'localhost', + port: 3000 } end diff --git a/config/environments/production.rb b/config/environments/production.rb index 12687e0..dcdd555 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -56,12 +56,12 @@ Rails.application.configure do config.log_tags = [:request_id] # Use a different cache store in production. - # config.cache_store = :mem_cache_store + config.cache_store = :redis_cache_store # Use a real queuing backend for Active Job (and separate queues per # environment) - # config.active_job.queue_adapter = :resque - # config.active_job.queue_name_prefix = "sutty_#{Rails.env}" + config.active_job.queue_adapter = :sidekiq + config.active_job.queue_name_prefix = "sutty_#{Rails.env}" config.action_mailer.perform_caching = false # Ignore bad email addresses and do not raise email delivery errors. From 957eb3cc318a6016cc8ab11912b51b0897068d4e Mon Sep 17 00:00:00 2001 From: f Date: Mon, 29 Jul 2019 16:19:46 -0300 Subject: [PATCH 31/44] binstubs de rails --- bin/bundle | 110 +------------------------------------------------- bin/haml-lint | 29 +++++++++++++ bin/rails | 34 ++-------------- bin/rake | 7 ---- bin/setup | 5 +-- bin/update | 8 ++-- bin/yarn | 11 +++++ 7 files changed, 50 insertions(+), 154 deletions(-) create mode 100755 bin/haml-lint create mode 100755 bin/yarn diff --git a/bin/bundle b/bin/bundle index 6965387..f19acf5 100755 --- a/bin/bundle +++ b/bin/bundle @@ -1,109 +1,3 @@ #!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'bundle' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'rubygems' - -m = Module.new do - module_function - - def invoked_as_script? - File.expand_path($PROGRAM_NAME) == File.expand_path(__FILE__) - end - - def env_var_version - ENV['BUNDLER_VERSION'] - end - - def cli_arg_version - return unless invoked_as_script? # don't want to hijack other binstubs - return unless 'update'.start_with?(ARGV.first || ' ') # must be running `bundle update` - - bundler_version = nil - update_index = nil - ARGV.each_with_index do |a, i| - if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN - bundler_version = a - end - next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ - - bundler_version = Regexp.last_match(1) || '>= 0.a' - update_index = i - end - bundler_version - end - - def gemfile - gemfile = ENV['BUNDLE_GEMFILE'] - return gemfile if gemfile && !gemfile.empty? - - File.expand_path('../Gemfile', __dir__) - end - - def lockfile - lockfile = - case File.basename(gemfile) - when 'gems.rb' then gemfile.sub(/\.rb$/, gemfile) - else "#{gemfile}.lock" - end - File.expand_path(lockfile) - end - - def lockfile_version - return unless File.file?(lockfile) - - lockfile_contents = File.read(lockfile) - return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ - - Regexp.last_match(1) - end - - def bundler_version - @bundler_version ||= begin - env_var_version || cli_arg_version || - lockfile_version || "#{Gem::Requirement.default}.a" - end - end - - def load_bundler! - ENV['BUNDLE_GEMFILE'] ||= gemfile - - # must dup string for RG < 1.8 compatibility - activate_bundler(bundler_version.dup) - end - - def activate_bundler(bundler_version) - if Gem::Version.correct?(bundler_version) && Gem::Version.new(bundler_version).release < Gem::Version.new('2.0') - bundler_version = '< 2' - end - gem_error = activation_error_handling do - gem 'bundler', bundler_version - end - return if gem_error.nil? - - require_error = activation_error_handling do - require 'bundler/version' - end - return if require_error.nil? && Gem::Requirement.new(bundler_version).satisfied_by?(Gem::Version.new(Bundler::VERSION)) - - warn "Activating bundler (#{bundler_version}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_version}'`" - exit 42 - end - - def activation_error_handling - yield - nil - rescue StandardError, LoadError => e - e - end -end - -m.load_bundler! - -load Gem.bin_path('bundler', 'bundle') if m.invoked_as_script? +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) +load Gem.bin_path('bundler', 'bundle') diff --git a/bin/haml-lint b/bin/haml-lint new file mode 100755 index 0000000..ae43753 --- /dev/null +++ b/bin/haml-lint @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'haml-lint' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("haml_lint", "haml-lint") diff --git a/bin/rails b/bin/rails index 088d75d..0739660 100755 --- a/bin/rails +++ b/bin/rails @@ -1,32 +1,4 @@ #!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'rails' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path('bundle', __dir__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort( - 'Your `bin/bundle` was not generated by Bundler, so this binstub - cannot run. Replace `bin/bundle` by running `bundle binstubs - bundler --force`, then run this command again.' - ) - end -end - -require 'rubygems' -require 'bundler/setup' - -load Gem.bin_path('railties', 'rails') +APP_PATH = File.expand_path('../config/application', __dir__) +require_relative '../config/boot' +require 'rails/commands' diff --git a/bin/rake b/bin/rake index 1fe6cf0..1724048 100755 --- a/bin/rake +++ b/bin/rake @@ -1,11 +1,4 @@ #!/usr/bin/env ruby -# frozen_string_literal: true - -begin - load File.expand_path('spring', __dir__) -rescue LoadError => e - raise unless e.message.include?('spring') -end require_relative '../config/boot' require 'rake' Rake.application.run diff --git a/bin/setup b/bin/setup index 3b7333e..94fd4d7 100755 --- a/bin/setup +++ b/bin/setup @@ -1,12 +1,9 @@ #!/usr/bin/env ruby -# frozen_string_literal: true - -require 'pathname' require 'fileutils' include FileUtils # path to your application root. -APP_ROOT = Pathname.new File.expand_path('..', __dir__) +APP_ROOT = File.expand_path('..', __dir__) def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") diff --git a/bin/update b/bin/update index 1d6aa6a..58bfaed 100755 --- a/bin/update +++ b/bin/update @@ -1,12 +1,9 @@ #!/usr/bin/env ruby -# frozen_string_literal: true - -require 'pathname' require 'fileutils' include FileUtils # path to your application root. -APP_ROOT = Pathname.new File.expand_path('..', __dir__) +APP_ROOT = File.expand_path('..', __dir__) def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") @@ -20,6 +17,9 @@ chdir APP_ROOT do system! 'gem install bundler --conservative' system('bundle check') || system!('bundle install') + # Install JavaScript dependencies if using Yarn + # system('bin/yarn') + puts "\n== Updating database ==" system! 'bin/rails db:migrate' diff --git a/bin/yarn b/bin/yarn new file mode 100755 index 0000000..460dd56 --- /dev/null +++ b/bin/yarn @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby +APP_ROOT = File.expand_path('..', __dir__) +Dir.chdir(APP_ROOT) do + begin + exec "yarnpkg", *ARGV + rescue Errno::ENOENT + $stderr.puts "Yarn executable was not detected in the system." + $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" + exit 1 + end +end From 5129e6d8d6dddf5e3ecd671409e8990c89814c95 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 29 Jul 2019 16:21:16 -0300 Subject: [PATCH 32/44] usar secretos --- .env.example | 2 -- .gitignore | 4 ++++ config/initializers/devise.rb | 2 +- config/secrets.yml | 32 -------------------------------- 4 files changed, 5 insertions(+), 35 deletions(-) delete mode 100644 config/secrets.yml diff --git a/.env.example b/.env.example index 0a8c05d..eea8055 100644 --- a/.env.example +++ b/.env.example @@ -1,8 +1,6 @@ RAILS_ENV=production -SECRET_KEY_BASE= IMAP_SERVER= DEFAULT_FROM= -DEVISE_PEPPER= SKEL_SUTTY=https://0xacab.org/sutty/skel.sutty.nl SUTTY=sutty.nl REDIS_SERVER= diff --git a/.gitignore b/.gitignore index 5cf7616..b89536c 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,7 @@ /data/* .env + +# Ignore master key for decrypting credentials and more. +/config/master.key +/config/credentials.yml.enc diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index e3dce7c..fe8d487 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -127,7 +127,7 @@ Devise.setup do |config| config.stretches = Rails.env.test? ? 1 : 11 # Set up a pepper to generate the hashed password. - config.pepper = ENV['DEVISE_PEPPER'] + config.pepper = Rails.application.credentials.devise_pepper # Send a notification to the original email when the user's email is # changed. diff --git a/config/secrets.yml b/config/secrets.yml deleted file mode 100644 index aead418..0000000 --- a/config/secrets.yml +++ /dev/null @@ -1,32 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Your secret key is used for verifying the integrity of signed cookies. -# If you change this key, all old signed cookies will become invalid! - -# Make sure the secret is at least 30 characters and all random, -# no regular words or you'll be exposed to dictionary attacks. -# You can use `rails secret` to generate a secure secret key. - -# Make sure the secrets in this file are kept private -# if you're sharing your code publicly. - -# Shared secrets are available across all environments. - -# shared: -# api_key: a1B2c3D4e5F6 - -# Environmental secrets are only available for that specific environment. - -development: - secret_key_base: 18809d32b6661e906759535c3de06955d0eb551a83de5639f1ca4f0375bafd9653b818c4b881942e5cd5cc8da265617c9164fdb63b9f491d4481036c3d23e677 - -test: - secret_key_base: 95f26bd27ca88acb1f0d8d207fa5e60ae7dc56463774990c4acb938110af035690c929f844eaa97cc9a06b67f44631663f40c927b19c706dcccf629143550a2f - -# Do not keep production secrets in the unencrypted secrets file. -# Instead, either read values from the environment. -# Or, use `bin/rails secrets:setup` to configure encrypted secrets -# and move the `production:` environment over there. - -production: - secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> From 11b945721ed2b9e7e9c3122296052cf0bedd34eb Mon Sep 17 00:00:00 2001 From: f Date: Mon, 29 Jul 2019 16:21:34 -0300 Subject: [PATCH 33/44] container: sincronizar antes de monit y copiar Gemfile modificado --- Dockerfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index ddf957c..2d0c39b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -92,17 +92,19 @@ RUN tar xf /tmp/sutty.tar.gz && rm /tmp/sutty.tar.gz COPY --from=build --chown=app:www-data /home/app/sutty/public/assets public/assets COPY --from=build --chown=app:www-data /home/app/sutty/vendor vendor COPY --from=build --chown=app:www-data /home/app/sutty/.bundle .bundle +COPY --from=build --chown=app:www-data /home/app/sutty/Gemfile Gemfile +COPY --from=build --chown=app:www-data /home/app/sutty/Gemfile.lock Gemfile.lock # Volver a root para cerrar la compilación USER root -# Instalar la configuración de monit y comprobarla -RUN install -m 640 -o root -g root ./monit.conf /etc/monit.d/sutty.conf -RUN monit -t # Sincronizar los assets a un directorio compartido RUN apk add --no-cache rsync COPY ./sync_assets.sh /usr/local/bin/sync_assets RUN chmod 755 /usr/local/bin/sync_assets +# Instalar la configuración de monit y comprobarla +RUN install -m 640 -o root -g root ./monit.conf /etc/monit.d/sutty.conf +RUN monit -t # Mantener estos directorios! VOLUME "/srv/http/_deploy" From 282559acbc7b0691897b989e50df615160617bf6 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 29 Jul 2019 16:42:06 -0300 Subject: [PATCH 34/44] deploy: copiar las credenciales --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 2d0c39b..4620f54 100644 --- a/Dockerfile +++ b/Dockerfile @@ -94,6 +94,7 @@ COPY --from=build --chown=app:www-data /home/app/sutty/vendor vendor COPY --from=build --chown=app:www-data /home/app/sutty/.bundle .bundle COPY --from=build --chown=app:www-data /home/app/sutty/Gemfile Gemfile COPY --from=build --chown=app:www-data /home/app/sutty/Gemfile.lock Gemfile.lock +COPY ./config/credentials.yml.enc ./config/credentials.yml.enc # Volver a root para cerrar la compilación USER root From 161d9eede2b903fc40262b1b8c42a6e7d6ddc87e Mon Sep 17 00:00:00 2001 From: f Date: Tue, 30 Jul 2019 17:05:46 -0300 Subject: [PATCH 35/44] =?UTF-8?q?manipular=20la=20configuraci=C3=B3n=20por?= =?UTF-8?q?=20separado?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/site.rb | 37 +++-------- app/models/site/config.rb | 65 +++++++++++++++++++ app/models/site/repository.rb | 4 ++ bin/bundle | 110 +++++++++++++++++++++++++++++++- test/models/site/config_test.rb | 38 +++++++++++ 5 files changed, 223 insertions(+), 31 deletions(-) create mode 100644 app/models/site/config.rb create mode 100644 test/models/site/config_test.rb diff --git a/app/models/site.rb b/app/models/site.rb index 7b26024..dd86a9f 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -70,7 +70,7 @@ class Site < ApplicationRecord # Este sitio acepta invitadxs? def invitadxs? - jekyll.config.fetch('invitadxs', false) + config.fetch('invitadxs', false) end def cover @@ -84,12 +84,12 @@ class Site < ApplicationRecord # Define si el sitio tiene un glosario def glossary? - jekyll.config.fetch('glossary', false) + config.fetch('glossary', false) end # Obtiene la lista de traducciones actuales def translations - @jekyll.config.dig('i18n') || [] + config.fetch('i18n', []) end # Devuelve el idioma por defecto del sitio @@ -146,14 +146,10 @@ class Site < ApplicationRecord end def config - if @jekyll.config.empty? - read - Rails.logger.info 'Leyendo config' - end - - @jekyll.config + @config ||= Site::Config.new(self) end + # TODO: Cambiar a Site::Config apenas empecemos a testear esto def collections_names @jekyll.config['collections'].keys end @@ -270,31 +266,14 @@ class Site < ApplicationRecord File.join('/', 'sites', id, path.gsub('..', '')) end - def get_url_from_site(path) - "https://#{name}#{path}" - end - # El directorio donde se almacenan los sitios def self.site_path File.join(Rails.root, '_sites') end - # El directorio de los sitios de una usuaria - # - # Los sitios se organizan por usuaria, entonces los sitios que - # administra pueden encontrarse directamente en su directorio. - # - # Si comparten gestión con otras usuarias, se hacen links simbólicos - # entre sí. - def self.site_path_for(site) - File.join(Site.site_path, site) - end - - # Comprueba que el directorio parezca ser de jekyll - def self.jekyll?(dir) - File.directory?(dir) && File.exist?(File.join(dir, '_config.yml')) - end - + # TODO: En lugar de leer todo junto de una vez, extraer la carga de + # documentos de Jekyll hacia Sutty para que podamos leer los datos que + # necesitamos. def self.load_jekyll(path) # Pasamos destination porque configuration() toma el directorio # actual y se mezclan :/ diff --git a/app/models/site/config.rb b/app/models/site/config.rb new file mode 100644 index 0000000..34b6469 --- /dev/null +++ b/app/models/site/config.rb @@ -0,0 +1,65 @@ +# frozen_string_literal: true + +class Site + # Representa la configuración del sitio de forma que podamos leer y + # escribir en el archivo _config.yml + class Config < OpenStruct + def initialize(site) + # Iniciar el OpenStruct con el sitio + super(site: site) + + read + end + + # Obtener un valor por defecto a partir de la configuración + def fetch(key, default) + send(:[], key) || default + end + + # Leer el archivo de configuración y setear los atributos en el + # objeto actual, creando los metodos de ostruct + def read + YAML.safe_load(File.read(path)).each do |key, value| + send("#{key}=".to_sym, value) + end + end + + # Escribe los cambios en el repositorio + # + # TODO: Convertir en una clase intermedia que también se encargue de + # guardar en git + def write + r = File.open(path, File::RDWR | File::CREAT, 0o640) do |f| + # Bloquear el archivo para que no sea accedido por otro + # proceso u otra editora + f.flock(File::LOCK_EX) + + # Empezar por el principio + f.rewind + + # Escribir el contenido en YAML + f.write(content.to_yaml) + + # Eliminar el resto + f.flush + f.truncate(f.pos) + end + + r.zero? + end + + # Obtener el contenido de la configuración como un hash, sin el + # sitio correspondiente. + def content + h = to_h.stringify_keys + h.delete 'site' + + h + end + + # Obtener la ruta donde se encuentra la configuración. + def path + File.join site.path, '_config.yml' + end + end +end diff --git a/app/models/site/repository.rb b/app/models/site/repository.rb index e8d49c0..e182a2a 100644 --- a/app/models/site/repository.rb +++ b/app/models/site/repository.rb @@ -18,6 +18,10 @@ class Site end # Trae los cambios del repositorio de origen sin aplicarlos y + # devuelve la cantidad de commits pendientes. + # + # XXX: Prestar atención a la velocidad de respuesta cuando tengamos + # repositorios remotos. def fetch if remote.check_connection :fetch @changes = rugged.fetch(remote)[:received_objects] diff --git a/bin/bundle b/bin/bundle index f19acf5..6965387 100755 --- a/bin/bundle +++ b/bin/bundle @@ -1,3 +1,109 @@ #!/usr/bin/env ruby -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) -load Gem.bin_path('bundler', 'bundle') +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'bundle' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require 'rubygems' + +m = Module.new do + module_function + + def invoked_as_script? + File.expand_path($PROGRAM_NAME) == File.expand_path(__FILE__) + end + + def env_var_version + ENV['BUNDLER_VERSION'] + end + + def cli_arg_version + return unless invoked_as_script? # don't want to hijack other binstubs + return unless 'update'.start_with?(ARGV.first || ' ') # must be running `bundle update` + + bundler_version = nil + update_index = nil + ARGV.each_with_index do |a, i| + if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN + bundler_version = a + end + next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ + + bundler_version = Regexp.last_match(1) || '>= 0.a' + update_index = i + end + bundler_version + end + + def gemfile + gemfile = ENV['BUNDLE_GEMFILE'] + return gemfile if gemfile && !gemfile.empty? + + File.expand_path('../Gemfile', __dir__) + end + + def lockfile + lockfile = + case File.basename(gemfile) + when 'gems.rb' then gemfile.sub(/\.rb$/, gemfile) + else "#{gemfile}.lock" + end + File.expand_path(lockfile) + end + + def lockfile_version + return unless File.file?(lockfile) + + lockfile_contents = File.read(lockfile) + return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ + + Regexp.last_match(1) + end + + def bundler_version + @bundler_version ||= begin + env_var_version || cli_arg_version || + lockfile_version || "#{Gem::Requirement.default}.a" + end + end + + def load_bundler! + ENV['BUNDLE_GEMFILE'] ||= gemfile + + # must dup string for RG < 1.8 compatibility + activate_bundler(bundler_version.dup) + end + + def activate_bundler(bundler_version) + if Gem::Version.correct?(bundler_version) && Gem::Version.new(bundler_version).release < Gem::Version.new('2.0') + bundler_version = '< 2' + end + gem_error = activation_error_handling do + gem 'bundler', bundler_version + end + return if gem_error.nil? + + require_error = activation_error_handling do + require 'bundler/version' + end + return if require_error.nil? && Gem::Requirement.new(bundler_version).satisfied_by?(Gem::Version.new(Bundler::VERSION)) + + warn "Activating bundler (#{bundler_version}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_version}'`" + exit 42 + end + + def activation_error_handling + yield + nil + rescue StandardError, LoadError => e + e + end +end + +m.load_bundler! + +load Gem.bin_path('bundler', 'bundle') if m.invoked_as_script? diff --git a/test/models/site/config_test.rb b/test/models/site/config_test.rb new file mode 100644 index 0000000..1ecbaba --- /dev/null +++ b/test/models/site/config_test.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +class ConfigText < ActiveSupport::TestCase + setup do + @rol = create :rol + @site = @rol.site + @usuarie = @rol.usuarie + end + + teardown do + @site.destroy + end + + test 'se puede leer' do + assert @site.config.is_a?(Site::Config) + assert_equal @site, @site.config.site + assert @site.config.plugins.count.positive? + end + + test 'se puede escribir' do + assert_nothing_raised do + @site.config.name = 'Test' + @site.config.lang = 'es' + end + + assert @site.config.write + + config = Site::Config.new(@site) + + assert_equal 'Test', config.name + assert_equal 'es', config.lang + end + + test 'se puede obtener información' do + assert @site.config.fetch('noexiste', true) + assert @site.config.fetch('sass', false) + end +end From 396b7a488180f314dc302d5d0309c78ff34ddd01 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 30 Jul 2019 17:08:07 -0300 Subject: [PATCH 36/44] ruby 2.5.5 --- .ruby-version | 1 + 1 file changed, 1 insertion(+) create mode 100644 .ruby-version diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..0cadbc1 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.5.5 From 4e1cfdd7262b67cb792825e823f8b78581ae9655 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 30 Jul 2019 18:07:08 -0300 Subject: [PATCH 37/44] guardar los cambios en git! --- app/models/site/config.rb | 33 ++++++++++------------- app/models/site/repository.rb | 24 +++++++++++++++++ app/models/site/writer.rb | 46 +++++++++++++++++++++++++++++++++ config/locales/en.yml | 2 ++ config/locales/es.yml | 2 ++ test/models/site/config_test.rb | 5 +++- 6 files changed, 91 insertions(+), 21 deletions(-) create mode 100644 app/models/site/writer.rb diff --git a/app/models/site/config.rb b/app/models/site/config.rb index 34b6469..9660d9f 100644 --- a/app/models/site/config.rb +++ b/app/models/site/config.rb @@ -19,33 +19,26 @@ class Site # Leer el archivo de configuración y setear los atributos en el # objeto actual, creando los metodos de ostruct def read - YAML.safe_load(File.read(path)).each do |key, value| + data = YAML.safe_load(File.read(path)) + @hash = data.hash + + data.each do |key, value| send("#{key}=".to_sym, value) end end # Escribe los cambios en el repositorio - # - # TODO: Convertir en una clase intermedia que también se encargue de - # guardar en git - def write - r = File.open(path, File::RDWR | File::CREAT, 0o640) do |f| - # Bloquear el archivo para que no sea accedido por otro - # proceso u otra editora - f.flock(File::LOCK_EX) + def write(usuarie) + return if persisted? - # Empezar por el principio - f.rewind + Site::Writer.new(site: site, file: path, + content: content.to_yaml, usuarie: usuarie, + message: I18n.t('sites.repository.config')).save + end - # Escribir el contenido en YAML - f.write(content.to_yaml) - - # Eliminar el resto - f.flush - f.truncate(f.pos) - end - - r.zero? + # Detecta si la configuración cambió comparando con el valor inicial + def persisted? + @hash == content.hash end # Obtener el contenido de la configuración como un hash, sin el diff --git a/app/models/site/repository.rb b/app/models/site/repository.rb index e182a2a..f59ad21 100644 --- a/app/models/site/repository.rb +++ b/app/models/site/repository.rb @@ -78,5 +78,29 @@ class Site walker.each.to_a end + + # Guarda los cambios en git, de a un archivo por vez + # rubocop:disable Metrics/AbcSize + def commit(file:, usuarie:, message:) + rugged.index.add(file) + rugged.index.write + + Rugged::Commit.create(rugged, + update_ref: 'HEAD', + parents: [rugged.head.target], + tree: rugged.index.write_tree, + message: message, + author: author(usuarie), + committer: committer) + end + # rubocop:enable Metrics/AbcSize + + def author(author) + { name: author.name, email: author.email, time: Time.now } + end + + def committer + { name: 'Sutty', email: "sutty@#{Site.domain}", time: Time.now } + end end end diff --git a/app/models/site/writer.rb b/app/models/site/writer.rb new file mode 100644 index 0000000..f9350f1 --- /dev/null +++ b/app/models/site/writer.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +class Site + # Se encarga de guardar los cambios en los archivos y mantenerlos + # actualizados en git + class Writer + attr_reader :site, :file, :content, :usuarie, :message + + def initialize(site:, file:, content:, usuarie:, message:) + @site = site + @content = content + @file = file + @usuarie = usuarie + @message = message + end + + # rubocop:disable Metrics/AbcSize + def save + r = File.open(file, File::RDWR | File::CREAT, 0o640) do |f| + # Bloquear el archivo para que no sea accedido por otro + # proceso u otra editora + f.flock(File::LOCK_EX) + + # Empezar por el principio + f.rewind + + # Escribir el contenido + f.write(content) + + # Eliminar el resto + f.flush + f.truncate(f.pos) + end + + r.zero? && site.repository.commit(file: relative_file, + usuarie: usuarie, + message: message) + end + # rubocop:enable Metrics/AbcSize + + # Devuelve la ruta relativa a la raíz del sitio + def relative_file + Pathname.new(file).relative_path_from(Pathname.new(site.path)).to_s + end + end +end diff --git a/config/locales/en.yml b/config/locales/en.yml index 157eaf6..9b03ef0 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -185,6 +185,8 @@ en: ejemplo: 'example' sites: + repository: + config: 'Changes in config' actions: 'Actions' posts: 'View and edit posts' title: 'Sites' diff --git a/config/locales/es.yml b/config/locales/es.yml index f2f4359..783933d 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -194,6 +194,8 @@ es: También sirve para archivo histórico :) ejemplo: 'ejemplo' sites: + repository: + config: 'Cambios en la configuración' actions: 'Acciones' posts: 'Ver y editar artículos' title: 'Sitios' diff --git a/test/models/site/config_test.rb b/test/models/site/config_test.rb index 1ecbaba..4ccaf37 100644 --- a/test/models/site/config_test.rb +++ b/test/models/site/config_test.rb @@ -23,12 +23,15 @@ class ConfigText < ActiveSupport::TestCase @site.config.lang = 'es' end - assert @site.config.write + assert @site.config.write(@usuarie) config = Site::Config.new(@site) assert_equal 'Test', config.name assert_equal 'es', config.lang + + assert_equal I18n.t('sites.repository.config'), + @site.repository.rugged.head.target.message end test 'se puede obtener información' do From 9a69edb05bb9d0b3cef0c46d510495c7d4e603dd Mon Sep 17 00:00:00 2001 From: f Date: Wed, 31 Jul 2019 17:55:34 -0300 Subject: [PATCH 38/44] agregar titulo y descripcion al sitio --- app/assets/stylesheets/application.scss | 22 ++++++++++++++ app/controllers/sites_controller.rb | 21 +++++++------ app/helpers/application_helper.rb | 17 +++++++++++ app/models/site.rb | 12 ++++++++ app/models/site/config.rb | 4 ++- app/views/sites/_form.haml | 30 +++++++++++++++++-- config/locales/es.yml | 8 +++-- .../20190730211624_add_description_to_site.rb | 8 +++++ .../20190730211756_add_title_to_sites.rb | 8 +++++ db/schema.rb | 4 ++- doc/crear_sitios.md | 10 +++++++ test/controllers/sites_controller_test.rb | 2 ++ test/factories/site.rb | 2 ++ 13 files changed, 133 insertions(+), 15 deletions(-) create mode 100644 db/migrate/20190730211624_add_description_to_site.rb create mode 100644 db/migrate/20190730211756_add_title_to_sites.rb diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 83bffea..097605d 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -5,6 +5,28 @@ @import "select2-theme-bootstrap4/dist/select2-bootstrap"; @import "dragula-with-animation/dist/dragula"; +@font-face { + font-family: 'Saira'; + font-style: normal; + font-weight: 500; + font-display: optional; + src: local('Saira Medium'), local('Saira-Medium'), + font-url('saira/v3/SairaMedium.ttf') format('truetype'); +} + +@font-face { + font-family: 'Saira'; + font-style: normal; + font-weight: 700; + font-display: optional; + src: local('Saira Bold'), local('Saira-Bold'), + font-url('saira/v3/SairaBold.ttf') format('truetype'); +} + +body { + font-family: Saira, sans-serif; +} + $footer-height: 60px; /* Colores */ diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb index 3b2f672..527762a 100644 --- a/app/controllers/sites_controller.rb +++ b/app/controllers/sites_controller.rb @@ -30,11 +30,14 @@ class SitesController < ApplicationController def create @site = Site.new(site_params) - current_usuarie.roles << Rol.new(site: @site, - temporal: false, - rol: 'usuarie') + @site.roles << Rol.new(site: @site, + usuarie: current_usuarie, + temporal: false, + rol: 'usuarie') - if current_usuarie.save + # XXX: Necesitamos escribir la configuración después porque queremos + # registrar quién hizo los cambios en el repositorio + if @site.save && @site.config.write(current_usuarie) redirect_to site_path(@site) else render 'new' @@ -50,7 +53,9 @@ class SitesController < ApplicationController @site = find_site authorize @site - if @site.update(site_params) + # XXX: Necesitamos escribir la configuración después porque queremos + # registrar quién hizo los cambios en el repositorio + if @site.update(site_params) && @site.config.write(current_usuarie) redirect_to sites_path else render 'edit' @@ -133,9 +138,7 @@ class SitesController < ApplicationController def site_params params.require(:site) - .permit(:name, :design_id, :licencia_id, - deploys_attributes: %i[ - type id _destroy - ]) + .permit(:name, :design_id, :licencia_id, :description, :title, + deploys_attributes: %i[type id _destroy]) end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f8ca552..449f9c5 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +# Helpers module ApplicationHelper # Devuelve el atributo name de un campo posiblemente anidado def field_name_for_post(names) @@ -24,4 +25,20 @@ module ApplicationHelper def sanitize_markdown(text, options = {}) sanitize(CommonMarker.render_html(text), options) end + + def invalid?(model, field) + model.errors.messages[field].present? + end + + def form_control(model, field) + if invalid? model, field + 'form-control is-invalid' + else + 'form-control' + end + end + + def form_class(model) + model.errors.messages.empty? ? 'needs-validation' : 'was-validated' + end end diff --git a/app/models/site.rb b/app/models/site.rb index dd86a9f..6c537e0 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -9,6 +9,8 @@ class Site < ApplicationRecord validates :design_id, presence: true validate :deploy_local_presence validates_inclusion_of :status, in: %w[waiting enqueued building] + validates_presence_of :title + validates :description, length: { in: 50..160 } friendly_id :name, use: %i[finders] @@ -32,6 +34,8 @@ class Site < ApplicationRecord after_create :load_jekyll! # Cambiar el nombre del directorio before_update :update_name! + # Guardar la configuración si hubo cambios + after_save :sync_attributes_with_config! attr_accessor :jekyll, :collections @@ -335,6 +339,14 @@ class Site < ApplicationRecord FileUtils.mv old_path, path end + # Sincroniza algunos atributos del sitio con su configuración y + # guarda los cambios + def sync_attributes_with_config! + config.theme = design.gem unless design_id_changed? + config.description = description unless description_changed? + config.title = title unless title_changed? + end + # Valida si el sitio tiene al menos una forma de alojamiento asociada # y es la local # diff --git a/app/models/site/config.rb b/app/models/site/config.rb index 9660d9f..1fc459c 100644 --- a/app/models/site/config.rb +++ b/app/models/site/config.rb @@ -28,12 +28,14 @@ class Site end # Escribe los cambios en el repositorio - def write(usuarie) + def write(usuarie = nil) return if persisted? Site::Writer.new(site: site, file: path, content: content.to_yaml, usuarie: usuarie, message: I18n.t('sites.repository.config')).save + # Actualizar el hash para no escribir dos veces + @hash = content.hash end # Detecta si la configuración cambió comparando con el valor inicial diff --git a/app/views/sites/_form.haml b/app/views/sites/_form.haml index 734e1e2..579d1a9 100644 --- a/app/views/sites/_form.haml +++ b/app/views/sites/_form.haml @@ -1,8 +1,34 @@ -= form_for site do |f| += form_for site, html: { class: form_class(site) } do |f| .form-group %h2= f.label :name %p.lead= t('.help.name') - = f.text_field :name, class: 'form-control' + -# + El dominio contiene letras y números + No puede empezar ni terminar con guiones + No puede estar compuesto solo de números + + = f.text_field :name, + class: form_control(site, :name), + required: true, + pattern: '^([a-z0-9][a-z0-9\-]*)?[a-z0-9]$', + minlength: 1, + maxlength: 63 + - if invalid? site, :name + .invalid-feedback= site.errors.messages[:name].join(', ') + .form-group + %h2= f.label :title + %p.lead= t('.help.title') + = f.text_field :title, class: form_control(site, :title), + required: true + - if invalid? site, :title + .invalid-feedback= site.errors.messages[:title].join(', ') + .form-group + %h2= f.label :description + %p.lead= t('.help.description') + = f.text_area :description, class: form_control(site, :description), + maxlength: 160, minlength: 50, required: true + - if invalid? site, :description + .invalid-feedback= site.errors.messages[:description].join(', ') .form-group %h2= t('.design.title') %p.lead= t('.help.design') diff --git a/config/locales/es.yml b/config/locales/es.yml index 783933d..5f0e543 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -30,6 +30,8 @@ es: password_confirmation: 'Confirmación de contraseña' site: name: 'Nombre' + title: 'Título' + description: 'Descripción' errors: models: site: @@ -215,7 +217,9 @@ es: submit: 'Guardar cambios' form: help: - name: 'El nombre de tu sitio. Solo puede contener letras y números.' + name: 'El nombre de tu sitio que formará parte de la dirección (ejemplo.sutty.nl). Solo puede contener letras minúsculas, números y guiones.' + title: 'El título de tu sitio puede ser lo que quieras.' + description: 'La descripción del sitio, que saldrá en buscadores. Entre 50 y 160 caracteres.' design: 'Elegí el diseño que va a tener tu sitio aquí. Podés cambiarlo luego. De tanto en tanto vamos sumando diseños nuevos.' licencia: 'Todo lo que publicamos posee automáticamente derechos de autore. Esto significa que nadie puede hacer uso de nuestras @@ -231,7 +235,7 @@ es: url: 'Demostración' license: 'Leer la licencia' licencia: - title: 'Licencia del sitio y todo lo que se publique' + title: 'Licencia del sitio y todo lo que publiques' url: 'Leer la licencia' deploys: title: '¿Dónde querés alojar tu sitio?' diff --git a/db/migrate/20190730211624_add_description_to_site.rb b/db/migrate/20190730211624_add_description_to_site.rb new file mode 100644 index 0000000..d907df4 --- /dev/null +++ b/db/migrate/20190730211624_add_description_to_site.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +# Agrega la descripción de un sitio +class AddDescriptionToSite < ActiveRecord::Migration[5.2] + def change + add_column :sites, :description, :text + end +end diff --git a/db/migrate/20190730211756_add_title_to_sites.rb b/db/migrate/20190730211756_add_title_to_sites.rb new file mode 100644 index 0000000..a48a241 --- /dev/null +++ b/db/migrate/20190730211756_add_title_to_sites.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +# Agrega el título al sitio +class AddTitleToSites < ActiveRecord::Migration[5.2] + def change + add_column :sites, :title, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index f7c0bd7..9455733 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -12,7 +12,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20_190_726_003_756) do +ActiveRecord::Schema.define(version: 20_190_730_211_756) do create_table 'build_stats', force: :cascade do |t| t.datetime 'created_at', null: false t.datetime 'updated_at', null: false @@ -99,6 +99,8 @@ ActiveRecord::Schema.define(version: 20_190_726_003_756) do t.integer 'design_id' t.integer 'licencia_id' t.string 'status', default: 'waiting' + t.text 'description' + t.string 'title' t.index ['design_id'], name: 'index_sites_on_design_id' t.index ['licencia_id'], name: 'index_sites_on_licencia_id' t.index ['name'], name: 'index_sites_on_name', unique: true diff --git a/doc/crear_sitios.md b/doc/crear_sitios.md index 92a309c..a70173c 100644 --- a/doc/crear_sitios.md +++ b/doc/crear_sitios.md @@ -212,3 +212,13 @@ método de deployment). El plan es migrar todo esto a de forma que la compilación se haga por separado de sutty. Este es un plan intermedio hasta que tengamos tiempo de hacerlo realmente. + + +# TODO + +* ver las estadisticas de compilación en lugar del log (el log también) +* comitear en git los articulos (igual no es de esta rama...) +* sanitizar titulo y descripcion, tambien escapar +* al crear el sitio incorporar politica de privacidad y codigo de + convivencia +* link a visitar sitio diff --git a/test/controllers/sites_controller_test.rb b/test/controllers/sites_controller_test.rb index 1c5d30e..35646f3 100644 --- a/test/controllers/sites_controller_test.rb +++ b/test/controllers/sites_controller_test.rb @@ -34,6 +34,8 @@ class SitesControllerTest < ActionDispatch::IntegrationTest post sites_url, headers: @authorization, params: { site: { name: name, + title: name, + description: name * 2, design_id: create(:design).id, licencia_id: create(:licencia).id, deploys_attributes: { diff --git a/test/factories/site.rb b/test/factories/site.rb index f59221e..d9d8720 100644 --- a/test/factories/site.rb +++ b/test/factories/site.rb @@ -3,6 +3,8 @@ FactoryBot.define do factory :site do name { "test-#{SecureRandom.hex}" } + title { SecureRandom.hex } + description { SecureRandom.hex * 2 } design licencia From 8bf0bdc508ca1668e14dc4c5e36f89d8a1e3d9b4 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 1 Aug 2019 13:26:47 -0300 Subject: [PATCH 39/44] el mensaje de commit sale con el idioma de le usuarie --- app/models/site/config.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/models/site/config.rb b/app/models/site/config.rb index 1fc459c..8ed79d9 100644 --- a/app/models/site/config.rb +++ b/app/models/site/config.rb @@ -31,9 +31,11 @@ class Site def write(usuarie = nil) return if persisted? - Site::Writer.new(site: site, file: path, - content: content.to_yaml, usuarie: usuarie, - message: I18n.t('sites.repository.config')).save + I18n.with_locale(usuarie.try(:lang) || I18n.default_locale) do + Site::Writer.new(site: site, file: path, + content: content.to_yaml, usuarie: usuarie, + message: I18n.t('sites.repository.config')).save + end # Actualizar el hash para no escribir dos veces @hash = content.hash end From 09346110b0d04f20caf6a0b9e63d30709a471d46 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 1 Aug 2019 15:15:31 -0300 Subject: [PATCH 40/44] privacidad y codigo de conducta --- app/assets/images/icon_external_link.png | Bin 0 -> 144 bytes app/assets/javascripts/external_links.js | 5 +++++ app/assets/stylesheets/application.scss | 9 +++++++++ app/views/sites/_form.haml | 12 ++++++++++++ config/locales/en.yml | 10 +++++++++- config/locales/es.yml | 11 +++++++++++ 6 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 app/assets/images/icon_external_link.png create mode 100644 app/assets/javascripts/external_links.js diff --git a/app/assets/images/icon_external_link.png b/app/assets/images/icon_external_link.png new file mode 100644 index 0000000000000000000000000000000000000000..16f9b92db47a1f1cd9d2320cc7d03122155a5200 GIT binary patch literal 144 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a)4a8DPr>mdKI;Vst028P**8l(j literal 0 HcmV?d00001 diff --git a/app/assets/javascripts/external_links.js b/app/assets/javascripts/external_links.js new file mode 100644 index 0000000..17e9cf2 --- /dev/null +++ b/app/assets/javascripts/external_links.js @@ -0,0 +1,5 @@ +$(document).on('turbolinks:load', function() { + $("a[href^='http://']").attr('target', '_blank'); + $("a[href^='https://']").attr('target', '_blank'); + $("a[href^='//']").attr('target', '_blank'); +}); diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 097605d..e4119a9 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -27,6 +27,15 @@ body { font-family: Saira, sans-serif; } +a { + &[target=_blank] { + /* TODO: Convertir a base64 para no hacer peticiones extra */ + &:after { + content: image-url('icon_external_link.png'); + } + } +} + $footer-height: 60px; /* Colores */ diff --git a/app/views/sites/_form.haml b/app/views/sites/_form.haml index 579d1a9..e9a008a 100644 --- a/app/views/sites/_form.haml +++ b/app/views/sites/_form.haml @@ -15,6 +15,7 @@ maxlength: 63 - if invalid? site, :name .invalid-feedback= site.errors.messages[:name].join(', ') + .form-group %h2= f.label :title %p.lead= t('.help.title') @@ -22,6 +23,7 @@ required: true - if invalid? site, :title .invalid-feedback= site.errors.messages[:title].join(', ') + .form-group %h2= f.label :description %p.lead= t('.help.description') @@ -29,6 +31,8 @@ maxlength: 160, minlength: 50, required: true - if invalid? site, :description .invalid-feedback= site.errors.messages[:description].join(', ') + %hr/ + .form-group %h2= t('.design.title') %p.lead= t('.help.design') @@ -51,6 +55,8 @@ - if design.license = link_to t('.design.license'), design.license, target: '_blank', class: 'btn btn-info' + %hr/ + .form-group %h2= t('.licencia.title') %p.lead= t('.help.licencia') @@ -72,6 +78,12 @@ %hr/ + .form-group + %h2= t('.privacidad.title') + %p.lead= sanitize_markdown t('.help.privacidad'), tags: %w[a] + + %hr/ + .form-group %h2= t('.deploys.title') %p.lead= t('.help.deploys') diff --git a/config/locales/en.yml b/config/locales/en.yml index 9b03ef0..602ec0f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -212,11 +212,17 @@ en: means nobody can use our works without explicit permission. By using licenses, we stablish conditions by which we want to share them.' + privacidad: | + The [privacy policy](https://sutty.nl/en/privacy-policy/) and + [code of conduct](https://sutty.nl/en/code-of-conduct/) inform + your visitors about their privacy and expected conduct of the + site's community. We suggest you use the same documents Sutty + uses. You can modify them as articles after creating the + site. deploys: | Sutty allows you to host your site in different places at the same time. This strategy makes your site available even when some of them become unavailable. - design: title: 'Design' actions: 'Information about this design' @@ -225,6 +231,8 @@ en: licencia: title: 'License for the site and everything in it' url: 'Read the license' + privacidad: + title: 'Privacy policy and code of conduct' deploys: title: 'Where do you want your site to be hosted?' fetch: diff --git a/config/locales/es.yml b/config/locales/es.yml index 5f0e543..7be2b4d 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -225,6 +225,15 @@ es: de autore. Esto significa que nadie puede hacer uso de nuestras obras sin permiso explícito. Con las licencias establecemos condiciones bajo las que queremos compartir.' + privacidad: | + Las [políticas de + privacidad](https://sutty.nl/es/politica-de-privacidad/) y + [código de + convivencia](https://sutty.nl/es/codigo-de-convivencia/) + informan a les visitantes qué garantías de privacidad vas a + darles y con qué códigos se va a autogestionar su comunidad. + Sugerimos las mismas que las de Sutty. Una vez creado el + sitio, podrás editarlas como artículos. deploys: | Sutty te permite alojar tu sitio en distintos lugares al mismo tiempo. Esta estrategia facilita que el sitio esté disponible @@ -237,6 +246,8 @@ es: licencia: title: 'Licencia del sitio y todo lo que publiques' url: 'Leer la licencia' + privacidad: + title: Políticas de privacidad y código de convivencia deploys: title: '¿Dónde querés alojar tu sitio?' fetch: From cc94a76567589fe8f97239aa430295bc3ea79da2 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 1 Aug 2019 20:13:38 -0300 Subject: [PATCH 41/44] no permitir html en description ni title --- app/lib/core_extensions/string/strip_tags.rb | 12 ++++++++++++ app/models/site.rb | 9 +++++++++ config/initializers/core_extensions.rb | 3 +++ doc/crear_sitios.md | 6 +++--- test/models/site_test.rb | 9 +++++++++ 5 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 app/lib/core_extensions/string/strip_tags.rb create mode 100644 config/initializers/core_extensions.rb diff --git a/app/lib/core_extensions/string/strip_tags.rb b/app/lib/core_extensions/string/strip_tags.rb new file mode 100644 index 0000000..76e35f8 --- /dev/null +++ b/app/lib/core_extensions/string/strip_tags.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module CoreExtensions + module String + # Elimina el HTML + module StripTags + def strip_tags + ActionController::Base.helpers.strip_tags(self) + end + end + end +end diff --git a/app/models/site.rb b/app/models/site.rb index 6c537e0..354e376 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -41,6 +41,15 @@ class Site < ApplicationRecord accepts_nested_attributes_for :deploys, allow_destroy: true + # No permitir HTML en estos atributos + def title=(title) + super(title.strip_tags) + end + + def description=(description) + super(description.strip_tags) + end + # El repositorio git para este sitio def repository @repository ||= Site::Repository.new path diff --git a/config/initializers/core_extensions.rb b/config/initializers/core_extensions.rb new file mode 100644 index 0000000..2207fe8 --- /dev/null +++ b/config/initializers/core_extensions.rb @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +String.include CoreExtensions::String::StripTags diff --git a/doc/crear_sitios.md b/doc/crear_sitios.md index a70173c..7f6bd8a 100644 --- a/doc/crear_sitios.md +++ b/doc/crear_sitios.md @@ -218,7 +218,7 @@ tengamos tiempo de hacerlo realmente. * ver las estadisticas de compilación en lugar del log (el log también) * comitear en git los articulos (igual no es de esta rama...) -* sanitizar titulo y descripcion, tambien escapar -* al crear el sitio incorporar politica de privacidad y codigo de - convivencia * link a visitar sitio +* editor de opciones +* forkear gemas +* que les usuaries elijan su propio idioma diff --git a/test/models/site_test.rb b/test/models/site_test.rb index b74daaf..438ef82 100644 --- a/test/models/site_test.rb +++ b/test/models/site_test.rb @@ -76,4 +76,13 @@ class SiteTest < ActiveSupport::TestCase assert File.directory?(@site.path) assert_not File.directory?(path) end + + test 'no se puede guardar html en title y description' do + site = build :site + site.description = "hola" + site.title = "hola" + + assert_equal 'hola', site.description + assert_equal 'hola', site.title + end end From aebe5b67640ed737a6eca447ee55d4110ff2cf00 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 1 Aug 2019 21:20:42 -0300 Subject: [PATCH 42/44] =?UTF-8?q?estad=C3=ADsticas=20b=C3=A1sicas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .rubocop.yml | 1 + app/controllers/stats_controller.rb | 18 ++++++++++++++++++ app/helpers/application_helper.rb | 8 ++++++++ app/models/build_stat.rb | 2 ++ app/models/deploy.rb | 2 +- app/models/site.rb | 1 + app/models/site_stat.rb | 3 +++ app/policies/site_stat_policy.rb | 15 +++++++++++++++ app/views/stats/index.haml | 18 ++++++++++++++++++ config/locales/en.yml | 10 ++++++++++ config/locales/es.yml | 10 ++++++++++ config/routes.rb | 2 ++ doc/crear_sitios.md | 3 +++ 13 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 app/controllers/stats_controller.rb create mode 100644 app/models/site_stat.rb create mode 100644 app/policies/site_stat_policy.rb create mode 100644 app/views/stats/index.haml diff --git a/.rubocop.yml b/.rubocop.yml index 8b614a3..fad6db4 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -40,6 +40,7 @@ Metrics/BlockLength: - 'config/environments/production.rb' - 'config/initializers/devise.rb' - 'db/schema.rb' + - 'config/routes.rb' Metrics/ClassLength: Exclude: diff --git a/app/controllers/stats_controller.rb b/app/controllers/stats_controller.rb new file mode 100644 index 0000000..07baaf1 --- /dev/null +++ b/app/controllers/stats_controller.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# Estadísticas del sitio +class StatsController < ApplicationController + include Pundit + before_action :authenticate_usuarie! + + def index + @site = find_site + authorize SiteStat.new(@site) + + # Solo queremos el promedio de tiempo de compilación, no de + # instalación de dependencias. + stats = @site.build_stats.jekyll + @build_avg = stats.average(:seconds).to_f.round(2) + @build_max = stats.maximum(:seconds).to_f.round(2) + end +end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 449f9c5..8be0d41 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -22,6 +22,14 @@ module ApplicationHelper "#{f.first}[#{f.last}]" end + def distance_of_time_in_words_if_more_than_a_minute(seconds) + if seconds > 60 + distance_of_time_in_words seconds + else + I18n.t('seconds', seconds: seconds) + end + end + def sanitize_markdown(text, options = {}) sanitize(CommonMarker.render_html(text), options) end diff --git a/app/models/build_stat.rb b/app/models/build_stat.rb index c99bf2c..5a6a936 100644 --- a/app/models/build_stat.rb +++ b/app/models/build_stat.rb @@ -3,4 +3,6 @@ # Recolecta estadísticas durante la generación del sitio class BuildStat < ApplicationRecord belongs_to :deploy + + scope :jekyll, -> { where(action: 'bundle_exec_jekyll_build') } end diff --git a/app/models/deploy.rb b/app/models/deploy.rb index e91a9d1..4d0ce45 100644 --- a/app/models/deploy.rb +++ b/app/models/deploy.rb @@ -42,7 +42,7 @@ class Deploy < ApplicationRecord # XXX: prestar atención a la concurrencia de sqlite3, se podría # enviar los datos directamente a una API para que se manejen desde # el proceso principal de rails y evitar problemas. - stat = build_stats.build action: cmd.split('-', 2).first.tr(' ', '_') + stat = build_stats.build action: cmd.split(' -', 2).first.tr(' ', '_') r = nil time_start diff --git a/app/models/site.rb b/app/models/site.rb index 354e376..d566cd3 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -18,6 +18,7 @@ class Site < ApplicationRecord belongs_to :licencia has_many :deploys + has_many :build_stats, through: :deploys has_many :roles has_many :usuaries, -> { where('roles.rol = ?', 'usuarie') }, through: :roles diff --git a/app/models/site_stat.rb b/app/models/site_stat.rb new file mode 100644 index 0000000..73503ac --- /dev/null +++ b/app/models/site_stat.rb @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +SiteStat = Struct.new(:site) diff --git a/app/policies/site_stat_policy.rb b/app/policies/site_stat_policy.rb new file mode 100644 index 0000000..a797034 --- /dev/null +++ b/app/policies/site_stat_policy.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +# Política de acceso a las estadísticas +class SiteStatPolicy + attr_reader :site_stat, :usuarie + + def initialize(usuarie, site_stat) + @usuarie = usuarie + @site_stat = site_stat + end + + def index? + site_stat.site.usuarie? usuarie + end +end diff --git a/app/views/stats/index.haml b/app/views/stats/index.haml new file mode 100644 index 0000000..eb55c5d --- /dev/null +++ b/app/views/stats/index.haml @@ -0,0 +1,18 @@ +.row + .col + = render 'layouts/breadcrumb', + crumbs: [link_to(t('sites.index'), sites_path), + link_to(@site.name, site_path(@site)), t('.title')] +.row + .col + %h1= t('.title') + %p.lead= t('.help') + + %table.table.table-striped.table-condensed + %tbody + %tr + %td= t('.build.average') + %td= distance_of_time_in_words_if_more_than_a_minute @build_avg + %tr + %td= t('.build.maximum') + %td= distance_of_time_in_words_if_more_than_a_minute @build_max diff --git a/config/locales/en.yml b/config/locales/en.yml index 602ec0f..6ad6eb9 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1,4 +1,5 @@ en: + seconds: '%{seconds} seconds' deploy_mailer: deployed: subject: "[Sutty] The site %{site} has been built" @@ -184,6 +185,15 @@ en: It also helps with site archival for historical purposes :) ejemplo: 'example' + stats: + index: + title: Statistics + help: | + Statistics show information about how your site is generated and + how many resources it uses. + build: + average: 'Average building time' + maximum: 'Maximum building time' sites: repository: config: 'Changes in config' diff --git a/config/locales/es.yml b/config/locales/es.yml index 7be2b4d..0a65b29 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -1,4 +1,5 @@ es: + seconds: '%{seconds} segundos' deploy_mailer: deployed: subject: "[Sutty] El sitio %{site} ha sido generado" @@ -195,6 +196,15 @@ es: También sirve para archivo histórico :) ejemplo: 'ejemplo' + stats: + index: + title: Estadísticas + help: | + Las estadísticas visibilizan información sobre cómo se genera y + cuántos recursos utiliza tu sitio. + build: + average: 'Tiempo promedio de generación' + maximum: 'Tiempo máximo de generación' sites: repository: config: 'Cambios en la configuración' diff --git a/config/routes.rb b/config/routes.rb index 7e66c76..a492ba9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -42,5 +42,7 @@ Rails.application.routes.draw do # Compilar el sitio post 'enqueue', to: 'sites#enqueue' post 'reorder_posts', to: 'sites#reorder_posts' + + resources :stats, only: [:index] end end diff --git a/doc/crear_sitios.md b/doc/crear_sitios.md index 7f6bd8a..9155b00 100644 --- a/doc/crear_sitios.md +++ b/doc/crear_sitios.md @@ -217,6 +217,9 @@ tengamos tiempo de hacerlo realmente. # TODO * ver las estadisticas de compilación en lugar del log (el log también) + + agrupar los build stats para poder ver todos los pasos de una + compilación juntos * comitear en git los articulos (igual no es de esta rama...) * link a visitar sitio * editor de opciones From 48b85acaced33923b68cb4f03107803bff5e95c2 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 2 Aug 2019 15:58:15 -0300 Subject: [PATCH 43/44] permitir que les usuaries se cambien el idioma --- app/controllers/application_controller.rb | 20 ++++++++- app/views/devise/registrations/edit.haml | 51 ++++++++++++++++------- app/views/layouts/_breadcrumb.haml | 13 +++--- config/initializers/locale.rb | 2 +- config/locales/devise.views.en.yml | 12 +++--- config/locales/devise.views.es.yml | 19 ++++----- config/locales/en.yml | 6 +++ config/locales/es.yml | 6 +++ doc/crear_sitios.md | 2 +- 9 files changed, 93 insertions(+), 38 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d27b719..b7e9338 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -5,8 +5,12 @@ class ApplicationController < ActionController::Base include ExceptionHandler protect_from_forgery with: :exception + + before_action :configure_permitted_parameters, if: :devise_controller? before_action :set_locale + layout :layout_by_usuarie + # No tenemos índice de sutty, vamos directamente a ver el listado de # sitios def index @@ -17,6 +21,14 @@ class ApplicationController < ActionController::Base private + def layout_by_usuarie + if current_usuarie + 'application' + else + 'devise' + end + end + # Encontrar un sitio por su nombre def find_site id = params[:site_id] || params[:id] @@ -50,6 +62,12 @@ class ApplicationController < ActionController::Base end def set_locale - I18n.locale = session[:lang] if session[:lang].present? + I18n.locale = current_usuarie.lang + end + + protected + + def configure_permitted_parameters + devise_parameter_sanitizer.permit(:account_update, keys: %i[lang]) end end diff --git a/app/views/devise/registrations/edit.haml b/app/views/devise/registrations/edit.haml index d81fff9..31fcb34 100644 --- a/app/views/devise/registrations/edit.haml +++ b/app/views/devise/registrations/edit.haml @@ -1,42 +1,65 @@ +.row + .col + = render 'layouts/breadcrumb', + crumbs: [link_to(t('.index'), sites_path), t('.title')] + .row.align-items-center.justify-content-center.full-height .col-md-6.align-self-center - %h2= t('.title', resource: resource.model_name.human) - = form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| + %h2= t('.title') + = form_for(resource, + as: resource_name, + url: registration_path(resource_name), + html: { method: :put }) do |f| + = render 'devise/shared/error_messages', resource: resource + .form-group = f.label :email = f.email_field :email, autofocus: true, autocomplete: 'email', class: 'form-control' - if devise_mapping.confirmable? && resource.pending_reconfirmation? - %div= t('.currently_waiting_confirmation_for_email', email: resource.unconfirmed_email) + %div + = t('.currently_waiting_confirmation_for_email', + email: resource.unconfirmed_email) + + .form-group + = f.label :lang + = f.select :lang, + I18n.available_locales.map { |lang| [t(lang), lang] }, {}, + class: 'form-control' + .form-group = f.label :password - %i - (#{t('.leave_blank_if_you_don_t_want_to_change_it')}) = f.password_field :password, autocomplete: 'new-password', - class: 'form-control' - - if @minimum_password_length - %em= t('devise.shared.minimum_password_length', count: @minimum_password_length) + class: 'form-control', 'aria-describedby': 'password-help' + %small.text-muted.form-text#password-help + = t('.leave_blank_if_you_don_t_want_to_change_it') + - if @minimum_password_length + = t('devise.shared.minimum_password_length', + count: @minimum_password_length) + .form-group = f.label :password_confirmation = f.password_field :password_confirmation, autocomplete: 'new-password', class: 'form-control' + .form-group = f.label :current_password - %i - (#{t('.we_need_your_current_password_to_confirm_your_changes')}) = f.password_field :current_password, autocomplete: 'current-password', - class: 'form-control' + required: true, + class: 'form-control', + 'aria-describedby': 'current-password-help' + %small.text-muted.form-text#current-password-help + = t('.we_need_your_current_password_to_confirm_your_changes') .actions = f.submit t('.update'), class: 'btn btn-lg btn-primary btn-block' + %hr/ %h3= t('.cancel_my_account') %p - = t('.unhappy') = button_to t('.cancel_my_account'), registration_path(resource_name), data: { confirm: t('.are_you_sure') }, - method: :delete - = link_to t('devise.shared.links.back'), :back + method: :delete, class: 'btn btn-danger btn-block' diff --git a/app/views/layouts/_breadcrumb.haml b/app/views/layouts/_breadcrumb.haml index 01484ac..322f416 100644 --- a/app/views/layouts/_breadcrumb.haml +++ b/app/views/layouts/_breadcrumb.haml @@ -1,17 +1,20 @@ -%nav{'aria-label': 'breadcrumb', role: 'navigation'} +%nav{ 'aria-label': 'breadcrumb', role: 'navigation' } %ol.breadcrumb %li.breadcrumb-item = link_to destroy_usuarie_session_path, method: :delete, data: { toggle: 'tooltip' }, title: t('help.logout'), role: 'button', class: 'btn-text' do = fa_icon 'sign-out', title: t('help.logout') + %li.breadcrumb-item + = link_to edit_usuarie_registration_path, + data: { toggle: 'tooltip' }, title: t('help.usuarie.edit') do + = current_usuarie.email + - if @site.try(:persisted?) && (help = @site.try(:config).try(:dig, 'help')) %li.breadcrumb-item= link_to t('.help'), help, target: '_blank' + - crumbs.compact.each do |crumb| - - if current_user.is_a? Invitadx - - if /\/sites/ =~ crumb - - next - if crumb == crumbs.last - %li.breadcrumb-item.active{'aria-current': 'page'}= crumb + %li.breadcrumb-item.active{ 'aria-current': 'page' }= crumb - else %li.breadcrumb-item= crumb diff --git a/config/initializers/locale.rb b/config/initializers/locale.rb index 056f48a..e9753dc 100644 --- a/config/initializers/locale.rb +++ b/config/initializers/locale.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true Rails.application.configure do - config.i18n.available_locales = %i[es en ar] + config.i18n.available_locales = %i[es en] config.i18n.default_locale = :es end diff --git a/config/locales/devise.views.en.yml b/config/locales/devise.views.en.yml index aa0697c..d4c60db 100644 --- a/config/locales/devise.views.en.yml +++ b/config/locales/devise.views.en.yml @@ -93,14 +93,14 @@ en: registrations: destroyed: Bye! Your account has been successfully cancelled. We hope to see you again soon. edit: + index: 'Back to sites' are_you_sure: Are you sure? cancel_my_account: Cancel my account currently_waiting_confirmation_for_email: 'Currently waiting confirmation for: %{email}' - leave_blank_if_you_don_t_want_to_change_it: leave blank if you don't want to change it - title: Edit %{resource} - unhappy: Unhappy? + leave_blank_if_you_don_t_want_to_change_it: Leave empty if you don't want to change it. + title: Edit my account update: Update - we_need_your_current_password_to_confirm_your_changes: we need your current password to confirm your changes + we_need_your_current_password_to_confirm_your_changes: We need your current password to confirm your changes new: sign_up: Sign up signed_up: Welcome! You have signed up successfully. @@ -126,8 +126,8 @@ en: sign_in_with_provider: Sign in with %{provider} sign_up: Sign up minimum_password_length: - one: "(%{count} character minimum)" - other: "(%{count} characters minimum)" + one: "%{count} character minimum." + other: "%{count} characters minimum." unlocks: new: resend_unlock_instructions: Resend unlock instructions diff --git a/config/locales/devise.views.es.yml b/config/locales/devise.views.es.yml index 0db4db7..affad80 100644 --- a/config/locales/devise.views.es.yml +++ b/config/locales/devise.views.es.yml @@ -93,14 +93,14 @@ es: registrations: destroyed: "¡Adiós! Tu cuenta ha sido cancelada correctamente. Esperamos verte pronto." edit: - are_you_sure: "¿Estás segura?" - cancel_my_account: Anular mi cuenta + index: 'Volver a sitios' + are_you_sure: "¿Estás segure?" + cancel_my_account: Eliminar mi cuenta currently_waiting_confirmation_for_email: 'Actualmente esperando la confirmacion de: %{email} ' - leave_blank_if_you_don_t_want_to_change_it: dejar en blanco si no desea cambiarlo - title: Editar %{resource} - unhappy: "¿Disconforme?" - update: Actualizar - we_need_your_current_password_to_confirm_your_changes: necesitamos tu contraseña actual para confirmar los cambios + leave_blank_if_you_don_t_want_to_change_it: Deja este campo vacío si no deseas cambiarla. + title: Editar mi cuenta + update: Actualizar mi perfil + we_need_your_current_password_to_confirm_your_changes: Necesitamos tu contraseña actual para confirmar los cambios. new: sign_up: Registrarme por primera vez email: O simplemente continuar con tu dirección de correo y contraseña @@ -110,7 +110,6 @@ es: signed_up_but_unconfirmed: Para recibir actualizaciones, se ha enviado un mensaje con un enlace de confirmación a tu correo electrónico. Abre el enlace para activar tu cuenta. update_needs_confirmation: Has actualizado tu cuenta correctamente, pero es necesario confirmar tu nuevo correo electrónico. Por favor, comprueba tu correo y sigue el enlace de confirmación para finalizar la comprobación del nuevo correo electrónico. updated: Tu cuenta se ha actualizado. - updated_but_not_signed_in: sessions: already_signed_out: Sesión finalizada. new: @@ -129,8 +128,8 @@ es: i_dont_have_account: ¿Nunca te registraste en LUNAR? i_have_account: ¿Ya tenés cuenta? minimum_password_length: - one: "(%{count} caracter como mínimo)" - other: "(%{count} caracteres como mínimo)" + one: "%{count} caracter como mínimo." + other: "%{count} caracteres como mínimo." unlocks: new: resend_unlock_instructions: Reenviar instrucciones para desbloquear diff --git a/config/locales/en.yml b/config/locales/en.yml index 6ad6eb9..8db358c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1,4 +1,6 @@ en: + es: Castillian Spanish + en: English seconds: '%{seconds} seconds' deploy_mailer: deployed: @@ -29,6 +31,8 @@ en: email: 'E-mail address' password: 'Password' password_confirmation: 'Password confirmation' + current_password: 'Current password' + lang: 'Main language' site: name: 'Name' errors: @@ -66,6 +70,8 @@ en: posts: reorder: 'The articles have been reordered!' help: + usuarie: + edit: Edit my profile category: 'Category' logout: 'Close the session' breadcrumbs: "What you see up here are the bread crumbs for this site. When you enter a new section, you will see the previous ones and also have a path for where you're standing." diff --git a/config/locales/es.yml b/config/locales/es.yml index 0a65b29..56210ab 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -1,4 +1,6 @@ es: + es: Castellano + en: Inglés seconds: '%{seconds} segundos' deploy_mailer: deployed: @@ -29,6 +31,8 @@ es: email: 'Correo electrónico' password: 'Contraseña' password_confirmation: 'Confirmación de contraseña' + current_password: 'Contraseña actual' + lang: Idioma principal site: name: 'Nombre' title: 'Título' @@ -68,6 +72,8 @@ es: posts: reorder: "¡Los artículos fueron reordenados!" help: + usuarie: + edit: Editar mi perfil category: 'Categoría' logout: 'Cierra la sesión' breadcrumbs: 'Lo que ves arriba son las migas de pan de este sitio. diff --git a/doc/crear_sitios.md b/doc/crear_sitios.md index 9155b00..ed06e77 100644 --- a/doc/crear_sitios.md +++ b/doc/crear_sitios.md @@ -216,6 +216,7 @@ tengamos tiempo de hacerlo realmente. # TODO +* aplicar la licencia al sitio! * ver las estadisticas de compilación en lugar del log (el log también) agrupar los build stats para poder ver todos los pasos de una @@ -224,4 +225,3 @@ tengamos tiempo de hacerlo realmente. * link a visitar sitio * editor de opciones * forkear gemas -* que les usuaries elijan su propio idioma From cfb0d71dbea4f894e388948f94e0c9e17f0946ff Mon Sep 17 00:00:00 2001 From: f Date: Fri, 2 Aug 2019 18:00:54 -0300 Subject: [PATCH 44/44] incluir front matter en las licencias --- db/seeds/licencias.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/db/seeds/licencias.yml b/db/seeds/licencias.yml index 7e04067..27c2931 100644 --- a/db/seeds/licencias.yml +++ b/db/seeds/licencias.yml @@ -7,6 +7,12 @@ description_en: 'The Peer Production License is a license that allows use for any purpose under the same terms, except for commercial purposes, which are only allowed for collectives, cooperatives and other worker-owned "enterprises". We recommend this license if you are inclined towards non-profit terms, since it allows the development of more ethical economies while fending off capitalistic for-profit uses. If you want to know more about it, we invite you to read [The Telekommunist Manifesto](http://networkcultures.org/blog/publication/no-03-the-telekommunist-manifesto-dmytri-kleiner/)' description_es: 'La licencia de Producción de Pares permite el uso con cualquier propósito bajo la misma licencia, a excepción de los usos comerciales que solo están permitidos a colectivos, cooperativas y otras "empresas" en manos de sus trabajadorxs. Recomendamos esta licencia si te estabas inclinando hacia términos sin fines de lucro, ya que permite el desarrollo de economías más éticas al mismo tiempo que impide la explotación capitalista. Si te interesa saber más, te invitamos a leer [El manifiesto telecomunista](https://endefensadelsl.org/manifiesto_telecomunista.html).' deed_en: | + --- + title: License + permalink: license/ + layout: post + --- + # Peer Production License (human-readable version) This is a human-readable summary of the [full @@ -48,6 +54,12 @@ such as publicity, privacy, or moral rights may limit how you use the material. deed_es: | + --- + title: Licencia + permalink: licencia/ + layout: post + --- + # Licencia de producción de pares (versión legible por humanas) Esto es un resumen legible por humanas del [texto legal (la licencia @@ -119,6 +131,12 @@ indicar si hicieron cambios." url_es: 'https://creativecommons.org/licenses/by/4.0/deed.es' deed_en: | + --- + title: License + permalink: license/ + layout: post + --- + This is a human-readable summary of (and not a substitute for) the [license](https://creativecommons.org/licenses/by/4.0/legalcode). @@ -155,6 +173,12 @@ such as publicity, privacy, or moral rights may limit how you use the material. deed_es: | + --- + title: Licencia + permalink: licencia/ + layout: post + --- + Este es un resumen legible por humanes (y no un sustituto) de la [licencia](https://creativecommons.org/licenses/by/4.0/legalcode). @@ -208,6 +232,12 @@ están permitidos, las mejoras hechas con fines de lucro deben ser compartidas bajo la misma licencia." deed_en: | + --- + title: License + permalink: license/ + layout: post + --- + This is a human-readable summary of (and not a substitute for) the [license](https://creativecommons.org/licenses/by-sa/4.0/legalcode). @@ -249,6 +279,12 @@ such as publicity, privacy, or moral rights may limit how you use the material. deed_es: | + --- + title: Licencia + permalink: licencia/ + layout: post + --- + Este es un resumen legible por humanes (y no un sustituto) de la [licencia](https://creativecommons.org/licenses/by/4.0/legalcode).