Skip to content

Commit

Permalink
tweaks, particularly to part interstitials
Browse files Browse the repository at this point in the history
  • Loading branch information
hjwp committed Apr 8, 2014
1 parent 264cbaa commit 652a489
Show file tree
Hide file tree
Showing 11 changed files with 85 additions and 68 deletions.
11 changes: 6 additions & 5 deletions chapter_08.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -1166,8 +1166,6 @@ exec ../virtualenv/bin/gunicorn \ <5>
superlists.wsgi:application
----

// TODO: log files? straight away?

Upstart is joyously simple to configure (especially if you've ever had the
dubious pleasure of writing an `init.d` script), and is fairly
self-explanatory.
Expand Down Expand Up @@ -1401,14 +1399,17 @@ Tests take some of the uncertainty out of deployment::
to show a functional test suite can take some of the uncertainty out of the
process.
Typical pain points - database, static files, dependencies, custom settings::
The things that you need to keep an eye out on any deployment include
your database configuration, static files, software dependencies, and
custom settings that differ between development and production. You'll
need to think through each of these for your own deployments.
Tests allow us to experiment::
Whenever we make a change to our server configuration, we can re-run the
test suite, and be confident that everything works as well as it did
before. It allows us to experiment with our setup with less fear.
//TODO: typical deployment issues? eg "virtualenv, static files, db..."
//TODO: TIP: use a virtualenv from the beginning of your project.
*******************************************************************************


Expand Down
4 changes: 0 additions & 4 deletions chapter_12.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -903,10 +903,6 @@ them to start using Class-Based Views.
******************************************************************************

// In the next chapter, we'll push our changes up to the server. Because we've
// added new constraints to the database, we'll need to prepare a database
// migration first.

