learn-test 3.2.1.pre.1 → 3.2.1.pre.6

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: 84391b9e1408bf20251f8e9b7759c7aa56f5d43e275654b937d25965a43786fd
4
- data.tar.gz: c860c5e7b1d90076156931f55a87af951dbfdcfdd37dfd6e862994af8db80d77
3
+ metadata.gz: 8794c9f5f79754792e07d3d25d4394cb893f1156c2f90ddf49fa791e3295ed5b
4
+ data.tar.gz: 106bb411827dd6cc527f5f2703f1720a7cb5abd4f950fae6f9429da46beef4c9
5
5
  SHA512:
6
- metadata.gz: 815c907df7bc15540d98f0c11a8287d3f730f7ec3e80d3a020e038bacbae4a0a4b424d7354df0ff7183534d6f3a7ce6210905a055a657b8afce16850300675f2
7
- data.tar.gz: b8d239d2fed6162338e64b6c7ee44a009e409a4396929630a807cb56be330a8d1310dbb486d4d5922036bd50b2f19370199a78626d892952a6eafbdd7cc36fc2
6
+ metadata.gz: b0499f0e0986bc8e1a2e8425bfdf364c701540b8f7e799055b7929868fecec7a5c4812a0df10deaf310f5efff8d22d7caa5e3b046f96b719757d32c81f2269e8
7
+ data.tar.gz: 51369aeb558ad730d61618dbcf426c99250d4368c7b3baec7e0d858e39a29cf18d378cabad353bb2ea13164a3adaa60731ca5ec8de1d3ca6b22cfdacb4eca005
@@ -15,15 +15,12 @@
15
15
  # Please see http://www.gnu.org/licenses/gpl-2.0.txt
16
16
  #
17
17
 
18
- USAGE='[ info | save <message> [ --editor | --untracked | --no-gpg-sign ] | log [ --pretty ] | delete ] [ [--] <file>... ]'
18
+ USAGE='[ save <message> [ --editor | --untracked | --no-gpg-sign ] | delete ] [ [--] <file>... ]'
19
19
  LONG_USAGE="Manage Work In Progress branches
20
20
 
21
21
  Commands:
22
22
  git wip - create a new WIP commit
23
23
  git wip save <message> - create a new WIP commit with custom message
24
- git wip info [<branch>] - brief WIP info
25
- git wip log [<branch>] - show changes on the WIP branch
26
- git wip delete [<branch>] - delete a WIP branch
27
24
 
28
25
  Options for save:
29
26
  -e --editor - be less verbose, assume called from an editor
@@ -31,22 +28,19 @@ Options for save:
31
28
  -i --ignored - capture also ignored files
32
29
  --no-gpg-sign - do not sign commit; that is, countermand
33
30
  'commit.gpgSign = true'
34
-
35
- Options for log:
36
- -p --pretty - show a pretty graph
37
- -r --reflog - show changes in reflog
38
- -s --stat - show diffstat
39
31
  "
40
32
 
41
- SUBDIRECTORY_OK=Yes
42
- OPTIONS_SPEC=''
43
-
44
33
  source "$(git --exec-path)/git-sh-setup"
45
34
 
46
35
  require_work_tree
47
36
 
48
- TMP="$GIT_DIR/.git-wip.$$"
49
- trap 'rm -f "$TMP-*"' 0
37
+ TMP=$(mktemp -d -t .git-wip)
38
+
39
+ cleanup () {
40
+ rm -f "$TMP-*"
41
+ }
42
+
43
+ trap cleanup 0
50
44
 
51
45
  WIP_INDEX="$TMP-INDEX"
52
46
 
@@ -68,10 +62,6 @@ report_soft_error () {
68
62
  die "$@"
69
63
  }
70
64
 
