diff --git a/html/branches_arent_just_for_birds_problem.html b/html/branches_arent_just_for_birds_problem.html new file mode 100644 index 0000000000..9d852d1241 --- /dev/null +++ b/html/branches_arent_just_for_birds_problem.html @@ -0,0 +1,60 @@ +

Create a new branch for your contribution.

+
+

Git repositories use branches to isolate work when needed. It's + common practice when working on a project or with others on a + project to create a {bold}branch{/bold} to put your changes in. This + way you can do your work while the main, commonly named 'master', + branch stays stable.

+

{cyan}GitHub Pages{/cyan}

+

GitHub.com will automatically serve and host static website files in + branches named 'gh-pages'. Since the project you forked creates a + website, its main branch is 'gh-pages'. All sites like this can be + found using this pattern for the URL:

+

http://githubusername.github.io/repositoryname

+

{bold}{cyan} + Create a branch{/bold} + ---------------{/cyan}

+

When you create a branch, Git copies everything from the current + branch you're on and places it in the branch you've requested.

+

Type git status to see what branch you're currently on (it + should be 'gh-pages')

+

Create a branch and name it "add-", where 'username' is + your username. For instance, "add-jlord".

+

$ git branch

+

Now you have a branch with a new name identical to 'gh-pages'.

+

To go into that branch and work on it, similar to using cd to + change directory in terminal, you {bold}checkout{/bold} a branch.

+

$ git checkout

+

{bold}{cyan} + Create a new file{/bold} + --------------------------{/cyan}

+

Back to the text editor. In the 'contributors' folder, create a + new file named "add-.txt", where 'username' is your + username. For instance, "add-jlord.txt". Then, just write your + GitHub username in it, that's it and that's all. For instance, + I'd type 'jlord' and hit save.

+

{bold}{cyan} + Check-in{/bold} + --------{/cyan}

+

Go through the steps for checking in a project:

+

$ git status + $ git add + $ git commit -m "commit message"

+

Now push your update to your fork on GitHub:

+

$ git push origin

+

Type git-it verify when you're done.

+

{cyan}

+

GIT TIPS

+

You can create and switch to a branch in one line:

+

$ git checkout -b

+

Create a new branch:

+

$ git branch

+

Move onto a branch:

+

$ git checkout

+

List the branches:

+

$ git branch

+

Rename a branch you're currently on:

+

$ git branch -m

+

Verify what branch you're working on

+

$ git status{/cyan}

+
diff --git a/html/commit_to_it_problem.html b/html/commit_to_it_problem.html new file mode 100644 index 0000000000..e5852b167d --- /dev/null +++ b/html/commit_to_it_problem.html @@ -0,0 +1,46 @@ +

Create a file in your new repository, add something to that file and + commit those changes to Git.

+
+

Now that you've got a repository started, add a file to it.

+

{bold}{cyan} + New File{/bold} + --------{/cyan}

+

Open a text editor. Now write a couple of lines of text, perhaps + describe the tastiest sandwich you can imagine, and save the + file as readme.md in the folder you created in the last lesson.

+

{bold}{cyan} + Check, Add and Commit Changes{/bold} + -----------------------------{/cyan}

+

Next check the {bold}status{/bold} of your repository. Below in this terminal, + you should still be within the new folder you created. See if there + are changes listed:

+

$ git status

+

Then {bold}add{/bold} the file you just created to the files you'd + like to {bold}commit{/bold} (aka save) to change.

+

$ git add readme.md

+

Finally, {bold}commit{/bold} those changes to the repository's history with a + short description of the updates. See the command hints below!

+

$ git commit -m "your commit message"

+

{bold}{cyan} + Make More Changes{/bold} + -----------------------------{/cyan}

+

Now add another line to readme.md, perhaps a title, and save.

+

In terminal, you can view the {bold}diff{/bold}erence between the + file now and how it was at your last commit.

+

$ git diff

+

Now with what you just learned above, commit this latest change.

+

When all changes are committed, run git-it verify.

+

{cyan}

+

GIT TIPS

+

{bold}Check status of changes to a repository{/bold}

+

$ git status

+

{bold}View changes to files{/bold}

+

$ git diff

+

