Difference between revisions of "Newbie Guide for Windows People Working on Minor Bugs"

From Dreamwidth Notes
Redirect page
Jump to: navigation, search
(What do you need and why?)
 
(82 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Warn|text=This guide is currently being rewritten to reflect the new workflow. Some things may be unclear, some things may no longer be relevant, some things may be missing. Please be patient.}}
+
#REDIRECT [[Newbie_Guide:_Getting_Started_on_Windows]]
 
+
{{Note|text=Feel free to correct, add, expand, anything that could make this better and clearer. ^_^}}
+
 
+
 
+
= What do you need and why? =
+
 
+
Because we're on Windows, we have to use quite a number of tools to access and manage things so this part might seem a little daunting. The good news is that 1) we're used to being flexible and resourceful, right? 2) once you've got everything set up things will be much simpler.
+
 
+
So what do we need?
+
 
+
 
+
# We need a Dreamhack where we'll clone the Dreamwidth code. Think of it as an online mirror of the Dreamwidth site.
+
# We need a Github account to be able to clone the Dreamwith repository code into our Dreamhack and fetch updates. This is our code source.
+
# We need PuTTY to connect GitHub to our Dreamhack, and to access and manage it. PuTTY is our center of command. We can't do anything without it.
+
# We need WinSCP to visualize the files on our Dreamhack and be able to open them in a text editor.
+
# We need a text editor to edit our files.
+
# We need a Bugzilla account to find bugs, files bugs and upload patches.
+
 
+
 
+
== Get a Dreamhack ==
+
 
