spawnpoint 0.2.0 → 0.3.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 +4 -4
- data/README.md +3 -3
- data/lib/spawnpoint/cli.rb +1 -1
- data/lib/spawnpoint/synchronizer.rb +9 -5
- data/lib/spawnpoint/version.rb +1 -1
- data/test/test_cli.rb +1 -1
- data/test/test_synchronizer.rb +15 -0
- data/test/test_version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 74b63ddf3131da47ad830cf6f2a948e8d874420297465d3815406d0a7a8132d0
|
|
4
|
+
data.tar.gz: 75501b0a8498aa3ee93decaa33bd03605a598f9b1821eb8fa15ce0c1d0b9d38d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4f895198fc61bc83bb47b86572ba5113b87cf018ecd73194f2406eb3e665703d4390a35a1cadf4b0fcb4b6bcadd32f0df9244994f09303cc94381cb7690c0d59
|
|
7
|
+
data.tar.gz: 95db91cebc3dacd2ee8766115dcd7121edcd7f4671d532fdfd7037326de84f22ee1722ccd7cbe7a592b47ab5c07c5ec2b407309bd2c7c76280ce62514d5b84ec
|
data/README.md
CHANGED
|
@@ -94,7 +94,7 @@ is ready, they can use the Git command directly instead.
|
|
|
94
94
|
| `spwn hop -- <branch> <file>` | `git restore --source <branch> -- <file>` | Bring a file back from another snapshot. |
|
|
95
95
|
| `spwn upload` | `git push` | Send your snapshots to the shared project space. |
|
|
96
96
|
| `spwn download` | `git pull` | Fetch new snapshots from the shared project space and combine them with yours. |
|
|
97
|
-
| `spwn sync <
|
|
97
|
+
| `spwn sync --target <game> --source <lesson>` | — | Copy lesson files into a game folder, replacing matching files when confirmed. |
|
|
98
98
|
| `spwn rollback --into <game>` | — | Undo the most recent lesson sync: restore replaced files and remove newly copied files. |
|
|
99
99
|
|
|
100
100
|
A few notes about the mapping:
|
|
@@ -123,8 +123,8 @@ students need while following a single-player course:
|
|
|
123
123
|
- `spwn upload` — push to a remote.
|
|
124
124
|
- `spwn download` — fetch and integrate from a remote.
|
|
125
125
|
- `spwn init` — start a new project.
|
|
126
|
-
- `spwn sync <
|
|
127
|
-
replace matching files without asking.
|
|
126
|
+
- `spwn sync --target <game> --source <lesson>` — copy lesson files into a game folder. Use `--force` to
|
|
127
|
+
replace matching files without asking. The older form `spwn sync <lesson> --into <game>` still works.
|
|
128
128
|
- `spwn rollback --into <game>` — undo the most recent sync. Files that existed before the sync
|
|
129
129
|
are restored, files created by the sync are removed, and unrelated game files are left alone.
|
|
130
130
|
|
data/lib/spawnpoint/cli.rb
CHANGED
|
@@ -233,7 +233,7 @@ module Spawnpoint
|
|
|
233
233
|
sync: {
|
|
234
234
|
name: "sync",
|
|
235
235
|
help: "Copy a lesson folder into your game folder. The first time a lesson touches a file that already exists in your game folder, spwn asks before replacing it. After you accept a file, later lessons upgrade that same file automatically, so asset updates get easier as you go.",
|
|
236
|
-
usage: "spwn sync <
|
|
236
|
+
usage: "spwn sync --target <game-folder> --source <lesson-folder> [--force] or spwn sync <lesson-folder> --into <game-folder> [--force]",
|
|
237
237
|
handler: ->(args) { require_relative "synchronizer"; Spawnpoint::Synchronizer.new.run(args) }
|
|
238
238
|
},
|
|
239
239
|
|
|
@@ -30,11 +30,12 @@ module Spawnpoint
|
|
|
30
30
|
|
|
31
31
|
unless lesson_folder
|
|
32
32
|
puts "Usage:"
|
|
33
|
+
puts " spwn sync --target <game-folder> --source <lesson-folder>"
|
|
33
34
|
puts " spwn sync <lesson-folder> --into <game-folder>"
|
|
34
|
-
puts "
|
|
35
|
+
puts " add --force to replace existing files without asking"
|
|
35
36
|
puts ""
|
|
36
37
|
puts "Example:"
|
|
37
|
-
puts " spwn sync
|
|
38
|
+
puts " spwn sync --target ~/DragonRuby/mygame --source 04-collectibles/starter"
|
|
38
39
|
puts ""
|
|
39
40
|
puts "The first time a lesson copies a file that already exists in your"
|
|
40
41
|
puts "game folder, spwn asks before replacing it. After you accept a"
|
|
@@ -43,8 +44,8 @@ module Spawnpoint
|
|
|
43
44
|
end
|
|
44
45
|
|
|
45
46
|
unless into_folder
|
|
46
|
-
puts "Oops: tell spwn where to copy the lesson with --into."
|
|
47
|
-
puts "Example: spwn sync
|
|
47
|
+
puts "Oops: tell spwn where to copy the lesson with --target (or --into)."
|
|
48
|
+
puts "Example: spwn sync --target ~/DragonRuby/mygame --source 04-collectibles/starter"
|
|
48
49
|
return 1
|
|
49
50
|
end
|
|
50
51
|
|
|
@@ -195,9 +196,12 @@ module Spawnpoint
|
|
|
195
196
|
while i < argv.length
|
|
196
197
|
arg = argv[i]
|
|
197
198
|
case arg
|
|
198
|
-
when "--into"
|
|
199
|
+
when "--into", "--target"
|
|
199
200
|
i += 1
|
|
200
201
|
into_folder = argv[i]
|
|
202
|
+
when "--source"
|
|
203
|
+
i += 1
|
|
204
|
+
lesson_folder ||= argv[i]
|
|
201
205
|
when "--force", "-f"
|
|
202
206
|
force = true
|
|
203
207
|
when /\A-/
|
data/lib/spawnpoint/version.rb
CHANGED
data/test/test_cli.rb
CHANGED
data/test/test_synchronizer.rb
CHANGED
|
@@ -52,6 +52,21 @@ class TestSynchronizer < Minitest::Test
|
|
|
52
52
|
assert_includes marker_paths, "main.rb"
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
+
def test_accepts_target_and_source_flags
|
|
56
|
+
write(@lesson, "main.rb", "puts :hi")
|
|
57
|
+
capture_io { @status = Spawnpoint::Synchronizer.new.run(["--target", @game, "--source", @lesson]) }
|
|
58
|
+
assert_equal 0, @status
|
|
59
|
+
assert_equal "puts :hi", File.read(File.join(@game, "main.rb"))
|
|
60
|
+
assert_includes marker_paths, "main.rb"
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def test_accepts_target_flag_with_positional_lesson
|
|
64
|
+
write(@lesson, "main.rb", "puts :hi")
|
|
65
|
+
capture_io { @status = Spawnpoint::Synchronizer.new.run([@lesson, "--target", @game]) }
|
|
66
|
+
assert_equal 0, @status
|
|
67
|
+
assert_equal "puts :hi", File.read(File.join(@game, "main.rb"))
|
|
68
|
+
end
|
|
69
|
+
|
|
55
70
|
def test_force_replaces_existing_file
|
|
56
71
|
write(@game, "main.rb", "old")
|
|
57
72
|
write(@lesson, "main.rb", "new")
|
data/test/test_version.rb
CHANGED