{bold}Add a file's changes to be committed{/bold}

+

$ git add

+

{bold}To add all files' changes{/bold}

+

$ git add .

+

{bold}To commit (aka save) the changes you've added with a short + message describing the changes{/bold}

+

$ git commit -m "your commit message"{/cyan}

+
diff --git a/html/forks_and_clones_problem.html b/html/forks_and_clones_problem.html new file mode 100644 index 0000000000..13fb144e00 --- /dev/null +++ b/html/forks_and_clones_problem.html @@ -0,0 +1,50 @@ +

Fork a project from GitHub.com and clone it locally.

+
+

Now you've made a project locally and pushed it to GitHub, but that's + only half the fun. The other half is working with other people and + projects.

+

When you {bold}fork{/bold} a repository, you're creating a copy of it on + your GitHub.com account. Forks are used for creating your own + version of a project or contributing back fixes or features to the + original project.

+

Once a project is forked, you then {bold}clone{/bold} (aka copy) it from + GitHub to your computer to work on locally.

+

{bold}{cyan} + Fork{/bold} + ----{/cyan}

+

The project we'll work with is {bold}www.github.com/jlord/patchwork{/bold}. Go + to that site and click the fork button at the top right. Once the + fork animation is complete, you've got a copy on your account. Copy + your fork's HTTP URL on the right side.

+

{bold}{cyan} + Clone a Repository{/bold} + -------------------{/cyan}

+

Now, in terminal, clone the repository. It will create a new folder + for the repository so no need to create one. But make sure you aren't + cloning it inside of another Git repository folder! So, if you're still + inside of the repository you created in the early challenges, + back out of that folder: cd ..

+

$ git clone

+

Navigate into that folder (in this case, named 'patchwork')

+

$ cd patchwork

+

Now you've got a copy of the repository on your computer and it is + automatically connected to the remote repository (your forked copy) + on your GitHub account.

+

{bold}{cyan} + Connect to the Original Repository{/bold} + ----------------------------------{/cyan}

+

But what if the original repository you forked changes? You'll want + to be able to {bold}pull{/bold} in those changes too. So let's add a remote + connection to the original, {bold}github.com/jlord/patchwork{/bold}, repository + with its URL, found on the right hand side of the original on GitHub.

+

You can name this remote connection anything you want, but often + people use 'upstream', let's use that for this.

+

$ git remote add upstream https://github.com/jlord/patchwork.git

+

When you've done these steps, run git-it verify.

+

{cyan}

+

GIT TIPS

+

{bold}Add remote connections{/bold}

+

$ git remote add

+

{bold}View remote connections{/bold}

+

$ git remote -v{/cyan}

+
diff --git a/html/get_git_problem.html b/html/get_git_problem.html new file mode 100644 index 0000000000..dcfd4c0a13 --- /dev/null +++ b/html/get_git_problem.html @@ -0,0 +1,46 @@ +

Install Git.

+
+

{bold}{cyan} + Get Git{/bold} + --------{/cyan}

+

Git is {bold}open source software{/bold} (free for anyone to use) written + by Linus Torvalds who also wrote the Linux operating system.

+

It is a program for keeping track of changes over time, known in + programming as {bold}version control{/bold}.

+

{cyan}To install Git{/cyan}

+ +
diff --git a/html/githubbin_problem.html b/html/githubbin_problem.html new file mode 100644 index 0000000000..ae4d1d78a9 --- /dev/null +++ b/html/githubbin_problem.html @@ -0,0 +1,25 @@ +

Configure Git and GitHub.

+
+

The repository you've created so far is just on your computer, which + is handy, but makes it pretty hard to share and work with others on. + No worries, that's what GitHub.com is for! In this challenge, + get Git and GitHub configured.

+

{bold}{cyan} + Create a GitHub Account{/bold} + -----------------------{/cyan}

+

GitHub is a website that allows people everywhere to share what + they're working on with Git and to easily work together.

+ +
diff --git a/html/its_a_small_world_problem.html b/html/its_a_small_world_problem.html new file mode 100644 index 0000000000..13612d2ecd --- /dev/null +++ b/html/its_a_small_world_problem.html @@ -0,0 +1,29 @@ +

Add a collaborator.

