learn-test 3.2.4 → 3.3.0.pre.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.
@@ -1,6 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'aruba/rspec'
4
+ require 'digest'
5
+ require 'simplecov'
6
+
7
+ SimpleCov.start
8
+
3
9
  require_relative '../lib/learn_test'
10
+
4
11
  RSpec.configure do |config|
5
12
  config.expect_with :rspec do |expectations|
6
13
  expectations.include_chain_clauses_in_custom_matcher_descriptions = true
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.4
4
+ version: 3.3.0.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Flatiron School
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-06 00:00:00.000000000 Z
11
+ date: 2020-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -136,24 +136,37 @@ dependencies:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: 0.8.1
139
- description:
139
+ - !ruby/object:Gem::Dependency
140
+ name: zeitwerk
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 2.4.0
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 2.4.0
153
+ description:
140
154
  email:
141
155
  - learn@flatironschool.com
142
156
  executables:
143
157
  - learn-test
144
- - learn-test-wip
145
158
  extensions: []
146
159
  extra_rdoc_files: []
147
160
  files:
148
161
  - ".circleci/config.yml"
149
162
  - ".gitignore"
150
163
  - ".rspec"
164
+ - ".rubocop.yml"
151
165
  - Gemfile
152
166
  - LICENSE.txt
153
167
  - README.md
154
168
  - Rakefile
155
169
  - bin/learn-test
156
- - bin/learn-test-wip
157
170
  - learn-test.gemspec
158
171
  - lib/learn_test.rb
159
172
  - lib/learn_test/client.rb
@@ -168,7 +181,10 @@ files:
168
181
  - lib/learn_test/dependencies/selenium_server.rb
169
182
  - lib/learn_test/dependency.rb
170
183
  - lib/learn_test/file_finder.rb
171
- - lib/learn_test/git_wip.rb
184
+ - lib/learn_test/git.rb
185
+ - lib/learn_test/git/wip/base.rb
186
+ - lib/learn_test/git/wip/branch.rb
187
+ - lib/learn_test/git/wip/error.rb
172
188
  - lib/learn_test/github_interactor.rb
173
189
  - lib/learn_test/js_strategy.rb
174
190
  - lib/learn_test/learn_oauth_token_parser.rb
@@ -197,10 +213,14 @@ files:
197
213
  - node_modules/karma-json-reporter/package.json
198
214
  - spec/features/rspec_unit_spec.rb
199
215
  - spec/fixtures/.netrc
216
+ - spec/fixtures/rspec-unit-spec/.results.json
200
217
  - spec/fixtures/rspec-unit-spec/.rspec
201
218
  - spec/fixtures/rspec-unit-spec/lib/dog.rb
202
219
  - spec/fixtures/rspec-unit-spec/spec/dog_spec.rb
203
220
  - spec/fixtures/rspec-unit-spec/spec/spec_helper.rb
221
+ - spec/learn_test/git/wip/base_spec.rb
222
+ - spec/learn_test/git/wip/branch_spec.rb
223
+ - spec/learn_test/git/wip/error_spec.rb
204
224
  - spec/learn_test/git_spec.rb
205
225
  - spec/learn_test/reporter_spec.rb
206
226
  - spec/learn_test/username_parser_spec.rb
@@ -212,7 +232,7 @@ homepage: https://github.com/learn-co/learn-test
212
232
  licenses:
213
233
  - MIT
214
234
  metadata: {}
215
- post_install_message:
235
+ post_install_message:
216
236
  rdoc_options: []
217
237
  require_paths:
218
238
  - lib
@@ -224,22 +244,26 @@ required_ruby_version: !ruby/object:Gem::Requirement
224
244
  version: 2.5.0
225
245
  required_rubygems_version: !ruby/object:Gem::Requirement
226
246
  requirements:
227
- - - ">="
247
+ - - ">"
228
248
  - !ruby/object:Gem::Version
229
- version: '0'
249
+ version: 1.3.1
230
250
  requirements: []
231
- rubygems_version: 3.0.6
232
- signing_key:
251
+ rubygems_version: 3.1.2
252
+ signing_key:
233
253
  specification_version: 4
234
254
  summary: Runs RSpec, Karma, Mocha, and Python Pytest Test builds and pushes JSON output
235
255
  to Learn.
236
256
  test_files:
237
257
  - spec/features/rspec_unit_spec.rb
238
258
  - spec/fixtures/.netrc
259
+ - spec/fixtures/rspec-unit-spec/.results.json
239
260
  - spec/fixtures/rspec-unit-spec/.rspec
