├── .dockerignore ├── .editorconfig ├── .gitattributes ├── .github └── workflows │ └── contributors.yml ├── .gitignore ├── .rspec ├── .rubocop.yml ├── .ruby-version ├── Dockerfile ├── Gemfile ├── Gemfile.lock ├── README.md ├── Rakefile ├── app ├── assets │ ├── config │ │ └── manifest.js │ ├── images │ │ ├── angular.svg │ │ ├── bash.svg │ │ ├── c.svg │ │ ├── cplusplus.svg │ │ ├── crystal.svg │ │ ├── csharp.svg │ │ ├── css.svg │ │ ├── dart.svg │ │ ├── default.svg │ │ ├── django.svg │ │ ├── elixir.svg │ │ ├── flutter.svg │ │ ├── git.svg │ │ ├── go.svg │ │ ├── haskell.svg │ │ ├── html.svg │ │ ├── java.svg │ │ ├── javascript.svg │ │ ├── kotlin.svg │ │ ├── linux.svg │ │ ├── markdown.svg │ │ ├── mongodb.svg │ │ ├── mysql.svg │ │ ├── nextjs.svg │ │ ├── ocaml.svg │ │ ├── php.svg │ │ ├── postgresql.svg │ │ ├── python.svg │ │ ├── r.svg │ │ ├── ruby.svg │ │ ├── rust.svg │ │ ├── spring.svg │ │ ├── swift.svg │ │ ├── typescript.svg │ │ ├── vim.svg │ │ └── vue.svg │ └── stylesheets │ │ ├── application.css │ │ ├── design_system.css │ │ ├── issue.css │ │ ├── repository.css │ │ └── spinner.css ├── channels │ └── application_cable │ │ ├── channel.rb │ │ └── connection.rb ├── controllers │ ├── application_controller.rb │ ├── concerns │ │ └── .keep │ └── repository_controller.rb ├── helpers │ ├── application_helper.rb │ ├── design_system_helper.rb │ ├── heroicon_helper.rb │ ├── issue_helper.rb │ └── repository_helper.rb ├── javascript │ ├── application.js │ ├── cdn │ │ └── unocss-runtime.js │ ├── controllers │ │ ├── application.js │ │ ├── hello_controller.js │ │ └── index.js │ └── pagination_loader.js ├── jobs │ └── application_job.rb ├── mailers │ └── application_mailer.rb ├── models │ ├── application_record.rb │ ├── concerns │ │ └── .keep │ ├── issue.rb │ └── repository.rb ├── services │ └── github │ │ ├── extract_issues_from_repository.rb │ │ └── extract_repositories.rb └── views │ ├── layouts │ ├── _spinner.html.erb │ ├── application.html.erb │ ├── mailer.html.erb │ └── mailer.text.erb │ └── repository │ ├── _card.html.erb │ ├── _card_badge.html.erb │ ├── _tag.html.erb │ └── index.html.erb ├── bin ├── bundle ├── docker-entrypoint ├── importmap ├── rails ├── rake └── setup ├── config.ru ├── config ├── application.rb ├── boot.rb ├── cable.yml ├── credentials.yml.enc ├── database.yml ├── dockerfile.yml ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── importmap.rb ├── initializers │ ├── assets.rb │ ├── content_security_policy.rb │ ├── filter_parameter_logging.rb │ ├── heroicon.rb │ ├── inflections.rb │ ├── permissions_policy.rb │ └── sentry.rb ├── locales │ └── en.yml ├── puma.rb ├── routes.rb ├── schedule.rb └── storage.yml ├── db ├── migrate │ ├── 20230816134816_create_repositories.rb │ ├── 20230828184031_create_issues.rb │ ├── 20230828185252_change_issue_field_from_type_to_issue_type.rb │ └── 20230918175013_add_technology_column_to_repository.rb ├── schema.rb └── seeds.rb ├── docs ├── 1-como-estilizar-uma-pagina.md ├── 2-como-utilizar-erb.md └── 3-como-criar-um-token-github.md ├── lib ├── assets │ └── .keep └── tasks │ ├── .keep │ └── fetch.rake ├── log └── .keep ├── public ├── 404.html ├── 422.html ├── 500.html ├── android-chrome-192x192.png ├── android-chrome-512x512.png ├── apple-touch-icon-precomposed.png ├── apple-touch-icon.png ├── favicon-16x16.png ├── favicon-32x32.png ├── favicon.ico ├── robots.txt └── site.webmanifest ├── spec ├── helpers │ ├── design_system_helper_spec.rb │ ├── issue_helper_spec.rb │ └── repository_helper_spec.rb ├── models │ ├── issue_spec.rb │ └── repository_spec.rb ├── rails_helper.rb ├── requests │ ├── issue_spec.rb │ └── repository_spec.rb └── spec_helper.rb ├── storage └── .keep ├── tmp ├── .keep ├── pids │ └── .keep └── storage │ └── .keep └── vendor ├── .keep └── javascript └── .keep /.dockerignore: -------------------------------------------------------------------------------- 1 | # See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files. 2 | 3 | # Ignore git directory. 4 | /.git/ 5 | 6 | # Ignore bundler config. 7 | /.bundle 8 | 9 | # Ignore all default key files. 10 | /config/master.key 11 | /config/credentials/*.key 12 | 13 | # Ignore all environment files. 14 | /.env* 15 | !/.env.example 16 | 17 | # Ignore all logfiles and tempfiles. 18 | /log/* 19 | /tmp/* 20 | !/log/.keep 21 | !/tmp/.keep 22 | 23 | # Ignore pidfiles, but keep the directory. 24 | /tmp/pids/* 25 | !/tmp/pids/ 26 | !/tmp/pids/.keep 27 | 28 | # Ignore storage (uploaded files in development and any SQLite databases). 29 | /storage/* 30 | !/storage/.keep 31 | /tmp/storage/* 32 | !/tmp/storage/ 33 | !/tmp/storage/.keep 34 | 35 | # Ignore assets. 36 | /node_modules/ 37 | /app/assets/builds/* 38 | !/app/assets/builds/.keep 39 | /public/assets 40 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | indent_size = 2 7 | indent_style = space 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # See https://git-scm.com/docs/gitattributes for more about git attribute files. 2 | 3 | # Mark the database schema as having been generated. 4 | db/schema.rb linguist-generated 5 | 6 | # Mark any vendored files as having been vendored. 7 | vendor/* linguist-vendored 8 | -------------------------------------------------------------------------------- /.github/workflows/contributors.yml: -------------------------------------------------------------------------------- 1 | on: 2 | push: 3 | branches: 4 | - main 5 | 6 | jobs: 7 | contrib-readme-job: 8 | runs-on: ubuntu-latest 9 | name: A job to automate contrib in readme 10 | steps: 11 | - name: Contribute List 12 | uses: akhilmhdh/contributors-readme-action@v2.3.6 13 | env: 14 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 15 | with: 16 | collaborators: all 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile '~/.gitignore_global' 6 | 7 | # Ignore bundler config. 8 | /.bundle 9 | 10 | # Ignore the default SQLite database. 11 | /db/*.sqlite3 12 | /db/*.sqlite3-* 13 | 14 | # Ignore all logfiles and tempfiles. 15 | /log/* 16 | /tmp/* 17 | !/log/.keep 18 | !/tmp/.keep 19 | 20 | # Ignore pidfiles, but keep the directory. 21 | /tmp/pids/* 22 | !/tmp/pids/ 23 | !/tmp/pids/.keep 24 | 25 | # Ignore uploaded files in development. 26 | /storage/* 27 | !/storage/.keep 28 | /tmp/storage/* 29 | !/tmp/storage/ 30 | !/tmp/storage/.keep 31 | 32 | /public/assets 33 | 34 | # Ignore master key for decrypting credentials and more. 35 | /config/master.key 36 | 37 | .env 38 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --require spec_helper 2 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | Style/Documentation: 2 | Enabled: false 3 | 4 | AllCops: 5 | NewCops: enable 6 | Exclude: 7 | - 'bin/*' 8 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | ruby-3.2.2 2 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax = docker/dockerfile:1 2 | 3 | # Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile 4 | ARG RUBY_VERSION=3.2.2 5 | FROM ruby:$RUBY_VERSION-slim as base 6 | 7 | LABEL fly_launch_runtime="rails" 8 | 9 | # Rails app lives here 10 | WORKDIR /rails 11 | 12 | # Set production environment 13 | ENV RAILS_ENV="production" \ 14 | BUNDLE_WITHOUT="development:test" \ 15 | BUNDLE_DEPLOYMENT="1" 16 | 17 | # Update gems and bundler 18 | RUN gem update --system --no-document && \ 19 | gem install -N bundler 20 | 21 | 22 | # Throw-away build stage to reduce size of final image 23 | FROM base as build 24 | 25 | # Install packages needed to build gems 26 | RUN apt-get update -qq && \ 27 | apt-get install --no-install-recommends -y build-essential pkg-config 28 | 29 | # Install application gems 30 | COPY --link Gemfile Gemfile.lock ./ 31 | RUN bundle install && \ 32 | bundle exec bootsnap precompile --gemfile && \ 33 | rm -rf ~/.bundle/ $BUNDLE_PATH/ruby/*/cache $BUNDLE_PATH/ruby/*/bundler/gems/*/.git 34 | 35 | # Copy application code 36 | COPY --link . . 37 | 38 | # Precompile bootsnap code for faster boot times 39 | RUN bundle exec bootsnap precompile app/ lib/ 40 | 41 | # Precompiling assets for production without requiring secret RAILS_MASTER_KEY 42 | RUN SECRET_KEY_BASE=DUMMY ./bin/rails assets:precompile 43 | 44 | 45 | # Final stage for app image 46 | FROM base 47 | 48 | # Install packages needed for deployment and cron 49 | RUN apt-get update -qq && \ 50 | apt-get install --no-install-recommends -y curl libsqlite3-0 cron && \ 51 | rm -rf /var/lib/apt/lists /var/cache/apt/archives 52 | 53 | # Copy built artifacts: gems, application 54 | COPY --from=build /usr/local/bundle /usr/local/bundle 55 | COPY --from=build /rails /rails 56 | 57 | # Run and own only the runtime files as a non-root user for security 58 | RUN useradd rails --create-home --shell /bin/bash && \ 59 | mkdir /data && \ 60 | chown -R rails:rails db log storage tmp /data 61 | 62 | USER rails:rails 63 | 64 | # Run whenever to update crontab 65 | RUN bundle exec wheneverize . && \ 66 | bundle exec whenever --update-crontab && \ 67 | service cron start # Start the cron service 68 | 69 | # Deployment options 70 | ENV DATABASE_URL="sqlite3:///data/production.sqlite3" \ 71 | RAILS_LOG_TO_STDOUT="1" \ 72 | RAILS_SERVE_STATIC_FILES="true" 73 | 74 | # Entrypoint prepares the database. 75 | ENTRYPOINT ["/rails/bin/docker-entrypoint"] 76 | 77 | # Start the server by default, this can be overwritten at runtime 78 | EXPOSE 3000 79 | VOLUME /data 80 | CMD ["./bin/rails", "server"] 81 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | git_source(:github) { |repo| "https://github.com/#{repo}.git" } 3 | 4 | ruby '3.2.2' 5 | 6 | # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" 7 | gem 'rails', '~> 7.0.7' 8 | 9 | # The original asset pipeline for Rails [https://github.com/rails/sprockets-rails] 10 | gem 'sprockets-rails' 11 | 12 | # Use sqlite3 as the database for Active Record 13 | gem 'sqlite3', '~> 1.4' 14 | 15 | # Use the Puma web server [https://github.com/puma/puma] 16 | gem 'puma', '~> 5.0' 17 | 18 | # Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails] 19 | gem 'importmap-rails' 20 | 21 | # Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev] 22 | gem 'turbo-rails' 23 | 24 | # Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev] 25 | gem 'stimulus-rails' 26 | 27 | # Build JSON APIs with ease [https://github.com/rails/jbuilder] 28 | gem 'jbuilder' 29 | 30 | # Use Redis adapter to run Action Cable in production 31 | # gem "redis", "~> 4.0" 32 | 33 | # Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis] 34 | # gem "kredis" 35 | 36 | # Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword] 37 | # gem "bcrypt", "~> 3.1.7" 38 | 39 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem 40 | gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby] 41 | 42 | # Reduces boot times through caching; required in config/boot.rb 43 | gem 'bootsnap', require: false 44 | 45 | # Use Sass to process CSS 46 | # gem "sassc-rails" 47 | 48 | # Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images] 49 | # gem "image_processing", "~> 1.2" 50 | 51 | group :development, :test do 52 | # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem 53 | gem 'debug', platforms: %i[mri mingw x64_mingw] 54 | gem 'dotenv-rails' 55 | gem 'rspec-rails', '~> 6.0.0' 56 | end 57 | 58 | group :development do 59 | # Use console on exceptions pages [https://github.com/rails/web-console] 60 | gem 'web-console' 61 | 62 | # Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler] 63 | # gem "rack-mini-profiler" 64 | 65 | # Speed up commands on slow machines / big apps [https://github.com/rails/spring] 66 | # gem "spring" 67 | end 68 | 69 | group :test do 70 | # Use system testing [https://guides.rubyonrails.org/testing.html#system-testing] 71 | gem 'capybara' 72 | gem 'selenium-webdriver' 73 | gem 'webdrivers' 74 | end 75 | 76 | gem 'ruby-progressbar', '~> 1.13' 77 | 78 | gem 'httparty', '~> 0.21.0' 79 | 80 | gem 'dockerfile-rails', '>= 1.5', group: :development 81 | 82 | gem 'sentry-ruby', '~> 5.10' 83 | 84 | gem 'sentry-rails', '~> 5.10' 85 | 86 | gem 'heroicon', '~> 1.0' 87 | gem 'pry', '~> 0.14.2' 88 | gem 'pry-rails' 89 | gem 'whenever', require: false 90 | gem 'will_paginate', '~> 3.3' 91 | 92 | gem 'faker', '~> 3.2' 93 | gem 'rubocop', require: false 94 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | actioncable (7.0.7) 5 | actionpack (= 7.0.7) 6 | activesupport (= 7.0.7) 7 | nio4r (~> 2.0) 8 | websocket-driver (>= 0.6.1) 9 | actionmailbox (7.0.7) 10 | actionpack (= 7.0.7) 11 | activejob (= 7.0.7) 12 | activerecord (= 7.0.7) 13 | activestorage (= 7.0.7) 14 | activesupport (= 7.0.7) 15 | mail (>= 2.7.1) 16 | net-imap 17 | net-pop 18 | net-smtp 19 | actionmailer (7.0.7) 20 | actionpack (= 7.0.7) 21 | actionview (= 7.0.7) 22 | activejob (= 7.0.7) 23 | activesupport (= 7.0.7) 24 | mail (~> 2.5, >= 2.5.4) 25 | net-imap 26 | net-pop 27 | net-smtp 28 | rails-dom-testing (~> 2.0) 29 | actionpack (7.0.7) 30 | actionview (= 7.0.7) 31 | activesupport (= 7.0.7) 32 | rack (~> 2.0, >= 2.2.4) 33 | rack-test (>= 0.6.3) 34 | rails-dom-testing (~> 2.0) 35 | rails-html-sanitizer (~> 1.0, >= 1.2.0) 36 | actiontext (7.0.7) 37 | actionpack (= 7.0.7) 38 | activerecord (= 7.0.7) 39 | activestorage (= 7.0.7) 40 | activesupport (= 7.0.7) 41 | globalid (>= 0.6.0) 42 | nokogiri (>= 1.8.5) 43 | actionview (7.0.7) 44 | activesupport (= 7.0.7) 45 | builder (~> 3.1) 46 | erubi (~> 1.4) 47 | rails-dom-testing (~> 2.0) 48 | rails-html-sanitizer (~> 1.1, >= 1.2.0) 49 | activejob (7.0.7) 50 | activesupport (= 7.0.7) 51 | globalid (>= 0.3.6) 52 | activemodel (7.0.7) 53 | activesupport (= 7.0.7) 54 | activerecord (7.0.7) 55 | activemodel (= 7.0.7) 56 | activesupport (= 7.0.7) 57 | activestorage (7.0.7) 58 | actionpack (= 7.0.7) 59 | activejob (= 7.0.7) 60 | activerecord (= 7.0.7) 61 | activesupport (= 7.0.7) 62 | marcel (~> 1.0) 63 | mini_mime (>= 1.1.0) 64 | activesupport (7.0.7) 65 | concurrent-ruby (~> 1.0, >= 1.0.2) 66 | i18n (>= 1.6, < 2) 67 | minitest (>= 5.1) 68 | tzinfo (~> 2.0) 69 | addressable (2.8.5) 70 | public_suffix (>= 2.0.2, < 6.0) 71 | ast (2.4.2) 72 | base64 (0.1.1) 73 | bindex (0.8.1) 74 | bootsnap (1.16.0) 75 | msgpack (~> 1.2) 76 | builder (3.2.4) 77 | capybara (3.39.2) 78 | addressable 79 | matrix 80 | mini_mime (>= 0.1.3) 81 | nokogiri (~> 1.8) 82 | rack (>= 1.6.0) 83 | rack-test (>= 0.6.3) 84 | regexp_parser (>= 1.5, < 3.0) 85 | xpath (~> 3.2) 86 | chronic (0.10.2) 87 | coderay (1.1.3) 88 | concurrent-ruby (1.2.2) 89 | crass (1.0.6) 90 | date (3.3.3) 91 | debug (1.8.0) 92 | irb (>= 1.5.0) 93 | reline (>= 0.3.1) 94 | diff-lcs (1.5.0) 95 | dockerfile-rails (1.5.3) 96 | rails 97 | dotenv (2.8.1) 98 | dotenv-rails (2.8.1) 99 | dotenv (= 2.8.1) 100 | railties (>= 3.2) 101 | erubi (1.12.0) 102 | faker (3.2.1) 103 | i18n (>= 1.8.11, < 2) 104 | globalid (1.1.0) 105 | activesupport (>= 5.0) 106 | heroicon (1.0.0) 107 | rails (>= 5.2) 108 | httparty (0.21.0) 109 | mini_mime (>= 1.0.0) 110 | multi_xml (>= 0.5.2) 111 | i18n (1.14.1) 112 | concurrent-ruby (~> 1.0) 113 | importmap-rails (1.2.1) 114 | actionpack (>= 6.0.0) 115 | railties (>= 6.0.0) 116 | io-console (0.6.0) 117 | irb (1.7.4) 118 | reline (>= 0.3.6) 119 | jbuilder (2.11.5) 120 | actionview (>= 5.0.0) 121 | activesupport (>= 5.0.0) 122 | json (2.6.3) 123 | language_server-protocol (3.17.0.3) 124 | loofah (2.21.3) 125 | crass (~> 1.0.2) 126 | nokogiri (>= 1.12.0) 127 | mail (2.8.1) 128 | mini_mime (>= 0.1.1) 129 | net-imap 130 | net-pop 131 | net-smtp 132 | marcel (1.0.2) 133 | matrix (0.4.2) 134 | method_source (1.0.0) 135 | mini_mime (1.1.5) 136 | minitest (5.19.0) 137 | msgpack (1.7.2) 138 | multi_xml (0.6.0) 139 | net-imap (0.3.7) 140 | date 141 | net-protocol 142 | net-pop (0.1.2) 143 | net-protocol 144 | net-protocol (0.2.1) 145 | timeout 146 | net-smtp (0.3.3) 147 | net-protocol 148 | nio4r (2.5.9) 149 | nokogiri (1.15.4-aarch64-linux) 150 | racc (~> 1.4) 151 | nokogiri (1.15.4-arm64-darwin) 152 | racc (~> 1.4) 153 | nokogiri (1.15.4-x86_64-linux) 154 | racc (~> 1.4) 155 | parallel (1.23.0) 156 | parser (3.2.2.3) 157 | ast (~> 2.4.1) 158 | racc 159 | pry (0.14.2) 160 | coderay (~> 1.1) 161 | method_source (~> 1.0) 162 | pry-rails (0.3.9) 163 | pry (>= 0.10.4) 164 | public_suffix (5.0.3) 165 | puma (5.6.6) 166 | nio4r (~> 2.0) 167 | racc (1.7.1) 168 | rack (2.2.8) 169 | rack-test (2.1.0) 170 | rack (>= 1.3) 171 | rails (7.0.7) 172 | actioncable (= 7.0.7) 173 | actionmailbox (= 7.0.7) 174 | actionmailer (= 7.0.7) 175 | actionpack (= 7.0.7) 176 | actiontext (= 7.0.7) 177 | actionview (= 7.0.7) 178 | activejob (= 7.0.7) 179 | activemodel (= 7.0.7) 180 | activerecord (= 7.0.7) 181 | activestorage (= 7.0.7) 182 | activesupport (= 7.0.7) 183 | bundler (>= 1.15.0) 184 | railties (= 7.0.7) 185 | rails-dom-testing (2.2.0) 186 | activesupport (>= 5.0.0) 187 | minitest 188 | nokogiri (>= 1.6) 189 | rails-html-sanitizer (1.6.0) 190 | loofah (~> 2.21) 191 | nokogiri (~> 1.14) 192 | railties (7.0.7) 193 | actionpack (= 7.0.7) 194 | activesupport (= 7.0.7) 195 | method_source 196 | rake (>= 12.2) 197 | thor (~> 1.0) 198 | zeitwerk (~> 2.5) 199 | rainbow (3.1.1) 200 | rake (13.0.6) 201 | regexp_parser (2.8.1) 202 | reline (0.3.7) 203 | io-console (~> 0.5) 204 | rexml (3.2.6) 205 | rspec-core (3.12.2) 206 | rspec-support (~> 3.12.0) 207 | rspec-expectations (3.12.3) 208 | diff-lcs (>= 1.2.0, < 2.0) 209 | rspec-support (~> 3.12.0) 210 | rspec-mocks (3.12.6) 211 | diff-lcs (>= 1.2.0, < 2.0) 212 | rspec-support (~> 3.12.0) 213 | rspec-rails (6.0.3) 214 | actionpack (>= 6.1) 215 | activesupport (>= 6.1) 216 | railties (>= 6.1) 217 | rspec-core (~> 3.12) 218 | rspec-expectations (~> 3.12) 219 | rspec-mocks (~> 3.12) 220 | rspec-support (~> 3.12) 221 | rspec-support (3.12.1) 222 | rubocop (1.56.3) 223 | base64 (~> 0.1.1) 224 | json (~> 2.3) 225 | language_server-protocol (>= 3.17.0) 226 | parallel (~> 1.10) 227 | parser (>= 3.2.2.3) 228 | rainbow (>= 2.2.2, < 4.0) 229 | regexp_parser (>= 1.8, < 3.0) 230 | rexml (>= 3.2.5, < 4.0) 231 | rubocop-ast (>= 1.28.1, < 2.0) 232 | ruby-progressbar (~> 1.7) 233 | unicode-display_width (>= 2.4.0, < 3.0) 234 | rubocop-ast (1.29.0) 235 | parser (>= 3.2.1.0) 236 | ruby-progressbar (1.13.0) 237 | rubyzip (2.3.2) 238 | selenium-webdriver (4.10.0) 239 | rexml (~> 3.2, >= 3.2.5) 240 | rubyzip (>= 1.2.2, < 3.0) 241 | websocket (~> 1.0) 242 | sentry-rails (5.10.0) 243 | railties (>= 5.0) 244 | sentry-ruby (~> 5.10.0) 245 | sentry-ruby (5.10.0) 246 | concurrent-ruby (~> 1.0, >= 1.0.2) 247 | sprockets (4.2.0) 248 | concurrent-ruby (~> 1.0) 249 | rack (>= 2.2.4, < 4) 250 | sprockets-rails (3.4.2) 251 | actionpack (>= 5.2) 252 | activesupport (>= 5.2) 253 | sprockets (>= 3.0.0) 254 | sqlite3 (1.6.3-aarch64-linux) 255 | sqlite3 (1.6.3-arm64-darwin) 256 | sqlite3 (1.6.3-x86_64-linux) 257 | stimulus-rails (1.2.2) 258 | railties (>= 6.0.0) 259 | thor (1.2.2) 260 | timeout (0.4.0) 261 | turbo-rails (1.4.0) 262 | actionpack (>= 6.0.0) 263 | activejob (>= 6.0.0) 264 | railties (>= 6.0.0) 265 | tzinfo (2.0.6) 266 | concurrent-ruby (~> 1.0) 267 | unicode-display_width (2.4.2) 268 | web-console (4.2.0) 269 | actionview (>= 6.0.0) 270 | activemodel (>= 6.0.0) 271 | bindex (>= 0.4.0) 272 | railties (>= 6.0.0) 273 | webdrivers (5.3.1) 274 | nokogiri (~> 1.6) 275 | rubyzip (>= 1.3.0) 276 | selenium-webdriver (~> 4.0, < 4.11) 277 | websocket (1.2.9) 278 | websocket-driver (0.7.6) 279 | websocket-extensions (>= 0.1.0) 280 | websocket-extensions (0.1.5) 281 | whenever (1.0.0) 282 | chronic (>= 0.6.3) 283 | will_paginate (3.3.1) 284 | xpath (3.2.0) 285 | nokogiri (~> 1.8) 286 | zeitwerk (2.6.11) 287 | 288 | PLATFORMS 289 | aarch64-linux 290 | arm64-darwin-21 291 | arm64-darwin-22 292 | x86_64-linux 293 | 294 | DEPENDENCIES 295 | bootsnap 296 | capybara 297 | debug 298 | dockerfile-rails (>= 1.5) 299 | dotenv-rails 300 | faker (~> 3.2) 301 | heroicon (~> 1.0) 302 | httparty (~> 0.21.0) 303 | importmap-rails 304 | jbuilder 305 | pry (~> 0.14.2) 306 | pry-rails 307 | puma (~> 5.0) 308 | rails (~> 7.0.7) 309 | rspec-rails (~> 6.0.0) 310 | rubocop 311 | ruby-progressbar (~> 1.13) 312 | selenium-webdriver 313 | sentry-rails (~> 5.10) 314 | sentry-ruby (~> 5.10) 315 | sprockets-rails 316 | sqlite3 (~> 1.4) 317 | stimulus-rails 318 | turbo-rails 319 | tzinfo-data 320 | web-console 321 | webdrivers 322 | whenever 323 | will_paginate (~> 3.3) 324 | 325 | RUBY VERSION 326 | ruby 3.2.2p53 327 | 328 | BUNDLED WITH 329 | 2.4.18 330 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 4noobs tracker 2 | 3 | Essa aplicação tem como objetivo listar as issues e as pull requests do GitHub de todos os 4noobs cadastrados no [repositório](https://github.com/he4rt/4noobs). 4 | 5 | ### Instalação 6 | 7 | Para fazer a instalação do 4noobs tracker, siga as etapas abaixo: 8 | 9 | #### Pré requisitos 10 | 11 | - [Git](https://git-scm.com/downloads) 12 | - [Ruby](https://www.ruby-lang.org/en/) versão 3.2.2 13 | - [Bundler](https://bundler.io/) 14 | 15 | A maneira de instalar os pacotes acima podem variar de acordo com o seu sistema operacional. Para verificar qual instalação é mais adequada para você, acesse a página oficial dos pacotes requisitados e siga as instruções. 16 | 17 | Para um guia mais direto com a instalação, recomendo entrar no [gorails](https://gorails.com/setup) 18 | 19 | #### Baixando o Projeto 20 | 21 | Com o `git` instalado, clone o repositório 22 | 23 | ```sh 24 | 25 | git clone https://github.com/cherryramatisdev/4noobs_tracker.git && cd 4noobs_tracker 26 | ``` 27 | 28 | #### Instalando as dependências 29 | 30 | Instale todas as dependências executando o seguinte em seu terminal 31 | 32 | ```sh 33 | bundle install 34 | ``` 35 | 36 | #### Iniciando a aplicação 37 | 38 | Parabéns 🎉, você realizou a instalação do projeto. Agora basta iniciar a aplicação 39 | 40 | ```sh 41 | bundle exec rails server 42 | ``` 43 | 44 | #### Fazendo o fetch dos repositórios e issues 45 | 46 | Caso a sua página inicial esteja vazia, você tem duas opções para conseguir desenvolver tranquilamente: 47 | 48 | 1. Usar mock: Super útil caso você tenha interesse apenas em testar o framework e não quer lidar com configuração de tokens e etc (*Recomendado para iniciantes*). 49 | 2. Usar os comandos `fetch`: Caso você tenha interesse em modificar a logica principal da aplicação, necessita lidar com geração de tokens. (**Caso 50 | 51 | ##### Usar mock 52 | 53 | Para usar o mock é super simples, apenas execute o comando: 54 | 55 | ```sh 56 | rails db:seed 57 | ``` 58 | 59 | ##### Usar os comandos fetch 60 | 61 | Para conseguir executar esse comandos é necessária a configuração de uma variável de ambiente no projeto com o token do GitHub para que seja possível acessar a API deles. Por favor referencie a [documentação](/docs/3-como-criar-um-token-github.md) 62 | 63 | ```sh 64 | # Fazendo fetch de todos os repositórios 65 | $ bundle exec rails fetch:repositories 66 | 67 | # Fazendo fetch de todas as issues/pull requests 68 | $ bundle exec rails fetch:issues 69 | ``` 70 | 71 | ## Como contribuir 72 | 73 | Contribuições fazem com que a comunidade open source seja um lugar incrível para aprender, inspirar e criar. Todas as contribuições 74 | são **extremamente apreciadas**! 75 | 76 | > Caso seja iniciante no framework Ruby on Rails, dê uma olhada na [pasta docs](/docs/) 77 | 78 | 1. Realize um Fork do projeto 79 | 2. Crie um branch com a nova feature (`git checkout -b feature/featurebraba`) 80 | 3. Realize o Commit (`git commit -m 'feature/featurebraba'`) 81 | 4. Realize o Push no Branch (`git push origin feature/featurebraba`) 82 | 5. Quando finalizar abra um Pull Request 83 | 84 | ## Pessoas que melhoraram este projeto! 85 | 86 | 87 | 88 | 89 | 96 | 103 | 110 | 117 |
90 | 91 | cherryramatisdev 92 |
93 | Cherry Ramatis 94 |
95 |
97 | 98 | willy-r 99 |
100 | William Rodrigues 101 |
102 |
104 | 105 | Nandosts 106 |
107 | Fernando Melo 108 |
109 |
111 | 112 | harkato 113 |
114 | Null 115 |
116 |
118 | 119 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require_relative 'config/application' 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /app/assets/config/manifest.js: -------------------------------------------------------------------------------- 1 | //= link_tree ../images 2 | //= link_directory ../stylesheets .css 3 | //= link_tree ../../javascript .js 4 | //= link_tree ../../../vendor/javascript .js 5 | -------------------------------------------------------------------------------- /app/assets/images/angular.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/bash.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/c.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/cplusplus.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/crystal.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/csharp.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/css.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/dart.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/default.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/assets/images/django.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/elixir.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/flutter.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/git.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/go.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/haskell.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/html.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/java.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/javascript.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/kotlin.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/linux.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/markdown.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/assets/images/mongodb.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/mysql.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/nextjs.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/ocaml.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/php.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/postgresql.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/python.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/r.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/ruby.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/rust.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/spring.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/swift.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/typescript.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/vim.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/vue.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's 6 | * vendor/assets/stylesheets directory can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the 9 | * compiled file so the styles you add here take precedence over styles defined in any other CSS 10 | * files in this directory. Styles in this file should be added after the last require_* statement. 11 | * It is generally better to create a new file per style scope. 12 | * 13 | *= require_tree . 14 | *= require_self 15 | */ 16 | 17 | html { 18 | font-size: 62.5%; 19 | } 20 | 21 | * { 22 | box-sizing: border-box; 23 | -webkit-font-smoothing: antialiased; 24 | -moz-osx-font-smoothing: grayscale; 25 | 26 | &::before, 27 | &::after { 28 | box-sizing: inherit; 29 | } 30 | } 31 | 32 | body { 33 | font-family: Roboto, sans-serif; 34 | margin: 0; 35 | background-color: #272727; 36 | } 37 | -------------------------------------------------------------------------------- /app/assets/stylesheets/design_system.css: -------------------------------------------------------------------------------- 1 | .pill { 2 | min-width: 4rem; 3 | border-radius: 1rem; 4 | } 5 | 6 | .rounded-smallest { 7 | border-radius: 0.5rem; 8 | } 9 | 10 | .rounded-small { 11 | border-radius: 1rem; 12 | } 13 | 14 | .rounded-medium { 15 | border-radius: 2rem; 16 | } 17 | -------------------------------------------------------------------------------- /app/assets/stylesheets/issue.css: -------------------------------------------------------------------------------- 1 | .issues-wrapper { 2 | --scrollbar-bgc: #CFD8DC; 3 | --scrollbar-thumb-bgc: #a855f7; 4 | 5 | height: 260px; 6 | overflow-y: auto; 7 | scrollbar-width: thin; 8 | scrollbar-color: var(--scrollbar-thumb-bgc) var(--scrollbar-bgc); 9 | } 10 | 11 | .issues-wrapper::-webkit-scrollbar { 12 | width: 11px; 13 | } 14 | 15 | .issues-wrapper::-webkit-scrollbar-track { 16 | background-color: var(--scrollbar-bgc); 17 | } 18 | 19 | .issues-wrapper::-webkit-scrollbar-thumb { 20 | background-color: var(--scrollbar-thumb-bgc) ; 21 | border-radius: 6px; 22 | border: 3px solid var(--scrollbar-bgc); 23 | } 24 | -------------------------------------------------------------------------------- /app/assets/stylesheets/repository.css: -------------------------------------------------------------------------------- 1 | .repository_issue_grid { 2 | display: grid; 3 | grid-template-columns: repeat(auto-fill, minmax(24rem, 1fr)); 4 | gap: 2rem; 5 | } 6 | 7 | .icon-size { 8 | width: 12px; 9 | height: 12px; 10 | } 11 | 12 | .card-badge { 13 | position: absolute; 14 | top: 0; 15 | right: 26px; 16 | width: 28px; 17 | height: 36px; 18 | display: flex; 19 | justify-content: center; 20 | align-items: center; 21 | border-bottom-left-radius: 8px; 22 | border-bottom-right-radius: 8px; 23 | background-color: #7E22CE; 24 | } 25 | -------------------------------------------------------------------------------- /app/assets/stylesheets/spinner.css: -------------------------------------------------------------------------------- 1 | #loading-spinner { 2 | position: fixed; 3 | top: 0; 4 | left: 0; 5 | width: 100%; 6 | height: 100%; 7 | background-color: rgba(255, 255, 255, 0.9); 8 | display: flex; 9 | justify-content: center; 10 | align-items: center; 11 | z-index: 100; 12 | transition: opacity 0.3s; 13 | opacity: 1; 14 | } 15 | 16 | .spinner { 17 | border: 4px solid rgba(255, 255, 255, 0.3); 18 | border-top: 4px solid #3498db; 19 | border-radius: 50%; 20 | width: 40px; 21 | height: 40px; 22 | animation: spin 2s linear infinite; 23 | } 24 | 25 | @keyframes spin { 26 | 0% { transform: rotate(0deg); } 27 | 100% { transform: rotate(360deg); } 28 | } 29 | -------------------------------------------------------------------------------- /app/channels/application_cable/channel.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Channel < ActionCable::Channel::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/channels/application_cable/connection.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Connection < ActionCable::Connection::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | end 3 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cherryramatisdev/4noobs_tracker/1477f73eb905477f66a96057ade2b756e0f98327/app/controllers/concerns/.keep -------------------------------------------------------------------------------- /app/controllers/repository_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RepositoryController < ApplicationController 4 | def index 5 | page = params[:page] || 1 6 | per_page = 10 7 | @repositories = Repository.paginate(page:, per_page:) 8 | 9 | render :index 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/design_system_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # DesignSystemHelper is responsible to provide more logical methods 4 | module DesignSystemHelper 5 | # @param icon_type [String] 6 | # @return [String] With html_safe to be rendered 7 | def icon(icon_type) 8 | case icon_type 9 | in 'issues' 10 | <<~HTML.html_safe 11 | 12 | 13 | 14 | 15 | 16 | HTML 17 | in 'pull' 18 | <<~HTML.html_safe 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | HTML 30 | end 31 | end 32 | 33 | # Returns the technology image pattern. 34 | # 35 | # This method transforms the technology, treating special cases such as 36 | # "C#" into "csharp", removing spaces and transforming to lowercase. 37 | # 38 | # @param technology [String] This represent the parsed technology 39 | def define_technology_image_pattern(technology) 40 | case technology 41 | in 'C#' 42 | 'csharp.svg' 43 | in 'C++' 44 | 'cplusplus.svg' 45 | else 46 | technology.gsub(%r{ }, '').downcase + '.svg' 47 | end 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /app/helpers/heroicon_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module HeroiconHelper 4 | include Heroicon::Engine.helpers 5 | end 6 | -------------------------------------------------------------------------------- /app/helpers/issue_helper.rb: -------------------------------------------------------------------------------- 1 | module IssueHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/repository_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module RepositoryHelper 4 | end 5 | -------------------------------------------------------------------------------- /app/javascript/application.js: -------------------------------------------------------------------------------- 1 | // Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails 2 | import "@hotwired/turbo-rails" 3 | import "controllers" 4 | import "./pagination_loader" 5 | -------------------------------------------------------------------------------- /app/javascript/controllers/application.js: -------------------------------------------------------------------------------- 1 | import { Application } from "@hotwired/stimulus" 2 | 3 | const application = Application.start() 4 | 5 | // Configure Stimulus development experience 6 | application.debug = false 7 | window.Stimulus = application 8 | 9 | export { application } 10 | -------------------------------------------------------------------------------- /app/javascript/controllers/hello_controller.js: -------------------------------------------------------------------------------- 1 | import { Controller } from "@hotwired/stimulus" 2 | 3 | export default class extends Controller { 4 | connect() { 5 | this.element.textContent = "Hello World!" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /app/javascript/controllers/index.js: -------------------------------------------------------------------------------- 1 | // Import and register all your controllers from the importmap under controllers/* 2 | 3 | import { application } from "controllers/application" 4 | 5 | // Eager load all controllers defined in the import map under controllers/**/*_controller 6 | import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading" 7 | eagerLoadControllersFrom("controllers", application) 8 | 9 | // Lazy load controllers as they appear in the DOM (remember not to preload controllers in import map!) 10 | // import { lazyLoadControllersFrom } from "@hotwired/stimulus-loading" 11 | // lazyLoadControllersFrom("controllers", application) 12 | -------------------------------------------------------------------------------- /app/javascript/pagination_loader.js: -------------------------------------------------------------------------------- 1 | window.addEventListener('load', function () { 2 | var loadingSpinner = document.getElementById('loading-spinner'); 3 | if (loadingSpinner) { 4 | setTimeout(function () { 5 | loadingSpinner.style.opacity = 0; 6 | 7 | setTimeout(function () { 8 | loadingSpinner.style.display = 'none'; 9 | }, 300); 10 | }, 300); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /app/jobs/application_job.rb: -------------------------------------------------------------------------------- 1 | class ApplicationJob < ActiveJob::Base 2 | # Automatically retry jobs that encountered a deadlock 3 | # retry_on ActiveRecord::Deadlocked 4 | 5 | # Most jobs are safe to ignore if the underlying records are no longer available 6 | # discard_on ActiveJob::DeserializationError 7 | end 8 | -------------------------------------------------------------------------------- /app/mailers/application_mailer.rb: -------------------------------------------------------------------------------- 1 | class ApplicationMailer < ActionMailer::Base 2 | default from: 'from@example.com' 3 | layout 'mailer' 4 | end 5 | -------------------------------------------------------------------------------- /app/models/application_record.rb: -------------------------------------------------------------------------------- 1 | class ApplicationRecord < ActiveRecord::Base 2 | primary_abstract_class 3 | end 4 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cherryramatisdev/4noobs_tracker/1477f73eb905477f66a96057ade2b756e0f98327/app/models/concerns/.keep -------------------------------------------------------------------------------- /app/models/issue.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Issue < ApplicationRecord 4 | validates :url, presence: true, uniqueness: true 5 | belongs_to :repository 6 | end 7 | -------------------------------------------------------------------------------- /app/models/repository.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Repository < ApplicationRecord 4 | include WillPaginate::ActiveRecord 5 | 6 | validates :name, presence: true, uniqueness: true 7 | has_many :issues 8 | end 9 | -------------------------------------------------------------------------------- /app/services/github/extract_issues_from_repository.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'json' 4 | 5 | module Github 6 | class ExtractIssuesFromRepository 7 | # @param name [String] 8 | # @param owner [String] 9 | # @return [void] 10 | def call(id:, name:, owner:) 11 | gh_token = "Bearer #{ENV.fetch('GH_API_KEY', nil)}" 12 | response = http_client(url: "https://api.github.com/repos/#{owner}/#{name}/issues", 13 | headers: { 'Authorization' => gh_token }) 14 | 15 | json_response = JSON.parse(response.body) 16 | 17 | return [] if json_response.empty? || json_response.nil? 18 | 19 | batch_upsert_to_table(response: json_response, repository_id: id) 20 | end 21 | 22 | private 23 | 24 | # @param url [String] 25 | # @param headers [Array>] 26 | def http_client(url:, headers:) 27 | HTTParty.get(url, { headers: }) 28 | end 29 | 30 | # @param issue [Array|Hash] 31 | # @return [Boolean] 32 | def validate_issue_object(issue) 33 | return false if issue.is_a?(Array) 34 | 35 | %w[title html_url state assignee].all? { |property| issue.key?(property) } 36 | end 37 | 38 | # @param url [String] 39 | # @return [String] 40 | def extract_url_type(url:) 41 | parsed_uri = URI.parse(url) 42 | 43 | parsed_uri.path.split('/')[3] 44 | end 45 | 46 | # @param response [Array] This is after being parsed by JSON.parse 47 | # @return [void] 48 | def batch_upsert_to_table(response:, repository_id:) 49 | issues_to_upsert = [] 50 | 51 | response.each do |obj| 52 | next unless validate_issue_object(obj) 53 | 54 | issue = Issue.find_or_initialize_by(url: obj['html_url']) 55 | issue.assign_attributes( 56 | title: obj['title'], 57 | url: obj['html_url'], 58 | state: obj['state'], 59 | assignee: obj['assignee'] ||= '', 60 | issue_type: extract_url_type(url: obj['html_url']), 61 | repository_id: 62 | ) 63 | 64 | issues_to_upsert << issue 65 | end 66 | 67 | Issue.transaction do 68 | issues_to_upsert.each(&:save!) 69 | end 70 | end 71 | end 72 | end 73 | -------------------------------------------------------------------------------- /app/services/github/extract_repositories.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'json' 4 | 5 | module Github 6 | class ExtractRepositories 7 | def call 8 | response = HTTParty.get('https://raw.githubusercontent.com/he4rt/4noobs/master/README.MD') 9 | 10 | extract_repositories_info(response.body).compact 11 | end 12 | 13 | private 14 | 15 | # Returns an array of hashes representing GitHub repository information of a 4Noob. 16 | # 17 | # This method extracts each row from the README markdown tables, and iterates 18 | # over each row to extract 4Noob repository information. 19 | # 20 | # @param response_string [String] This represent the whole raw README 21 | # @return [Array] An array of hashes containing GitHub repository information of a 4Noob. 22 | def extract_repositories_info(response_string) 23 | repositories_info = [] 24 | 25 | table_row_regex = /\|.*\|?/ 26 | response_string.scan(table_row_regex) do |row| 27 | repository_info = extract_repository_info_from_row(row) 28 | next if repository_info.nil? 29 | 30 | repositories_info << repository_info 31 | end 32 | 33 | repositories_info 34 | end 35 | 36 | # Returns a hash with repository information about a valid 4Noob repository or nil otherwise. 37 | # 38 | # Extract information from row table about a valid 4Noob repository (published 4Noob), 39 | # if row doesn't match a valid repository, it will return nil. 40 | # 41 | # @param row [String] This represent a specific row of a markdown table 42 | # @return [Hash|nil] Hash containing GitHub repository information of a 4Noob or nil 43 | def extract_repository_info_from_row(row) 44 | row_info_regex = %r{\| ([^\|]*) .* \[Clique aqui ➡️\]\((https://github\.com/([^/]+)/([^/]+\w))/?\)} 45 | row_info_match = row.match(row_info_regex) 46 | # Ignores row that don't have GitHub repo. 47 | # For example headers table and unpublished 4Noobs. 48 | return if row_info_match.nil? 49 | 50 | { 51 | owner: row_info_match[3], 52 | repo_name: row_info_match[4], 53 | full_url: row_info_match[2], 54 | technology: row_info_match[1].strip 55 | } 56 | end 57 | end 58 | end 59 | -------------------------------------------------------------------------------- /app/views/layouts/_spinner.html.erb: -------------------------------------------------------------------------------- 1 | <%= stylesheet_link_tag 'spinner.css' %> 2 | 3 |
4 |
5 |
6 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 4Noobs Tracker | All 4Noobs Repositories 5 | 6 | 7 | 8 | 9 | 10 | <%= csrf_meta_tags %> 11 | <%= csp_meta_tag %> 12 | 13 | <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> 14 | 15 | 16 | 17 | 18 | <%= javascript_include_tag 'cdn/unocss-runtime' %> 19 | <%= javascript_importmap_tags %> 20 | 21 | 22 | 23 | <%= render 'layouts/spinner' %> 24 | 25 |
26 | <%= yield %> 27 |
28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.text.erb: -------------------------------------------------------------------------------- 1 | <%= yield %> 2 | -------------------------------------------------------------------------------- /app/views/repository/_card.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <% if has_badge %> 3 | <%= render "card_badge", technology: repository.technology %> 4 | <% end %> 5 | 6 |
7 |

