├── .browserslistrc ├── .gitignore ├── .travis.yml ├── DbBackup ├── backup.yml ├── config.rb └── models │ └── code_curiosity_backup.rb ├── Gemfile ├── Gemfile.lock ├── LICENSE ├── Procfile ├── README.md ├── Rakefile ├── app ├── assets │ ├── config │ │ └── manifest.js │ ├── images │ │ ├── .keep │ │ ├── icon.png │ │ ├── logo-home.png │ │ ├── logo_50pxh.png │ │ ├── org-ett-logo.png │ │ └── org-josh-logo.png │ ├── javascripts │ │ ├── admin │ │ │ ├── datatables.min.js │ │ │ ├── ignored_files.js │ │ │ ├── redeem_requests.js │ │ │ ├── repositories.js │ │ │ └── users.js │ │ ├── application.js │ │ ├── bootbox.min.js │ │ ├── bootstrap-multiselect.js │ │ ├── comments.js │ │ ├── commits.js │ │ ├── components.js │ │ ├── components │ │ │ ├── .gitkeep │ │ │ ├── celebrity_box.es6.jsx │ │ │ ├── points_history.es6.jsx │ │ │ ├── points_history_row.es6.jsx │ │ │ ├── points_tile.es6.jsx │ │ │ ├── subscriptions_history.es6.jsx │ │ │ ├── subscriptions_history_row.es6.jsx │ │ │ └── user_points_chart.es6.jsx │ │ ├── dashboard.coffee │ │ ├── github │ │ │ ├── github_client.js │ │ │ └── repos.js │ │ ├── google_analytics.js.coffee │ │ ├── home.js │ │ ├── jquery.barrating.js │ │ ├── mustache.js │ │ ├── notification.js │ │ ├── points_chart.js │ │ ├── rating.js │ │ ├── redeem.js │ │ ├── sponsors.js │ │ └── users.js │ └── stylesheets │ │ ├── admin │ │ ├── datatables.min.css │ │ ├── ignored_files.scss │ │ ├── redeem_requests.scss │ │ ├── sponsors.scss │ │ └── users.scss │ │ ├── application.scss │ │ ├── bars-pill.css │ │ ├── bootstrap_multiselect.css │ │ ├── commits.scss │ │ ├── dashboard.scss │ │ ├── home.scss │ │ ├── info.scss │ │ ├── redeem.scss │ │ ├── registrations.scss │ │ ├── style.scss │ │ └── users.scss ├── controllers │ ├── admin │ │ ├── commits_controller.rb │ │ ├── ignored_files_controller.rb │ │ ├── redeem_requests_controller.rb │ │ ├── repositories_controller.rb │ │ ├── sponsors_controller.rb │ │ └── users_controller.rb │ ├── application_controller.rb │ ├── commits_controller.rb │ ├── concerns │ │ ├── .keep │ │ ├── contribution_helper.rb │ │ ├── gh_cache_helper.rb │ │ ├── ignored_file_helper.rb │ │ ├── judges_actions.rb │ │ └── repo_pagination.rb │ ├── dashboard_controller.rb │ ├── github │ │ └── repos_controller.rb │ ├── home_controller.rb │ ├── info_controller.rb │ ├── redeem_controller.rb │ ├── registrations_controller.rb │ ├── repositories_controller.rb │ ├── transactions_controller.rb │ ├── users │ │ └── omniauth_callbacks_controller.rb │ ├── users_controller.rb │ └── v1 │ │ ├── base_controller.rb │ │ ├── subscriptions_controller.rb │ │ └── transactions_controller.rb ├── helpers │ ├── admin │ │ ├── ignored_files_helper.rb │ │ ├── redeem_requests_helper.rb │ │ └── repositories_helper.rb │ ├── application_helper.rb │ ├── dashboard_helper.rb │ ├── github │ │ └── repos_helper.rb │ ├── home_helper.rb │ ├── repositories_helper.rb │ ├── scores_helper.rb │ └── users_helper.rb ├── javascript │ └── packs │ │ └── application.js ├── jobs │ ├── application_job.rb │ ├── fetch_commit_job.rb │ ├── user_gh_repos_job.rb │ └── user_repos_job.rb ├── mailers │ ├── .keep │ ├── application_mailer.rb │ ├── redeem_mailer.rb │ └── subscription_mailer.rb ├── models │ ├── .keep │ ├── budget.rb │ ├── code_file.rb │ ├── comment.rb │ ├── commit.rb │ ├── commit_reward.rb │ ├── commit_score.rb │ ├── concerns │ │ ├── .keep │ │ ├── active_job_retries_count.rb │ │ ├── judge_scoring_helper.rb │ │ ├── repo_leaders.rb │ │ └── user_github_helper.rb │ ├── file_to_be_ignored.rb │ ├── git_app.rb │ ├── git_fetcher.rb │ ├── pull_request.rb │ ├── redeem_request.rb │ ├── repo_budget.rb │ ├── repository.rb │ ├── role.rb │ ├── score.rb │ ├── sponsor.rb │ ├── transaction.rb │ └── user.rb ├── presenters │ └── v1 │ │ └── base_presenter.rb ├── serializers │ └── transaction_serializer.rb ├── services │ ├── frequency_factor_calculator.rb │ └── multi_line_chart │ │ ├── contribution.rb │ │ ├── index.rb │ │ └── user.rb └── views │ ├── admin │ ├── commits │ │ ├── _commits.html.haml │ │ ├── _commits_table.html.haml │ │ ├── index.html.haml │ │ └── index.js.haml │ ├── ignored_files │ │ ├── _form.html.haml │ │ ├── _ignored_file.html.haml │ │ ├── edit.html.haml │ │ ├── index.html.haml │ │ ├── index.js.erb │ │ ├── new.html.haml │ │ └── update_ignore_field.js.erb │ ├── redeem_requests │ │ ├── _redeem.html.haml │ │ ├── _redeem_request.html.haml │ │ ├── _tagtable.html.haml │ │ ├── index.html.haml │ │ └── index.js.haml │ ├── repositories │ │ ├── _add_repo.html.haml │ │ ├── _repos_table.html.haml │ │ ├── index.html.haml │ │ ├── index.js.erb │ │ └── update_ignore_field.js │ ├── sponsors │ │ ├── _form.html.haml │ │ ├── _sponsors.html.haml │ │ ├── _sponsors_table.html.haml │ │ ├── edit.html.haml │ │ ├── index.html.haml │ │ ├── index.js.haml │ │ ├── new.html.haml │ │ └── show.html.haml │ └── users │ │ ├── _user.html.haml │ │ ├── block_user.js │ │ ├── index.html.haml │ │ └── index.js.erb │ ├── application │ ├── _admin_sidebar.html.haml │ ├── _alert_box.html.haml │ ├── _callout_box.html.haml │ ├── _celebrity_box.html.haml │ ├── _flash_message.html.haml │ ├── _footer.html.haml │ ├── _mail_signature.html.haml │ ├── _navbar.html.haml │ ├── _sidebar.html.haml │ ├── _user_nav.html.haml │ └── score.js.haml │ ├── comments │ ├── _comment.html.haml │ ├── _form.html.haml │ └── create.js.haml │ ├── commits │ ├── _commits.html.haml │ ├── _commits_table.html.haml │ ├── index.html.haml │ └── index.js.haml │ ├── dashboard │ └── index.html.haml │ ├── devise │ ├── confirmations │ │ └── new.html.erb │ ├── mailer │ │ ├── confirmation_instructions.html.erb │ │ ├── reset_password_instructions.html.erb │ │ └── unlock_instructions.html.erb │ ├── passwords │ │ ├── edit.html.erb │ │ └── new.html.erb │ ├── registrations │ │ ├── edit.html.erb │ │ └── new.html.erb │ ├── sessions │ │ └── new.html.erb │ └── unlocks │ │ └── new.html.erb │ ├── github │ └── repos │ │ ├── _repo_row.html.haml │ │ ├── _repos.html.haml │ │ ├── index.html.haml │ │ ├── index.js.erb │ │ ├── orgs.js.erb │ │ └── sync.js.erb │ ├── home │ ├── _info.html.haml │ ├── _subscribers_list.html.haml │ ├── _trend.html.haml │ ├── _user.html.haml │ ├── index.html.haml │ └── leaderboard.html.haml │ ├── info │ ├── _faq.html.haml │ ├── _new_terms_modal.html.haml │ └── faq.html.haml │ ├── kaminari │ ├── _first_page.html.haml │ ├── _gap.html.haml │ ├── _last_page.html.haml │ ├── _next_page.html.haml │ ├── _page.html.haml │ ├── _paginator.html.haml │ └── _prev_page.html.haml │ ├── layouts │ ├── application.html.haml │ ├── devise.html.haml │ ├── home.html.haml │ ├── info.html.haml │ ├── mailer.html.haml │ ├── mailer.text.haml │ └── public.html.haml │ ├── redeem │ ├── _amazon.html.haml │ ├── _form.html.haml │ ├── _github.html.haml │ ├── _new_modal.html.haml │ ├── _other.html.haml │ ├── _submit_buttons.html.haml │ ├── create.js.haml │ └── new.html.haml │ ├── redeem_mailer │ ├── coupon_code.html.haml │ ├── notify_admin.html.haml │ └── redeem_request.html.haml │ ├── registrations │ └── terms_and_conditions.html.haml │ ├── repositories │ ├── _form.html.haml │ ├── create.js.haml │ ├── edit.js.haml │ ├── index.html.haml │ └── new.html.haml │ ├── subscription_mailer │ └── new_t_and_c.html.haml │ └── users │ ├── _form.html.haml │ ├── _organizations.html.haml │ ├── _settings.html.haml │ ├── _share_button.html.haml │ ├── _sponsor_profile.html.haml │ ├── _subscription.html.haml │ ├── _transaction.html.haml │ ├── _transactions.html.haml │ ├── _twitter_data.html.haml │ ├── edit.js.haml │ ├── remove_handle.js.haml │ ├── show.html.haml │ ├── sync.js.erb │ ├── update.js.haml │ └── update_notification.js.haml ├── babel.config.js ├── bin ├── aws.rb ├── backup ├── bundle ├── console ├── dotenv ├── fission ├── fog ├── haml ├── httparty ├── mongo_console ├── nokogiri ├── rackup ├── rails ├── rake ├── rbvmomish ├── rdoc ├── redcarpet ├── restclient ├── ri ├── rollbar-rails-runner ├── sdoc ├── sdoc-merge ├── setup ├── sidekiq ├── sidekiqmon ├── sprockets ├── stripe-console ├── thor ├── tilt ├── webpack ├── webpack-dev-server ├── whenever ├── wheneverize ├── yard ├── yardoc └── yri ├── cache └── .keep ├── config.ru ├── config ├── application.rb ├── badge.yml ├── boot.rb ├── code_curiosity_config.yml ├── deploy.rb ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── git.yml ├── info.yml ├── initializers │ ├── active_job.rb │ ├── assets.rb │ ├── backtrace_silencers.rb │ ├── cookies_serializer.rb │ ├── deserialize_job.rb │ ├── devise.rb │ ├── filter_parameter_logging.rb │ ├── globals.rb │ ├── inflections.rb │ ├── kaminari_config.rb │ ├── lib.rb │ ├── mail_interceptor.rb │ ├── mime_types.rb │ ├── mongoid_ext.rb │ ├── mongoid_search.rb │ ├── rollbar.rb │ ├── session_store.rb │ ├── sidekiq.rb │ ├── simple_form.rb │ ├── simple_form_bootstrap.rb │ ├── stripe.rb │ └── wrap_parameters.rb ├── locales │ ├── devise.en.yml │ ├── en.yml │ └── simple_form.en.yml ├── mongoid.yml ├── routes.rb ├── schedule.rb ├── secrets.yml ├── sidekiq.yml ├── webpack │ ├── development.js │ ├── environment.js │ ├── production.js │ └── test.js └── webpacker.yml ├── db └── seeds.rb ├── env.sample ├── fixtures └── vcr_cassettes │ ├── commit_info.yml │ ├── my_commits.yml │ ├── repo_info.yml │ ├── set_created_at_and_language.yml │ └── set_lang_invalid_repo.yml ├── lib ├── assets │ └── .keep ├── development_mail_interceptor.rb ├── git_lib_ext.rb ├── github_client.rb ├── tasks │ ├── .keep │ ├── fetch_commits.rake │ ├── fetch_data.rake │ ├── fix_august_budget.rake │ ├── hide_undebited_requests.rake │ ├── notify_all.rake │ ├── repo.rake │ ├── score_and_reward.rake │ ├── set.rake │ └── utils.rake ├── templates │ └── erb │ │ └── scaffold │ │ └── _form.html.erb └── vcs │ ├── git_branch.rb │ ├── git_commit.rb │ ├── git_commit_stats.rb │ ├── git_pull_request.rb │ └── git_repository.rb ├── log └── .keep ├── package.json ├── postcss.config.js ├── public ├── 404.html ├── 422.html ├── 500.html ├── New_Redemption_Strategy.pdf ├── Terms_of_service_CodeCuriosity.pdf ├── apple-touch-icon-precomposed.png ├── apple-touch-icon.png ├── docs │ └── v1 │ │ ├── index.html │ │ └── style.css ├── favicon.ico ├── logo │ ├── Geometos Rounded.ttf │ ├── logo-cc-black.png │ ├── logo-cc-revert.png │ ├── logo-cc.ai │ ├── logo-cc.eps │ ├── logo-cc.png │ └── logo-cc.svg └── robots.txt ├── test ├── controllers │ ├── .keep │ ├── admin │ │ ├── commits_controller_test.rb │ │ ├── ignored_files_controller_test.rb │ │ ├── redeem_requests_controller_test.rb │ │ ├── repositories_controller_test.rb │ │ ├── sponsors_controller_test.rb │ │ └── users_controller_test.rb │ ├── commits_controller_test.rb │ ├── dashboard_controller_test.rb │ ├── github │ │ └── repos_controller_test.rb │ ├── home_controller_test.rb │ ├── info_controller_test.rb │ ├── redeem_controller_test.rb │ ├── registrations_controller_test.rb │ ├── repositories_controller_test.rb │ ├── transactions_controller_test.rb │ ├── users │ │ └── omniauth_callbacks_controller_test.rb │ ├── users_controller_test.rb │ └── v1 │ │ └── transactions_controller_test.rb ├── factories │ ├── budgets.rb │ ├── comments.rb │ ├── commits.rb │ ├── file_to_be_ignoreds.rb │ ├── git_apps.rb │ ├── pull_requests.rb │ ├── redeem_requests.rb │ ├── repositories.rb │ ├── roles.rb │ ├── scores.rb │ ├── sponsors.rb │ ├── transactions.rb │ └── users.rb ├── fixtures │ ├── .keep │ ├── bugspot.yml │ ├── commit-daily.json │ ├── commit.json │ ├── commits.json │ ├── dummy-commit.json │ ├── git_commit.json │ ├── git_commit_stats.json │ ├── org-popular-remote.json │ ├── org-popular-repos-with-unpopular-remotes.json │ ├── org-popular-repos.json │ ├── org-remote-unpopular-fork.json │ ├── org-repo.json │ ├── org-repos.json │ ├── org-unpopular-forked-repos.json │ ├── org-unpopular-repos-with-popular-remotes.json │ ├── org-unpopular-repos.json │ ├── org.json │ ├── organization.json │ ├── popular-repos-with-forks.json │ ├── pull_request.json │ ├── rails.png │ ├── repo.json │ ├── repos.json │ ├── repositories.yml │ ├── test.csv │ ├── unforked_repo.json │ ├── unpopular-forked-repos.json │ ├── unpopular-remote.json │ ├── unpopular-repos.json │ ├── user-fork-repo.json │ ├── user-popular-repos.json │ └── users.yml ├── helpers │ ├── .keep │ ├── admin │ │ ├── redeem_requests_helper_test.rb │ │ └── repositories_helper_test.rb │ └── users_helper_test.rb ├── integration │ ├── .keep │ └── user_flow_test.rb ├── jobs │ └── user_repos_job_test.rb ├── lib │ └── tasks │ │ ├── fetch_commits_test.rb │ │ ├── repo_test.rb │ │ ├── score_and_reward_test.rb │ │ └── set_test.rb ├── mailers │ ├── .keep │ ├── previews │ │ ├── redeem_mailer_preview.rb │ │ └── subscription_mailer_preview.rb │ └── redeem_mailer_test.rb ├── models │ ├── .keep │ ├── budget_test.rb │ ├── code_file_test.rb │ ├── comment_test.rb │ ├── commit_reward_test.rb │ ├── commit_test.rb │ ├── file_to_be_ignored_test.rb │ ├── git_app_test.rb │ ├── git_fetcher_test.rb │ ├── pull_request_test.rb │ ├── redeem_request_test.rb │ ├── repository_test.rb │ ├── score_test.rb │ ├── sponsor_test.rb │ ├── transaction_test.rb │ └── user_test.rb ├── serializers │ └── transaction_serializer_test.rb └── test_helper.rb ├── vendor └── assets │ ├── javascripts │ ├── .keep │ ├── AdminLTE.js │ ├── bootstrap-typeahead.js │ ├── bootstrap2-toggle.js │ ├── jquery.noty.packaged.js │ ├── jquery.shorten.js │ └── stream_table.js │ └── stylesheets │ ├── .keep │ ├── AdminLTE.css │ ├── bootstrap2-toggle.css │ └── skin-black-light.css └── yarn.lock /.browserslistrc: -------------------------------------------------------------------------------- 1 | defaults 2 | -------------------------------------------------------------------------------- /.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-journal 13 | 14 | # Ignore all logfiles and tempfiles. 15 | /log/* 16 | !/log/.keep 17 | /tmp 18 | .ruby-gemset 19 | .ruby-version 20 | *.swp 21 | /extra 22 | 23 | # Ignore ENV variables 24 | *.env.* 25 | 26 | # Ignore local storage of profile photos 27 | /public/system/sponsorer 28 | 29 | 1 30 | dump.rdb 31 | /repositories 32 | app/models/app_test.rb 33 | *.diff 34 | widget.js 35 | widget_test/ 36 | page_cache 37 | bin/dbload 38 | mongodump-* 39 | config/mongoid.yml 40 | coverage 41 | 42 | /public/packs 43 | /public/packs-test 44 | /node_modules 45 | /yarn-error.log 46 | yarn-debug.log* 47 | .yarn-integrity 48 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | notifications: 2 | email: 3 | recipients: 4 | - ENV['ADMIN_EMAILS'].split(',') 5 | on_success: change 6 | on_failure: always 7 | 8 | language: ruby 9 | 10 | rvm: 11 | - '2.3.0' 12 | 13 | env: 14 | - ENC_KEY='somerandomkeysomerandomkeysomerandomkeysomerandomkey' 15 | 16 | services: 17 | - mongodb 18 | - redis-server 19 | 20 | cache: 21 | bundler: true 22 | directories: 23 | - "travis_phantomjs" 24 | 25 | before_install: 26 | - "phantomjs --version" 27 | - "export PATH=$PWD/travis_phantomjs/phantomjs-2.1.1-linux-x86_64/bin:$PATH" 28 | - "phantomjs --version" 29 | - "if [ $(phantomjs --version) != '2.1.1' ]; then rm -rf $PWD/travis_phantomjs; mkdir -p $PWD/travis_phantomjs; fi" 30 | - "if [ $(phantomjs --version) != '2.1.1' ]; then wget https://assets.membergetmember.co/software/phantomjs-2.1.1-linux-x86_64.tar.bz2 -O $PWD/travis_phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2; fi" 31 | - "if [ $(phantomjs --version) != '2.1.1' ]; then tar -xvf $PWD/travis_phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2 -C $PWD/travis_phantomjs; fi" 32 | - "phantomjs --version" 33 | 34 | sudo: false 35 | 36 | addons: 37 | code_climate: 38 | repo_token: ENV['CODECLIMATE_REPO_TOKEN'] 39 | 40 | -------------------------------------------------------------------------------- /DbBackup/backup.yml: -------------------------------------------------------------------------------- 1 | database: 2 | name: 'code_curiosity' 3 | username: '' 4 | password: '' 5 | host: '' 6 | port: '' 7 | storage: 8 | access_key_id: "" 9 | secret_access_key: "" 10 | region: "region" 11 | bucket: "bucket" 12 | encryptor: 13 | passphrase: "passphrase" 14 | mail: "mail@codecuriosity.com" 15 | notify: 16 | authentication: "plain" 17 | from: 'mail@codecuriosity.org' 18 | to: 'mail@codecuriosity.com' 19 | domain: "codecuriosity.org" 20 | user_name: "user_name" 21 | password: "password" 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Josh Software Private Limited 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: bundle exec rails server -b 0.0.0.0 2 | redis: redis-server 3 | sidekiq: bundle exec sidekiq 4 | -------------------------------------------------------------------------------- /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 File.expand_path('../config/application', __FILE__) 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /app/assets/config/manifest.js: -------------------------------------------------------------------------------- 1 | //= link_tree ../images 2 | //= link_directory ../javascripts .js 3 | //= link_directory ../stylesheets .css -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/app/assets/images/.keep -------------------------------------------------------------------------------- /app/assets/images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/app/assets/images/icon.png -------------------------------------------------------------------------------- /app/assets/images/logo-home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/app/assets/images/logo-home.png -------------------------------------------------------------------------------- /app/assets/images/logo_50pxh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/app/assets/images/logo_50pxh.png -------------------------------------------------------------------------------- /app/assets/images/org-ett-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/app/assets/images/org-ett-logo.png -------------------------------------------------------------------------------- /app/assets/images/org-josh-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/app/assets/images/org-josh-logo.png -------------------------------------------------------------------------------- /app/assets/javascripts/admin/ignored_files.js: -------------------------------------------------------------------------------- 1 | $(document).on('page:change', function(event) { 2 | 3 | $(function() { 4 | $('#file').bootstrapToggle(); 5 | }) 6 | 7 | $('#file').change(function() { 8 | query = $('#q').val(); 9 | $.ajax({ 10 | type: 'get', 11 | url: '/admin/ignored_files', 12 | data: {'ignored': !($(this).is(':checked')), query: query} 13 | }) 14 | }) 15 | 16 | 17 | $(document).on('change', '.primary', function(){ 18 | id = this.id; 19 | $(".primary#"+id).prop('disabled', true); 20 | $.ajax({ 21 | type: 'patch', 22 | url: "/admin/ignored_files/"+id+"/update_ignore_field", 23 | data: {'ignored_value': this.checked} 24 | }) 25 | }) 26 | 27 | }); -------------------------------------------------------------------------------- /app/assets/javascripts/admin/redeem_requests.js: -------------------------------------------------------------------------------- 1 | 2 | $(document).on('page:change', function(event) { 3 | $('#coupon-code-modal').on('show.bs.modal', function (event) { 4 | var button = $(event.relatedTarget); 5 | var modal = $(this); 6 | 7 | modal.find('form').attr('action', button.data('url')); 8 | modal.find('#redeem_request_coupon_code').val(button.data('code')); 9 | modal.find('#redeem_request_comment').val(button.data('comment')); 10 | modal.find('#redeem_request_points').val(button.data('points')); 11 | modal.find('#redeem_request_status').val(button.data('status') + ''); 12 | }) 13 | 14 | $(function() { 15 | $('#redeem').bootstrapToggle(); 16 | }) 17 | 18 | $('#redeem').change(function() { 19 | if($(this).is(':checked')){ 20 | console.log(this.checked); 21 | $.ajax({ 22 | type: 'get', 23 | url: '/admin/redeem_requests', 24 | data: {'status': false} 25 | }) 26 | } 27 | else{ 28 | console.log($(this).is(':checked')); 29 | $.ajax({ 30 | type: 'get', 31 | url: '/admin/redeem_requests', 32 | data: {'status': true} 33 | }) 34 | } 35 | 36 | }) 37 | 38 | $("a.closeDropdown").on( "click", function() { 39 | $("#store").dropdown("toggle"); 40 | }) 41 | }); 42 | -------------------------------------------------------------------------------- /app/assets/javascripts/admin/repositories.js: -------------------------------------------------------------------------------- 1 | $(document).on('page:change', function(event) { 2 | 3 | $(function() { 4 | $('#repo').bootstrapToggle(); 5 | }) 6 | 7 | $('#repo').change(function() { 8 | query = $("#q").val(); 9 | $.ajax({ 10 | type: 'get', 11 | url: '/admin/repositories', 12 | data: { 'ignored': !(this.checked), query: query } 13 | }) 14 | }) 15 | 16 | $(document).on('change', '.secondary', function(){ 17 | id = this.id; 18 | $(".secondary#"+id).prop('disabled', true); 19 | $.ajax({ 20 | type: 'patch', 21 | url: "/admin/repositories/"+id+"/update_ignore_field", 22 | data: {'ignore_value': this.checked} 23 | }) 24 | }) 25 | }); 26 | 27 | -------------------------------------------------------------------------------- /app/assets/javascripts/admin/users.js: -------------------------------------------------------------------------------- 1 | $(document).on('page:change', function(event) { 2 | 3 | $(function() { 4 | $('#blocked').bootstrapToggle(); 5 | }) 6 | 7 | $('#blocked').change(function() { 8 | $('#status').val(!this.checked); 9 | $('#q').val(''); 10 | $.ajax({ 11 | type: 'get', 12 | url: '/admin/users', 13 | data: { 'blocked': !(this.checked) } 14 | }); 15 | }); 16 | 17 | $(document).on('change', '.block', function(){ 18 | id = this.id; 19 | $(".block#"+id).prop("disabled", true); 20 | $.ajax({ 21 | type: 'patch', 22 | url: '/admin/users/'+id+'/block_user', 23 | data: { 'blocked': this.checked, 'id': id } 24 | }) 25 | }) 26 | }); 27 | -------------------------------------------------------------------------------- /app/assets/javascripts/comments.js: -------------------------------------------------------------------------------- 1 | 2 | $(document).on("click", ".show-comments", function(e){ 3 | e.stopPropagation(); 4 | var $ele = $(this), commentsId, $comments; 5 | 6 | if($ele.hasClass("open")){ 7 | commentsId = $ele.data("id"); 8 | $comments = $("#comments_" + commentsId + ' .direct-chat-messages') 9 | $comments.html(""); 10 | }else{ 11 | $.get($ele.data('url')); 12 | } 13 | 14 | $ele.toggleClass("open"); 15 | }); 16 | -------------------------------------------------------------------------------- /app/assets/javascripts/commits.js: -------------------------------------------------------------------------------- 1 | $(document).on('page:change', function(event) { 2 | $(document).ready(function() { 3 | $(document).on('click', '.reveal', function() { 4 | var $this = $(this); 5 | $this.fadeOut('fast', function() { 6 | $this.closest('td').find('.reward').fadeIn('slow').show(); 7 | $this.replaceWith(); 8 | }); 9 | }); 10 | }); 11 | 12 | $(document).ready(function() { 13 | $('.reveal_all').on('click', function() { 14 | $('.reveal').fadeOut('slow').replaceWith(); 15 | $('.reward').fadeIn('slow').show(); 16 | }); 17 | }); 18 | 19 | $(document).ready(function() { 20 | $('.scores').tooltip({ 21 | title: 'Not Yet Scored, Be Patient!', 22 | placement: 'left' 23 | }); 24 | 25 | $('.rewards').tooltip({ 26 | title: 'Not Yet Rewarded, Be Patient!', 27 | placement: 'left' 28 | }); 29 | }); 30 | }); 31 | -------------------------------------------------------------------------------- /app/assets/javascripts/components.js: -------------------------------------------------------------------------------- 1 | //= require_tree ./components 2 | -------------------------------------------------------------------------------- /app/assets/javascripts/components/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/app/assets/javascripts/components/.gitkeep -------------------------------------------------------------------------------- /app/assets/javascripts/components/celebrity_box.es6.jsx: -------------------------------------------------------------------------------- 1 | class CelebrityBox extends React.Component { 2 | constructor(props){ 3 | super(props); 4 | } 5 | 6 | render() { 7 | return ( 8 |
9 |
10 |
11 | 12 | { this.props.title ? (

{ this.props.title }

) : (null) } 13 |