+
+

Working with others is one of the best things about GitHub because + it makes it easy to work from all over the world at any time.

+

{cyan}Collaborators{/cyan}

+

{bold}Collaborators{/bold} are other GitHub users who are given permission to + make edits to a repository owned by someone else. To add + {bold}collaborators{/bold} to a project, visit the repository's GitHub page + and click the 'Settings' icon on the right side menu. Then select the + 'Collaborators' tab. Type in the username to add and click 'Add'.

+

{bold}{cyan} + Hello, Repo Robot!{/bold} + ------------------{/cyan}

+

Go to the your forked Patchwork repository's page on GitHub and + add 'reporobot' as a collaborator.

+

{bold}http://www.github.com/yourusername/patchwork/settings/collaboration{/bold}

+

When you've added Reporobot as a collaborator to your Patchwork fork, + run git-it verify.

+

{cyan}

+

GIT TIPS

+

{bold}Pull in changes from a remote{/bold}

+

$ git pull

+

{bold}Copy a repository to your computer{/bold}

+

$ git clone

+

{bold}Add remote connections{/bold}

+

$ git remote add

+

{bold}View remote connections{/bold}

+

$ git remote -v{/cyan}

+
diff --git a/html/merge_tada_problem.html b/html/merge_tada_problem.html new file mode 100644 index 0000000000..fe4227869e --- /dev/null +++ b/html/merge_tada_problem.html @@ -0,0 +1,45 @@ +

Merge branch, tidy up and pull upstream for much win!

+
+

Your pull request is being merged! But meanwhile, since you + know that you definitely want those updates in your forked version, + and your branch is in good working order, merge it into the main + branch on your forked repository, in this case, gh-pages.

+

{bold}{cyan} + Merge a branch{/bold} + --------------{/cyan}

+

First, move into the branch you want to merge into (in this case, + branch gh-pages).

+

$ git checkout

+

Now tell Git what branch you want to merge in (in this case, + your feature branch that begins with "add-").

+

$ git merge

+

Tidy up by deleting your feature branch now that it has been merged.

+

$ git branch -D

+

You can also delete the branch from your fork on GitHub:

+

$ git push --delete

+

{bold}{cyan} + Congratulations!{/bold} + ----------------{/cyan}

+

You've created local repositories, remote repositories, worked with + a collaborator, pushed, pulled and joined the millions of others + developing and enriching open source!

+

Visit {bold}jlord.github.io/patchwork{/bold} to see your changes incorporated!

+

And last but not least, if you pull in updates from the original + (since it now shows you on the home page) you'll be up to date + and have a version too, live at: yourusername.github.io/patchwork.

+

$ git pull upstream gh-pages

+

When you've merged your branch, deleted it and pulled from the + original, run git-it verify.

+

{cyan}

+

GIT TIPS

+

{bold}Merge a branch into current branch{/bold}

+

$ git merge

+

{bold}Change the branch you're working on{/bold}

+

$ git checkout

+

{bold}Delete a local branch{/bold}

+

$ git branch -D

+

{bold}Delete a remote branch{/bold}

+

$ git push --delete

+

{bold}Pull from a remote branch{/bold}

+

$ git pull {/cyan}

+
diff --git a/html/pull_never_out_of_date_problem.html b/html/pull_never_out_of_date_problem.html new file mode 100644 index 0000000000..2e163c4b5c --- /dev/null +++ b/html/pull_never_out_of_date_problem.html @@ -0,0 +1,27 @@ +

Keep your file up to date, pull in changes from collaborators.

+
+

If you're working on something with someone you need to stay up + to date with the latest version. So you'll want to {bold}pull{/bold} in any + changes that may have been made.

+

{bold}{cyan} + Pull in Changes{/bold} + -----------------{/cyan}

+

See if Reporobot has made any changes to your 'add-' branch by pulling + in from the remote named 'origin' on GitHub:

+

$ git pull

+

If nothing's changed, it will tell you 'Already up-to-date'. + If there are changes, it will merge those changes into your local + version.

+

Did Reporobot make changes? Git tells you where changes were made. + You can open that file and see Reporobot's updates. Surprise, + Reporobot is an artist!

+

When you've pulled, type git-it verify.

