bundler-leak 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +59 -0
  3. data/.github/ISSUE_TEMPLATE/feature_request.md +47 -0
  4. data/.github/workflows/test.yml +27 -0
  5. data/.gitignore +1 -2
  6. data/Gemfile +1 -1
  7. data/README.md +13 -4
  8. data/Rakefile +1 -14
  9. data/bundler-leak.gemspec +2 -1
  10. data/code-of-conduct.md +77 -0
  11. data/{bin → exe}/bundle-leak +0 -0
  12. data/{bin → exe}/bundler-leak +0 -0
  13. data/fastruby-logo.png +0 -0
  14. data/gemspec.yml +3 -0
  15. data/lib/bundler/plumber/advisory.rb +7 -1
  16. data/lib/bundler/plumber/cli.rb +1 -1
  17. data/lib/bundler/plumber/database.rb +1 -1
  18. data/lib/bundler/plumber/version.rb +1 -1
  19. data/pull_request_template.md +7 -0
  20. data/spec/advisory_spec.rb +1 -1
  21. data/spec/bundle/unpatched_gems/Gemfile +0 -35
  22. data/spec/bundle/unpatched_gems/Gemfile.lock +60 -0
  23. data/spec/cli_spec.rb +49 -33
  24. data/spec/database_spec.rb +2 -7
  25. data/spec/integration_spec.rb +2 -2
  26. data/spec/spec_helper.rb +1 -1
  27. metadata +29 -34
  28. data/.travis.yml +0 -13
  29. data/data/ruby-mem-advisory-db/.gitignore +0 -1
  30. data/data/ruby-mem-advisory-db/.rspec +0 -1
  31. data/data/ruby-mem-advisory-db/.travis.yml +0 -12
  32. data/data/ruby-mem-advisory-db/CONTRIBUTING.md +0 -69
  33. data/data/ruby-mem-advisory-db/CONTRIBUTORS.md +0 -40
  34. data/data/ruby-mem-advisory-db/Gemfile +0 -9
  35. data/data/ruby-mem-advisory-db/Gemfile.lock +0 -38
  36. data/data/ruby-mem-advisory-db/LICENSE.txt +0 -5
  37. data/data/ruby-mem-advisory-db/README.md +0 -72
  38. data/data/ruby-mem-advisory-db/Rakefile +0 -26
  39. data/data/ruby-mem-advisory-db/gems/celluloid/670.yml +0 -13
  40. data/data/ruby-mem-advisory-db/gems/grape/301.yml +0 -11
  41. data/data/ruby-mem-advisory-db/gems/oj/229.yml +0 -11
  42. data/data/ruby-mem-advisory-db/gems/redcarpet/516.yml +0 -14
  43. data/data/ruby-mem-advisory-db/gems/redis/612.yml +0 -12
  44. data/data/ruby-mem-advisory-db/gems/sidekiq/2598.yml +0 -11
  45. data/data/ruby-mem-advisory-db/gems/sidekiq-statistic/73.yml +0 -9
  46. data/data/ruby-mem-advisory-db/gems/therubyracer/336.yml +0 -13
  47. data/data/ruby-mem-advisory-db/gems/zipruby/PRE-SA-2012-02.yml +0 -9
  48. data/data/ruby-mem-advisory-db/scripts/post-advisories.sh +0 -18
  49. data/data/ruby-mem-advisory-db/spec/advisories_spec.rb +0 -23
  50. data/data/ruby-mem-advisory-db/spec/advisory_example.rb +0 -209
  51. data/data/ruby-mem-advisory-db/spec/gem_example.rb +0 -37
  52. data/data/ruby-mem-advisory-db/spec/library_example.rb +0 -21
  53. data/data/ruby-mem-advisory-db/spec/ruby_example.rb +0 -22
  54. data/data/ruby-mem-advisory-db/spec/spec_helper.rb +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d6a7260a91e09321434a8b2ce2106896144db3a27a7fe32cf519f904bbbabf86
