-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from digital-armstrong/feature/history-params
API for ASRC, comment for posts and any updates
- Loading branch information
Showing
69 changed files
with
901 additions
and
582 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
AllCops: | ||
NewCops: enable | ||
TargetRubyVersion: "3.2" | ||
|
||
linters: | ||
LineLength: | ||
max: 120 | ||
RedundantDiv: | ||
enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,4 +28,4 @@ ADD . $RAILS_ROOT | |
ENV PATH=$RAILS_ROOT/bin:${PATH} | ||
|
||
EXPOSE 3000 | ||
CMD ["bin/prod"] | ||
CMD ["make start"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
setup: | ||
bundle install | ||
yarn install | ||
yarn build | ||
yarn build:css | ||
bin/rails db:drop db:create db:migrate db:seed | ||
|
||
start: | ||
bundle install | ||
yarn install | ||
yarn build | ||
yarn build:css | ||
rm ./tmp/pids/server.pid | ||
bin/dev | ||
|
||
clean: | ||
bin/rails db:drop db:create db:migrate db:seed | ||
|
||
|
||
check: test lint | ||
|
||
lint: | ||
bundle exec rubocop -a | ||
# bundle exec slim-lint app/views/ | ||
|
||
test: | ||
bin/rails test | ||
|
||
.PHONY: test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,74 +9,49 @@ for ARMStrong, OMIT and assistant for shield "D". | |
|
||
## Before start | ||
|
||
### Configuring your workspace: | ||
|
||
#### Install and configure Docker and Docker-Compose; | ||
|
||
Installing: | ||
### Local installation: | ||
|
||
```bash | ||
sudo dnf remove docker \ | ||
docker-client \ | ||
docker-client-latest \ | ||
docker-common \ | ||
docker-latest \ | ||
docker-latest-logrotate \ | ||
docker-logrotate \ | ||
docker-selinux \ | ||
docker-engine-selinux \ | ||
docker-engine | ||
|
||
sudo dnf -y install dnf-plugins-core | ||
|
||
sudo dnf config-manager \ | ||
--add-repo \ | ||
https://download.docker.com/linux/fedora/docker-ce.repo | ||
|
||
sudo dnf install docker-ce docker-ce-cli containerd.io docker-compose-plugin | ||
git clone [email protected]:digital-armstrong/Armstrong.Web.git && \ | ||
cd ./Armstrong.Web && \ | ||
docker compose run --rm web bash -c "make setup" | ||
``` | ||
|
||
Fixing problem: | ||
This commands cloned repo and setup prroject dependency. Also you can manually install all deps: | ||
|
||
```bash | ||
usermod -a -G docker $USER | ||
bundle install | ||
yarn install | ||
yarn build | ||
yarn build:css | ||
bin/rails db:drop db:create db:migrate db:seed | ||
``` | ||
|
||
Start after system be load: | ||
## Start | ||
|
||
After installing the dependencies, you can run the project in docker compose: | ||
|
||
```bash | ||
sudo systemctl enable docker | ||
docker compose up --build | ||
``` | ||
|
||
#### Install [ZSH and Oh-my-zsh](https://ohmyz.sh/) | ||
That's all. =) | ||
|
||
Install: | ||
## Other options | ||
|
||
```bash | ||
sudo dnf install zsh | ||
``` | ||
All of the below commands must be executed inside the container. | ||
|
||
```bash | ||
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" | ||
``` | ||
Connect to a running container: `docker exec -it armstrongweb_web_1 bash` | ||
Clean startup with command execution: `docker compose run --rm web bash -c "<your command>"` | ||
|
||
Set as default shell: | ||
### Refresh database | ||
|
||
```bash | ||
chsh -s $(which zsh) | ||
make cleanup | ||
``` | ||
|
||
#### Install [git-flow](https://github.com/petervanderdoes/gitflow-avh) | ||
|
||
Install: | ||
### Test and lint | ||
|
||
```bash | ||
$ wget -q https://raw.githubusercontent.com/petervanderdoes/gitflow-avh/develop/contrib/gitflow-installer.sh && sudo bash gitflow-installer.sh install stable; rm gitflow-installer.sh | ||
make check | ||
``` | ||
|
||
### Read manual | ||
|
||
- [Git-flow](https://jeffkreeftmeijer.com/git-flow/) | ||
- [Git-flow usage](https://github.com/petervanderdoes/gitflow-avh#git-flow-usage) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
module Posts | ||
class ApplicationController < ApplicationController | ||
def resource_post | ||
@resource_post ||= Post.find(params[:post_id]) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# frozen_string_literal: true | ||
|
||
module Posts | ||
class CommentsController < ApplicationController | ||
before_action :authenticate_user!, only: [:create] | ||
|
||
def create | ||
@comment = resource_post.comments.build(comments_params) | ||
@comment.user = current_user | ||
|
||
if @comment.save | ||
redirect_to(resource_post, notice: t('.success')) | ||
else | ||
redirect_to(resource_post, alert: @comment.errors.full_messages.join('. ')) | ||
end | ||
end | ||
|
||
private | ||
|
||
def comments_params | ||
params.require(:post_comment).permit(:content, :parent_id) | ||
end | ||
end | ||
end |
Oops, something went wrong.