diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000000..87209befe3 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: [parndt, bricesanchez] diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000000..be66fa6e67 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,53 @@ +name: CI + +on: [push] + +jobs: + test: + strategy: + matrix: + database: [ mysql, postgresql ] + extension: [ core, dragonfly, images, pages, resources ] + ruby: [ "2.7.x", "2.6.x" ] + fail-fast: false + max-parallel: 10 + runs-on: ubuntu-latest + + env: + BUNDLE_JOBS: 4 + BUNDLE_PATH: vendor/bundle + CI: true + DB: ${{ matrix.database }} + MYSQL_PASSWORD: root + PGHOST: localhost + PGUSER: postgres + RAILS_ENV: test + + name: ${{ matrix.extension }} ${{ matrix.ruby }} ${{ matrix.database }} + steps: + - uses: actions/setup-ruby@v1.0.0 + with: + version: ${{ matrix.ruby }} + - uses: actions/checkout@v2 + - run: sudo apt-get update && sudo apt-get install libpq-dev libmysqlclient-dev libsqlite3-dev -y + - run: sudo systemctl start mysql.service + - id: cache-bundler + uses: actions/cache@v2 + with: + path: vendor/bundle + key: ${{ matrix.ruby }}-gem-${{ matrix.database }}-${{ hashFiles('Gemfile') }} + - run: bundle install --without development --path vendor/bundle + - run: bin/rake refinery:testing:dummy_app + env: + PGPORT: ${{ job.services.postgres.ports[5432] }} + + - run: bin/rspec ${{ matrix.extension }}/spec + env: + PGPORT: ${{ job.services.postgres.ports[5432] }} + RETRY_COUNT: 3 + + services: + postgres: + image: postgres:11.5 + ports: ["5432:5432"] + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d8e636a8a4..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,41 +0,0 @@ -language: ruby -dist: bionic -sudo: false -branches: - only: - - master -addons: - postgresql: '10' -services: - - mysql -cache: - bundler: true - directories: - - /home/travis/.webdrivers/ -before_install: - - gem update --system - - gem install bundler -bundler_args: --without development -before_script: - - export RETRY_COUNT=3 - - bin/rake refinery:testing:dummy_app -script: - - bin/rspec $EXTENSION/spec -env: - - DB=postgresql EXTENSION=core - - DB=postgresql EXTENSION=dragonfly - - DB=postgresql EXTENSION=pages - - DB=postgresql EXTENSION=images - - DB=postgresql EXTENSION=resources - - DB=mysql EXTENSION=core - - DB=mysql EXTENSION=dragonfly - - DB=mysql EXTENSION=pages - - DB=mysql EXTENSION=images - - DB=mysql EXTENSION=resources -notifications: - email: true - webhooks: - - https://webhooks.gitter.im/e/b5d48907cdc89864b874 -rvm: - - 2.6 - - 2.5 diff --git a/Gemfile b/Gemfile index 20880a9fc0..2c13a9b35e 100644 --- a/Gemfile +++ b/Gemfile @@ -9,11 +9,6 @@ path "./" do gem "refinerycms-resources" end -gem 'bootsnap', require: false -gem 'listen' - -gem 'activejob' - # Add support for refinerycms-acts-as-indexed gem 'refinerycms-acts-as-indexed', ['~> 3.0', '>= 3.0.0'] @@ -21,25 +16,31 @@ gem 'refinerycms-acts-as-indexed', ['~> 3.0', '>= 3.0.0'] gem 'refinerycms-wymeditor', ['~> 2.2', '>= 2.2.0'] # Database Configuration -unless ENV['TRAVIS'] +unless ENV['CI'] gem 'activerecord-jdbcsqlite3-adapter', '>= 1.3.0.rc1', platform: :jruby gem 'sqlite3', platform: :ruby end -if !ENV['TRAVIS'] || ENV['DB'] == 'mysql' +if !ENV['CI'] || ENV['DB'] == 'mysql' group :mysql do gem 'activerecord-jdbcmysql-adapter', '>= 1.3.0.rc1', platform: :jruby gem 'mysql2', '~> 0.4', :platform => :ruby end end -if !ENV['TRAVIS'] || ENV['DB'] == 'postgresql' +if !ENV['CI'] || ENV['DB'] == 'postgresql' group :postgres, :postgresql do gem 'activerecord-jdbcpostgresql-adapter', '>= 1.3.0.rc1', platform: :jruby gem 'pg', '~> 0.21', platform: :ruby end end +group :development, :test do + gem 'activejob' + gem 'bootsnap', require: false + gem 'listen', '~> 3.0' +end + group :test do gem 'refinerycms-testing', path: './testing' gem 'generator_spec', '~> 0.9.3' diff --git a/certs/parndt.pem b/certs/parndt.pem index 4a8c05fddb..3a304af0d3 100644 --- a/certs/parndt.pem +++ b/certs/parndt.pem @@ -1,25 +1,25 @@ -----BEGIN CERTIFICATE----- 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 -2Oqsxsw30MIZnh2Cw/xLRkc1I50luA== +aW8wDQYJKoZIhvcNAQELBQADggGBALu2HM50B8xqlAXkCwavJDvWWtV9pG1igFUg +friZRWprUQ5nTaNmAd8p8qbJQwaIK2gt+DfYWfB9LtKnQTfbhLRBbmJ7zYw8LjKY +PwCs4RWjDAiuyCO3ppfsz+1bsMUXPLgWlaUkXsUy3nr2NruEFTO9zu3wGYQQ93Tt +vYSHOnP35UB4QjsjNrOO7FBaQfy6O909PP+GnVcJ62s9c26voJz63RSolwY7Jydw +XUlG68jjJKSoDHRzVTmNB7sX8rs8P2kvYkpIUXPHyls3mWBWjBWbdEYWESZrxI2x +dS7jY3AnfqhvsWra2pSREb2IDqPnJrHVOejnEI/zuuufUxLwDx3AC6SMdsyWkZ7V +9OmLt2rg75Sct6h2220lO5ySqYtqAXuOMBDGv5L0zLalx1g8LACA7uILTKVWh8B8 +Hsej0MQ3drCB1eA4c9OXdCUQJnY2aLTq3uNvTbZvoTgWK55eq3KLBJ4zzoKZ4tBX +/HIFI/fEwYlI1Ji3oikUrHkc4rWgaQ== -----END CERTIFICATE----- diff --git a/core/config/locales/sk.yml b/core/config/locales/sk.yml index c77472f905..65de910590 100644 --- a/core/config/locales/sk.yml +++ b/core/config/locales/sk.yml @@ -52,6 +52,11 @@ sk: button_text: Hľadať results_for_html: "Výsledky hľadania pre ‘%{query}’" no_results: Žiadne záznamy sa nenašli + cancel_search: 'Zrušiť vyhľadávanie' + search_input_notice: '' + input: + placeholder: "Hľadať …" + help: 'Napíšte slovo alebo frázu, ktorú chcete vyhľadať' delete: message: Naozaj chcete zmazať '%{title}'? error_messages: @@ -66,6 +71,8 @@ sk: close_this_message: Zavrieť správu draft_page_message: not_live: Táto stránka NIE JE viditeľná pre bežných návštevníkov webu. + skip_to_first_child_page_message: + skip_to_first_child: "Táto stránka má nastavenie \"Presmeruj na prvú substránku\" a nikdy nebude zobrazená návštevníkom" footer: copyright: Copyright © %{year} %{site_name} no_script: diff --git a/core/lib/generators/refinery/cms/templates/config/database.yml.mysql b/core/lib/generators/refinery/cms/templates/config/database.mysql.yml similarity index 100% rename from core/lib/generators/refinery/cms/templates/config/database.yml.mysql rename to core/lib/generators/refinery/cms/templates/config/database.mysql.yml diff --git a/core/lib/generators/refinery/cms/templates/config/database.yml.postgresql b/core/lib/generators/refinery/cms/templates/config/database.postgresql.yml similarity index 100% rename from core/lib/generators/refinery/cms/templates/config/database.yml.postgresql rename to core/lib/generators/refinery/cms/templates/config/database.postgresql.yml diff --git a/core/lib/generators/refinery/cms/templates/config/database.yml.sqlite3 b/core/lib/generators/refinery/cms/templates/config/database.sqlite3.yml similarity index 100% rename from core/lib/generators/refinery/cms/templates/config/database.yml.sqlite3 rename to core/lib/generators/refinery/cms/templates/config/database.sqlite3.yml diff --git a/core/lib/generators/refinery/dummy/templates/rails/database.yml b/core/lib/generators/refinery/dummy/templates/rails/database.yml index f09bb1daa8..88a6ac3e2f 100644 --- a/core/lib/generators/refinery/dummy/templates/rails/database.yml +++ b/core/lib/generators/refinery/dummy/templates/rails/database.yml @@ -5,7 +5,7 @@ login: &login reconnect: false pool: 5 username: root - password: + password: <%%= ENV['MYSQL_PASSWORD'] %> #socket: /tmp/mysql.sock <% elsif /postgresql/ === @database %> adapter: postgresql @@ -31,4 +31,4 @@ test: production: <<: *login - database: dummy_prod \ No newline at end of file + database: dummy_prod diff --git a/core/lib/refinery/application_controller.rb b/core/lib/refinery/application_controller.rb index daf4347c06..db50738723 100644 --- a/core/lib/refinery/application_controller.rb +++ b/core/lib/refinery/application_controller.rb @@ -31,8 +31,7 @@ def error_404(exception = nil) # fallback to the default 404.html page. file = Rails.root.join 'public', '404.html' file = Refinery.roots('refinery/core').join('public', '404.html') unless file.exist? - render file: file.cleanpath.to_s.gsub(%r{#{file.extname}$}, ''), - layout: false, status: 404, format: :html + render file: file, format: :html, layout: false, status: 404 return false end diff --git a/core/refinerycms-core.gemspec b/core/refinerycms-core.gemspec index 3ae69263e5..cb1f64cdf0 100644 --- a/core/refinerycms-core.gemspec +++ b/core/refinerycms-core.gemspec @@ -1,43 +1,43 @@ -# Encoding: UTF-8 -require File.expand_path('../../core/lib/refinery/version', __FILE__) +# frozen_string_literal: true + +require File.expand_path('../core/lib/refinery/version', __dir__) version = Refinery::Version.to_s rails_version = ['>= 6.0.0', '< 7'] Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY - s.name = %q{refinerycms-core} + s.name = 'refinerycms-core' s.version = version - s.summary = %q{Core extension for Refinery CMS} - s.description = %q{The core of Refinery CMS. This handles the common functionality and is required by most extensions} - s.email = %q{refinerycms@p.arndt.io} - s.homepage = %q{https://www.refinerycms.com} - s.rubyforge_project = %q{refinerycms} - s.authors = ['Philip Arndt', 'Uģis Ozols', 'Rob Yurkowski'] - s.license = %q{MIT} - s.require_paths = %w(lib) + s.summary = 'Core extension for Refinery CMS' + s.description = 'The core of Refinery CMS. This handles the common functionality and is required by most extensions' + s.email = 'gems@p.arndt.io' + s.homepage = 'https://www.refinerycms.com' + s.authors = ['Philip Arndt', 'David Jones', 'Uģis Ozols', 'Brice Sanchez'] + s.license = 'MIT' + s.require_paths = %w[lib] s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- spec/*`.split("\n") s.required_ruby_version = Refinery::Version.required_ruby_version - s.add_dependency 'refinerycms-i18n', ['~> 5.0', '>= 5.0.1'] - s.add_dependency 'railties', rails_version - s.add_dependency 'activerecord', rails_version s.add_dependency 'actionpack', rails_version - s.add_dependency 'truncate_html', '~> 0.9' - s.add_dependency 'will_paginate', '~> 3.1', '>= 3.1.0' - s.add_dependency 'sass-rails', '>= 4.0', '< 7' - s.add_dependency 'font-awesome-sass', '>= 4.3.0', '< 5.0' + s.add_dependency 'activerecord', rails_version s.add_dependency 'coffee-rails', ['~> 4.0', '>= 4.0.0'] + s.add_dependency 'decorators', '~> 2.0', '>= 2.0.0' + s.add_dependency 'font-awesome-sass', '>= 4.3.0', '< 5.0' s.add_dependency 'jquery-rails', '~> 4.3', '>= 4.3.1' s.add_dependency 'jquery-ui-rails', '~> 6.0', '>= 6.0.0' - s.add_dependency 'decorators', '~> 2.0', '>= 2.0.0' + s.add_dependency 'railties', rails_version + s.add_dependency 'refinerycms-i18n', ['~> 5.0', '>= 5.0.1'] + s.add_dependency 'sass-rails', '>= 4.0', '< 7' + s.add_dependency 'truncate_html', '~> 0.9' + s.add_dependency 'will_paginate', '~> 3.1', '>= 3.1.0' s.add_dependency 'zilch-authorisation', '~> 0', '>= 0.0.1' - s.cert_chain = [File.expand_path("../../certs/parndt.pem", __FILE__)] - if $0 =~ /gem\z/ && ARGV.include?("build") && ARGV.include?(__FILE__) - s.signing_key = File.expand_path("~/.ssh/gem-private_key.pem") + s.cert_chain = [File.expand_path('../certs/parndt.pem', __dir__)] + if $PROGRAM_NAME =~ /gem\z/ && ARGV.include?('build') && ARGV.include?(__FILE__) + s.signing_key = File.expand_path('~/.ssh/gem-private_key.pem') end end diff --git a/core/spec/lib/generators/refinery/cms/cms_generator_spec.rb b/core/spec/lib/generators/refinery/cms/cms_generator_spec.rb index 05b435b915..7c29c6ba89 100644 --- a/core/spec/lib/generators/refinery/cms/cms_generator_spec.rb +++ b/core/spec/lib/generators/refinery/cms/cms_generator_spec.rb @@ -57,9 +57,9 @@ module Refinery end end directory "config" do - file "database.yml.mysql" - file "database.yml.postgresql" - file "database.yml.sqlite3" + file "database.mysql.yml" + file "database.postgresql.yml" + file "database.sqlite3.yml" end } end diff --git a/doc/guides/6 - Updating Refinery/1 - Upgrading to the Latest Stable Version.md b/doc/guides/6 - Updating Refinery/1 - Upgrading to the Latest Stable Version.md index 89b2118e92..234d49d8b1 100644 --- a/doc/guides/6 - Updating Refinery/1 - Upgrading to the Latest Stable Version.md +++ b/doc/guides/6 - Updating Refinery/1 - Upgrading to the Latest Stable Version.md @@ -15,7 +15,7 @@ Take a look at to find the latest versio Edit your `Gemfile` to reference the latest version of Refinery (a later version than the one shown [may exist](https://rubygems.org/gems/refinerycms/versions)). ```ruby -gem 'refinerycms', '~> 3.0.0' +gem 'refinerycms', '~> 4.0.0' ``` Now install the new gems using bundler's update functionality: @@ -39,4 +39,4 @@ Database migrations and new gem dependencies may have been added, so finish your ```shell $ bin/rake db:migrate $ bundle install -``` \ No newline at end of file +``` diff --git a/doc/guides/7 - Hosting and Deployment/2 - Amazon S3 for Uploads.md b/doc/guides/7 - Hosting and Deployment/2 - Amazon S3 for Uploads.md index 54bd52aa1f..ba87a7d645 100644 --- a/doc/guides/7 - Hosting and Deployment/2 - Amazon S3 for Uploads.md +++ b/doc/guides/7 - Hosting and Deployment/2 - Amazon S3 for Uploads.md @@ -1,83 +1,107 @@ # Using Amazon S3 for Uploads -Hosting your site's files on Amazon S3 is a popular option for many, especially if you're using a read only file system like +Hosting your app's files on Amazon S3 is a popular option for many, especially if you're using a read-only filesystem like [Heroku](https://heroku.com). This guide will show you how to: * Enable and configure Refinery to store files and images on Amazon S3 __NOTE__: If you are using S3 in combination with Heroku please refer to the [Heroku guide](/guides/heroku) for more information. -## Setting Up +## Preparation -If you want to use Refinery's image and resource support on S3 instead of the local -file system, you'll need an additional gem. Create a S3 bucket called `my_app_production` and add this line in your `Gemfile`: +If you want to configure Refinery images and/or resources engine to use Amazon's S3 datastore instead of the local +filesystem, you'll need the `dragonfly-s3_data_store` gem. Add it in your `Gemfile` for the environments where you plan to use it: ```ruby group :production do gem 'dragonfly-s3_data_store' end ``` +In Amazon AWS, create an S3 bucket with a descriptive name, for example `myapp-production`. Create an Access Control List (ACL) for your bucket that allows anyone to read files (it's called "list objects" in S3). Without read permissions uploads may result in 403 Forbidden error. -## Telling Refinery to use S3 +It is recommended to create a separate, so-called IAM user for interacting with only S3, and to disable the security credentials of the AWS root user. -Refinery will use S3 for storage if it finds the `S3_KEY`, `S3_SECRET`, and `S3_BUCKET` environment variables. +## Configuration for S3 -There are a number of ways to set these with your credentials, including unix variables or settings them manually through Ruby using ENV. +Refinery will use S3 for storage if `Refinery::Dragonfly.s3_datastore` evaluates as true. In addition, you need four S3 parameters. You can set them by using environment variables and/or adding literal definitions in your app. -### Unix variables +There are three methods of setting the four S3 parameters: -```bash -$ export S3_KEY='fill_in_your_key_here' -$ export S3_SECRET='fill_in_your_secret_key_here' -$ export S3_BUCKET='fill_in_your_bucket_name_here' -$ export S3_REGION='fill_in_your_buckets_region_here' -``` +1. Use enviroment variables with names that Refinery will recognize automatically, +2. Use environment variables with any names, and in your app pass their values to Dragonfly config variables +3. Define the parameters directly as Dragonfly config variables with string literal values + +The advantage of using environment variables is that the credentials will not be hard-coded anywhere in your app, which enhances security. Also the environment variables make it easy to use different buckets or different credentials in development and production. -On the last line, fill in your preferred way of starting your Rails server. +### Environment variables -__Note__: `S3_REGION` is only needed if you have created your bucket in a region other than the default `us-east-1`. +Environment variables are typically set in a `.bash_profile` file in the user directory. -### Using Ruby ENV +Refinery will automatically recognize environment variables `S3_KEY`, `S3_SECRET`, `S3_BUCKET`, and `S3_REGION`. Define the variables in your profile file like this: + +```bash +export S3_KEY='your_aws_key_goes_here' +export S3_SECRET='fill_in_your_very_very_long_aws_secret_key_here' +export S3_BUCKET='your_bucket_name_goes_here' +export S3_REGION='your_region_here' +``` -You can put the environment keys literally in any of the Rails config files like +Alternatively you can define environment variables in your app. This solution is less secure, as the values will be hard-coded in your app source. You can put the var definitions literally in any of the Rails config files, like `config/application.rb` or `config/environments/production.rb`: ```ruby -ENV['S3_KEY']='fill_in_your_key_here' -ENV['S3_SECRET']='fill_in_your_secret_key_here' -ENV['S3_BUCKET']='fill_in_your_bucket_name_here' +ENV['S3_KEY']='your_aws_key_goes_here' +ENV['S3_SECRET']='fill_in_your_very_very_long_aws_secret_key_here' +(...) ``` -__Note__: For Heroku, you should use [config vars to set your environment variables](/guides/heroku)) +__Note__: `S3_REGION` is not needed if your bucket resides in the default AWS region, `us-east-1`. + +__Note__: For Heroku, you should set your environment variables by [Heroku's config vars](/guides/heroku)). + +If you decide not to use the standard environment variable names that Refinery recognizes automatically, you will have to manually pass the values to Dragonfly config vars (method 2 above). For this you can use the Dragonfly initializer file. + +### The Dragonfly initializer file + +In old Refinery versions, the S3 variables were defined in `Refinery::Core`. In Refinery 4 they are defined in `Refinery::Dragonfly`instead. The Dragonfly initializer file can be found at `config/initializers/refinery/dragonfly.rb`. If there is no such file, generate it by running `rails generate refinery:dragonfly` at your app root. -Another option, especially if you experience `Dragonfly::DataStorage::S3DataStore` exceptions, is to configure your -Amazon S3 credentials in `config/initializers/refinery/core.rb` using the following syntax: +The important parts in the file are the four S3 parameters, plus the `config.s3_datastore` variable, for which you only need to check that it will evaluate as true. + +To define the four S3 variables, you will either use environment variables, if you have set them, or string literals, like `config.s3_region = 'eu-north-1'`. Here is an example with environment variables: ```ruby -Refinery::Core.configure do |config| - config.s3_backend = true - config.s3_access_key_id = 'fill_in_your_key_here' - config.s3_secret_access_key = 'fill_in_your_secret_key_here' - config.s3_bucket_name = 'fill_in_your_bucket_name_here' - config.s3_region = 'fill_in_your_buckets_region_here' # this one's not always required, default is 'us-east-1' +Refinery::Dragonfly.configure do |config| + config.s3_access_key_id = ENV['AWS_ACCESS_KEY_ID'] + config.s3_secret_access_key = ENV['AWS_SECRET_ACCESS_KEY] + config.s3_bucket_name = ENV['S3_BUCKET_NAME'] + config.s3_region = ENV['S3_REGION'] # not required for the default region 'us-east-1' + config.s3_datastore = config.s3_access_key_id.present? || config.s3_secret_access_key.present? end ``` -## Turning S3 on and off +### Images initializer -S3 should automatically sense that it is enabled based on these ENV variables but if it is not you can add this code to the __end__ of the appropriate environment file, for example with the production environment -`config/environments/production.rb`: +If you have set the four S3 parameters using any of the methods mentioned above, then in the images initializer it is only necessary to switch on the S3 datastore. Also you can set a root path to keep your S3 bucket organized. In this example the images will be saved in an `images` folder in your S3 bucket: ```ruby -Refinery::Core.config.s3_backend = true +config.s3_datastore = Refinery::Dragonfly.s3_datastore # will evaluate as true +config.s3_root_path = 'images' ``` -There are some cases where you have these three variables set but do not want to use S3. - - You can always manually set S3 to either `false` or `true` in the environment you are using. +## Turning S3 on and off -For example, forcing S3 to always be off in development is as simple as adding the following line to the __end__ of `config/environments/development.rb`: +If you don't want to use S3, simply set `config.s3_datastore = false` in the initializer file for Dragonfly, images, and/or resources. You can also set it in an environment configuration file. For example add this to the __end__ of `config/environments/development.rb`: ```ruby -Refinery::Core.config.s3_backend = false +Refinery::Dragonfly.config.s3_datastore = false ``` + +## Debugging + +If you have set the S3 datastore as specified above, but the images still appear in your local datastore (typically `public/system`), or if you face any errors on upload, debugging can be tricky. First ensure that the Dragonfly variables are properly set. In development environment it should be safe to simply print the var values in your views, for example with `<%= Refinery::Dragonfly.s3_bucket_name %>`. Be careful not to reveal your secrets to the public. + +If all looks good and the uploads still fail, you can use the aws command-line tool to try uploading, and also to check your bucket permissions: `aws2 s3api get-bucket-acl --bucket my-bucket-name`. Check that the public has read permissions. + +You can switch on logging in your S3 bucket. This may give you some information about what's going on. + +If you get system errors, use the [byebug](https://github.com/deivid-rodriguez/byebug) gem, write the word `byebug` somewhere in the various functions mentioned in the error stack, and when byebug then interrupts serving the request, try to use any available commands to read whatever variables are available at each point. diff --git a/dragonfly/lib/refinery/dragonfly/dragonfly.rb b/dragonfly/lib/refinery/dragonfly/dragonfly.rb index 4acb4d5799..9a992d5666 100644 --- a/dragonfly/lib/refinery/dragonfly/dragonfly.rb +++ b/dragonfly/lib/refinery/dragonfly/dragonfly.rb @@ -32,7 +32,7 @@ def configure!(extension) # These options require a name and block define_url extension.dragonfly_define_url if extension.dragonfly_define_url.present? - before_serve extension.dragonfly_before_serve if extension.dragonfly_before_serve.present? + before_serve(&extension.dragonfly_before_serve) if extension.dragonfly_before_serve.present? # There can be more than one instance of each of these options. diff --git a/dragonfly/refinerycms-dragonfly.gemspec b/dragonfly/refinerycms-dragonfly.gemspec index 1151dcb3d3..15542324fd 100644 --- a/dragonfly/refinerycms-dragonfly.gemspec +++ b/dragonfly/refinerycms-dragonfly.gemspec @@ -1,10 +1,9 @@ # Encoding: UTF-8 - Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = %q{refinerycms-dragonfly} - s.version = '1.0.1' + s.version = '1.0.2' s.summary = %q{Dragonfly interface for Refinery CMS} s.description = %q{Allows Refinery to use dragonfly for file storage and processing} s.email = %q{anita@joli.com.au} diff --git a/images/config/locales/en.yml b/images/config/locales/en.yml index 774cb46c38..b6cc910d9b 100644 --- a/images/config/locales/en.yml +++ b/images/config/locales/en.yml @@ -28,7 +28,6 @@ en: format: Format crop_success: Crop has been successfully generated no_crops_yet: There are no image crops yet. Click "Save crop" to add your first image crop. - crop: delete_crop: "%{title} - Crop %{id}" actions: diff --git a/images/config/locales/sk.yml b/images/config/locales/sk.yml index 2785535fd9..7e951b4db5 100644 --- a/images/config/locales/sk.yml +++ b/images/config/locales/sk.yml @@ -5,6 +5,8 @@ sk: title: Obrázky description: Spravovať obrázky admin: + locale_picker: + language: Jazyk images: delete: Zmazať tento obrázok edit: Upraviť tento obrázok @@ -15,6 +17,19 @@ sk: replace_image: " nahradiť ho týmto..." current_image: Vybraný obrázok maximum_image_size: Maximálna veľkosť obrázku je %{bytes}. + image_title: Názov + image_title_help: Extra informácie o obrázku + image_alt: Alt + image_alt_help: Text, ktorý sa zobrazí, ak obrázok nemôže byť zobrazený. + ratios: Pomer strán + choose_crop: Aby ste mohli editovať zmenšeninu, prosím zvoľte formát z nasledovného zoznamu + available_crops: Dostupné zmenšeniny + save: Uložiť zmenšeninu + format: Formát + crop_success: Zmenšenina bola úspešne vygenerovaná + no_crops_yet: Zatiaľ neboli vytvorené žiadne zmenšeniny. Kliknite "Uložiť zmenšeninu" ak chcete pridať prvú + crop: + delete_crop: "%{title} - Zmenšenina %{id}" actions: create_new_image: Pridať nový obrázok records: @@ -29,6 +44,7 @@ sk: button_text: Vložiť resize_image: Upraviť veľkosť? size: Veľkosť + select_resize: Vyberte veľkosť insert: existing_image: Knižnica new_image: Nový obrázok @@ -41,4 +57,4 @@ sk: blank: Musíte zadať obrázok ktorý chcete nahrať. too_big: Maximálna veľkosť obrázku %{size}MB in size. incorrect_format: 'Obrázok musí byť vo formáte JPG, PNG alebo GIF.' - different_file_name: Nový obrázok nesmie mať odlišný názov súboru \ No newline at end of file + different_file_name: Nový obrázok nesmie mať odlišný názov súboru diff --git a/images/refinerycms-images.gemspec b/images/refinerycms-images.gemspec index 12f22488eb..e1db636fb4 100644 --- a/images/refinerycms-images.gemspec +++ b/images/refinerycms-images.gemspec @@ -1,20 +1,20 @@ -# Encoding: UTF-8 -require File.expand_path('../../core/lib/refinery/version', __FILE__) +# frozen_string_literal: true + +require File.expand_path('../core/lib/refinery/version', __dir__) version = Refinery::Version.to_s Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY - s.name = %q{refinerycms-images} + s.name = 'refinerycms-images' s.version = version - s.summary = %q{Images extension for Refinery CMS} - s.description = %q{Handles all image upload and processing functionality in Refinery CMS.} - s.email = %q{refinerycms@p.arndt.io} - s.homepage = %q{https://www.refinerycms.com} - s.rubyforge_project = %q{refinerycms} - s.authors = ['Philip Arndt', 'Uģis Ozols', 'Rob Yurkowski'] - s.license = %q{MIT} - s.require_paths = %w(lib) + s.summary = 'Images extension for Refinery CMS' + s.description = 'Handles all image upload and processing functionality in Refinery CMS.' + s.email = 'gems@p.arndt.io' + s.homepage = 'https://www.refinerycms.com' + s.authors = ['Philip Arndt', 'David Jones', 'Uģis Ozols', 'Brice Sanchez'] + s.license = 'MIT' + s.require_paths = %w[lib] s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- spec/*`.split("\n") @@ -24,8 +24,8 @@ Gem::Specification.new do |s| s.required_ruby_version = Refinery::Version.required_ruby_version - s.cert_chain = [File.expand_path("../../certs/parndt.pem", __FILE__)] - if $0 =~ /gem\z/ && ARGV.include?("build") && ARGV.include?(__FILE__) - s.signing_key = File.expand_path("~/.ssh/gem-private_key.pem") + s.cert_chain = [File.expand_path('../certs/parndt.pem', __dir__)] + if $PROGRAM_NAME =~ /gem\z/ && ARGV.include?('build') && ARGV.include?(__FILE__) + s.signing_key = File.expand_path('~/.ssh/gem-private_key.pem') end end diff --git a/pages/app/views/refinery/admin/pages/_page.html.erb b/pages/app/views/refinery/admin/pages/_page.html.erb index 9e49436e3b..efc2011519 100644 --- a/pages/app/views/refinery/admin/pages/_page.html.erb +++ b/pages/app/views/refinery/admin/pages/_page.html.erb @@ -48,6 +48,6 @@ <%= content_tag :ul, class: 'nested', data: { 'ajax-content': refinery.admin_children_pages_path(page.nested_url) } do %> - <%= render(partial: 'page', collection: page.children, cached: ->(child_page) { child_page.self_and_descendants }) if Refinery::Pages.auto_expand_admin_tree %> + <%= render(partial: 'page', collection: page.children, cached: ->(child_page) { child_page.self_and_descendants.to_a }) if Refinery::Pages.auto_expand_admin_tree %> <% end %> diff --git a/pages/app/views/refinery/admin/pages_dialogs/link_to.html.erb b/pages/app/views/refinery/admin/pages_dialogs/link_to.html.erb index 1fd6ed59b7..edf0c47489 100644 --- a/pages/app/views/refinery/admin/pages_dialogs/link_to.html.erb +++ b/pages/app/views/refinery/admin/pages_dialogs/link_to.html.erb @@ -27,10 +27,10 @@
<%= will_paginate @pages, :id => 'pages_paginate' %> diff --git a/pages/config/locales/sk.yml b/pages/config/locales/sk.yml index 4ebe0f1e49..16b0d0b266 100644 --- a/pages/config/locales/sk.yml +++ b/pages/config/locales/sk.yml @@ -37,9 +37,11 @@ sk: new: Pridať novú podstránku expand_collapse: Rozbaliť alebo zbaliť podstránky page: - view_live_html: Zobraziť stránku
(otvorí sa v novom okne) - hidden: skrytá draft: pracovná verzia + hidden: skrytá + redirected: Presmerovanie + skip_to_first_child: Presmerovať na prvú substránku + view_live_html: Zobraziť stránku
(otvorí sa v novom okne) form: preview: Náhľad preview_changes: Zobraziť náhľad s vykonanými zmenami diff --git a/pages/refinerycms-pages.gemspec b/pages/refinerycms-pages.gemspec index 13bfcb61eb..c67ff1b60e 100644 --- a/pages/refinerycms-pages.gemspec +++ b/pages/refinerycms-pages.gemspec @@ -1,37 +1,37 @@ -# Encoding: UTF-8 -require File.expand_path('../../core/lib/refinery/version', __FILE__) +# frozen_string_literal: true + +require File.expand_path('../core/lib/refinery/version', __dir__) version = Refinery::Version.to_s Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY - s.name = %q{refinerycms-pages} + s.name = 'refinerycms-pages' s.version = version - s.summary = %q{Pages extension for Refinery CMS} - s.description = %q{The default content extension of Refinery CMS. This extension handles the administration and display of user-editable pages.} - s.email = %q{refinerycms@p.arndt.io} - s.homepage = %q{https://www.refinerycms.com} - s.rubyforge_project = %q{refinerycms} - s.authors = ['Philip Arndt', 'Uģis Ozols', 'Rob Yurkowski'] - s.license = %q{MIT} - s.require_paths = %w(lib) + s.summary = 'Pages extension for Refinery CMS' + s.description = 'The default content extension of Refinery CMS. This extension handles the administration and display of user-editable pages.' + s.email = 'gems@p.arndt.io' + s.homepage = 'https://www.refinerycms.com' + s.authors = ['Philip Arndt', 'David Jones', 'Uģis Ozols', 'Brice Sanchez'] + s.license = 'MIT' + s.require_paths = %w[lib] s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- spec/*`.split("\n") - s.add_dependency 'refinerycms-core', version + s.add_dependency 'awesome_nested_set', '~> 3.1', '>= 3.1.0' + s.add_dependency 'babosa', '~> 1.0' + s.add_dependency 'diffy', '~> 3.1', '>= 3.1.0' s.add_dependency 'friendly_id', ['>= 5.1.0', '< 5.3'] s.add_dependency 'friendly_id-mobility', '~> 0.5' - s.add_dependency 'awesome_nested_set', '~> 3.1', '>= 3.1.0' + s.add_dependency 'refinerycms-core', version s.add_dependency 'seo_meta', '~> 3.0', '>= 3.0.0' - s.add_dependency 'babosa', '~> 1.0' s.add_dependency 'speakingurl-rails', '~> 8.0', '>= 8.0.0' - s.add_dependency 'diffy', '~> 3.1', '>= 3.1.0' s.required_ruby_version = Refinery::Version.required_ruby_version - s.cert_chain = [File.expand_path("../../certs/parndt.pem", __FILE__)] - if $0 =~ /gem\z/ && ARGV.include?("build") && ARGV.include?(__FILE__) - s.signing_key = File.expand_path("~/.ssh/gem-private_key.pem") + s.cert_chain = [File.expand_path('../certs/parndt.pem', __dir__)] + if $PROGRAM_NAME =~ /gem\z/ && ARGV.include?('build') && ARGV.include?(__FILE__) + s.signing_key = File.expand_path('~/.ssh/gem-private_key.pem') end end diff --git a/readme.md b/readme.md index 22c03c44a9..3c274fdaab 100644 --- a/readme.md +++ b/readme.md @@ -10,6 +10,10 @@ You can chat with us using Gitter: [![Gitter chat](https://badges.gitter.im/refinery/refinerycms.svg)](https://gitter.im/refinery/refinerycms) +You can deploy an example app to Heroku: + +[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/refinery/refinerycms-example-app) + ## Requirements * [Bundler](http://gembundler.com) diff --git a/refinerycms.gemspec b/refinerycms.gemspec index 466afaac96..6a88a5b7a5 100644 --- a/refinerycms.gemspec +++ b/refinerycms.gemspec @@ -1,22 +1,22 @@ -# Encoding: UTF-8 -require File.expand_path('../core/lib/refinery/version', __FILE__) +# frozen_string_literal: true + +require File.expand_path('core/lib/refinery/version', __dir__) version = Refinery::Version.to_s Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY - s.name = %q{refinerycms} + s.name = 'refinerycms' s.version = version - s.description = %q{A Ruby on Rails CMS that supports Rails 5.1. It's developer friendly and easy to extend.} - s.summary = %q{A Ruby on Rails CMS that supports Rails 5.1} - s.email = %q{refinerycms@p.arndt.io} - s.homepage = %q{https://www.refinerycms.com} - s.rubyforge_project = %q{refinerycms} - s.authors = ['Philip Arndt', 'Uģis Ozols', 'Rob Yurkowski'] - s.license = %q{MIT} + s.description = "A CMS for Ruby on Rails, supporting Rails 6+. It's developer friendly and easy to extend." + s.summary = 'A CMS for Ruby on Rails, supporting Rails 6+' + s.email = 'gems@p.arndt.io' + s.homepage = 'https://www.refinerycms.com' + s.authors = ['Philip Arndt', 'David Jones', 'Uģis Ozols', 'Brice Sanchez'] + s.license = 'MIT' s.bindir = 'exe' - s.executables = %w(refinerycms) - s.require_paths = %w(lib) + s.executables = %w[refinerycms] + s.require_paths = %w[lib] s.files = `git ls-files -- lib/* templates/*`.split("\n") @@ -26,8 +26,8 @@ Gem::Specification.new do |s| s.add_dependency 'refinerycms-resources', version s.required_ruby_version = Refinery::Version.required_ruby_version - s.cert_chain = [File.expand_path("../certs/parndt.pem", __FILE__)] - if $0 =~ /gem\z/ && ARGV.include?("build") && ARGV.include?(__FILE__) - s.signing_key = File.expand_path("~/.ssh/gem-private_key.pem") + s.cert_chain = [File.expand_path('certs/parndt.pem', __dir__)] + if $PROGRAM_NAME =~ /gem\z/ && ARGV.include?('build') && ARGV.include?(__FILE__) + s.signing_key = File.expand_path('~/.ssh/gem-private_key.pem') end end diff --git a/resources/config/locales/sk.yml b/resources/config/locales/sk.yml index b94d2aa12c..ee296fd628 100644 --- a/resources/config/locales/sk.yml +++ b/resources/config/locales/sk.yml @@ -13,6 +13,9 @@ sk: or: alebo replace: " nahradiť týmto..." maximum_file_size: Maximálna veľkosť súboru je %{bytes}. + resource_file: Súbor + resource_title: Názov + resource_title_help: Názov zobrazený návštevníkom stránky resource: download: Stiahnuť súbor (%{size}) actions: @@ -33,4 +36,6 @@ sk: models: refinery/resource: blank: Musíte vybrať súbor pre nahranie. + incorrect_format: "Typ súboru nie je povolený. Váš súbor musí byť typu MP4, MPEG, WMV, AVI, WAV, + GIF, JPEG, PNG, SVG, TIFF, PSD, CSV, PDF, TXT, RAR, ZIP, XLS, PPT alebo DOC" too_big: Maximálna veľkosť súboru je %{size} MB. diff --git a/resources/refinerycms-resources.gemspec b/resources/refinerycms-resources.gemspec index ebd7b22ea7..0829b0c6ce 100644 --- a/resources/refinerycms-resources.gemspec +++ b/resources/refinerycms-resources.gemspec @@ -1,20 +1,20 @@ -# Encoding: UTF-8 -require File.expand_path('../../core/lib/refinery/version', __FILE__) +# frozen_string_literal: true + +require File.expand_path('../core/lib/refinery/version', __dir__) version = Refinery::Version.to_s Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY - s.name = %q{refinerycms-resources} + s.name = 'refinerycms-resources' s.version = version - s.summary = %q{Resources extension for Refinery CMS} - s.description = %q{Handles all file upload and processing functionality in Refinery CMS.} - s.email = %q{refinerycms@p.arndt.io} - s.homepage = %q{https://www.refinerycms.com} - s.rubyforge_project = %q{refinerycms} - s.authors = ['Philip Arndt', 'Uģis Ozols', 'Rob Yurkowski'] - s.license = %q{MIT} - s.require_paths = %w(lib) + s.summary = 'Resources extension for Refinery CMS' + s.description = 'Handles all file upload and processing functionality in Refinery CMS.' + s.email = 'gems@p.arndt.io' + s.homepage = 'https://www.refinerycms.com' + s.authors = ['Philip Arndt', 'David Jones', 'Uģis Ozols', 'Brice Sanchez'] + s.license = 'MIT' + s.require_paths = %w[lib] s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- spec/*`.split("\n") @@ -24,8 +24,8 @@ Gem::Specification.new do |s| s.required_ruby_version = Refinery::Version.required_ruby_version - s.cert_chain = [File.expand_path("../../certs/parndt.pem", __FILE__)] - if $0 =~ /gem\z/ && ARGV.include?("build") && ARGV.include?(__FILE__) - s.signing_key = File.expand_path("~/.ssh/gem-private_key.pem") + s.cert_chain = [File.expand_path('../certs/parndt.pem', __dir__)] + if $PROGRAM_NAME =~ /gem\z/ && ARGV.include?('build') && ARGV.include?(__FILE__) + s.signing_key = File.expand_path('~/.ssh/gem-private_key.pem') end end diff --git a/resources/spec/lib/refinery/resources/engine_spec.rb b/resources/spec/lib/refinery/resources/engine_spec.rb index ff7caf410f..9f649d0263 100644 --- a/resources/spec/lib/refinery/resources/engine_spec.rb +++ b/resources/spec/lib/refinery/resources/engine_spec.rb @@ -4,5 +4,17 @@ module Refinery describe Resources do it_has_behaviour 'Creates a dragonfly App:' it_has_behaviour 'adds the dragonfly app to the middleware stack' + + it 'calls dragonfly#before_serve to set configuration' do + dummy_proc = -> (_job, _env) {} + expect_any_instance_of(::Dragonfly::Server).to( + receive(:before_serve) { |&block| expect(block).to be(dummy_proc) } + ) + ::Refinery::Resources.configure do |config| + config.dragonfly_before_serve = dummy_proc + end + + ::Refinery::Dragonfly.configure!(::Refinery::Resources) + end end end diff --git a/testing/refinerycms-testing.gemspec b/testing/refinerycms-testing.gemspec index f773648889..908cafcb7f 100644 --- a/testing/refinerycms-testing.gemspec +++ b/testing/refinerycms-testing.gemspec @@ -1,34 +1,34 @@ -# Encoding: UTF-8 -require File.expand_path('../../core/lib/refinery/version', __FILE__) +# frozen_string_literal: true + +require File.expand_path('../core/lib/refinery/version', __dir__) version = Refinery::Version.to_s Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY - s.name = %q{refinerycms-testing} + s.name = 'refinerycms-testing' s.version = version - s.summary = %q{Testing plugin for Refinery CMS} - s.description = %q{This plugin adds the ability to tests against the Refinery CMS gem while inside a Refinery CMS extension} - s.email = %q{refinerycms@p.arndt.io} - s.homepage = %q{https://www.refinerycms.com} - s.rubyforge_project = %q{refinerycms} - s.authors = ['Philip Arndt', 'Uģis Ozols', 'Rob Yurkowski'] - s.license = %q{MIT} - s.require_paths = %w(lib) + s.summary = 'Testing plugin for Refinery CMS' + s.description = 'This plugin adds the ability to tests against the Refinery CMS gem while inside a Refinery CMS extension' + s.email = 'gems@p.arndt.io' + s.homepage = 'https://www.refinerycms.com' + s.authors = ['Philip Arndt', 'David Jones', 'Uģis Ozols', 'Brice Sanchez'] + s.license = 'MIT' + s.require_paths = %w[lib] s.files = `git ls-files`.split("\n") - s.add_dependency 'refinerycms-core', version - s.add_dependency 'factory_bot_rails', '~> 4.8' - s.add_dependency 'rspec-rails', '~> 4.0.0.beta2' s.add_dependency 'capybara', '>= 2.18' + s.add_dependency 'factory_bot_rails', '~> 4.8' s.add_dependency 'rails-controller-testing', '>= 0.1.1' + s.add_dependency 'refinerycms-core', version + s.add_dependency 'rspec-rails', '~> 4.0.0.beta2' s.add_dependency 'webdrivers', '~> 4.0' s.required_ruby_version = Refinery::Version.required_ruby_version - s.cert_chain = [File.expand_path("../../certs/parndt.pem", __FILE__)] - if $0 =~ /gem\z/ && ARGV.include?("build") && ARGV.include?(__FILE__) - s.signing_key = File.expand_path("~/.ssh/gem-private_key.pem") + s.cert_chain = [File.expand_path('../certs/parndt.pem', __dir__)] + if $PROGRAM_NAME =~ /gem\z/ && ARGV.include?('build') && ARGV.include?(__FILE__) + s.signing_key = File.expand_path('~/.ssh/gem-private_key.pem') end end