4
- data.tar.gz: 6b1dbb00bf846c7e52c5a24be5f46048b7ca9b61ecec3c801c2c40eb78516516
3
+ metadata.gz: da3d27fec7acee6b26df26e77f7efdb5d4d5c4783bab50a5ffee8c70344c9791
4
+ data.tar.gz: 16104345f72340b3b14d5106a08c24a3b4627ead89aa4bc48423346c255f483f
5
5
  SHA512:
6
- metadata.gz: 1d9523794f9ee066976bf5ba73bfc072ac2291cfa8c3e53c3f2021f2449bccc4d3d6a3497114e210168d8114239a00b60b1b25c40f18057ee503f3447ae5bd5d
7
- data.tar.gz: 4d7e7319fc73914ae027c00c7f5d578030fdc3966cc69e6d07014b13a02b900c6eaa8f5d1e1e94b7844444a10119fa1925b26aba8777292a236dad4535886c20
6
+ metadata.gz: 2556087c7303334229b4957a28915795b8bc2df3ea05834cac8c3d81f67fee5a17bf454493590131f3a9950e8dc7f26f5c7b8bca0ab06e437c766feed360dda3
7
+ data.tar.gz: 64f11cfcedce51dafa622b0453f0ce0e77d8a0e48ce0bb3b5d437f0648fba1a775b3116b28d05814ef4b860fa6c7958ff74355fb6ed236cd5cba10dc04114117
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: "[BUG]"
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **IMPORTANT: please make sure you ask yourself all intro questions and fill all sections of the template.**
11
+
12
+ **Before we start...:**
13
+
14
+ - [ ] I checked the documentation and found no answer
15
+ - [ ] I checked to make sure that this issue has not already been filed
16
+ - [ ] I'm reporting the issue to the correct repository (for multi-repository projects)
17
+
18
+
19
+ **Branch/Commit:**
20
+
21
+ Inform what branch/commit of bundler-leak you are using.
22
+
23
+ **Expected behavior:**
24
+
25
+ Please include a detailed description of the behavior you were expecting when you encountered this issue.
26
+
27
+ **Actual behavior:**
28
+
29
+ Please include a detailed description of the actual behavior of the application.
30
+
31
+ **Steps to reproduce:**
32
+
33
+ How do I achieve this behavior? Use the following format to provide a step-by-step guide:
34
+
35
+ 1. Step 1: ...
36
+ 2. Step 2: ...
37
+
38
+ **Context and environment:**
39
+
40
+ Provide any relevant information about your setup (Customize the list accordingly based on what info is relevant to this project)
41
+
42
+ 1. Version of the software the issue is being opened for.
43
+ 2. Operating System
44
+ 3. Operating System version
45
+ 4. Ruby version
46
+
47
+ _Delete any information that is not relevant._
48
+
49
+ If you are unable to reproduce the bug, add the **Non-Reproducible** tag and describe the steps you followed leading to the bug to the best of your recollection.
50
+
51
+ **Screenshots and Videos**
52
+
53
+ If the issue has an effect in the frontend, include any relevant screenshots and videos here.
54
+
55
+ **Logs**
56
+
57
+ Include relevant log snippets or files here.
58
+
59
+ **I will abide by the [code of conduct] (code_of_conduct.md)**
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: Feature request
3
+ about: Request a new feature
4
+ title: "[REQUEST]"
5
+ labels: 'enhancement'
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **IMPORTANT: please make sure you ask yourself all intro questions and fill all sections of the template.**
11
+
12
+ **Before we start...:**
13
+
14
+ - [ ] I checked the documentation and didn't find this feature
15
+ - [ ] I checked to make sure that this feature has not already been requested
16
+
17
+
18
+ **Branch/Commit:**
19
+
20
+ Inform what branch/commit/version of bundler-leak you are using.
21
+
22
+ **Describe the feature:**
23
+
24
+ Please include a detailed description of the feature you are requesting and any detail on it’s expected behavior.
25
+
26
+ > **As a \<role name\>**
27
+ > **I do \<something\>**
28
+ > **And then I do \<another action\>**
29
+ > **And I see \<some result\>**
30
+
31
+ **Problem:**
32
+
33
+ Please include a detailed description of the problem this feature would solve.
34
+
35
+ > **As a \<role name\>**
36
+ > **I want to \<do something\>**
37
+ > **So that I can achieve a \<goal\>**
38
+
39
+ **Mockups:**
40
+
41
+ Include any mockup idea related to the requested feature if it applies.
42
+
43
+ **Resources:**
44
+
45
+ If you have resources related to the implementation or research for this feature, add them here.
46
+
47
+ **I will abide by the [code of conduct] (code_of_conduct.md)**
@@ -0,0 +1,27 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ branches:
9
+ - main
10
+
11
+ jobs:
12
+ test:
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ os: [ubuntu-latest]
17
+ ruby: ['2.6', '2.7', '3.0', '3.1']
18
+ runs-on: ${{ matrix.os }}
19
+ steps:
20
+ - uses: actions/checkout@v2
21
+ - uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: ${{ matrix.ruby }}
24
+ - name: Run tests
25
+ run: |
26
+ ./bin/setup
27
+ bundle exec rspec spec
data/.gitignore CHANGED
@@ -5,7 +5,6 @@ doc/
5
5
  .yardoc/
6
6
  coverage/
7
7
  pkg/
8
- spec/bundle/*/Gemfile.lock
9
- spec/bundle/*/.bundle/
8
+ spec/bundle/unpatched_gems/.bundle/
10
9
  vendor/bundle/
11
10
  tmp/
data/Gemfile CHANGED
@@ -9,7 +9,7 @@ group :development do
9
9
  gem 'rubygems-tasks', '~> 0.2'
10
10
  gem 'rspec', '~> 3.0'
11
11
  gem 'yard', '~> 0.9'
12
- gem 'simplecov', '~> 0.7', :require => false
12
+ gem 'simplecov', '~> 0.21.2', :require => false
13
13
  end
14
14
 
15
15
  gem "byebug", "~> 11.0", :groups => [:development, :test]
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  * [Issues](https://github.com/rubymem/bundler-leak/issues)
5
5
  * [Documentation](http://rubydoc.info/gems/bundler-leak/frames)
6
6
  * [Email](mailto:oss at ombulabs.com)
7
- * [![Build Status](https://travis-ci.org/rubymem/bundler-leak.svg?branch=master)](https://travis-ci.org/rubymem/bundler-leak)
7
+ * [![Build Status](https://travis-ci.org/rubymem/bundler-leak.svg?branch=main)](https://travis-ci.org/rubymem/bundler-leak)
8
8
  * [![Code Climate](https://codeclimate.com/github/rubymem/bundler-leak.svg)](https://codeclimate.com/github/rubymem/bundler-leak)
9
9
 
10
10
  ## Description
@@ -45,15 +45,15 @@ Update the [ruby-mem-advisory-db] that `bundle leak` uses:
45
45
  $ bundle leak update
46
46
 
47
47
  cd data/ruby-mem-advisory-db
48
- git pull origin master
48
+ git pull origin main
49
49
  remote: Enumerating objects: 14, done.
50
50
  remote: Counting objects: 100% (14/14), done.
51
51
  remote: Compressing objects: 100% (4/4), done.
52
52
  remote: Total 9 (delta 5), reused 7 (delta 4), pack-reused 0
53
53
  Unpacking objects: 100% (9/9), done.
54
54
  From github.com:rubymem/ruby-mem-advisory-db
55
- * branch master -> FETCH_HEAD
56
- 3254525..c4fc78e master -> origin/master
55
+ * branch main -> FETCH_HEAD
56
+ 3254525..c4fc78e main -> origin/main
57
57
  Updating 3254525..c4fc78e
58
58
  Fast-forward
59
59
  README.md | 68 ++++++++++++++++++++------------------------------------------------
@@ -116,3 +116,12 @@ along with bundler-leak. If not, see <http://www.gnu.org/licenses/>.
116
116
  [bundler]: https://github.com/carlhuda/bundler#readme
117
117
 
118
118
  [ruby-mem-advisory-db]: https://github.com/rubymem/ruby-mem-advisory-db
119
+
120
+ ## Code of Conduct
121
+
122
+ Everyone interacting in the bundler-leak project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/rubymem/bundler-leak/code-of-conduct.md).
123
+
124
+ ## FastRuby.io
125
+ ![fastruby](https://github.com/rubymem/bundler-leak/raw/main/fastruby-logo.png)
126
+
127
+ `bundler-leak` is maintained and funded by FastRuby.io, inc. The names and logos for FastRuby.io are trademarks of FastRuby.io, inc.
data/Rakefile CHANGED
@@ -20,7 +20,7 @@ namespace :db do
20
20
  timestamp = nil
21
21
 
22
22
  chdir 'data/ruby-mem-advisory-db' do
23
- sh 'git', 'pull', 'origin', 'master'
23
+ sh 'git', 'pull', 'origin', 'main'
24
24
 
25
25
  File.open('../ruby-mem-advisory-db.ts','w') do |file|
26
26
  file.write Time.parse(`git log --pretty="%cd" -1`).utc
@@ -36,19 +36,6 @@ end
36
36
  require 'rspec/core/rake_task'
37
37
  RSpec::Core::RakeTask.new
38
38
 
39
- namespace :spec do
40
- task :bundle do
41
- root = 'spec/bundle'
42
-
43
- %w[unpatched_gems].each do |bundle|
44
- chdir(File.join(root,bundle)) do
45
- sh "unset BUNDLE_BIN_PATH BUNDLE_GEMFILE RUBYOPT && bundle config set --local path '../../../vendor/bundle' && bundle install"
46
- end
47
- end
48
- end
49
- end
50
- task :spec => 'spec:bundle'
51
-
52
39
  task :test => :spec
53
40
  task :default => :spec
54
41
 
data/bundler-leak.gemspec CHANGED
@@ -33,8 +33,9 @@ Gem::Specification.new do |gem|
33
33
  end
34
34
  end
35
35
 
36
+ gem.bindir = "exe"
36
37
  gem.executables = gemspec.fetch('executables') do
37
- glob['bin/*'].map { |path| File.basename(path) }
38
+ glob['exe/*'].map { |path| File.basename(path) }
38
39
  end
39
40
  gem.default_executable = gem.executables.first if Gem::VERSION < '1.7.'
40
41
 
@@ -0,0 +1,77 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to make participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, sex characteristics, gender identity and expression,
9
+ level of experience, education, socio-economic status, nationality, personal
10
+ appearance, race, religion, or sexual identity and orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies within all project spaces, and it also applies when
49
+ an individual is representing the project or its community in public spaces.
50
+ Examples of representing a project or community include using an official
51
+ project e-mail address, posting via an official social media account, or acting
52
+ as an appointed representative at an online or offline event. Representation of
53
+ a project may be further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at [oss@ombulabs.com]. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72
+
73
+ [homepage]: https://www.contributor-covenant.org
74
+
75
+ For answers to common questions about this code of conduct, see
76
+ https://www.contributor-covenant.org/faq
77
+
File without changes
File without changes
data/fastruby-logo.png ADDED
Binary file
data/gemspec.yml CHANGED
@@ -12,3 +12,6 @@ required_rubygems_version: ">= 1.8.0"
12
12
  dependencies:
13
13
  thor: ">= 0.18, < 2"
14
14
  bundler: ">= 1.2.0, < 3"
15
+
16
+ development_dependencies:
17
+ byebug: "~> 11.1"
@@ -44,7 +44,7 @@ module Bundler
44
44
  #
45
45
  def self.load(path)
46
46
  id = File.basename(path).chomp('.yml')
47
- data = YAML.load_file(path)
47
+ data = load_advisory_from_yaml(path)
48
48
 
49
49
  unless data.kind_of?(Hash)
50
50
  raise("advisory data in #{path.dump} was not a Hash")
@@ -69,6 +69,12 @@ module Bundler
69
69
  )
70
70
  end
71
71
 
72
+ def self.load_advisory_from_yaml(path)
73
+ return YAML.load_file(path, permitted_classes: [Date]) if Gem::Version.new(Psych::VERSION) >= Gem::Version.new('4')
74
+
75
+ YAML.load_file(path)
76
+ end
77
+
72
78
  #
73
79
  # Checks whether the version is not affected by the advisory.
74
80
  #
@@ -76,7 +76,7 @@ module Bundler
76
76
  end
77
77
 
78
78
  unless options.quiet?
79
- puts("ruby-mem-advisory-db: #{Database.new.size} advisories")
79
+ say("ruby-mem-advisory-db: #{Database.new.size} advisories", :green)
80
80
  end
81
81
  end
82
82
 
@@ -100,7 +100,7 @@ module Bundler
100
100
  if File.directory?(USER_PATH)
101
101
  if File.directory?(File.join(USER_PATH, ".git"))
102
102
  Dir.chdir(USER_PATH) do
103
- command = "git fetch --all; git reset --hard origin/master"
103
+ command = "git fetch --all; git reset --hard origin/main"
104
104
  command << ' --quiet' if options[:quiet]
105
105
 
106
106
  system *command
@@ -19,6 +19,6 @@
19
19
  module Bundler
20
20
  module Plumber
21
21
  # bundler-leak version
22
- VERSION = '0.2.0'
22
+ VERSION = '0.3.0'
23
23
  end
24
24
  end
@@ -0,0 +1,7 @@
1
+ **IMPORTANT: Please read the README before submitting pull requests for this project. Additionally, if your PR closes any open GitHub issues, make sure you include _Closes #XXXX_ in your comment or use the option on the PR's sidebar to add related issues to auto-close the issue that your PR fixes. **
2
+
3
+ **Description:**
4
+
5
+ Please include a summary of the change and which issue is fixed or which feature is introduced. If changes to the behavior are made, clearly describe what changes.
6
+
7
+ I will abide by the [code of conduct](code_of_conduct.md).
@@ -27,7 +27,7 @@ describe Bundler::Plumber::Advisory do
27
27
  subject { described_class.load(path) }
28
28
 
29
29
  describe "load" do
30
- let(:data) { YAML.load_file(path) }
30
+ let(:data) { YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(File.read(path)) : YAML.load_file(path) }
31
31
 
32
32
  describe '#id' do
33
33
  subject { super().id }
@@ -2,38 +2,3 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem "celluloid", "0.17.0"
4
4
  gem "therubyracer", "0.12.1"
5
-
6
- # Bundle edge Rails instead:
7
- # gem 'rails', :git => 'git://github.com/rails/rails.git'
8
-
9
- gem 'sqlite3', platform: [:mri, :rbx]
10
-
11
-
12
- # Gems used only for assets and not required
13
- # in production environments by default.
14
- group :assets do
15
- # gem 'sass-rails', '~> 3.2.3'
16
- # gem 'coffee-rails', '~> 3.2.1'
17
-
18
- # See https://github.com/sstephenson/execjs#readme for more supported runtimes
19
- # gem 'therubyracer', :platforms => :ruby
20
-
21
- # gem 'uglifier', '>= 1.0.3'
22
- end
23
-
24
- gem 'jquery-rails'
25
-
26
- # To use ActiveModel has_secure_password
27
- # gem 'bcrypt-ruby', '~> 3.0.0'
28
-
29
- # To use Jbuilder templates for JSON
30
- # gem 'jbuilder'
31
-
32
- # Use unicorn as the app server
33
- # gem 'unicorn'
34
-
35
- # Deploy with Capistrano
36
- # gem 'capistrano'
37
-
38
- # To use debugger
39
- # gem 'debugger'
@@ -0,0 +1,60 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ celluloid (0.17.0)
5
+ bundler
6
+ celluloid-essentials
7
+ celluloid-extras
8
+ celluloid-fsm
9
+ celluloid-pool
10
+ celluloid-supervision
11
+ dotenv
12
+ nenv
13
+ rspec-logsplit (>= 0.1.2)
14
+ timers (~> 4.0.0)
15
+ celluloid-essentials (0.20.2)
16
+ bundler
17
+ dotenv
18
+ nenv
19
+ rspec-logsplit (>= 0.1.2)
20
+ timers (~> 4.0.0)
21
+ celluloid-extras (0.20.0)
22
+ bundler
23
+ dotenv
24
+ nenv
25
+ rspec-logsplit (>= 0.1.2)
26
+ timers (~> 4.0.0)
27
+ celluloid-fsm (0.20.0)
28
+ bundler
29
+ dotenv
30
+ nenv
31
+ rspec-logsplit (>= 0.1.2)
32
+ timers (~> 4.0.0)
33
+ celluloid-pool (0.20.0)
34
+ bundler
35
+ dotenv
36
+ nenv
37
+ rspec-logsplit (>= 0.1.2)
38
+ timers (~> 4.0.0)
39
+ celluloid-supervision (0.20.1)
40
+ bundler
41
+ dotenv
42
+ nenv
43
+ rspec-logsplit (>= 0.1.2)
44
+ timers (~> 4.0.0)
45
+ dotenv (2.7.6)
46
+ hitimes (2.0.0)
47
+ nenv (0.3.0)
48
+ rspec-logsplit (0.1.3)
49
+ therubyracer (0.12.1)
50
+ timers (4.0.4)
51
+ hitimes
52
+
53
+ PLATFORMS
54
+ ruby
55
+
56
+ DEPENDENCIES
57
+ celluloid (= 0.17.0)
58
+
59
+ BUNDLED WITH
60
+ 2.1.4
data/spec/cli_spec.rb CHANGED
@@ -5,33 +5,49 @@ describe Bundler::Plumber::CLI do
5
5
  describe "#update" do
6
6
  context "not --quiet (the default)" do
7
7
  context "when update succeeds" do
8
-
9
- before { expect(Bundler::Plumber::Database).to receive(:update!).and_return(true) }
8
+ before { allow(Bundler::Plumber::Database).to receive(:update!).and_return(true) }
10
9
 
11
10
  it "prints updated message" do
12
- expect { subject.update }.to output(/Updated ruby-mem-advisory-db/).to_stdout
11
+ allow(subject).to(
12
+ receive(:say)
13
+ )
14
+
15
+ subject.update
16
+
17
+ expect(subject).to(
18
+ have_received(:say).with("Updated ruby-mem-advisory-db", :green)
19
+ )
13
20
  end
14
21
 
15
22
  it "prints total advisory count" do
16
23
  database = double
17
- expect(database).to receive(:size).and_return(1234)
18
- expect(Bundler::Plumber::Database).to receive(:new).and_return(database)
24
+ allow(database).to receive(:size).and_return(1234)
25
+ allow(Bundler::Plumber::Database).to receive(:new).and_return(database)
26
+
27
+ allow(subject).to(
28
+ receive(:say)
29
+ )
19
30
 
20
- expect { subject.update }.to output(/ruby-mem-advisory-db: 1234 advisories/).to_stdout
31
+ subject.update
32
+
33
+ expect(subject).to(
34
+ have_received(:say).with("ruby-mem-advisory-db: 1234 advisories", :green)
35
+ )
21
36
  end
22
37
  end
23
38
 
24
39
  context "when update fails" do
25
-
26
- before { expect(Bundler::Plumber::Database).to receive(:update!).and_return(false) }
40
+ before { allow(Bundler::Plumber::Database).to receive(:update!).and_return(false) }
27
41
 
28
42
  it "prints failure message" do
29
- expect do
30
- begin
31
- subject.update
32
- rescue SystemExit
33
- end
34
- end.to output(/Failed updating ruby-mem-advisory-db!/).to_stdout
43
+ allow(subject).to(receive(:say))
44
+ allow(subject).to(receive(:exit))
45
+
46
+ subject.update
47
+
48
+ expect(subject).to(
49
+ have_received(:say).with("Failed updating ruby-mem-advisory-db!", :red)
50
+ )
35
51
  end
36
52
 
37
53
  it "exits with error status code" do
@@ -49,14 +65,14 @@ describe Bundler::Plumber::CLI do
49
65
  end
50
66
 
51
67
  context "--quiet" do
52
- before do
53
- allow(subject).to receive(:options).and_return(double("Options", quiet?: true))
68
+ subject do
69
+ Bundler::Plumber::CLI.new([], quiet: true)
54
70
  end
55
71
 
56
72
  context "when update succeeds" do
57
73
 
58
74
  before do
59
- expect(Bundler::Plumber::Database).to(
75
+ allow(Bundler::Plumber::Database).to(
60
76
  receive(:update!).with(quiet: true).and_return(true)
61
77
  )
62
78
  end
@@ -67,31 +83,31 @@ describe Bundler::Plumber::CLI do
67
83
  end
68
84
 
69
85
  context "when update fails" do
70
-
71
86
  before do
72
- expect(Bundler::Plumber::Database).to(
87
+ allow(Bundler::Plumber::Database).to(
73
88
  receive(:update!).with(quiet: true).and_return(false)
74
89
  )
90
+ allow(subject).to receive(:exit)
75
91
  end
76
92
 
77
93
  it "prints failure message" do
78
- expect do
79
- begin
80
- subject.update
81
- rescue SystemExit
82
- end
83
- end.to output(/Failed updating ruby-mem-advisory-db!/).to_stdout
94
+ allow(subject).to(
95
+ receive(:say)
96
+ )
97
+
98
+ subject.update
99
+
100
+ expect(subject).to(
101
+ have_received(:say).with("Failed updating ruby-mem-advisory-db!", :red)
102
+ )
84
103
  end
85
104
 
86
105
  it "exits with error status code" do
87
- expect {
88
- # Capture output of `update` only to keep spec output clean.
89
- # The test regarding specific output is above.
90
- expect { subject.update }.to output.to_stdout
91
- }.to raise_error(SystemExit) do |error|
92
- expect(error.success?).to eq(false)
93
- expect(error.status).to eq(1)
94
- end
106
+ allow(subject).to receive(:exit)
107
+
108
+ subject.update
109
+
110
+ expect(subject).to have_received(:exit).with(1)
95
111
  end
96
112
  end
97
113
  end
@@ -14,15 +14,10 @@ describe Bundler::Plumber::Database do
14
14
  expect(File.directory?(subject)).to be_truthy
15
15
  end
16
16
 
17
- it "should prefer the user repo, if it's as up to date, or more up to date than the vendored one" do
17
+ xit "should prefer the user repo, if it's as up to date, or more up to date than the vendored one" do
18
18
 
19
19
  Bundler::Plumber::Database.update!(quiet: false)
20
20
 
21
- Dir.chdir(Bundler::Plumber::Database::USER_PATH) do
22
- puts "Timestamp:"
23
- system 'git log --pretty="%cd" -1'
24
- end
25
-
26
21
  # As up to date...
27
22
  expect(Bundler::Plumber::Database.path).to eq mocked_user_path
28
23
 
@@ -36,7 +31,7 @@ describe Bundler::Plumber::Database do
36
31
  end
37
32
 
38
33
  describe "update!" do
39
- it "should create the USER_PATH path as needed" do
34
+ xit "should create the USER_PATH path as needed" do
40
35
  Bundler::Plumber::Database.update!(quiet: false)
41
36
  expect(File.directory?(mocked_user_path)).to be true
42
37
  end