spoom 1.1.14 → 1.1.15

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: 7a84bd540e0965d15ff7e0b44349f603a73b3975c551420cb53e1c233878eec5
4
- data.tar.gz: fa06bea2051f57cd64b5ced219d0c6f2c4903a9d17b5ef5642e149d08350f5e2
3
+ metadata.gz: 2a61ae83fa56b7a78027c8954c5680d4784c5a3f8b2d717ed3ba49b36409ede2
4
+ data.tar.gz: b339a398e57f92f71b797dd8d427e18749d1afd6246be42fe549baf96563706e
5
5
  SHA512:
6
- metadata.gz: 259eaf90edc9cb6e7c5e40aee135112944258a813b88690098cf1e547f4304ef259b341e07159c7ce1bfe8f194dffe885f3db5ed4e74c39eec13351e81f0d40d
7
- data.tar.gz: 3477a2b2647605c3884c632c4534106fe1384e33ae321dee20e61ce48a430e83ecb734ad8f9d8e7e2fb7abf39726913789e95ed0529ad9eda48b6099bb89892b
6
+ metadata.gz: 981c7b625e31b732ce731c600fd1291afb9635818918d77424750ba152633f06e8f4515037c5044badcc951ded1dd9fd768ae135ff2305359005a2cb7ad47a38
7
+ data.tar.gz: 123baadb32b3341271b323eab29a1ddb4561c74b9afbe6cfa71af61ff1547783a24a1d439406f482b3c40920b960e4b04fc19ca7c0423c18407af00bc35fa692
data/lib/spoom/context.rb CHANGED
@@ -46,6 +46,12 @@ module Spoom
46
46
 
47
47
  # File System
48
48
 
49
+ # Does the context directory at `absolute_path` exist and is a directory?
50
+ sig { returns(T::Boolean) }
51
+ def exist?
52
+ File.directory?(@absolute_path)
53
+ end
54
+
49
55
  # Create the context directory at `absolute_path`
50
56
  sig { void }
51
57
  def mkdir!
@@ -190,6 +196,12 @@ module Spoom
190
196
  Spoom::Git.current_branch(path: @absolute_path)
191
197
  end
192
198
 
199
+ # Get the last commit in the currently checked out branch
200
+ sig { params(short_sha: T::Boolean).returns(T.nilable(Git::Commit)) }
201
+ def git_last_commit(short_sha: true)
202
+ Spoom::Git.last_commit(path: @absolute_path, short_sha: short_sha)
203
+ end
204
+
193
205
  # Sorbet
194
206
 
195
207
  # Run `bundle exec srb` in this context directory
data/lib/spoom/git.rb CHANGED
@@ -75,9 +75,9 @@ module Spoom
75
75
  # Utils
76
76
 
77
77
  # Get the last commit in the currently checked out branch
78
- sig { params(path: String).returns(T.nilable(Commit)) }
79
- def last_commit(path: ".")
80
- result = log("HEAD --format='%h %at' -1", path: path)
78
+ sig { params(path: String, short_sha: T::Boolean).returns(T.nilable(Commit)) }
79
+ def last_commit(path: ".", short_sha: true)
80
+ result = log("HEAD --format='%#{short_sha ? "h" : "H"} %at' -1", path: path)
81
81
  return nil unless result.status
82
82
 
83
83
  out = result.out.strip
data/lib/spoom/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Spoom
5
- VERSION = "1.1.14"
5
+ VERSION = "1.1.15"
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spoom
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.14
4
+ version: 1.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandre Terrasa
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-12 00:00:00.000000000 Z
11
+ date: 2022-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler