This is the code for the shescoding.org website.
She's Coding is an open-source website project currently under development in cooperation with the documentary film CODE: Debugging the Gender Gap. She’s Coding is meant to serve as the destination for anyone who wants to learn more about the gender gap problem in computer science and become part of the solution.
Open-source?
Yes! She's Coding is built by the community, for the community. We currently have a small group of volunteers bootstrapping the project, and we are in the process of defining some simple rules on how to contribute for the wider community.
Let us know if you want to join our team!
Mac OSX: Install Homebrew:
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
-
Set the Ruby version to 2.5.3. In order to be able to pick the ruby version or to download ruby, we recommend using a ruby version manager. There are 2 ruby version management tools: rvm and rbenv.
-
Install rvm:
$ \curl -sSL https://get.rvm.io | bash -s stable
-
Install Ruby:
$ rvm install 2.5.3
-
Select this version of ruby for use in this project:
$ rvm use 2.5.3
-
Select this version for use:
$ rvm use 2.5.3
-
Install rbenv:
$ brew install rbenv
-
Install Ruby:
$ rbenv install 2.5.3
-
Check ruby version:
$ ruby -v
You should see ruby version printed as result:
ruby 2.5.3xxx
and xxx represents the revision and the architecture of the installed version.-
Change your ruby version locally inside shescoding-dot-org repository:
$ cd shescoding-dot-org $ rbenv local 2.5.3
-
-
Install Postgresql
-
Mac:
Install:
$ brew install postgresql
Initialize the postgres database:
$ initdb /usr/local/var/postgres
Start the postgres server:
$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
-
Ubuntu:
See [https://help.ubuntu.com/community/PostgreSQL]
For simple setup (local use only) follow the "Alternate Server Setup" of the resource provided above.
-
-
Set up the database
$ createdb shescoding_development $ psql -d shescoding_development -c "CREATE USER shescoding WITH PASSWORD 'shescoding'" $ psql -d shescoding_development -c "GRANT ALL PRIVILEGES ON DATABASE shescoding_development to shescoding"
-
Set up your local repo
-
Fork the repository by hitting the "Fork" button on the shescoding github page.
-
Clone the repository:
$ git clone https://github.com/shescoding/shescoding-dot-org.git
-
Add the upstream repository:
$ git remote add upstream https://github.com/shescoding/shescoding-dot-org.git
-
-
To complete installation, skip past the directions for Windows 10 here
Go to Windows App Store and download the most stable version of Ubuntu, then
-
Go to developer settings by searching "Developer"
-
In the results under Settings, click For developer settings
-
Select Developer Mode
Open the Ubuntu app and complete setup (username, password, etc.), then run:
$ sudo apt-get update
-
Install Ruby
After update completes, install Ruby, your version manager, and Rails as you would for Ubuntu:
(NOTE: the below command also installs dependencies such as nodejs and yarn)
$ sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev nodejs yarn
-
Install RVM or RBENV
$ sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev $ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB $ curl -sSL https://get.rvm.io | bash -s stable $ source ~/.rvm/scripts/rvm $ rvm install 2.5.3 $ rvm use 2.5.3 --default $ ruby -v
$ git clone https://github.com/rbenv/rbenv.git ~/.rbenv $ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc $ echo 'eval "$(rbenv init -)"' >> ~/.bashrc $ exec $SHELL $ git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc exec $SHELL $ rbenv install 2.5.3 $ rbenv global 2.5.3 $ ruby -v
-
Upload SSH Key to Github
-
Generate an SSH key for your github account
$ ssh-keygen -t rsa -b 4096 -C "[email protected]"
-
Open the file containing the key from your Windows folder below:
C:\Users\YourWindowsUserName\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu16.04onWindows_79rhkp1fndgsc\LocalState\rootfs\home\YourUbuntuUserName\.ssh
-
Open id_rsa.pub with either notepad or notepad++.
-
Copy everything in that file and set up your key in your github page.
-
-
Install Postgresql
(NOTE: Google Chrome will block these downloads for security reasons. Please download using Firefox or Edge)
Install postgres from EnterpriseDB
Set up your username and password defaults. You will not need to set up a specialized name or password when developing in Windows, but you will need to add these to the database.yml file later.
Install PGAdmin4 with postgres in the installer, or download manually from PGAdmin for Windows
-
Set up the Database
Run PGAdmin4
-
If PGAdmin4 will not run, try the following:
Clear all Roaming Data:
C:\Users\YourUserName\AppData\Roaming\pgAdmin
Download Oracle Java and set up the evironment variable path
C:\Program Files (x86)\Common Files\Oracle\Java\javapath
Once PGAdmin4 is running, click on your servers, right click on PostreSQL, hover over Create, and then click Database
Type shescoding_development in the Database field and select the owner. I recommend using your general postgres user
-
-
Set up your local repo
-
Open your Ubuntu for Windows Application
-
Change your directory to your Windows location, such as Desktop
$ cd /mnt/c/users/YourWindowsUserName/desktop
-
You can see the Ubuntu file directory if you wish, but it is not necessary unless you need to copy your SSH Keys for Github or other repositories
C:\Users\YourWindowsUserName\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu16.04onWindows_79rhkp1fndgsc\LocalState\rootfs\home\YourUbuntuUserName
-
Now clone the repository
$ git clone https://github.com/shescoding/shescoding-dot-org.git
-
Add the upstream repository:
$ git remote add upstream https://github.com/shescoding/shescoding-dot-org.git
-
Change the directory to your development environment
$ cd shescoding-dot-org
-
Open your database.yml file and make the following changes
- Under default: &default
host: localhost
- Under development:
username: YourPostGresUserName password: YourPostGresPassword
-
-
With PGAdmin4 still running, complete setup by following the steps below.
-
Load all the gems:
$ bundle install
-
Run database migrations:
$ rake db:migrate
-
Seed the database:
$ rake db:seed
-
Start the Rails server:
$ rails s
-
Visit the project at localhost:3000
Please do not commit and push directly to the master branch! The hooks/pre-commit file in this repository contains a pre-commit hook that warns you if you are checking directly into master. In order to enable this hook, from the root of the repo do:
$ cp hooks/pre-commit .git/hooks/
$ chmod +x .git/hooks/pre-commit
In order to run the tests, make sure all the gems are installed and the test environment is set up properly with working database.
- Set up:
$ bundle install
$ bundle exec rake db:create RAILS_ENV=test
$ bundle exec rake db:schema:load RAILS_ENV=test
- Run the tests with RSpec Rails:
$ bundle exec rspec -fd
Notes:
-fd
stands for full details. You can also run tests by using commandsbundle exec rspec
orbundle exec rake
to get an overview without details of each test.- If you are having trouble running bundle install, please make sure Nokogiri gem is installed on your machine. Full instructions can be found here.
This project uses a tool called JSHint for linting (quality-checking) Javascript code. If you want to see this tool in action, check out the creator's interactive demo.
- Run the Javascript asset linting with JSHint:
$ bundle exec rake jshint
Note: Any contributor who makes changes to existing Javascript files or adds new ones, needs to run JSHint to make sure erroneous files don't get committed to the codebase.