gig 0.0.4

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.
Files changed (6) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/README.md +5 -0
  4. data/lib/gig/version.rb +5 -0
  5. data/lib/gig.rb +71 -0
  6. metadata +61 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 32f93b55797c23f2060a6a00602e4097d19356f80efe0f24daee2fa71c287900
4
+ data.tar.gz: cbdeab6b788fbe1c54c0a18b341b667f78fb606d4b607f4564c5ae309f4d99ea
5
+ SHA512:
6
+ metadata.gz: 026147464ac6706f93adb5ad6e13395e5a754911575493016caaf2f3761b7f207463794398290aff760af4f696d2a13237262fecc64d080bcbf41033093f02fa
7
+ data.tar.gz: ba5e22da9c9bb8b6f59c8f6247991ea9465abdf21a3e4d5edbbad4964f0fd6ff0e9ba2bbc2bfc1321cd81887c54ec4886fb75e61b1476c4ea47a9106d9eca06b
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Ethan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,5 @@
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
+
3
+ ## License
4
+
5
+ The gem is available under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gig
4
+ VERSION = "0.0.4"
5
+ end
data/lib/gig.rb ADDED
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'gig/version'
4
+
5
+ module Gig
6
+ class << self
7
+ # @param name [#to_s] rake task name
8
+ # @param gemspec_filename
9
+ # @param ignore_files [Enumerable]
10
+ def make_task(name: 'gig', gemspec_filename: , ignore_files: )
11
+ Rake::Task.define_task(name) do
12
+ require 'shellwords'
13
+ require 'set'
14
+
15
+ git_files = `git ls-files -z --recurse-submodules`.split("\x0")
16
+
17
+ fs_files = Dir.glob('**/*', File::FNM_DOTMATCH).reject { |f| File.lstat(f).ftype == 'directory' }
18
+
19
+ spec = Gem::Specification.load(gemspec_filename) || abort("gemspec did not load: #{gemspec_filename}")
20
+
21
+ files = Set.new + git_files + fs_files + spec.files + spec.test_files
22
+
23
+ file_errors = []
24
+ file_error = -> (msg) {
25
+ file_errors << msg
26
+ puts msg
27
+ }
28
+
29
+ files.each do |file|
30
+ in_git = git_files.include?(file)
31
+ in_fs = fs_files.include?(file)
32
+ in_spec = spec.files.include?(file) || spec.test_files.include?(file)
33
+
34
+ if in_git
35
+ if in_fs
36
+ if in_spec
37
+ git_status = `git status --porcelain #{Shellwords.escape(file)}`
38
+ if git_status.empty?
39
+ # pass
40
+ else
41
+ file_error.("file modified from git: #{file}")
42
+ end
43
+ else
44
+ if ignore_files.include?(file)
45
+ # pass
46
+ else
47
+ file_error.("git file not in gemspec: #{file}")
48
+ end
49
+ end
50
+ else
51
+ file_error.("git file not in fs: #{file}")
52
+ end
53
+ else
54
+ if in_spec
55
+ file_error.("file in gemspec but not in git: #{file}")
56
+ else
57
+ # in fs but ignored by git and spec: pass
58
+ end
59
+ end
60
+ end
61
+
62
+ unless file_errors.empty?
63
+ abort "aborting gem build due to file errors"
64
+ end
65
+
66
+ require 'rubygems/package'
67
+ Gem::Package.build(spec)
68
+ end
69
+ end
70
+ end
71
+ end
metadata ADDED
@@ -0,0 +1,61 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gig
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
5
+ platform: ruby
6
+ authors:
7
+ - Ethan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-02-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: ''
28
+ email:
29
+ - ethan@unth.net
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - LICENSE.txt
35
+ - README.md
36
+ - lib/gig.rb
37
+ - lib/gig/version.rb
38
+ homepage: https://github.com/notEthan/gig
39
+ licenses:
40
+ - MIT
41
+ metadata: {}
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ requirements: []
57
+ rubygems_version: 3.1.2
58
+ signing_key:
59
+ specification_version: 4
60
+ summary: gig
61
+ test_files: []