+

{cyan}

+

GIT TIPS

+

{bold}Check Git status{/bold}

+

$ git status

+

{bold}Pull in changes from a remote branch{/bold}

+

$ git pull

+

{bold}See changes to the remote before you pull in{/bold}

+

$ git fetch --dry-run{/cyan}

+
diff --git a/html/remote_control_problem.html b/html/remote_control_problem.html new file mode 100644 index 0000000000..3427c26979 --- /dev/null +++ b/html/remote_control_problem.html @@ -0,0 +1,92 @@ +

Connect your local and remote repositories and push changes.

+
+

GitHub.com stores a {bold}remote{/bold} copy of your repository (it's + 'remote' because that copy is not on your computer, but on a server + elsewhere). By {bold}pushing{/bold} your {bold}local{/bold} (on your computer) + changes to it, you keep it up to date. That way others can always get the + latest, too. And everyone can work on a project together without needing + access to your computer where your local copy is stored.

+

{bold}{cyan} + Create a Remote Repository{/bold} + --------------------------{/cyan}

+

You want to sync your {bold}local{/bold} version with one stored on GitHub.com + called the {bold}remote{/bold} version. So first create an empty + remote repository on GitHub.com.

+ +
+

A note:

+

If you have GitHub for Windows on your computer, a remote + named 'origin' is automatically created. In that case, you'll + just need to tell it what URL to associate with origin. Use this + command instead of the 'add' one above:

+

$ git remote set-url origin

+

Your {bold}local{/bold} version is now connected to the + {bold}remote{/bold} on GitHub.com.

+

{bold}{cyan} + Push Work to your Remote{/bold} + ---------------------------------{/cyan}

+

Next you want to {bold}push{/bold} everything you've done locally + to GitHub.

+

Git has a branching system so that you can work on different + parts of a project at different times. By default the first + branch is named master. When you push (and later pull) from + a project, you tell Git the branch name you want and the + name of the remote that it lives on.

+

$ git push origin master

+

For a visual on how branches work in a project, see this + GitHub Guide: {bold}guides.github.com/overviews/flow/{/bold}

+

Now go to GitHub and refresh the page of your repository. WOAH! + Everything is the same locally and remotely. Congrats on your + first public repository!

+

When you're synced locally and on GitHub.com, run:

+

$ git-it verify

+

{cyan}

+

GIT TIPS

+

{bold}Add remote connections{/bold}

+

$ git remote add

+

{bold}Set a URL to a remote{/bold}

+

$ git remote set-url

+

{bold}Pull in changes{/bold}

+

$ git pull

+

{bold}View remote connections{/bold}

+

$ git remote -v

+

{bold}Push changes{/bold}

+

$ git push {/cyan}

+
diff --git a/html/repository_problem.html b/html/repository_problem.html new file mode 100644 index 0000000000..9e958057d4 --- /dev/null +++ b/html/repository_problem.html @@ -0,0 +1,39 @@ +

Create a new Git repository.

+
+

A {bold}repository{/bold} is essentially a project. You can imagine it + as a project's folder with all the related files inside of it. In + fact, that's what it will look like on your computer anyways.

+

You tell Git what your project is and Git will start tracking all + of the changes to that folder. Files added or subtracted or even + a single letter in a single file added -- all of it's tracked and + time stamped by Git.

+

{bold}{cyan} + Create a Repository{/bold} + -------------------{/cyan}

+

You're going to create a new folder and initialize it as a Git + repository. You'll need some basic terminal (Bash) commands (see + below) for moving around and creating folders (just like you'd do + in Finder or Windows Explorer).

+

To make things easier, name your folder what you'd name the project, + keep it lowercase, no spaces or symbols. How about 'sandwich'.

+

You can type all of this here in your terminal window.

+

To make a new folder:

+

$ mkdir sandwich

+

To go into that folder:

+

$ cd sandwich

+

To create a new Git instance for a project:

+

$ git init

+

That's it! It will just return you to a new line.

+

When you've initialized a new Git repository, run:

+

$ git-it verify

+

{cyan}

+

TERMINAL TIPS

+

{bold}Make a new folder (aka directory){/bold}

+

$ mkdir

+

{bold}Navigate into an existing folder (aka change directory){/bold}

+

$ cd

+

{bold}List the items in a folder{/bold}

+

$ ls

+

{bold}Turn Git on for a folder{/bold}

+

$ git init{/cyan}

+
diff --git a/html/requesting_you_pull_please_problem.html b/html/requesting_you_pull_please_problem.html new file mode 100644 index 0000000000..6d0961b72d --- /dev/null +++ b/html/requesting_you_pull_please_problem.html @@ -0,0 +1,46 @@ +

Submit a Pull Request.

+
+

When you make changes and improvements to a project you've forked, + often you'll want to (and have intended to from the get-go) send + those changes to the maintainer of the original and {bold}request{/bold} that + they {bold}pull{/bold} the changes into the original so that everyone can + benefit from the updates - that's a {bold}pull request{/bold}.

+

We want to add you to the list of workshop finishers, so make + a {bold}pull request{/bold} to the original: {bold}www.github.com/jlord/patchwork{/bold}.

+

{cyan}{bold} + Create a pull request + ---------------------{/bold}{/cyan}

+ +
diff --git a/package.json b/package.json index 29198311a5..70af09e29f 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,8 @@ "dependencies": { "concat-stream": "~1.2.1", "github-oauth": "0.0.4", + "glob": "^3.2.11", + "marked": "^0.3.2", "request": "~2.30.0", "workshopper-jlord": "0.0.0" } diff --git a/site/index.html b/site/index.html new file mode 100644 index 0000000000..3318ce1de5 --- /dev/null +++ b/site/index.html @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + +

Install Git. + + -------------------------------------------------------------------- + {bold}{cyan} + Get Git{/bold} + --------{/cyan} + + Git is {bold}open source software{/bold} (free for anyone to use) written + by Linus Torvalds who also wrote the Linux operating system. + + It is a program for keeping track of changes over time, known in + programming as {bold}version control{/bold}. + + {cyan}To install Git{/cyan} + + - Windows: It's recommended to download GitHub for Windows, + which includes Git and has an easier install: + {bold}windows.github.com{/bold}. + + - Mac: You can also download GitHub for Mac, which includes + Git, {bold}mac.github.com{/bold} (from Preferences, select + the command line tools install), or Git by itself: + {bold}http://git-scm.com/downloads{/bold}. + + - Follow the installation instructions. + + Git isn't like other programs on your computer. You'll likely not + see an icon on your desktop, but it will always be available to you + and you'll be able to access it at anytime from your + terminal (which you're in right now!) or Git desktop applications. + + Once it is installed, open terminal (aka Bash, aka Shell, aka Prompt). + You can verify that it's really there by typing: + + $ git --version + + This will return the version of Git that you're running. + + Next, configure Git so it knows who to associate your changes to: + + Set your name: + + $ git config --global user.name "Your Name" + + Now set your email: + + $ git config --global user.email youremail@example.com + + When you're done type into terminal: + + $ git-it verify + + PRO TIP: Dollar signs are often used in programming documentation + to signify that the line is command line code. You don't actually + type it in, though, only type `git-it verify`. + + When you finish each challenge, type `git-it` to see the menu and + go to the next challenge. Some of the challenges are longer than the + screen, so don't forget to scroll up to where it begins after it + loads! + +

+ + + + + + + diff --git a/txtToHTML.js b/txtToHTML.js new file mode 100644 index 0000000000..3bf9e01638 --- /dev/null +++ b/txtToHTML.js @@ -0,0 +1,28 @@ +var fs = require('fs') +var marked = require('marked') +var glob = require('glob') + +glob("**/*.txt", function (err, files) { + if (err) return console.log("Err globbing") + var matches = [] + files.forEach(function(file) { + if (file.match('problems/')) { + matches.push(file) + } else return + }) + convertToHTML(matches) +}) + +function convertToHTML(files) { + files.forEach(function(file) { + var filename = createFilename(file) + var txt = fs.readFileSync(file) + var html = marked(txt.toString()) + fs.writeFileSync('html/' + filename + '.html', html) + }) +} + +function createFilename(origname) { + var string = origname.split('/').splice(1, 2).join("_") + return string.toString().replace('.txt', '') +}