gig 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +18 -0
  3. data/gig.gemspec +28 -0
  4. data/lib/gig/version.rb +1 -1
  5. data/lib/gig.rb +20 -17
  6. metadata +9 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5824cec3310a22127e9e6fcdd09bd8ff7dd630a0fe962cb7d34a33f7b9a14f82
4
- data.tar.gz: 93d618046e0d53530239adae5a45be06787e7a21877eb8ef710be511c83ddf63
3
+ metadata.gz: f943dab3aba7fb52891beaaeb7408e835a60fc190f964f7afa6bab43145d7e81
4
+ data.tar.gz: 8b1139ef896f849a8013602ceeb16d5d370daa56ad0d0fa2e3f3ded5c7923dfe
5
5
  SHA512:
6
- metadata.gz: ce2d191605eeb94d1477f4e3ba74a84ddd96de98f3a56308b14e9563275ba79b80b86381854cf8172dbe437a462a7f0f5873d0a15b313dadccfab8233bbf7808
7
- data.tar.gz: 31924bae77ce18d61e7dd9d023080cb7e69b1def46fa665bbe05c2e5d7e19e63364f8de60aafe90f1e8aa7bf8e07b64c2cd47b0baa5f802e56fce7cd48eca885
6
+ metadata.gz: 3e3f4a87eee4b3bcfe6cbd517eef485efe2ebb61f902790b81455dfbba57b4d4652803ff533d10fdf816613a8221806b6310c169f554218a4a5b6a029cc4a73e
7
+ data.tar.gz: 29e571ba1108209a2fc4f1d4bafc8ff40f28b03f2f1f55c4dbde1e151fa3bdd930cb202abbc0fa81b19f2fe1d277955c8daf80331c23ff2674c7c1b67fd57de9
data/README.md CHANGED
@@ -1,5 +1,23 @@
1
1
  `gig` contains a rake task of the same name to check for consistency of files between git, gemspec, and the filesystem before building.
2
2
 
3
+ ## Usage
4
+
5
+ In your rakefile, `require 'gig'` and invoke [Gig.make_task](https://rubydoc.info/gems/gig/Gig), passing `gemspec_filename` and `ignore_files`. Globs are useful for `ignore_files`, and `File::FNM_DOTMATCH` should be used when globs may contain dotfiles. For example:
6
+
7
+ ```ruby
8
+ require 'gig'
9
+
10
+ ignore_files = %w(
11
+ .github/**/*
12
+ .gitignore
13
+ .gitmodules
14
+ Gemfile
15
+ Rakefile.rb
16
+ test/**/*
17
+ ).map { |glob| Dir.glob(glob, File::FNM_DOTMATCH) }.inject([], &:|)
18
+ Gig.make_task(gemspec_filename: 'my_gem.gemspec', ignore_files: ignore_files)
19
+ ```
20
+
3
21
  ## License
4
22
 
5
23
  The gem is available under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/gig.gemspec ADDED
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path("../lib", __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require "gig/version"
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "gig"
9
+ spec.version = Gig::VERSION
10
+ spec.authors = ["Ethan"]
11
+ spec.email = ["ethan@unth.net"]
12
+
13
+ spec.summary = "gig"
14
+ spec.description = "a rake task to check a gem's consistency with git and the filesystem before building"
15
+ spec.homepage = "https://github.com/notEthan/gig"
16
+ spec.license = "MIT"
17
+
18
+ spec.files = [
19
+ 'LICENSE.txt',
20
+ 'README.md',
21
+ 'gig.gemspec',
22
+ *Dir['lib/**/*'],
23
+ ].reject { |f| File.lstat(f).ftype == 'directory' }
24
+
25
+ spec.require_paths = ["lib"]
26
+
27
+ spec.add_dependency 'rake'
28
+ end
data/lib/gig/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gig
4
- VERSION = "0.0.5"
4
+ VERSION = "0.0.6"
5
5
  end
data/lib/gig.rb CHANGED
@@ -6,7 +6,7 @@ module Gig
6
6
  class << self
7
7
  # @param name [#to_s] rake task name
8
8
  # @param gemspec_filename
9
- # @param ignore_files [Enumerable]
9
+ # @param ignore_files [Enumerable<String>]
10
10
  def make_task(name: 'gig', gemspec_filename: , ignore_files: )
11
11
  Rake.application.last_description = "check consistency of gemspec files with git and filesystem before building the gem"
12
12
  Rake::Task.define_task(name) do
@@ -33,33 +33,36 @@ module Gig
33
33
  in_spec = spec.files.include?(file) || spec.test_files.include?(file)
34
34
  in_ignore = ignore_files.include?(file)
35
35
 
36
- if in_git
37
- if in_fs
38
- if in_spec
39
- if in_ignore
40
- file_error.("file is ignored, but present in gemspec: #{file}")
41
- end
36
+ if in_spec
37
+ if in_ignore
38
+ file_error.("file in gig ignore_files, but present in gemspec: #{file}")
39
+ end
40
+
41
+ if in_git
42
+ if in_fs
42
43
  git_status = `git status --porcelain #{Shellwords.escape(file)}`
43
44
  if git_status.empty?
44
45
  # pass
45
46
  else
46
- file_error.("file modified from git: #{file}")
47
+ file_error.("file in gemspec, but modified from git: #{file}")
47
48
  end
48
49
  else
49
- if in_ignore
50
- # pass
51
- else
52
- file_error.("git file not in gemspec: #{file}")
53
- end
50
+ file_error.("file in gemspec, but not in filesystem: #{file}")
54
51
  end
55
52
  else
56
- file_error.("git file not in fs: #{file}")
53
+ if in_fs
54
+ file_error.("file in gemspec and filesystem, but not in git: #{file}")
55
+ else
56
+ file_error.("file in gemspec, but not in git and not in filesystem: #{file}")
57
+ end
57
58
  end
59
+ elsif in_ignore
60
+ # in ignore_files, and not in gemspec: pass (regardless of git or fs)
58
61
  else
59
- if in_spec
60
- file_error.("file in gemspec but not in git: #{file}")
62
+ if in_git
63
+ file_error.("file in git, but in neither gemspec nor gig ignore_files: #{file}")
61
64
  else
62
- # in fs but ignored by git and spec: pass
65
+ # not in gemspec, not in ignore_files, not in git: pass - it's in the filesystem but can be ignored
63
66
  end
64
67
  end
65
68
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gig
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-04 00:00:00.000000000 Z
11
+ date: 2023-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -24,7 +24,8 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- description: ''
27
+ description: a rake task to check a gem's consistency with git and the filesystem
28
+ before building
28
29
  email:
29
30
  - ethan@unth.net
30
31
  executables: []
@@ -33,13 +34,14 @@ extra_rdoc_files: []
33
34
  files:
34
35
  - LICENSE.txt
35
36
  - README.md
37
+ - gig.gemspec
36
38
  - lib/gig.rb
37
39
  - lib/gig/version.rb
38
40
  homepage: https://github.com/notEthan/gig
39
41
  licenses:
40
42
  - MIT
41
43
  metadata: {}
42
- post_install_message:
44
+ post_install_message:
43
45
  rdoc_options: []
44
46
  require_paths:
45
47
  - lib
@@ -54,8 +56,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
54
56
  - !ruby/object:Gem::Version
55
57
  version: '0'
56
58
  requirements: []
57
- rubygems_version: 3.1.2
58
- signing_key:
59
+ rubygems_version: 3.1.6
60
+ signing_key:
59
61
  specification_version: 4
60
62
  summary: gig
61
63
  test_files: []