NOTE: At this point I want to say a huge thanks to Andrew Godwin and the whole
Django team. Up until Django 1.7, I used to have a whole chapter 13, entirely
devoted to migrations. Migrations now "just work", so I was able to drop it
Expand Down
3 changes: 2 additions & 1 deletion chapter_15.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,8 @@ STATICFILES_DIRS = (

NOTE: You might want to re-introduce the LOGGING setting from earlier at this
point. There's no need for an explicit test for this, and our current test
suite will let us know in the unlikely event that it breaks anything.
suite will let us know in the unlikely event that it breaks anything. As we'll
find out in <<testfixtures-and-logging>>, it'll be useful for debugging later.

And we can quickly run the layout + styling FT to check the CSS all still works:

Expand Down
1 change: 1 addition & 0 deletions part1.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ that fits with TDD. Since it's absolutely essential to serious software
engineering, I'll also be using a version control system (Git), and showing
how and when to do commits, to integrate with the TDD and web development
workflow.
//TODO: lots of talk of TDD, but what is it? we do find out later, but..

We'll be using Django, the Python world's most popular web framework
(probably). I've tried to introduce the Django concepts slowly and one at
Expand Down
13 changes: 10 additions & 3 deletions part2.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ building a website.
But, real developers ship, and in order to ship, we're going to have to tackle
some of the trickier but unavoidable aspects of web development: static files,
form data validation, database migrations, the dreaded JavaScript, but most
hairy of all, deployment to a production server.
form data validation, the dreaded JavaScript, but most hairy of all, deployment
to a production server.
At every stage, TDD can help us to get these things right too.
Expand All @@ -28,5 +28,12 @@ to get you started when you get to your own project, but you will also need
to do your own reading around when you start to apply these topics in "real
life".
Lots of fun stuff coming up!
For example, if you weren't familiar with Django before starting on the book,
you may find that taking a little time to run through the official Django
tutorial at this point would complement what you've learned so far nicely,
and will leave you more confident with the Django stuff over the next few
chapters, so you can focus on the core concepts.
Oh, but there's lots of fun stuff coming up! Just you wait!
--
32 changes: 22 additions & 10 deletions part3.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,32 @@ More advanced topics

[partintro]
--
This may be called the advanced section, but it's full of really important
topics for TDD and web development.
We'll be talking about how to integrate 3rd party systems, and
how to test them. We'll cover mocking, which is a core part of TDD. We'll

"Oh my gosh, what? Another section? Harry, I'm exhausted, it's already
been two hundred pages, I don't think I can handle a whole 'nother section
of the book. Particularly not if it's called "Advanced"... Maybe I can
get away with just skipping it?"
Oh no you can't! This may be called the advanced section, but it's full of
really important topics for TDD and web development. No way can you skip
it. If anything, it's 'even more important' than the first two sections.

We'll be talking about how to integrate 3rd party systems, and how to test
them. Modern web development is all about re-using existing components. We'll
cover mocking and test isolation, which is really a core part of TDD, and a
technique you're going to need for all but the simplest of codebases. We'll
talk about server-side debugging, and test fixtures, and how to set up a
Continuous Integration environment. All of these are vital in any web
development project.
Continuous Integration environment. None of these things are
take-it-or-leave-it optional luxury extras for your project, they're all
vital!


Inevitably, the learning curve does get a little steeper in this section. You
may find yourself having to read things a couple of times before they sink in,
or you may find that things don't work first go, and that you need to do a bit
of debugging on your own. Do persist with it! There's lots of interesting
stuff in here. And I'm always happy to help if you're stuck, just drop me
line.
of debugging on your own. But persist with it! The harder it is, the more
rewarding it is. And I'm always happy to help if you're stuck, just drop me
an email, [email protected]

I hope you've enjoyed the book so far. The best is yet to come, you'll see!
Come on, I promise the best is yet to come!
--
1 change: 1 addition & 0 deletions pre-requisite-installations.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ a decent development setup on a Mac anyway. Check out
http://brew.sh//[brew.sh] for installation instructions. Once installed, it'll
prompt you to go through a few setup steps. You'll need to install XCode from
the app store, which means signing up for a Mac developer ID.
//TODO: look for a non-homebrew way...
Once that's all done, you'll be able to install Python 3 and Pip with one
simple command:
Expand Down
4 changes: 2 additions & 2 deletions preface.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Preface
-------

This book is my attempt to share with the world the journey I've taken from
"hacker" to "software engineer". It's mainly about testing, but there's a lot
more to it, as you'll soon see.
"hacking" to "software engineering". It's mainly about testing, but there's a
lot more to it, as you'll soon see.

I want to thank you for reading it.

Expand Down
14 changes: 3 additions & 11 deletions todos.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
sort out logging in 15.
tests for 17+19
polish final chapter. add wrap-up. polish interstitials
switch to using mockmyid for ch 14/15?
investigate steve young's problems with persona, redirect loop / logout bug
revise appendix 2 on CBVs
update model test at some apposite point
Explain re: "workspace" path and suggest where to put code. sigh.
write a note re: the correct ratio of tests to code, to address the bad review from the bangalorean http://shop.oreilly.com/product/0636920029533.do
thing showing where in the cycle we are?
suggest ppl use a git tag at the end of each chapter.
appendix / box on testing logging, based on blog post?

integrate this video as an intro to django? http://www.youtube.com/watch?v=zTNA0MtZwso

Expand All @@ -19,8 +12,6 @@ pre-requisite-installations.asciidoc://TODO: mention need for knowledge of basic
pre-requisite-installations.asciidoc://TODO: remove on proper release. And add comment re future versions??
pre-requisite-installations.asciidoc://TODO: check on this periodically.
preface.asciidoc://TODO: tighten up this section
appendix_III_provisioning_with_ansible.asciidoc:TODO: comments on switching everything over from fabric?
appendix_III_provisioning_with_ansible.asciidoc:TODO: mention (demo?) Vagrant as a way of spinning up servers + vms
chapter_02.asciidoc://TODO: update if I do write an appendix about BDD
chapter_03.asciidoc://TODO: use .decode instead of comparing bytes.
chapter_04.asciidoc://TODO: shorten this section
Expand All @@ -34,8 +25,6 @@ chapter_07.asciidoc://TODO: screenshot here?
chapter_08.asciidoc://TODO: remove this once django is out
chapter_08.asciidoc://TODO: this could be a good place to pause and make a new chapter.
chapter_08.asciidoc:// TODO: log files? straight away?
chapter_08.asciidoc://TODO: typical deployment issues? eg "virtualenv, static files, db..."
chapter_08.asciidoc://TODO: TIP: use a virtualenv from the beginning of your project.
chapter_10.asciidoc://TODO: change the span to a div.
chapter_10.asciidoc:Cross off our todos:
chapter_12.asciidoc://TODO: we actually need a migration here, but nothing is telling us that!
Expand Down Expand Up @@ -67,3 +56,6 @@ chapter_18.asciidoc://TODO: more stuff here?
chapter_20.asciidoc://TODO: check on this when newer seleniae come out
chapter_21.asciidoc://TODO: rename Oni to Francis, as per ch. 6?
chapter_21.asciidoc://TODO: consider the fact that the lists page has that too...

appendix_III_provisioning_with_ansible.asciidoc:TODO: comments on switching everything over from fabric?
appendix_III_provisioning_with_ansible.asciidoc:TODO: mention (demo?) Vagrant as a way of spinning up servers + vms
8 changes: 6 additions & 2 deletions update_source_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ def fetch_if_possible(target_dir):
if fetch.returncode:
if 'Name or service not known' in stderr.decode():
# no internet
return
print('No Internet')
return False
raise Exception("Error running git fetch")
return True



Expand All @@ -43,7 +45,9 @@ def update_sources_for_chapter(chapter_no):
['git', 'log', '-n 1', '--format=%H'], cwd=target
).decode().strip()
print('current commit', commit_specified_by_submodule)
fetch_if_possible(target)
connected = fetch_if_possible(target)
if not connected:
return
if chapter_no > 1:
subprocess.check_output(['git', 'checkout', chapter_before], cwd=target)
subprocess.check_output(['git', 'reset', '--hard', 'origin/{}'.format(chapter_before)], cwd=target)
Expand Down
62 changes: 32 additions & 30 deletions wordcount
Original file line number Diff line number Diff line change
@@ -1,34 +1,36 @@
402 1755 14016 appendix_II_Django_Class-Based_Views.asciidoc
602 2305 18341 appendix_II_Django_Class-Based_Views.asciidoc
177 627 4942 appendix_III_provisioning_with_ansible.asciidoc
147 661 4921 appendix_I_PythonAnywhere.asciidoc
18 88 1124 bibliography.asciidoc
41 40 1117 book.asciidoc
345 1929 12756 chapter_01.asciidoc
384 2189 14570 chapter_02.asciidoc
820 3791 27365 chapter_03.asciidoc
821 4445 30746 chapter_04.asciidoc
1356 6587 45722 chapter_05.asciidoc
2084 9017 67266 chapter_06.asciidoc
889 3704 28278 chapter_07.asciidoc
1388 6526 45875 chapter_08.asciidoc
561 2890 25795 chapter_09.asciidoc
1355 5348 41134 chapter_10.asciidoc
1184 4354 35183 chapter_11.asciidoc
829 2736 24152 chapter_12.asciidoc
504 2305 17132 chapter_13.asciidoc
552 2335 17344 chapter_14.asciidoc
1969 7732 61615 chapter_15.asciidoc
1578 4826 42783 chapter_16.asciidoc
852 3133 27909 chapter_17.asciidoc
715 2301 20010 chapter_18.asciidoc
774 3289 27134 chapter_19.asciidoc
521 2164 17566 chapter_20.asciidoc
226 1320 9053 chapter_21.asciidoc
179 980 6016 chapter_22.asciidoc
200 1162 7112 appendix_IV_what_to_do_next.asciidoc
23 116 1334 bibliography.asciidoc
40 38 1126 book.asciidoc
365 1993 13288 chapter_01.asciidoc
402 2251 15223 chapter_02.asciidoc
825 3782 27540 chapter_03.asciidoc
828 4335 30576 chapter_04.asciidoc
1453 6975 48839 chapter_05.asciidoc
2201 9373 69918 chapter_06.asciidoc
952 3913 30140 chapter_07.asciidoc
1426 6697 47843 chapter_08.asciidoc
632 3251 28620 chapter_09.asciidoc
1459 5563 43526 chapter_10.asciidoc
1232 4463 36432 chapter_11.asciidoc
914 3105 27516 chapter_12.asciidoc
299 1356 11021 chapter_13.asciidoc
592 2541 18653 chapter_14.asciidoc
2112 8507 66929 chapter_15.asciidoc
1809 5862 50939 chapter_16.asciidoc
1175 4198 37178 chapter_17.asciidoc
816 3151 25266 chapter_18.asciidoc
1688 5805 48703 chapter_19.asciidoc
882 3699 30656 chapter_20.asciidoc
580 2564 20458 chapter_21.asciidoc
456 2992 20125 chapter_22.asciidoc
90 601 3597 epilogue.asciidoc
160 670 4313 outline_and_future_chapters.asciidoc
40 297 1715 part1.asciidoc
30 201 1287 part2.asciidoc
22 166 932 part3.asciidoc
370 2372 14986 preface.asciidoc
239 1826 11601 pre-requisite-installations.asciidoc
21532 92604 706358 total
32 201 1273 part2.asciidoc
23 170 958 part3.asciidoc
385 2437 15260 preface.asciidoc
249 1828 11649 pre-requisite-installations.asciidoc
25266 107489 825930 total

0 comments on commit 652a489

Please sign in to comment.