71
- cleanup () {
72
- rm -f "$TMP-*"
73
- }
74
-
75
65
  get_work_branch () {
76
66
  ref=$(git symbolic-ref -q HEAD) \
77
67
  || report_soft_error "git-wip requires a branch"
@@ -85,10 +75,6 @@ get_work_branch () {
85
75
  echo $branch
86
76
  }
87
77
 
88
- get_wip_branch () {
89
- return 0
90
- }
91
-
92
78
  check_files () {
93
79
  local -a files="$@"
94
80
 
@@ -223,86 +209,6 @@ do_save () {
223
209
  dbg "SUCCESS"
224
210
  }
225
211
 
226
- do_info () {
227
- local branch=$1
228
-
229
- die "info not implemented"
230
- }
231
-
232
- do_log () {
233
- local work_branch=$1
234
- [ -z $branch ] && work_branch=$(get_work_branch)
235
- local wip_branch="$WIP_PREFIX$work_branch"
236
-
237
- local log_cmd="log"
238
- local graph=""
239
- local pretty=""
240
- local stat=""
241
- while [ -n "$1" ]
242
- do
243
- case "$1" in
244
- -p|--pretty)
245
- graph="--graph"
246
- pretty="--pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative"
247
- ;;
248
- -s|--stat)
249
- stat="--stat"
250
- ;;
251
- -r|--reflog)
252
- log_cmd="reflog"
253
- ;;
254
- *)
255
- break
256
- ;;
257
- esac
258
- shift
259
- done
260
-
261
- if [ $log_cmd = reflog ]
262
- then
263
- echo git reflog $stat $pretty $wip_branch | sh
264
- return $?
265
- fi
266
-
267
- if ! work_last=$(git rev-parse --verify $work_branch)
268
- then
269
- die "'$work_branch' branch has no commits."
270
- fi
271
-
272
- dbg work_last=$work_last
273
-
274
- if ! wip_last=$(git rev-parse --quiet --verify $wip_branch)
275
- then
276
- die "'$work_branch' branch has no commits."
277
- fi
278
-
279
- dbg wip_last=$wip_last
280
-
281
- local base=$(git merge-base $wip_last $work_last)
282
-
283
- dbg base=$base
284
-
285
- echo git log $graph $stat $pretty $@ $wip_last $work_last "^$base~1" | sh
286
- }
287
-
288
- do_delete () {
289
- local branch=$1
290
-
291
- die "delete not implemented"
292
- }
293
-
294
- do_help () {
295
- local rc=$1
296
-
297
- cat <<END
298
- Usage: git wip $USAGE
299
-
300
- $LONG_USAGE
301
- END
302
- exit $rc
303
- }
304
-
305
-
306
212
  if test $# -eq 0
307
213
  then
308
214
  dbg "no arguments"
@@ -323,13 +229,6 @@ save)
323
229
  shift
324
230
  fi
325
231
  ;;
326
- info|log|delete)
327
- WIP_COMMAND=$1
328
- shift
329
- ;;
330
- help)
331
- do_help 0
332
- ;;
333
232
  --*)
334
233
  ;;
335
234
  *)
@@ -341,15 +240,6 @@ case $WIP_COMMAND in
341
240
  save)
342
241
  do_save "$WIP_MESSAGE" $@
343
242
  ;;
344
- info)
345
- do_info $@
346
- ;;
347
- log)
348
- do_log $@
349
- ;;
350
- delete)
351
- do_delete $@
352
- ;;
353
243
  *)
354
244
  usage
355
245
  exit 1
@@ -9,13 +9,25 @@ module LearnTest
9
9
  git = Git.open('./', log: log)
10
10
  working_branch = git.current_branch
11
11
 
12
- `learn-test-wip save "Automatic test submission" -u &> /dev/null`
13
-
14
- return false unless $?.success? # rubocop:disable Style/SpecialGlobalVars
15
-
16
- git.push('origin', "wip/#{working_branch}:refs/heads/wip")
17
- git.config['remote.origin.url'].gsub('.git', '/tree/wip')
18
- rescue StandardError
12
+ Open3.popen3('learn-test-wip save "Automatic test submission" --editor') do |_stdin, stdout, stderr, wait_thr|
13
+ while out = stdout.gets do
14
+ puts out
15
+ end
16
+
17
+ while err = stderr.gets do
18
+ puts err
19
+ end
20
+
21
+ if wait_thr.value.exitstatus.zero?
22
+ git.push('origin', "wip/#{working_branch}:refs/heads/wip")
23
+ git.config['remote.origin.url'].gsub('.git', '/tree/wip')
24
+ else
25
+ puts 'There was an error running learn-test-wip'
26
+ false
27
+ end
28
+ end
29
+ rescue StandardError => e
30
+ puts e
19
31
  false
20
32
  end
21
33
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LearnTest
4
- VERSION = '3.2.1.pre.1'
4
+ VERSION = '3.2.1.pre.6'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: learn-test
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.1.pre.1
4
+ version: 3.2.1.pre.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Flatiron School
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-21 00:00:00.000000000 Z
11
+ date: 2020-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake