diff --git a/.pryrc b/.pryrc new file mode 100644 index 00000000..c8ab8334 --- /dev/null +++ b/.pryrc @@ -0,0 +1,30 @@ +Pry.config.color = true + +if defined?(Rails) + production_env = ENV.fetch("PRODUCTION_ENV", "production") + + if Rails.env.production? && Rails.application.sandbox == false + production_warning = "Warning: You are using the #{production_env} console in non-sandboxed mode" + + puts + puts Pry::Helpers::Text.red("*" * production_warning.size) + puts Pry::Helpers::Text.red(production_warning) + puts Pry::Helpers::Text.red("*" * production_warning.size) + puts + end + + environment_prompt = if Rails.env.production? + "(" + Pry::Helpers::Text.red(production_env) + ")" + else + "(" + Pry::Helpers::Text.green(Rails.env) + ")" + end + + sandbox_prompt = Rails.application.sandbox ? "(sandbox)" : "(writable)" + + Pry.config.prompt_name = [ + environment_prompt, + " ", + sandbox_prompt, + " " + ].join +end diff --git a/Gemfile b/Gemfile index 7430d2db..94c1b3ec 100644 --- a/Gemfile +++ b/Gemfile @@ -11,6 +11,7 @@ gem "high_voltage" gem "jbuilder", "~> 2.11" gem "jquery-rails" gem "pg" +gem "pry-rails" gem "mini_racer" gem "puma", "~> 5.3" gem "rollbar" @@ -46,7 +47,6 @@ group :development, :test do gem "dotenv-rails" gem "factory_bot_rails" gem "faker" - gem "pry" gem "rspec-rails" gem "standard" end diff --git a/Gemfile.lock b/Gemfile.lock index 739a49f9..adb7f454 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -165,6 +165,8 @@ GEM pry (0.14.1) coderay (~> 1.1) method_source (~> 1.0) + pry-rails (0.3.9) + pry (>= 0.10.4) public_suffix (4.0.6) puma (5.3.2) nio4r (~> 2.0) @@ -321,7 +323,7 @@ DEPENDENCIES listen (>= 3.0.5, < 3.6) mini_racer pg - pry + pry-rails puma (~> 5.3) rails (~> 6.1.3) rails_layout