trackler 2.2.1.33 → 2.2.1.34
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/README.md +1 -1
- data/problem-specifications/exercises/palindrome-products/description.md +9 -3
- data/tracks/c/exercises/hamming/src/example.c +9 -8
- data/tracks/c/exercises/hamming/src/example.h +1 -1
- data/tracks/c/exercises/hamming/test/test_hamming.c +31 -7
- data/tracks/clojure/config.json +10 -0
- data/tracks/clojure/exercises/collatz-conjecture/README.md +34 -0
- data/tracks/clojure/exercises/collatz-conjecture/project.clj +4 -0
- data/tracks/clojure/exercises/collatz-conjecture/src/collatz_conjecture.clj +3 -0
- data/tracks/clojure/exercises/collatz-conjecture/src/example.clj +13 -0
- data/tracks/clojure/exercises/collatz-conjecture/test/collatz_conjecture_test.clj +29 -0
- data/tracks/coldfusion/.gitignore +1 -0
- data/tracks/coldfusion/.travis.yml +16 -4
- data/tracks/coldfusion/CONTRIBUTING.md +10 -0
- data/tracks/coldfusion/README.md +85 -6
- data/tracks/coldfusion/config.json +195 -10
- data/tracks/coldfusion/config/maintainers.json +8 -1
- data/tracks/coldfusion/docs/ABOUT.md +8 -0
- data/tracks/coldfusion/docs/EXERCISE_README_INSERT.md +15 -0
- data/tracks/coldfusion/docs/INSTALLATION.md +35 -0
- data/tracks/coldfusion/docs/LEARNING.md +37 -0
- data/tracks/coldfusion/docs/RESOURCES.md +29 -0
- data/tracks/coldfusion/docs/SNIPPET.txt +8 -0
- data/tracks/coldfusion/docs/TESTS.md +19 -0
- data/tracks/coldfusion/exercises/acronym/.meta/HINTS.md +0 -0
- data/tracks/coldfusion/exercises/acronym/Acronym.cfc +13 -0
- data/tracks/coldfusion/exercises/acronym/AcronymTest.cfc +43 -0
- data/tracks/coldfusion/exercises/acronym/Solution.cfc +22 -0
- data/tracks/coldfusion/exercises/acronym/SolutionTest.cfc +7 -0
- data/tracks/coldfusion/exercises/acronym/TestRunner.cfc +103 -0
- data/tracks/coldfusion/exercises/acronym/box.json +8 -0
- data/tracks/coldfusion/exercises/acronym/index.cfm +37 -0
- data/tracks/coldfusion/exercises/atbash-cipher/.meta/HINTS.md +0 -0
- data/tracks/coldfusion/exercises/atbash-cipher/AtbashCipher.cfc +14 -0
- data/tracks/coldfusion/exercises/atbash-cipher/AtbashCipherTest.cfc +71 -0
- data/tracks/coldfusion/exercises/atbash-cipher/Solution.cfc +56 -0
- data/tracks/coldfusion/exercises/atbash-cipher/SolutionTest.cfc +7 -0
- data/tracks/coldfusion/exercises/atbash-cipher/TestRunner.cfc +103 -0
- data/tracks/coldfusion/exercises/atbash-cipher/box.json +8 -0
- data/tracks/coldfusion/exercises/atbash-cipher/index.cfm +37 -0
- data/tracks/coldfusion/exercises/diamond/.meta/HINTS.md +0 -0
- data/tracks/coldfusion/exercises/diamond/Diamond.cfc +13 -0
- data/tracks/coldfusion/exercises/diamond/DiamondTest.cfc +35 -0
- data/tracks/coldfusion/exercises/diamond/Solution.cfc +35 -0
- data/tracks/coldfusion/exercises/diamond/SolutionTest.cfc +7 -0
- data/tracks/coldfusion/exercises/diamond/TestRunner.cfc +103 -0
- data/tracks/coldfusion/exercises/diamond/box.json +8 -0
- data/tracks/coldfusion/exercises/diamond/index.cfm +37 -0
- data/tracks/coldfusion/exercises/difference-of-squares/.meta/HINTS.md +0 -0
- data/tracks/coldfusion/exercises/difference-of-squares/DifferenceOfSquares.cfc +18 -0
- data/tracks/coldfusion/exercises/difference-of-squares/DifferenceOfSquaresTest.cfc +63 -0
- data/tracks/coldfusion/exercises/difference-of-squares/Solution.cfc +28 -0
- data/tracks/coldfusion/exercises/difference-of-squares/SolutionTest.cfc +7 -0
- data/tracks/coldfusion/exercises/difference-of-squares/TestRunner.cfc +103 -0
- data/tracks/coldfusion/exercises/difference-of-squares/box.json +8 -0
- data/tracks/coldfusion/exercises/difference-of-squares/index.cfm +37 -0
- data/tracks/coldfusion/exercises/flatten-array/.meta/HINTS.md +0 -0
- data/tracks/coldfusion/exercises/flatten-array/FlattenArray.cfc +13 -0
- data/tracks/coldfusion/exercises/flatten-array/FlattenArrayTest.cfc +42 -0
- data/tracks/coldfusion/exercises/flatten-array/Solution.cfc +26 -0
- data/tracks/coldfusion/exercises/flatten-array/SolutionTest.cfc +7 -0
- data/tracks/coldfusion/exercises/flatten-array/TestRunner.cfc +103 -0
- data/tracks/coldfusion/exercises/flatten-array/box.json +8 -0
- data/tracks/coldfusion/exercises/flatten-array/index.cfm +37 -0
- data/tracks/coldfusion/exercises/gigasecond/.meta/HINTS.md +0 -0
- data/tracks/coldfusion/exercises/gigasecond/Gigasecond.cfc +13 -0
- data/tracks/coldfusion/exercises/gigasecond/GigasecondTest.cfc +39 -0
- data/tracks/coldfusion/exercises/gigasecond/Solution.cfc +16 -0
- data/tracks/coldfusion/exercises/gigasecond/SolutionTest.cfc +7 -0
- data/tracks/coldfusion/exercises/gigasecond/TestRunner.cfc +103 -0
- data/tracks/coldfusion/exercises/gigasecond/box.json +8 -0
- data/tracks/coldfusion/exercises/gigasecond/index.cfm +37 -0
- data/tracks/coldfusion/exercises/grains/.meta/HINTS.md +0 -0
- data/tracks/coldfusion/exercises/grains/Grains.cfc +14 -0
- data/tracks/coldfusion/exercises/grains/GrainsTest.cfc +63 -0
- data/tracks/coldfusion/exercises/grains/Solution.cfc +22 -0
- data/tracks/coldfusion/exercises/grains/SolutionTest.cfc +7 -0
- data/tracks/coldfusion/exercises/grains/TestRunner.cfc +103 -0
- data/tracks/coldfusion/exercises/grains/box.json +8 -0
- data/tracks/coldfusion/exercises/grains/index.cfm +37 -0
- data/tracks/coldfusion/exercises/hamming/.meta/HINTS.md +0 -0
- data/tracks/coldfusion/exercises/hamming/Hamming.cfc +13 -0
- data/tracks/coldfusion/exercises/hamming/HammingTest.cfc +75 -0
- data/tracks/coldfusion/exercises/hamming/Solution.cfc +25 -0
- data/tracks/coldfusion/exercises/hamming/SolutionTest.cfc +7 -0
- data/tracks/coldfusion/exercises/hamming/TestRunner.cfc +103 -0
- data/tracks/coldfusion/exercises/hamming/box.json +8 -0
- data/tracks/coldfusion/exercises/hamming/index.cfm +37 -0
- data/tracks/coldfusion/exercises/hello-world/HelloWorld.cfc +13 -0
- data/tracks/coldfusion/exercises/hello-world/HelloWorldTest.cfc +18 -0
- data/tracks/coldfusion/exercises/hello-world/Solution.cfc +13 -0
- data/tracks/coldfusion/exercises/hello-world/SolutionTest.cfc +7 -0
- data/tracks/coldfusion/exercises/hello-world/TestRunner.cfc +103 -0
- data/tracks/coldfusion/exercises/hello-world/box.json +8 -0
- data/tracks/coldfusion/exercises/hello-world/index.cfm +37 -0
- data/tracks/coldfusion/exercises/isogram/.meta/HINTS.md +0 -0
- data/tracks/coldfusion/exercises/isogram/Isogram.cfc +13 -0
- data/tracks/coldfusion/exercises/isogram/IsogramTest.cfc +55 -0
- data/tracks/coldfusion/exercises/isogram/Solution.cfc +23 -0
- data/tracks/coldfusion/exercises/isogram/SolutionTest.cfc +7 -0
- data/tracks/coldfusion/exercises/isogram/TestRunner.cfc +103 -0
- data/tracks/coldfusion/exercises/isogram/box.json +8 -0
- data/tracks/coldfusion/exercises/isogram/index.cfm +37 -0
- data/tracks/coldfusion/exercises/largest-series-product/.meta/HINTS.md +0 -0
- data/tracks/coldfusion/exercises/largest-series-product/LargestSeriesProduct.cfc +13 -0
- data/tracks/coldfusion/exercises/largest-series-product/LargestSeriesProductTest.cfc +75 -0
- data/tracks/coldfusion/exercises/largest-series-product/Solution.cfc +41 -0
- data/tracks/coldfusion/exercises/largest-series-product/SolutionTest.cfc +7 -0
- data/tracks/coldfusion/exercises/largest-series-product/TestRunner.cfc +103 -0
- data/tracks/coldfusion/exercises/largest-series-product/box.json +8 -0
- data/tracks/coldfusion/exercises/largest-series-product/index.cfm +37 -0
- data/tracks/coldfusion/exercises/leap/Leap.cfc +15 -0
- data/tracks/coldfusion/exercises/leap/LeapTest.cfc +39 -0
- data/tracks/coldfusion/exercises/leap/Solution.cfc +19 -0
- data/tracks/coldfusion/exercises/leap/SolutionTest.cfc +7 -0
- data/tracks/coldfusion/exercises/leap/TestRunner.cfc +103 -0
- data/tracks/coldfusion/exercises/leap/box.json +8 -0
- data/tracks/coldfusion/exercises/leap/index.cfm +37 -0
- data/tracks/coldfusion/exercises/luhn/.meta/HINTS.md +0 -0
- data/tracks/coldfusion/exercises/luhn/Luhn.cfc +13 -0
- data/tracks/coldfusion/exercises/luhn/LuhnTest.cfc +67 -0
- data/tracks/coldfusion/exercises/luhn/Solution.cfc +38 -0
- data/tracks/coldfusion/exercises/luhn/SolutionTest.cfc +7 -0
- data/tracks/coldfusion/exercises/luhn/TestRunner.cfc +103 -0
- data/tracks/coldfusion/exercises/luhn/box.json +8 -0
- data/tracks/coldfusion/exercises/luhn/index.cfm +37 -0
- data/tracks/coldfusion/exercises/nth-prime/.meta/HINTS.md +0 -0
- data/tracks/coldfusion/exercises/nth-prime/NthPrime.cfc +13 -0
- data/tracks/coldfusion/exercises/nth-prime/NthPrimeTest.cfc +35 -0
- data/tracks/coldfusion/exercises/nth-prime/Solution.cfc +33 -0
- data/tracks/coldfusion/exercises/nth-prime/SolutionTest.cfc +7 -0
- data/tracks/coldfusion/exercises/nth-prime/TestRunner.cfc +103 -0
- data/tracks/coldfusion/exercises/nth-prime/box.json +8 -0
- data/tracks/coldfusion/exercises/nth-prime/index.cfm +37 -0
- data/tracks/coldfusion/exercises/pangram/.meta/HINTS.md +0 -0
- data/tracks/coldfusion/exercises/pangram/Pangram.cfc +13 -0
- data/tracks/coldfusion/exercises/pangram/PangramTest.cfc +55 -0
- data/tracks/coldfusion/exercises/pangram/Solution.cfc +21 -0
- data/tracks/coldfusion/exercises/pangram/SolutionTest.cfc +7 -0
- data/tracks/coldfusion/exercises/pangram/TestRunner.cfc +103 -0
- data/tracks/coldfusion/exercises/pangram/box.json +8 -0
- data/tracks/coldfusion/exercises/pangram/index.cfm +37 -0
- data/tracks/coldfusion/exercises/pig-latin/.meta/HINTS.md +0 -0
- data/tracks/coldfusion/exercises/pig-latin/PigLatin.cfc +13 -0
- data/tracks/coldfusion/exercises/pig-latin/PigLatinTest.cfc +115 -0
- data/tracks/coldfusion/exercises/pig-latin/Solution.cfc +30 -0
- data/tracks/coldfusion/exercises/pig-latin/SolutionTest.cfc +7 -0
- data/tracks/coldfusion/exercises/pig-latin/TestRunner.cfc +103 -0
- data/tracks/coldfusion/exercises/pig-latin/box.json +8 -0
- data/tracks/coldfusion/exercises/pig-latin/index.cfm +37 -0
- data/tracks/coldfusion/exercises/raindrops/.meta/HINTS.md +0 -0
- data/tracks/coldfusion/exercises/raindrops/Raindrops.cfc +13 -0
- data/tracks/coldfusion/exercises/raindrops/RaindropsTest.cfc +87 -0
- data/tracks/coldfusion/exercises/raindrops/Solution.cfc +33 -0
- data/tracks/coldfusion/exercises/raindrops/SolutionTest.cfc +7 -0
- data/tracks/coldfusion/exercises/raindrops/TestRunner.cfc +103 -0
- data/tracks/coldfusion/exercises/raindrops/box.json +8 -0
- data/tracks/coldfusion/exercises/raindrops/index.cfm +37 -0
- data/tracks/coldfusion/exercises/rna-transcription/.meta/HINTS.md +0 -0
- data/tracks/coldfusion/exercises/rna-transcription/RnaTranscription.cfc +13 -0
- data/tracks/coldfusion/exercises/rna-transcription/RnaTranscriptionTest.cfc +47 -0
- data/tracks/coldfusion/exercises/rna-transcription/Solution.cfc +35 -0
- data/tracks/coldfusion/exercises/rna-transcription/SolutionTest.cfc +7 -0
- data/tracks/coldfusion/exercises/rna-transcription/TestRunner.cfc +103 -0
- data/tracks/coldfusion/exercises/rna-transcription/box.json +8 -0
- data/tracks/coldfusion/exercises/rna-transcription/index.cfm +37 -0
- data/tracks/coldfusion/exercises/saddle-points/.meta/HINTS.md +0 -0
- data/tracks/coldfusion/exercises/saddle-points/SaddlePoints.cfc +13 -0
- data/tracks/coldfusion/exercises/saddle-points/SaddlePointsTest.cfc +35 -0
- data/tracks/coldfusion/exercises/saddle-points/Solution.cfc +59 -0
- data/tracks/coldfusion/exercises/saddle-points/SolutionTest.cfc +7 -0
- data/tracks/coldfusion/exercises/saddle-points/TestRunner.cfc +103 -0
- data/tracks/coldfusion/exercises/saddle-points/box.json +8 -0
- data/tracks/coldfusion/exercises/saddle-points/index.cfm +37 -0
- data/tracks/coldfusion/exercises/scrabble-score/.meta/HINTS.md +0 -0
- data/tracks/coldfusion/exercises/scrabble-score/ScrabbleScore.cfc +13 -0
- data/tracks/coldfusion/exercises/scrabble-score/ScrabbleScoreTest.cfc +59 -0
- data/tracks/coldfusion/exercises/scrabble-score/Solution.cfc +50 -0
- data/tracks/coldfusion/exercises/scrabble-score/SolutionTest.cfc +7 -0
- data/tracks/coldfusion/exercises/scrabble-score/TestRunner.cfc +103 -0
- data/tracks/coldfusion/exercises/scrabble-score/box.json +8 -0
- data/tracks/coldfusion/exercises/scrabble-score/index.cfm +37 -0
- data/tracks/coldfusion/exercises/secret-handshake/.meta/HINTS.md +0 -0
- data/tracks/coldfusion/exercises/secret-handshake/SecretHandshake.cfc +13 -0
- data/tracks/coldfusion/exercises/secret-handshake/SecretHandshakeTest.cfc +63 -0
- data/tracks/coldfusion/exercises/secret-handshake/Solution.cfc +31 -0
- data/tracks/coldfusion/exercises/secret-handshake/SolutionTest.cfc +7 -0
- data/tracks/coldfusion/exercises/secret-handshake/TestRunner.cfc +103 -0
- data/tracks/coldfusion/exercises/secret-handshake/box.json +8 -0
- data/tracks/coldfusion/exercises/secret-handshake/index.cfm +37 -0
- data/tracks/coldfusion/exercises/space-age/.meta/HINTS.md +0 -0
- data/tracks/coldfusion/exercises/space-age/Solution.cfc +28 -0
- data/tracks/coldfusion/exercises/space-age/SolutionTest.cfc +7 -0
- data/tracks/coldfusion/exercises/space-age/SpaceAge.cfc +13 -0
- data/tracks/coldfusion/exercises/space-age/SpaceAgeTest.cfc +47 -0
- data/tracks/coldfusion/exercises/space-age/TestRunner.cfc +103 -0
- data/tracks/coldfusion/exercises/space-age/box.json +8 -0
- data/tracks/coldfusion/exercises/space-age/index.cfm +37 -0
- data/tracks/coldfusion/exercises/sum-of-multiples/.meta/HINTS.md +0 -0
- data/tracks/coldfusion/exercises/sum-of-multiples/Solution.cfc +27 -0
- data/tracks/coldfusion/exercises/sum-of-multiples/SolutionTest.cfc +7 -0
- data/tracks/coldfusion/exercises/sum-of-multiples/SumOfMultiples.cfc +13 -0
- data/tracks/coldfusion/exercises/sum-of-multiples/SumOfMultiplesTest.cfc +63 -0
- data/tracks/coldfusion/exercises/sum-of-multiples/TestRunner.cfc +103 -0
- data/tracks/coldfusion/exercises/sum-of-multiples/box.json +8 -0
- data/tracks/coldfusion/exercises/sum-of-multiples/index.cfm +37 -0
- data/tracks/coldfusion/exercises/triangle/.meta/HINTS.md +0 -0
- data/tracks/coldfusion/exercises/triangle/Solution.cfc +53 -0
- data/tracks/coldfusion/exercises/triangle/SolutionTest.cfc +7 -0
- data/tracks/coldfusion/exercises/triangle/TestRunner.cfc +103 -0
- data/tracks/coldfusion/exercises/triangle/Triangle.cfc +18 -0
- data/tracks/coldfusion/exercises/triangle/TriangleTest.cfc +95 -0
- data/tracks/coldfusion/exercises/triangle/box.json +8 -0
- data/tracks/coldfusion/exercises/triangle/index.cfm +37 -0
- data/tracks/coldfusion/tasks/GenerateTests.cfc +179 -0
- data/tracks/coldfusion/tasks/ScaffoldExercise.cfc +85 -0
- data/tracks/coldfusion/tasks/TestAllSolutions.cfc +24 -0
- data/tracks/coldfusion/tasks/exercise_template/.meta/HINTS.md +0 -0
- data/tracks/coldfusion/tasks/exercise_template/@@name@@.cfc +13 -0
- data/tracks/coldfusion/tasks/exercise_template/@@name@@Test.cfc +15 -0
- data/tracks/coldfusion/tasks/exercise_template/Solution.cfc +6 -0
- data/tracks/coldfusion/tasks/exercise_template/SolutionTest.cfc +7 -0
- data/tracks/coldfusion/tasks/exercise_template/TestRunner.cfc +103 -0
- data/tracks/coldfusion/tasks/exercise_template/box.json +8 -0
- data/tracks/coldfusion/tasks/exercise_template/index.cfm +37 -0
- data/tracks/common-lisp/config.json +12 -0
- data/tracks/common-lisp/exercises/collatz-conjecture/README.md +84 -0
- data/tracks/common-lisp/exercises/collatz-conjecture/collatz-conjecture-test.lisp +31 -0
- data/tracks/common-lisp/exercises/collatz-conjecture/collatz-conjecture.lisp +7 -0
- data/tracks/common-lisp/exercises/collatz-conjecture/example.lisp +14 -0
- data/tracks/csharp/exercises/clock/Clock.cs +20 -4
- data/tracks/csharp/exercises/clock/ClockTest.cs +290 -55
- data/tracks/csharp/exercises/clock/Example.cs +11 -8
- data/tracks/csharp/generators/Exercises/Clock.cs +75 -0
- data/tracks/csharp/generators/Output/FormattingExtensions.cs +0 -1
- data/tracks/csharp/generators/Program.cs +2 -1
- data/tracks/haskell/config.json +10 -0
- data/tracks/haskell/exercises/collatz-conjecture/README.md +87 -0
- data/tracks/haskell/exercises/collatz-conjecture/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/collatz-conjecture/examples/success-standard/src/CollatzConjecture.hs +9 -0
- data/tracks/haskell/exercises/collatz-conjecture/package.yaml +20 -0
- data/tracks/haskell/exercises/collatz-conjecture/src/CollatzConjecture.hs +4 -0
- data/tracks/haskell/exercises/collatz-conjecture/stack.yaml +1 -0
- data/tracks/haskell/exercises/collatz-conjecture/test/Tests.hs +52 -0
- data/tracks/idris/docs/SNIPPET.txt +10 -0
- data/tracks/rust/README.md +83 -2
- data/tracks/rust/config.json +24 -0
- data/tracks/rust/exercises/perfect-numbers/.gitignore +7 -0
- data/tracks/rust/exercises/perfect-numbers/Cargo.toml +5 -0
- data/tracks/rust/exercises/perfect-numbers/README.md +56 -0
- data/tracks/rust/exercises/perfect-numbers/example.rs +20 -0
- data/tracks/rust/exercises/perfect-numbers/src/lib.rs +0 -0
- data/tracks/rust/exercises/perfect-numbers/tests/perfect-numbers.rs +33 -0
- data/tracks/rust/exercises/poker/.gitignore +7 -0
- data/tracks/rust/exercises/poker/.meta/hints.md +8 -0
- data/tracks/rust/exercises/poker/Cargo-example.toml +8 -0
- data/tracks/rust/exercises/poker/Cargo.toml +6 -0
- data/tracks/rust/exercises/poker/README.md +54 -0
- data/tracks/rust/exercises/poker/example.rs +341 -0
- data/tracks/rust/exercises/poker/src/lib.rs +7 -0
- data/tracks/rust/exercises/poker/tests/poker.rs +298 -0
- metadata +242 -5
- data/tracks/coldfusion/exercises/leap/example.cfc +0 -11
- data/tracks/coldfusion/exercises/leap/leap.cfc +0 -5
- data/tracks/coldfusion/exercises/leap/leap_tests.cfc +0 -35
@@ -0,0 +1,85 @@
|
|
1
|
+
/**
|
2
|
+
* I scaffold a new exercise from the template.
|
3
|
+
*/
|
4
|
+
component {
|
5
|
+
|
6
|
+
function run(
|
7
|
+
slug,
|
8
|
+
difficulty,
|
9
|
+
uuid=createGUID()
|
10
|
+
) {
|
11
|
+
var repoRootPath = expandPath( getDirectoryFromPath( getCurrentTemplatePath() ) & '../' );
|
12
|
+
|
13
|
+
// Acquire slug
|
14
|
+
if( isNull( arguments.slug ) ) {
|
15
|
+
arguments.slug = ask( 'Exercise slug as defined by Excercism. Ex: "hello-world": ' );
|
16
|
+
}
|
17
|
+
|
18
|
+
// Slug of hello-world defaults to name of HelloWorld
|
19
|
+
var exerciseName = arguments.slug
|
20
|
+
.listToArray( '-' )
|
21
|
+
.map( function( i ){
|
22
|
+
return i.left( 1 ).uCase() & i.right( -1 ).lCase();
|
23
|
+
} )
|
24
|
+
.toList( '' );
|
25
|
+
|
26
|
+
// Acquire diffculty
|
27
|
+
if( isNull( arguments.difficulty ) ) {
|
28
|
+
arguments.difficulty = ask( message='Difficulty: ', defaultResponse=1 );
|
29
|
+
}
|
30
|
+
|
31
|
+
// Validation to prevent duplicate runs
|
32
|
+
var exerciseDirectory = repoRootPath & 'exercises/' & arguments.slug;
|
33
|
+
if( directoryExists( exerciseDirectory ) ) {
|
34
|
+
error( 'An exercise named [#arguments.slug#] already exists!' );
|
35
|
+
}
|
36
|
+
|
37
|
+
// Add this exercise to config.json
|
38
|
+
var configJSON = deserializeJSON( fileRead( repoRootPath & '/config.json' ) );
|
39
|
+
configJSON.exercises.append( {
|
40
|
+
"uuid": arguments.uuid,
|
41
|
+
"difficulty": arguments.difficulty+0,
|
42
|
+
"slug": arguments.slug,
|
43
|
+
"topics": []
|
44
|
+
} );
|
45
|
+
fileWrite( repoRootPath & '/config.json', formatterUtil.formatJSON( json=configJSON, indent=' ' , lineEnding=chr( 10 ) ) );
|
46
|
+
|
47
|
+
// Create exercise scaffold
|
48
|
+
directoryCreate( exerciseDirectory );
|
49
|
+
directoryCopy( repoRootPath & '/tasks/exercise_template', exerciseDirectory, true );
|
50
|
+
|
51
|
+
// Perform Token replacements
|
52
|
+
command( 'tokenReplace' )
|
53
|
+
.params( '**', '@@name@@', exerciseName )
|
54
|
+
.inWorkingDirectory( exerciseDirectory )
|
55
|
+
.run();
|
56
|
+
|
57
|
+
directoryList( exerciseDirectory, true )
|
58
|
+
.each( function( path ){
|
59
|
+
if( path.findNoCase( '@@name@@' ) ) {
|
60
|
+
fileMove( path, path.replaceNoCase( '@@name@@', exerciseName, 'all' ) );
|
61
|
+
}
|
62
|
+
} );
|
63
|
+
|
64
|
+
print.boldGreenLine( 'New exercise created!' )
|
65
|
+
.line()
|
66
|
+
.greenLine( 'The exercise is located here: ' )
|
67
|
+
.indentedYellowLine( exerciseDirectory )
|
68
|
+
.line()
|
69
|
+
.greenLine( 'Create a sample solution here: ' )
|
70
|
+
.indentedYellowLine( exerciseDirectory & '/Solution.cfc' )
|
71
|
+
.line()
|
72
|
+
.greenLine( 'Test your solution with this command: ' )
|
73
|
+
.indentedYellowLine( 'box task run TestRunner --solution' )
|
74
|
+
.line()
|
75
|
+
.toConsole();
|
76
|
+
|
77
|
+
// Generate test suite
|
78
|
+
command( 'task run' )
|
79
|
+
.params( 'GenerateTests', 'run', slug )
|
80
|
+
.inWorkingDirectory( repoRootPath & '/tasks' )
|
81
|
+
.run();
|
82
|
+
|
83
|
+
}
|
84
|
+
|
85
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
/**
|
2
|
+
* I test all the solutions in each exercise to make sure they all pass.
|
3
|
+
*/
|
4
|
+
component {
|
5
|
+
|
6
|
+
function run() {
|
7
|
+
// Get an array of all the excercise names
|
8
|
+
var exercises = directoryList( expandPath( getDirectoryFromPath( getCurrentTemplatePath() ) & '../exercises' ) );
|
9
|
+
|
10
|
+
// If there's a testrunner task in them, run it. If any of the tasks fail, the exit code will come back as 1
|
11
|
+
exercises.each( function( path ) {
|
12
|
+
if( fileExists( path & '/TestRunner.cfc' ) ) {
|
13
|
+
command( 'task run' )
|
14
|
+
.params( 'TestRunner' )
|
15
|
+
// Specifically as the task runners to run the SolutionTest
|
16
|
+
.flags( 'solution' )
|
17
|
+
.inWorkingDirectory( path )
|
18
|
+
.run();
|
19
|
+
}
|
20
|
+
} );
|
21
|
+
|
22
|
+
}
|
23
|
+
|
24
|
+
}
|
File without changes
|
@@ -0,0 +1,103 @@
|
|
1
|
+
/**
|
2
|
+
* I am a CommandBox task runner which you can use to test your implementation of this exercise against the
|
3
|
+
* provided test suite. To use me, open the CommandBox CLI and run this:
|
4
|
+
*
|
5
|
+
* CommandBox> task run TestRunner
|
6
|
+
*
|
7
|
+
* To start up a test watcher that will automatically rerun the test suite every time you save a file change, run this:
|
8
|
+
*
|
9
|
+
* CommandBox> task run TestRunner --watcher
|
10
|
+
*
|
11
|
+
*/
|
12
|
+
component {
|
13
|
+
|
14
|
+
/**
|
15
|
+
* @solution Runs the tests against the solution
|
16
|
+
* @watcher Start up a file watch that re-runs the tests on file changes. Use Ctrl-C to stop
|
17
|
+
*/
|
18
|
+
function run( boolean solution=false, boolean watcher=false ) {
|
19
|
+
|
20
|
+
ensureTestBox();
|
21
|
+
|
22
|
+
if( watcher ) {
|
23
|
+
|
24
|
+
// Tabula rasa
|
25
|
+
command( 'cls' ).run();
|
26
|
+
|
27
|
+
// Start watcher
|
28
|
+
watch()
|
29
|
+
.paths( '*.cfc' )
|
30
|
+
.inDirectory( getCWD() )
|
31
|
+
.withDelay( 500 )
|
32
|
+
.onChange( function() {
|
33
|
+
|
34
|
+
// Clear the screen
|
35
|
+
command( 'cls' )
|
36
|
+
.run();
|
37
|
+
|
38
|
+
// This is neccessary so changes to tests get picked up right away.
|
39
|
+
pagePoolClear();
|
40
|
+
|
41
|
+
runTests( solution );
|
42
|
+
|
43
|
+
} )
|
44
|
+
.start();
|
45
|
+
|
46
|
+
} else {
|
47
|
+
runTests( solution );
|
48
|
+
}
|
49
|
+
|
50
|
+
}
|
51
|
+
|
52
|
+
/**
|
53
|
+
* Make sure the TestBox framework is installed
|
54
|
+
*/
|
55
|
+
private function ensureTestBox() {
|
56
|
+
var excerciseRoot = getCWD();
|
57
|
+
var testBoxRoot = excerciseRoot & '/testbox';
|
58
|
+
|
59
|
+
if( !directoryExists( testBoxRoot ) ) {
|
60
|
+
|
61
|
+
print.boldYellowLine( 'Installing some missing dependencies for you!' ).toConsole();
|
62
|
+
command( 'install' )
|
63
|
+
.inWorkingDirectory( excerciseRoot )
|
64
|
+
.run();
|
65
|
+
}
|
66
|
+
|
67
|
+
// Bootstrap TestBox framework
|
68
|
+
filesystemUtil.createMapping( '/testbox', testBoxRoot );
|
69
|
+
}
|
70
|
+
|
71
|
+
/**
|
72
|
+
* Invoke TestBox to run the test suite
|
73
|
+
*/
|
74
|
+
private function runTests( boolean solution=false ) {
|
75
|
+
|
76
|
+
// Create TestBox and run the tests
|
77
|
+
testData = new testbox.system.TestBox()
|
78
|
+
.runRaw( directory = {
|
79
|
+
// Find all CFCs...
|
80
|
+
mapping = filesystemUtil.makePathRelative( getCWD() ),
|
81
|
+
// ... in this directory ...
|
82
|
+
recurse = false,
|
83
|
+
// ... whose name ends in "test"
|
84
|
+
filter = function( path ) {
|
85
|
+
return path.reFind( ( solution ? 'Solution' : '' ) & 'Test.cfc$' );
|
86
|
+
}
|
87
|
+
} )
|
88
|
+
.getMemento();
|
89
|
+
|
90
|
+
// Print out the results with ANSI formatting for the CLI
|
91
|
+
getInstance( 'CLIRenderer@testbox-commands' )
|
92
|
+
.render( print, testData, true );
|
93
|
+
|
94
|
+
print.toConsole();
|
95
|
+
|
96
|
+
// Set proper exit code
|
97
|
+
if( testData.totalFail || testData.totalError ) {
|
98
|
+
setExitCode( 1 );
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
102
|
+
}
|
103
|
+
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<!---
|
2
|
+
|
3
|
+
This file will only be used if you want to start up a web server in this directory. You can do so by running:
|
4
|
+
|
5
|
+
$> box
|
6
|
+
CommandBox> install
|
7
|
+
CommandBox> server start
|
8
|
+
|
9
|
+
However, this is not necessary unless you really just want to use the HTML reporters on TestBox.
|
10
|
+
Ideally, you'll skip the need for this file entirely and just run the tests directly frm the CLI like this:
|
11
|
+
|
12
|
+
CommandBox> task run TestRunner
|
13
|
+
|
14
|
+
--->
|
15
|
+
<cfsetting showDebugOutput="false">
|
16
|
+
<cfparam name="url.reporter" default="simple">
|
17
|
+
<cfscript>
|
18
|
+
// get a list of all CFCs in this folder whose name looks like "XXXTest.cfc"
|
19
|
+
// And turn it into compnent path relative to the web root
|
20
|
+
url.bundles = directoryList(
|
21
|
+
path=expandPath( '/' ),
|
22
|
+
filter='*Test.cfc' )
|
23
|
+
.map( function( path ) {
|
24
|
+
return path
|
25
|
+
.replaceNoCase( expandPath( '/' ), '' )
|
26
|
+
.left( -4 )
|
27
|
+
} )
|
28
|
+
.toList();
|
29
|
+
</cfscript>
|
30
|
+
|
31
|
+
<!--- Ensure TestBox --->
|
32
|
+
<cfif fileExists( "/testbox/system/runners/HTMLRunner.cfm" )>
|
33
|
+
<!--- Include the TestBox HTML Runner --->
|
34
|
+
<cfinclude template="/testbox/system/runners/HTMLRunner.cfm">
|
35
|
+
<cfelse>
|
36
|
+
Oops, you don't have TestBox installed yet! Please run <b>box install</b> from the root of your excercise folder and refresh this page.
|
37
|
+
</cfif>
|
@@ -204,6 +204,18 @@
|
|
204
204
|
"Sorting"
|
205
205
|
]
|
206
206
|
},
|
207
|
+
{
|
208
|
+
"uuid": "b3ad38c2-2962-4b47-9b14-20ca262ebff6",
|
209
|
+
"slug": "collatz-conjecture",
|
210
|
+
"core": false,
|
211
|
+
"unlocked_by": null,
|
212
|
+
"difficulty": 1,
|
213
|
+
"topics": [
|
214
|
+
"Integer",
|
215
|
+
"Recursivity",
|
216
|
+
"Mathematics"
|
217
|
+
]
|
218
|
+
},
|
207
219
|
{
|
208
220
|
"uuid": "6c702aa9-70f3-41d0-bc76-4323a08f8fbf",
|
209
221
|
"slug": "meetup",
|
@@ -0,0 +1,84 @@
|
|
1
|
+
## Collatz Conjecture.
|
2
|
+
|
3
|
+
The Collatz Conjecture or 3x+1 problem can be summarized as follows:
|
4
|
+
|
5
|
+
Take any positive integer n. If n is even, divide n by 2 to get n / 2. If n is
|
6
|
+
odd, multiply n by 3 and add 1 to get 3n + 1. Repeat the process indefinitely.
|
7
|
+
The conjecture states that no matter which number you start with, you will
|
8
|
+
always reach 1 eventually.
|
9
|
+
|
10
|
+
Given a number n, return the number of steps required to reach 1.
|
11
|
+
|
12
|
+
## Examples
|
13
|
+
Starting with n = 12, the steps would be as follows:
|
14
|
+
|
15
|
+
0. 12
|
16
|
+
1. 6
|
17
|
+
2. 3
|
18
|
+
3. 10
|
19
|
+
4. 5
|
20
|
+
5. 16
|
21
|
+
6. 8
|
22
|
+
7. 4
|
23
|
+
8. 2
|
24
|
+
9. 1
|
25
|
+
|
26
|
+
Resulting in 9 steps. So for input n = 12, the return value would be 9.
|
27
|
+
|
28
|
+
|
29
|
+
## Submitting Incomplete Solutions
|
30
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
31
|
+
|
32
|
+
## Setup
|
33
|
+
|
34
|
+
Check out [Exercism Help](http://exercism.io/languages/lisp) for instructions to
|
35
|
+
get started writing Common Lisp. That page will explain how to install and setup
|
36
|
+
a Lisp implementation and how to run the tests.
|
37
|
+
|
38
|
+
## Formatting
|
39
|
+
|
40
|
+
While Common Lisp doesn't care about indentation and layout of code,
|
41
|
+
nor whether you use spaces or tabs, this is an important consideration
|
42
|
+
for submissions to exercism.io. Excercism.io's code widget cannot
|
43
|
+
handle mixing of tab and space characters well so using only spaces is recommended to make
|
44
|
+
the code more readable to the human reviewers. Please review your
|
45
|
+
editors settings on how to accomplish this. Below are instructions for
|
46
|
+
popular editors for Common Lisp.
|
47
|
+
|
48
|
+
### VIM
|
49
|
+
|
50
|
+
Use the following commands to ensure VIM uses only spaces for
|
51
|
+
indentation:
|
52
|
+
|
53
|
+
```vimscript
|
54
|
+
:set tabstop=2
|
55
|
+
:set shiftwidth=2
|
56
|
+
:set expandtab
|
57
|
+
```
|
58
|
+
|
59
|
+
(or as a oneliner `:set tabstop=2 shiftwidth=2 expandtab`). This can
|
60
|
+
be added to your `~/.vimrc` file to use it all the time.
|
61
|
+
|
62
|
+
### Emacs
|
63
|
+
|
64
|
+
Emacs is very well suited for editing Common Lisp and has many
|
65
|
+
powerful add-on packages available. The only thing that one needs to
|
66
|
+
do with a stock emacs to make it work well with exercism.io is to
|
67
|
+
evaluate the following code:
|
68
|
+
|
69
|
+
`(setq indent-tab-mode nil)`
|
70
|
+
|
71
|
+
This can be placed in your `~/.emacs` (or `~/.emacs.d/init.el`) in
|
72
|
+
order to have it set whenever Emacs is launched.
|
73
|
+
|
74
|
+
One suggested add-on for Emacs and Common Lisp is
|
75
|
+
[SLIME](https://github.com/slime/slime) which offers tight integration
|
76
|
+
with the REPL; making iterative coding and testing very easy.
|
77
|
+
|
78
|
+
|
79
|
+
## Source
|
80
|
+
An unsolved problem in mathematics named after mathematician Lothar Collatz
|
81
|
+
see more at [collatz conjecture wikipedia]("https://en.wikipedia.org/wiki/3x_%2B_1_problem")
|
82
|
+
|
83
|
+
## Submitting Incomplete Solutions
|
84
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1,31 @@
|
|
1
|
+
(ql:quickload "lisp-unit")
|
2
|
+
#-xlisp-test (load "collatz-conjecture")
|
3
|
+
|
4
|
+
(defpackage #:collatz-conjecture-test
|
5
|
+
(:use #:common-lisp #:lisp-unit))
|
6
|
+
|
7
|
+
(in-package #:collatz-conjecture-test)
|
8
|
+
|
9
|
+
(define-test steps-for-1
|
10
|
+
(assert-equal 0 (collatz-conjecture:collatz 1)))
|
11
|
+
|
12
|
+
(define-test steps-for-16
|
13
|
+
(assert-equal 4 (collatz-conjecture:collatz 16)))
|
14
|
+
|
15
|
+
(define-test steps-for-12
|
16
|
+
(assert-equal 9 (collatz-conjecture:collatz 12)))
|
17
|
+
|
18
|
+
(define-test steps-for-1000000
|
19
|
+
(assert-equal 152 (collatz-conjecture:collatz 1000000)))
|
20
|
+
|
21
|
+
(define-test steps-for-0
|
22
|
+
(assert-equal NIL (collatz-conjecture:collatz 0)))
|
23
|
+
|
24
|
+
(define-test steps-for-negative
|
25
|
+
(assert-equal NIL (collatz-conjecture:collatz (- 0 15))))
|
26
|
+
|
27
|
+
|
28
|
+
#-xlisp-test
|
29
|
+
(let ((*print-errors* t)
|
30
|
+
(*print-failures* t))
|
31
|
+
(run-tests :all))
|