From 559693c060f293afde70c6b8716afc901717b8e9 Mon Sep 17 00:00:00 2001 From: Max Melentiev Date: Sun, 14 Jun 2020 20:17:44 +0300 Subject: [PATCH] Remove unused gems, replace credentials with secrets --- .gitignore | 1 + Gemfile | 12 ++++++------ Gemfile.lock | 40 -------------------------------------- bin/setup | 5 ++++- config/boot.rb | 2 +- config/credentials.yml.enc | 1 - config/secrets.yml.sample | 10 ++++++++++ spec/rails_helper.rb | 12 ++++++------ 8 files changed, 28 insertions(+), 55 deletions(-) delete mode 100644 config/credentials.yml.enc create mode 100644 config/secrets.yml.sample diff --git a/.gitignore b/.gitignore index fb4a208..44d9e86 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ /config/master.key spec/examples.txt +config/secrets.yml diff --git a/Gemfile b/Gemfile index 84eac07..0253268 100644 --- a/Gemfile +++ b/Gemfile @@ -25,10 +25,10 @@ gem "turbo-rails" gem "stimulus-rails" # Build JSON APIs with ease [https://github.com/rails/jbuilder] -gem "jbuilder" +# gem "jbuilder" # Use Redis adapter to run Action Cable in production -gem "redis", "~> 4.0" +# gem "redis", "~> 4.0" # Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis] # gem "kredis" @@ -40,7 +40,7 @@ gem "redis", "~> 4.0" gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ] # Reduces boot times through caching; required in config/boot.rb -gem "bootsnap", require: false +# gem "bootsnap", require: false # Use Sass to process CSS # gem "sassc-rails" @@ -75,9 +75,9 @@ end group :test do # Use system testing [https://guides.rubyonrails.org/testing.html#system-testing] - gem "capybara" - gem "selenium-webdriver" - gem "webdrivers" + # gem "capybara" + # gem "selenium-webdriver" + # gem "webdrivers" gem "rspec-rails" gem "rspec-its" diff --git a/Gemfile.lock b/Gemfile.lock index 28969a8..1ac9ea9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -66,24 +66,10 @@ GEM i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - addressable (2.8.0) - public_suffix (>= 2.0.2, < 5.0) awesome_print (1.9.2) bindex (0.8.1) - bootsnap (1.11.1) - msgpack (~> 1.2) builder (3.2.4) byebug (11.1.3) - capybara (3.36.0) - addressable - matrix - mini_mime (>= 0.1.3) - nokogiri (~> 1.8) - rack (>= 1.6.0) - rack-test (>= 0.6.3) - regexp_parser (>= 1.5, < 3.0) - xpath (~> 3.2) - childprocess (4.1.0) coderay (1.1.3) concurrent-ruby (1.1.9) crass (1.0.6) @@ -104,20 +90,15 @@ GEM io-wait (0.2.1) irb (1.4.1) reline (>= 0.3.0) - jbuilder (2.11.5) - actionview (>= 5.0.0) - activesupport (>= 5.0.0) loofah (2.14.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) marcel (1.0.2) - matrix (0.4.2) method_source (1.0.0) mini_mime (1.1.2) minitest (5.15.0) - msgpack (1.4.5) net-imap (0.2.3) digest net-protocol @@ -147,7 +128,6 @@ GEM yard (~> 0.9.11) pry-rails (0.3.9) pry (>= 0.10.4) - public_suffix (4.0.6) puma (5.6.2) nio4r (~> 2.0) racc (1.6.0) @@ -181,11 +161,8 @@ GEM thor (~> 1.0) zeitwerk (~> 2.5) rake (13.0.6) - redis (4.6.0) - regexp_parser (2.2.1) reline (0.3.1) io-console (~> 0.5) - rexml (3.2.5) rspec-core (3.11.0) rspec-support (~> 3.11.0) rspec-expectations (3.11.0) @@ -206,11 +183,6 @@ GEM rspec-mocks (~> 3.10) rspec-support (~> 3.10) rspec-support (3.11.0) - rubyzip (2.3.2) - selenium-webdriver (4.1.0) - childprocess (>= 0.5, < 5.0) - rexml (~> 3.2, >= 3.2.5) - rubyzip (>= 1.2.2) spring (4.0.0) spring-commands-rspec (1.0.4) spring (>= 0.9.1) @@ -237,16 +209,10 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webdrivers (5.0.0) - nokogiri (~> 1.6) - rubyzip (>= 1.3.0) - selenium-webdriver (~> 4.0) webrick (1.7.0) websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - xpath (3.2.0) - nokogiri (~> 1.8) yard (0.9.27) webrick (~> 1.7.0) zeitwerk (2.5.4) @@ -256,21 +222,16 @@ PLATFORMS DEPENDENCIES awesome_print - bootsnap - capybara debug importmap-rails - jbuilder pry pry-byebug pry-doc pry-rails puma (~> 5.0) rails (~> 7.0.2, >= 7.0.2.3) - redis (~> 4.0) rspec-its rspec-rails - selenium-webdriver spring spring-commands-rspec sprockets-rails @@ -279,7 +240,6 @@ DEPENDENCIES turbo-rails tzinfo-data web-console - webdrivers RUBY VERSION ruby 3.0.0p0 diff --git a/bin/setup b/bin/setup index ec47b79..cfb2223 100755 --- a/bin/setup +++ b/bin/setup @@ -17,10 +17,13 @@ FileUtils.chdir APP_ROOT do system! "gem install bundler --conservative" system("bundle check") || system!("bundle install") - # puts "\n== Copying sample files ==" + puts "\n== Copying sample files ==" # unless File.exist?("config/database.yml") # FileUtils.cp "config/database.yml.sample", "config/database.yml" # end + unless File.exist?("config/secrets.yml") + cp "config/secrets.yml.sample", "config/secrets.yml" + end puts "\n== Preparing database ==" system! "bin/rails db:prepare" diff --git a/config/boot.rb b/config/boot.rb index 988a5dd..ebfe695 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,4 +1,4 @@ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) require "bundler/setup" # Set up gems listed in the Gemfile. -require "bootsnap/setup" # Speed up boot time by caching expensive operations. +# require "bootsnap/setup" # Speed up boot time by caching expensive operations. diff --git a/config/credentials.yml.enc b/config/credentials.yml.enc deleted file mode 100644 index 505a255..0000000 --- a/config/credentials.yml.enc +++ /dev/null @@ -1 +0,0 @@ -5j19y0jZ7DvbGEcPnXWXds1fxVuvfcn3nM2GXbZxDn5d9wm/NVa+ehpRf0STUA2YB6zdX8brSt7n0ujDgGsU4AV6vud/fgb30ycJFucvuDGUkikBG0+HM4UZv3gEDVKGK3NpFdrQPgnVk/UqvpDZu0tpPDNHjkh5Vcx3ElTlen3yFVQs9dzmhB35beZBEusHNHRHbINXuezlmfg1aZLaMRErAyVdreyk7mYBom3ehBgpUSdy0qWKlnMaF96kZhtaltUKhOcr5ck1/UkgJkJPQxbzmbl/1aGAo6gwFMa/rbKlTazJlPvCTtjDGMvo3dSiYlwLga04PphKWr7z1z2+Ohqb/LlUcXYlFVVUYCct8d3AfaM05+CaFSvOHUerH5KhMi5F0zsVQWc+tNVMigZpPbDtsOo2xsL08e2O--bvMv87BLt2sd8x7s--0D5Q6EBxEW8h28k83KYN1g== \ No newline at end of file diff --git a/config/secrets.yml.sample b/config/secrets.yml.sample new file mode 100644 index 0000000..a7f9717 --- /dev/null +++ b/config/secrets.yml.sample @@ -0,0 +1,10 @@ +development: &dev + secret_key_base: 93b7f55dd41146764804e122fc94b1e9b9fd86718659a219e8f0828135156dd0245165b215e29d740da4626d92ef2f04648627f8de96b75e59ef8d1a06f35788 + +test: + secret_key_base: 7fb559360ff2d7297bf5fbe7eeb7480e3692373708e08283498acfcbfb4207c142812bb52f36606e13cbf9b22a309bf4a64882e0424527f42423106f77e9faba + +# Do not keep production secrets in the repository, +# instead read values from the environment. +production: + <<: *dev diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 00345af..3a379db 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -24,12 +24,12 @@ # Checks for pending migrations and applies them before tests are run. # If you are not using ActiveRecord, you can remove these lines. -begin - ActiveRecord::Migration.maintain_test_schema! -rescue ActiveRecord::PendingMigrationError => e - puts e.to_s.strip - exit 1 -end +# begin +# ActiveRecord::Migration.maintain_test_schema! +# rescue ActiveRecord::PendingMigrationError => e +# puts e.to_s.strip +# exit 1 +# end RSpec.configure do |config| # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures config.fixture_path = "#{::Rails.root}/spec/fixtures"