Skip to content

Commit 3b297a9

Browse files
Make contributing easier and more awesome.
This pull request adds the following: Script Bootstrap ---------------- `script/bootstrap`, conventionally used to get new clones up and running in a single command. This one checks for Ruby and Mongo and then, assuming both are present, installs (if necessary) and runs bundler. The idea is that there are only two things new contributors ever need to do. 1. git clone 2. script/bootstrap If we really like it, we can make it smart enough to recommend ways to *get* MongoDB and Ruby based on the OS, but I feel like that's a bit overkill for a v1. The idea is that contribution should be as smooth as possible so would-be helpers can start helping immediately. The script should remain idempotent so if changes are made to the application, existing contributors can pull, run script/bootstrap, and be ready to go without borking their existing dev instance. One thing this does as a side effect is specify a path for vendored gems and binstubs, this is why the .gitignore changes were made. .ruby-version ------------- Specify a Ruby version using the ruby manager agnostic version of an rvmrc. CONTRIBUTING.md --------------- When you create a new Pull Request or Issue, GitHub will highlight a block above the new issue/PR title calling attention to the repository's CONTRIBUTING.md file, should one exist. This is an expanded version of the Helping Out section from the README.
1 parent cd34a5a commit 3b297a9

5 files changed

Lines changed: 102 additions & 2 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ tmp/
77
.DS_Store
88
*.swp
99
.redcar
10+
bin/

.ruby-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ruby-1.9.3-p392

CONTRIBUTING.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Thanks for helping! #
2+
3+
## Questions ##
4+
5+
If you're asking a question about Hackety Hack itself, check out the [Hackety
6+
Hack repository][hh].
7+
Otherwise, go ahead and open an [issue][issues] and let us know!
8+
9+
## Bugs ##
10+
11+
If you notice a bug in Hackety-Hack.com, this is the place to let us know.
12+
Please tell us:
13+
14+
- Which url the bug occurred at
15+
- What steps we can take to reproduce this bug
16+
- If the bug is visual, including a screenshot is really helpful.
17+
18+
## Pull Requests ##
19+
20+
We :heart: pull requests; We :heart::blue_heart::green_heart: Pull Requests with tests. In fact, we don't want to accept pull requests without relevant tests. If you're not sure if the feature you want is welcome and you want to check with us, feel free to create [an issue][issues] or if you're just totally driven to make it happen, spike it out and open a pull request, but we'll ask you to add tests before it's merged.
21+
22+
23+
[hh]: https://github.com/hacketyhack/hacketyhack
24+
[issues]: https://github.com/hacketyhack/hackety-hack.com/issues

README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,24 @@ If you have any experience writing Rails apps, feel free to help out, we're open
1111
+ **Test your code**, we really can't stress this enough, ideally you should be practicing [TDD][tdd] and writing tests before you even write your code. If you don't test your code, we have no way of knowing if it works properly so please do test.
1212
+ **If it's a major feature, file an issue**, if you file an issue we can discuss certain aspects of the new feature with you and ensure it's a good fit for hackety-hack.com.
1313

14-
Additionally, if you're _not_ a developer and you have a feature you'd really like to see on the site, file an issue and we'll be sure to look into it on your behalf.
14+
## Getting Started ##
15+
16+
Once you've cloned this repository, running `script/bootstrap` should tell you everything you need to know.
17+
18+
Dependencies for the curious:
19+
20+
- Ruby: 1.9.3 is preferred.
21+
- MongoDB: 2.2.x or 2.4.x
22+
23+
As long as you have those things, the script will handle the rest as best it can, including installing the gem dependencies with Bundler.
24+
25+
If the tests aren't passing when you clone, open [an issue][issues] or drop into
26+
[#hacketyhack on freenode][irc].
27+
28+
Additionally, if you're _not_ a developer and you have a feature you'd really like to see on the site, file [an issue][issues] and we'll be sure to look into it on your behalf.
1529

1630
[hh.com]: http://hackety-hack.com/
1731
[hh]: https://github.com/hacketyhack/hacketyhack
18-
[tdd]: http://en.wikipedia.org/wiki/Test-driven_development
32+
[irc]: http://webchat.freenode.net/#hacketyhack
33+
[issues]: https://github.com/hacketyhack/hackety-hack.com/issues
34+
[tdd]: http://en.wikipedia.org/wiki/Test-driven_development

script/bootstrap

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/dash
2+
3+
go_go_gadget_bootstrap() {
4+
check_ruby
5+
check_mongo
6+
check_bundler
7+
bail_unless_chill
8+
good_luck_have_fun
9+
}
10+
11+
check_mongo() {
12+
which mongo > /dev/null 2>&1
13+
if [ $? -ne 0 ]; then
14+
NOMONGO="Hey, in order to remember stuff I need MongoDB"
15+
fi
16+
}
17+
18+
check_bundler() {
19+
if [ -z "$NORUBY" ]; then
20+
which bundle > /dev/null 2>&1
21+
if [ $? -ne 0 ]; then
22+
gem install bundler || exit 2
23+
fi
24+
fi
25+
}
26+
27+
good_luck_have_fun() {
28+
bundle install --path .bundle --binstubs bin
29+
bin/rake spec cucumber
30+
}
31+
32+
check_ruby() {
33+
which ruby > /dev/null 2>&1
34+
if [ $? -ne 0 ]; then
35+
NORUBY="Whoa there, looks like you're missing Ruby!"
36+
else
37+
ruby -v | grep '^ruby 1.9.3' > /dev/null 2>&1
38+
if [ $? -ne 0 ]; then
39+
NORUBY="Hrmm, your Ruby version isn't Ruby 1.9.3, that's really what I prefer."
40+
fi
41+
fi
42+
}
43+
44+
bail_unless_chill() {
45+
if [ "$NORUBY" -a "$NOMONGO" ]; then
46+
echo "$NORUBY"
47+
echo "$NOMONGO"
48+
exit 1
49+
elif [ "$NORUBY" ]; then
50+
echo "$NORUBY"
51+
exit 1
52+
elif [ "$NOMONGO" ]; then
53+
echo "$NOMONGO"
54+
exit 1
55+
fi
56+
}
57+
58+
go_go_gadget_bootstrap

0 commit comments

Comments
 (0)