+
* Apply for a Dreamhack by [http://hack.dreamwidth.net/apply.shtml filling this form]. The two important fields are 'your desired username' and 'your email address'. Your username is used to manage your Dreamhack and to create the URL where your Dreamhack will be located at so you can pick anything. Your email address is used to send you a welcome e-mail which contains important information as well as various alerts. You can pick any of your existing email addresses or choose to create an email account entirely devoted to your development work.
+
 
+
* Once you're done, you should get an e-mail with your login username and a password. Don't lose it.
+
 
+
 
+
== Create an account on GitHub ==
+
 
+
* Go to [http://www.github.com/ http://www.github.com/], click on 'sign up and pricing' and create a free account. I suggest you pick a username people are familiar with. Ideally the same username you'll have on your Bugzilla account.
+
 
+
 
+
== Install PuTTY ==
+
 
+
* Download 'Windows installer for everything except PuTTYtel' .exe file at [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] and install it.
+
 
+
* Run PuTTY. In the configuration window, enter "hack.dreamwidth.net" for the host name. Go to Connection/Data and enter the username/login given to you in the welcome e-mail. It should be something like dh-username.
+
 
+
* Click on Open. If you get a pop-up message about a key, click Yes.
+
 
+
* Enter the password given to you in the welcome e-mail when asked. Note that no characters are displayed and the cursor won't move. It's normal.
+
 
+
* Change your password by typing:
+
<syntaxhighlight lang="bash">passwd</syntaxhighlight>
+
 
+
* Your default Dreamhack account is called system. Type this to set its password:
+
 
+
<source lang="bash">$LJHOME/bin/upgrading/make_system.pl</source>
+
 
+
 
+
== Install WinSCP ==
+
 
+
* Install [http://winscp.net/eng/download.php WinSCP]. During the installation, you may be asked about the mode you prefer: Commander and Explorer. Commander works like an FTP client: a partitioned window with your computer files on one side and the Dreamhack files on the other. Explorer will only display your Dreamhack files and works like Windows's Explorer. I prefer this mode because I rarely need to access my computer files but choose what's easiest for you.
+
 
+
* Use "hack.dreamwidth.net" for the host name. Enter your username and your new password. Click on Save then on Login.
+
 
+
 
+
== Get a good text editor ==
+
 
+
While you can use Notepad, I recommend [[Editor:_Notepad_plus_plus | Notepad++]] instead. It's free, simple and will make editing much easier.
+
 
+
 
+
== Create a Bugzilla account ==
+
 
+
* Simply [http://bugs.dwscoalition.org/createaccount.cgi click here].
+
 
+
* As <dwuser>mark</dwuser> explained [http://dw-dev.dreamwidth.org/17146.html here], go to [http://bugs.dwscoalition.org/userprefs.cgi?tab=account Name and Password] and enter your name following this format: <code>Name [:username]</code>. 'Name' can be your real name, a nickname, your username again, etc. You don't have to give your real name if you don't want to.
+
 
+
= Setting Things Up =
+
 
+
== On your GitHub account ==
+
 
+
You need to fork the Dreamwidth code onto your own account. Forking is like cloning and branching. It will copy the code and also label your copy as being a branch (a fork) of the original Dreamwidth code.
+
 
+
* Go to https://github.com/dreamwidth/dw-free and click on Fork on the upper right corner.
+
 
+
* Then go to https://github.com/dreamwidth/dw-nonfree and do the same.
+
 
+
 
+
== On your Dreamhack ==
+
 
+
Now you need to 'import' both of these onto your Dreamhack. The free part goes into (<code>~/dw/*</code>) while the non-free part goes into (<code>~/dw/ext/dw-nonfree/*</code>.
+
 
+
* Open PuTTY and type this to kill any process which might be running and stop your hack:
+
 
+
<source lang="bash">killall worker-manager
+
stop-apache</source>
+
 
+
* Then this to move your current code to username-xx:
+
 
+
<source lang="bash">mv $LJHOME $LJHOME-xx</source>
+
 
+
FIXME: is this necessary for new users?
+
 
+
* Type this to clone your GitHub code onto your Dreamhack (replace USERNAME with your GitHub username):
+
 
+
<source lang="bash">git clone https://USERNAME@github.com/USERNAME/dw-free.git $LJHOME</source>
+
 
+
* Then this to link the repo with the original DW repo on GitHub:
+
 
+
<source lang="bash">cd $LJHOME
+
git remote add dreamwidth https://github.com/dreamwidth/dw-free
+
git fetch dreamwidth
+
git branch --set-upstream develop dreamwidth/develop
+
git branch --set-upstream master dreamwidth/master</source>
+
 
+
* Now let's do the same thing with the non-free part of Dreamwidth:
+
 
+
<source lang="bash">cd $LJHOME/ext
+
git clone https://USERNAME@github.com/USERNAME/dw-nonfree.git
+
cd dw-nonfree
+
git remote add dreamwidth https://github.com/dreamwidth/dw-nonfree
+
git fetch dreamwidth
+
git branch --set-upstream develop dreamwidth/develop
+
git branch --set-upstream master dreamwidth/master
+
cd ..</source>
+
 
+
FIXME: add last two steps.
+
 
+
 
+
== Further steps on your Dreamhack ==
+
 
+
These are not mandatory but will make your life easier.
+
 
+
=== Give special abilities to your system account ===
+
 
+
* Log in to your Dreamhack (http://www.yourusername.hack.dreamwidth.net/) using system and your password.
+
 
+
* Go to [http://www.yourusername.hack.dreamwidth.net/admin/priv/ http://www.yourusername.hack.dreamwidth.net/admin/priv/]. Click on 'payments' type 'system' in the User field then click on 'Make Changes'. The system account now has the ability (called 'privilege' or 'priv') to give paid time to any account.
+
 
+
* Go to [http://www.yourusername.hack.dreamwidth.net/admin/pay http://www.yourusername.hack.dreamwidth.net/admin/pay]. Type 'system' in the Edit user field and click on Go. Make your account a seed one.
+
 
+
=== Get rid of invite codes ===
+
 
+
* In WinSCP, go to <code>/dw/cvs/local/etc/</code>, and double-click on <code>config.pl</code>. Find <code>$USE_ACCT_CODES = 1;</code> and change 1 to <code>0</code>. Save your file.
+
 
+
* In PuTTY, type this to make the changes go live on your Dreamhack:
+
 
+
FIXME
+
 
+
 
+
= Making sure things are up-to-date =
+
 
+
== Updating your code ==
+
 
+
* Code is committed by developers all the time. You must regularly update your repositories with the <code>pull</code> command:
+
 
+
FIXME
+
 
+
 
+
== Updating your database ==
+
 
+
FIXME
+
 
+
 
+
= Before You Edit Anything =
+
 
+
== Find or File a Bug ==
+
 
+
* To find: you can use [http://bugs.dwscoalition.org/userprefs.cgi?tab=saved-searches predefined searches] such as [http://bugs.dwscoalition.org/buglist.cgi?cmdtype=dorem&remaction=run&namedcmd=unassigned%20effort-minor&sharer_id=2 unassigned effort-minor].
+
 
+
: Some of these bugs won't appear to require 'minor' effort to you. It's normal. Try to find small bugs among them: minor modifications to be done on one of the site pages (text to be modified; elements to be added, removed or moved; elements to be hidden from some categories of users, etc.).
+
 
+
* To file: make sure it's not already been filed using [http://bugs.dwscoalition.org/query.cgi?format=specific simple search] or [http://bugs.dwscoalition.org/query.cgi?format=advanced advanced search] then [http://bugs.dwscoalition.org/enter_bug.cgi?product=Dreamwidth%20Development use this form] to file a new bug. Fill and edit the fields as needed.
+
 
+
* To assign a bug to yourself, enter your Bugzilla e-mail address in Assign To and set the status to IN_PROGRESS.
+
 
+
: To make this easier, you can also use of <dwuser>fu</dwuser>'s Greasemonkey scripts: [http://www.afunamatata.com/greasemonkey/ Dreamwidth Bug Grabber]. Click on (grab!) next to Assign To and this will edit it and Status for you. Click on Save Changes of course.
+
 
+
== Create a Patch ==
+
 
+
FIXME
+
 
+
= Edit Files =
+
 
+
* Use WinSCP to open the file(s) you need to edit.
+
 
+
* If you're working on site pages, you're working on .bml files. These are in <code>~dw/cvs/dw-free/htdocs/</code> or one of the subsequent folders. You'll see that their names correspond to the URLs of site pages. These files may use .pm modules/widgets which are in <code>~dw/cvs/dw-free/cgi-bin/DW/</code> or <code>~dw/cvs/dw-free/cgi-bin/LJ/</code>.
+
 
+
* For text strings which are not in <code>~dw/cvs/dw-free/htdocs/xxx.bml.text</code> files, see <code>~dw/cvs/dw-free/bin/upgrading/en.dat</code>.
+
 
+
* For more specific searches, you can use the grep command: <code>grep [option(s)] pattern [file(s)]</code>
+
 
+
Interesting options:
+
 
+
-E: match using extended regular expressions
+
-F: match using fixed strings
+
-r: recursive
+
-i: case insensitive
+
-l: filename only
+
-n: add relative line number
+
 
+
Examples:
+
 
+
<syntaxhighlight lang="bash">grep -ri "find this text" * | more</syntaxhighlight>
+
 
+
: This will search for "find this text" in all files.
+
 
+
<syntaxhighlight lang="bash">grep -rl print_entry $LJHOME/bin/upgrading/s2layers</syntaxhighlight>
+
 
+
: This will search for files containing "print_entry" in the /s2layers folder.
+
 
+
= Test Your Changes on Your Dreamhack =
+
 
+
* In PuTTY, stop your Dreamhack:
+
<syntaxhighlight lang="bash">cd $LJHOME
+
stop-apache</syntaxhighlight>
+
 
+
* Update your database:
+
FIXME
+
 
+
* Start your Dreamhack again:
+
<syntaxhighlight lang="bash">start-apache</syntaxhighlight>
+
 
+
* Go to your Dreamhack and test. Edit the files again in WinSCP if more changes are needed. Go through these steps again to test your new changes.
+
 
+
 
+
= Submit Your Patch =
+
 
+
== Update & Save Your Patch ==
+
 
+
FIXME
+
 
+
== Upload Your Patch to Bugzilla ==
+
 
+
* Log in to [http://bugs.dwscoalition.org/ Bugzilla] and open your bug.
+
 
+
* Click on 'Add an Attachment' to attach your patch. Add a description, check 'patch' and set Flags/Commit and Flags/Review to ?. Feel free to add a comment if you have questions or remarks. Click on Submit.
+
 
+
: To help you with this, you can use one of <dwuser>fu</dwuser>'s Greasemonkey scripts: [http://www.afunamatata.com/greasemonkey/ Dreamwidth Patch Upload Defaults]. This will automatically check 'patch' and set the flags for you.
+
 
+
* Wait for someone to review and commit your patch. You're done. :)
+
 
+
* (optional) [[Patches|Further reading on patches]]
+
 
+
= More: Troubleshooting Tips =
+
 
+
== Issues With Text Strings ==
+
 
+
* As <dwuser>denise</dwuser> explained [http://dw-dev-training.dreamwidth.org/13233.html here], you need to delete old text strings and create new ones when you edit .text files or en.dat instead of simply editing the text. If the change isn't critical - the string doesn't need to be renamed or the text change is minor - it's better to notify the site copy team so that text can be changed locally and the original file left alone.
+
 
+
* If text you've modified doesn't appear on the site after a code push, append <code>?uselang=debug</code> to the page URL to make sure it's using the right string. If it is and it still doesn't display after a while, comment on <dwcomm>dw_maintenance</dwcomm>.
+
 
+
== Starting Over ==
+
 
+
* If something's really wrong you can also [[Dreamhack_Troubleshooting#I_want_to_wipe_my_install_and_start_over|rebuild you Dreamhack and start over]].
+
 
+
 
+
= References =
+
 
+
* [http://ss64.com/bash/ Bash commands ]
+
 
+
[[Category:Development]]
+
[[Category:Getting Started]]
+

Latest revision as of 16:20, 13 March 2013