jefferies_tube 1.0.4 → 1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ef6f6f392dc985fea9fab905b6f231544ccbc881
4
- data.tar.gz: 3c38d59fe5e6ac15ba4ef13c691ff5f2f74ef8c6
2
+ SHA256:
3
+ metadata.gz: c26142656f2dbd377a3d4f2fe0850303133147c410a22db25cab0123669d5cfa
4
+ data.tar.gz: 5593a8821e97d000ded09ee563669f85dde0857ff3fa430bb7eb02a3941c90f7
5
5
  SHA512:
6
- metadata.gz: 3d5248c423b58644d99fb800561579032ac6e35d451e4559ac1731f6c1afe2865be402d092aca4cadfafa7c18bd7f425b068db2c9ae625d55dfbd3b709601e3d
7
- data.tar.gz: dfd0ad2a5e3933596e01c592307f15eec4209f7885f8c6f3acdf604bd98e4b6358db62c269484dd20027bdd292ebd6cc6e7fad939ab1bdd23879a310124b4c99
6
+ metadata.gz: c1c24325ee32a148689eaa66aed57bc64af7ad37ffbc830b573c6bc10c964f44d25df1b395c1fb9e1f3305d254a44ea630b2ff1973ddff159a8aa07c17bb5cf3
7
+ data.tar.gz: 5b4718b4a0250e43a8427835d62b887dfd9b02298028c2cc4e2d11110760b25264edd50a2c2a7188693883d8a219c94c19aa114857f4f55432504f1fd5fe928e
@@ -1 +1 @@
1
- 2.2.3
1
+ 2.6.3
@@ -4,9 +4,23 @@ This is a [changelog](https://keepachangelog.com/en/0.3.0/).
4
4
 
5
5
  This project attempts to follow [semantic versioning](https://semver.org/)
6
6
 
7
- ## Unreleased
7
+ ## 1.2
8
8
 
9
- * _nada_
9
+ * enhancements
10
+ * Allow passing through bundler-audit ignore with `set :bundler_audit_ignore, ["CVE-1234-5678"]`
11
+
12
+ ## 1.1.1
13
+
14
+ * enhancements
15
+ * Add colorful IRB prompts based on Rails environment
16
+
17
+ ## 1.0.5 - 2019-02-19
18
+
19
+ * enhancements
20
+ * Require bundler-audit version ~> 0.6.1 in order to support Bundler version >= 2
21
+
22
+ * features
23
+ * Add cap task for running arbitrary rake task on server. e.g. `cap dev rails:rake[flipper:synchronize_features]`.
10
24
 
11
25
  ## 1.0.4 - 2018-10-02
12
26
 
data/README.md CHANGED
@@ -99,6 +99,15 @@ To automatically tag the code that is about to be released (lazy programmer solu
99
99
  before 'deploy', 'deploy:create_tag'
100
100
  ```
101
101
 
102
+ #### Bundler Audit
103
+
104
+ By default jefferies_tube will raise an error and stop if it detects any vulnerabilities is your installed gems. If you need to deploy anyway even with vulnerabilities you can do `I_KNOW_GEMS_ARE_INSECURE=true cap <environment> deploy`.
105
+
106
+ To ignore specific CVE's when running bundler-audit, inside `config/deploy.rb`:
107
+ ```ruby
108
+ set :bundler_audit_ignore, ["CVE-1234-5678"]
109
+ ```
110
+
102
111
  ### Enable/Disable Maintence Mode
103
112
 
104
113
  ```
@@ -155,6 +164,16 @@ end
155
164
 
156
165
  If you do this, don't forget to add `my.development.rb` to the gitignore file.
157
166
 
167
+ ### Terminal colors
168
+ Changes the prompt color of your terminal. Shows Development environments in blue, Test in yellow, and Production in a scary red.
169
+ Defaults to using the Rails env and Rails app class name, but configuration can be done in a Rails initializer like:
170
+ ```
171
+ JefferiesTube.configure do |config|
172
+ config.environment = 'production' # If you're using a nonstandard env name but want colors.
173
+ config.prompt_name = 'ShortName' #For a shorter prompt name if you have a long app
174
+ end
175
+ ```
176
+
158
177
  ## Contributing
159
178
 
160
179
  1. Fork it ( http://github.com/<my-github-username>/jefferies_tube/fork )
@@ -1,4 +1,4 @@
1
- @import compass/reset
1
+ @import 'meyer_reset'
2
2
 
3
3
  html
4
4
  box-sizing: border-box
@@ -0,0 +1,48 @@
1
+ /* http://meyerweb.com/eric/tools/css/reset/
2
+ v2.0 | 20110126
3
+ License: none (public domain)
4
+ */
5
+
6
+ html, body, div, span, applet, object, iframe,
7
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
8
+ a, abbr, acronym, address, big, cite, code,
9
+ del, dfn, em, img, ins, kbd, q, s, samp,
10
+ small, strike, strong, sub, sup, tt, var,
11
+ b, u, i, center,
12
+ dl, dt, dd, ol, ul, li,
13
+ fieldset, form, label, legend,
14
+ table, caption, tbody, tfoot, thead, tr, th, td,
15
+ article, aside, canvas, details, embed,
16
+ figure, figcaption, footer, header, hgroup,
17
+ menu, nav, output, ruby, section, summary,
18
+ time, mark, audio, video {
19
+ margin: 0;
20
+ padding: 0;
21
+ border: 0;
22
+ font-size: 100%;
23
+ font: inherit;
24
+ vertical-align: baseline;
25
+ }
26
+ /* HTML5 display-role reset for older browsers */
27
+ article, aside, details, figcaption, figure,
28
+ footer, header, hgroup, menu, nav, section {
29
+ display: block;
30
+ }
31
+ body {
32
+ line-height: 1;
33
+ }
34
+ ol, ul {
35
+ list-style: none;
36
+ }
37
+ blockquote, q {
38
+ quotes: none;
39
+ }
40
+ blockquote:before, blockquote:after,
41
+ q:before, q:after {
42
+ content: '';
43
+ content: none;
44
+ }
45
+ table {
46
+ border-collapse: collapse;
47
+ border-spacing: 0;
48
+ }
@@ -24,6 +24,5 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency "rake"
25
25
  spec.add_development_dependency "rspec", '~> 3.0'
26
26
 
27
- spec.add_dependency "bundler-audit", '~>0.5.0'
28
- spec.add_dependency 'compass-rails'
27
+ spec.add_dependency "bundler-audit", '~> 0.6.1'
29
28
  end
@@ -1,6 +1,31 @@
1
1
  require 'jefferies_tube/version'
2
- require 'jefferies_tube/engine'
2
+ require 'jefferies_tube/engine' if defined?(Rails)
3
3
 
4
4
  module JefferiesTube
5
5
  require 'jefferies_tube/railtie' if defined?(Rails)
6
+
7
+ class << self
8
+ def configure
9
+ yield(configuration)
10
+ end
11
+
12
+ def configuration
13
+ @configuration ||= Configuration.new
14
+ end
15
+ end
16
+
17
+ class Configuration
18
+ attr_accessor :environment
19
+ attr_accessor :prompt_name
20
+
21
+ def initialize
22
+ if defined?(Rails)
23
+ @environment = ::Rails.env.downcase || nil
24
+ @prompt_name = ::Rails.application.class.parent_name || nil
25
+ else
26
+ @environment = "development"
27
+ @prompt_name = "JefferiesTube"
28
+ end
29
+ end
30
+ end
6
31
  end
@@ -30,7 +30,8 @@ namespace :deploy do
30
30
  Bundler::Audit::Database.update!
31
31
  scanner = Bundler::Audit::Scanner.new
32
32
  vulnerable = false
33
- scanner.scan do |result|
33
+ ignore = fetch(:bundler_audit_ignore, [])
34
+ scanner.scan(ignore: ignore) do |result|
34
35
  vulnerable = true
35
36
  case result
36
37
  when Bundler::Audit::Scanner::InsecureSource
@@ -3,7 +3,6 @@ namespace :rails do
3
3
  task :console do
4
4
  console_roles = [roles(:worker), roles(:app)].find(&:any?)
5
5
  on console_roles, primary: true do |host, user|
6
- rails_env = fetch(:rails_env)
7
6
  run_interactively "RAILS_ENV=#{rails_env} bundle exec rails console"
8
7
  end
9
8
  end
@@ -11,7 +10,6 @@ namespace :rails do
11
10
  desc "Open the rails dbconsole on each of the remote servers"
12
11
  task :dbconsole do
13
12
  on roles(:db), primary: true do |host|
14
- rails_env = fetch(:rails_env)
15
13
  run_interactively "RAILS_ENV=#{rails_env} bundle exec rails dbconsole"
16
14
  end
17
15
  end
@@ -19,8 +17,18 @@ namespace :rails do
19
17
  desc "Open the rails log"
20
18
  task :log do
21
19
  on roles(:app), primary: true do |host, user|
22
- rails_env = ENV['LOG'] || fetch(:rails_env)
23
- run_interactively %Q{tail -f log/#{rails_env}.log | grep --line-buffered --invert "Delayed::Backend::ActiveRecord::Job Load"}
20
+ filename = ENV['LOG'] || rails_env
21
+ run_interactively %Q{tail -f log/#{filename}.log | grep --line-buffered --invert "Delayed::Backend::ActiveRecord::Job Load"}
22
+ end
23
+ end
24
+
25
+ desc "Run a rake task"
26
+ task :rake, :task_to_run do |_, parameters|
27
+ task_to_run = parameters[:task_to_run]
28
+ abort "Must supply task to run on remote server.\nUsage example: cap dev rails:rake[flipper:synchronize_features]" if task_to_run.nil?
29
+ roles = [roles(:worker), roles(:app)].find(&:any?)
30
+ on roles, primary: true do
31
+ run_interactively "RAILS_ENV=#{rails_env} bundle exec rake #{task_to_run}"
24
32
  end
25
33
  end
26
34
 
@@ -29,4 +37,8 @@ namespace :rails do
29
37
  puts "ssh #{host.user}@#{host} -p #{port} -t 'cd #{deploy_to}/current; #{command}'"
30
38
  exec "ssh #{host.user}@#{host} -p #{port} -t 'cd #{deploy_to}/current; #{command}'"
31
39
  end
40
+
41
+ def rails_env
42
+ fetch(:rails_env)
43
+ end
32
44
  end
@@ -0,0 +1,26 @@
1
+ class JefferiesTube::Console
2
+ def self.prompt
3
+ rails_env = JefferiesTube.configuration.environment
4
+ if rails_env
5
+ color = "\e[0m" #Default to white text on no background
6
+ current_app = JefferiesTube.configuration.prompt_name
7
+
8
+ # shorten some common long environment names
9
+ if rails_env == "development"
10
+ elsif rails_env == "dev"
11
+ rails_env = "dev"
12
+ color = "\e[0;37m\e[1;44m" #White on blue
13
+ elsif ["test", "qa", "staging"].include? rails_env
14
+ color = "\e[0;37m\e[1;43m" #White on yellow
15
+ elsif rails_env == "production"
16
+ rails_env = "prod"
17
+ color = "\e[0;37m\e[1;41m" #White on red
18
+ end
19
+
20
+ base = "#{color}#{current_app}(#{rails_env})\e[0m"
21
+ return "#{base}> "
22
+ else
23
+ return "#{current_app}> "
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,11 @@
1
+ prompt = JefferiesTube::Console.prompt
2
+
3
+ IRB.conf[:PROMPT][:RAILS_ENV] = {
4
+ :PROMPT_I => prompt,
5
+ :PROMPT_N => prompt,
6
+ :PROMPT_S => nil,
7
+ :PROMPT_C => prompt.sub('> ', '>* '),
8
+ :RETURN => "=> %s\n"
9
+ }
10
+
11
+ IRB.conf[:PROMPT_MODE] = :RAILS_ENV
@@ -1,12 +1,22 @@
1
1
  require 'jefferies_tube'
2
+ require 'jefferies_tube/console'
2
3
  require 'rails'
3
4
 
4
5
  module JefferiesTube
6
+
5
7
  class Railtie < ::Rails::Railtie
6
8
  railtie_name :jefferies_tube
7
9
 
8
10
  console do
9
11
  ActiveRecord::Base.connection
12
+
13
+ ARGV.push "-r", File.join(File.dirname(__FILE__),"custom_prompts.irbrc.rb")
14
+
15
+ if defined? Pry
16
+ Pry.config.prompt = proc {
17
+ JefferiesTube::Console.prompt
18
+ }
19
+ end
10
20
  end
11
21
 
12
22
  config.after_initialize do |args|
@@ -33,7 +43,6 @@ module JefferiesTube
33
43
  ActionView::Base.send :include, JefferiesTube::ApplicationHelper
34
44
  end
35
45
 
36
-
37
46
  initializer "fix spring + figaro" do |config|
38
47
  if defined?(Spring) && File.exists?("config/application.yml")
39
48
  require 'spring/watcher'
@@ -1,5 +1,7 @@
1
+ require 'open-uri'
2
+
1
3
  module JefferiesTube
2
- VERSION = "1.0.4"
4
+ VERSION = "1.3"
3
5
 
4
6
  def self.latest_rubygems_version
5
7
  JSON.parse(URI.parse("https://rubygems.org/api/v1/versions/jefferies_tube/latest.json").read)["version"]
@@ -0,0 +1,20 @@
1
+ require_relative '../lib/jefferies_tube'
2
+
3
+ RSpec.describe "Configuration" do
4
+ describe 'configuration' do
5
+ it 'allows the Environment name to be initialized' do
6
+ expect(JefferiesTube.configuration.environment).to_not be_nil
7
+ end
8
+
9
+ it 'allows a custom environment name & prompt' do
10
+ JefferiesTube.configure do |config|
11
+ config.environment = 'production' # If you're using a nonstandard env name but want colors.
12
+ config.prompt_name = 'ShortName' #For a shorter prompt name if you have a long app
13
+ end
14
+
15
+ expect(JefferiesTube.configuration.environment).to eq("production")
16
+ expect(JefferiesTube.configuration.prompt_name).to eq("ShortName")
17
+ end
18
+
19
+ end
20
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jefferies_tube
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: '1.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Samson
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-02 00:00:00.000000000 Z
11
+ date: 2020-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print
@@ -86,28 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 0.5.0
89
+ version: 0.6.1
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 0.5.0
97
- - !ruby/object:Gem::Dependency
98
- name: compass-rails
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :runtime
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
96
+ version: 0.6.1
111
97
  description: Useful tools for Rails.
112
98
  email:
113
99
  - brian@tenforwardconsulting.com
@@ -125,6 +111,7 @@ files:
125
111
  - README.md
126
112
  - Rakefile
127
113
  - app/assets/stylesheets/jefferies_tube.sass
114
+ - app/assets/stylesheets/meyer_reset.css
128
115
  - app/controllers/jefferies_tube/errors_controller.rb
129
116
  - app/helpers/jefferies_tube/application_helper.rb
130
117
  - app/views/errors/404.html.haml
@@ -142,6 +129,8 @@ files:
142
129
  - lib/jefferies_tube/capistrano/rails.rb
143
130
  - lib/jefferies_tube/capistrano/s3_assets.rb
144
131
  - lib/jefferies_tube/capistrano/ssh.rb
132
+ - lib/jefferies_tube/console.rb
133
+ - lib/jefferies_tube/custom_prompts.irbrc.rb
145
134
  - lib/jefferies_tube/database_backup.rb
146
135
  - lib/jefferies_tube/database_backup_adapter.rb
147
136
  - lib/jefferies_tube/engine.rb
@@ -151,13 +140,14 @@ files:
151
140
  - lib/jefferies_tube/test_backup_adapter.rb
152
141
  - lib/jefferies_tube/version.rb
153
142
  - lib/tasks/db.rake
143
+ - spec/configuration_spec.rb
154
144
  - spec/database_backup_spec.rb
155
145
  - spec/spec_helper.rb
156
146
  homepage: https://github.com/tenforwardconsulting/jefferies_tube/
157
147
  licenses:
158
148
  - MIT
159
149
  metadata: {}
160
- post_install_message:
150
+ post_install_message:
161
151
  rdoc_options: []
162
152
  require_paths:
163
153
  - lib
@@ -172,11 +162,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
162
  - !ruby/object:Gem::Version
173
163
  version: '0'
174
164
  requirements: []
175
- rubyforge_project:
176
- rubygems_version: 2.6.13
177
- signing_key:
165
+ rubygems_version: 3.1.4
166
+ signing_key:
178
167
  specification_version: 4
179
168
  summary: Ten Forward Consulting useful tools.
180
169
  test_files:
170
+ - spec/configuration_spec.rb
181
171
  - spec/database_backup_spec.rb
182
172
  - spec/spec_helper.rb