{ this.props.message }

14 |
15 |
16 |
17 | ); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/assets/javascripts/components/points_history_row.es6.jsx: -------------------------------------------------------------------------------- 1 | class PointsHistoryRow extends React.Component { 2 | render() { 3 | return ( 4 | 5 | { this.props.index } 6 | { "$ " + Math.abs(this.props.amount) } 7 | 8 | { this.props.details.toUpperCase() } 9 | 10 | 11 | { this.props.label.toUpperCase() }{` `} 12 | { this.props.show_coupon_code && this.props.coupon_code ? (
Coupon Code:{ this.props.coupon_code }
) : (null) }{` `} 13 | { this.props.redeem_request_retailer ? ( {this.props.redeem_request_retailer.toUpperCase()} ) : (null) } 14 | 15 | { this.props.date } 16 | 17 | ); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/assets/javascripts/components/points_tile.es6.jsx: -------------------------------------------------------------------------------- 1 | class PointsTile extends React.Component { 2 | constructor(props){ 3 | super(props); 4 | } 5 | 6 | render(){ 7 | return ( 8 |
9 |
10 |

{ this.props.points }

11 |

{ this.props.title }

12 |
13 |
14 | 15 |
16 | More info 17 | 18 | 19 |
20 | ); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/assets/javascripts/components/subscriptions_history_row.es6.jsx: -------------------------------------------------------------------------------- 1 | class SubscriptionsHistoryRow extends React.Component { 2 | constructor(props) { 3 | super(props); 4 | } 5 | 6 | render () { 7 | return ( 8 | 9 | { this.props.index } 10 | { this.props.roundDate } 11 | { this.props.commits } 12 | { this.props.activities } 13 | { this.props.points } 14 | 15 | ); 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /app/assets/javascripts/components/user_points_chart.es6.jsx: -------------------------------------------------------------------------------- 1 | class UserPointsChart extends React.Component { 2 | constructor(props) { 3 | super(props); 4 | } 5 | 6 | componentDidMount() { 7 | userTrendChart(this.props.xAxis, this.props.commits, this.props.points, this.props.username); 8 | } 9 | 10 | render () { 11 | return ( 12 |
13 |
14 |
15 |
16 | ); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/assets/javascripts/dashboard.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | 5 | @load_repos = (repos) -> 6 | if repos.length == 0 7 | return 8 | 9 | template = Mustache.compile($.trim($("#template").html())) 10 | view = (record, index) -> 11 | template(record: record, index: index) 12 | 13 | options = { 14 | view: view, 15 | search_box: "#repo-search-box" 16 | pagination: { 17 | container: "#repos-pagination", 18 | ul_class: "pagination pagination-sm no-margin", 19 | next_text: "»", 20 | prev_text: "«", 21 | per_page_select: false 22 | } 23 | } 24 | 25 | $("#stream_table").stream_table(options, repos) 26 | 27 | $(document).on "page:change", -> 28 | $('#datepicker1').datepicker format: 'dd/mm/yyyy' 29 | -------------------------------------------------------------------------------- /app/assets/javascripts/github/github_client.js: -------------------------------------------------------------------------------- 1 | 2 | (function($, window, document) { 3 | 4 | "use strict"; 5 | 6 | window.GHSTORE = {}; 7 | 8 | var API_URL = 'https://api.github.com/'; 9 | 10 | var GhApi = function(username) { 11 | if(!username){ 12 | username = $('#gh-user').data('login'); 13 | } 14 | 15 | return new GA(username); 16 | }; 17 | 18 | window.GhApi = GhApi; 19 | 20 | var GA = function(username) { 21 | this.username = username; 22 | }; 23 | 24 | GA.prototype.get = function(uriComponents, callback){ 25 | var uri = uriComponents.join('/'); 26 | 27 | if(GHSTORE[uri]){ 28 | callback(GHSTORE[uri]); 29 | return; 30 | } 31 | 32 | $.getJSON('https://api.github.com/' + uri, function(result){ 33 | GHSTORE[uri] = result; 34 | callback(GHSTORE[uri]); 35 | }); 36 | }; 37 | 38 | GA.prototype.orgs = function(callback){ 39 | this.get(['users', this.username, 'orgs'], callback); 40 | }; 41 | 42 | 43 | })( jQuery, window , document ); 44 | -------------------------------------------------------------------------------- /app/assets/javascripts/github/repos.js: -------------------------------------------------------------------------------- 1 | 2 | function renderOrgsMenu(){ 3 | var tpl = $("#org-href-tpl").html(); 4 | var container = $("#orgs-list"); 5 | 6 | GhApi().orgs(function(orgs){ 7 | $.each(orgs, function(){ 8 | var html = Mustache.render(tpl, this); 9 | container.append(html); 10 | }); 11 | }); 12 | } 13 | 14 | $(document).on('shown.bs.tab', 'a.gh-org-repos', function (e) { 15 | $('#gh-orgs-title h3').text('Fetching.....'); 16 | 17 | var attrs = { href: $(this).data('href') }; 18 | 19 | $.rails.handleRemote($('', attrs)); 20 | }) 21 | 22 | -------------------------------------------------------------------------------- /app/assets/javascripts/notification.js: -------------------------------------------------------------------------------- 1 | $.noty.defaults.timeout = 5000; 2 | $.noty.defaults.theme = "relax"; 3 | $.noty.defaults.type = "notification" 4 | 5 | window.flashNotification = function(message, type, timeout){ 6 | if(type == "notice" || !type){ 7 | type = "information" 8 | } 9 | 10 | noty({text: message, type: type, layout: 'topRight', timeout: timeout }); 11 | } 12 | -------------------------------------------------------------------------------- /app/assets/javascripts/rating.js: -------------------------------------------------------------------------------- 1 | function showRatingControl(){ 2 | $('.rating-control select').barrating('show', { 3 | theme: 'bars-pill', 4 | showValues: true, 5 | showSelectedRating: false, 6 | onSelect: function(value, text, event) { 7 | if (typeof(event) !== 'undefined') { 8 | var li = $(event.target).closest('li'); 9 | var url = li.data('url') 10 | $.post(url, { rating: value }) 11 | } 12 | } 13 | }); 14 | } 15 | -------------------------------------------------------------------------------- /app/assets/javascripts/redeem.js: -------------------------------------------------------------------------------- 1 | $(document).on('page:change', function(){ 2 | alert_user(); 3 | }); 4 | 5 | var alert_user = function() { 6 | $(document).on('click', 'button.submit-redeem', function(event){ 7 | event.stopPropagation(); 8 | event.stopImmediatePropagation(); 9 | var form = $(this).parent('form'); 10 | var points = $(this).data().points; 11 | bootbox.confirm({ 12 | title: 'Alert', 13 | message: "You have $ " + points + " in your account.
Are you sure you want to continue?", 14 | buttons: { 15 | confirm: { 16 | label: 'Continue', 17 | className: 'btn-success' 18 | }, 19 | cancel: { 20 | label: 'Cancel', 21 | className: 'btn-danger' 22 | } 23 | }, 24 | callback: function (result) { 25 | if (result) { 26 | $(form).submit(); 27 | } 28 | } 29 | }); 30 | }); 31 | }; 32 | -------------------------------------------------------------------------------- /app/assets/javascripts/users.js: -------------------------------------------------------------------------------- 1 | $(document).on('page:change', function(event) { 2 | $(document).ready(function() { 3 | $('.badge').popover({ 4 | container: 'body', 5 | placement: 'bottom', 6 | trigger: 'hover' 7 | }); 8 | }); 9 | }); 10 | -------------------------------------------------------------------------------- /app/assets/stylesheets/admin/ignored_files.scss: -------------------------------------------------------------------------------- 1 | .slide{ 2 | padding-left: 5px; 3 | float: right; 4 | } 5 | .primary{ 6 | vertical-align: text-bottom; 7 | width: 25px; 8 | height: 17px; 9 | } 10 | .box-tools{ 11 | width: 1015px; 12 | } 13 | -------------------------------------------------------------------------------- /app/assets/stylesheets/admin/redeem_requests.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the admin/redeem_requests controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | .slide{ 5 | float: right; 6 | } 7 | 8 | .btn.btn-primary.glyphicon.glyphicon-download{ 9 | float: right; 10 | } -------------------------------------------------------------------------------- /app/assets/stylesheets/admin/sponsors.scss: -------------------------------------------------------------------------------- 1 | td, th { 2 | text-align: center; 3 | } 4 | 5 | input#create_sponsor { 6 | margin-top: 10px; 7 | } 8 | -------------------------------------------------------------------------------- /app/assets/stylesheets/admin/users.scss: -------------------------------------------------------------------------------- 1 | .box-tools{ 2 | width: 1015px; 3 | } 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/bootstrap_multiselect.css: -------------------------------------------------------------------------------- 1 | .multiselect-container{position:absolute;list-style-type:none;margin:0;padding:0}.multiselect-container .input-group{margin:5px}.multiselect-container>li{padding:0}.multiselect-container>li>a.multiselect-all label{font-weight:700}.multiselect-container>li.multiselect-group label{margin:0;padding:3px 20px 3px 20px;height:100%;font-weight:700}.multiselect-container>li.multiselect-group-clickable label{cursor:pointer}.multiselect-container>li>a{padding:0}.multiselect-container>li>a>label{margin:0;height:100%;cursor:pointer;font-weight:400;padding:3px 20px 3px 40px}.multiselect-container>li>a>label.radio,.multiselect-container>li>a>label.checkbox{margin:0}.multiselect-container>li>a>label>input[type=checkbox]{margin-bottom:5px}.btn-group>.btn-group:nth-child(2)>.multiselect.btn{border-top-left-radius:4px;border-bottom-left-radius:4px}.form-inline .multiselect-container label.checkbox,.form-inline .multiselect-container label.radio{padding:3px 20px 3px 40px}.form-inline .multiselect-container li a label.checkbox input[type=checkbox],.form-inline .multiselect-container li a label.radio input[type=radio]{margin-left:-20px;margin-right:0} 2 | -------------------------------------------------------------------------------- /app/assets/stylesheets/commits.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the Commits controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | 5 | form#filters, .reveal_all { 6 | float: right; 7 | } 8 | 9 | td, th { 10 | text-align: center; 11 | } 12 | 13 | input#query, input#to, input#from{ 14 | margin-right: 5px; 15 | } 16 | 17 | .reward { 18 | display: none; 19 | } 20 | 21 | input#query { 22 | width: 200px; 23 | } 24 | -------------------------------------------------------------------------------- /app/assets/stylesheets/info.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the info controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | 5 | .info{ 6 | h1.faq-title{ 7 | margin-top: 40px; 8 | margin-bottom: 5px; 9 | text-align: center; 10 | font-weight: 600; 11 | } 12 | 13 | h4.faq-subtitle{ 14 | color: #697176; 15 | margin-bottom: 60px; 16 | text-align: center; 17 | } 18 | 19 | .faqs{ 20 | .faq{ 21 | font-size: 16px; 22 | line-height: 1.8; 23 | margin-bottom: 30px; 24 | padding-left: 2px; 25 | text-align: justify; 26 | 27 | .question{ 28 | font-weight: 700; 29 | } 30 | } 31 | } 32 | } 33 | 34 | .info.footer{ 35 | padding: 20px; 36 | } 37 | -------------------------------------------------------------------------------- /app/assets/stylesheets/redeem.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the redeem controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | #promote{ 5 | @extend .badge !optional; 6 | background-color: #00a65a; 7 | font-size: 14px; 8 | 9 | a { 10 | color: white; 11 | } 12 | 13 | } 14 | 15 | -------------------------------------------------------------------------------- /app/assets/stylesheets/registrations.scss: -------------------------------------------------------------------------------- 1 | h1#tac { 2 | text-align: center; 3 | } 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/users.scss: -------------------------------------------------------------------------------- 1 | .badge.bronze { 2 | background-color: #CD7F32; 3 | } 4 | 5 | .badge.silver { 6 | background-color: #C0C0C0; 7 | } 8 | 9 | .badge.gold { 10 | background-color: #D4AF37; 11 | } 12 | 13 | .list-group-item.pull-right { 14 | color: #333333 15 | } 16 | -------------------------------------------------------------------------------- /app/controllers/admin/commits_controller.rb: -------------------------------------------------------------------------------- 1 | class Admin::CommitsController < ApplicationController 2 | 3 | def index 4 | from = (params[:from].presence.try(:to_date) || Date.today.beginning_of_month).beginning_of_day 5 | to = (params[:to].presence.try(:to_date) || Date.today).end_of_day 6 | 7 | @commits = Commit.all.in_range(from, to) 8 | .search_by(params[:query]) 9 | @sum = @commits.sum(:reward) 10 | #@commits = @commits.page(params[:page]) 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | # Prevent CSRF attacks by raising an exception. 3 | # For APIs, you may want to use :null_session instead. 4 | protect_from_forgery with: :exception 5 | 6 | before_action :signout_old_login 7 | 8 | protected 9 | 10 | def signout_old_login 11 | if current_user && current_user.auth_token.blank? 12 | sign_out current_user 13 | redirect_to root_path 14 | return false 15 | end 16 | end 17 | 18 | def authenticate_admin! 19 | unless current_user.is_admin? 20 | redirect_back(notice: I18n.t('messages.unauthorized_access')) 21 | end 22 | end 23 | 24 | def authenticate_sponsor! 25 | if current_user && !current_user.is_sponsorer? 26 | redirect_back(notice: I18n.t('messages.unauthorized_access')) 27 | end 28 | end 29 | 30 | def redirect_back(opts = {}) 31 | redirect_to(request.env['HTTP_REFERER'] || root_path, opts) 32 | end 33 | 34 | def work_in_progress 35 | redirect_back 36 | return false 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /app/controllers/commits_controller.rb: -------------------------------------------------------------------------------- 1 | class CommitsController < ApplicationController 2 | before_action :user_commits, only: [:index, :reveal] 3 | 4 | def index 5 | from = params[:from].presence || Time.now.beginning_of_month 6 | to = params[:to].presence.try(:to_date).try(:end_of_day) || Time.now 7 | @commits = @commits.in_range(from, to) 8 | .search_by(params[:query]) 9 | .page(params[:page]) 10 | .includes(:repository) 11 | end 12 | 13 | def reveal 14 | if params[:id] 15 | @commits.find(params[:id]).set(is_reveal: true) 16 | else 17 | @commits.set(is_reveal: true) 18 | end 19 | # render nothing: true # removed in rails 5.1 20 | head :ok 21 | end 22 | 23 | private 24 | 25 | def user_commits 26 | @commits = current_user.commits.desc(:commit_date) 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/app/controllers/concerns/.keep -------------------------------------------------------------------------------- /app/controllers/concerns/contribution_helper.rb: -------------------------------------------------------------------------------- 1 | module ContributionHelper 2 | def contribution_data(user = current_user) 3 | @user_commits = user.commits.group_by {|t| t.commit_date.beginning_of_month } 4 | .sort 5 | @xAxis = [] 6 | @commits = [] 7 | @points = [] 8 | @username = user.eql?(current_user) ? ['Your'] : ["#{user.name.titleize}'s"] 9 | @user_commits.map do |key, value| 10 | @xAxis << key.strftime('%b %Y') 11 | @commits << value.count 12 | @points << value.sum(&:score) 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/controllers/concerns/gh_cache_helper.rb: -------------------------------------------------------------------------------- 1 | module GhCacheHelper 2 | 3 | private 4 | 5 | def cache_user_repos(page) 6 | Rails.cache.fetch("#{current_user.github_handle}/repos/#{page}", expires_in: 1.hour) do 7 | GITHUB.repositories.list({ 8 | user: current_user.github_handle, 9 | page: page, 10 | sort: 'updated', 11 | direction: 'desc' 12 | }) 13 | end 14 | end 15 | 16 | def cache_org_repos(name, page) 17 | return [] if name.blank? 18 | 19 | Rails.cache.fetch("#{name}/repos/#{page}", expires_in: 1.hour) do 20 | GITHUB.repositories.list({ 21 | org: name, 22 | page: page, 23 | sort: 'updated', 24 | direction: 'desc' 25 | }) 26 | end 27 | end 28 | 29 | end 30 | -------------------------------------------------------------------------------- /app/controllers/concerns/ignored_file_helper.rb: -------------------------------------------------------------------------------- 1 | module IgnoredFileHelper 2 | 3 | def find_ignored_file 4 | @ignored_file = FileToBeIgnored.where(id: params[:id]).first 5 | end 6 | 7 | end -------------------------------------------------------------------------------- /app/controllers/concerns/judges_actions.rb: -------------------------------------------------------------------------------- 1 | module JudgesActions 2 | def comments 3 | @comments = @resource.comments 4 | end 5 | 6 | def comment 7 | @comment = @resource.comments.build(comment_params) 8 | @comment.user = current_user 9 | 10 | if @comment.save 11 | @comment = Comment.new 12 | else 13 | @resource.reload 14 | end 15 | 16 | @comments = @resource.comments 17 | 18 | render 'comments/create' 19 | end 20 | 21 | def rate 22 | @resource.rate(current_user, params[:rating]) 23 | # render nothing: true # removed in rails 5.1 24 | head :ok 25 | end 26 | 27 | private 28 | 29 | def comment_params 30 | params.require(:comment).permit(:content, :is_public) 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /app/controllers/concerns/repo_pagination.rb: -------------------------------------------------------------------------------- 1 | module RepoPagination 2 | def paginate(pages_count) 3 | @total_count = if params[:total_count].present? 4 | params[:total_count].to_i 5 | else 6 | GITHUB.per_page * pages_count 7 | end 8 | 9 | @pagination = Kaminari.paginate_array([], total_count: @total_count) 10 | .page(params[:page]) 11 | .limit(GITHUB.per_page) 12 | 13 | @pagination.offset_value = params[:page].to_i > 0 ? GITHUB.per_page * (params[:page].to_i - 1) : 0 14 | end 15 | end 16 | 17 | -------------------------------------------------------------------------------- /app/controllers/dashboard_controller.rb: -------------------------------------------------------------------------------- 1 | class DashboardController < ApplicationController 2 | include ContributionHelper 3 | before_action :authenticate_user!, except: [:webhook] 4 | 5 | def index 6 | contribution_data 7 | end 8 | 9 | def webhook 10 | # render :nothing # removed in rails 5.1 11 | head :ok 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /app/controllers/github/repos_controller.rb: -------------------------------------------------------------------------------- 1 | class Github::ReposController < ApplicationController 2 | before_action :authenticate_user! 3 | 4 | def sync 5 | unless current_user.repo_syncing? 6 | UserReposJob.perform_later(current_user.id.to_s) unless current_user.blocked 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/controllers/home_controller.rb: -------------------------------------------------------------------------------- 1 | class HomeController < ApplicationController 2 | def index 3 | if user_signed_in? 4 | redirect_to dashboard_path 5 | return 6 | else 7 | @user_trend, @contribution_trend, @xAxis = MultiLineChart::Index.get 8 | end 9 | end 10 | 11 | def leaderboard 12 | @subscriptions = current_round.subscriptions 13 | .where(:points.gt => 0) 14 | .order(points: :desc) 15 | .page(1).per(5) 16 | 17 | if user_signed_in? 18 | render layout: 'application' 19 | else 20 | render layout: 'info' 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /app/controllers/info_controller.rb: -------------------------------------------------------------------------------- 1 | class InfoController < ApplicationController 2 | def faq 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/controllers/redeem_controller.rb: -------------------------------------------------------------------------------- 1 | class RedeemController < ApplicationController 2 | before_action :authenticate_user! 3 | 4 | def create 5 | @redeem = current_user.redeem_requests.build(redeem_params) 6 | if @redeem.save 7 | flash[:notice] = I18n.t('redeem.request_created') 8 | end 9 | end 10 | 11 | private 12 | 13 | def redeem_params 14 | params.fetch(:redeem_request).permit(:points, :retailer, :gift_product_url, :address, :store) 15 | end 16 | 17 | end 18 | -------------------------------------------------------------------------------- /app/controllers/registrations_controller.rb: -------------------------------------------------------------------------------- 1 | class RegistrationsController < Devise::RegistrationsController 2 | 3 | before_action :redirect_to_home, except: [:terms_and_conditions] 4 | 5 | def terms_and_conditions 6 | if params[:terms_and_conditions] 7 | current_user.set(terms_and_conditions: params[:terms_and_conditions]) 8 | redirect_to dashboard_path 9 | else 10 | render 'terms_and_conditions' 11 | end 12 | end 13 | 14 | private 15 | 16 | def redirect_to_home 17 | redirect_to root_path 18 | end 19 | 20 | def sign_up_params 21 | params.require(:user).permit(:email, :github_handle, :name) 22 | end 23 | 24 | end 25 | -------------------------------------------------------------------------------- /app/controllers/transactions_controller.rb: -------------------------------------------------------------------------------- 1 | class TransactionsController < ApplicationController 2 | 3 | before_action :authenticate_user! 4 | 5 | respond_to :html, :js 6 | 7 | def index 8 | @records_per_page = Kaminari.config.default_per_page 9 | @transactions = Transaction.where(user_id:current_user.id).order_by(:created_at => 'desc').page(params[:page]).per(@records_per_page) 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/controllers/users/omniauth_callbacks_controller.rb: -------------------------------------------------------------------------------- 1 | class Users::OmniauthCallbacksController < ApplicationController 2 | before_action :authenticate_user!, except: [:github, :failure] 3 | 4 | def github 5 | @user = User.from_omniauth(request.env["omniauth.auth"]) 6 | 7 | #normal user sign in 8 | sign_in :user, @user 9 | 10 | unless @user.terms_and_conditions 11 | redirect_to terms_and_conditions_path 12 | else 13 | redirect_to dashboard_path 14 | flash[:notice] = "Signed in successfully!" 15 | end 16 | end 17 | 18 | def failure 19 | redirect_to root_path 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /app/controllers/v1/base_controller.rb: -------------------------------------------------------------------------------- 1 | class V1::BaseController < ApplicationController 2 | end 3 | -------------------------------------------------------------------------------- /app/controllers/v1/subscriptions_controller.rb: -------------------------------------------------------------------------------- 1 | class V1::SubscriptionsController < V1::BaseController 2 | def index 3 | user = User.find params[:id] 4 | render json: user.subscriptions.where(:created_at.gt => Date.parse("Feb 2016")).desc(:created_at) 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /app/controllers/v1/transactions_controller.rb: -------------------------------------------------------------------------------- 1 | class V1::TransactionsController < V1::BaseController 2 | #before_action :authenticate_user! 3 | 4 | def index 5 | user = User.find params[:id] 6 | render json: user.transactions.where(hidden: false).desc(:created_at) 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /app/helpers/admin/ignored_files_helper.rb: -------------------------------------------------------------------------------- 1 | module Admin::IgnoredFilesHelper 2 | def to_boolean(str) 3 | str == "true" 4 | end 5 | end -------------------------------------------------------------------------------- /app/helpers/admin/redeem_requests_helper.rb: -------------------------------------------------------------------------------- 1 | module Admin::RedeemRequestsHelper 2 | 3 | def amount_for_store(store = nil) 4 | redeem_requests = RedeemRequest.where(status: false) 5 | redeem_requests = redeem_requests.where(store: store) if store and REDEEM['amazon_stores'].include?(store) 6 | redeem_requests.sum(:amount) 7 | end 8 | 9 | end 10 | -------------------------------------------------------------------------------- /app/helpers/admin/repositories_helper.rb: -------------------------------------------------------------------------------- 1 | module Admin::RepositoriesHelper 2 | 3 | def check_boolean(str) 4 | str == "true" 5 | end 6 | 7 | def child_count(id) 8 | repos = @forks_repos_count.to_a.select{ |r| r['_id'] == id} 9 | repos[0]['count'] unless repos.empty? 10 | end 11 | end 12 | 13 | -------------------------------------------------------------------------------- /app/helpers/dashboard_helper.rb: -------------------------------------------------------------------------------- 1 | module DashboardHelper 2 | def check_if_active(cat) 3 | 'active' if @category == cat 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /app/helpers/github/repos_helper.rb: -------------------------------------------------------------------------------- 1 | module Github::ReposHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/home_helper.rb: -------------------------------------------------------------------------------- 1 | module HomeHelper 2 | 3 | def select_avatar(sponsorer) 4 | if sponsorer.avatar? 5 | sponsorer.avatar 6 | else 7 | avatar_url(sponsorer.user) 8 | end 9 | end 10 | 11 | def redirect(sponsorer) 12 | if sponsorer.organization_url? 13 | sponsorer.organization_url 14 | else 15 | user_path(sponsorer.user.github_handle.downcase) 16 | end 17 | end 18 | 19 | def widget_class 20 | if @size > 2 21 | 'col-md-4' 22 | elsif @size == 2 23 | 'col-md-6' 24 | else 25 | 'col-md-12' 26 | end 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /app/helpers/repositories_helper.rb: -------------------------------------------------------------------------------- 1 | module RepositoriesHelper 2 | 3 | def repository_uri(type = :source_url) 4 | return params[:repository][:source_url] if params[:repository].present? 5 | end 6 | 7 | def popular_repository_label 8 | "Repository with minimum #{REPOSITORY_CONFIG['popular']['stars']} stars." 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /app/helpers/scores_helper.rb: -------------------------------------------------------------------------------- 1 | module ScoresHelper 2 | def score_color(scorable) 3 | case scorable.scores.count 4 | when 0 5 | 'bs-callout bs-callout-danger' 6 | when 1 7 | 'bs-callout bs-callout-warning' 8 | when 2 9 | 'bs-callout bs-callout-warning' 10 | else 11 | 'bs-callout bs-callout-success' 12 | end 13 | end 14 | 15 | def status_color(user) 16 | # TODO: optimize this using mongoDB aggregation query to get the number 17 | # of commits that have less than 3 scores. 18 | # Kept a case statement incase we need more color codes later on 19 | counter = user.commits.includes(:scores).select { |c| c.scores.count < 3 }.count 20 | if counter == 0 21 | counter = user.activities.includes(:scores).select { |c| c.scores.count < 3 }.count 22 | end 23 | case counter 24 | when 0 25 | 'bs-callout bs-callout-success' 26 | else 27 | 'bs-callout bs-callout-warning' 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /app/helpers/users_helper.rb: -------------------------------------------------------------------------------- 1 | module UsersHelper 2 | 3 | def logged_in_user? 4 | current_user == @user 5 | end 6 | 7 | def github_points_options 8 | REDEEM['github_redeem_amounts'].collect do |amount| 9 | ["$#{amount}", amount] 10 | end 11 | end 12 | 13 | def remove_prefix(twitter_handle) 14 | twitter_handle[1..-1] 15 | end 16 | 17 | def amount_earned(user) 18 | user.transactions.where(type: 'debit').sum(:amount).abs 19 | end 20 | 21 | def level(points) 22 | BADGE.select{|key, value| points.in?(value['min']..value['max'])} 23 | .keys.first 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /app/javascript/packs/application.js: -------------------------------------------------------------------------------- 1 | /* eslint no-console:0 */ 2 | // This file is automatically compiled by Webpack, along with any other files 3 | // present in this directory. You're encouraged to place your actual application logic in 4 | // a relevant structure within app/javascript and only use these pack files to reference 5 | // that code so it'll be compiled. 6 | // 7 | // To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate 8 | // layout file, like app/views/layouts/application.html.erb 9 | 10 | 11 | // Uncomment to copy all static images under ../images to the output folder and reference 12 | // them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>) 13 | // or the `imagePath` JavaScript helper below. 14 | // 15 | // const images = require.context('../images', true) 16 | // const imagePath = (name) => images(name, true) 17 | 18 | console.log('Hello World from Webpacker') 19 | -------------------------------------------------------------------------------- /app/jobs/application_job.rb: -------------------------------------------------------------------------------- 1 | class ApplicationJob < ActiveJob::Base 2 | end -------------------------------------------------------------------------------- /app/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/app/mailers/.keep -------------------------------------------------------------------------------- /app/mailers/application_mailer.rb: -------------------------------------------------------------------------------- 1 | class ApplicationMailer < ActionMailer::Base 2 | default from: "info@codecuriosity.org" 3 | layout 'mailer' 4 | end 5 | -------------------------------------------------------------------------------- /app/mailers/redeem_mailer.rb: -------------------------------------------------------------------------------- 1 | class RedeemMailer < ApplicationMailer 2 | default from: 'info@codecuriosity.org' 3 | 4 | def redeem_request(request) 5 | @user = request.user 6 | @points = request.points 7 | 8 | mail(to: @user.email, subject: "[CODECURIOSITY] #{@points} points redemption request") 9 | end 10 | 11 | def notify_admin(request) 12 | @redeem_request = request 13 | @user = request.user 14 | 15 | mail(to: ENV['ADMIN_EMAILS'].split(','), subject: "Redemption request from #{request.user.github_handle}") 16 | end 17 | 18 | def coupon_code(request) 19 | @user = request.user 20 | @redeem_request = request 21 | 22 | mail(to: request.user.email, subject: "[CODECURIOSITY] Here is your gift!") 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /app/mailers/subscription_mailer.rb: -------------------------------------------------------------------------------- 1 | class SubscriptionMailer < ApplicationMailer 2 | 3 | def subscription_email(user) 4 | @user = user 5 | subject_message = "Welcome to #{Date.today.strftime("%B")} challenge round of Code Curiosity" 6 | mail(subject:"#{subject_message}") 7 | end 8 | 9 | def progress(user, round) 10 | @user = user 11 | @subscription = user.subscriptions.where(round: round).first 12 | 13 | message = if @subscription.goal_achived? 14 | "You have achieved your goal before time." 15 | else 16 | "You have still time to achieve your goal. Keep it up..." 17 | end 18 | 19 | mail(to: user.email, subject: "[CODECURIOSITY] #{message}") 20 | end 21 | 22 | def redeem_points(user, message) 23 | @user = user 24 | @message = message 25 | 26 | mail(to: user.email, subject: "[CODECURIOSITY] Your points for the month of #{Date.today.strftime("%B")}!") 27 | end 28 | 29 | def new_t_and_c(user) 30 | @user = user 31 | mail(to: user.email, subject: "[CODECURIOSITY] New Redemption Strategy") 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /app/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/app/models/.keep -------------------------------------------------------------------------------- /app/models/budget.rb: -------------------------------------------------------------------------------- 1 | class Budget 2 | include Mongoid::Document 3 | include Mongoid::Timestamps 4 | 5 | field :start_date, type: Date 6 | field :end_date, type: Date 7 | field :day_amount, type: Float 8 | field :amount, type: Float 9 | field :is_all_repos, type: Boolean, default: false 10 | field :is_deactivated, type: Boolean, default: false 11 | 12 | belongs_to :sponsor 13 | has_and_belongs_to_many :repositories 14 | 15 | validates :start_date, :end_date, :amount, presence: true 16 | 17 | scope :activated, -> { where(is_deactivated: false) } 18 | 19 | after_save do |sponsor| 20 | sponsor.set(day_amount: calculate_day_amount) 21 | end 22 | 23 | private 24 | 25 | def calculate_day_amount 26 | number_of_days = (end_date - start_date).to_i + 1 27 | amount/number_of_days 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /app/models/code_file.rb: -------------------------------------------------------------------------------- 1 | class CodeFile 2 | include Mongoid::Document 3 | include Mongoid::Timestamps 4 | 5 | field :name, type: String 6 | field :commits_count, type: Integer, default: 0 7 | field :bugspots_score, type: Integer, default: 0 8 | field :branches, type: Array, default: [] 9 | 10 | belongs_to :repository 11 | 12 | index({ name: 1 }) 13 | end 14 | -------------------------------------------------------------------------------- /app/models/comment.rb: -------------------------------------------------------------------------------- 1 | class Comment 2 | include Mongoid::Document 3 | include Mongoid::Timestamps 4 | 5 | field :content, type: String 6 | field :is_public, type: Boolean, default: false 7 | 8 | belongs_to :commentable, polymorphic: true 9 | belongs_to :user 10 | 11 | validates :content, presence: true 12 | 13 | after_create do |c| 14 | c.commentable.inc(comments_count: 1) 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /app/models/commit_score.rb: -------------------------------------------------------------------------------- 1 | class CommitScore 2 | def initialize(commit, repo) 3 | @commit = commit 4 | @repo = repo 5 | @pr = commit.pull_request 6 | end 7 | 8 | def calculate 9 | rand(6..10) 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/app/models/concerns/.keep -------------------------------------------------------------------------------- /app/models/concerns/active_job_retries_count.rb: -------------------------------------------------------------------------------- 1 | module ActiveJobRetriesCount 2 | extend ActiveSupport::Concern 3 | MAX_RETRY_COUNT = 5 4 | 5 | included do 6 | attr_accessor :retries_count 7 | end 8 | 9 | # define the activejob methods to increment the retry count during failed retries of a job 10 | def initialize(*arguments) 11 | super 12 | @retries_count ||= 0 13 | end 14 | 15 | def deserialize(job_data) 16 | super 17 | @retries_count = job_data['retries_count'] || 0 18 | end 19 | 20 | def serialize 21 | super.merge('retries_count' => retries_count || 0) 22 | end 23 | 24 | def retry_job(options) 25 | @retries_count = (retries_count || 0) + 1 26 | super(options) 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /app/models/concerns/judge_scoring_helper.rb: -------------------------------------------------------------------------------- 1 | module JudgeScoringHelper 2 | extend ActiveSupport::Concern 3 | 4 | included do 5 | field :judges_score, type: Integer 6 | end 7 | 8 | def set_judges_avg_score 9 | score = scores.any? ? (scores.pluck(:value).sum/scores.count.to_f).round : nil 10 | 11 | self.set(judges_score: score) 12 | end 13 | 14 | def avg_score 15 | if self.scores.any? 16 | (scores.pluck(:value).sum/scores.count.to_f).round 17 | end 18 | end 19 | 20 | def judge_rating(user) 21 | scores.where(user: user).first.try(:value) 22 | end 23 | 24 | def final_score 25 | judges_score || auto_score 26 | end 27 | 28 | def rate(judge, rating) 29 | score = self.scores.where(user: judge).first 30 | 31 | if score.nil? 32 | score = self.scores.build(user: judge) 33 | end 34 | 35 | if rating.present? 36 | score.update_attributes(value: rating.to_i) 37 | else 38 | score.destroy if score 39 | end 40 | 41 | set_judges_avg_score 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /app/models/concerns/repo_leaders.rb: -------------------------------------------------------------------------------- 1 | module RepoLeaders 2 | 3 | def leaders(round) 4 | map = %Q{ 5 | function() { 6 | emit(this.user_id, this.judges_score || this.auto_score || 0); 7 | } 8 | } 9 | 10 | reduce = %Q{ 11 | function(key, values) { 12 | return Array.sum(values); 13 | } 14 | } 15 | 16 | repo_ids = Repository.or(source_gh_id: gh_id).or(gh_id: gh_id).pluck(:id) 17 | 18 | result = Commit.where(round: round, :repository_id.in => repo_ids) 19 | .map_reduce(map, reduce) 20 | .out(inline: true) 21 | 22 | leaders = result.to_a.sort!{|r1, r2| r2['value'] <=> r1['value'] }.first(10) 23 | leaders.each do |r| 24 | r['user'] = User.find(r['_id']) 25 | end 26 | 27 | return leaders 28 | end 29 | 30 | end 31 | -------------------------------------------------------------------------------- /app/models/file_to_be_ignored.rb: -------------------------------------------------------------------------------- 1 | class FileToBeIgnored 2 | include Mongoid::Document 3 | include Mongoid::Timestamps 4 | 5 | field :name, type: String 6 | field :programming_language, type: String 7 | field :ignored, type: Boolean, default: false 8 | field :count, type: Integer, default: 0 9 | field :highest_score, type: Float, default: 0 10 | 11 | validates :name, presence: true 12 | 13 | def self.name_exist?(file_path) 14 | file_name = File.basename(file_path) 15 | 16 | return false if file_name.blank? 17 | 18 | where(name: /(#{Regexp.escape(file_name)})$/).first 19 | end 20 | 21 | end -------------------------------------------------------------------------------- /app/models/git_app.rb: -------------------------------------------------------------------------------- 1 | class GitApp 2 | include Mongoid::Document 3 | 4 | @@access_token = nil 5 | 6 | def self.access_token 7 | @@access_token 8 | end 9 | 10 | def self.info 11 | update_token 12 | Github.new( 13 | oauth_token: @@access_token, 14 | client_id: ENV['GIT_APP_ID'], 15 | client_secret: ENV['GIT_APP_SECRET'] 16 | ) 17 | end 18 | 19 | def self.update_token 20 | user = User.where(:auth_token.ne => nil).all.sample 21 | @@access_token = User.encrypter.decrypt_and_verify(user.auth_token) 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /app/models/pull_request.rb: -------------------------------------------------------------------------------- 1 | class PullRequest 2 | include Mongoid::Document 3 | include Mongoid::Timestamps 4 | 5 | field :number, type: Integer 6 | field :created_at_git, type: String 7 | field :comment_count, type: Integer 8 | field :author_association, type: String 9 | field :label, type: DateTime 10 | 11 | has_many :commits 12 | 13 | validates :number, :created_at_git, :author_association, :comment_count, presence: true 14 | end 15 | -------------------------------------------------------------------------------- /app/models/repo_budget.rb: -------------------------------------------------------------------------------- 1 | class RepoBudget 2 | attr_accessor :date 3 | 4 | def initialize(date) 5 | @date = date 6 | end 7 | 8 | def calculate 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /app/models/role.rb: -------------------------------------------------------------------------------- 1 | class Role 2 | include Mongoid::Document 3 | 4 | field :name, type: String 5 | end 6 | -------------------------------------------------------------------------------- /app/models/score.rb: -------------------------------------------------------------------------------- 1 | class Score 2 | include Mongoid::Document 3 | include Mongoid::Timestamps 4 | 5 | field :value, type: Integer, default: 0 6 | field :comment, type: String 7 | 8 | embedded_in :scorable, polymorphic: true 9 | belongs_to :user 10 | 11 | validates :user, :value, presence: true 12 | validates :value, numericality: { only_integer: true, greater_than: -1 } 13 | end 14 | -------------------------------------------------------------------------------- /app/models/sponsor.rb: -------------------------------------------------------------------------------- 1 | class Sponsor 2 | include Mongoid::Document 3 | 4 | field :name, type: String 5 | field :is_individual, type: Boolean, default: false 6 | 7 | has_many :budgets, dependent: :destroy 8 | 9 | accepts_nested_attributes_for :budgets, allow_destroy: true 10 | 11 | validates :name, presence: true 12 | validates :name, uniqueness: true 13 | end 14 | -------------------------------------------------------------------------------- /app/presenters/v1/base_presenter.rb: -------------------------------------------------------------------------------- 1 | class V1::BasePresenter 2 | end 3 | -------------------------------------------------------------------------------- /app/serializers/transaction_serializer.rb: -------------------------------------------------------------------------------- 1 | class TransactionSerializer < ActiveModel::Serializer 2 | attributes :id, :points, :type, :transaction_type, :description, :created_at, :coupon_code, :redeem_request_retailer, :amount 3 | 4 | def transaction_type 5 | object.transaction_type.humanize 6 | end 7 | 8 | def created_at 9 | object.created_at.strftime('%d/%b/%Y %T') 10 | end 11 | 12 | def redeem_request_retailer 13 | object.redeem_request.retailer if object.redeem_request? 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/services/frequency_factor_calculator.rb: -------------------------------------------------------------------------------- 1 | class FrequencyFactorCalculator 2 | def initialize(commit) 3 | @user = commit.user 4 | @commit = commit 5 | end 6 | 7 | attr_reader :user, :commit 8 | 9 | def result 10 | 1 + (weight / threshold) 11 | end 12 | 13 | private 14 | 15 | def weight 16 | [weight_sum, 0].max 17 | end 18 | 19 | def weight_sum 20 | evaluation_days.collect do |date| 21 | date.in?(number_of_days_commited) ? 1 : -1 22 | end.sum.to_f 23 | end 24 | 25 | def threshold 26 | SCORING_ENGINE_CONFIG[:frequency_factor_threshold] 27 | end 28 | 29 | def number_of_days_commited 30 | @number_of_days_commited ||= user.commits.where(:commit_date.gt => from_date, :commit_date.lt => to_date) 31 | .asc(:commit_date) 32 | .pluck(:commit_date) 33 | .collect(&:to_date) 34 | end 35 | 36 | def evaluation_days 37 | (from_date..to_date).collect(&:to_date) 38 | end 39 | 40 | def from_date 41 | @from_date ||= commit.commit_date - threshold.days 42 | end 43 | 44 | def to_date 45 | @to_date ||= commit.commit_date - 1.day 46 | end 47 | end 48 | -------------------------------------------------------------------------------- /app/services/multi_line_chart/contribution.rb: -------------------------------------------------------------------------------- 1 | class MultiLineChart::Contribution 2 | class << self 3 | def get 4 | contributions = Commit.collection.aggregate([match, project, group, sort]) 5 | contributions.collect do |r| 6 | [ 7 | "#{Date::ABBR_MONTHNAMES[r['_id']['month']]} #{r['_id']['year']}", 8 | r['total'] 9 | ] 10 | end 11 | end 12 | 13 | private 14 | 15 | def match 16 | { 17 | '$match' => { 18 | 'commit_date' => { '$gt' => Date.parse('Apr 2016') } 19 | } 20 | } 21 | end 22 | 23 | def project 24 | { 25 | '$project' => { 26 | 'month' => { '$month' => '$commit_date'}, 27 | 'year' => {'$year' => '$commit_date'}, 28 | 'score' => 1 29 | } 30 | } 31 | end 32 | 33 | def group 34 | { 35 | '$group' => { 36 | _id: {'month' => '$month', 'year' => '$year'}, 37 | total: { '$sum' => '$score' } 38 | } 39 | } 40 | end 41 | 42 | def sort 43 | { 44 | '$sort' => { 45 | '_id.year' => 1, 46 | '_id.month' => 1 47 | } 48 | } 49 | end 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /app/services/multi_line_chart/index.rb: -------------------------------------------------------------------------------- 1 | class MultiLineChart::Index 2 | def self.get 3 | users = MultiLineChart::User.get 4 | contributions = MultiLineChart::Contribution.get 5 | 6 | xAxis = contributions.map(&:first) 7 | u_trend = users.inject([]){ |acc, value| acc << acc.last.to_i + value[1].to_i } 8 | c_trend = contributions.inject([]){ |acc, value| acc << acc.last.to_i + value[1].to_i } 9 | 10 | [u_trend, c_trend, xAxis] 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/services/multi_line_chart/user.rb: -------------------------------------------------------------------------------- 1 | class MultiLineChart::User 2 | class << self 3 | def get 4 | users = User.collection.aggregate([match, project, group, sort]) 5 | users.collect do |r| 6 | [ 7 | "#{Date::ABBR_MONTHNAMES[r['_id']['month']]} #{r['_id']['year']}", 8 | r['total'] 9 | ] 10 | end 11 | end 12 | 13 | private 14 | 15 | def match 16 | { 17 | '$match' => { 18 | 'auto_created' => false, 19 | 'created_at' => { '$gt' => Date.parse('Apr 2016') } 20 | } 21 | } 22 | end 23 | 24 | def project 25 | { 26 | '$project' => { 27 | 'month' => { '$month' => '$created_at'}, 28 | 'year' => {'$year' => '$created_at'} 29 | } 30 | } 31 | end 32 | 33 | def group 34 | { 35 | '$group' => { 36 | _id: {'month' => '$month', 'year' => '$year'}, 37 | total: { '$sum' => 1 } 38 | } 39 | } 40 | end 41 | 42 | def sort 43 | { 44 | '$sort' => { 45 | '_id.year' => 1, 46 | '_id.month' => 1 47 | } 48 | } 49 | end 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /app/views/admin/commits/_commits.html.haml: -------------------------------------------------------------------------------- 1 | - @commits.each do |commit| 2 | %tr 3 | %td= commit.commit_date.strftime("%d %B %y") 4 | %td= commit.user&.name 5 | %td= commit.repository&.name 6 | %td 7 | = commit.message 8 | %br 9 | = link_to commit.html_url, class: 'btn btn-xs' do 10 | %i.fa.fa-fw.fa-share 11 | View 12 | %td 13 | - if commit.score.nil? 14 | %a.scores.fa.fa-hourglass-2 15 | - else 16 | = commit.score 17 | %td 18 | - if commit.non_rewardable_commit? 19 | %span - 20 | - else 21 | - if commit.reward.nil? 22 | %a.rewards.fa.fa-hourglass-2 23 | - else 24 | = "$ #{commit.reward}" 25 | -------------------------------------------------------------------------------- /app/views/admin/commits/_commits_table.html.haml: -------------------------------------------------------------------------------- 1 | - if @commits.any? 2 | %table.table.table-hover.table-bordered.commits_table 3 | %thead 4 | %tr 5 | %th.col-xs-2 Commit Date 6 | %th.col-xs-2 User 7 | %th.col-xs-2 Repository Name 8 | %th.col-xs-7 Description 9 | %th.col-xs-1 Score 10 | %th.col-xs-1 Reward($) 11 | %tbody 12 | = render partial: 'commits' 13 | - else 14 | = render partial: 'callout_box', locals: {type: 'success', title: 'No Contributions', message: 'There are no commits.'} 15 | -------------------------------------------------------------------------------- /app/views/admin/commits/index.html.haml: -------------------------------------------------------------------------------- 1 | %section.content-header 2 | %nav.navbar.navbar-default 3 | .container-fluid 4 | .navbar-header 5 | %a.navbar-brand 6 | Commits 7 | %p.navbar-text.navbar-right.pull-right 8 | Reward: 9 | %span.badge= "$#{@commits.sum(:reward)}" 10 |    11 | %section.content 12 | .row 13 | .col-xs-12 14 | = form_tag(admin_commits_path, method: :get, remote: true, id: 'filters', class: 'form-inline') do 15 | = date_field_tag :from, Date.today.beginning_of_month, class: 'form-control' 16 | = date_field_tag :to, Date.today, class: 'form-control' 17 | = text_field_tag :query, nil, placeholder: 'Name of User, repository or description', class: 'form-control' 18 | = submit_tag 'Go', class: 'btn btn-default' 19 | %br 20 | %br 21 | %br 22 | .box.box-primary 23 | .box-body.table-responsive#commits 24 | - if @commits.any? 25 | = render partial: 'commits_table' 26 | - else 27 | = 'No commits' 28 | -------------------------------------------------------------------------------- /app/views/admin/commits/index.js.haml: -------------------------------------------------------------------------------- 1 | :plain 2 | $("#commits").html("#{j render(partial: 'commits_table')}"); 3 | $('.commits_table').DataTable(); 4 | $(".badge").html("#{@sum}"); 5 | -------------------------------------------------------------------------------- /app/views/admin/ignored_files/_form.html.haml: -------------------------------------------------------------------------------- 1 | = simple_form_for @ignored_file, url: path do |f| 2 | .col-xs-6 3 | = f.input :name 4 | = f.input :programming_language 5 | = f.input :ignored, as: :select, collection: { 'Yes' => 'true', 'No' => 'false'}, include_blank: false 6 | %button.btn.btn-primary{type: 'submit'}= @ignored_file.persisted? ? 'Update' : 'Create' -------------------------------------------------------------------------------- /app/views/admin/ignored_files/_ignored_file.html.haml: -------------------------------------------------------------------------------- 1 | %tr 2 | %td= ignored_file.name 3 | %td= ignored_file.programming_language 4 | %td= ignored_file.highest_score 5 | %td= ignored_file.count 6 | %td= ignored_file.ignored ? 'Yes' : 'No' 7 | %td 8 | = link_to 'Edit', edit_admin_ignored_file_path(ignored_file), class: 'btn btn-xs btn-primary' 9 | = link_to 'Delete', admin_ignored_file_path(ignored_file), class: 'btn btn-xs btn-danger', data: { method: 'delete', confirm: 'Are you sure?' } 10 | %td 11 | %input.primary{:type => "checkbox", name: 'ignored', checked: to_boolean("#{ignored_file.ignored}"), id: "#{ignored_file.id}"} -------------------------------------------------------------------------------- /app/views/admin/ignored_files/edit.html.haml: -------------------------------------------------------------------------------- 1 | %section.content-header 2 | %h1 3 | Edit File 4 | %section.content 5 | .row 6 | .col-xs-12 7 | .box.box-primary 8 | .box-body 9 | = render partial: 'form', locals: { path: admin_ignored_file_path(@ignored_file) } -------------------------------------------------------------------------------- /app/views/admin/ignored_files/index.js.erb: -------------------------------------------------------------------------------- 1 | $('#ignored_file').html("<%=j(render(partial: 'ignored_file', collection: @ignored_files)) %>"); 2 | $(".pagination-container").html("<%=j(paginate @ignored_files, remote: true)%>") -------------------------------------------------------------------------------- /app/views/admin/ignored_files/new.html.haml: -------------------------------------------------------------------------------- 1 | %section.content-header 2 | %h1 3 | Add File 4 | %section.content 5 | .row 6 | .col-xs-12 7 | .box.box-primary 8 | .box-body 9 | = render partial: 'form', locals: { path: admin_ignored_files_path } -------------------------------------------------------------------------------- /app/views/admin/ignored_files/update_ignore_field.js.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/app/views/admin/ignored_files/update_ignore_field.js.erb -------------------------------------------------------------------------------- /app/views/admin/redeem_requests/_redeem.html.haml: -------------------------------------------------------------------------------- 1 | %table.table.table-bordered 2 | = render partial: 'tagtable' 3 | .pagination-container 4 | = paginate @redeem_requests, :remote => true -------------------------------------------------------------------------------- /app/views/admin/redeem_requests/_redeem_request.html.haml: -------------------------------------------------------------------------------- 1 | %tr 2 | %td 3 | - if redeem_request.user.is_sponsorer 4 | .badge $ 5 | = link_to redeem_request.user.email, user_path(redeem_request.user), target: '_blank' 6 | %td 7 | - if redeem_request.retailer_other? 8 | = link_to redeem_request.retailer.upcase, redeem_request.gift_product_url, target: '_blank' 9 | - else 10 | = redeem_request.retailer.upcase 11 | %td= redeem_request.store? ? redeem_request.store.upcase : "NA" 12 | %td= redeem_request.points 13 | %td= redeem_request.amount 14 | %td= redeem_request.created_at.strftime('%D %T') 15 | %td= redeem_request.coupon_code 16 | %td= redeem_request.address 17 | %th= redeem_request.status ? 'Closed' : 'Open' 18 | %td 19 | = link_to 'Set Coupon/Points', '#', class: 'btn btn-xs btn-primary', data: { toggle: 'modal', target: '#coupon-code-modal', url: admin_redeem_request_path(redeem_request), code: redeem_request.coupon_code, comment: redeem_request.comment, retailer: redeem_request.retailer, status: redeem_request.status, points: redeem_request.points } 20 | -if @status == 'true' 21 | = link_to '', admin_redeem_request_path(redeem_request), class: 'glyphicon glyphicon-trash', data:{method: 'delete', confirm: 'Are you sure?'} 22 | -------------------------------------------------------------------------------- /app/views/admin/redeem_requests/_tagtable.html.haml: -------------------------------------------------------------------------------- 1 | %thead 2 | %tr 3 | %th.col-xs-2 User 4 | %th.col-xs-1 Gift Shop 5 | %th.col-xs-1 Store 6 | %th.col-xs-1 Points 7 | %th.col-xs-1 Cost($) 8 | %th.col-xs-2 Date 9 | %th.col-xs-2 Coupon Code 10 | %th.col-xs-1 Address 11 | %th.col-xs-1 Status 12 | %th.col-xs-2 Actions 13 | %tbody 14 | = render @redeem_requests 15 | -------------------------------------------------------------------------------- /app/views/admin/redeem_requests/index.js.haml: -------------------------------------------------------------------------------- 1 | :plain 2 | $("#user_table").html("#{j render(partial: 'redeem')}"); -------------------------------------------------------------------------------- /app/views/admin/repositories/_add_repo.html.haml: -------------------------------------------------------------------------------- 1 | .modal-dialog 2 | .modal-content 3 | .modal-header 4 | %button.close{'aria-label' => 'Close', 'data-dismiss' => 'modal', :type => 'button'} 5 | %i.fa.fa-close 6 | %h4.modal-title 7 | Add Repository 8 | .modal-body 9 | = simple_form_for(Repository.new, url: admin_repositories_path, method: 'post') do |f| 10 | = f.input :name 11 | = f.input :owner 12 | = f.submit 'Add', class: 'btn btn-primary btn-block' 13 | -------------------------------------------------------------------------------- /app/views/admin/repositories/_repos_table.html.haml: -------------------------------------------------------------------------------- 1 | %table.table.table-hover.table-bordered#repos 2 | %thead 3 | %tr 4 | %th.col-xs-2 5 | Name 6 | .badge Forks 7 | %th.col-xs-3 Description 8 | %th.col-xs-1 Stars 9 | %th.col-xs-1 Ignored 10 | %th.col-xs-1 To be Ignored? 11 | %tbody 12 | - @repos.each do |repo| 13 | %tr 14 | %td.col-xs-2 15 | = link_to repo.name, repo.source_url, target: "_blank" 16 | - if repo.popular? || repo.source_gh_id.nil? 17 | .badge= child_count(repo.id) 18 | %td.col-xs-3= repo.description 19 | %td.col-xs-1= repo.stars 20 | %td.col-xs-1= repo.ignore ? 'Yes' : 'No' 21 | %td.col-xs-1 22 | %input.secondary{:type => "checkbox", name: "ignore",checked: check_boolean("#{repo.ignore}"), id: "#{repo.id}"} 23 | 24 | -------------------------------------------------------------------------------- /app/views/admin/repositories/index.html.haml: -------------------------------------------------------------------------------- 1 | %section.content-header 2 | %h1 3 | Repositories:- 4 | %label.slide 5 | %input#repo{ checked: "checked", type: "checkbox", data: {toggle: 'toggle', width: 100, height: 34, on: "Required", off: "Ignored"}} 6 | = link_to '#', class: 'btn btn-primary pull-right', data: { toggle: 'modal', target: '#add_repo .modal' } do 7 | Add Repo 8 | %section.content 9 | .row 10 | .col-xs-12 11 | .box.box-primary 12 | .box-header 13 | %h3.box-title 14 | %span Repositories: 15 | .box-tools 16 | = form_tag(search_admin_repositories_path, method: :get, class: 'col-xs-2 col-md-4 pull-right') do 17 | .input-group.input-group-sm 18 | = text_field_tag('q', params[:q], class: 'form-control pull-right', placeholder: 'Repository name') 19 | .input-group-btn 20 | %button.btn.btn-default{type: 'submit'} Go 21 | .box-body.table-responsive 22 | - if @repos.any? 23 | = render 'repos_table' 24 | .pagination-container 25 | = paginate @repos, remote: true 26 | #add_repo 27 | .modal.fade 28 | = render partial: 'add_repo' 29 | -------------------------------------------------------------------------------- /app/views/admin/repositories/index.js.erb: -------------------------------------------------------------------------------- 1 | $('#repos').html("<%=j render 'repos_table' %>"); 2 | $(".pagination-container").html("<%=j(paginate @repos, remote: true)%>") -------------------------------------------------------------------------------- /app/views/admin/repositories/update_ignore_field.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/app/views/admin/repositories/update_ignore_field.js -------------------------------------------------------------------------------- /app/views/admin/sponsors/_sponsors.html.haml: -------------------------------------------------------------------------------- 1 | - @sponsors.each do |sponsor| 2 | %tr 3 | %td 4 | = link_to admin_sponsor_path(sponsor) do 5 | = sponsor.name 6 | %td= sponsor.is_individual ? 'Individual' : 'Organisation' 7 | %td 8 | = link_to 'Edit', edit_admin_sponsor_path(sponsor.id), class: 'btn btn-primary' 9 | = link_to 'Destory', admin_sponsor_path(sponsor.id), method: :delete, confirm: "Are you sure?", class: 'btn btn-danger' 10 | -------------------------------------------------------------------------------- /app/views/admin/sponsors/_sponsors_table.html.haml: -------------------------------------------------------------------------------- 1 | %table.table.table-hover.table-bordered 2 | %thead 3 | %tr 4 | %th.col-xs-1 Name 5 | %th.col-xs-1 Organisation/Individual 6 | %th.col-xs-1 Actions 7 | %tbody 8 | = render partial: 'sponsors' 9 | 10 | .pagination-container 11 | = paginate @sponsors, remote: true 12 | -------------------------------------------------------------------------------- /app/views/admin/sponsors/edit.html.haml: -------------------------------------------------------------------------------- 1 | %section.content-header 2 | %h1 3 | Sponsor 4 | %section.content 5 | .row 6 | .col-xs-12 7 | .box.box-primary 8 | .box-body 9 | = render 'form' 10 | -------------------------------------------------------------------------------- /app/views/admin/sponsors/index.html.haml: -------------------------------------------------------------------------------- 1 | %section.content-header 2 | %h1 3 | Sponsors :- 4 | 5 | = link_to new_admin_sponsor_path, class: 'btn btn-primary pull-right' do 6 | Add Sponsor 7 | 8 | %section.content 9 | .row 10 | .col-xs-12 11 | .box.box-primary 12 | .box-header 13 | %h3.box-title 14 | %span 15 | .box-tools 16 | 17 | .box-body.table-responsive#sponsors 18 | = render partial: 'sponsors_table' 19 | -------------------------------------------------------------------------------- /app/views/admin/sponsors/index.js.haml: -------------------------------------------------------------------------------- 1 | :plain 2 | $("#sponsors").html("#{j render(partial: 'sponsors_table')}"); 3 | -------------------------------------------------------------------------------- /app/views/admin/sponsors/new.html.haml: -------------------------------------------------------------------------------- 1 | %section.content-header 2 | %h1 3 | Sponsor 4 | %section.content 5 | .row 6 | .col-xs-12 7 | .box.box-primary 8 | .box-body 9 | = render 'form' 10 | -------------------------------------------------------------------------------- /app/views/admin/sponsors/show.html.haml: -------------------------------------------------------------------------------- 1 | %section.content-header 2 | %h1 3 | Budgets :- 4 | 5 | %section.content 6 | .row 7 | .col-xs-12 8 | .box.box-primary 9 | .box-header 10 | %h3.box-title 11 | %span 12 | .box-tools 13 | 14 | .box-body.table-responsive 15 | %table.table.table-hover.table-bordered 16 | %thead 17 | %tr 18 | %th.col-xs-1 Start Date 19 | %th.col-xs-1 End Date 20 | %th.col-xs-1 Amount 21 | %th.col-xs-1 Day Amount 22 | %th.col-xs-2 Repositories 23 | 24 | %tbody#sponsors 25 | - @budgets.each do |budget| 26 | %tr 27 | %td= budget.start_date.strftime('%d %B %y') 28 | %td= budget.end_date.strftime('%d %B %y') 29 | %td= budget.amount 30 | %td= budget.day_amount.round(2) 31 | %td 32 | - if budget.is_all_repos 33 | = 'All Repositories' 34 | - else 35 | = budget.repositories.collect{|repo| repo.name}.join(', ') 36 | -------------------------------------------------------------------------------- /app/views/admin/users/_user.html.haml: -------------------------------------------------------------------------------- 1 | %tr 2 | %td= link_to user.name, user_path(user), target: '_blank' 3 | %td= link_to user.github_handle, github_url(user), target: '_blank' 4 | %td= user.points 5 | %td= user.email 6 | %td= user.created_at.strftime('%d/%m/%Y %T') 7 | %td= check_box_tag user.id, 'blocked', user.blocked, { id: "#{user.id}", class: 'block'} 8 | %td 9 | %a{href: admin_user_login_as_path(user), class: "btn btn-primary btn-sm", data: {confirm: "Are you sure?"}} 10 | %i.fa.fa-user 11 | Login as 12 | %a{href: admin_user_path(user.id), class: "btn btn-danger btn-sm", data: {method: 'delete', confirm: "Are you sure? This action is irreversible"}} 13 | %i.fa.fa-trash 14 | 15 | -------------------------------------------------------------------------------- /app/views/admin/users/block_user.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/app/views/admin/users/block_user.js -------------------------------------------------------------------------------- /app/views/admin/users/index.js.erb: -------------------------------------------------------------------------------- 1 | $('#users').html("<%=j render(partial: 'user', collection: @users) %>"); 2 | $(".pagination-container").html("<%=j(paginate @users, remote: true)%>") 3 | -------------------------------------------------------------------------------- /app/views/application/_admin_sidebar.html.haml: -------------------------------------------------------------------------------- 1 | %li.treeview 2 | %a{href: "#"} 3 | %i.fa.fa-gears 4 | %span Admin 5 | %i.fa.fa-angle-left.pull-right 6 | %ul.treeview-menu 7 | %li 8 | %a{href: admin_users_path} 9 | %i.fa.fa-circle-o 10 | %span Users 11 | %li 12 | %a{href: admin_commits_path} 13 | %i.fa.fa-circle-o 14 | %span Commits 15 | %li 16 | %a{href: admin_repositories_path} 17 | %i.fa.fa-circle-o 18 | %span Repositories 19 | %li 20 | %a{href: admin_ignored_files_path} 21 | %i.fa.fa-circle-o 22 | %span Ignored Files 23 | %li 24 | %a{href: admin_sponsors_path} 25 | %i.fa.fa-circle-o 26 | %span Sponsors 27 | %li 28 | %a{href: admin_redeem_requests_path} 29 | %i.fa.fa-credit-card-alt 30 | %span Redeem Requests 31 | -------------------------------------------------------------------------------- /app/views/application/_alert_box.html.haml: -------------------------------------------------------------------------------- 1 | .alert.alert-dismissible{class: "alert-#{type}"} 2 | %button.close{ data: { dismiss: 'alert'}}× 3 | - if title 4 | %h4 5 | %i.icon.fa.fa-info 6 | = title 7 | %p= message 8 | -------------------------------------------------------------------------------- /app/views/application/_callout_box.html.haml: -------------------------------------------------------------------------------- 1 | .callout{class: "callout-#{type}"} 2 | - if title 3 | %h4=title 4 | %p= message 5 | -------------------------------------------------------------------------------- /app/views/application/_celebrity_box.html.haml: -------------------------------------------------------------------------------- 1 | %section 2 | .callout-info.col-xs-12 3 | = render partial: 'callout_box', locals: { type: 'info', title: nil, message: t('user.celebrity_signup')} 4 | -------------------------------------------------------------------------------- /app/views/application/_flash_message.html.haml: -------------------------------------------------------------------------------- 1 | :javascript 2 | if(#{flash[:notice].present?}){ 3 | flashNotification("#{flash[:notice]}", 'success', 3000) 4 | } 5 | 6 | if(#{flash[:alert].present?}){ 7 | flashNotification("#{flash[:alert]}", 'error') 8 | } 9 | -------------------------------------------------------------------------------- /app/views/application/_footer.html.haml: -------------------------------------------------------------------------------- 1 | .pull-right 2 | %strong 3 | Powered by 4 | %a{:href => 'http://joshsoftware.com', target: '_blank'} JoshSoftware 5 | 6 | .pull-right 7 | = link_to "Terms of Service", "/Terms_of_service_CodeCuriosity.pdf", style: " float: right; position: relative; left: -30%; font-weight: bold;" 8 | %span.contact 9 | %a{:href => "mailto:info@codecuriosity.org?Subject=CodeCuriosity%20Feedback", :target => "_top", style: " float: right; position: relative; left: -30%; font-weight: bold;"} 10 | %i.fa.fa-envelope-square 11 | %span Contact Us 12 | -------------------------------------------------------------------------------- /app/views/application/_mail_signature.html.haml: -------------------------------------------------------------------------------- 1 | %div   2 | %div Keep those contributions coming! 3 | %div - Team CodeCuriosity  4 | %div   5 | %div 6 | %em "Open Source is now fun and rewarding!"   7 | %div 8 | %em #CodeCuriosity 9 | %div   -------------------------------------------------------------------------------- /app/views/application/_navbar.html.haml: -------------------------------------------------------------------------------- 1 | %header.main-header 2 | %a.logo{:href => '/'} 3 | %span.logo-mini 4 | %b.code> C 5 | %b.curiocity> C 6 | %span.logo-lg 7 | = image_tag 'logo_50pxh.png', height: 35 8 | %nav.navbar.navbar-static-top{:role => 'navigation'} 9 | - if current_user 10 | %a.sidebar-toggle{'data-toggle' => 'offcanvas', :href => '#', :role => 'button', style: "padding-left: 11px; padding-right: 12px;"} 11 | %span.sr-only Toggle navigation 12 | .navbar-custom-menu 13 | %ul.nav.navbar-nav 14 | %li 15 | = link_to ACCOUNT['twitter'], { :style=>'color:#1da1f2;', target: :_blank} do 16 | %i.fa.fa-twitter 17 | %li 18 | = link_to faq_path do 19 | %i.fa.fa-question 20 | FAQS 21 | - if current_user 22 | = render 'user_nav' 23 | - else 24 | %li 25 | = link_to omniauth_authorize_path(:user, :github) do 26 | %span.fa.fa-github 27 | Sign in with GitHub 28 | -------------------------------------------------------------------------------- /app/views/application/_sidebar.html.haml: -------------------------------------------------------------------------------- 1 | %aside.main-sidebar 2 | %section.sidebar 3 | %ul.sidebar-menu 4 | %li{class: is_active('index', 'dashboard')} 5 | = link_to root_path do 6 | %i.fa.fa-dashboard 7 | %span Dashboard 8 | = render 'admin_sidebar' if current_user.is_admin? 9 | %li{class: is_active(params[:action], 'commits')} 10 | = link_to commits_path do 11 | %i.fa.fa-gift 12 | %span Rewards 13 | -------------------------------------------------------------------------------- /app/views/application/_user_nav.html.haml: -------------------------------------------------------------------------------- 1 | %li.dropdown.user.user-menu 2 | %a.dropdown-toggle{'data-toggle' => 'dropdown', :href => '#'} 3 | %img.user-image#profile-pic{:alt => current_user.name, :src => avatar_url}/ 4 | %span.hidden-xs= current_user.name.titleize 5 | %ul.dropdown-menu 6 | %li.user-header 7 | %img.img-circle{:alt => current_user.name, :src => avatar_url}/ 8 | %p 9 | = current_user.name.titleize 10 | %small Github - #{current_user.github_handle} 11 | %li.user-footer 12 | .pull-left 13 | = link_to "Profile" , user_path(current_user), class: "btn btn-default btn-flat" 14 | .pull-right 15 | = link_to 'Sign out', destroy_user_session_path, class: 'btn btn-default btn-flat', method: :delete 16 | -------------------------------------------------------------------------------- /app/views/application/score.js.haml: -------------------------------------------------------------------------------- 1 | $("tr[data-#{@scorable.class.to_s.downcase}='#{@scorable.id.to_s}']").removeClass().addClass("#{score_color(@scorable)}") 2 | -------------------------------------------------------------------------------- /app/views/comments/_comment.html.haml: -------------------------------------------------------------------------------- 1 | .direct-chat-msg{class: comment.user_id == current_user.id ? 'left' : 'right'} 2 | .direct-chat-info.clearfix 3 | %span.direct-chat-name.pull-left= comment.user.github_handle 4 | %span.direct-chat-timestamp.pull-right= comment.created_at.strftime('%d %b %H:%m') 5 | %label.pull-right.comment-type{ class: comment.is_public ? 'bg-green' : 'bg-yellow' } 6 | = comment.is_public ? 'Public' : 'Private' 7 | = image_tag avatar_url(comment.user), class: 'direct-chat-img', alt: comment.user.github_handle 8 | .direct-chat-text 9 | = comment.content 10 | -------------------------------------------------------------------------------- /app/views/comments/_form.html.haml: -------------------------------------------------------------------------------- 1 | .direct-chat-messages 2 | = render partial: 'comments/comment', collection: @comments, as: :comment 3 | = simple_form_for (@comment || Comment.new), url: add_judge_comment_path(resource), remote: true do |f| 4 | .input-group 5 | %span.input-group-addon 6 | %label Public 7 | = f.input_field :is_public, as: :boolean, label: false 8 | = f.input_field :content, placeholder: 'Type a comment', class: 'form-control input-sm', autocomplete: false 9 | -------------------------------------------------------------------------------- /app/views/comments/create.js.haml: -------------------------------------------------------------------------------- 1 | $("#comments_#{@resource.id.to_s}").html("#{j(render partial: 'comments/form', locals: { resource: @resource } )}") 2 | $("#comments_count_#{@resource.id}").html("Comments (#{@resource.comments_count})") 3 | -------------------------------------------------------------------------------- /app/views/commits/_commits.html.haml: -------------------------------------------------------------------------------- 1 | - @commits.each do |commit| 2 | %tr 3 | %td= commit.commit_date.strftime("%d %B %y") 4 | %td= commit.repository&.name 5 | %td 6 | = commit.message 7 | %br 8 | = link_to commit.html_url, class: 'btn btn-xs' do 9 | %i.fa.fa-fw.fa-share 10 | View 11 | %td 12 | - if commit.score.nil? 13 | %a.scores.fa.fa-hourglass-2 14 | - else 15 | = commit.score 16 | %td 17 | - if commit.non_rewardable_commit? 18 | %span - 19 | - else 20 | - if commit.reward.nil? 21 | %a.rewards.fa.fa-hourglass-2 22 | - else 23 | - if commit.is_reveal || commit.reward.zero? 24 | = "$ #{commit.reward}" 25 | - else 26 | = link_to reveal_commit_path(commit), method: 'patch', 27 | class: 'btn btn-success btn-xs reveal', remote: true do 28 | %i.fa.fa-fw.fa-gift 29 | Reveal 30 | .reward 31 | = "$ #{commit.reward}" 32 | -------------------------------------------------------------------------------- /app/views/commits/_commits_table.html.haml: -------------------------------------------------------------------------------- 1 | - if @commits.any? 2 | %table.table.table-hover.table-bordered 3 | %thead 4 | %tr 5 | %th.col-xs-2 Commit Date 6 | %th.col-xs-2 Repository Name 7 | %th.col-xs-7 Description 8 | %th.col-xs-1 Score 9 | %th.col-xs-1 Reward($) 10 | %tbody 11 | = render partial: 'commits' 12 | 13 | .pagination-container 14 | = paginate @commits, remote: true 15 | 16 | - else 17 | = render partial: 'callout_box', locals: {type: 'success', title: 'Keep Contributing', message: 'There are no commits in this period.'} 18 | -------------------------------------------------------------------------------- /app/views/commits/index.html.haml: -------------------------------------------------------------------------------- 1 | %section.content-header 2 | %h1 3 | Rewards :- 4 | 5 | - if @commits.any? && @commits.with_reward.where(is_reveal: false).any? 6 | = link_to reveal_commits_path, method: 'patch', 7 | class: 'btn btn-success reveal_all', remote: true do 8 | %i.fa.fa-fw.fa-gift 9 | Reveal All 10 | 11 | %section.content 12 | .row 13 | .col-xs-12 14 | .box.box-primary 15 | .box-header 16 | %h3.box-title 17 | %span Contributions :- 18 | .box-tools 19 | = form_tag(commits_path, method: :get, remote: true, id: 'filters') do 20 | %table 21 | %tr 22 | %td= date_field_tag :from, Date.today.beginning_of_month 23 | %td= date_field_tag :to, Date.today 24 | %td= text_field_tag :query, nil, placeholder: 'Repository name/Description' 25 | %td= submit_tag 'Go' 26 | 27 | .box-body.table-responsive#commits 28 | = render partial: 'commits_table' 29 | %p 30 | %b Note: 31 | Contributions commited from 1st July, 2018 will be rewarded! 32 | 33 | -------------------------------------------------------------------------------- /app/views/commits/index.js.haml: -------------------------------------------------------------------------------- 1 | :plain 2 | $("#commits").html("#{j render(partial: 'commits_table')}"); 3 | -------------------------------------------------------------------------------- /app/views/dashboard/index.html.haml: -------------------------------------------------------------------------------- 1 | %section.content-header 2 | %h1 3 | Dashboard 4 | = react_component 'CelebrityBox', { type: 'info', title: '', message: t('user.celebrity_signup') } if current_user && current_user.celebrity 5 | %section.content 6 | .row 7 | .col-lg-3.col-xs-6 8 | = react_component 'PointsTile', { color: 'bg-aqua', title: 'Points', points: format_points(current_user.points), 9 | logo: 'ion-pie-graph', path: user_path(current_user) } 10 | .col-lg-3.col-xs-6 11 | = react_component 'PointsTile', { color: 'bg-green', title: 'Commits', points: current_user.commits_count, 12 | logo: 'ion-stats-bars', path: commits_path} 13 | .row 14 | .col-xs-12 15 | - if current_user.commits_count.equal?(0) 16 | = render partial: 'callout_box', locals: {type: 'info', title: 'Keep Contributing', message: 'There are no commits.'} 17 | - else 18 | = react_component 'UserPointsChart', { xAxis: @xAxis, commits: @commits, points: @points, username: @username } 19 | -------------------------------------------------------------------------------- /app/views/devise/confirmations/new.html.erb: -------------------------------------------------------------------------------- 1 |

Resend confirmation instructions

2 | 3 | <%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> 4 | <%= devise_error_messages! %> 5 | 6 |
7 | <%= f.label :email %>
8 | <%= f.email_field :email, autofocus: true %> 9 |
10 | 11 |
12 | <%= f.submit "Resend confirmation instructions" %> 13 |
14 | <% end %> 15 | 16 | <%= render "devise/shared/links" %> 17 | -------------------------------------------------------------------------------- /app/views/devise/mailer/confirmation_instructions.html.erb: -------------------------------------------------------------------------------- 1 |

Welcome <%= @email %>!

2 | 3 |

You can confirm your account email through the link below:

4 | 5 |

<%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %>

6 | -------------------------------------------------------------------------------- /app/views/devise/mailer/reset_password_instructions.html.erb: -------------------------------------------------------------------------------- 1 |

Hello <%= @resource.email %>!

2 | 3 |

Someone has requested a link to change your password. You can do this through the link below.

4 | 5 |

<%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %>

6 | 7 |

If you didn't request this, please ignore this email.

8 |

Your password won't change until you access the link above and create a new one.

9 | -------------------------------------------------------------------------------- /app/views/devise/mailer/unlock_instructions.html.erb: -------------------------------------------------------------------------------- 1 |

Hello <%= @resource.email %>!

2 | 3 |

Your account has been locked due to an excessive number of unsuccessful sign in attempts.

4 | 5 |

Click the link below to unlock your account:

6 | 7 |

<%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %>

8 | -------------------------------------------------------------------------------- /app/views/devise/passwords/edit.html.erb: -------------------------------------------------------------------------------- 1 |

Change your password

2 | 3 | <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %> 4 | <%= devise_error_messages! %> 5 | <%= f.hidden_field :reset_password_token %> 6 | 7 |
8 | <%= f.label :password, "New password" %>
9 | <%= f.password_field :password, autofocus: true, autocomplete: "off" %> 10 |
11 | 12 |
13 | <%= f.label :password_confirmation, "Confirm new password" %>
14 | <%= f.password_field :password_confirmation, autocomplete: "off" %> 15 |
16 | 17 |
18 | <%= f.submit "Change my password" %> 19 |
20 | <% end %> 21 | 22 | <%= render "devise/shared/links" %> 23 | -------------------------------------------------------------------------------- /app/views/devise/passwords/new.html.erb: -------------------------------------------------------------------------------- 1 |

Forgot your password?

2 | 3 | <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> 4 | <%= devise_error_messages! %> 5 | 6 |
7 | <%= f.label :email %>
8 | <%= f.email_field :email, autofocus: true %> 9 |
10 | 11 |
12 | <%= f.submit "Send me reset password instructions" %> 13 |
14 | <% end %> 15 | 16 | <%= render "devise/shared/links" %> 17 | -------------------------------------------------------------------------------- /app/views/devise/registrations/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Sign up

4 | 5 | <%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> 6 | <%= f.input :name %> 7 | <%= f.input :email %> 8 | <%= f.input :github_handle %> 9 | <%= f.input :password %> 10 | <%= f.input :password_confirmation %> 11 | 12 | <%= f.submit "Sign up", class: "btn btn-success" %> 13 | <% end %> 14 | 15 | <%= render "devise/shared/links" %> 16 |
17 |
18 | -------------------------------------------------------------------------------- /app/views/devise/sessions/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Log in

4 | 5 | <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> 6 |
7 | <%= f.email_field :email, autofocus: true, placeholder: "Email", class: "form-control" %> 8 |
9 | 10 |
11 | <%= f.password_field :password, autocomplete: "off", placeholder: "Password", class: "form-control" %> 12 |
13 | 14 | <% if devise_mapping.rememberable? -%> 15 |
16 | <%= f.check_box :remember_me %> 17 | <%= f.label :remember_me %> 18 |
19 | <% end -%> 20 | 21 |
22 | <%= f.submit "Log in", class: "btn btn-primary btn-lg btn-block" %> 23 |
24 | <% end %> 25 | 26 | 27 | <%= render "devise/shared/links" %> 28 |
29 |
30 | -------------------------------------------------------------------------------- /app/views/devise/unlocks/new.html.erb: -------------------------------------------------------------------------------- 1 |

Resend unlock instructions

2 | 3 | <%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %> 4 | <%= devise_error_messages! %> 5 | 6 |
7 | <%= f.label :email %>
8 | <%= f.email_field :email, autofocus: true %> 9 |
10 | 11 |
12 | <%= f.submit "Resend unlock instructions" %> 13 |
14 | <% end %> 15 | 16 | <%= render "devise/shared/links" %> 17 | -------------------------------------------------------------------------------- /app/views/github/repos/_repo_row.html.haml: -------------------------------------------------------------------------------- 1 | %tr{id: "repo-#{repo.id}"} 2 | %td= link_to repo.name, repo.html_url, target: '_blank' 3 | %td= repo.description 4 | %td{ align: 'center'} 5 | - if current_user.repositories.where(gh_id: repo.id).none? 6 | = simple_form_for Repository.new, remote: true do |f| 7 | = f.hidden_field :owner, value: repo.owner.login 8 | = f.hidden_field :name, value: repo.name 9 | = f.hidden_field :gh_id, value: repo.id 10 | = f.submit 'Add', data: { :'disable-with' => 'Adding...'}, class: 'btn btn-block btn-success btn-xs' 11 | - else 12 | Contributing 13 | -------------------------------------------------------------------------------- /app/views/github/repos/_repos.html.haml: -------------------------------------------------------------------------------- 1 | %table.table.table-bordered 2 | %thead 3 | %tr 4 | %th.col-xs-2 Name 5 | %th.col-xs-5 Description 6 | %th.col-xs-1 Actions 7 | %tbody 8 | = render partial: 'repo_row', collection: @repos, as: :repo 9 | -------------------------------------------------------------------------------- /app/views/github/repos/index.js.erb: -------------------------------------------------------------------------------- 1 | $('#my-repos-tab').html("<%=j render 'repos' %>"); 2 | -------------------------------------------------------------------------------- /app/views/github/repos/orgs.js.erb: -------------------------------------------------------------------------------- 1 | $('#gh-orgs-title h3').text("<%= j params[:org_name].titleize %>'s Repositories"); 2 | $('#gh-orgs-repos').html("<%=j render 'repos' %>"); 3 | -------------------------------------------------------------------------------- /app/views/github/repos/sync.js.erb: -------------------------------------------------------------------------------- 1 | flashNotification("<%= t('repositories.github_sync') %>", "success"); 2 | -------------------------------------------------------------------------------- /app/views/home/_info.html.haml: -------------------------------------------------------------------------------- 1 | %h4= info['question'] 2 | %p= info['answer'] 3 | -------------------------------------------------------------------------------- /app/views/home/_subscribers_list.html.haml: -------------------------------------------------------------------------------- 1 | .container.center-aligned 2 | .box-header 3 | %h2 Organization Sponsors 4 | .box-body 5 | - ORGANIZATIONAL_SPONSORERS.each do |org| 6 | .img-center 7 | = link_to image_tag(org[1]["logo"], class: "img-responsive", width: 180, height: 180, alt: "Responsive image"), org[1]["link"], target: '_blank' 8 | -------------------------------------------------------------------------------- /app/views/home/_trend.html.haml: -------------------------------------------------------------------------------- 1 | %section.content-header 2 | %h4 CodeCuriosity Trend 3 | %section.content 4 | .row 5 | .box-body.no-padding 6 | #chart-container 7 | 8 | :javascript 9 | multiLineChart(#{@xAxis},#{@user_trend},#{@contribution_trend}) 10 | -------------------------------------------------------------------------------- /app/views/home/_user.html.haml: -------------------------------------------------------------------------------- 1 | %tr 2 | %td 3 | %span.rank= subscription_counter + 1 4 | = image_tag avatar_url(subscription.user), widht: 40, height: 40, class: 'img-circle' 5 | %td 6 | = link_to subscription.user.github_handle, user_path(subscription.user), class: 'users-list-name' 7 | %td= subscription.commits_count 8 | %td= subscription.activities_count 9 | %td= format_points(subscription.points) 10 | -------------------------------------------------------------------------------- /app/views/home/index.html.haml: -------------------------------------------------------------------------------- 1 | .jumbotron 2 | .container 3 | .row 4 | = image_tag 'logo-home.png' 5 | .row 6 | .box-header 7 | .col-xs-12 8 | %h4 9 | %span.text 10 | = number_with_delimiter(User.contestants.count) 11 | users 12 | have contributed 13 | %span.text 14 | = number_with_delimiter(User.contestants.sum(:points)) 15 | points 16 | and 17 | %span.text 18 | = "$#{number_with_delimiter(RedeemRequest.total_points_redeemed/REDEEM['one_dollar_to_points'])}" 19 | has been rewarded back to 20 | %span.text 21 | = number_with_delimiter(RedeemRequest.where(status: true).count) 22 | contributors! 23 | .row 24 | %a.btn.btn-primary.btn-lg{ href: omniauth_authorize_path(:user, :github) } 25 | %span.fa.fa-github 26 | Sign in with Github 27 | .row.marketing 28 | .col-md-12.col-lg-offset-1.col-md-offset-1 29 | - INFO['home'].each_slice(2) do |data| 30 | .col-lg-5.col-md-5 31 | = render partial: 'info', collection: data, as: 'info' 32 | .row.marketing 33 | = render partial: 'subscribers_list' 34 | .row 35 | = render partial: 'trend' 36 | -------------------------------------------------------------------------------- /app/views/home/leaderboard.html.haml: -------------------------------------------------------------------------------- 1 | %section.content-header 2 | %h1 3 | Leaderboard 4 | %section.content 5 | .row 6 | .col-xs-12 7 | - if @subscriptions.none? 8 | .callout-info 9 | = render partial: 'callout_box', locals: { type: 'success', title: t('user.no_leaders'), message: ''} 10 | - else 11 | .box 12 | .box-body.table-responsive.no-padding 13 | %table.table.leaderboard 14 | %tbody 15 | %tr 16 | %th.col-xs-2 # 17 | %th User 18 | %th Commits 19 | %th Activities 20 | %th Points 21 | = render partial: 'user', collection: @subscriptions, as: :subscription 22 | -------------------------------------------------------------------------------- /app/views/info/_faq.html.haml: -------------------------------------------------------------------------------- 1 | .faq{id: faq['html_anchor']} 2 | %b.question= raw(faq['question']) 3 | %p.answer= raw(faq['answer']) 4 | -------------------------------------------------------------------------------- /app/views/info/faq.html.haml: -------------------------------------------------------------------------------- 1 | %h1.faq-title Frequent Questions 2 | %h4.faq-subtitle 3 | Simple answers to your most common questions 4 | .callout-info.col-md-offset-2.col-md-8.col-sm-12.col-sm-offset-0 5 | .alert.alert-error 6 | Please review the 7 | = link_to "Terms of Service", "/New_Redemption_Strategy.pdf" 8 | = ". Subscribe to CodeCuriosity and reward the open-source community" 9 | 10 | .faqs.col-md-offset-2.col-md-8.col-sm-12.col-sm-offset-0 11 | = render partial: 'faq', collection: INFO['faq'] 12 | -------------------------------------------------------------------------------- /app/views/kaminari/_first_page.html.haml: -------------------------------------------------------------------------------- 1 | %li 2 | = link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote 3 | -------------------------------------------------------------------------------- /app/views/kaminari/_gap.html.haml: -------------------------------------------------------------------------------- 1 | %li.disabled 2 | = content_tag :a, raw(t 'views.pagination.truncate') 3 | -------------------------------------------------------------------------------- /app/views/kaminari/_last_page.html.haml: -------------------------------------------------------------------------------- 1 | %li 2 | = link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote} 3 | -------------------------------------------------------------------------------- /app/views/kaminari/_next_page.html.haml: -------------------------------------------------------------------------------- 1 | %li 2 | = link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote 3 | -------------------------------------------------------------------------------- /app/views/kaminari/_page.html.haml: -------------------------------------------------------------------------------- 1 | - if page.current? 2 | %li.active 3 | = content_tag :a, page, remote: remote, rel: (page.next? ? 'next' : (page.prev? ? 'prev' : nil)) 4 | - else 5 | %li 6 | = link_to page, url, remote: remote, rel: (page.next? ? 'next' : (page.prev? ? 'prev' : nil)) 7 | -------------------------------------------------------------------------------- /app/views/kaminari/_paginator.html.haml: -------------------------------------------------------------------------------- 1 | = paginator.render do 2 | %ul.pagination.pagination-sm 3 | = first_page_tag unless current_page.first? 4 | = prev_page_tag unless current_page.first? 5 | - each_page do |page| 6 | - if page.left_outer? || page.right_outer? || page.inside_window? 7 | = page_tag page 8 | - elsif !page.was_truncated? 9 | = gap_tag 10 | = next_page_tag unless current_page.last? 11 | = last_page_tag unless current_page.last? 12 | -------------------------------------------------------------------------------- /app/views/kaminari/_prev_page.html.haml: -------------------------------------------------------------------------------- 1 | %li 2 | = link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote 3 | -------------------------------------------------------------------------------- /app/views/layouts/devise.html.haml: -------------------------------------------------------------------------------- 1 | !!! 2 | %html{:lang => "en"} 3 | %head 4 | %title CodeCuriosity 5 | = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true 6 | = javascript_include_tag 'application', 'data-turbolinks-track' => true 7 | = csrf_meta_tags 8 | 9 | %body 10 | .container-fluid 11 | .row 12 | = yield 13 | -------------------------------------------------------------------------------- /app/views/layouts/home.html.haml: -------------------------------------------------------------------------------- 1 | !!! 2 | %html{:lang => 'en'} 3 | %head 4 | %meta{:content => 'text/html; charset=UTF-8', 'http-equiv' => 'Content-Type'}/ 5 | %meta{:charset => 'UTF-8'}/ 6 | %meta{:content => 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no', :name => 'viewport'}/ 7 | %title CodeCuriosity 8 | = favicon_link_tag asset_path('icon.png'), :rel => 'icon', :type => 'image/png' 9 | = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true 10 | = javascript_include_tag 'application', 'data-turbolinks-track' => true 11 | = csrf_meta_tags 12 | /[if lt IE 9] 13 | 14 | 15 | %body.skin-black-light.sidebar-mini.home-wrapper 16 | .wrapper.info 17 | = render 'navbar' 18 | = yield 19 | .info.col-sm-offset-1.col-sm-10.col-sm-offset-1.footer 20 | = render 'footer' 21 | = render 'flash_message' 22 | -------------------------------------------------------------------------------- /app/views/layouts/info.html.haml: -------------------------------------------------------------------------------- 1 | !!! 2 | %html{:lang => 'en'} 3 | %head 4 | %meta{:content => 'text/html; charset=UTF-8', 'http-equiv' => 'Content-Type'}/ 5 | %meta{:charset => 'UTF-8'}/ 6 | %meta{:content => 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no', :name => 'viewport'}/ 7 | %title CodeCuriosity 8 | = favicon_link_tag asset_path('icon.png'), :rel => 'icon', :type => 'image/png' 9 | = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true 10 | = javascript_include_tag 'application', 'data-turbolinks-track' => true 11 | = csrf_meta_tags 12 | %link{ rel: 'stylesheet', href: 'https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css'} 13 | /[if lt IE 9] 14 | 15 | 16 | %body.skin-black-light.sidebar-mini 17 | .wrapper.info 18 | = render 'navbar' 19 | - if current_user 20 | = render 'sidebar' 21 | = yield 22 | .info.col-sm-offset-1.col-sm-10.col-sm-offset-1.footer 23 | = render 'footer' 24 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.text.haml: -------------------------------------------------------------------------------- 1 | = yield -------------------------------------------------------------------------------- /app/views/layouts/public.html.haml: -------------------------------------------------------------------------------- 1 | !!! 2 | %html{:lang => 'en'} 3 | %head 4 | %meta{:content => 'text/html; charset=UTF-8', 'http-equiv' => 'Content-Type'}/ 5 | %meta{:charset => 'UTF-8'}/ 6 | %meta{:content => 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no', :name => 'viewport'}/ 7 | %title CodeCuriosity 8 | = favicon_link_tag asset_path('icon.png'), :rel => 'icon', :type => 'image/png' 9 | = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true 10 | = javascript_include_tag 'application', 'data-turbolinks-track' => true 11 | = csrf_meta_tags 12 | %link{ rel: 'stylesheet', href: 'https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css'} 13 | /[if lt IE 9] 14 | 15 | 16 | %body.sidebar-mini.skin-black-light 17 | .wrapper 18 | = render 'navbar' 19 | .content 20 | = yield 21 | .content 22 | = render 'footer' 23 | - if flash.any? 24 | :javascript 25 | #{show_flash_notifications} 26 | -------------------------------------------------------------------------------- /app/views/redeem/_amazon.html.haml: -------------------------------------------------------------------------------- 1 | = simple_form_for(@redeem || RedeemRequest.new(user: current_user), url: redeem_path, remote: true) do |f| 2 | .row 3 | .col-md-6 4 | = f.input :points, label: 'Redeemable', hint: "Info: Redemption in multiple of $ #{REDEEM['min_amount']}." 5 | .col-md-6 6 | = f.input :store, collection: REDEEM['amazon_stores'], include_blank: false, label: 'Store' 7 | = f.input :retailer, as: :hidden, input_html: { value: 'amazon'} 8 | = render 'redeem/submit_buttons', f: f 9 | -------------------------------------------------------------------------------- /app/views/redeem/_form.html.haml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/app/views/redeem/_form.html.haml -------------------------------------------------------------------------------- /app/views/redeem/_github.html.haml: -------------------------------------------------------------------------------- 1 | = simple_form_for(@redeem || RedeemRequest.new(user: current_user), url: redeem_path, remote: true) do |f| 2 | = f.input :points, collection: github_points_options, include_blank: false, label: 'Gift Card Amount' 3 | = f.input :retailer, as: :hidden, input_html: { value: 'github'} 4 | = render 'redeem/submit_buttons', f: f -------------------------------------------------------------------------------- /app/views/redeem/_new_modal.html.haml: -------------------------------------------------------------------------------- 1 | .modal-dialog 2 | .modal-content 3 | .modal-header 4 | %button.close{'aria-label' => 'Close', 'data-dismiss' => 'modal', :type => 'button'} 5 | %span{'aria-hidden' => 'true'} × 6 | %h4.modal-title 7 | Redeem Points 8 | .modal-body 9 | .nav-tabs-custom 10 | %ul.nav.nav-tabs 11 | %li.active 12 | %a{href: '#github_redeem', data: { toggle: 'tab'} } 13 | %i.fa.fa-github-alt 14 | Github 15 | %li 16 | %a{href: '#amazon_redeem', data: { toggle: 'tab'} } 17 | %i.fa.fa-amazon 18 | Amazon 19 | %li 20 | %a{href: '#other_redeem', data: { toggle: 'tab'} } Other 21 | .tab-content 22 | .tab-pane.active#github_redeem 23 | = render 'redeem/github' 24 | .tab-pane#amazon_redeem 25 | = render 'redeem/amazon' 26 | .tab-pane#other_redeem 27 | = render 'redeem/other' 28 | -------------------------------------------------------------------------------- /app/views/redeem/_other.html.haml: -------------------------------------------------------------------------------- 1 | = simple_form_for(@redeem || RedeemRequest.new(user: current_user), url: redeem_path, remote: true) do |f| 2 | = f.input :gift_product_url, label: 'If you want us to buy some merchandise instead of a gift-card, enter the product link.', placeholder: 'http://github.myshopify.com/products/octodex-sticker-packs', 3 | hint: 'Info: Ensure you have enough points in your account to include shipping charges too.' 4 | = f.input :address, as: :text, label: 'Shipping Address', input_html: { row: 4 } 5 | = f.input :retailer, as: :hidden, input_html: { value: 'other'} 6 | = render 'redeem/submit_buttons', f: f -------------------------------------------------------------------------------- /app/views/redeem/_submit_buttons.html.haml: -------------------------------------------------------------------------------- 1 | %button.btn.btn-default{'data-dismiss' => 'modal', :type => 'button'} Cancel 2 | %button.btn.btn-primary.submit-redeem{ type: "button", data: { points: current_user.redeemable_points } } 3 | Redeem 4 | -------------------------------------------------------------------------------- /app/views/redeem/create.js.haml: -------------------------------------------------------------------------------- 1 | - if @redeem.valid? 2 | Turbolinks.visit("#{user_path(current_user, anchor: 'wallet')}"); 3 | - else 4 | - if @redeem.retailer == 'github' 5 | $("#redeem-modal #github_redeem").html("#{j render('redeem/github')}"); 6 | - if @redeem.retailer == 'amazon' 7 | $("#redeem-modal #amazon_redeem").html("#{j render('redeem/amazon')}"); 8 | - if @redeem.retailer == 'other' 9 | $("#redeem-modal #other_redeem").html("#{j render('redeem/other')}"); 10 | alert_user(); 11 | -------------------------------------------------------------------------------- /app/views/redeem/new.html.haml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/app/views/redeem/new.html.haml -------------------------------------------------------------------------------- /app/views/redeem_mailer/coupon_code.html.haml: -------------------------------------------------------------------------------- 1 | - content_for :signature do 2 | = render 'application/mail_signature' 3 | 4 | %h4= "Hello #{@user.name}," 5 | - if @redeem_request.coupon_code.present? 6 | %p= "Your coupon code is #{@redeem_request.coupon_code} for #{@redeem_request.retailer}" 7 | - if @redeem_request.comment.present? 8 | %p= @redeem_request.comment 9 | 10 | -------------------------------------------------------------------------------- /app/views/redeem_mailer/notify_admin.html.haml: -------------------------------------------------------------------------------- 1 | - content_for :signature do 2 | = render 'application/mail_signature' 3 | 4 | %h4 Hello Admin, 5 | %p 6 | = @redeem_request.points 7 | points redemption request from 8 | = link_to @user.github_handle, user_url(@user) 9 | %p 10 | = link_to 'View Reddem Request', admin_users_url(@user) 11 | %p 12 | %dl.dl-horizontal 13 | %dt Name 14 | %dd= @user.name 15 | %dt Points 16 | %dd= @redeem_request.points 17 | %dt Gift Card Type 18 | %dd= @redeem_request.retailer 19 | %dt Gift Product Url 20 | %dd= @redeem_request.gift_product_url.present? ? link_to('Product Url', @redeem_request.gift_product_url, target: '_blank') : '-' 21 | %dt Address 22 | %dd= @redeem_request.address || '-' 23 | -------------------------------------------------------------------------------- /app/views/redeem_mailer/redeem_request.html.haml: -------------------------------------------------------------------------------- 1 | - content_for :signature do 2 | = render 'application/mail_signature' 3 | %h4= "Hello #{@user.name}," 4 | %p 5 | Your redemption request has been received. We will process your request and send you a coupon code as soon as possible. 6 | -------------------------------------------------------------------------------- /app/views/repositories/create.js.haml: -------------------------------------------------------------------------------- 1 | - if @repo.nil? 2 | flashNotification("#{t('repositories.not_found')}", 'error'); 3 | - elsif @repo.valid? 4 | $("#repo-#{@repo.gh_id} td:last").html('Contributing') 5 | - else 6 | - @repo.errors.full_messages.each do |m| 7 | flashNotification("#{m}", 'error', false); 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/views/repositories/edit.js.haml: -------------------------------------------------------------------------------- 1 | $("#new_repo").html("#{escape_javascript(render 'form.html.haml')}") 2 | $('#new_repo').modal('show') 3 | -------------------------------------------------------------------------------- /app/views/repositories/new.html.haml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/app/views/repositories/new.html.haml -------------------------------------------------------------------------------- /app/views/users/_form.html.haml: -------------------------------------------------------------------------------- 1 | #userform.modal.fade{"aria-labelledby" => "EditUser", :role => "dialog", :tabindex => "-1"} 2 | .modal-dialog{:role => "document"} 3 | .modal-content 4 | = simple_form_for(current_user, url: user_path(current_user.id), validate: true, method: :patch, remote: true) do |f| 5 | .modal-header 6 | %button.close{"aria-label" => "Close", "data-dismiss" => "modal", :type => "button"} 7 | %h4#EditUser.modal-title Edit User 8 | .modal-body 9 | = f.input :twitter_handle, validate: { presence: true } 10 | .modal-footer 11 | = f.submit 'save', class: 'btn btn-primary' 12 | %button.btn.btn-default{"data-dismiss" => "modal", :type => "button"} Close 13 | 14 | -------------------------------------------------------------------------------- /app/views/users/_organizations.html.haml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/app/views/users/_organizations.html.haml -------------------------------------------------------------------------------- /app/views/users/_settings.html.haml: -------------------------------------------------------------------------------- 1 | .row 2 | .col-md-6 3 | .well 4 | = simple_form_for(current_user, url: update_notification_user_path(current_user), method: 'put', remote: true) do |f| 5 | %label.checkbox 6 | = f.check_box :notify_monthly_progress 7 | Notify monthly progress 8 | %label.checkbox 9 | = f.check_box :notify_monthly_points 10 | Notify monthly points 11 | %button.btn.btn-primary{:type => 'submit'} Save 12 | .col-md-6 13 | .well 14 | = link_to "Delete my account", user_path(current_user), class: 'btn btn-large btn-block btn-danger', data: { method: 'delete', confirm: 'This action is irreversible. Are you sure you want to delete your account?' } 15 | -------------------------------------------------------------------------------- /app/views/users/_share_button.html.haml: -------------------------------------------------------------------------------- 1 | .row 2 | .col-sm-12 3 | .tweet-box.col-sm-12 4 | .tweet-content-img.pull-right 5 | %a.twitter-share-button{"data-text" => "Here is my #opensource contribution", "data-size" => 'large', "data-url" => request.original_url, :href => "https://twitter.com/share"} Tweet 6 | :javascript 7 | !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs'); 8 | -------------------------------------------------------------------------------- /app/views/users/_sponsor_profile.html.haml: -------------------------------------------------------------------------------- 1 | .row 2 | .col-md-4 3 | .table 4 | .well 5 | %tr 6 | %td Payment Plan: 7 | %td @plan[:name] 8 | %tr 9 | %td Subscribed at: 10 | %td @plan[:subscribed_at] 11 | %tr 12 | %td Subscription Amount: 13 | %td @plan[:amount] -------------------------------------------------------------------------------- /app/views/users/_subscription.html.haml: -------------------------------------------------------------------------------- 1 | %tr 2 | %td= subscription_counter + 1 3 | %td= subscription.round.from_date.strftime("%b %Y") 4 | %td= subscription.commits_count 5 | %td= subscription.activities_count 6 | %td= format_points(subscription.points) 7 | / 8 | %td= subscription.goal ? link_to(subscription.goal.name, goals_path) : '-' 9 | -------------------------------------------------------------------------------- /app/views/users/_transaction.html.haml: -------------------------------------------------------------------------------- 1 | %tr 2 | %td= transaction_counter + 1 3 | %td= transaction.points 4 | %td.transaction-detail 5 | %b 6 | = (transaction.transaction_type || transaction.description).to_s.humanize 7 | %small.label{class: transaction.credit? ? 'bg-green' : 'bg-red'} 8 | = transaction.type.upcase 9 | - if logged_in_user? 10 | - if transaction.coupon_code.present? 11 | %h5 12 | Coupon code: 13 | %i= transaction.coupon_code 14 | - if transaction.redeem_transaction? 15 | %small.label{class: 'bg-primary' }= transaction.redeem_request.retailer.upcase if transaction.redeem_request 16 | %td= transaction.created_at.strftime('%d/%b/%Y %T') 17 | -------------------------------------------------------------------------------- /app/views/users/_transactions.html.haml: -------------------------------------------------------------------------------- 1 | = react_component 'PointsHistory', total_points: @user.points, user_id: @user.id.to_s, show_coupon_code: logged_in_user? 2 | -------------------------------------------------------------------------------- /app/views/users/_twitter_data.html.haml: -------------------------------------------------------------------------------- 1 | #twitter-data.pull-right 2 | = link_to "#{ user.twitter_handle.present? ? remove_prefix(user.twitter_handle) : "Add your twitter handle" }", edit_user_path, remote: true, data: { toggle: "modal", target: "#newform"}, class: "fa fa-twitter", id: 'twitter-handle' 3 | - if user.twitter_handle.present? 4 | %span.tool-tip{"data-placement" => "top", "data-toggle" => "tooltip", :title => "Remove"} 5 | = link_to "", remove_handle_user_path, remote: true, class: "fa fa-remove", method: :patch 6 | -------------------------------------------------------------------------------- /app/views/users/edit.js.haml: -------------------------------------------------------------------------------- 1 | $("#userform").replaceWith("#{escape_javascript(render 'form')}") 2 | $('.modal-backdrop').remove(); 3 | $('#userform').modal('show') 4 | -------------------------------------------------------------------------------- /app/views/users/remove_handle.js.haml: -------------------------------------------------------------------------------- 1 | $("#twitter-data").html("#{escape_javascript(render 'twitter_data', user: current_user)}"); 2 | -------------------------------------------------------------------------------- /app/views/users/sync.js.erb: -------------------------------------------------------------------------------- 1 | flashNotification("<%= t('messages.contribution_sync') %>", "notice"); -------------------------------------------------------------------------------- /app/views/users/update.js.haml: -------------------------------------------------------------------------------- 1 | $('#userform').modal('hide') 2 | $('.modal-backdrop').remove(); 3 | $('#twitter-data').replaceWith("#{escape_javascript(render "twitter_data", user: current_user)}"); 4 | -------------------------------------------------------------------------------- /app/views/users/update_notification.js.haml: -------------------------------------------------------------------------------- 1 | flashNotification("Updated successfully.", 'info'); 2 | -------------------------------------------------------------------------------- /bin/aws.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'aws.rb' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("aws-sdk-core", "aws.rb") 30 | -------------------------------------------------------------------------------- /bin/backup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'backup' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("backup", "backup") 30 | -------------------------------------------------------------------------------- /bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'console' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("fog-dnsimple", "console") 30 | -------------------------------------------------------------------------------- /bin/dotenv: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'dotenv' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("dotenv", "dotenv") 30 | -------------------------------------------------------------------------------- /bin/fission: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'fission' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("fission", "fission") 30 | -------------------------------------------------------------------------------- /bin/fog: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'fog' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("fog", "fog") 30 | -------------------------------------------------------------------------------- /bin/haml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'haml' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("haml", "haml") 30 | -------------------------------------------------------------------------------- /bin/httparty: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'httparty' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("httparty", "httparty") 30 | -------------------------------------------------------------------------------- /bin/mongo_console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'mongo_console' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("mongo", "mongo_console") 30 | -------------------------------------------------------------------------------- /bin/nokogiri: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'nokogiri' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("nokogiri", "nokogiri") 30 | -------------------------------------------------------------------------------- /bin/rackup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'rackup' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("rack", "rackup") 30 | -------------------------------------------------------------------------------- /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/rbvmomish: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'rbvmomish' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("rbvmomi", "rbvmomish") 30 | -------------------------------------------------------------------------------- /bin/rdoc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'rdoc' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("rdoc", "rdoc") 30 | -------------------------------------------------------------------------------- /bin/redcarpet: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'redcarpet' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("redcarpet", "redcarpet") 30 | -------------------------------------------------------------------------------- /bin/restclient: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'restclient' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("rest-client", "restclient") 30 | -------------------------------------------------------------------------------- /bin/ri: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'ri' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("rdoc", "ri") 30 | -------------------------------------------------------------------------------- /bin/rollbar-rails-runner: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'rollbar-rails-runner' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("rollbar", "rollbar-rails-runner") 30 | -------------------------------------------------------------------------------- /bin/sdoc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'sdoc' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("sdoc", "sdoc") 30 | -------------------------------------------------------------------------------- /bin/sdoc-merge: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'sdoc-merge' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("sdoc", "sdoc-merge") 30 | -------------------------------------------------------------------------------- /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 setup or update your development environment automatically. 13 | # This script is idempotent, so that you can run it at anytime 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== Removing old logs and tempfiles ==" 21 | system! 'bin/rails log:clear tmp:clear' 22 | 23 | puts "\n== Restarting application server ==" 24 | system! 'bin/rails restart' 25 | end 26 | -------------------------------------------------------------------------------- /bin/sidekiq: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'sidekiq' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("sidekiq", "sidekiq") 30 | -------------------------------------------------------------------------------- /bin/sidekiqmon: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'sidekiqmon' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("sidekiq", "sidekiqmon") 30 | -------------------------------------------------------------------------------- /bin/sprockets: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'sprockets' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("sprockets", "sprockets") 30 | -------------------------------------------------------------------------------- /bin/stripe-console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'stripe-console' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("stripe", "stripe-console") 30 | -------------------------------------------------------------------------------- /bin/thor: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'thor' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("thor", "thor") 30 | -------------------------------------------------------------------------------- /bin/tilt: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'tilt' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("tilt", "tilt") 30 | -------------------------------------------------------------------------------- /bin/webpack: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development" 4 | ENV["NODE_ENV"] ||= "development" 5 | 6 | require "pathname" 7 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 8 | Pathname.new(__FILE__).realpath) 9 | 10 | require "bundler/setup" 11 | 12 | require "webpacker" 13 | require "webpacker/webpack_runner" 14 | 15 | APP_ROOT = File.expand_path("..", __dir__) 16 | Dir.chdir(APP_ROOT) do 17 | Webpacker::WebpackRunner.run(ARGV) 18 | end 19 | -------------------------------------------------------------------------------- /bin/webpack-dev-server: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development" 4 | ENV["NODE_ENV"] ||= "development" 5 | 6 | require "pathname" 7 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 8 | Pathname.new(__FILE__).realpath) 9 | 10 | require "bundler/setup" 11 | 12 | require "webpacker" 13 | require "webpacker/dev_server_runner" 14 | 15 | APP_ROOT = File.expand_path("..", __dir__) 16 | Dir.chdir(APP_ROOT) do 17 | Webpacker::DevServerRunner.run(ARGV) 18 | end 19 | -------------------------------------------------------------------------------- /bin/whenever: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'whenever' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("whenever", "whenever") 30 | -------------------------------------------------------------------------------- /bin/wheneverize: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'wheneverize' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("whenever", "wheneverize") 30 | -------------------------------------------------------------------------------- /bin/yard: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'yard' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("yard", "yard") 30 | -------------------------------------------------------------------------------- /bin/yardoc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'yardoc' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("yard", "yardoc") 30 | -------------------------------------------------------------------------------- /bin/yri: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'yri' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("yard", "yri") 30 | -------------------------------------------------------------------------------- /cache/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/cache/.keep -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run Rails.application 5 | -------------------------------------------------------------------------------- /config/badge.yml: -------------------------------------------------------------------------------- 1 | bronze: 2 | min: rand(10) 3 | max: rand(10) 4 | silver: 5 | min: rand(10) 6 | max: rand(10) 7 | gold: 8 | min: rand(10) 9 | max: rand(10) 10 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 2 | 3 | require 'bundler/setup' # Set up gems listed in the Gemfile. 4 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /config/git.yml: -------------------------------------------------------------------------------- 1 | access_token_1: your_access_token 2 | 3 | access_token_2: your_access_token 4 | -------------------------------------------------------------------------------- /config/initializers/active_job.rb: -------------------------------------------------------------------------------- 1 | require File.join(Rails.root, 'app', 'jobs', 'application_job.rb') 2 | ActiveJob::Base.queue_adapter = :sidekiq 3 | -------------------------------------------------------------------------------- /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 app/assets folder are already added. 11 | # Rails.application.config.assets.precompile += %w( search.js ) 12 | 13 | Rails.application.config.assets.precompile += %w( logo_50pxh.png logo-home.png widgets.scss widgets.js ) 14 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.action_dispatch.cookies_serializer = :json 4 | -------------------------------------------------------------------------------- /config/initializers/deserialize_job.rb: -------------------------------------------------------------------------------- 1 | # Overrides the deserialize method to pass retry count during subsequent retries of failed job 2 | unless ActiveJob::Base.method_defined?(:deserialize) 3 | module ActiveJob 4 | class Base 5 | def self.deserialize(job_data) 6 | job = job_data['job_class'].constantize.new 7 | job.deserialize(job_data) 8 | job 9 | end 10 | 11 | def deserialize(job_data) 12 | self.job_id = job_data['job_id'] 13 | self.queue_name = job_data['queue_name'] 14 | self.serialized_arguments = job_data['arguments'] 15 | end 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password] 5 | -------------------------------------------------------------------------------- /config/initializers/globals.rb: -------------------------------------------------------------------------------- 1 | require 'github_client' 2 | require 'git_lib_ext' 3 | 4 | GITHUB = Github.new(oauth_token: ENV['GIT_OAUTH_TOKEN'], client_id: ENV['GIT_APP_ID'], client_secret: ENV['GIT_APP_SECRET']) 5 | GithubClient.init(oauth_token: ENV['GIT_OAUTH_TOKEN'], client_id: ENV['GIT_APP_ID'], client_secret: ENV['GIT_APP_SECRET']) 6 | 7 | YAML.load_file('config/code_curiosity_config.yml').tap do |config| 8 | REPOSITORY_CONFIG = config['repository'] 9 | SCORING_ENGINE_CONFIG = config['scoring_engine'] 10 | REDEEM = config['redeem'] 11 | REDEEM_THRESHOLD = config['redeem_request_threshold'] 12 | ACCOUNT = config['account'] 13 | ORGANIZATIONAL_SPONSORERS = config['organizational_sponsorers'] 14 | TRANSACTION = config['transaction'] 15 | end 16 | 17 | COMMIT_RATINGS = (0..5).to_a 18 | ACTIVITY_RATINGS = (0..2).to_a 19 | 20 | INFO = YAML.load_file('config/info.yml') 21 | BADGE = YAML.load_file('config/badge.yml') 22 | 23 | MARKDOWN = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true) 24 | 25 | NEW_FEATURE_LAUNCH_DATE = Date.new(2018,7,1) 26 | -------------------------------------------------------------------------------- /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( redeems ) 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/kaminari_config.rb: -------------------------------------------------------------------------------- 1 | Kaminari.configure do |config| 2 | config.default_per_page = 10 3 | config.max_per_page = 10 4 | config.window = 4 5 | config.outer_window = 1 6 | config.left = 2 7 | config.right = 4 8 | config.page_method_name = :page 9 | config.param_name = :page 10 | end 11 | -------------------------------------------------------------------------------- /config/initializers/lib.rb: -------------------------------------------------------------------------------- 1 | Dir["#{Rails.root}/lib/**/*.rb"].each { |f| require f } -------------------------------------------------------------------------------- /config/initializers/mail_interceptor.rb: -------------------------------------------------------------------------------- 1 | if Rails.env.development? 2 | require Rails.root.join("lib", "development_mail_interceptor.rb") 3 | ActionMailer::Base.register_interceptor(DevelopmentMailInterceptor) 4 | end 5 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | -------------------------------------------------------------------------------- /config/initializers/mongoid_ext.rb: -------------------------------------------------------------------------------- 1 | module BSON 2 | class ObjectId 3 | def as_json(*args) 4 | to_s 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /config/initializers/mongoid_search.rb: -------------------------------------------------------------------------------- 1 | Mongoid::Search.setup do |config| 2 | config.allow_empty_search = true 3 | config.minimum_word_size = 1 4 | end 5 | -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.session_store :cookie_store, key: '_code-curiosity_session' 4 | -------------------------------------------------------------------------------- /config/initializers/sidekiq.rb: -------------------------------------------------------------------------------- 1 | require 'sidekiq' 2 | require 'sidekiq-status' 3 | 4 | Sidekiq.configure_client do |config| 5 | config.client_middleware do |chain| 6 | # accepts :expiration (optional) 7 | chain.add Sidekiq::Status::ClientMiddleware, expiration: 30.minutes # default 8 | end 9 | end 10 | 11 | Sidekiq.configure_server do |config| 12 | config.server_middleware do |chain| 13 | # accepts :expiration (optional) 14 | chain.add Sidekiq::Status::ServerMiddleware, expiration: 30.minutes # default 15 | end 16 | config.client_middleware do |chain| 17 | # accepts :expiration (optional) 18 | chain.add Sidekiq::Status::ClientMiddleware, expiration: 30.minutes # default 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /config/initializers/stripe.rb: -------------------------------------------------------------------------------- 1 | Rails.configuration.stripe = { 2 | :publishable_key => ENV['STRIPE_PUBLISHABLE_KEY'], 3 | :secret_key => ENV['STRIPE_SECRET_KEY'] 4 | } 5 | 6 | Stripe.api_key = Rails.configuration.stripe[:secret_key] -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] if respond_to?(:wrap_parameters) 9 | end 10 | 11 | # To enable root element in JSON for ActiveRecord objects. 12 | # ActiveSupport.on_load(:active_record) do 13 | # self.include_root_in_json = true 14 | # end 15 | -------------------------------------------------------------------------------- /config/locales/simple_form.en.yml: -------------------------------------------------------------------------------- 1 | en: 2 | simple_form: 3 | "yes": 'Yes' 4 | "no": 'No' 5 | required: 6 | text: 'required' 7 | mark: '*' 8 | # You can uncomment the line below if you need to overwrite the whole required html. 9 | # When using html, text and mark won't be used. 10 | # html: '*' 11 | error_notification: 12 | default_message: "Please review the problems below:" 13 | # Examples 14 | # labels: 15 | # defaults: 16 | # password: 'Password' 17 | # user: 18 | # new: 19 | # email: 'E-mail to sign in.' 20 | # edit: 21 | # email: 'E-mail.' 22 | # hints: 23 | # defaults: 24 | # username: 'User name to sign in.' 25 | # password: 'No special characters, please.' 26 | # include_blanks: 27 | # defaults: 28 | # age: 'Rather not say' 29 | # prompts: 30 | # defaults: 31 | # age: 'Select your age' 32 | -------------------------------------------------------------------------------- /config/schedule.rb: -------------------------------------------------------------------------------- 1 | # Use this file to easily define all of your cron jobs. 2 | # 3 | # It's helpful, but not entirely necessary to understand cron before proceeding. 4 | # http://en.wikipedia.org/wiki/Cron 5 | 6 | # Example: 7 | # 8 | # set :output, "/path/to/my/cron_log.log" 9 | # 10 | # every 2.hours do 11 | # command "/usr/bin/some_great_command" 12 | # runner "MyModel.some_method" 13 | # rake "some:great:rake:task" 14 | # end 15 | # 16 | # every 4.days do 17 | # runner "AnotherModel.prune_old_records" 18 | # end 19 | 20 | # Learn more: http://github.com/javan/whenever 21 | 22 | set :output, "/home/deploy/projects/codecuriosity/current/cron_log.log" 23 | 24 | every :day, :at => '8:00pm' do 25 | rake "fetch_data:sync_repos" 26 | end 27 | 28 | every :day, :at => '10:00pm' do 29 | command 'backup perform --trigger code_curiosity_backup' 30 | end 31 | 32 | every :day, :at => '10:30am' do 33 | rake 'repo:delete_large_repositories' 34 | end 35 | 36 | every '1 1 21 * *' do 37 | # rake 'subscription:send_progress_emails' 38 | end 39 | 40 | every '1 10 7 * *' do 41 | # rake 'subscription:redeem_points' 42 | end 43 | 44 | every :day, :at => '00:00am' do 45 | rake 'fetch_commits' 46 | end 47 | 48 | every :day, :at => '01:00am' do 49 | rake 'score_and_reward' 50 | end 51 | -------------------------------------------------------------------------------- /config/secrets.yml: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key is used for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | 6 | # Make sure the secret is at least 30 characters and all random, 7 | # no regular words or you'll be exposed to dictionary attacks. 8 | # You can use `rake secret` to generate a secure secret key. 9 | 10 | # Make sure the secrets in this file are kept private 11 | # if you're sharing your code publicly. 12 | 13 | development: 14 | secret_key_base: f2b9b33466ea6a408a69f7785c1ba391cadef27691810de33fc79606c619d5e5cd3d95b5655efed14b9ad914c19750692b238d078ae57a03df46b963e8f99fbd 15 | 16 | test: 17 | secret_key_base: 8425803cd5586d11bd05b2db1b87bd4f171da1a7f4fb668ff01df5f7e2d55ccbb63d9129ffe4d5168502d89e400b496f6d2c5886d2bbe9242e9c29ab4f78eeb5 18 | 19 | # Do not keep production secrets in the repository, 20 | # instead read values from the environment. 21 | production: 22 | secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> 23 | -------------------------------------------------------------------------------- /config/sidekiq.yml: -------------------------------------------------------------------------------- 1 | :concurrency: 25 2 | :logfile: ./log/sidekiq.log 3 | :queues: 4 | - score 5 | - git 6 | - mailers 7 | - rollbar 8 | -------------------------------------------------------------------------------- /config/webpack/development.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'development' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /config/webpack/environment.js: -------------------------------------------------------------------------------- 1 | const { environment } = require('@rails/webpacker') 2 | 3 | module.exports = environment 4 | -------------------------------------------------------------------------------- /config/webpack/production.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'production' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /config/webpack/test.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'development' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) 7 | # Mayor.create(name: 'Emanuel', city: cities.first) 8 | 9 | #Roles 10 | Role.find_or_create_by(name: 'Admin') 11 | 12 | if Rails.env.development? 13 | Round.create(name: 'first', from_date: Date.today.beginning_of_month, end_date: Date.today.end_of_month, status: :open) if Round.find_by(status: :open).nil? 14 | end -------------------------------------------------------------------------------- /env.sample: -------------------------------------------------------------------------------- 1 | GIT_APP_ID= your app id 2 | GIT_APP_SECRET= your app id secret 3 | GIT_OAUTH_TOKEN=git auth token 4 | ENC_KEY=encryption key 5 | REDIS=redis://localhost:6379/0/cache 6 | SENDGRID_USERNAME="username" 7 | SENDGRID_PASSWORD="password" 8 | ADMIN_EMAILS="admin@test.com" 9 | ROLLBAR_TOKEN="" 10 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/lib/assets/.keep -------------------------------------------------------------------------------- /lib/development_mail_interceptor.rb: -------------------------------------------------------------------------------- 1 | class DevelopmentMailInterceptor 2 | def self.delivering_email(message) 3 | message.subject = "#{message.to} #{message.subject}" 4 | message.to = "testvx100@gmail.com" 5 | Rails.logger.debug "Interceptor prevented sending mail #{message.inspect}!" 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /lib/git_lib_ext.rb: -------------------------------------------------------------------------------- 1 | module GitLibExt 2 | def commit_branch(sha) 3 | command('branch', ['--contains', sha]).sub('* ', '') 4 | end 5 | 6 | def commit_grep(message) 7 | command_lines('log', ['--grep', message, '--pretty="%H - %s"']) 8 | end 9 | 10 | def commits_by_file(file) 11 | command_lines('log', ['--pretty="%H - %s"', '--follow', file]) 12 | end 13 | end 14 | 15 | module GitCommitExt 16 | def branch 17 | name = @base.lib.commit_branch(sha) rescue nil 18 | return name if name 19 | 20 | commit_grep(self.message) 21 | end 22 | end 23 | 24 | module GitBaseExt 25 | def commit_grep(message) 26 | result = lib.commit_grep(message).map do |log| 27 | log.split(" - ").collect{|s| s.sub('"', '')} 28 | end 29 | 30 | # Remove non ascii chars 31 | non_ascii_range = "^\u{0000}-\u{007F}" 32 | clean_message = message.delete!(non_ascii_range) 33 | log = result.find{|r| r[1].delete(non_ascii_range) == message } 34 | 35 | if log 36 | return lib.commit_branch(log[0]) rescue nil 37 | end 38 | end 39 | 40 | def file_commits_count(file) 41 | path = File.join(self.dir.path, file) 42 | lib.commits_by_file(path).count 43 | end 44 | end 45 | 46 | Git::Lib.send :include, GitLibExt 47 | Git::Object::Commit.send :include, GitCommitExt 48 | Git::Base.send :include, GitBaseExt 49 | -------------------------------------------------------------------------------- /lib/github_client.rb: -------------------------------------------------------------------------------- 1 | class GithubClient 2 | URL = 'https://github.com' 3 | 4 | class << self 5 | attr_accessor :client 6 | 7 | def init(options = {}) 8 | self.client = Github.new(options) 9 | end 10 | 11 | def repo(owner, repo_name) 12 | @client.repos.get(owner, repo_name) 13 | rescue 14 | nil 15 | end 16 | 17 | def repos 18 | @client.repos.get(ownder) 19 | end 20 | 21 | def user(name) 22 | @client.users.get(user: name) 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/lib/tasks/.keep -------------------------------------------------------------------------------- /lib/tasks/fetch_commits.rake: -------------------------------------------------------------------------------- 1 | desc "Fetch commits daily." 2 | task :fetch_commits, [:from_date, :to_date] => :environment do |t, args| 3 | from_date = args[:from_date].present? ? args[:from_date] : nil 4 | to_date = args[:to_date].present? ? args[:to_date] : nil 5 | repos = Repository.required 6 | 7 | repos.each do |repo| 8 | repo.branches.each do |branch| 9 | FetchCommitJob.perform_later( 10 | repo_owner: repo.owner, 11 | repo_name: repo.name, 12 | branch_name: branch, 13 | from_date: from_date, 14 | to_date: to_date 15 | ) 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /lib/tasks/fix_august_budget.rake: -------------------------------------------------------------------------------- 1 | desc 'fix budget for august 1 and 2' 2 | task :fix_august_budget => :environment do 3 | budget = Budget.new 4 | 5 | budget.start_date = Date.new(2018, 8, 1) 6 | budget.end_date = Date.new(2018, 8, 2) 7 | budget.sponsor_id = Sponsor.first.id 8 | budget.amount = 20 9 | budget.is_all_repos = true 10 | 11 | budget.save 12 | 13 | Rake::Task[:score_and_reward].invoke('2018-8-01','2018-8-02') 14 | end 15 | -------------------------------------------------------------------------------- /lib/tasks/hide_undebited_requests.rake: -------------------------------------------------------------------------------- 1 | desc 'hide the redeem requests which are undebited' 2 | task :hide_undebited_requests => :environment do 3 | RedeemRequest.where(status: false).map(&:destroy) 4 | Transaction.where(hidden: true).map(&:destroy) 5 | end -------------------------------------------------------------------------------- /lib/tasks/notify_all.rake: -------------------------------------------------------------------------------- 1 | namespace :notify_all do 2 | desc "Send mail to all contenstants about change in Terms of Service" 3 | task notify_contestants: :environment do 4 | users = User.contestants.any_of({notify_monthly_points: nil}, {notify_monthly_points: true}).where(:points.gte => 85, :points.lt => 1000).pluck(:id) 5 | User.contestants.where(:id.nin => users).each do |user| 6 | SubscriptionMailer.redeem_points(user, "Change in Terms of Service").deliver_later 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /lib/tasks/score_and_reward.rake: -------------------------------------------------------------------------------- 1 | desc 'set score and reward daily' 2 | task :score_and_reward, [:from_date, :to_date] => :environment do |t, args| 3 | from_date = args[:from_date].present? ? args[:from_date].to_date : Date.yesterday 4 | to_date = args[:to_date].present? ? args[:to_date].to_date : Date.yesterday 5 | date = from_date..to_date 6 | 7 | date.each{ |date| CommitReward.new(date).calculate } 8 | end 9 | 10 | desc 'Recalculate score and reward' 11 | task recalculate_score_and_reward: :environment do 12 | Transaction.redeemable.destroy_all 13 | date = NEW_FEATURE_LAUNCH_DATE..Date.today 14 | date.each{ |date| CommitReward.new(date).calculate } 15 | puts "-----------------" 16 | puts RedeemRequest.count 17 | end 18 | -------------------------------------------------------------------------------- /lib/templates/erb/scaffold/_form.html.erb: -------------------------------------------------------------------------------- 1 | <%%= simple_form_for(@<%= singular_table_name %>) do |f| %> 2 | <%%= f.error_notification %> 3 | 4 |
5 | <%- attributes.each do |attribute| -%> 6 | <%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %> 7 | <%- end -%> 8 |
9 | 10 |
11 | <%%= f.button :submit %> 12 |
13 | <%% end %> 14 | -------------------------------------------------------------------------------- /lib/vcs/git_branch.rb: -------------------------------------------------------------------------------- 1 | module Vcs 2 | class GitBranch 3 | attr_reader :git_username, :repo_name 4 | 5 | def initialize(git_username: , repo_name: ) 6 | @git_username = git_username 7 | @repo_name = repo_name 8 | end 9 | 10 | def list 11 | GITHUB.repos.branches(user: git_username, repo: repo_name).list 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /lib/vcs/git_commit.rb: -------------------------------------------------------------------------------- 1 | module Vcs 2 | class GitCommit 3 | attr_reader :repo_owner, :repo_name, 4 | :branch_name, :from_date, :to_date 5 | 6 | def initialize(**options) 7 | @repo_owner = options[:repo_owner] 8 | @repo_name = options[:repo_name] 9 | @branch_name = options[:branch_name] 10 | @from_date = options[:from_date] 11 | @to_date = options[:to_date] 12 | end 13 | 14 | def list 15 | GitApp.info.repos.commits.list( 16 | user: repo_owner, 17 | repo: repo_name, 18 | sha: branch_name, 19 | since: from_date, 20 | "until": to_date 21 | ) 22 | end 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /lib/vcs/git_commit_stats.rb: -------------------------------------------------------------------------------- 1 | module Vcs 2 | class GitCommitStats 3 | attr_reader :sha, :repo 4 | 5 | def initialize(sha, repo) 6 | @sha = sha 7 | @repo = repo 8 | end 9 | 10 | def list 11 | GitApp.info.repos.commits.get( 12 | user: repo.owner, 13 | repo: repo.name, 14 | sha: sha 15 | ).stats 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /lib/vcs/git_pull_request.rb: -------------------------------------------------------------------------------- 1 | module Vcs 2 | class GitPullRequest 3 | attr_reader :sha 4 | 5 | def initialize(sha) 6 | @sha = sha 7 | end 8 | 9 | def get 10 | pull_requests = GitApp.info.search.issues("sha:#{sha}") 11 | return nil if pull_requests.items.size != 1 12 | pull_requests.items[0] 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /lib/vcs/git_repository.rb: -------------------------------------------------------------------------------- 1 | module Vcs 2 | class GitRepository 3 | attr_reader :git_username 4 | 5 | def initialize(git_username: ) 6 | @git_username = git_username 7 | end 8 | 9 | def list 10 | GITHUB.repos(user: git_username).list 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /log/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/log/.keep -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "@rails/webpacker": "5.2.1" 4 | }, 5 | "devDependencies": { 6 | "webpack-dev-server": "^3.11.0" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [ 3 | require('postcss-import'), 4 | require('postcss-flexbugs-fixes'), 5 | require('postcss-preset-env')({ 6 | autoprefixer: { 7 | flexbox: 'no-2009' 8 | }, 9 | stage: 3 10 | }) 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /public/New_Redemption_Strategy.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/public/New_Redemption_Strategy.pdf -------------------------------------------------------------------------------- /public/Terms_of_service_CodeCuriosity.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/public/Terms_of_service_CodeCuriosity.pdf -------------------------------------------------------------------------------- /public/apple-touch-icon-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/public/apple-touch-icon-precomposed.png -------------------------------------------------------------------------------- /public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/public/apple-touch-icon.png -------------------------------------------------------------------------------- /public/docs/v1/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Documentation for v1 5 | 6 | 7 | 8 |
9 |
10 |

API Operations

11 |
12 |
13 |

Documentation for v1

14 |
15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /public/docs/v1/style.css: -------------------------------------------------------------------------------- 1 | body {margin: 0; background-color: #fff; color: #000; font-family: Arial,sans-serif;} 2 | content {margin-left: 200px;} 3 | content h1 {text-align: center;} 4 | operations {float: left; width: 200px; border-right: 1px solid #ccc;} 5 | operations h3 {text-align: center;} 6 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/public/favicon.ico -------------------------------------------------------------------------------- /public/logo/Geometos Rounded.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/public/logo/Geometos Rounded.ttf -------------------------------------------------------------------------------- /public/logo/logo-cc-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/public/logo/logo-cc-black.png -------------------------------------------------------------------------------- /public/logo/logo-cc-revert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/public/logo/logo-cc-revert.png -------------------------------------------------------------------------------- /public/logo/logo-cc.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/public/logo/logo-cc.ai -------------------------------------------------------------------------------- /public/logo/logo-cc.eps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/public/logo/logo-cc.eps -------------------------------------------------------------------------------- /public/logo/logo-cc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/public/logo/logo-cc.png -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /test/controllers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/test/controllers/.keep -------------------------------------------------------------------------------- /test/controllers/dashboard_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class DashboardControllerTest < ActionController::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/controllers/github/repos_controller_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class Github::ReposControllerTest < ActionController::TestCase 4 | end 5 | -------------------------------------------------------------------------------- /test/controllers/home_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class HomeControllerTest < ActionController::TestCase 4 | def setup 5 | super 6 | @user = create :user, auth_token: 'dah123rty' 7 | end 8 | 9 | test 'should get index for non logged-in user' do 10 | get :index 11 | assert_response :success 12 | assert_template :index 13 | end 14 | 15 | test 'should redirect to dashboard if logged-in user' do 16 | sign_in @user 17 | get :index 18 | assert_response :redirect 19 | assert_redirected_to dashboard_path 20 | end 21 | 22 | test 'should load featured_groups for non logged-in user' do 23 | get :index 24 | assert_response :success 25 | assert_template partial: '_trend' 26 | end 27 | 28 | end 29 | -------------------------------------------------------------------------------- /test/controllers/info_controller_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class InfoControllerTest < ActionController::TestCase 4 | 5 | test 'faq' do 6 | get :faq 7 | assert_response :success 8 | end 9 | 10 | end 11 | -------------------------------------------------------------------------------- /test/controllers/registrations_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class RegistrationsControllerTest < ActionController::TestCase 4 | before do 5 | @request.env["devise.mapping"] = Devise.mappings[:user] 6 | @user = create(:user, :auth_token => 'dah123rty') 7 | sign_in @user 8 | end 9 | 10 | test 'if user has not accepted terms and conditions' do 11 | get :terms_and_conditions 12 | 13 | assert_template 'terms_and_conditions' 14 | end 15 | 16 | test 'if user has accepted terms and conditions' do 17 | get :terms_and_conditions, terms_and_conditions: true 18 | 19 | assert_redirected_to dashboard_path 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /test/controllers/repositories_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class RepositoriesControllerTest < ActionController::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/controllers/transactions_controller_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class TransactionsControllerTest < ActionController::TestCase 4 | include Devise::TestHelpers 5 | 6 | test "must get user transactions" do 7 | skip 'Route not defined' 8 | user = create :user 9 | sign_in user 10 | xhr :get, :index, format: :js, :id => user.id 11 | assert_response :success 12 | assert_not_empty assigns(:transactions) 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /test/controllers/users_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class UsersControllerTest < ActionController::TestCase 4 | def setup 5 | super 6 | @user = create :user, auth_token: 'dah123rty' 7 | end 8 | 9 | test 'destroy' do 10 | assert_equal @user.deleted?, false 11 | sign_in @user 12 | delete :destroy, { id: @user.id } 13 | @user.reload 14 | assert @user.deleted? 15 | assert @user.deleted_at.present? 16 | assert @user.auto_created 17 | assert_equal @user.active, false 18 | end 19 | 20 | test "only logged in user is abled to update his twitter handle" do 21 | user = create :user, auth_token: 'dah123rty' 22 | sign_in user 23 | xhr :get, :edit, id: user.id 24 | assert_response :success 25 | end 26 | 27 | test "must not update twitter handle if user is not logged in" do 28 | user = create :user, auth_token: 'aswq123ew' 29 | xhr :get, :edit, id: user.id 30 | assert_response 401 31 | end 32 | 33 | test "should update twitter handle when update" do 34 | user = create :user, auth_token: 'dah123rty' 35 | sign_in user 36 | xhr :patch, :update, user: { twitter_handle: 'amitk'}, id: user.id 37 | assert_response :success 38 | assert_equal '@amitk', user.reload.twitter_handle 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /test/factories/budgets.rb: -------------------------------------------------------------------------------- 1 | FactoryBot.define do 2 | factory :budget do 3 | start_date {Date.today} 4 | end_date {Date.tomorrow} 5 | amount {Faker::Number.number(digits: 4)} 6 | is_all_repos {random_boolean = [true, false].sample} 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /test/factories/comments.rb: -------------------------------------------------------------------------------- 1 | FactoryBot.define do 2 | factory :comment do 3 | content { "MyString" } 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /test/factories/commits.rb: -------------------------------------------------------------------------------- 1 | FactoryBot.define do 2 | factory :commit do 3 | message { Faker::Lorem.paragraph } 4 | commit_date { DateTime.now } 5 | association :user 6 | association :repository 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /test/factories/file_to_be_ignoreds.rb: -------------------------------------------------------------------------------- 1 | FactoryBot.define do 2 | factory :file_to_be_ignored do 3 | name {Faker::Lorem.word} 4 | programming_language {Faker::Lorem.word} 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /test/factories/git_apps.rb: -------------------------------------------------------------------------------- 1 | FactoryBot.define do 2 | factory :git_app do 3 | 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /test/factories/pull_requests.rb: -------------------------------------------------------------------------------- 1 | FactoryBot.define do 2 | factory :pull_request do 3 | number {Faker::Number.number(digits: 2)} 4 | comment_count {Faker::Number.number(digits: 2)} 5 | author_association {"COLLABORATOR"} 6 | label {"bug"} 7 | created_at_git {Faker::Date.between(from: 1.month.ago, to: 2.month.ago)} 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /test/factories/redeem_requests.rb: -------------------------------------------------------------------------------- 1 | FactoryBot.define do 2 | factory :redeem_request do 3 | association :user 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /test/factories/repositories.rb: -------------------------------------------------------------------------------- 1 | FactoryBot.define do 2 | factory :repository do 3 | name {Faker::Name.name} 4 | ssh_url { Faker::Internet.url(host: 'github.com', path: "/#{Faker::Lorem.word}/#{Faker::Lorem.word}") } 5 | source_url { Faker::Internet.url(host: 'github.com', path: "/#{Faker::Lorem.word}/#{Faker::Lorem.word}") } 6 | description { Faker::Lorem.sentence } 7 | watchers {Faker::Number.digit} 8 | gh_id {Faker::Number.number(digits: 6)} 9 | 10 | factory :repository_with_activity_and_commits do 11 | transient do 12 | count {2} 13 | score {2} 14 | end 15 | 16 | after(:create) do |repo, evaluator| 17 | create_list(:commit, evaluator.count, repository: repo, score: evaluator.score) 18 | create_list(:activity, evaluator.count, repository: repo, score: evaluator.score) 19 | end 20 | end 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /test/factories/roles.rb: -------------------------------------------------------------------------------- 1 | FactoryBot.define do 2 | factory :role do 3 | name {Faker::Name.first_name} 4 | 5 | trait :admin do 6 | name {'Admin'} 7 | end 8 | 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /test/factories/scores.rb: -------------------------------------------------------------------------------- 1 | FactoryBot.define do 2 | factory :score do 3 | value { Faker::Number.number(digits: 1) } 4 | comment { Faker::Lorem.sentence } 5 | association :user 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /test/factories/sponsors.rb: -------------------------------------------------------------------------------- 1 | FactoryBot.define do 2 | factory :sponsor do 3 | name {Faker::Name.name} 4 | is_individual {random_boolean = [true, false].sample} 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /test/factories/transactions.rb: -------------------------------------------------------------------------------- 1 | FactoryBot.define do 2 | factory :transaction do 3 | type {Faker::Lorem.word} 4 | points {Faker::Number.number(digits: 2)} 5 | association :user 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /test/factories/users.rb: -------------------------------------------------------------------------------- 1 | FactoryBot.define do 2 | factory :user do 3 | name {Faker::Name.name} 4 | email { Faker::Internet.email } 5 | password {Faker::Internet.password} 6 | sign_in_count {Faker::Number.digit} 7 | active {random_boolean = [true, false].sample} 8 | is_judge {random_boolean = [true, false].sample} 9 | github_handle {Faker::Internet.user_name} 10 | uid { Faker::Number.number(digits: 6) } 11 | 12 | factory :user_with_transactions do 13 | transient do 14 | transactions_count {1} 15 | end 16 | after(:create) do |user, evaluator| 17 | create_list(:transaction, evaluator.transactions_count, :points => 1, :type => 'credit', user: user) 18 | end 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /test/fixtures/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/test/fixtures/.keep -------------------------------------------------------------------------------- /test/fixtures/org.json: -------------------------------------------------------------------------------- 1 | { 2 | "login": "joshsoftware", 3 | "id": 130756, 4 | "url": "https://api.github.com/orgs/joshsoftware", 5 | "repos_url": "https://api.github.com/orgs/joshsoftware/repos", 6 | "events_url": "https://api.github.com/orgs/joshsoftware/events", 7 | "hooks_url": "https://api.github.com/orgs/joshsoftware/hooks", 8 | "issues_url": "https://api.github.com/orgs/joshsoftware/issues", 9 | "members_url": "https://api.github.com/orgs/joshsoftware/members{/member}", 10 | "public_members_url": "https://api.github.com/orgs/joshsoftware/public_members{/member}", 11 | "avatar_url": "https://avatars.githubusercontent.com/u/130756?v=3", 12 | "description": null, 13 | "name": "Josh Software Private Limited", 14 | "company": null, 15 | "blog": "http://www.joshsoftware.com", 16 | "location": "Pune", 17 | "email": null, 18 | "public_repos": 120, 19 | "public_gists": 0, 20 | "followers": 0, 21 | "following": 0, 22 | "html_url": "https://github.com/joshsoftware", 23 | "created_at": "2009-09-24T09:46:13Z", 24 | "updated_at": "2016-09-12T10:10:29Z", 25 | "type": "Organization" 26 | } -------------------------------------------------------------------------------- /test/fixtures/organization.json: -------------------------------------------------------------------------------- 1 | { 2 | "login": "joshsoftware", 3 | "id": 130756, 4 | "url": "https://api.github.com/orgs/joshsoftware", 5 | "repos_url": "https://api.github.com/orgs/joshsoftware/repos", 6 | "events_url": "https://api.github.com/orgs/joshsoftware/events", 7 | "hooks_url": "https://api.github.com/orgs/joshsoftware/hooks", 8 | "issues_url": "https://api.github.com/orgs/joshsoftware/issues", 9 | "members_url": "https://api.github.com/orgs/joshsoftware/members{/member}", 10 | "public_members_url": "https://api.github.com/orgs/joshsoftware/public_members{/member}", 11 | "avatar_url": "https://avatars.githubusercontent.com/u/130756?v=3", 12 | "description": null, 13 | "name": "Josh Software Private Limited", 14 | "company": null, 15 | "blog": "http://www.joshsoftware.com", 16 | "location": "Pune", 17 | "email": null, 18 | "public_repos": 120, 19 | "public_gists": 0, 20 | "followers": 0, 21 | "following": 0, 22 | "html_url": "https://github.com/joshsoftware", 23 | "created_at": "2009-09-24T09:46:13Z", 24 | "updated_at": "2016-09-12T10:10:29Z", 25 | "type": "Organization" 26 | } 27 | -------------------------------------------------------------------------------- /test/fixtures/rails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/test/fixtures/rails.png -------------------------------------------------------------------------------- /test/fixtures/repositories.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | name: MyString 5 | 6 | two: 7 | name: MyString 8 | -------------------------------------------------------------------------------- /test/fixtures/test.csv: -------------------------------------------------------------------------------- 1 | user1, 9988754515, user1@gmail.com 2 | user2, 9856451245, user2@gmail.com 3 | user3, 9565451252, user3@gmail.com 4 | user4, 9754251563, user4@gmail.com 5 | -------------------------------------------------------------------------------- /test/fixtures/users.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | # This model initially had no columns defined. If you add columns to the 4 | # model remove the '{}' from the fixture names and add the columns immediately 5 | # below each fixture, per the syntax in the comments below 6 | # 7 | one: {} 8 | # column: value 9 | # 10 | two: {} 11 | # column: value 12 | -------------------------------------------------------------------------------- /test/helpers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/test/helpers/.keep -------------------------------------------------------------------------------- /test/helpers/admin/redeem_requests_helper_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class Admin::RedeemRequestsHelperTest < ActionView::TestCase 4 | 5 | test "check value of points if store is not provided" do 6 | seed_data 7 | create(:redeem_request, points: 100, user: @user) 8 | create(:redeem_request, points: 100, user: @user, store: 'amazon.in') 9 | create(:redeem_request, points: 100, user: @user, store: 'amazon.uk') 10 | assert_equal 300, amount_for_store 11 | end 12 | 13 | test "check value of points if store is provided" do 14 | seed_data 15 | create(:redeem_request, points: 100, user: @user) 16 | create(:redeem_request, points: 100, user: @user, store: 'amazon.in') 17 | create(:redeem_request, points: 100, user: @user, store: 'amazon.uk') 18 | assert_equal 100, amount_for_store('amazon.in') 19 | end 20 | 21 | def seed_data 22 | role = create(:role, :name => 'Admin') 23 | @user = create(:user) 24 | @user.roles << role 25 | transaction = create(:transaction, :type => 'credit', :points => 420, user: @user) 26 | end 27 | 28 | end 29 | -------------------------------------------------------------------------------- /test/helpers/admin/repositories_helper_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class Admin::RepositoriesHelperTest < ActionView::TestCase 4 | 5 | test "should return true of string true and vice versa" do 6 | assert_equal check_boolean("true"), true 7 | assert_equal check_boolean("false"), false 8 | end 9 | 10 | end 11 | 12 | -------------------------------------------------------------------------------- /test/helpers/users_helper_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class UsersHelperTest < ActionView::TestCase 4 | test "show remove twitter handle prefix from twitter handle" do 5 | twitter_handle = "@amitk301293" 6 | assert_equal "amitk301293", remove_prefix(twitter_handle) 7 | end 8 | 9 | test 'must return sum amount of only debit transactions made by user' do 10 | user = create :user 11 | create :transaction, transaction_type: 'daily reward', type: 'credit', points: 100, user: user 12 | create :transaction, transaction_type: 'redeem_points', type: 'debit', points: 200, user: user 13 | assert_equal 200, amount_earned(user) 14 | end 15 | 16 | test 'must return 0 if user has no debit transactions' do 17 | user = create :user 18 | create :transaction, transaction_type: 'royalty_bonus', type: 'credit', points: 1000, user: user 19 | create :transaction, transaction_type: 'Round', type: 'credit', points: 100, user: user 20 | assert_equal 0, amount_earned(user) 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /test/integration/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/test/integration/.keep -------------------------------------------------------------------------------- /test/lib/tasks/fetch_commits_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class FetchCommitsTest < ActiveSupport::TestCase 4 | setup do 5 | CodeCuriosity::Application.load_tasks 6 | end 7 | 8 | test 'daily commits' do 9 | VCR.use_cassette("my_commits", record: :new_episodes) do 10 | repo = create :repository, name: 'tanya-josh', owner: 'tanya-saroha', language: 'Ruby' 11 | auth_token = User.encrypter.encrypt_and_sign('your_access_token') 12 | create :user, github_handle: 'tanya-saroha', created_at: Date.yesterday - 1, auth_token: auth_token 13 | 14 | assert_equal repo.commits.count, 0 15 | Sidekiq::Testing.inline! 16 | 17 | Rake::Task['fetch_commits'].invoke 18 | 19 | Sidekiq::Testing.inline! 20 | repo.reload 21 | assert_equal repo.commits.count, 4 22 | 23 | assert_equal repo.commits[0].score, 0 24 | assert_nil repo.commits[0].reward 25 | end 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /test/lib/tasks/score_and_reward_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class ScoreAndRewardTest < ActiveSupport::TestCase 4 | setup do 5 | CodeCuriosity::Application.load_tasks 6 | end 7 | 8 | def test_score_and_reward_calculations 9 | repo = create :repository, name: 'tanya-josh', owner: 'tanya-saroha', language: 'Ruby' 10 | user = create :user, github_handle: 'tanya-saroha', created_at: Date.yesterday - 1 11 | commit = create :commit, message: 'commit1', repository_id: repo.id 12 | 13 | assert_equal commit.score, 0 14 | assert_nil commit.reward 15 | 16 | Rake::Task['score_and_reward'].invoke 17 | commit.reload 18 | 19 | assert commit.score > 5 20 | assert commit.reward > 5 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /test/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/test/mailers/.keep -------------------------------------------------------------------------------- /test/mailers/previews/redeem_mailer_preview.rb: -------------------------------------------------------------------------------- 1 | # Preview all emails at http://localhost:3000/rails/mailers/redeem_mailer 2 | class RedeemMailerPreview < ActionMailer::Preview 3 | 4 | def redeem_request 5 | RedeemMailer.redeem_request(RedeemRequest.first) 6 | end 7 | 8 | def notify_admin 9 | RedeemMailer.notify_admin(RedeemRequest.first) 10 | end 11 | 12 | def coupon_code 13 | request = RedeemRequest.where(:coupon_code.ne => nil).first || RedeemRequest.first 14 | RedeemMailer.coupon_code(request) 15 | end 16 | 17 | end 18 | -------------------------------------------------------------------------------- /test/mailers/previews/subscription_mailer_preview.rb: -------------------------------------------------------------------------------- 1 | # Preview all emails at http://localhost:3000/rails/mailers/subscription_mailer 2 | class SubscriptionMailerPreview < ActionMailer::Preview 3 | 4 | def progress 5 | user = User.contestants.first 6 | SubscriptionMailer.progress(user, Round.opened) 7 | end 8 | 9 | def redeem_points 10 | user = User.contestants.first 11 | SubscriptionMailer.redeem_points(user, "You have enough points. Splurge!") 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /test/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/test/models/.keep -------------------------------------------------------------------------------- /test/models/budget_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class BudgetTest < ActiveSupport::TestCase 4 | test 'start date must be present' do 5 | budget = build(:budget, start_date: '') 6 | budget.valid? 7 | assert_not_empty budget.errors[:start_date] 8 | end 9 | 10 | test 'end date must be present' do 11 | budget = build(:budget, end_date: '') 12 | budget.valid? 13 | assert_not_empty budget.errors[:end_date] 14 | end 15 | 16 | test 'amount must be present' do 17 | budget = build(:budget, amount: '') 18 | budget.valid? 19 | assert_not_empty budget.errors[:amount] 20 | end 21 | 22 | describe 'after budget is created' do 23 | test 'set day amount' do 24 | budget = create :budget 25 | budget.valid? 26 | assert_not_nil budget.day_amount 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /test/models/code_file_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class CodeFileTest < ActiveSupport::TestCase 4 | end 5 | -------------------------------------------------------------------------------- /test/models/comment_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class CommentTest < ActiveSupport::TestCase 4 | 5 | def test_content_should_be_present 6 | comment = build(:comment, :content => nil) 7 | comment.valid? 8 | assert_not_empty comment.errors[:content] 9 | end 10 | 11 | def test_commemt_count_should_be_zero_before_creating_any_comment 12 | comment = build(:comment, :content => Faker::Lorem.sentences) 13 | commit = build(:commit) 14 | comment.commentable = commit 15 | comments_count = comment.commentable.comments_count 16 | assert_equal comments_count, 0 17 | end 18 | 19 | def test_comment_count_should_be_incremented_after_creating_comment 20 | comment = build(:comment, :content => Faker::Lorem.sentences) 21 | commit = build(:commit) 22 | comment.commentable = commit 23 | comment.save 24 | comments_count = comment.commentable.comments_count 25 | assert_equal comments_count, 1 26 | end 27 | 28 | end 29 | -------------------------------------------------------------------------------- /test/models/git_app_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class GitAppTest < ActiveSupport::TestCase 4 | GIT_INFO = YAML.load_file('config/git.yml') 5 | 6 | def setup 7 | @user = create :user, name: 'user' 8 | end 9 | 10 | def git_app 11 | @git_app ||= GitApp.new 12 | end 13 | 14 | def test_valid 15 | assert git_app.valid? 16 | end 17 | 18 | test 'info method should update access_token when it is nil' do 19 | @user.auth_token = User.encrypter.encrypt_and_sign('631375614b9ea46165cf63ae7ee522291e912592') 20 | @user.save 21 | GitApp.info 22 | assert_equal GitApp.access_token, '631375614b9ea46165cf63ae7ee522291e912592' 23 | end 24 | 25 | test 'update token method should update access_token whenever called' do 26 | @user.auth_token = User.encrypter.encrypt_and_sign('5d96b0c2abd3c8a850960a40a9703113ce0218f2') 27 | @user.save 28 | GitApp.update_token 29 | assert_equal GitApp.access_token, '5d96b0c2abd3c8a850960a40a9703113ce0218f2' 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /test/models/pull_request_test.rb: -------------------------------------------------------------------------------- 1 | require_relative "../test_helper" 2 | 3 | class PullRequestTest < ActiveSupport::TestCase 4 | test "number must be present" do 5 | pull_request = build(:pull_request, number: '') 6 | pull_request.valid? 7 | assert_not_empty pull_request.errors[:number] 8 | end 9 | 10 | test "created_at_git must be present" do 11 | pull_request = build(:pull_request, created_at_git: '') 12 | pull_request.valid? 13 | assert_not_empty pull_request.errors[:created_at_git] 14 | end 15 | 16 | test "author_association must be present" do 17 | pull_request = build(:pull_request, author_association: '') 18 | pull_request.valid? 19 | assert_not_empty pull_request.errors[:author_association] 20 | end 21 | 22 | test "comment_count must be present" do 23 | pull_request = build(:pull_request, comment_count: '') 24 | pull_request.valid? 25 | assert_not_empty pull_request.errors[:comment_count] 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /test/models/score_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class ScoreTest < ActiveSupport::TestCase 4 | def test_user_must_be_present 5 | score = build :score, user: nil 6 | score.valid? 7 | assert_not_empty score.errors[:user] 8 | assert_includes(score.errors[:user], "can't be blank") 9 | end 10 | 11 | def test_value_must_be_present 12 | score = build :score, value: nil 13 | score.valid? 14 | assert_not_empty score.errors[:value] 15 | assert_includes(score.errors[:value], "can't be blank") 16 | end 17 | 18 | def test_value_must_be_integer 19 | score = build :score, value: 'abc' 20 | score.valid? 21 | assert_not_empty score.errors[:value] 22 | assert_includes(score.errors[:value], 'is not a number') 23 | end 24 | 25 | def test_value_must_be_greater_equal_to_zero 26 | score = build :score, value: -1 27 | score.valid? 28 | assert_not_empty score.errors[:value] 29 | assert_includes(score.errors[:value], 'must be greater than -1') 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /test/models/sponsor_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class SponsorTest < ActiveSupport::TestCase 4 | test 'name must be present' do 5 | sponsor = build(:sponsor, name: '') 6 | sponsor.valid? 7 | assert_not_empty sponsor.errors[:name] 8 | end 9 | 10 | test 'name must be unique' do 11 | sponsor_1 = create(:sponsor, name: 'sample') 12 | sponsor_2 = build(:sponsor, name: 'sample') 13 | sponsor_2.valid? 14 | assert_not_empty sponsor_2.errors[:name] 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /test/serializers/transaction_serializer_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class TransactionSerializerTest < ActiveSupport::TestCase 4 | def setup 5 | super 6 | @user = create :user, auth_token: 'dah123rty' 7 | @transaction = create(:transaction, type: 'credit', points: 500, user: @user, transaction_type: 'royalty_bonus') 8 | @redeem_request = create(:redeem_request, points: 100, retailer: 'other', address: 'pune', gift_product_url: Faker::Internet.url, 9 | coupon_code: 'aitpune', user: @user) 10 | @transaction = @redeem_request.transaction 11 | end 12 | 13 | test 'serialize the transaction' do 14 | serializer = TransactionSerializer.new(@transaction) 15 | data = serializer.serializable_hash 16 | 17 | assert_equal @transaction.id, data[:id] 18 | assert_equal -100, data[:points] 19 | assert_equal 'debit', data[:type] 20 | assert_equal 'Redeem points', data[:transaction_type] 21 | assert_equal 'aitpune', data[:coupon_code] 22 | assert_equal 'other', data[:redeem_request_retailer] 23 | assert_equal @transaction.created_at.strftime('%d/%b/%Y %T'), data[:created_at] 24 | end 25 | 26 | end 27 | -------------------------------------------------------------------------------- /vendor/assets/javascripts/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/vendor/assets/javascripts/.keep -------------------------------------------------------------------------------- /vendor/assets/stylesheets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/code-curiosity/0bcb49472c18310b319e4fb93f58bb62df58ba7d/vendor/assets/stylesheets/.keep --------------------------------------------------------------------------------