8 | <%= repository.name %> 9 |

10 | 11 |
12 | <% repository.issues.each do |issue| %> 13 |
14 | <%= icon issue.issue_type %> 15 |
16 | 17 | <%= issue.title %> 18 | 19 | 20 |
21 | <%= render "tag", content: issue.state %> 22 |
23 |
24 |
25 | <% end %> 26 |
27 |
28 | 29 |
30 |
31 | <%= heroicon 'arrow-top-right-on-square', options: { class: 'icon-size color-purple-9' } %> 32 | Ver todas as issues 33 |
34 |
35 | <%= heroicon 'arrow-top-right-on-square', options: { class: 'icon-size color-purple-9' } %> 36 | Ver todos os PRs 37 |
38 |
39 | <%= heroicon 'arrow-top-right-on-square', options: { class: 'icon-size color-purple-9' } %> 40 | Abrir repositório 41 |
42 |
43 |
44 | -------------------------------------------------------------------------------- /app/views/repository/_card_badge.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%= 'Card of the repository ' + technology %> 8 |
9 | -------------------------------------------------------------------------------- /app/views/repository/_tag.html.erb: -------------------------------------------------------------------------------- 1 |
2 | 3 | <%= content %> 4 | 5 |
6 | -------------------------------------------------------------------------------- /app/views/repository/index.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <% @repositories.each do |repository| %> 3 | <% unless repository.issues.empty? %> 4 | <%= render 'card', has_badge: true, repository: %> 5 | <% end %> 6 | <% end %> 7 |
8 | 9 | 55 | 56 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'bundle' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "rubygems" 12 | 13 | m = Module.new do 14 | module_function 15 | 16 | def invoked_as_script? 17 | File.expand_path($0) == File.expand_path(__FILE__) 18 | end 19 | 20 | def env_var_version 21 | ENV["BUNDLER_VERSION"] 22 | end 23 | 24 | def cli_arg_version 25 | return unless invoked_as_script? # don't want to hijack other binstubs 26 | return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update` 27 | bundler_version = nil 28 | update_index = nil 29 | ARGV.each_with_index do |a, i| 30 | if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN 31 | bundler_version = a 32 | end 33 | next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ 34 | bundler_version = $1 35 | update_index = i 36 | end 37 | bundler_version 38 | end 39 | 40 | def gemfile 41 | gemfile = ENV["BUNDLE_GEMFILE"] 42 | return gemfile if gemfile && !gemfile.empty? 43 | 44 | File.expand_path("../Gemfile", __dir__) 45 | end 46 | 47 | def lockfile 48 | lockfile = 49 | case File.basename(gemfile) 50 | when "gems.rb" then gemfile.sub(/\.rb$/, ".locked") 51 | else "#{gemfile}.lock" 52 | end 53 | File.expand_path(lockfile) 54 | end 55 | 56 | def lockfile_version 57 | return unless File.file?(lockfile) 58 | lockfile_contents = File.read(lockfile) 59 | return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ 60 | Regexp.last_match(1) 61 | end 62 | 63 | def bundler_requirement 64 | @bundler_requirement ||= 65 | env_var_version || 66 | cli_arg_version || 67 | bundler_requirement_for(lockfile_version) 68 | end 69 | 70 | def bundler_requirement_for(version) 71 | return "#{Gem::Requirement.default}.a" unless version 72 | 73 | bundler_gem_version = Gem::Version.new(version) 74 | 75 | bundler_gem_version.approximate_recommendation 76 | end 77 | 78 | def load_bundler! 79 | ENV["BUNDLE_GEMFILE"] ||= gemfile 80 | 81 | activate_bundler 82 | end 83 | 84 | def activate_bundler 85 | gem_error = activation_error_handling do 86 | gem "bundler", bundler_requirement 87 | end 88 | return if gem_error.nil? 89 | require_error = activation_error_handling do 90 | require "bundler/version" 91 | end 92 | return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION)) 93 | warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`" 94 | exit 42 95 | end 96 | 97 | def activation_error_handling 98 | yield 99 | nil 100 | rescue StandardError, LoadError => e 101 | e 102 | end 103 | end 104 | 105 | m.load_bundler! 106 | 107 | if m.invoked_as_script? 108 | load Gem.bin_path("bundler", "bundle") 109 | end 110 | -------------------------------------------------------------------------------- /bin/docker-entrypoint: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # If running the rails server then create or migrate existing database 4 | if [ "${*}" == "./bin/rails server" ]; then 5 | ./bin/rails db:prepare 6 | fi 7 | 8 | exec "${@}" 9 | -------------------------------------------------------------------------------- /bin/importmap: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require_relative "../config/application" 4 | require "importmap/commands" 5 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | APP_PATH = File.expand_path("../config/application", __dir__) 3 | require_relative "../config/boot" 4 | require "rails/commands" 5 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require_relative "../config/boot" 3 | require "rake" 4 | Rake.application.run 5 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require "fileutils" 3 | 4 | # path to your application root. 5 | APP_ROOT = File.expand_path("..", __dir__) 6 | 7 | def system!(*args) 8 | system(*args) || abort("\n== Command #{args} failed ==") 9 | end 10 | 11 | FileUtils.chdir APP_ROOT do 12 | # This script is a way to set up or update your development environment automatically. 13 | # This script is idempotent, so that you can run it at any time and get an expectable outcome. 14 | # Add necessary setup steps to this file. 15 | 16 | puts "== Installing dependencies ==" 17 | system! "gem install bundler --conservative" 18 | system("bundle check") || system!("bundle install") 19 | 20 | # puts "\n== Copying sample files ==" 21 | # unless File.exist?("config/database.yml") 22 | # FileUtils.cp "config/database.yml.sample", "config/database.yml" 23 | # end 24 | 25 | puts "\n== Preparing database ==" 26 | system! "bin/rails db:prepare" 27 | 28 | puts "\n== Removing old logs and tempfiles ==" 29 | system! "bin/rails log:clear tmp:clear" 30 | 31 | puts "\n== Restarting application server ==" 32 | system! "bin/rails restart" 33 | end 34 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require_relative 'config/environment' 4 | 5 | run Rails.application 6 | Rails.application.load_server 7 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require_relative 'boot' 2 | 3 | require 'rails/all' 4 | 5 | # Require the gems listed in Gemfile, including any gems 6 | # you've limited to :test, :development, or :production. 7 | Bundler.require(*Rails.groups) 8 | 9 | # Load dotenv only in development or test environment 10 | Dotenv::Railtie.load if %w[development test].include? ENV['RAILS_ENV'] 11 | 12 | module GhIssueLister 13 | class Application < Rails::Application 14 | # Initialize configuration defaults for originally generated Rails version. 15 | config.load_defaults 7.0 16 | 17 | config.hosts << 'fornoobstracker.fly.dev' 18 | config.hosts << '127.0.0.1' 19 | 20 | # Because Sqlite3 is all right 21 | config.active_record.sqlite3_production_warning = false 22 | 23 | # Configuration for the application, engines, and railties goes here. 24 | # 25 | # These settings can be overridden in specific environments using the files 26 | # in config/environments, which are processed later. 27 | # 28 | # config.time_zone = "Central Time (US & Canada)" 29 | # config.eager_load_paths << Rails.root.join("extras") 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) 2 | 3 | require 'bundler/setup' # Set up gems listed in the Gemfile. 4 | require 'bootsnap/setup' # Speed up boot time by caching expensive operations. 5 | -------------------------------------------------------------------------------- /config/cable.yml: -------------------------------------------------------------------------------- 1 | development: 2 | adapter: async 3 | 4 | test: 5 | adapter: test 6 | 7 | production: 8 | adapter: redis 9 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> 10 | channel_prefix: gh_issue_lister_production 11 | -------------------------------------------------------------------------------- /config/credentials.yml.enc: -------------------------------------------------------------------------------- 1 | Oe0TKO85EuexflQ4jjrjMPiobhK/eMTppGiKIhqpCetFPUutRnYL81xX1sNuKJmFXKlYFRRrr/EsWdfBeaVFR+spF2ehMPN2k12q+BMyu6R6YWVJS3mux7/cqVa7QLh0GyN90iH0Utq25Yxotb/bPR0sAA6eF3idjVfu/nyOO+GFPSXaquoDBGZhPDj2e7y1C8rLndiG0IQrmmrFEoErRJAABdNH/msa4g4cXp/nAVkjBRUzbo8JIezRjTBjeqVeRSpK7x/MQv3dOmJOy0e6NypuyVngciBCYQxwMSBkkimbBiu422HgscfDP8eSfcf8pzMitvy8Xw853ZI3iBPp3nun1QvF4dLb8iR25b6DFGmz0i+S8AxTnpDZBURmO6vUptDtvX/qkeDHqBn59WS9HydGSf9P85w1ocg0--Ze7ZcAKooS/EeX/J--K+WKeKJyOXGMBXwaia4RDQ== -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | # SQLite. Versions 3.8.0 and up are supported. 2 | # gem install sqlite3 3 | # 4 | # Ensure the SQLite 3 gem is defined in your Gemfile 5 | # gem "sqlite3" 6 | # 7 | default: &default 8 | adapter: sqlite3 9 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> 10 | timeout: 5000 11 | 12 | development: 13 | <<: *default 14 | database: db/development.sqlite3 15 | 16 | # Warning: The database defined as "test" will be erased and 17 | # re-generated from your development database when you run "rake". 18 | # Do not set this db to the same as development or production. 19 | test: 20 | <<: *default 21 | database: db/test.sqlite3 22 | 23 | production: 24 | <<: *default 25 | database: db/production.sqlite3 26 | -------------------------------------------------------------------------------- /config/dockerfile.yml: -------------------------------------------------------------------------------- 1 | # generated by dockerfile-rails 2 | 3 | --- 4 | options: 5 | label: 6 | fly_launch_runtime: rails 7 | sentry: true 8 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require_relative 'application' 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | require 'active_support/core_ext/integer/time' 2 | 3 | Rails.application.configure do 4 | # Settings specified here will take precedence over those in config/application.rb. 5 | 6 | # In the development environment your application's code is reloaded any time 7 | # it changes. This slows down response time but is perfect for development 8 | # since you don't have to restart the web server when you make code changes. 9 | config.cache_classes = false 10 | 11 | # Do not eager load code on boot. 12 | config.eager_load = false 13 | 14 | # Show full error reports. 15 | config.consider_all_requests_local = true 16 | 17 | # Enable server timing 18 | config.server_timing = true 19 | 20 | # Enable/disable caching. By default caching is disabled. 21 | # Run rails dev:cache to toggle caching. 22 | if Rails.root.join('tmp/caching-dev.txt').exist? 23 | config.action_controller.perform_caching = true 24 | config.action_controller.enable_fragment_cache_logging = true 25 | 26 | config.cache_store = :memory_store 27 | config.public_file_server.headers = { 28 | 'Cache-Control' => "public, max-age=#{2.days.to_i}" 29 | } 30 | else 31 | config.action_controller.perform_caching = false 32 | 33 | config.cache_store = :null_store 34 | end 35 | 36 | # Store uploaded files on the local file system (see config/storage.yml for options). 37 | config.active_storage.service = :local 38 | 39 | # Don't care if the mailer can't send. 40 | config.action_mailer.raise_delivery_errors = false 41 | 42 | config.action_mailer.perform_caching = false 43 | 44 | # Print deprecation notices to the Rails logger. 45 | config.active_support.deprecation = :log 46 | 47 | # Raise exceptions for disallowed deprecations. 48 | config.active_support.disallowed_deprecation = :raise 49 | 50 | # Tell Active Support which deprecation messages to disallow. 51 | config.active_support.disallowed_deprecation_warnings = [] 52 | 53 | # Raise an error on page load if there are pending migrations. 54 | config.active_record.migration_error = :page_load 55 | 56 | # Highlight code that triggered database queries in logs. 57 | config.active_record.verbose_query_logs = true 58 | 59 | # Suppress logger output for asset requests. 60 | config.assets.quiet = true 61 | 62 | # Raises error for missing translations. 63 | # config.i18n.raise_on_missing_translations = true 64 | 65 | # Annotate rendered view with file names. 66 | # config.action_view.annotate_rendered_view_with_filenames = true 67 | 68 | # Uncomment if you wish to allow Action Cable access from any origin. 69 | # config.action_cable.disable_request_forgery_protection = true 70 | end 71 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | require 'active_support/core_ext/integer/time' 2 | 3 | Rails.application.configure do 4 | # Settings specified here will take precedence over those in config/application.rb. 5 | 6 | # Code is not reloaded between requests. 7 | config.cache_classes = true 8 | 9 | # Eager load code on boot. This eager loads most of Rails and 10 | # your application in memory, allowing both threaded web servers 11 | # and those relying on copy on write to perform better. 12 | # Rake tasks automatically ignore this option for performance. 13 | config.eager_load = true 14 | 15 | # Full error reports are disabled and caching is turned on. 16 | config.consider_all_requests_local = false 17 | config.action_controller.perform_caching = true 18 | 19 | # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] 20 | # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). 21 | # config.require_master_key = true 22 | 23 | # Disable serving static files from the `/public` folder by default since 24 | # Apache or NGINX already handles this. 25 | config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? 26 | 27 | # Compress CSS using a preprocessor. 28 | # config.assets.css_compressor = :sass 29 | 30 | # Do not fallback to assets pipeline if a precompiled asset is missed. 31 | config.assets.compile = false 32 | 33 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 34 | # config.asset_host = "http://assets.example.com" 35 | 36 | # Specifies the header that your server uses for sending files. 37 | # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache 38 | # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX 39 | 40 | # Store uploaded files on the local file system (see config/storage.yml for options). 41 | config.active_storage.service = :local 42 | 43 | # Mount Action Cable outside main process or domain. 44 | # config.action_cable.mount_path = nil 45 | # config.action_cable.url = "wss://example.com/cable" 46 | # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ] 47 | 48 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 49 | # config.force_ssl = true 50 | 51 | # Include generic and useful information about system operation, but avoid logging too much 52 | # information to avoid inadvertent exposure of personally identifiable information (PII). 53 | config.log_level = :info 54 | 55 | # Prepend all log lines with the following tags. 56 | config.log_tags = [:request_id] 57 | 58 | # Use a different cache store in production. 59 | # config.cache_store = :mem_cache_store 60 | 61 | # Use a real queuing backend for Active Job (and separate queues per environment). 62 | # config.active_job.queue_adapter = :resque 63 | # config.active_job.queue_name_prefix = "gh_issue_lister_production" 64 | 65 | config.action_mailer.perform_caching = false 66 | 67 | # Ignore bad email addresses and do not raise email delivery errors. 68 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 69 | # config.action_mailer.raise_delivery_errors = false 70 | 71 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 72 | # the I18n.default_locale when a translation cannot be found). 73 | config.i18n.fallbacks = true 74 | 75 | # Don't log any deprecations. 76 | config.active_support.report_deprecations = false 77 | 78 | # Use default logging formatter so that PID and timestamp are not suppressed. 79 | config.log_formatter = Logger::Formatter.new 80 | 81 | # Use a different logger for distributed setups. 82 | # require "syslog/logger" 83 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name") 84 | 85 | if ENV['RAILS_LOG_TO_STDOUT'].present? 86 | logger = ActiveSupport::Logger.new(STDOUT) 87 | logger.formatter = config.log_formatter 88 | config.logger = ActiveSupport::TaggedLogging.new(logger) 89 | end 90 | 91 | # Do not dump schema after migrations. 92 | config.active_record.dump_schema_after_migration = false 93 | end 94 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | require 'active_support/core_ext/integer/time' 2 | 3 | # The test environment is used exclusively to run your application's 4 | # test suite. You never need to work with it otherwise. Remember that 5 | # your test database is "scratch space" for the test suite and is wiped 6 | # and recreated between test runs. Don't rely on the data there! 7 | 8 | Rails.application.configure do 9 | # Settings specified here will take precedence over those in config/application.rb. 10 | 11 | # Turn false under Spring and add config.action_view.cache_template_loading = true. 12 | config.cache_classes = true 13 | 14 | # Eager loading loads your whole application. When running a single test locally, 15 | # this probably isn't necessary. It's a good idea to do in a continuous integration 16 | # system, or in some way before deploying your code. 17 | config.eager_load = ENV['CI'].present? 18 | 19 | # Configure public file server for tests with Cache-Control for performance. 20 | config.public_file_server.enabled = true 21 | config.public_file_server.headers = { 22 | 'Cache-Control' => "public, max-age=#{1.hour.to_i}" 23 | } 24 | 25 | # Show full error reports and disable caching. 26 | config.consider_all_requests_local = true 27 | config.action_controller.perform_caching = false 28 | config.cache_store = :null_store 29 | 30 | # Raise exceptions instead of rendering exception templates. 31 | config.action_dispatch.show_exceptions = false 32 | 33 | # Disable request forgery protection in test environment. 34 | config.action_controller.allow_forgery_protection = false 35 | 36 | # Store uploaded files on the local file system in a temporary directory. 37 | config.active_storage.service = :test 38 | 39 | config.action_mailer.perform_caching = false 40 | 41 | # Tell Action Mailer not to deliver emails to the real world. 42 | # The :test delivery method accumulates sent emails in the 43 | # ActionMailer::Base.deliveries array. 44 | config.action_mailer.delivery_method = :test 45 | 46 | # Print deprecation notices to the stderr. 47 | config.active_support.deprecation = :stderr 48 | 49 | # Raise exceptions for disallowed deprecations. 50 | config.active_support.disallowed_deprecation = :raise 51 | 52 | # Tell Active Support which deprecation messages to disallow. 53 | config.active_support.disallowed_deprecation_warnings = [] 54 | 55 | # Raises error for missing translations. 56 | # config.i18n.raise_on_missing_translations = true 57 | 58 | # Annotate rendered view with file names. 59 | # config.action_view.annotate_rendered_view_with_filenames = true 60 | end 61 | -------------------------------------------------------------------------------- /config/importmap.rb: -------------------------------------------------------------------------------- 1 | # Pin npm packages by running ./bin/importmap 2 | 3 | pin 'application', preload: true 4 | pin '@hotwired/turbo-rails', to: 'turbo.min.js', preload: true 5 | pin '@hotwired/stimulus', to: 'stimulus.min.js', preload: true 6 | pin '@hotwired/stimulus-loading', to: 'stimulus-loading.js', preload: true 7 | pin_all_from 'app/javascript/controllers', under: 'controllers' 8 | -------------------------------------------------------------------------------- /config/initializers/assets.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Version of your assets, change this if you want to expire all your assets. 4 | Rails.application.config.assets.version = '1.0' 5 | 6 | # Add additional assets to the asset load path. 7 | # Rails.application.config.assets.paths << Emoji.images_path 8 | 9 | # Precompile additional assets. 10 | # application.js, application.css, and all non-JS/CSS in the app/assets 11 | # folder are already added. 12 | # Rails.application.config.assets.precompile += %w( admin.js admin.css ) 13 | -------------------------------------------------------------------------------- /config/initializers/content_security_policy.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Define an application-wide content security policy. 4 | # See the Securing Rails Applications Guide for more information: 5 | # https://guides.rubyonrails.org/security.html#content-security-policy-header 6 | 7 | # Rails.application.configure do 8 | # config.content_security_policy do |policy| 9 | # policy.default_src :self, :https 10 | # policy.font_src :self, :https, :data 11 | # policy.img_src :self, :https, :data 12 | # policy.object_src :none 13 | # policy.script_src :self, :https 14 | # policy.style_src :self, :https 15 | # # Specify URI for violation reports 16 | # # policy.report_uri "/csp-violation-report-endpoint" 17 | # end 18 | # 19 | # # Generate session nonces for permitted importmap and inline scripts 20 | # config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s } 21 | # config.content_security_policy_nonce_directives = %w(script-src) 22 | # 23 | # # Report violations without enforcing the policy. 24 | # # config.content_security_policy_report_only = true 25 | # end 26 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure parameters to be filtered from the log file. Use this to limit dissemination of 4 | # sensitive information. See the ActiveSupport::ParameterFilter documentation for supported 5 | # notations and behaviors. 6 | Rails.application.config.filter_parameters += %i[ 7 | passw secret token _key crypt salt certificate otp ssn 8 | ] 9 | -------------------------------------------------------------------------------- /config/initializers/heroicon.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Heroicon.configure do |config| 4 | config.variant = :solid # Options are :solid, :outline and :mini 5 | 6 | ## 7 | # You can set a default class, which will get applied to every icon with 8 | # the given variant. To do so, un-comment the line below. 9 | # config.default_class = {solid: "h-5 w-5", outline: "h-6 w-6", mini: "h-4 w-4"} 10 | end 11 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format. Inflections 4 | # are locale specific, and you may define rules for as many different 5 | # locales as you wish. All of these examples are active by default: 6 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 7 | # inflect.plural /^(ox)$/i, "\\1en" 8 | # inflect.singular /^(ox)en/i, "\\1" 9 | # inflect.irregular "person", "people" 10 | # inflect.uncountable %w( fish sheep ) 11 | # end 12 | 13 | # These inflection rules are supported but not enabled by default: 14 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 15 | # inflect.acronym "RESTful" 16 | # end 17 | -------------------------------------------------------------------------------- /config/initializers/permissions_policy.rb: -------------------------------------------------------------------------------- 1 | # Define an application-wide HTTP permissions policy. For further 2 | # information see https://developers.google.com/web/updates/2018/06/feature-policy 3 | # 4 | # Rails.application.config.permissions_policy do |f| 5 | # f.camera :none 6 | # f.gyroscope :none 7 | # f.microphone :none 8 | # f.usb :none 9 | # f.fullscreen :self 10 | # f.payment :self, "https://secure.example.com" 11 | # end 12 | -------------------------------------------------------------------------------- /config/initializers/sentry.rb: -------------------------------------------------------------------------------- 1 | if ENV['SENTRY_DSN'] 2 | 3 | Sentry.init do |config| 4 | config.dsn = ENV['SENTRY_DSN'] 5 | config.breadcrumbs_logger = %i[active_support_logger http_logger] 6 | 7 | # Set traces_sample_rate to 1.0 to capture 100% 8 | # of transactions for performance monitoring. 9 | # We recommend adjusting this value in production. 10 | config.traces_sample_rate = 1.0 11 | # or 12 | config.traces_sampler = lambda do |_context| 13 | true 14 | end 15 | end 16 | 17 | end 18 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Files in the config/locales directory are used for internationalization 2 | # and are automatically loaded by Rails. If you want to use locales other 3 | # than English, add the necessary files in this directory. 4 | # 5 | # To use the locales, use `I18n.t`: 6 | # 7 | # I18n.t "hello" 8 | # 9 | # In views, this is aliased to just `t`: 10 | # 11 | # <%= t("hello") %> 12 | # 13 | # To use a different locale, set it with `I18n.locale`: 14 | # 15 | # I18n.locale = :es 16 | # 17 | # This would use the information in config/locales/es.yml. 18 | # 19 | # The following keys must be escaped otherwise they will not be retrieved by 20 | # the default I18n backend: 21 | # 22 | # true, false, on, off, yes, no 23 | # 24 | # Instead, surround them with single quotes. 25 | # 26 | # en: 27 | # "true": "foo" 28 | # 29 | # To learn more, please read the Rails Internationalization guide 30 | # available at https://guides.rubyonrails.org/i18n.html. 31 | 32 | en: 33 | hello: "Hello world" 34 | -------------------------------------------------------------------------------- /config/puma.rb: -------------------------------------------------------------------------------- 1 | # Puma can serve each request in a thread from an internal thread pool. 2 | # The `threads` method setting takes two numbers: a minimum and maximum. 3 | # Any libraries that use thread pools should be configured to match 4 | # the maximum value specified for Puma. Default is set to 5 threads for minimum 5 | # and maximum; this matches the default thread size of Active Record. 6 | # 7 | max_threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 } 8 | min_threads_count = ENV.fetch('RAILS_MIN_THREADS') { max_threads_count } 9 | threads min_threads_count, max_threads_count 10 | 11 | # Specifies the `worker_timeout` threshold that Puma will use to wait before 12 | # terminating a worker in development environments. 13 | # 14 | worker_timeout 3600 if ENV.fetch('RAILS_ENV', 'development') == 'development' 15 | 16 | # Specifies the `port` that Puma will listen on to receive requests; default is 3000. 17 | # 18 | port ENV.fetch('PORT') { 3000 } 19 | 20 | # Specifies the `environment` that Puma will run in. 21 | # 22 | environment ENV.fetch('RAILS_ENV') { 'development' } 23 | 24 | # Specifies the `pidfile` that Puma will use. 25 | pidfile ENV.fetch('PIDFILE') { 'tmp/pids/server.pid' } 26 | 27 | # Specifies the number of `workers` to boot in clustered mode. 28 | # Workers are forked web server processes. If using threads and workers together 29 | # the concurrency of the application would be max `threads` * `workers`. 30 | # Workers do not work on JRuby or Windows (both of which do not support 31 | # processes). 32 | # 33 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 } 34 | 35 | # Use the `preload_app!` method when specifying a `workers` number. 36 | # This directive tells Puma to first boot the application and load code 37 | # before forking the application. This takes advantage of Copy On Write 38 | # process behavior so workers use less memory. 39 | # 40 | # preload_app! 41 | 42 | # Allow puma to be restarted by `bin/rails restart` command. 43 | plugin :tmp_restart 44 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Rails.application.routes.draw do 4 | root 'repository#index' 5 | 6 | resources :repository, only: %i[index] 7 | end 8 | -------------------------------------------------------------------------------- /config/schedule.rb: -------------------------------------------------------------------------------- 1 | every :day, at: '06:00am' do 2 | rake 'fetch:issues' 3 | end 4 | -------------------------------------------------------------------------------- /config/storage.yml: -------------------------------------------------------------------------------- 1 | test: 2 | service: Disk 3 | root: <%= Rails.root.join("tmp/storage") %> 4 | 5 | local: 6 | service: Disk 7 | root: <%= Rails.root.join("storage") %> 8 | 9 | # Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) 10 | # amazon: 11 | # service: S3 12 | # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> 13 | # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> 14 | # region: us-east-1 15 | # bucket: your_own_bucket-<%= Rails.env %> 16 | 17 | # Remember not to checkin your GCS keyfile to a repository 18 | # google: 19 | # service: GCS 20 | # project: your_project 21 | # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> 22 | # bucket: your_own_bucket-<%= Rails.env %> 23 | 24 | # Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) 25 | # microsoft: 26 | # service: AzureStorage 27 | # storage_account_name: your_account_name 28 | # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> 29 | # container: your_container_name-<%= Rails.env %> 30 | 31 | # mirror: 32 | # service: Mirror 33 | # primary: local 34 | # mirrors: [ amazon, google, microsoft ] 35 | -------------------------------------------------------------------------------- /db/migrate/20230816134816_create_repositories.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class CreateRepositories < ActiveRecord::Migration[7.0] 4 | def change 5 | create_table :repositories do |t| 6 | t.string :name 7 | t.string :owner 8 | t.string :url 9 | 10 | t.timestamps 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20230828184031_create_issues.rb: -------------------------------------------------------------------------------- 1 | class CreateIssues < ActiveRecord::Migration[7.0] 2 | def change 3 | create_table :issues do |t| 4 | t.string :title 5 | t.string :url 6 | t.string :state 7 | t.string :assignee 8 | t.string :type 9 | t.references :repository, null: false, foreign_key: true 10 | 11 | t.timestamps 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /db/migrate/20230828185252_change_issue_field_from_type_to_issue_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ChangeIssueFieldFromTypeToIssueType < ActiveRecord::Migration[7.0] 4 | def change 5 | rename_column :issues, :type, :issue_type 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20230918175013_add_technology_column_to_repository.rb: -------------------------------------------------------------------------------- 1 | class AddTechnologyColumnToRepository < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :repositories, :technology, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/schema.rb: -------------------------------------------------------------------------------- 1 | # This file is auto-generated from the current state of the database. Instead 2 | # of editing this file, please use the migrations feature of Active Record to 3 | # incrementally modify your database, and then regenerate this schema definition. 4 | # 5 | # This file is the source Rails uses to define your schema when running `bin/rails 6 | # db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to 7 | # be faster and is potentially less error prone than running all of your 8 | # migrations from scratch. Old migrations may fail to apply correctly if those 9 | # migrations use external dependencies or application code. 10 | # 11 | # It's strongly recommended that you check this file into your version control system. 12 | 13 | ActiveRecord::Schema[7.0].define(version: 20_230_918_175_013) do 14 | create_table 'issues', force: :cascade do |t| 15 | t.string 'title' 16 | t.string 'url' 17 | t.string 'state' 18 | t.string 'assignee' 19 | t.string 'issue_type' 20 | t.integer 'repository_id', null: false 21 | t.datetime 'created_at', null: false 22 | t.datetime 'updated_at', null: false 23 | t.index ['repository_id'], name: 'index_issues_on_repository_id' 24 | end 25 | 26 | create_table 'repositories', force: :cascade do |t| 27 | t.string 'name' 28 | t.string 'owner' 29 | t.string 'url' 30 | t.datetime 'created_at', null: false 31 | t.datetime 'updated_at', null: false 32 | t.string 'technology' 33 | end 34 | 35 | add_foreign_key 'issues', 'repositories' 36 | end 37 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'faker' 4 | 5 | # Create 10 repositories 6 | 10.times do 7 | repository = Repository.create( 8 | name: Faker::App.name, 9 | owner: Faker::Internet.user_name, 10 | url: Faker::Internet.url, 11 | technology: Faker::ProgrammingLanguage.name 12 | ) 13 | 14 | # Create 2 issues for each repository 15 | 2.times do 16 | Issue.create( 17 | title: Faker::Lorem.sentence, 18 | url: Faker::Internet.url, 19 | state: 'open', 20 | assignee: Faker::Internet.user_name, 21 | issue_type: 'issues', 22 | repository: 23 | ) 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /docs/1-como-estilizar-uma-pagina.md: -------------------------------------------------------------------------------- 1 | # Como estilizar uma pagina 2 | 3 | Para iniciantes no framework ruby on rails a arquitetura inicial pode ser um pouco intimidadora, afim de facilitar a contribuição de pessoas não especializadas no framework vou descrever de forma simples onde podemos achar o HTML de uma pagina e como estilizamos com CSS. 4 | 5 | ## Onde esta meu arquivo HTML? 6 | 7 | Para nos localizarmos no projeto, vou lhe apresentar os três locais que vão ser uteis para uma contribuição front-end: 8 | 9 | 1. `app/assets/stylesheets`: Aqui vamos ter todos os nossos arquivos CSS, como todos os estilos são interpretados globalmente é importante aplicar alguma técnica de namespace no nome das classes. 10 | 2. `app/views/`: Aqui temos todos os arquivos HTML, esses arquivos normalmente estão dentro de uma pasta inicial de contexto como `issue` e dentro dela vão estar os arquivos com extensão `.html.erb` 11 | 3. `config/routes.rb`: Aqui temos listados todas as nossas rotas(já vamos aprender como ler essas rotas) 12 | 13 | ## Interpretando o arquivo de rotas 14 | 15 | O arquivo de rotas pode se tornar muito complexo, mas para estilizarmos podemos nos ater a pequenos conceitos: 16 | 17 | Para cada método teremos uma string seguindo o padrão "nome_do_controller#nome_do_arquivo_html", por exemplo podemos olhar o nosso arquivo router: 18 | 19 | ```ruby 20 | # frozen_string_literal: true 21 | 22 | Rails.application.routes.draw do 23 | root 'repository#index' 24 | end 25 | ``` 26 | 27 | Como pode ver, o método `root` representa o controller `repository` (encontrado em `app/controllers/repository_controller.rb`) junto com a view `index` 28 | 29 | Nesse caso estamos falando do arquivo `app/views/repository/index.html.erb`, simples certo? O framework inteiro segue uma logica muito bem estruturada então podemos confiar que esse padrão vai se manter consistentemente. 30 | 31 | A medida que tivermos mais rotas, vamos utilizar o método `get` ao invés do método `root` visto que o root referencia a rota inicial apenas. 32 | 33 | Mas a logica sera a mesma, abaixo deixo um exemplo de uma rota fictícia: 34 | 35 | ```ruby 36 | # frozen_string_literal: true 37 | 38 | Rails.application.routes.draw do 39 | root 'repository#index' 40 | 41 | get 'issue#new' 42 | end 43 | ``` 44 | 45 | Nesse exemplo sabemos que o arquivo sera localizado em `app/views/issue/new.html.erb`. 46 | 47 | Para saber um pouco mais sobre como o ERB funciona, referencie a [próxima pagina](/docs/2-como-utilizar-erb.md) 48 | -------------------------------------------------------------------------------- /docs/2-como-utilizar-erb.md: -------------------------------------------------------------------------------- 1 | # O que é ERB? 2 | 3 | ERB é uma sigla para "Embedded Ruby" e serve para incluirmos código ruby em N tipos de arquivo a fins de template (podemos por exemplo gerar arquivos de configuração dinamicamente usando ERB). No caso do ruby on rails é usado para manipular arquivos HTML que são usados nas nossas views dando mais poder para quem esta desenvolvendo (podendo utilizar condicionais, estruturas de repetição, classes utilitárias da aplicação, etc....) 4 | 5 | Considere o exemplo abaixo: 6 | 7 | ```erb 8 |
    9 | <% @tarefas.each do |tarefa| %> 10 |
  • 11 | <%= tarefa %> 12 |
  • 13 | 14 | <% if tarefa == "Tarefa 3" %> 15 |
  • Tarefa 3 lidada especificamente
  • 16 | <% end %> 17 | <% end %> 18 |
19 | ``` 20 | 21 | ## Diferença entre tag de exibição e tag de controle 22 | 23 | Utilizando ERB temos duas formas de utilizar a linguagem ruby dentro do html: 24 | 25 | - Exibindo algum conteúdo para o usuário final (tela do navegador): 26 | 27 | Nesse caso estamos falando de qualquer coisa que aparece na tela como uma variável, para isso usamos o padrão `<%= %>`. Perceba que o `=` diferencia essa tag em específico, podemos por exemplo exibir o valor de uma variável para a tela(sendo o uso mais comum): `<%= variavel %>` 28 | 29 | - Não exibindo algum conteúdo para o usuário final 30 | 31 | Já nesse caso estamos falando de estruturas que **não** aparecem para o usuário final, logo usamos essa tag para declarar condicionais, estruturas de repetição, etc...Por exemplo podemos usar um if com: `<% if 1 > 0 %>`, esses condicionais vão ser acompanhados de uma tag especial `<% end %>` que indica o escopo onde podemos incluir conteúdo, por exemplo: 32 | 33 | ```erb 34 | <% if 1 > 0 %> 35 |

O valor de 1 é maior que 0

36 | <% end %> 37 | ``` 38 | 39 | ## Estruturas de repetição 40 | 41 | As estruturas de repetição servem para que possamos lidar com listas dentro dos nossos templates, como por exemplo uma lista de tarefas ou de usuários para alguma página em específico. 42 | 43 | - Each 44 | 45 | De longe o mais usado para templates é o each, nele podemos percorrer uma lista diretamente e lidar com cada valor dentro da lista separadamente como podemos ver abaixo: 46 | 47 | ```erb 48 |
    49 | <% [1, 2, 3, 4].each do |numero| %> 50 |
  • <%= numero %> Dentro da lista :D
  • 51 | <% end %> 52 |
