|
9 | 9 |
|
10 | 10 | ## Support for both RSpec-1 and RSpec-2 |
11 | 11 |
|
12 | | -This RSpec.tmbundle works with both rspec-1 and rspec-2. Given that they work |
13 | | -differently, the RSpec.tmbundle tries its best to figure out which one you're |
14 | | -using in each project when you try to run RSpec examples. There are two |
15 | | -separate parts to this process, and you have some control over how each one |
16 | | -works. |
| 12 | +This `RSpec.tmbundle` works with both rspec-1 and rspec-2. Given |
| 13 | +that they work differently, the `RSpec.tmbundle` tries its best to |
| 14 | +figure out which one you're using in each project when you try to |
| 15 | +run RSpec examples. There are two separate parts to this process, |
| 16 | +and you have some control over how each one works. |
17 | 17 |
|
18 | | -### Load Path |
| 18 | +### LOAD_PATH |
19 | 19 |
|
20 | | -The first thing that happens is that the RSpec.tmbundle prepares the Load Path |
21 | | -as follows: |
| 20 | +The `RSpec.tmbundle` prepares the `LOAD_PATH` as follows: |
22 | 21 |
|
23 | | -If a Gemfile is present, it assumes you want to use Bundler to prepare the Load Path, |
24 | | -so it requires 'bundler' and runs `Bundler.setup` (this can be overridden - see below). |
| 22 | +1. If a `Gemfile` is present, `Bundler` is used to prepare the |
| 23 | +Load Path with `requires 'bundler'` and then `Bundler.setup` is |
| 24 | +executed. (This can be overridden - see below). |
25 | 25 |
|
26 | | -If not using Bundler, then it looks to see if rspec is in vendor/plugins or vendor/gems, |
27 | | -in which cases it adds its lib directory to the Load Path. |
| 26 | +2. If `Bundler` isn't being used, `vendor/plugins` and |
| 27 | +`vendor/gems` are searched for `rspec`. If `rspec` is found, then |
| 28 | +it's `lib` directory is added to `LOAD_PATH`. |
28 | 29 |
|
29 | 30 | ### RSpec-version |
30 | 31 |
|
31 | | -Once the Load Path is prepared, the bundle tries to determine which version of |
32 | | -RSpec to invoke as follows: |
| 32 | +Once the `LOAD_PATH` is prepared, `RSpec-tmbundle` tries to |
| 33 | +determine which version of RSpec to use as follows: |
33 | 34 |
|
34 | | -First, it looks for a ./rspec-tm file in the project root directory. If this |
35 | | -is present, it looks to see if it contains a setting for the RSpec version. To |
36 | | -use this, just add `.rspec-tm` to the project root with: |
| 35 | +1. `RSpec-tmbundle` checks for an `./rspec-tm` file in the |
| 36 | +project's root directory. If that file is exists, then |
| 37 | +`RSpec-tmbundle` attempts to set the RSpec version from the |
| 38 | +configuration found there. |
| 39 | + |
| 40 | +To configure the version using this method add a file named |
| 41 | +`.rspec-tm` to the project's root directory containing: |
37 | 42 |
|
38 | 43 | --rspec-version 2.0.0 |
39 | 44 |
|
40 | | -or which ever version you are using. This is the one fool proof way to ensure |
41 | | -that the right version is invoked, but you don't really need to do this in most |
42 | | -cases. |
| 45 | +or whichever version you are using. |
| 46 | + |
| 47 | +This is the one foolproof way to ensure that the right version is |
| 48 | +invoked, but you don't really need to do this in most cases. |
| 49 | + |
| 50 | +2. If no version is configured, `RSpec-tmbundle` searches for |
| 51 | +`rspec` in the `vendor/gems` and the `vendor/plugins` directories. |
| 52 | +If `rspec` is found, `RSpec-tmbundle` determines the version to |
| 53 | +use based on the files present there. |
| 54 | + |
| 55 | +3. If no version is configured and no rspec directory could be |
| 56 | +found in vendor, then `RSpec-tmbundle` attempts to run rspec-2 |
| 57 | +with: |
43 | 58 |
|
44 | | -If the version is not configured, it then checks to see if rspec was found in |
45 | | -vendor/gems or vendor/plugins. If so, it figures out which version to invoke |
46 | | -based on files present in that rspec directory. |
| 59 | + require 'rspec/core' |
47 | 60 |
|
48 | | -If no version is configured, and no rspec directory is found in vendor, then |
49 | | -it just tries to require 'rspec/core' (for RSpec-2) and then 'spec/autorun' (for |
50 | | -RSpec-1). |
| 61 | +If that raises an exception, `RSpec-tmbundle` makes a final |
| 62 | +attempt by trying to run rspec-1 with: |
51 | 63 |
|
52 | | -### Which approach should I use? |
| 64 | + require 'spec/autorun' |
53 | 65 |
|
54 | | -The effectiveness of each approach is dependent, in part, upon how you manage |
55 | | -your gem environment. The simplest approach to choosing is to first see if it |
56 | | -just works, and if not, then configure the version you want in the .rspec-tm file. |
| 66 | +### Which Approach Should I Use? |
| 67 | + |
| 68 | +The effectiveness of each approach is partially dependent on how |
| 69 | +you manage your gem environment. The simplest (and suggested) |
| 70 | +approach is to first just see if it just works, and if not, then |
| 71 | +configure the version you want in the `.rspec-tm` file. |
57 | 72 |
|
58 | 73 | ## Rubygems |
59 | 74 |
|
60 | | -The RSpec TextMate bundle does not `require "rubygems"` so that users who |
61 | | -choose other packaging mechanisms can still use it. If you _are_ using Rubygems |
62 | | -as your package manager, then the simplest thing to do is |
| 75 | +The RSpec TextMate bundle does not `require "rubygems"` so that |
| 76 | +users who choose other packaging mechanisms can still use it. If |
| 77 | +you _are_ using Rubygems as your package manager, then the |
| 78 | +simplest thing to do is |
63 | 79 |
|
64 | | -* open up TextMate Preferences |
65 | | -* go to the Advanced tab |
| 80 | +* open the TextMate Preferences |
| 81 | +* go to the `Advanced` tab |
66 | 82 | * add a variable named `RUBYOPT` with the value `rubygems` |
67 | 83 |
|
68 | 84 | ## Options |
69 | 85 |
|
70 | | -You can set the following options in an .rspec-tm file in the root directory of |
71 | | -your project: |
| 86 | +You can set the following options in an `.rspec-tm` file in the |
| 87 | +root directory of your project: |
72 | 88 |
|
73 | 89 | ### --rspec-version |
| 90 | + |
74 | 91 | see RSpec-version, above. |
75 | 92 |
|
76 | 93 | ### --bundler |
77 | | -Tell the TMBundle to use Bundler, even if there is no Gemfile (in which case |
78 | | -you should have the BUNDLER_GEMFILE environment variable set). |
| 94 | + |
| 95 | +Use `Bundler`, even if there is no `Gemfile` (in which case you |
| 96 | +should have the `BUNDLER_GEMFILE` environment variable set). |
79 | 97 |
|
80 | 98 | ### --skip-bundler |
81 | | -Tell the TMBundle _not_ to use Bundler, even if there is a Gemfile. |
| 99 | + |
| 100 | +Don't use `Bundler`, even if there is a `Gemfile`. |
82 | 101 |
|
83 | 102 | ## TextMate shell variables |
84 | 103 |
|
85 | | -In addition to the standard TextMate shell variables, the RSpec TextMate bundle |
86 | | -supports the following: |
| 104 | +In addition to the standard TextMate shell variables, the RSpec |
| 105 | +TextMate bundle supports the following: |
87 | 106 |
|
88 | 107 | ### TM_RSPEC_FORMATTER |
89 | | -Use to set a custom formatter other than RSpec's TextMate formatter. Use the |
90 | | -full classname e.g. 'Spec::Core::Formatters::WebKit' |
| 108 | + |
| 109 | +Set a custom formatter other than RSpec's TextMate formatter. Use |
| 110 | +the full classname, e.g. `'Spec::Core::Formatters::WebKit'` |
91 | 111 |
|
92 | 112 | ### TM_RSPEC_OPTS |
93 | | -Use this to set RSpec options just as you would in a .rspec file. |
| 113 | + |
| 114 | +Use this to set RSpec options just as you would in an `.rspec` |
| 115 | +file. |
94 | 116 |
|
95 | 117 | ### TM_RSPEC_HOME |
96 | | -If you're hacking on rspec yourself, point this to the rspec-core project |
97 | | -directory for rspec-2, or the rspec directory for rspec-1. |
| 118 | + |
| 119 | +If you're hacking on rspec yourself, point this to the |
| 120 | +`rspec-core` project directory for rspec-2, or the `rspec` |
| 121 | +directory for rspec-1. |
98 | 122 |
|
99 | 123 | ## RVM Integration |
100 | 124 |
|
101 | | -There are lots of ways to configure TextMate to work with rvm, but this is the |
102 | | -one the we recommend: |
| 125 | +There are lots of ways to configure TextMate to work with `rvm`, |
| 126 | +but this is the one the we recommend: |
103 | 127 |
|
104 | | -First, copy the following into ~/.rvm/bin/textmate_ruby |
| 128 | +First, copy the following into` ~/.rvm/bin/textmate_ruby` |
105 | 129 |
|
106 | 130 | #!/usr/bin/env sh |
107 | 131 | source ~/.rvm/scripts/rvm |
108 | 132 | cd . |
109 | 133 | exec ruby "$@" |
110 | 134 |
|
111 | | -Next, set up a `TM_RUBY` option in TextMate/Preferences/Advanced/Shell |
112 | | -Variables that points to the textmate_ruby command. |
| 135 | +Next, set up a `TM_RUBY` option in |
| 136 | +`TextMate/Preferences/Advanced/Shell Variables` that points to the |
| 137 | +`textmate_ruby` command. |
113 | 138 |
|
114 | 139 | Learn more at: |
115 | 140 |
|
116 | 141 | * [http://beginrescueend.com/integration/textmate/](http://beginrescueend.com/integration/textmate/) |
117 | 142 | * [http://groups.google.com/group/rubyversionmanager/browse_thread/thread/64b84bbcdf49e9b?fwc=1&pli=1](http://groups.google.com/group/rubyversionmanager/browse_thread/thread/64b84bbcdf49e9b?fwc=1&pli=1) |
118 | 143 |
|
119 | 144 | ## History |
120 | | -Parts of RSpec.tmbundle is based on Florian Weber's TDDMate. |
| 145 | + |
| 146 | +Parts of `RSpec.tmbundle` are based on Florian Weber's TDDMate. |
121 | 147 |
|
122 | 148 | ## License |
123 | | -The license of RSpec.tmbundle is the same as [RSpec](http://github.com/rspec/rspec/blob/master/License.txt)'s. |
| 149 | + |
| 150 | +The license of `RSpec.tmbundle` is the same as |
| 151 | +[RSpec](http://github.com/rspec/rspec/blob/master/License.txt)'s. |
124 | 152 |
|
0 commit comments