jefferies_tube 1.0.4 → 1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.ruby-version +1 -1
- data/CHANGELOG.md +16 -2
- data/README.md +19 -0
- data/app/assets/stylesheets/jefferies_tube.sass +1 -1
- data/app/assets/stylesheets/meyer_reset.css +48 -0
- data/jefferies_tube.gemspec +1 -2
- data/lib/jefferies_tube.rb +26 -1
- data/lib/jefferies_tube/capistrano/deploy.rb +2 -1
- data/lib/jefferies_tube/capistrano/rails.rb +16 -4
- data/lib/jefferies_tube/console.rb +26 -0
- data/lib/jefferies_tube/custom_prompts.irbrc.rb +11 -0
- data/lib/jefferies_tube/railtie.rb +10 -1
- data/lib/jefferies_tube/version.rb +3 -1
- data/spec/configuration_spec.rb +20 -0
- metadata +13 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c26142656f2dbd377a3d4f2fe0850303133147c410a22db25cab0123669d5cfa
|
4
|
+
data.tar.gz: 5593a8821e97d000ded09ee563669f85dde0857ff3fa430bb7eb02a3941c90f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1c24325ee32a148689eaa66aed57bc64af7ad37ffbc830b573c6bc10c964f44d25df1b395c1fb9e1f3305d254a44ea630b2ff1973ddff159a8aa07c17bb5cf3
|
7
|
+
data.tar.gz: 5b4718b4a0250e43a8427835d62b887dfd9b02298028c2cc4e2d11110760b25264edd50a2c2a7188693883d8a219c94c19aa114857f4f55432504f1fd5fe928e
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.6.3
|
data/CHANGELOG.md
CHANGED
@@ -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
|
-
##
|
7
|
+
## 1.2
|
8
8
|
|
9
|
-
*
|
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 )
|
@@ -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
|
+
}
|
data/jefferies_tube.gemspec
CHANGED
@@ -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.
|
28
|
-
spec.add_dependency 'compass-rails'
|
27
|
+
spec.add_dependency "bundler-audit", '~> 0.6.1'
|
29
28
|
end
|
data/lib/jefferies_tube.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
23
|
-
run_interactively %Q{tail -f log/#{
|
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
|
@@ -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'
|
@@ -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.
|
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:
|
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.
|
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.
|
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
|
-
|
176
|
-
|
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
|