53 | ```` 54 | 55 | ## Condicionais 56 | 57 | Como ja falamos no "Diferença entre tag de exibição e tag de controle", podemos utilizar as tags de controle para criar condicionais em nossos templates, essas condicionais podem ter os seguintes tipos (que seguem a linguagem ruby visto que ERB é apenas um Embedded Ruby). 58 | 59 | - If 60 | 61 | Ja vimos algumas vezes o if e com ele podemos construir condicionais unicos ou multiplos considerando primeiro o caminho `true` e depois o caminho `false`, como mostrado abaixo: 62 | 63 | ```erb 64 | <% if "todo".empty? %> 65 |

todo não foi encontrado

66 | <% else %> 67 |

todo foi encontrado

68 | <% end %> 69 | ``` 70 | 71 | > Isso vai produzir um h1 escrito "todo foi encontrado" na tela. 72 | 73 | - Unless 74 | 75 | O unless se comporta da mesma forma que o if, mas com ele podemos assumir o caminho `false` primeiro e depois o caminho `true`, como mostrado abaixo: 76 | 77 | ```erb 78 | <% unless "todo".empty? %> 79 |

todo não foi encontrado

80 | <% else %> 81 |

todo foi encontrado

82 | <% end %> 83 | ``` 84 | 85 | > Isso vai produzir um h1 escrito "todo não foi encontrado" na tela. 86 | 87 | - Case 88 | 89 | No caso desse condicional conhecido como switch em outras linguagens como JavaScript, podemos analisar uma única variável por múltiplos ângulos como mostrado abaixo: 90 | 91 | ```erb 92 | <% case 1 %> 93 | <% when 0 %> 94 |

É zero

95 | <% when 1 %> 96 |

É um

97 | <% else %> 98 |

É qualquer outro número

99 | <% end %> 100 | ``` 101 | 102 | > Isso vai produzir um h1 escrito "É um" na tela. 103 | -------------------------------------------------------------------------------- /docs/3-como-criar-um-token-github.md: -------------------------------------------------------------------------------- 1 | # Como criar um token GitHub 2 | 3 | Para que possamos executar o comando `fetch:issues` que pega todas as issues do github, precisamos ter uma chave de acesso na API deles. Essa chave pode ser configurada de maneira muito simples seguindo o passo a passo abaixo: 4 | 5 | 1. Primeiro entre nas configurações da sua conta: 6 | 7 | image 8 | 9 | 2. Depois entre nas sessão de desenvolvedor (scrollando ate o final da pagina): 10 | 11 | image-1 12 | 13 | 3. Selecione a aba de "Personal access token" e então "Fine-grained tokens" para poder visualizar seus tokens 14 | 15 | image-2 16 | 17 | 4. Clique no botão "Generate New Token", digite um nome para seu token e faça scroll diretamente para o final da pagina 18 | 19 | https://github.com/cherryramatisdev/4noobs_tracker/assets/86631177/f93a96c2-73f0-425f-9e17-8a847c06c089 20 | 21 | 22 | 5. Agora que você conseguiu copiar o token, crie um arquivo `.env` na pasta do projeto com o seguinte conteudo: 23 | 24 | ``` 25 | GH_API_KEY=seutokenaqui 26 | ``` 27 | 28 | Parabéns! Agora você deve conseguir executar o comandos descritos no [README](/README.md) facilmente. 29 | 30 | Caso reste alguma duvida, por favor me chame! 31 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cherryramatisdev/4noobs_tracker/1477f73eb905477f66a96057ade2b756e0f98327/lib/assets/.keep -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cherryramatisdev/4noobs_tracker/1477f73eb905477f66a96057ade2b756e0f98327/lib/tasks/.keep -------------------------------------------------------------------------------- /lib/tasks/fetch.rake: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | namespace :fetch do 4 | desc 'Fetch all the repositories from the README at https://github.com/he4rt/4noobs and insert to the database' 5 | task repositories: :environment do 6 | require_relative '../../app/services/github/extract_repositories' 7 | 8 | repositories_info = Github::ExtractRepositories.new.call 9 | total_repositories = repositories_info.length 10 | 11 | progress_bar = ProgressBar.create(total: total_repositories) 12 | 13 | repositories_info.each do |repository_info| 14 | progress_bar.increment 15 | repository = Repository.find_or_initialize_by(name: repository_info[:repo_name]) 16 | repository.assign_attributes( 17 | name: repository_info[:repo_name], 18 | owner: repository_info[:owner], 19 | url: repository_info[:full_url], 20 | technology: repository_info[:technology] 21 | ) 22 | repository.save! 23 | end 24 | 25 | progress_bar.finish 26 | end 27 | 28 | desc 'Fetch all the issues from all the repositories and insert to the database' 29 | task issues: :environment do 30 | require_relative '../../app/services/github/extract_repositories' 31 | require_relative '../../app/services/github/extract_issues_from_repository' 32 | 33 | repositories = Repository.all 34 | 35 | if repositories.empty? 36 | puts 'First run rails fetch:repositories and then fetch:issues' 37 | return 38 | end 39 | 40 | progress_bar = ProgressBar.create(total: repositories.count) 41 | 42 | repositories.each do |repository| 43 | progress_bar.increment 44 | Github::ExtractIssuesFromRepository.new.call(id: repository[:id], name: repository[:name], 45 | owner: repository[:owner]) 46 | end 47 | 48 | progress_bar.finish 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /log/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cherryramatisdev/4noobs_tracker/1477f73eb905477f66a96057ade2b756e0f98327/log/.keep -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The page you were looking for doesn't exist.

62 |

You may have mistyped the address or the page may have moved.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The change you wanted was rejected.

62 |

Maybe you tried to change something you didn't have access to.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

We're sorry, but something went wrong.

62 |
63 |

If you are the application owner check the logs for more information.

64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /public/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cherryramatisdev/4noobs_tracker/1477f73eb905477f66a96057ade2b756e0f98327/public/android-chrome-192x192.png -------------------------------------------------------------------------------- /public/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cherryramatisdev/4noobs_tracker/1477f73eb905477f66a96057ade2b756e0f98327/public/android-chrome-512x512.png -------------------------------------------------------------------------------- /public/apple-touch-icon-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cherryramatisdev/4noobs_tracker/1477f73eb905477f66a96057ade2b756e0f98327/public/apple-touch-icon-precomposed.png -------------------------------------------------------------------------------- /public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cherryramatisdev/4noobs_tracker/1477f73eb905477f66a96057ade2b756e0f98327/public/apple-touch-icon.png -------------------------------------------------------------------------------- /public/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cherryramatisdev/4noobs_tracker/1477f73eb905477f66a96057ade2b756e0f98327/public/favicon-16x16.png -------------------------------------------------------------------------------- /public/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cherryramatisdev/4noobs_tracker/1477f73eb905477f66a96057ade2b756e0f98327/public/favicon-32x32.png -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cherryramatisdev/4noobs_tracker/1477f73eb905477f66a96057ade2b756e0f98327/public/favicon.ico -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | -------------------------------------------------------------------------------- /public/site.webmanifest: -------------------------------------------------------------------------------- 1 | {"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"} -------------------------------------------------------------------------------- /spec/helpers/design_system_helper_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | # Specs in this file have access to a helper object that includes 4 | # the DesignSystemHelper. For example: 5 | # 6 | # describe DesignSystemHelper do 7 | # describe "string concat" do 8 | # it "concats two strings with spaces" do 9 | # expect(helper.concat_strings("this","that")).to eq("this that") 10 | # end 11 | # end 12 | # end 13 | RSpec.describe DesignSystemHelper, type: :helper do 14 | describe 'define_technology_image_pattern()' do 15 | it 'given C# technology then should return csharp.svg' do 16 | expect(helper.define_technology_image_pattern('C#')).to eq('csharp.svg') 17 | end 18 | 19 | it 'given C++ technology then should return cpluplus.svg' do 20 | expect(helper.define_technology_image_pattern('C++')).to eq('cplusplus.svg') 21 | end 22 | 23 | it 'given random technology then should return it in lowercase and without spaces' do 24 | expect(helper.define_technology_image_pattern('Test Technology')).to eq('testtechnology.svg') 25 | end 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /spec/helpers/issue_helper_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | # Specs in this file have access to a helper object that includes 4 | # the IssueHelper. For example: 5 | # 6 | # describe IssueHelper do 7 | # describe "string concat" do 8 | # it "concats two strings with spaces" do 9 | # expect(helper.concat_strings("this","that")).to eq("this that") 10 | # end 11 | # end 12 | # end 13 | RSpec.describe IssueHelper, type: :helper do 14 | pending "add some examples to (or delete) #{__FILE__}" 15 | end 16 | -------------------------------------------------------------------------------- /spec/helpers/repository_helper_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | # Specs in this file have access to a helper object that includes 4 | # the RepositoryHelper. For example: 5 | # 6 | # describe RepositoryHelper do 7 | # describe "string concat" do 8 | # it "concats two strings with spaces" do 9 | # expect(helper.concat_strings("this","that")).to eq("this that") 10 | # end 11 | # end 12 | # end 13 | RSpec.describe RepositoryHelper, type: :helper do 14 | pending "add some examples to (or delete) #{__FILE__}" 15 | end 16 | -------------------------------------------------------------------------------- /spec/models/issue_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe Issue, type: :model do 4 | context 'when saving issue' do 5 | it 'should save with valid url' do 6 | repository = Repository.create(name: 'test', owner: 'test', url: 'http://test.com') 7 | 8 | issue = Issue.new(title: 'test', url: 'https://test.com', state: 'test', assignee: '', issue_type: 'test', 9 | repository_id: repository.id) 10 | expect(issue.valid?).to be_truthy 11 | expect(issue.save).to be_truthy 12 | end 13 | 14 | it 'should not save without url' do 15 | repository = Repository.create(name: 'test', owner: 'test', url: 'http://test.com') 16 | 17 | issue = Issue.new(title: 'test', state: 'test', assignee: '', issue_type: 'test', repository_id: repository.id) 18 | expect(issue.valid?).to be_falsy 19 | expect(issue.save).to be_falsy 20 | expect(issue.errors[:url]).to include(%(can't be blank)) 21 | end 22 | 23 | it 'should not save duplicate url' do 24 | repository = Repository.create(name: 'test', owner: 'test', url: 'http://test.com') 25 | 26 | Issue.create(title: 'test', url: 'https://test.com', state: 'test', assignee: '', issue_type: 'test', 27 | repository_id: repository.id) 28 | issue = Issue.new(title: 'test', url: 'https://test.com', state: 'test', assignee: '', issue_type: 'test', 29 | repository_id: repository.id) 30 | expect(issue.valid?).to be_falsy 31 | expect(issue.save).to be_falsy 32 | expect(issue.errors[:url]).to include(%(has already been taken)) 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /spec/models/repository_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe Repository, type: :model do 4 | context 'when saving repository' do 5 | it 'should save with valid name' do 6 | repository = Repository.new(name: 'test', owner: 'test', url: 'http://test.com', technology: 'A') 7 | expect(repository.valid?).to be_truthy 8 | expect(repository.save).to be_truthy 9 | end 10 | 11 | it 'should not save without name' do 12 | repository = Repository.new(owner: 'test', url: 'http://test.com', technology: 'A') 13 | expect(repository.valid?).to be_falsy 14 | expect(repository.save).to be_falsy 15 | expect(repository.errors[:name]).to include(%(can't be blank)) 16 | end 17 | 18 | it 'should not save duplicate name' do 19 | Repository.create(name: 'test', owner: 'test', url: 'http://test.com', technology: 'A') 20 | repository = Repository.new(name: 'test', owner: 'test', url: 'http://test.com', technology: 'A') 21 | expect(repository.valid?).to be_falsy 22 | expect(repository.save).to be_falsy 23 | expect(repository.errors[:name]).to include(%(has already been taken)) 24 | end 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /spec/rails_helper.rb: -------------------------------------------------------------------------------- 1 | # This file is copied to spec/ when you run 'rails generate rspec:install' 2 | require 'spec_helper' 3 | ENV['RAILS_ENV'] ||= 'test' 4 | require_relative '../config/environment' 5 | # Prevent database truncation if the environment is production 6 | abort('The Rails environment is running in production mode!') if Rails.env.production? 7 | require 'rspec/rails' 8 | # Add additional requires below this line. Rails is not loaded until this point! 9 | 10 | # Requires supporting ruby files with custom matchers and macros, etc, in 11 | # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are 12 | # run as spec files by default. This means that files in spec/support that end 13 | # in _spec.rb will both be required and run as specs, causing the specs to be 14 | # run twice. It is recommended that you do not name files matching this glob to 15 | # end with _spec.rb. You can configure this pattern with the --pattern 16 | # option on the command line or in ~/.rspec, .rspec or `.rspec-local`. 17 | # 18 | # The following line is provided for convenience purposes. It has the downside 19 | # of increasing the boot-up time by auto-requiring all files in the support 20 | # directory. Alternatively, in the individual `*_spec.rb` files, manually 21 | # require only the support files necessary. 22 | # 23 | # Dir[Rails.root.join('spec', 'support', '**', '*.rb')].sort.each { |f| require f } 24 | 25 | # Checks for pending migrations and applies them before tests are run. 26 | # If you are not using ActiveRecord, you can remove these lines. 27 | begin 28 | ActiveRecord::Migration.maintain_test_schema! 29 | rescue ActiveRecord::PendingMigrationError => e 30 | abort e.to_s.strip 31 | end 32 | RSpec.configure do |config| 33 | # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures 34 | config.fixture_path = "#{Rails.root}/spec/fixtures" 35 | 36 | # If you're not using ActiveRecord, or you'd prefer not to run each of your 37 | # examples within a transaction, remove the following line or assign false 38 | # instead of true. 39 | config.use_transactional_fixtures = true 40 | 41 | # You can uncomment this line to turn off ActiveRecord support entirely. 42 | # config.use_active_record = false 43 | 44 | # RSpec Rails can automatically mix in different behaviours to your tests 45 | # based on their file location, for example enabling you to call `get` and 46 | # `post` in specs under `spec/controllers`. 47 | # 48 | # You can disable this behaviour by removing the line below, and instead 49 | # explicitly tag your specs with their type, e.g.: 50 | # 51 | # RSpec.describe UsersController, type: :controller do 52 | # # ... 53 | # end 54 | # 55 | # The different available types are documented in the features, such as in 56 | # https://rspec.info/features/6-0/rspec-rails 57 | config.infer_spec_type_from_file_location! 58 | 59 | # Filter lines from Rails gems in backtraces. 60 | config.filter_rails_from_backtrace! 61 | # arbitrary gems may also be filtered via: 62 | # config.filter_gems_from_backtrace("gem name") 63 | end 64 | -------------------------------------------------------------------------------- /spec/requests/issue_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe 'Issues', type: :request do 4 | describe 'GET /index' do 5 | pending "add some examples (or delete) #{__FILE__}" 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /spec/requests/repository_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe 'Repositories', type: :request do 4 | describe 'GET /index' do 5 | pending "add some examples (or delete) #{__FILE__}" 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # This file was generated by the `rails generate rspec:install` command. Conventionally, all 2 | # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. 3 | # The generated `.rspec` file contains `--require spec_helper` which will cause 4 | # this file to always be loaded, without a need to explicitly require it in any 5 | # files. 6 | # 7 | # Given that it is always loaded, you are encouraged to keep this file as 8 | # light-weight as possible. Requiring heavyweight dependencies from this file 9 | # will add to the boot time of your test suite on EVERY test run, even for an 10 | # individual file that may not need all of that loaded. Instead, consider making 11 | # a separate helper file that requires the additional dependencies and performs 12 | # the additional setup, and require it from the spec files that actually need 13 | # it. 14 | # 15 | # See https://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration 16 | RSpec.configure do |config| 17 | # rspec-expectations config goes here. You can use an alternate 18 | # assertion/expectation library such as wrong or the stdlib/minitest 19 | # assertions if you prefer. 20 | config.expect_with :rspec do |expectations| 21 | # This option will default to `true` in RSpec 4. It makes the `description` 22 | # and `failure_message` of custom matchers include text for helper methods 23 | # defined using `chain`, e.g.: 24 | # be_bigger_than(2).and_smaller_than(4).description 25 | # # => "be bigger than 2 and smaller than 4" 26 | # ...rather than: 27 | # # => "be bigger than 2" 28 | expectations.include_chain_clauses_in_custom_matcher_descriptions = true 29 | end 30 | 31 | # rspec-mocks config goes here. You can use an alternate test double 32 | # library (such as bogus or mocha) by changing the `mock_with` option here. 33 | config.mock_with :rspec do |mocks| 34 | # Prevents you from mocking or stubbing a method that does not exist on 35 | # a real object. This is generally recommended, and will default to 36 | # `true` in RSpec 4. 37 | mocks.verify_partial_doubles = true 38 | end 39 | 40 | # This option will default to `:apply_to_host_groups` in RSpec 4 (and will 41 | # have no way to turn it off -- the option exists only for backwards 42 | # compatibility in RSpec 3). It causes shared context metadata to be 43 | # inherited by the metadata hash of host groups and examples, rather than 44 | # triggering implicit auto-inclusion in groups with matching metadata. 45 | config.shared_context_metadata_behavior = :apply_to_host_groups 46 | 47 | # The settings below are suggested to provide a good initial experience 48 | # with RSpec, but feel free to customize to your heart's content. 49 | # # This allows you to limit a spec run to individual examples or groups 50 | # # you care about by tagging them with `:focus` metadata. When nothing 51 | # # is tagged with `:focus`, all examples get run. RSpec also provides 52 | # # aliases for `it`, `describe`, and `context` that include `:focus` 53 | # # metadata: `fit`, `fdescribe` and `fcontext`, respectively. 54 | # config.filter_run_when_matching :focus 55 | # 56 | # # Allows RSpec to persist some state between runs in order to support 57 | # # the `--only-failures` and `--next-failure` CLI options. We recommend 58 | # # you configure your source control system to ignore this file. 59 | # config.example_status_persistence_file_path = "spec/examples.txt" 60 | # 61 | # # Limits the available syntax to the non-monkey patched syntax that is 62 | # # recommended. For more details, see: 63 | # # https://rspec.info/features/3-12/rspec-core/configuration/zero-monkey-patching-mode/ 64 | # config.disable_monkey_patching! 65 | # 66 | # # Many RSpec users commonly either run the entire suite or an individual 67 | # # file, and it's useful to allow more verbose output when running an 68 | # # individual spec file. 69 | # if config.files_to_run.one? 70 | # # Use the documentation formatter for detailed output, 71 | # # unless a formatter has already been configured 72 | # # (e.g. via a command-line flag). 73 | # config.default_formatter = "doc" 74 | # end 75 | # 76 | # # Print the 10 slowest examples and example groups at the 77 | # # end of the spec run, to help surface which specs are running 78 | # # particularly slow. 79 | # config.profile_examples = 10 80 | # 81 | # # Run specs in random order to surface order dependencies. If you find an 82 | # # order dependency and want to debug it, you can fix the order by providing 83 | # # the seed, which is printed after each run. 84 | # # --seed 1234 85 | # config.order = :random 86 | # 87 | # # Seed global randomization in this process using the `--seed` CLI option. 88 | # # Setting this allows you to use `--seed` to deterministically reproduce 89 | # # test failures related to randomization by passing the same `--seed` value 90 | # # as the one that triggered the failure. 91 | # Kernel.srand config.seed 92 | end 93 | -------------------------------------------------------------------------------- /storage/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cherryramatisdev/4noobs_tracker/1477f73eb905477f66a96057ade2b756e0f98327/storage/.keep -------------------------------------------------------------------------------- /tmp/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cherryramatisdev/4noobs_tracker/1477f73eb905477f66a96057ade2b756e0f98327/tmp/.keep -------------------------------------------------------------------------------- /tmp/pids/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cherryramatisdev/4noobs_tracker/1477f73eb905477f66a96057ade2b756e0f98327/tmp/pids/.keep -------------------------------------------------------------------------------- /tmp/storage/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cherryramatisdev/4noobs_tracker/1477f73eb905477f66a96057ade2b756e0f98327/tmp/storage/.keep -------------------------------------------------------------------------------- /vendor/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cherryramatisdev/4noobs_tracker/1477f73eb905477f66a96057ade2b756e0f98327/vendor/.keep -------------------------------------------------------------------------------- /vendor/javascript/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cherryramatisdev/4noobs_tracker/1477f73eb905477f66a96057ade2b756e0f98327/vendor/javascript/.keep --------------------------------------------------------------------------------