pronto-rails_schema 0.5.0 → 0.6.0

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: 73462fcba466cc178b527e5d25a9b8ba2052d4a7
4
- data.tar.gz: 2ae7ccddd5a67e73c31f6d262d4b0a6f7e3963f1
3
+ metadata.gz: 2a791d0ec72059f102b4c6f632b340cf8138bede
4
+ data.tar.gz: 152ce45fed3689b7e34ec51191d2374acba87fea
5
5
  SHA512:
6
- metadata.gz: 6f5a5975e963b28d46e89639ea48364b53a571394ee708531064926133fa85cf7851a4e78f18d6d5cb9e71beb4997edfe97292cfb80b811745a70f93ea9e1c4a
7
- data.tar.gz: 6ff1ddc66fac239e50d59fca2ffa2dac521a098b9252a6e0f293220eccc204abfbc16def65fad31e0d8d4ae77fa3f578b89adf7383de717156f5aee08851e26b
6
+ metadata.gz: 32d1ef3147db97068f6c24d093bcc5fbb6d176c5fb5fa5d521a9ae89fe13ecbffa5365d76adffe0f7ff4edcea484bf410c5d69be3f3e29342e7bae1d8a6d6beb
7
+ data.tar.gz: 145d097760d97772b819dd62358eda5623a9d56ccb1d6c0332cfc9ed9d434152b6f6201df57c59ad13b0313ded63755ccf175374856de001ad78136258ce3f4a
data/README.md CHANGED
@@ -4,3 +4,5 @@ Pronto runner for monitoring Rails schema.rb or structure.sql consistency.
4
4
  Tool prints a warning message when migration is present
5
5
  but there are no modifications in schema.rb or structure.sql.
6
6
  [What is Pronto?](https://github.com/mmozuras/pronto)
7
+
8
+ [![Gem Version](https://badge.fury.io/rb/pronto-rails_schema.svg)](https://badge.fury.io/rb/pronto-rails_schema)
@@ -2,22 +2,19 @@ require 'pronto'
2
2
 
3
3
  module Pronto
4
4
  class RailsSchema < Runner
5
- def run(patches, _)
6
- return [] unless patches
7
-
8
- migration_patches = patches
9
- .select { |patch| detect_added_migration_file(patch) }
5
+ def run
10
6
  return [] unless migration_patches.any?
11
7
 
12
8
  if schema_file_present?
13
- schema_patch = patches.find { |patch| detect_schema_file(patch.new_file_full_path) }
14
- return generate_messages_for(migration_patches, 'schema.rb') unless changes_detected?(schema_patch)
9
+ schema_patch = @patches.find { |patch| detect_schema_file(patch.new_file_full_path) }
10
+ return generate_messages_for('schema.rb') unless changes_detected?(schema_patch)
15
11
  end
16
12
 
17
13
  if structure_file_present?
18
- structure_patch = patches.find { |patch| detect_structure_file(patch.new_file_full_path) }
19
- return generate_messages_for(migration_patches, 'structure.sql') unless changes_detected?(structure_patch)
14
+ structure_patch = @patches.find { |patch| detect_structure_file(patch.new_file_full_path) }
15
+ return generate_messages_for('structure.sql') unless changes_detected?(structure_patch)
20
16
  end
17
+
21
18
  []
22
19
  end
23
20
 
@@ -31,10 +28,17 @@ module Pronto
31
28
  File.exists?('db/structure.sql')
32
29
  end
33
30
 
34
- def generate_messages_for(patches, target)
35
- patches.map do |patch|
31
+ def migration_patches
32
+ return [] unless @patches
33
+ @migration_patches ||= @patches
34
+ .select { |patch| detect_added_migration_file(patch) }
35
+ end
36
+
37
+ def generate_messages_for(target)
38
+ migration_patches.map do |patch|
36
39
  Message.new(patch.delta.new_file[:path], nil, :warning,
37
- "Migration file detected, but no changes in #{target}")
40
+ "Migration file detected, but no changes in #{target}",
41
+ nil, self.class)
38
42
  end
39
43
  end
40
44
 
@@ -1,5 +1,5 @@
1
1
  module Pronto
2
2
  module RailsSchemaVersion
3
- VERSION = "0.5.0"
3
+ VERSION = "0.6.0"
4
4
  end
5
5
  end
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ["lib"]
22
22
 
23
- spec.add_dependency 'pronto', '~> 0.5.0 '
23
+ spec.add_dependency 'pronto', '~> 0.6.0 '
24
24
  spec.add_development_dependency "bundler", "~> 1.10"
25
25
  spec.add_development_dependency "rake", "~> 10.0"
26
26
  spec.add_development_dependency "rspec", "~> 3.3"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pronto-rails_schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raimondas Valickas
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-10 00:00:00.000000000 Z
11
+ date: 2016-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pronto
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.5.0
19
+ version: 0.6.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.5.0
26
+ version: 0.6.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement