Skip to content

Commit

Permalink
cleanup and improve the code
Browse files Browse the repository at this point in the history
  • Loading branch information
the-teacher committed Jan 29, 2023
1 parent 6b572c4 commit 71ef225
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 15 deletions.
5 changes: 4 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@ gem "kaminari", "1.2.2"
gem "whenever", "1.0.0", require: false

group :development, :test do
# fake data for development and testing
# Fake data for development and testing
gem "faker", "3.1.0"

# Code linting
gem "rubocop-rails", "2.17.4", require: false
end

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
27 changes: 25 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ GEM
tzinfo (~> 2.0)
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
bindex (0.8.1)
bootsnap (1.15.0)
msgpack (~> 1.2)
Expand Down Expand Up @@ -177,6 +178,7 @@ GEM
jbuilder (2.11.5)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
json (2.6.3)
kaminari (1.2.2)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.2.2)
Expand Down Expand Up @@ -219,6 +221,9 @@ GEM
nokogiri (1.13.10)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
parallel (1.22.1)
parser (3.2.0.0)
ast (~> 2.4.1)
pg (1.4.5)
public_suffix (5.0.1)
puma (5.6.5)
Expand Down Expand Up @@ -253,13 +258,31 @@ GEM
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.0.6)
redis (5.0.5)
redis-client (>= 0.9.0)
redis-client (0.11.2)
connection_pool
regexp_parser (2.6.1)
rexml (3.2.5)
rubocop (1.44.1)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.2.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.24.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.24.1)
parser (>= 3.1.1.0)
rubocop-rails (2.17.4)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
ruby-progressbar (1.11.0)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
sanitize (6.0.0)
Expand Down Expand Up @@ -291,8 +314,7 @@ GEM
railties (>= 6.0.0)
tzinfo (2.0.5)
concurrent-ruby (~> 1.0)
tzinfo-data (1.2022.7)
tzinfo (>= 1.0.0)
unicode-display_width (2.4.2)
web-console (4.2.0)
actionview (>= 6.0.0)
activemodel (>= 6.0.0)
Expand Down Expand Up @@ -329,6 +351,7 @@ DEPENDENCIES
puma (= 5.6.5)
rails (= 7.0.4.2)
redis (= 5.0.5)
rubocop-rails (= 2.17.4)
sanitize (= 6.0.0)
selenium-webdriver (= 4.7.1)
sidekiq (= 7.0.2)
Expand Down
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@ Rails 7 Application is Ready in Minutes!
<td><b><a href="https://www.ruby-toolbox.com/categories/web_servers">Puma</a></b></td>
<td>Application Web Server. To launch Rails app</td>
</tr>
<tr>
<td colspan="3"><b>Code Quality</b></td>
</tr>
<tr>
<td><img width="100px" alt="rspec" src="docs/rubocop.png"></td>
<td><b><a href="https://www.ruby-toolbox.com/categories/code_metrics">Rubocop</a></b></td>
<td>Ruby static code analyzer (a.k.a. linter) and formatter.</td>
</tr>
</tbody>
</table>

Expand Down Expand Up @@ -144,11 +152,6 @@ What I'm going to add...
<td><b><a href="https://www.ruby-toolbox.com/categories/testing_frameworks">RSpec</a></b></td>
<td>Testing Framework for Rails</td>
</tr>
<tr>
<td><img width="100px" alt="rspec" src="docs/rubocop.png"></td>
<td><b><a href="https://www.ruby-toolbox.com/categories/code_metrics">Rubocop</a></b></td>
<td>Ruby static code analyzer (a.k.a. linter) and formatter.</td>
</tr>
</tbody>
</table>

Expand Down Expand Up @@ -195,13 +198,14 @@ What was done:
4. Launching PgSQL Container
5. Launching Redis Container
6. Launching Rails Container
7. Installing Gems. Please Wait
7. Installing Gems
8. Create DB. Migrate DB. Create Seeds
9. Indexing Article Model
10. Launching Rails App with Puma
11. Launching Sidekiq
12. Visit Rails App: http://localhost:3000
13. Visit Mail Service: http://localhost:1080
12. Rubocop is Checking
13. Visit Rails App: http://localhost:3000
14. Visit Mail Service: http://localhost:1080
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Welcome to RAILS 7!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
5 changes: 4 additions & 1 deletion bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ FileUtils.chdir APP_ROOT do
system('docker compose -f docker/docker-compose.yml up rails -d')
wait('to launch Rails Container')

step_info "Installing Gems. Please Wait"
step_info "Installing Gems"
rails_install_gems

step_info "Create DB. Migrate DB. Create Seeds"
Expand All @@ -55,6 +55,9 @@ FileUtils.chdir APP_ROOT do
step_info "Launching Sidekiq"
sidekiq_start

step_info "Rubocop is Checking"
rubocop

step_info "Visit Rails App: http://localhost:3000"
step_info "Visit Mail Service: http://localhost:1080"

Expand Down
2 changes: 1 addition & 1 deletion config/initializers/_SIDEKIQ.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
puts "Sidekiq service address: #{redis_url}"

SQ_ERR_LOGGER = Logger.new(
Rails.root.join('/log/sidekiq.errors.log')
Rails.root.join('log/sidekiq.errors.log')
)

Sidekiq.configure_client do |config|
Expand Down
2 changes: 0 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,3 @@ RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | b
COPY Gemfile Gemfile
COPY --chown=lucky:lucky Gemfile.lock Gemfile.lock
RUN bundle

RUN gem install rubocop-rails -v 2.17.4
Binary file added docs/releases/Rails7.StartKit-1.3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 71ef225

Please sign in to comment.