pre-commit 0.38.1 → 0.39.0
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
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5849a98ebb481bb8f21d491ce6de8f41bb27187ba650bef608e88ce4c6f6b4da
|
4
|
+
data.tar.gz: c3c4d54f01f80b104189fef18de43e2e217b7cb759e41b5ecca933f7ed4ef793
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 377c16ed45e5339853dae530f14faf2b467ca8f932e9e44bdd645b1a52491e81aa4de0476bbfd92c4143ae5007828352e986a036ce8df6a15b4a43e685397803
|
7
|
+
data.tar.gz: 2f56fcc858842ec520f04ee19f9b830eee3b9c85d39dc9276fc0f3023de1057d8d15adb1f5d29b44f7a30d126fd3208664f87aa2ec1b70161e9f5d1698d9601d
|
@@ -3,13 +3,9 @@ require 'pre-commit/checks/plugin'
|
|
3
3
|
module PreCommit
|
4
4
|
module Checks
|
5
5
|
class Migration < Plugin
|
6
|
-
VERSION_PATTERN = /(\d{
|
6
|
+
VERSION_PATTERN = /(\d{4}_?\d{2}_?\d{2}_?\d{6})/
|
7
7
|
|
8
|
-
|
9
|
-
def to_s
|
10
|
-
"<#{self.class.name} file=\"#{file}\" version=\"#{version}\">"
|
11
|
-
end
|
12
|
-
end
|
8
|
+
VersionedFile = Struct.new(:file, :version)
|
13
9
|
|
14
10
|
def self.aliases
|
15
11
|
[:migrations]
|
@@ -25,7 +21,9 @@ module PreCommit
|
|
25
21
|
"You're trying to change the schema without adding a migration file"
|
26
22
|
elsif migration_files.any? && schema_files.any?
|
27
23
|
migration_versions = migration_files.map(&:version)
|
28
|
-
|
24
|
+
schema_versions = schema_files.map(&:version)
|
25
|
+
missing_versions = migration_versions - schema_versions
|
26
|
+
|
29
27
|
if missing_versions.any?
|
30
28
|
"You did not add the schema versions for "\
|
31
29
|
"#{migration_versions.join(', ')} to #{schema_files.map(&:file).join(' or ')}"
|
@@ -52,7 +50,8 @@ module PreCommit
|
|
52
50
|
|
53
51
|
files.each_with_object([]) do |f, result|
|
54
52
|
File.read(f).scan(VERSION_PATTERN) do |i|
|
55
|
-
|
53
|
+
version = i.first.gsub(/_/, "")
|
54
|
+
result << VersionedFile.new(f, version)
|
56
55
|
end
|
57
56
|
end
|
58
57
|
end
|
data/lib/pre-commit/checks/js.rb
CHANGED
@@ -6,7 +6,7 @@ module PreCommit
|
|
6
6
|
def call(staged_files)
|
7
7
|
require 'execjs'
|
8
8
|
rescue RuntimeError, LoadError => e
|
9
|
-
$stderr.puts "Could not load execjs: #{e}"
|
9
|
+
$stderr.puts "Could not load execjs: #{e}. You need to manually install execjs to use JavaScript plugins for security reasons."
|
10
10
|
else
|
11
11
|
staged_files = files_filter(staged_files)
|
12
12
|
return if staged_files.empty?
|
@@ -11,13 +11,13 @@ describe PreCommit::Checks::<%= name.capitalize %> do
|
|
11
11
|
let(:check){ PreCommit::Checks::<%= name.capitalize %>.new(nil, nil, []) }
|
12
12
|
|
13
13
|
it "does nothing" do
|
14
|
-
check.send(:run_check, "rake").
|
14
|
+
check.send(:run_check, "rake").must_be_nil
|
15
15
|
end
|
16
16
|
|
17
17
|
it "checks files" do
|
18
18
|
Dir.chdir(test_files) do
|
19
19
|
# TODO: create example files in test/files
|
20
|
-
check.send(:run_check, ".keep").
|
20
|
+
check.send(:run_check, ".keep").must_be_nil
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pre-commit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.39.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shajith Chacko, Josh Lubaway
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pluginator
|
@@ -44,28 +44,28 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '5.0'
|
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: '
|
54
|
+
version: '5.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: minitest-reporters
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
61
|
+
version: '1.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
68
|
+
version: '1.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|