autowow 0.16.0 → 0.16.1
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 +4 -4
- data/.gitignore +1 -0
- data/README.md +1 -1
- data/lib/autowow/commands/rbenv.rb +4 -0
- data/lib/autowow/commands/vcs.rb +12 -5
- data/lib/autowow/features/rbenv.rb +8 -0
- data/lib/autowow/features/vcs.rb +18 -3
- data/lib/autowow/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f55bfd872a119778b302703a39cefb379d5338b3fe7e7bdab919d70d73fe350
|
4
|
+
data.tar.gz: a1194055e1a2ffa4e0c813a98e7e71e002a971a0cbeaa0615862bd5960f131f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b912bfef14595af0c6900b51d6e36471b7cd1224dc0af0d6df8501610ef1cefe6019bde1082156bf4f26200c164e074c4b2bb1ef62abb0a8e85f3f7cee5fe1b
|
7
|
+
data.tar.gz: bf0a0804a2223c4472d8d4276f3b0af60a9de92494903c7a2671db1aba886d01b03a4c9ce364dce429ee98e515fb7b67daafcd174cef8d926adfd9b2c1ac7535
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
#### Set of commands to [auto]mate [w]ay [o]f [w]orking
|
4
4
|
|
5
5
|
<!--- Version informartion -->
|
6
|
-
*You are viewing the README of version [v0.16.
|
6
|
+
*You are viewing the README of version [v0.16.1](https://github.com/thisismydesign/autowow/releases/tag/v0.16.1). You can find other releases [here](https://github.com/thisismydesign/autowow/releases).*
|
7
7
|
<!--- Version informartion end -->
|
8
8
|
|
9
9
|
| Branch | Status |
|
data/lib/autowow/commands/vcs.rb
CHANGED
@@ -14,11 +14,11 @@ module Autowow
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def changes_not_on_remote(branch)
|
17
|
-
cmd + terminal_options + ["log",
|
17
|
+
cmd + terminal_options + ["log", "--not", "--remotes", branch]
|
18
18
|
end
|
19
19
|
|
20
20
|
def branch_list
|
21
|
-
cmd + ["for-each-ref", "--format
|
21
|
+
cmd + ["for-each-ref", "--format='%(refname:short)'", "refs/heads/"]
|
22
22
|
end
|
23
23
|
|
24
24
|
def push(branch = nil, remote = nil)
|
@@ -93,9 +93,16 @@ module Autowow
|
|
93
93
|
cmd + ["reset", "--hard", branch]
|
94
94
|
end
|
95
95
|
|
96
|
-
|
97
|
-
|
98
|
-
|
96
|
+
def upstream_tracking(branch)
|
97
|
+
cmd + ["for-each-ref", "--format=%'(upstream:short)'", "refs/heads/#{branch}"]
|
98
|
+
end
|
99
|
+
|
100
|
+
def current_ref
|
101
|
+
cmd + ["symbolic-ref", "--quiet", "HEAD"]
|
102
|
+
end
|
103
|
+
|
104
|
+
def show_ref(branch)
|
105
|
+
cmd + ["show-ref", branch]
|
99
106
|
end
|
100
107
|
|
101
108
|
include ReflectionUtils::CreateModuleFunctions
|
data/lib/autowow/features/vcs.rb
CHANGED
@@ -46,6 +46,10 @@ module Autowow
|
|
46
46
|
greet(latest_project_info)
|
47
47
|
end
|
48
48
|
|
49
|
+
def is_tracked?(branch)
|
50
|
+
!quiet.run!(Vcs.upstream_tracking(branch).join(" ")).out.strip.empty?
|
51
|
+
end
|
52
|
+
|
49
53
|
def self.force_pull
|
50
54
|
pretty_with_output.run(git_status)
|
51
55
|
branch = working_branch
|
@@ -199,7 +203,11 @@ module Autowow
|
|
199
203
|
end
|
200
204
|
|
201
205
|
def branch_pushed(branch)
|
202
|
-
|
206
|
+
is_tracked?(branch) && commits_pushed?(branch)
|
207
|
+
end
|
208
|
+
|
209
|
+
def commits_pushed?(branch)
|
210
|
+
quiet.run(changes_not_on_remote(branch)).out.strip.empty?
|
203
211
|
end
|
204
212
|
|
205
213
|
def greet(latest_project_info = nil)
|
@@ -211,6 +219,9 @@ module Autowow
|
|
211
219
|
logger.info(latest_project_info)
|
212
220
|
check_projects_older_than(1, :months)
|
213
221
|
end
|
222
|
+
|
223
|
+
return unless Rbenv.exists?
|
224
|
+
|
214
225
|
obsolete_rubies = Rbenv.obsolete_versions
|
215
226
|
if obsolete_rubies.any?
|
216
227
|
logger.info("\nThe following Ruby versions are not used by any projects, maybe consider removing them?")
|
@@ -223,7 +234,7 @@ module Autowow
|
|
223
234
|
def check_projects_older_than(quantity, unit)
|
224
235
|
old_projects = Fs.older_than(git_projects, quantity, unit)
|
225
236
|
deprecated_projects = old_projects.reject do |project|
|
226
|
-
Dir.chdir(project) {
|
237
|
+
Dir.chdir(project) { any_branch_not_pushed? || uncommitted_changes?(quiet.run(git_status).out) }
|
227
238
|
end
|
228
239
|
|
229
240
|
logger.info("The following projects have not been touched for more than #{quantity} #{unit} and all changes have been pushed, maybe consider removing them?") unless deprecated_projects.empty?
|
@@ -233,6 +244,10 @@ module Autowow
|
|
233
244
|
end
|
234
245
|
end
|
235
246
|
|
247
|
+
def any_branch_not_pushed?
|
248
|
+
branches.reject { |branch| branch_pushed(branch) }.any?
|
249
|
+
end
|
250
|
+
|
236
251
|
def get_latest_repo_info
|
237
252
|
latest = latest_repo
|
238
253
|
time_diff = TimeDifference.between(File.mtime(latest), Time.now).humanize_higher_than(:days).downcase
|
@@ -245,7 +260,7 @@ module Autowow
|
|
245
260
|
end
|
246
261
|
|
247
262
|
def branches
|
248
|
-
quiet.run(branch_list).out.clean_lines
|
263
|
+
quiet.run(branch_list.join(" ")).out.clean_lines
|
249
264
|
end
|
250
265
|
|
251
266
|
def uncommitted_changes?(status)
|
data/lib/autowow/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autowow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.16.
|
4
|
+
version: 0.16.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thisismydesign
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: easy_logging
|