transpec 3.0.4 → 3.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f5754630c15f5f19404c281a79990204109e6788
4
- data.tar.gz: c17cfcb2f1142e0c6c0978173401d6dd444cbcef
3
+ metadata.gz: d40aebdbb1e1f3e66aff593224f873193f187919
4
+ data.tar.gz: 5699ff25b4e218514844def74918519cec54c69a
5
5
  SHA512:
6
- metadata.gz: 41864e335343d4334e52b8ca4349bdd1d5a701646eda18dd7700a99e8e298c5c0448f0c15043ba5f903c1c729c1112b181bcf11e91f34bcfd9be868ecda91871
7
- data.tar.gz: 2b571ca015d069cd95310274544f32a84654b3b17fc3c5021f05f756bbd4ec9b5c141010bb5ae8a38958279288941f8abccbc724c152504cf1a8ab7986431388
6
+ metadata.gz: ac3ae1a634b6d1e2355509134bd685e2bd26e322fefba06ae2e5b5b994530f23bf497e8049fa827c7774a5dda07d5d807b0cd30bfc8719b0667f25bad5b86158
7
+ data.tar.gz: 75fd01a09e678f449a61b40a77f31394b9900bbe6edb2b95c0aab8446fc0a3d7d19bdd4c9812606a96f5ff8fe61ecd79c73d3dfb9d7c9d87fc94eff1eea204ba
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Development
4
4
 
5
+ ## v3.0.5
6
+
7
+ * Abort processing if the project has a `Gemfile` but no `Gemfile.lock`.
8
+
5
9
  ## v3.0.4
6
10
 
7
11
  * Fix an issue where `obj = Klass.any_instance; obj.should_receive(:message)` was not properly converted to `expect_any_instance_of(Klass).to receive(:message)` when run on RSpec 3.
data/lib/transpec/cli.rb CHANGED
@@ -28,7 +28,7 @@ module Transpec
28
28
  def run(args)
29
29
  begin
30
30
  paths = OptionParser.new(config).parse(args)
31
- fail_if_should_not_continue!
31
+ validate!
32
32
  rescue => error
33
33
  warn error.message
34
34
  return false
@@ -95,7 +95,7 @@ module Transpec
95
95
 
96
96
  private
97
97
 
98
- def fail_if_should_not_continue!
98
+ def validate!
99
99
  unless config.forced?
100
100
  if Git.command_available? && Git.inside_of_repository? && !Git.clean?
101
101
  fail 'The current Git repository is not clean. Aborting. ' \
@@ -17,7 +17,8 @@ module Transpec
17
17
  end
18
18
 
19
19
  def using_bundler?
20
- File.exist?(gemfile_lock_path)
20
+ gemfile_path = File.join(path, 'Gemfile')
21
+ File.exist?(gemfile_path)
21
22
  end
22
23
 
23
24
  def depend_on_rspec_rails?
@@ -45,15 +46,19 @@ module Transpec
45
46
  private
46
47
 
47
48
  def dependency_gems
48
- @dependency_gems ||= begin
49
- gemfile_lock_content = File.read(gemfile_lock_path)
50
- lockfile = Bundler::LockfileParser.new(gemfile_lock_content)
51
- lockfile.specs
52
- end
49
+ return @dependency_gems if @dependency_gems
50
+ lockfile = Bundler::LockfileParser.new(gemfile_lock_content)
51
+ @dependency_gems = lockfile.specs
53
52
  end
54
53
 
55
- def gemfile_lock_path
56
- @gemfile_lock_path ||= File.join(path, 'Gemfile.lock')
54
+ def gemfile_lock_content
55
+ gemfile_lock_path = File.join(path, 'Gemfile.lock')
56
+
57
+ if File.exist?(gemfile_lock_path)
58
+ File.read(gemfile_lock_path)
59
+ else
60
+ fail GemfileLockNotFoundError, 'Gemfile.lock is missing. Please run `bundle install`.'
61
+ end
57
62
  end
58
63
 
59
64
  def fetch_rspec_version
@@ -65,5 +70,7 @@ module Transpec
65
70
  RSpec::Core::Version::STRING
66
71
  end
67
72
  end
73
+
74
+ class GemfileLockNotFoundError < StandardError; end
68
75
  end
69
76
  end
@@ -5,7 +5,7 @@ module Transpec
5
5
  module Version
6
6
  MAJOR = 3
7
7
  MINOR = 0
8
- PATCH = 4
8
+ PATCH = 5
9
9
 
10
10
  def self.to_s
11
11
  [MAJOR, MINOR, PATCH].join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: transpec
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.4
4
+ version: 3.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuji Nakayama