-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: dogi <dogi@users.noreply.github.com>
- Loading branch information
Showing
17 changed files
with
138 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
function magazines() { | ||
checkargn $# 3 | ||
magtype="$1" | ||
req="$2" | ||
lang="$3" | ||
available_mag=0 | ||
if [ -z "$magtype" ]; then | ||
echo "ERROR: no magazine type given" | ||
exit 1 | ||
fi | ||
for file in $MAGAZINES/*; do | ||
if [ "$magtype" = "$(echo "${file##*/}" | sed -e 's/^download-//' -e 's/.sh$//')" ]; then available_mag=1; fi | ||
done | ||
if [ $available_mag = 0 ]; then | ||
echo "Please specify a valid magazine type, these include: magpi, hackspace, wireframe, helloworld" | ||
elif [ "$req" = "" ]; then source $MAGAZINES/download-$magtype.sh && info | ||
elif [ "$req" = "latest" ] || [ "$req" = "all" ] || [[ "$req" =~ ^[0-9]+$ ]] || [[ "$req" = "language" ]]; then | ||
if [[ "$req" = "language" ]]; then | ||
echo "coming soon!" | ||
exit 1 | ||
fi | ||
checkinternet | ||
if [ ! -d "$magtype" ]; then mkdir $magtype; fi | ||
cd $magtype || return | ||
if [[ "$req" =~ ^[0-9]+$ ]]; then source $MAGAZINES/download-$magtype.sh && number | ||
else source $MAGAZINES/download-$magtype.sh && $req; fi | ||
cd .. | ||
echo "Requested issue(s) saved in the $magtype directory" | ||
else | ||
magazine_help | ||
fi | ||
} | ||
|
||
function magazine_help { | ||
echo | ||
echo "Usage: $BASENAME magazines <helloworld|hackspace|magpi|wireframe> [all|latest|number]" | ||
echo | ||
echo "This downloads the specified issue of a magazine as a pdf with filename <mag_type>#.pdf based on user input" | ||
echo | ||
echo "Example:" | ||
echo | ||
echo " $BASENAME magazines magpi" | ||
echo " This will print out details about the magpi magazine." | ||
echo | ||
echo " $BASENAME magazines magpi all" | ||
echo " This will download all the currently present issues of magpi." | ||
echo | ||
echo " $BASENAME magazines magpi latest" | ||
echo " This will download the latest issue of magpi." | ||
echo | ||
echo " $BASENAME magazines magpi number" | ||
echo " This will download issue [number] of magpi." | ||
echo | ||
echo " $BASENAME magazines magpi language [language_choice] ((coming soon))" | ||
echo " This will download all available [language_choice] issues of magpi." | ||
echo | ||
echo " $BASENAME magazines helloworld" | ||
echo " This will print out details about the helloworld magazine." | ||
echo | ||
echo " $BASENAME magazines helloworld all" | ||
echo " This will download all the currently present issues of helloworld." | ||
echo | ||
echo " $BASENAME magazines helloworld latest" | ||
echo " This will download the latest issue of helloworld." | ||
echo | ||
echo " $BASENAME magazines helloworld number" | ||
echo " This will download issue [number] of helloworld." | ||
echo | ||
echo " $BASENAME magazines hackspace" | ||
echo " This will print out details about the hackspace magazine." | ||
echo | ||
echo " $BASENAME magazines hackspace all" | ||
echo " This will download all the currently present issues of hackspace." | ||
echo | ||
echo " $BASENAME magazines hackspace latest" | ||
echo " This will download the latest issue of hackspace." | ||
echo | ||
echo " $BASENAME magazines hackspace number" | ||
echo " This will download issue [number] of hackspace." | ||
echo | ||
echo " $BASENAME magazines wireframe" | ||
echo " This will print out details about the wireframe magazine." | ||
echo | ||
echo " $BASENAME magazines wireframe all" | ||
echo " This will download all the currently present issues of wireframe." | ||
echo | ||
echo " $BASENAME magazines wireframe latest" | ||
echo " This will download the latest issue of wireframe." | ||
echo | ||
echo " $BASENAME magazines wireframe number" | ||
echo " This will download issue [number] of wireframe." | ||
echo | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
12 changes: 6 additions & 6 deletions
12
tests/magazine/hackspace.bats → tests/magazines/hackspace.bats
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
#!/usr/bin/env bats | ||
load ../test-helper | ||
|
||
@test "$clinom magazine hackspace" { | ||
run "${clicmd}" magazine hackspace | ||
@test "$clinom magazines hackspace" { | ||
run "${clicmd}" magazines hackspace | ||
assert_output -p "HackSpace magazine is packed with projects for fixers and tinkerers of all abilities. We'll teach you new techniques and give you refreshers on familiar ones, from 3D printing, laser cutting, and woodworking to electronics and Internet of Things." | ||
} | ||
|
||
@test "$clinom magazine hackspace latest" { | ||
run "${clicmd}" magazine hackspace latest | ||
@test "$clinom magazines hackspace latest" { | ||
run "${clicmd}" magazines hackspace latest | ||
assert_success | ||
} | ||
|
||
@test "$clinom magazine hackspace all" { | ||
run "${clicmd}" magazine hackspace all | ||
@test "$clinom magazines hackspace all" { | ||
run "${clicmd}" magazines hackspace all | ||
assert_success | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env bats | ||
load ../test-helper | ||
|
||
@test "$clinom magazines helloworld" { | ||
run "${clicmd}" magazines helloworld | ||
assert_output -p "HelloWorld is the computing and digital making magazine for educators." | ||
} | ||
|
||
@test "$clinom magazines helloworld latest" { | ||
run "${clicmd}" magazines helloworld latest | ||
assert_success | ||
} | ||
|
||
@test "$clinom magazines helloworld all" { | ||
run "${clicmd}" magazines helloworld all | ||
assert_success | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
#!/usr/bin/env bats | ||
load ../test-helper | ||
|
||
@test "$clinom magazine magpi" { | ||
run "${clicmd}" magazine magpi | ||
@test "$clinom magazines magpi" { | ||
run "${clicmd}" magazines magpi | ||
assert_output -p "The MagPi is The Official Raspberry Pi magazine. Written by and for the community, it is packed with Raspberry Pi-themed projects, computing and electronics tutorials, how-to guides, and the latest news and reviews." | ||
} | ||
|
||
@test "$clinom magazine magpi latest" { | ||
run "${clicmd}" magazine magpi latest | ||
@test "$clinom magazines magpi latest" { | ||
run "${clicmd}" magazines magpi latest | ||
assert_success | ||
} | ||
|
||
@test "$clinom magazine magpi all" { | ||
run "${clicmd}" magazine magpi all | ||
@test "$clinom magazines magpi all" { | ||
run "${clicmd}" magazines magpi all | ||
assert_success | ||
} |
12 changes: 6 additions & 6 deletions
12
tests/magazine/wireframe.bats → tests/magazines/wireframe.bats
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
#!/usr/bin/env bats | ||
load ../test-helper | ||
|
||
@test "$clinom magazine wireframe" { | ||
run "${clicmd}" magazine wireframe | ||
@test "$clinom magazines wireframe" { | ||
run "${clicmd}" magazines wireframe | ||
assert_output -p "Wireframe is a new fortnightly magazine that lifts the lid on video games. In every issue, we'll be looking at how games are made, who makes them, and even guide you through the process of making your own." | ||
} | ||
|
||
@test "$clinom magazine wireframe latest" { | ||
run "${clicmd}" magazine wireframe latest | ||
@test "$clinom magazines wireframe latest" { | ||
run "${clicmd}" magazines wireframe latest | ||
assert_success | ||
} | ||
|
||
@test "$clinom magazine wireframe all" { | ||
run "${clicmd}" magazine wireframe all | ||
@test "$clinom magazines wireframe all" { | ||
run "${clicmd}" magazines wireframe all | ||
assert_success | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters