jefferies_tube 1.0.5 → 1.4

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: 769f6639dd1b61c313edd77594df6a38815356df
4
- data.tar.gz: ec350541673ed0a48421f629befb97e675794938
2
+ SHA256:
3
+ metadata.gz: 42afa1c0d3f03fcca7ee352fd0d557c6592c15cc72f575c1f76b059c10a0fbaa
4
+ data.tar.gz: 5b16221cfc31659d7dcc2eff9289932f3f1974e401eae42d0b1e172219ad9e4d
5
5
  SHA512:
6
- metadata.gz: 70b599a9e83cd1a1cd0dbb3c6132e4246781351571b979fc33fb06d8ae9f73a25225d7d5117320103e71f86100de6c80a654fc5de8a0049e9e144bb675c968ba
7
- data.tar.gz: 73f30ca34cff1c5b37ae471974afd2757df323e0a17a9a53942dee28f2c651562bd8988812fb4d616f8fb12b6e65625150346b1f29156a3a77003e22267e17c0
6
+ metadata.gz: 38be79244ee0c4f08f72cb82d3a82240977f6d8a1aafe99cbe8b4aa0d2393fcd07b962a875b99ca1b064899b64459e7d0d92aeb7c5216d84211680ad9acd54f4
7
+ data.tar.gz: f2cfe1e09ca3532bdf755d34fae7aef8a29361254975d9b9f70c7094570d6b05a6690d4b9bb41ac5fb364a49c446807ffb36c972e514595594f8b73018fe01a4
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.3.0
1
+ 2.6.3
data/CHANGELOG.md CHANGED
@@ -1,12 +1,30 @@
1
1
  # Changelog
2
2
 
3
- This is a [changelog](https://keepachangelog.com/en/0.3.0/).
3
+ This is a [changelog](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
5
  This project attempts to follow [semantic versioning](https://semver.org/)
6
6
 
7
7
  ## Unreleased
8
8
 
9
- * _nada_
9
+ ## 1.4
10
+
11
+ * enhancements
12
+ * Rails 6.1 support - fix deprecations and outdated gem dependencies.
13
+
14
+ ## 1.3
15
+
16
+ * enhancements
17
+ * Remove `compass-rails` dependency.
18
+
19
+ ## 1.2
20
+
21
+ * enhancements
22
+ * Allow passing through bundler-audit ignore with `set :bundler_audit_ignore, ["CVE-1234-5678"]`
23
+
24
+ ## 1.1.1
25
+
26
+ * enhancements
27
+ * Add colorful IRB prompts based on Rails environment
10
28
 
11
29
  ## 1.0.5 - 2019-02-19
12
30
 
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,10 +164,28 @@ 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 )
161
180
  2. Create your feature branch (`git checkout -b my-new-feature`)
162
181
  3. Commit your changes (`git commit -am 'Add some feature'`)
163
- 4. Push to the branch (`git push origin my-new-feature`)
164
- 5. Create new Pull Request
182
+ 4. Add changes to the CHANGELOG file in the 'Unreleased' section.
183
+ 5. Push to the branch (`git push origin my-new-feature`)
184
+ 6. Create new Pull Request
185
+
186
+ ### Release
187
+
188
+ - Update `lib/jefferies_tube/version.rb` with the new version number (be sure to follow
189
+ [semver](https://semver.org/)).
190
+ - Update `CHANGELOG.md` and move everything in 'Unreleased' to a new section for the new version.
191
+ - Tag the final commit in that release.
@@ -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
+ }
@@ -20,10 +20,10 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "awesome_print"
22
22
  spec.add_development_dependency "bundler"
23
- spec.add_development_dependency "pry"
23
+ spec.add_development_dependency "pry", '~> 0.13'
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.6.1'
28
- spec.add_dependency 'compass-rails'
27
+ spec.add_dependency "bundler-audit", '~> 0.7.0'
28
+ spec.add_dependency "pry", '~> 0.13'
29
29
  end
@@ -1,6 +1,36 @@
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 =
25
+ if ::Rails::VERSION::MAJOR >= 6
26
+ ::Rails.application.class.module_parent_name || nil
27
+ else
28
+ ::Rails.application.class.parent_name || nil
29
+ end
30
+ else
31
+ @environment = "development"
32
+ @prompt_name = "JefferiesTube"
33
+ end
34
+ end
35
+ end
6
36
  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
@@ -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,20 @@
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.prompt = Pry::Prompt.new(:jefferies_tube, '', Array.new(2) { proc { JefferiesTube::Console.prompt } })
17
+ end
10
18
  end
11
19
 
12
20
  config.after_initialize do |args|
@@ -30,10 +38,11 @@ module JefferiesTube
30
38
  end
31
39
 
32
40
  initializer "jefferies_tube.view_helpers" do
33
- ActionView::Base.send :include, JefferiesTube::ApplicationHelper
41
+ ::Rails.application.reloader.to_prepare do
42
+ ActionView::Base.send :include, JefferiesTube::ApplicationHelper
43
+ end
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.5"
4
+ VERSION = "1.4"
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.5
4
+ version: '1.4'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Samson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-19 00:00:00.000000000 Z
11
+ date: 2021-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: pry
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '0.13'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '0.13'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -86,28 +86,28 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 0.6.1
89
+ version: 0.7.0
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.6.1
96
+ version: 0.7.0
97
97
  - !ruby/object:Gem::Dependency
98
- name: compass-rails
98
+ name: pry
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: '0.13'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
110
+ version: '0.13'
111
111
  description: Useful tools for Rails.
112
112
  email:
113
113
  - brian@tenforwardconsulting.com
@@ -125,6 +125,7 @@ files:
125
125
  - README.md
126
126
  - Rakefile
127
127
  - app/assets/stylesheets/jefferies_tube.sass
128
+ - app/assets/stylesheets/meyer_reset.css
128
129
  - app/controllers/jefferies_tube/errors_controller.rb
129
130
  - app/helpers/jefferies_tube/application_helper.rb
130
131
  - app/views/errors/404.html.haml
@@ -142,6 +143,8 @@ files:
142
143
  - lib/jefferies_tube/capistrano/rails.rb
143
144
  - lib/jefferies_tube/capistrano/s3_assets.rb
144
145
  - lib/jefferies_tube/capistrano/ssh.rb
146
+ - lib/jefferies_tube/console.rb
147
+ - lib/jefferies_tube/custom_prompts.irbrc.rb
145
148
  - lib/jefferies_tube/database_backup.rb
146
149
  - lib/jefferies_tube/database_backup_adapter.rb
147
150
  - lib/jefferies_tube/engine.rb
@@ -151,6 +154,7 @@ files:
151
154
  - lib/jefferies_tube/test_backup_adapter.rb
152
155
  - lib/jefferies_tube/version.rb
153
156
  - lib/tasks/db.rake
157
+ - spec/configuration_spec.rb
154
158
  - spec/database_backup_spec.rb
155
159
  - spec/spec_helper.rb
156
160
  homepage: https://github.com/tenforwardconsulting/jefferies_tube/
@@ -172,11 +176,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
176
  - !ruby/object:Gem::Version
173
177
  version: '0'
174
178
  requirements: []
175
- rubyforge_project:
176
- rubygems_version: 2.6.13
179
+ rubygems_version: 3.0.3
177
180
  signing_key:
178
181
  specification_version: 4
179
182
  summary: Ten Forward Consulting useful tools.
180
183
  test_files:
184
+ - spec/configuration_spec.rb
181
185
  - spec/database_backup_spec.rb
182
186
  - spec/spec_helper.rb