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

New exercise template and scaffold #28

Merged
merged 26 commits into from
Sep 19, 2017

Conversation

bdw429s
Copy link
Contributor

@bdw429s bdw429s commented Sep 11, 2017

This is a template for exercises going forward as well as a CLI task runner for future contributors to easily scaffold out a fresh exercise. To use the scaffold a contributor can simply run this command and follow the prompts to supply the slug, name (defaults to camel-cased slug without hyphens), and difficulty level (defaults to 1).

box task run tasks/ScaffoldExercise

This command will:

  1. Add the new exercise to the /config.json (generates a new UUID, I assume each lang/exercise is unique)
  2. Create the exercise folder and populate it with the template
  3. Rename placeholder files
  4. Replace text tokens inside the template files with exercise name
  5. Output instructions to the user with the location of the new exercise on their hard drive and their next steps.

Example usage:

box task run tasks/ScaffoldExercise
Exercise slug as defined by Excercism. Ex: "hello-world": word-count
Exercise Name, camel cased and one word. Ex: "HelloWorld": WordCount
Difficulty: 1

New exercise created!

The exercise is located here:
  C:\Users\Brad.development\Documents\GitHub\coldfusion\exercises/word-count

The next steps are to create the unit tests here:
  C:\Users\Brad.development\Documents\GitHub\coldfusion\exercises/word-count/WordCountTest.cfc

Then create a sample solution here:
  C:\Users\Brad.development\Documents\GitHub\coldfusion\exercises/word-count/Solution.cfc

Test your solution with this command:
  box task run TestRunner --solution

@bdw429s
Copy link
Contributor Author

bdw429s commented Sep 11, 2017

The "Files Changed" are cluttered with changes from the unmerged pull that this was branched from. All changes are in this commit:
2e672db

@Insti
Copy link

Insti commented Sep 11, 2017

You can get rid of those other changes that you don't need for this PR by rebasing onto master.

git checkout exercise-scaffold
git rebase --onto master ex-excercise-setup

This should leave you with just the differences between the end of ex-exercise-setup and the exercise-scaffold branch as changes to master. You can then force push the exercise-scaffold branch and end up with a cleaner PR.

This is useful for keeping your PRs 'clean' when you don't have to worry about conflicting file modifications.

@bdw429s
Copy link
Contributor Author

bdw429s commented Sep 11, 2017

Thx for the tup @Insti but I'd like to clarify a couple things (Even after using Git for years I'm always a little afraid I'll screw it up!)

  • Are you saying I should run these commands now before the pull/branch that this pull/branch was branched from is merged? Or are these commands something I should do after the parent commits are merged into master?
  • To clarify, there are probably files and directories referenced in this pull which don't even exist on master yet, but were created in the previous pull. I'm unclear on how that will be handled if I try to rebase directly to master which is still at a point in history where some of these files didn't exist yet or looked different. This is why I branched this pull from the previous branch since they build on each other.

Thanks!

@Insti
Copy link

Insti commented Sep 11, 2017

  1. It's something you can do now. (after it becomes a no-op)

  2. I think in this PR the changes are independent, but git tends to be pretty good about working out what should be where. I think it will complain about conflicts if it won't work well.

I usually do this on codebases I'm more familiar with so I have a better idea of what should be happening. It's probably OK to keep doing what you're doing if you don't want to risk it.

@bdw429s
Copy link
Contributor Author

bdw429s commented Sep 11, 2017

I still feel like this cartoon sometimes even after years of Git usage :)

https://xkcd.com/1597/

@bdw429s bdw429s merged commit 9d65d65 into exercism:master Sep 19, 2017
@bdw429s bdw429s deleted the exercise-scaffold branch October 14, 2017 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants