git-dirty 1.0.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 +7 -0
- data/.gitignore +11 -0
- data/.travis.yml +7 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +35 -0
- data/LICENSE.txt +21 -0
- data/README.markdown +26 -0
- data/Rakefile +6 -0
- data/git-dirty-file.gemspec +27 -0
- data/lib/git-dirty.rb +18 -0
- data/lib/git-dirty/file_task.rb +55 -0
- data/lib/git-dirty/version.rb +3 -0
- metadata +97 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c462817f2157cfcda07223673637a950b19a7d3201d07b9df1a3d880092e744f
|
4
|
+
data.tar.gz: ea211ec86791ab4a0ed831d73f2b1e331daf984d941d68f384d882f2f35ad214
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f2cd5a3f986d50e3c1bc3779b9cb9d5351ee62cb03521f782cf25220c5c6c98bfa154c307d80b26a31dc7112b0321543b123b06e25426bf0dd2c0c1418f39749
|
7
|
+
data.tar.gz: d0ff111b1931c168b24f94acab55cece327e901b48f274b206d02358d1c92cb5ee21a1aaecd0a5b2947087b93d9a76254ebe69991432a4c3299577c939a1e650
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
git-dirty (1.0.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
diff-lcs (1.3)
|
10
|
+
rake (10.5.0)
|
11
|
+
rspec (3.8.0)
|
12
|
+
rspec-core (~> 3.8.0)
|
13
|
+
rspec-expectations (~> 3.8.0)
|
14
|
+
rspec-mocks (~> 3.8.0)
|
15
|
+
rspec-core (3.8.0)
|
16
|
+
rspec-support (~> 3.8.0)
|
17
|
+
rspec-expectations (3.8.2)
|
18
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
19
|
+
rspec-support (~> 3.8.0)
|
20
|
+
rspec-mocks (3.8.0)
|
21
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
22
|
+
rspec-support (~> 3.8.0)
|
23
|
+
rspec-support (3.8.0)
|
24
|
+
|
25
|
+
PLATFORMS
|
26
|
+
ruby
|
27
|
+
|
28
|
+
DEPENDENCIES
|
29
|
+
bundler (~> 1.17)
|
30
|
+
git-dirty!
|
31
|
+
rake (~> 10.0)
|
32
|
+
rspec (~> 3.0)
|
33
|
+
|
34
|
+
BUNDLED WITH
|
35
|
+
1.17.3
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Steffen Uhlig
|
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.markdown
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# Git::DirtyFile
|
2
|
+
|
3
|
+
Rake task to record the git status in a separate file
|
4
|
+
|
5
|
+
# Usage
|
6
|
+
|
7
|
+
Add it to your Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem "git-dirty"
|
11
|
+
```
|
12
|
+
|
13
|
+
In your `Rakefile`:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
require 'git-dirty'
|
17
|
+
git_dirty_file 'tmp/git-status'
|
18
|
+
````
|
19
|
+
|
20
|
+
Now you will have a new rake target for `tmp/git-status`, which will be updated whenever the contents of that file differ from the actual status.
|
21
|
+
|
22
|
+
The status is represented by the output of `git rev-parse --short HEAD` (which provides the SHA of the current git HEAD). If the workspace is dirty (i.e. has new, changed or deleted files), an asterisk (`*`) is appended.
|
23
|
+
|
24
|
+
# License
|
25
|
+
|
26
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "git-dirty/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "git-dirty"
|
7
|
+
spec.version = GitDirty::VERSION
|
8
|
+
spec.authors = ["Steffen Uhlig"]
|
9
|
+
spec.email = ["Steffen.Uhlig@de.ibm.com"]
|
10
|
+
|
11
|
+
spec.summary = %q{Rake task to record the git status in a separate file.}
|
12
|
+
spec.description = %q{This gem provides a Rake task that records the git status in a separate file, which can then be included, e.g. as part of a file-based build process.}
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
# Specify which files should be added to the gem when it is released.
|
16
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
17
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
18
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.17"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
27
|
+
end
|
data/lib/git-dirty.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'git-dirty/file_task'
|
2
|
+
|
3
|
+
module GitDirty
|
4
|
+
#
|
5
|
+
# This is the DSL method to use in a Rakefile, e.g.
|
6
|
+
#
|
7
|
+
# <code>
|
8
|
+
# require 'git_dirty'
|
9
|
+
# git_dirty_file '/tmp/git-dirty-status'
|
10
|
+
# </code>
|
11
|
+
#
|
12
|
+
def git_dirty_file(*args, &block)
|
13
|
+
GitDirty::FileTask.define_task(*args, &block)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# Make the DSL globally available
|
18
|
+
self.extend GitDirty
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'rake/file_task'
|
2
|
+
|
3
|
+
module GitDirty
|
4
|
+
class FileTask < Rake::FileTask
|
5
|
+
include Rake::DSL
|
6
|
+
|
7
|
+
def initialize(name, *args)
|
8
|
+
super
|
9
|
+
desc "Write git status to #{name} (should be git-ignored)"
|
10
|
+
end
|
11
|
+
|
12
|
+
def needed?
|
13
|
+
(actual_state != persisted_state).tap do |needed|
|
14
|
+
if application.options.trace
|
15
|
+
if needed
|
16
|
+
application.trace "*** #{name} IS needed"
|
17
|
+
else
|
18
|
+
application.trace "*** #{name} is NOT needed"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def execute(args=nil)
|
25
|
+
if application.options.trace
|
26
|
+
application.trace "*** Writing actual state '#{actual_state}' to #{name}"
|
27
|
+
end
|
28
|
+
|
29
|
+
File.write(name, actual_state)
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def actual_state
|
35
|
+
if clean?
|
36
|
+
rev
|
37
|
+
else
|
38
|
+
"#{rev}*"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def persisted_state
|
43
|
+
return nil unless File.exist?(name)
|
44
|
+
File.read(name).chomp
|
45
|
+
end
|
46
|
+
|
47
|
+
def clean?
|
48
|
+
`git status --porcelain`.chomp.empty?
|
49
|
+
end
|
50
|
+
|
51
|
+
def rev
|
52
|
+
`git rev-parse --short HEAD`.chomp
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: git-dirty
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Steffen Uhlig
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-03-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.17'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.17'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
description: This gem provides a Rake task that records the git status in a separate
|
56
|
+
file, which can then be included, e.g. as part of a file-based build process.
|
57
|
+
email:
|
58
|
+
- Steffen.Uhlig@de.ibm.com
|
59
|
+
executables: []
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- ".travis.yml"
|
65
|
+
- Gemfile
|
66
|
+
- Gemfile.lock
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.markdown
|
69
|
+
- Rakefile
|
70
|
+
- git-dirty-file.gemspec
|
71
|
+
- lib/git-dirty.rb
|
72
|
+
- lib/git-dirty/file_task.rb
|
73
|
+
- lib/git-dirty/version.rb
|
74
|
+
homepage:
|
75
|
+
licenses:
|
76
|
+
- MIT
|
77
|
+
metadata: {}
|
78
|
+
post_install_message:
|
79
|
+
rdoc_options: []
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
requirements: []
|
93
|
+
rubygems_version: 3.0.3
|
94
|
+
signing_key:
|
95
|
+
specification_version: 4
|
96
|
+
summary: Rake task to record the git status in a separate file.
|
97
|
+
test_files: []
|