240
261
  - spec/fixtures/rspec-unit-spec/lib/dog.rb
241
262
  - spec/fixtures/rspec-unit-spec/spec/dog_spec.rb
242
263
  - spec/fixtures/rspec-unit-spec/spec/spec_helper.rb
264
+ - spec/learn_test/git/wip/base_spec.rb
265
+ - spec/learn_test/git/wip/branch_spec.rb
266
+ - spec/learn_test/git/wip/error_spec.rb
243
267
  - spec/learn_test/git_spec.rb
244
268
  - spec/learn_test/reporter_spec.rb
245
269
  - spec/learn_test/username_parser_spec.rb
@@ -1,249 +0,0 @@
1
- #!/bin/bash
2
- #
3
- # Copyright Bart Trojanowski <bart@jukie.net>
4
- #
5
- # git-wip is a script that will manage Work In Progress (or WIP) branches.
6
- # WIP branches are mostly throw away but identify points of development
7
- # between commits. The intent is to tie this script into your editor so
8
- # that each time you save your file, the git-wip script captures that
9
- # state in git. git-wip also helps you return back to a previous state of
10
- # development.
11
- #
12
- # See also http://github.com/bartman/git-wip
13
- #
14
- # The code is licensed as GPL v2 or, at your option, any later version.
15
- # Please see http://www.gnu.org/licenses/gpl-2.0.txt
16
- #
17
-
18
- USAGE='[ save <message> [ --editor | --untracked | --no-gpg-sign ] | delete ] [ [--] <file>... ]'
19
- LONG_USAGE="Manage Work In Progress branches
20
-
21
- Commands:
22
- git wip - create a new WIP commit
23
- git wip save <message> - create a new WIP commit with custom message
24
-
25
- Options for save:
26
- -e --editor - be less verbose, assume called from an editor
27
- -u --untracked - capture also untracked files
28
- -i --ignored - capture also ignored files
29
- --no-gpg-sign - do not sign commit; that is, countermand
30
- 'commit.gpgSign = true'
31
- "
32
-
33
- . "$(git --exec-path)/git-sh-setup"
34
-
35
- require_work_tree
36
-
37
- TMP=$(mktemp -d -t .git-wip)
38
-
39
- cleanup () {
40
- rm -f "$TMP-*"
41
- }
42
-
43
- trap cleanup 0
44
-
45
- WIP_INDEX="$TMP-INDEX"
46
-
47
- WIP_PREFIX=refs/wip/
48
- WIP_COMMAND=
49
- WIP_MESSAGE=WIP
50
- EDITOR_MODE=false
51
-
52
- dbg() {
53
- if test -n "$WIP_DEBUG"
54
- then
55
- printf '# %s\n' "$*"
56
- fi
57
- }
58
-
59
- # some errors are not worth reporting in --editor mode
60
- report_soft_error () {
61
- $EDITOR_MODE && exit 0
62
- die "$@"
63
- }
64
-
65
- get_work_branch () {
66
- ref=$(git symbolic-ref -q HEAD) \
67
- || report_soft_error "git-wip requires a branch"
68
-
69
-
70
- branch=${ref#refs/heads/}
71
- if [ $branch = $ref ] ; then
72
- die "git-wip requires a local branch"
73
- fi
74
-
75
- echo $branch
76
- }
77
-
78
- check_files () {
79
- local -a files="$@"
80
-
81
- for f in "${files[@]}"
82
- do
83
- [ -f "$f" -o -d "$f" ] || die "$f: No such file or directory."
84
- done
85
- }
86
-
87
- build_new_tree () {
88
- local untracked=$1 ; shift
89
- local ignored=$1 ; shift
90
- local files="$@"
91
-
92
- (
93
- set -e
94
- rm -f "$WIP_INDEX"
95
- cp -p "$GIT_DIR/index" "$WIP_INDEX"
96
- export GIT_INDEX_FILE="$WIP_INDEX"
97
- git read-tree $wip_parent
98
- if [ -n "$files" ]
99
- then
100
- git add -f "${files[@]}"
101
- else
102
- git add --update .
103
- fi
104
- [ -n "$untracked" ] && git add .
105
- [ -n "$ignored" ] && git add -f -A .
106
- git write-tree
107
- rm -f "$WIP_INDEX"
108
- )
109
- }
110
-
111
- do_save () {
112
- local msg="$1" ; shift
113
- local add_untracked=
114
- local add_ignored=
115
- local no_sign=
116
-
117
- while test $# != 0
118
- do
119
- case "$1" in
120
- -e|--editor)
121
- EDITOR_MODE=true
122
- ;;
123
- -u|--untracked)
124
- add_untracked=t
125
- ;;
126
- -i|--ignored)
127
- add_ignored=t
128
- ;;
129
- --no-gpg-sign)
130
- no_sign=--no-gpg-sign
131
- ;;
132
- --)
133
- shift
134
- break
135
- ;;
136
- *)
137
- [ -f "$1" ] && break
138
- die "Unknown option '$1'."
139
- ;;
140
- esac
141
- shift
142
- done
143
- local files="$@"
144
- local "add_untracked=$add_untracked"
145
- local "add_ignored=$add_ignored"
146
-
147
- if test ${#files} -gt 0
148
- then
149
- check_files "${files[@]}"
150
- fi
151
-
152
- dbg "msg=$msg"
153
- dbg "files=$files"
154
-
155
- local work_branch=$(get_work_branch)
156
- local wip_branch="$WIP_PREFIX$work_branch"
157
-
158
- dbg "work_branch=$work_branch"
159
- dbg "wip_branch=$wip_branch"
160
-
161
- # enable reflog
162
- local wip_branch_file="$GIT_DIR/logs/$wip_branch"
163
- dbg "wip_branch_file=$wip_branch_file"
164
- mkdir -p "$(dirname "$wip_branch_file")"
165
- : >>"$wip_branch_file"
166
-
167
- if ! work_last=$(git rev-parse --verify $work_branch)
168
- then
169
- report_soft_error "'$work_branch' branch has no commits."
170
- fi
171
-
172
- dbg "work_last=$work_last"
173
-
174
- if wip_last=$(git rev-parse --quiet --verify $wip_branch)
175
- then
176
- local base=$(git merge-base $wip_last $work_last) \
177
- || die "'work_branch' and '$wip_branch' are unrelated."
178
-
179
- if [ $base = $work_last ] ; then
180
- wip_parent=$wip_last
181
- else
182
- wip_parent=$work_last
183
- fi
184
- else
185
- wip_parent=$work_last
186
- fi
187
-
188
- dbg "wip_parent=$wip_parent"
189
-
190
- new_tree=$( build_new_tree "$add_untracked" "$add_ignored" "${files[@]}" ) \
191
- || die "Cannot save the current worktree state."
192
-
193
- dbg "new_tree=$new_tree"
194
-
195
- if git diff-tree --exit-code --quiet $new_tree $wip_parent ; then
196
- report_soft_error "no changes"
197
- fi
198
-
199
- dbg "... has changes"
200
-
201
- new_wip=$(printf '%s\n' "$msg" | git commit-tree $no_sign $new_tree -p $wip_parent 2>/dev/null) \
202
- || die "Cannot record working tree state"
203
-
204
- dbg "new_wip=$new_wip"
205
-
206
- msg1=$(printf '%s\n' "$msg" | sed -e 1q)
207
- git update-ref -m "git-wip: $msg1" $wip_branch $new_wip $wip_last
208
-
209
- dbg "SUCCESS"
210
- }
211
-
212
- if test $# -eq 0
213
- then
214
- dbg "no arguments"
215
-
216
- do_save "WIP"
217
- exit $?
218
- fi
219
-
220
- dbg "args: $@"
221
-
222
- case "$1" in
223
- save)
224
- WIP_COMMAND=$1
225
- shift
226
- if [ -n "$1" ]
227
- then
228
- WIP_MESSAGE="$1"
229
- shift
230
- fi
231
- ;;
232
- --*)
233
- ;;
234
- *)
235
- [ -f "$1" ] || die "Unknown command '$1'."
236
- ;;
237
- esac
238
-
239
- case $WIP_COMMAND in
240
- save)
241
- do_save "$WIP_MESSAGE" $@
242
- ;;
243
- *)
244
- usage
245
- exit 1
246
- ;;
247
- esac
248
-
249
- # vim: set noet sw=8
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'git'
4
- require 'logger'
5
-
6
- module LearnTest
7
- module GitWip
8
- class << self
9
- def run!(log: false)
10
- git = Git.open('./', log: log)
11
- working_branch = git.current_branch
12
-
13
- commands = [
14
- 'learn-test-wip save "Automatic test submission" --editor',
15
- "git push origin wip/#{working_branch}:refs/heads/wip"
16
- ].join(';')
17
-
18
- Open3.popen3(commands) do |_stdin, _stdout, _stderr, wait_thr|
19
- # while out = stdout.gets do; puts out; end
20
- # while err = stderr.gets do; puts err; end
21
-
22
- if wait_thr.value.exitstatus.zero?
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
- false
31
- end
32
- end
33
- end
34
- end