- ΠΠΎΠΏΡΠ°ΠΊΡΠΈΠΊΠΎΠ²Π°ΡΡΡΡ Π² Π½Π°ΡΡΡΠΎΠΉΠΊΠ΅ ΠΌΠΎΠ½ΠΈΡΠΎΡΠΈΠ½Π³Π°
- ΠΠΎΠΏΡΠ°ΠΊΡΠΈΠΊΠΎΠ²Π°ΡΡΡΡ Π² ΠΏΠΎΠΈΡΠΊΠ΅ Π²ΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎΡΡΠ΅ΠΉ Π΄Π»Ρ ΠΎΠΏΡΠΈΠΌΠΈΠ·Π°ΡΠΈΠΈ
- ΠΠΎΠΏΡΠ°ΠΊΡΠΈΠΊΠΎΠ²Π°ΡΡΡΡ Π² ΠΏΡΠΎΠ²Π΅ΡΠΊΠ΅ Π³ΠΈΠΏΠΎΡΠ΅Π· ΠΈ ΠΎΠ±ΠΎΡΠ½ΠΎΠ²Π°Π½ΠΈΠΈ ΠΏΡΠ΅Π΄Π»ΠΎΠΆΠ΅Π½ΠΈΠΉ ΠΏΠΎ ΠΎΠΏΡΠΈΠΌΠΈΠ·Π°ΡΠΈΠΈ
- ΠΠΎΠ·Π½Π°ΠΊΠΎΠΌΠΈΡΡΡΡ Ρ ΠΈΠ½ΡΠ΅ΡΠ΅ΡΠ½ΡΠΌ ΠΆΠΈΠ²ΡΠΌ open-source ΠΏΡΠΎΠ΅ΠΊΡΠΎΠΌ
- ΠΠ°Π²Π΅ΡΡΠΈ dev.to Π»ΠΎΠΊΠ°Π»ΡΠ½ΠΎ
- ΠΠ°ΡΡΡΠΎΠΈΡΡ ΡΠ²ΠΎΠΉ Skylight Π΄Π»Ρ ΠΌΠΎΠ½ΠΈΡΠΎΡΠΈΠ½Π³Π° Π»ΠΎΠΊΠ°Π»ΡΠ½ΠΎΠ³ΠΎ dev.to
- ΠΠ°ΡΡΡΠΎΠΈΡΡ ΡΠ²ΠΎΠΉ NewRelic Π΄Π»Ρ ΠΌΠΎΠ½ΠΈΡΠΎΡΠΈΠ½Π³Π° Π»ΠΎΠΊΠ°Π»ΡΠ½ΠΎΠ³ΠΎ dev.to
- ΠΠ°ΡΡΡΠΎΠΈΡΡ ΡΠ²ΠΎΠΉ Scout Π΄Π»Ρ ΠΌΠΎΠ½ΠΈΡΠΎΡΠΈΠ½Π³Π° Π»ΠΎΠΊΠ°Π»ΡΠ½ΠΎΠ³ΠΎ dev.to
- ΠΠ°ΡΡΡΠΎΠΈΡΡ ΡΠ²ΠΎΠΉ Prometheus + Grafana Π΄Π»Ρ ΠΌΠΎΠ½ΠΈΡΠΎΡΠΈΠ½Π³Π° Π»ΠΎΠΊΠ°Π»ΡΠ½ΠΎΠ³ΠΎ dev.to
ΠΡΠ΅ ΠΈΠ½ΡΡΡΡΠΌΠ΅Π½ΡΡ ΠΌΠΎΠ½ΠΈΡΠΎΡΠΈΠ½Π³Π° ΠΏΠΎΠΊΠ°Π·ΡΠ²Π°ΡΡ, ΡΡΠΎ ΡΠ°ΠΌΠΎΠΉ Π³ΠΎΡΡΡΠ΅ΠΉ ΡΠΎΡΠΊΠΎΠΉ ΡΠ²Π»ΡΠ΅ΡΡΡ Π³Π»Π°Π²Π½Π°Ρ ΡΡΡΠ°Π½ΠΈΡΠ°, StoriesController#index
.
Π ΡΠ°ΡΡΠ½ΠΎΡΡΠΈ, Π·Π°ΠΌΠ΅ΡΠ½ΠΎΠ΅ Π²ΡΠ΅ΠΌΡ Π·Π°Π½ΠΈΠΌΠ°Π΅Ρ ΡΠ΅Π½Π΄Π΅ΡΠΈΠ½Π³ partial
-ΠΎΠ² _single_story.html.erb
.
Π Π°ΡΡΠΌΠΎΡΡΠΈΡΠ΅ Π³ΠΈΠΏΠΎΡΠ΅Π·Ρ ΠΎ ΡΠΎΠΌ, ΡΡΠΎ ΠΌΠΎΠΆΠ½ΠΎ Π·Π°ΠΊΠ΅ΡΠΈΡΠΎΠ²Π°ΡΡ <%= render "articles/single_story", story: story %>
Π² _main_stories_feed.html.erb
ΠΈ ΡΡΠΎ Π΄Π°ΡΡ Π·Π°ΠΌΠ΅ΡΠ½ΡΠΉ ΡΡΡΠ΅ΠΊΡ.
- ΠΠ΅ Π·Π°Π±ΡΠ΄ΡΡΠ΅ Π²ΠΊΠ»ΡΡΠΈΡΡ Π»ΠΎΠΊΠ°Π»ΡΠ½ΠΎΠ΅ ΠΊΡΡΠΈΡΠΎΠ²Π°Π½ΠΈΠ΅ (
touch tmp/caching-dev.txt
) - ΠΠ°Π³ΡΡΠ·ΠΈΡΠ΅ Π³Π»Π°Π²Π½ΡΡ ΡΡΡΠ°Π½ΠΈΡΡ Π·Π°ΠΏΡΠΎΡΠ°ΠΌΠΈ, ΡΠ°ΠΊ ΡΡΠΎΠ±Ρ ΠΎΠ½ΠΈ ΠΎΡΡΠ°Π·ΠΈΠ»ΠΈΡΡ Π² ΡΠΈΡΡΠ΅ΠΌΠ°Ρ ΠΌΠΎΠ½ΠΈΡΠΎΡΠΈΠ½Π³Π°
- Π‘Π΄Π΅Π»Π°ΠΉΡΠ΅
benchmark
Ρ ΠΏΠΎΠΌΠΎΡΡΡab
- Π‘Π΄Π΅Π»Π°ΠΉΡΠ΅ ΠΎΠΏΡΠΈΠΌΠΈΠ·Π°ΡΠΈΡ
- Π‘Π½ΠΎΠ²Π° Π½Π°Π³ΡΡΠ·ΠΈΡΠ΅ ΡΡΡΠ°Π½ΠΈΡΡ Π·Π°ΠΏΡΠΎΡΠ°ΠΌΠΈ ΠΈ ΠΏΠ΅ΡΠ΅Π·Π°ΠΏΡΡΡΠΈΡΠ΅
benchmark
ΠΡΠ»ΠΈ Π²Ρ ΠΏΠΎΡΡΠΈΡΠ°Π΅ΡΠ΅, ΡΡΠΎ ΠΏΡΠΈΠΌΠ΅Π½ΠΈΡΡ ΠΊΡΡΠΈΡΠΎΠ²Π°Π½ΠΈΠ΅ Π·Π΄Π΅ΡΡ ΡΠ΅Π»Π΅ΡΠΎΠΎΠ±ΡΠ°Π·Π½ΠΎ, ΠΎΡΠΎΡΠΌΠΈΡΠ΅ ΠΎΠ±ΠΎΡΠ½ΠΎΠ²Π°Π½Π½ΡΠΉ PR
Ρ ΡΡΠΈΠΌ ΠΏΡΠ΅Π΄Π»ΠΎΠΆΠ΅Π½ΠΈΠ΅ΠΌ. ΠΠ°ΠΏΠΈΡΠΈΡΠ΅ Π² ΠΎΠΏΠΈΡΠ°Π½ΠΈΠΈ PR
, ΠΊΠ°ΠΊΠ°Ρ Π±ΡΠ»Π° Π³ΠΈΠΏΠΎΡΠ΅Π·Π°, ΠΎΡΠΊΡΠ΄Π° ΠΎΠ½Π° Π²Π·ΡΠ»Π°ΡΡ, ΠΊΠ°ΠΊ Π²Ρ ΠΏΡΠΎΠ²Π΅ΡΡΠ»ΠΈ Π³ΠΈΠΏΠΎΡΠ΅Π·Ρ, ΠΊΠ°ΠΊΠΈΠ΅ ΡΠ΅Π·ΡΠ»ΡΡΠ°ΡΡ ΠΏΠΎΠ»ΡΡΠΈΠ»ΠΈ. ΠΡΠΈΠ»ΠΎΠΆΠΈΡΠ΅ ΡΠΊΡΠΈΠ½ΡΠΎΡΡ Π³ΡΠ°ΡΠΈΠΊΠΎΠ² ΠΌΠΎΠ½ΠΈΡΠΎΡΠΈΠ½Π³Π°, Π΅ΡΠ»ΠΈ Π½Π° Π½ΠΈΡ
Π²ΠΈΠ΄Π΅Π½ ΡΡΡΠ΅ΠΊΡ ΠΎΠΏΡΠΈΠΌΠΈΠ·Π°ΡΠΈΠΈ.
ΠΠ±ΡΠ°ΡΠΈΡΠ΅ Π²Π½ΠΈΠΌΠ°Π½ΠΈΠ΅ Π½Π° ΠΊΠ»Π°ΡΡ FlareTag
. ΠΠ½ ΡΠΈΠ³ΡΡΠΈΡΡΠ΅Ρ Π² ΠΎΡΡΡΡΠ°Ρ
ΡΠΈΡΡΠ΅ΠΌ ΠΌΠΎΠ½ΠΈΡΠΎΡΠΈΠ½Π³Π° ΠΊΠ°ΠΊ ΡΠ°ΡΡΠΎ Π²ΡΠ·ΡΠ²Π°Π΅ΠΌΡΠΉ ΠΊΠΎΠ΄ ΠΏΡΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΡ. ΠΠΎΠΆΠ½ΠΎ Π»ΠΈ ΠΎΠΏΡΠΈΠΌΠΈΠ·ΠΈΡΠΎΠ²Π°ΡΡ ΡΡΠΎ-ΡΠΎ Π² ΡΡΠΎΠΌ ΠΊΠ»Π°ΡΡΠ΅, ΠΈΠ»ΠΈ Π² ΠΌΠ΅ΡΠΎΠ΄Π°Ρ
, ΠΊΠΎΡΠΎΡΡΠ΅ ΠΎΠ½ ΠΈΡΠΏΠΎΠ»ΡΠ·ΡΠ΅Ρ?
ΠΡΠ»ΠΈ Π²Ρ ΠΏΡΠΈΠ΄ΡΠΌΠ°Π΅ΡΠ΅ ΠΊΠ°ΠΊ Π΅Π³ΠΎ ΠΎΠΏΡΠΈΠΌΠΈΠ·ΠΈΡΠΎΠ²Π°ΡΡ, ΠΏΠΎΠΏΡΠΎΠ±ΡΠΉΡΠ΅ ΡΠ΄Π΅Π»Π°ΡΡ ΠΎΠ±ΠΎΡΠ½ΠΎΠ²Π°Π½Π½ΡΠΉ PR
, ΠΊΠ°ΠΊ Π² ΠΎΡΠ½ΠΎΠ²Π½ΠΎΠΉ ΡΠ°ΡΡΠΈ Π·Π°Π΄Π°Π½ΠΈΡ.
ΠΠΎΠ±Π΅ΠΉΡΠ΅ΡΡ Π·Π°ΠΏΡΡΠΊΠ° ΠΏΡΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΡ Π² ΡΠ΅ΠΆΠΈΠΌΠ΅ RAILS_ENV=production
.
ΠΠΎΠΆΠ½ΠΎ ΠΏΡΠΎΡΡΠΎ Π½Π°ΡΠ°ΡΡ, ΠΈ Π΄Π°Π»Π΅Π΅ ΡΡΡΡΠ°Π½ΡΡΡ Π²ΠΎΠ·Π½ΠΈΠΊΠ°ΡΡΠΈΠ΅ ΠΏΡΠΎΠ±Π»Π΅ΠΌΡ ΠΎΠ΄Π½Ρ Π·Π° ΠΎΠ΄Π½ΠΎΠΉ.
ΠΡΠ»ΠΈ ΠΏΠΎΠ»ΡΡΠΈΡΡΡ Π·Π°ΠΏΡΡΡΠΈΡΡ ΠΏΡΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΠ΅ Π² production
ΡΠ΅ΠΆΠΈΠΌΠ΅, ΡΡΠ°Π²Π½ΠΈΡΠ΅ ΠΌΠ΅ΡΡΠΈΠΊΠΈ Ρ ΡΠ΅ΠΆΠΈΠΌΠΎΠΌ development
. Π‘ΡΠ°Π²Π½ΠΈΡΠ΅ ΠΎΡΡΡΡΡ Rack-mini-profiler
Ρ development
.
Π‘Π΄Π΅Π»Π°ΠΉΡΠ΅ Π²ΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎΡΡΡ ΡΠ΄ΠΎΠ±Π½ΠΎ Π·Π°ΠΏΡΡΡΠΈΡΡ local-production
, Π΄ΠΎΠ±Π°Π²ΡΡΠ΅ ΠΈΠ½ΡΠΎΡΠΌΠ°ΡΠΈΡ ΠΎΠ± ΡΡΠΎΠΉ Π²ΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎΡΡΠΈ Π² Readme
.
ΠΠΎΠΈΡΠΈΡΠ΅ Π²ΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎΡΡΠΈ Π΄Π»Ρ ΠΎΠΏΡΠΈΠΌΠΈΠ·Π°ΡΠΈΠΈ ΡΠ°ΠΌΠΎΡΡΠΎΡΡΠ΅Π»ΡΠ½ΠΎ. ΠΡΠ»ΠΈ Π½Π°ΠΉΠ΄ΡΡΠ΅, Π΄ΠΎΠ±Π°Π²Π»ΡΠΉΡΠ΅ Π² PR
Π²Π°ΡΠΈ ΠΎΠΏΡΠΈΠΌΠΈΠ·Π°ΡΠΈΠΈ Ρ ΠΎΠ±ΠΎΡΠ½ΠΎΠ²Π°Π½ΠΈΡΠΌΠΈ.
PR
Π² ΡΡΠΎΡ ΡΠ΅ΠΏΠΎΠ·ΠΈΡΠΎΡΠΈΠΉ Ρ ΠΊΠΎΠ΄ΠΎΠΌ ΠΈ ΠΏΠΎΠ΄ΡΠΎΠ±Π½ΡΠΌ ΠΎΠΏΠΈΡΠ°Π½ΠΈΠ΅ΠΌ ΠΏΡΠΎΠ΄Π΅Π»Π°Π½Π½ΠΎΠΉ ΡΠ°Π±ΠΎΡΡ Π² ΠΎΠΏΠΈΡΠ°Π½ΠΈΠΈ PR
-Π°.
Welcome to the dev.to codebase. We are so excited to have you. With your help, we can build out DEV to be more stable and better serve our community.
dev.to (or just DEV) is a platform where software developers write articles, take part in discussions, and build their professional profiles. We value supportive and constructive dialogue in the pursuit of great code and career growth for all members. The ecosystem spans from beginner to advanced developers, and all are welcome to find their place within our community. β€οΈ
We encourage you to contribute to dev.to! Please check out the Contributing to dev.to guide for guidelines about how to proceed.
We expect contributors to abide by our underlying code of conduct. All conversations and discussions on GitHub (issues, pull requests) and across dev.to must be respectful and harassment-free.
All issues labeled with approved
are up for grabs. For clarification on how we label issues, check out their definitions here.
When in doubt, ask a core team member! You can mention us in any issues or ask on the DEV Contributor thread. Any issue with the good first issue
tag is typically a good place to start for anyone new to the project. For newer developers, try 'entry-level' issues.
Refactoring code, e.g. improving the code without modifying the behavior is an area that can probably be done based on intuition and may not require much communication to be merged.
Fixing bugs may also not require a lot of communication, but the more the better. Please surround bug fixes with ample tests. Bugs are magnets for other bugs. Write tests near bugs!
Building features is the area which will require the most communication and/or negotiation. Every feature is subjective and open for debate. The product roadmap should be a good guide to follow. As always, when in doubt, ask!
- Fork the project & clone locally. Follow the initial setup here.
- Create a branch, naming it either a feature or bug:
git checkout -b feature/that-new-feature
orbug/fixing-that-bug
- Code and commit your changes. Bonus points if you write a good commit message:
git commit -m 'Add some feature'
- Push to the branch:
git push origin feature/that-new-feature
- Create a pull request for your branch π
Note: be sure to maintain your fork!
Nobody's perfect. Something doesn't work? Or could be done better? Let us know by creating an issue.
PS: a clear and detailed issue gets lots of love, all you have to do is follow the issue template!
Some existing code may be poorly written or untested, so we must have more scrutiny going forward. We test with rspec, let us know if you have any questions about this!
- Try to keep the pull requests small. A pull request should try its very best to address only a single concern.
- Make sure all tests pass and add additional tests for the code you submit. More info here
- Document your reasoning behind the changes. Explain why you wrote the code in the way you did. The code should explain what it does.
- If there's an existing issue related to the pull request, reference to it by adding something like
References/Closes/Fixes/Resolves #305
, where 305 is the issue number. More info here - If you follow the pull request template, you can't go wrong.
Please note: all commits in a pull request will be squashed when merged, but when your PR is approved and passes our CI, it will be live on production!
Whether you are stuck with feature implementation, first-time setup, or you just want to tell us something could be done better, check out our OSS thread or create an issue. You can also mention any core team member in an issue and we'll respond as soon as possible.
π OSS Help/Discussion Thread π
We are all humans trying to work together to improve the community. Always be kind and appreciate the need for tradeoffs. β€οΈ
We run on a Rails backend with mostly vanilla JavaScript on the front end, and some Preact sprinkled in. One of our goals is to move to mostly Preact for our front end.
Additional technologies and services are listed on our docs.
This project follows thoughtbot's Ruby Style Guide, using Rubocop along with Rubocop-Rspec as the code analyzer. If you have Rubocop installed with your text editor of choice, you should be up and running.
For Javascript, we follow Airbnb's JS Style Guide, using ESLint and prettier. If you have ESLint installed with your text editor of choice, you should be up and running.
When commits are made, a git precommit hook runs via husky and lint-staged. ESLint, prettier, and Rubocop will run on your code before it's committed. If there are linting errors that can't be automatically fixed, the commit will not happen. You will need to fix the issue manually then attempt to commit again.
Note: if you've already installed the husky package at least once (used for precommit npm script), you will need to run yarn --force
or npm install --no-cache
. For some reason, the post-install script of husky does not run when the package is pulled from yarn or npm's cache. This is not husky specific, but rather a cached package issue.
This section provides a high-level requirement & quick start guide. For detailed installations, please check out our docs.
- Ruby: we recommend using rbenv to install the Ruby version listed on the badge.
- Yarn: please refer to their installation guide.
- PostgreSQL 9.4 or higher.
- Make sure all the prerequisites are installed.
- Fork dev.to repository, ie. https://github.com/thepracticaldev/dev.to/fork
- Clone your forked repository, ie.
git clone https://github.com/<your-username>/dev.to.git
gem install foreman
- Setup your database
- Create
config/database.yml
by copying from the provided template (i.e.cp config/database.yml.sample config/database.yml
) - Update the
config/database.yml
file if needed.
- Create
- Set up your environment variables/secrets
- Take a look at
Envfile
. This file lists all theENV
variables we use and provides a fake default for any missing keys. You'll need to get your own free Algolia credentials to get your development environment running. - This guide will show you how to get free API keys for additional services that may be required to run certain parts of the app.
- For any key that you wish to enter/replace:
- Create
config/application.yml
by copying from the provided template (ie. with bash:cp config/sample_application.yml config/application.yml
). This is a personal file that is ignored in git. - Obtain the development variable and apply the key you wish to enter/replace. ie:
GITHUB_KEY: "SOME_REAL_SECURE_KEY_HERE" GITHUB_SECRET: "ANOTHER_REAL_SECURE_KEY_HERE"
- Create
- If you are missing
ENV
variables on bootup,envied
gem will alert you with messages similar to'error_on_missing_variables!': The following environment variables should be set: A_MISSING_KEY.
. - You do not need "real" keys for basic development. Some features require certain keys, so you may be able to add them as you go.
- Take a look at
- Run
bin/setup
- That's it! Run
bin/startup
to start the application and head tohttp://localhost:3000/
View Full Installation Documentation
Our docker implementation is incomplete and may not work smoothly. Please kindly report any issues and any contribution is welcomed!
- Install
docker
anddocker-compose
git clone git@github.com:thepracticaldev/dev.to.git
- Set environment variables above as described in the "Basic Installation"
- run
docker-compose build
- run
docker-compose run web rails db:setup
- run
docker-compose run web yarn install
- run
docker-compose up
- That's it! Navigate to
localhost:3000
We're mostly a Rails app, with a bit of Webpack sprinkled in. For most cases, simply running bin/rails server
will do. If you're working with Webpack though, you'll need to run the following:
- Run
bin/startup
to start the server, Webpack, and our job runnerdelayed_job
.bin/startup
runsforeman start -f Procfile.dev
under the hood. alias start="bin/startup"
makes this even faster. π- If you're using
pry
for debugging in Rails, note that usingforeman
andpry
together works, but it's not as clean asbin/rails server
.
Here are some singleton commands you may need, usually in a separate instance/tab of your shell.
- Running the job server (if using
bin/rails server
) -- this is mostly for notifications and emails:bin/rails jobs:work
- Clearing jobs (in case you don't want to wait for the backlog of jobs):
bin/rails jobs:clear
Current gotchas: potential environment issues with external services need to be worked out.
We use Spring and it is already included in the project.
- Use the provided bin stubs to automatically start Spring, i.e.
bin/rails server
,bin/rspec spec/models/
,bin/rake db:migrate
. - If Spring isn't picking up on new changes, use
spring stop
. For example, Spring should always be restarted if there's a change in environment key. - Check Spring's status whenever with
spring status
.
Caveat: bin/rspec
is not equipped with Spring because it affects Simplecov's result. Instead use bin/spring rspec
.
Check out our dedicated docs page for more technical documentation.
Our new product roadmap can be found here. Many notes need to be converted to issues but this should provide an overview of features we plan to work on, as well as features we are considering.
Core team members will move issues along the project board as they progress.
- Ideas & Requests: features up for discussion.
- Needs Owners: features in need of an owner.
- Committed: features we're committed to building -- free for contributors to work on, but please communicate with the owner beforehand.
- In Progress (early stage): work has begun on feature.
- In Progress (late stage): feature is near completion.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Please see the LICENSE file in our repository for the full text.
Like many open source projects, we require that contributors provide us with a Contributor License Agreement (CLA). By submitting code to the DEV project, you are granting us a right to use that code under the terms of the CLA.
Our version of the CLA was adapted from the Microsoft Contributor License Agreement, which they generously made available to the public domain under Creative Commons CC0 1.0 Universal.
Any questions, please refer to our license FAQ doc or email yo@dev.to