Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update exercise scaffolding setup #225

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
197 changes: 0 additions & 197 deletions tasks/GenerateReadme.cfc

This file was deleted.

6 changes: 3 additions & 3 deletions tasks/GenerateTests.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ component {

if( all ) {

// Get an array of all the excercise names
// Get an array of all the exercise names
var exercises = directoryList( expandPath( getDirectoryFromPath( getCurrentTemplatePath() ) & '../exercises' ) )
.map( function( path ) {
return path.listLast( '/\' );
Expand All @@ -26,7 +26,7 @@ component {

// Acquire slug
if( isNull( arguments.slug ) ) {
arguments.slug = ask( 'Exercise slug as defined by Excercism. Ex: "hello-world": ' );
arguments.slug = ask( 'Exercise slug as defined by Exercism. Ex: "hello-world": ' );
}
var exercises = [ slug ];

Expand Down Expand Up @@ -60,7 +60,7 @@ component {
var testStub = fileRead( repoRootPath & '/tasks/exercise_template/@@name@@Test.cfc' );
testStub = testStub.replace( '@@name@@', exerciseName, 'all' );
testStub = testStub.replace( '@@testCases@@', testCases, 'all' );
var targetExercisePath = repoRootPath & 'exercises/' & slug;
var targetExercisePath = repoRootPath & 'exercises/practice/' & slug;
var newTestPath = targetExercisePath & '/' & exerciseName & 'Test.cfc';

if( !directoryExists( targetExercisePath ) ) {
Expand Down
17 changes: 6 additions & 11 deletions tasks/ScaffoldExercise.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,20 @@ component {
}

// Validation to prevent duplicate runs
var exerciseDirectory = repoRootPath & 'exercises/' & arguments.slug;
var exerciseDirectory = repoRootPath & 'exercises/practice/' & arguments.slug;
if( directoryExists( exerciseDirectory ) ) {
error( 'An exercise named [#arguments.slug#] already exists!' );
}

// Add this exercise to config.json
var configJSON = deserializeJSON( fileRead( repoRootPath & '/config.json' ) );
configJSON.exercises.append( {
configJSON.exercises.practice.append( {
"slug": arguments.slug,
"name": arguments.slug,
"uuid": arguments.uuid,
"practices": [],
"prerequisites": [],
"difficulty": arguments.difficulty+0,
"slug": arguments.slug,
"topics": []
} );
fileWrite( repoRootPath & '/config.json', formatterUtil.formatJSON( json=configJSON, indent=' ' , lineEnding=chr( 10 ), spaceAfterColon=true ) );

Expand Down Expand Up @@ -79,13 +81,6 @@ component {
.params( 'GenerateTests', 'run', slug )
.inWorkingDirectory( repoRootPath & '/tasks' )
.run();

// Generate README.md
command( 'task run' )
.params( 'GenerateReadme', 'run', slug )
.inWorkingDirectory( repoRootPath & '/tasks' )
.run();

}

}
3 changes: 0 additions & 3 deletions tasks/exercise_template/.meta/hints.md

This file was deleted.