From 5e8244d50397e682068617137f41d0439d109f04 Mon Sep 17 00:00:00 2001 From: Cristian Mircea Messel Date: Sat, 26 Apr 2014 04:03:58 +0300 Subject: [PATCH 001/415] add missing self for consistency within class --- app/models/project.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/models/project.rb b/app/models/project.rb index 6e5afb8a..0fef0787 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -114,10 +114,10 @@ def tip_for commit end # create tip - tip = tips.create({ user: user, - amount: amount, - commit: commit.sha, - commit_message: commit.commit.message }) + tip = self.tips.create({ user: user, + amount: amount, + commit: commit.sha, + commit_message: commit.commit.message }) tip.notify_user @@ -172,11 +172,11 @@ def update_info end def amount_to_pay - tips.to_pay.sum(:amount) + self.tips.to_pay.sum(:amount) end def has_undecided_tips? - tips.undecided.any? + self.tips.undecided.any? end def commit_url(commit) From 5d1480c04fc9846aff1692377708f70bc7c53fd6 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Fri, 25 Jul 2014 14:00:50 +0800 Subject: [PATCH 002/415] users can change their display_name --- app/controllers/users_controller.rb | 2 +- app/models/user.rb | 4 ++-- app/views/layouts/application.html.haml | 2 +- app/views/projects/show.html.haml | 4 ++-- app/views/tips/index.html.haml | 6 +++--- app/views/user_mailer/check_bitcoin_address.html.haml | 2 +- app/views/user_mailer/new_tip.html.haml | 2 +- app/views/users/index.html.haml | 4 ++-- app/views/users/show.html.haml | 5 +++-- config/locales/en.yml | 3 ++- db/migrate/20140725054216_add_display_name_to_users.rb | 5 +++++ db/schema.rb | 3 ++- spec/mailers/user_mailer_spec.rb | 6 +++--- spec/models/user_spec.rb | 6 +++--- 14 files changed, 31 insertions(+), 23 deletions(-) create mode 100644 db/migrate/20140725054216_add_display_name_to_users.rb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index b60d16f5..f3e5a8db 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -36,7 +36,7 @@ def login private def users_params - params.require(:user).permit(:bitcoin_address, :password, :password_confirmation, :unsubscribed) + params.require(:user).permit(:bitcoin_address, :password, :password_confirmation, :unsubscribed, :display_name) end def load_user diff --git a/app/models/user.rb b/app/models/user.rb index e88fdf25..915dd0ff 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -24,8 +24,8 @@ def balance tips.decided.unpaid.sum(:amount) end - def full_name - name.presence || nickname.presence || email + def display_name + attributes['display_name'].presence || name.presence || nickname.presence || email end def subscribed? diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index aba3e447..64551ad7 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -35,7 +35,7 @@ %div.pull-right %small - if current_user - = current_user.full_name + = current_user.display_name \/ = link_to btc_human(current_user.balance), current_user \/ diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 6b70cf1e..19a1ac34 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -64,9 +64,9 @@ %li = l tip.created_at, format: :short - if tip.user.nickname.blank? - = tip.user.full_name + = tip.user.display_name - else - = link_to tip.user.full_name, "https://github.com/#{tip.user.nickname}", target: '_blank' + = link_to tip.user.display_name, "https://github.com/#{tip.user.nickname}", target: '_blank' - if tip.decided? = raw t('.received', amount: btc_human(tip.amount)) - else diff --git a/app/views/tips/index.html.haml b/app/views/tips/index.html.haml index 68ed00c7..3d5b5082 100644 --- a/app/views/tips/index.html.haml +++ b/app/views/tips/index.html.haml @@ -2,7 +2,7 @@ - if @project = raw t('.project_tips', project: link_to(@project.full_name, pretty_project_path(@project))) - elsif @user - = raw t('.user_tips', user: link_to(@user.full_name, @user)) + = raw t('.user_tips', user: link_to(@user.display_name, @user)) - else = t('.tips') %p @@ -24,9 +24,9 @@ - unless @user %td - if tip.user.nickname.blank? - = tip.user.full_name + = tip.user.display_name - else - = link_to tip.user.full_name, "https://github.com/#{tip.user.nickname}", target: '_blank' + = link_to tip.user.display_name, "https://github.com/#{tip.user.nickname}", target: '_blank' - unless @project %td= link_to tip.project.full_name, tip.project %td= link_to tip.commit[0..6], "https://github.com/#{tip.project.full_name}/commit/#{tip.commit}", target: :blank diff --git a/app/views/user_mailer/check_bitcoin_address.html.haml b/app/views/user_mailer/check_bitcoin_address.html.haml index 56adfce6..5d19ec4a 100644 --- a/app/views/user_mailer/check_bitcoin_address.html.haml +++ b/app/views/user_mailer/check_bitcoin_address.html.haml @@ -1,4 +1,4 @@ -%h4 Hello, #{@user.full_name}! +%h4 Hello, #{@user.display_name}! %p Recently, we discovered a security breach in our system and it's possible that someone changed your Bitcoin address. Please check it: diff --git a/app/views/user_mailer/new_tip.html.haml b/app/views/user_mailer/new_tip.html.haml index 52e21d40..9d92730c 100644 --- a/app/views/user_mailer/new_tip.html.haml +++ b/app/views/user_mailer/new_tip.html.haml @@ -1,4 +1,4 @@ -%h4 Hello, #{@user.full_name}! +%h4 Hello, #{@user.display_name}! %p You were tipped #{btc_human @tip.amount} for your commit on Project #{@tip.project.full_name}. Please, log in and tell us your bitcoin address to get it. diff --git a/app/views/users/index.html.haml b/app/views/users/index.html.haml index ba7b0b18..23b89916 100644 --- a/app/views/users/index.html.haml +++ b/app/views/users/index.html.haml @@ -11,9 +11,9 @@ %tr %td - if user.nickname.blank? - = user.full_name + = user.display_name - else - = link_to user.full_name, "https://github.com/#{user.nickname}", target: '_blank' + = link_to user.display_name, "https://github.com/#{user.nickname}", target: '_blank' %td= user.commits_count %td= btc_human user.withdrawn_amount = paginate @users diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index 9bc44a6d..41e3ff16 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -1,4 +1,4 @@ -%h1= @user.name +%h1= @user.display_name %p %strong= t('.balance') %p @@ -21,10 +21,11 @@ %p= @user.email = twitter_bootstrap_form_for @user do |f| = f.text_field :bitcoin_address, placeholder: t('.bitcoin_address_placeholder') + = f.text_field :display_name - if f.object.bitcoin_address.blank? = f.check_box :unsubscribed, t('.notify'), { checked: !f.object.unsubscribed? }, '0', '1' %br - = f.submit t('.submit_bitcoin_address') + = f.submit t('.submit_user') %br %p %strong= link_to t('.change_password'), '#new_password_form', data: {toggle: "collapse"} diff --git a/config/locales/en.yml b/config/locales/en.yml index d3395633..3ae10a18 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -146,7 +146,7 @@ en: received: "%{time} received %{amount} for commit %{commit} in %{project}" bitcoin_address_placeholder: Your bitcoin address notify: Notify me about new tips (no more than one email per month) - submit_bitcoin_address: Update Bitcoin address + submit_user: Update user info change_password: Change your password submit_password: Change my password withdrawals: @@ -194,3 +194,4 @@ en: bitcoin_address: Bitcoin address password: Password password_confirmation: Password confirmation + display_name: Display name diff --git a/db/migrate/20140725054216_add_display_name_to_users.rb b/db/migrate/20140725054216_add_display_name_to_users.rb new file mode 100644 index 00000000..9e783036 --- /dev/null +++ b/db/migrate/20140725054216_add_display_name_to_users.rb @@ -0,0 +1,5 @@ +class AddDisplayNameToUsers < ActiveRecord::Migration + def change + add_column :users, :display_name, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 81ba432b..5a0eaaaf 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140722092532) do +ActiveRecord::Schema.define(version: 20140725054216) do create_table "collaborators", force: true do |t| t.integer "project_id" @@ -121,6 +121,7 @@ t.datetime "confirmation_sent_at" t.string "confirmation_token" t.string "unconfirmed_email" + t.string "display_name" end add_index "users", ["email"], name: "index_users_on_email", unique: true diff --git a/spec/mailers/user_mailer_spec.rb b/spec/mailers/user_mailer_spec.rb index ea39c905..6e21c8a7 100644 --- a/spec/mailers/user_mailer_spec.rb +++ b/spec/mailers/user_mailer_spec.rb @@ -2,7 +2,7 @@ describe UserMailer do describe 'new_tip' do - let(:user) { mock_model User, name: 'kd', email: 'kd.engineer@yahoo.co.in', full_name: 'kuldeep aggarwal', login_token: 'my login token', balance: 10 } + let(:user) { mock_model User, name: 'kd', email: 'kd.engineer@yahoo.co.in', display_name: 'kuldeep aggarwal', login_token: 'my login token', balance: 10 } let(:project) { mock_model Project, full_name: 'logger-extension' } let(:tip) { mock_model Tip, amount: 0.0001, project: project } let(:mail) { UserMailer.new_tip(user, tip) } @@ -19,8 +19,8 @@ expect(mail.from).to eq ['no-reply@tip4commit.com'] end - it 'assigns user\'s full_name' do - expect(mail.body.encoded).to match(user.full_name) + it 'assigns user\'s display_name' do + expect(mail.body.encoded).to match(user.display_name) end it 'assigns users\' balance' do diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 8f646a9f..c95a5918 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -6,21 +6,21 @@ describe 'full_name' do context 'when name is present' do it 'returns name' do - expect(user.full_name).to eq(user.name) + expect(user.display_name).to eq(user.name) end end context 'when name is absent and nickname is present' do it 'returns nickname' do user.name = nil - expect(user.full_name).to eq(user.nickname) + expect(user.display_name).to eq(user.nickname) end end context 'when name and nickname is absent and email is absent' do it 'returns email' do user.name = user.nickname = nil - expect(user.full_name).to eq(user.email) + expect(user.display_name).to eq(user.email) end end end From e7ca64ae86a241a0e7146d50c2eaec99f8e1f390 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 28 Jul 2014 21:40:43 +0800 Subject: [PATCH 003/415] rescued from Net::SMTPServerBusy --- app/models/tip.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/models/tip.rb b/app/models/tip.rb index b7594537..9a775e9b 100644 --- a/app/models/tip.rb +++ b/app/models/tip.rb @@ -108,8 +108,12 @@ def amount_percentage=(percentage) def notify_user if amount and amount > 0 and user.bitcoin_address.blank? and !user.unsubscribed if user.notified_at.nil? or user.notified_at < 30.days.ago - UserMailer.new_tip(user, self).deliver - user.touch :notified_at + begin + UserMailer.new_tip(user, self).deliver + user.touch :notified_at + rescue Net::SMTPServerBusy => e + Rails.logger.info "Error: #{e.class}: #{e.message}" + end end end end From d0a69b87bd37d856d3e32eedc52b19096c8561d4 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 4 Aug 2014 20:58:04 +0800 Subject: [PATCH 004/415] uses https in notification emails --- config/environments/production.rb | 1 + config/environments/test.rb | 2 +- spec/mailers/user_mailer_spec.rb | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index d1485d96..7dfac981 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -68,6 +68,7 @@ config.action_mailer.perform_deliveries = true config.action_mailer.raise_delivery_errors = true + config.action_mailer.default_url_options = { :host => 'tip4commit.com', :protocol => 'https' } config.action_mailer.default_options = {from: 'no-reply@' + CONFIG['smtp_settings']['domain'] } # Enable locale fallbacks for I18n (makes lookups for any locale fall back to diff --git a/config/environments/test.rb b/config/environments/test.rb index a696349d..359f1c92 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -31,7 +31,7 @@ # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test config.action_mailer.raise_delivery_errors = false - config.action_mailer.default_url_options = { :host => 'tip4commit.com' } + config.action_mailer.default_url_options = { :host => 'tip4commit.com', :protocol => 'https' } config.action_mailer.default_options = { from: 'no-reply@tip4commit.com' } # Print deprecation notices to the stderr. diff --git a/spec/mailers/user_mailer_spec.rb b/spec/mailers/user_mailer_spec.rb index 6e21c8a7..4b0f1308 100644 --- a/spec/mailers/user_mailer_spec.rb +++ b/spec/mailers/user_mailer_spec.rb @@ -26,5 +26,9 @@ it 'assigns users\' balance' do expect(mail.body.encoded).to match("Please, log in and tell us your bitcoin address to get it.

\r\n

Your current balance is 0.00000010 Ƀ") end + + it 'useses secure protocol for links' do + expect(mail.body.encoded).to match('https') + end end end From a8eb98a8719eba49a2f8f169180267d536af41d8 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 4 Aug 2014 21:46:18 +0800 Subject: [PATCH 005/415] temporarily proxying coingiving --- README.md | 4 ++-- app/assets/javascripts/application.js.coffee | 2 +- app/views/projects/show.html.haml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8fd3cf95..21fea313 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ Tip4commit ========== -[![tip for next commit](http://tip4commit.com/projects/307.svg)](http://tip4commit.com/projects/307) [![Build Status](https://travis-ci.org/tip4commit/tip4commit.png?branch=master)](https://travis-ci.org/tip4commit/tip4commit) +[![tip for next commit](https://tip4commit.com/projects/307.svg)](https://tip4commit.com/projects/307) [![Build Status](https://travis-ci.org/tip4commit/tip4commit.png?branch=master)](https://travis-ci.org/tip4commit/tip4commit) Donate bitcoins to open source projects or make commits and get tips for it. -Official site: http://tip4commit.com/ +Official site: https://tip4commit.com/ Forum thread: https://bitcointalk.org/index.php?topic=315802 diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee index 23595f33..a2a76b69 100644 --- a/app/assets/javascripts/application.js.coffee +++ b/app/assets/javascripts/application.js.coffee @@ -15,4 +15,4 @@ $(document).on "ready page:change", -> window.addthis_share = null # Finally, load addthis - $.getScript "http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-526425ac0ea0780b" + $.getScript "//s7.addthis.com/js/250/addthis_widget.js#pubid=ra-526425ac0ea0780b" diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 19a1ac34..95b1d908 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -18,7 +18,7 @@ .panel-heading %h4.panel-title= t('.project_sponsors') .panel-body - %iframe{ src: "http://coingiving.com/project_sponsors?url=#{project_url @project}", scrolling: "no", style: 'width:100%; height:500px; border:0px; padding:0;overflow:hidden'} + %iframe{ src: "/coingiving/project_sponsors?url=#{project_url @project}", scrolling: "no", style: 'width:100%; height:500px; border:0px; padding:0;overflow:hidden'} .hidden %span(data-coingiving="title")= "[tip4commit] " + @project.full_name %span(data-coingiving="description")= @project.description From e5066bc22f12f9de2c2fb9e3ca4ab75175409114 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Tue, 5 Aug 2014 12:29:33 +0800 Subject: [PATCH 006/415] attemp to use soingiving with self-signed certificate --- app/views/projects/show.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 95b1d908..3ac725a8 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -18,7 +18,7 @@ .panel-heading %h4.panel-title= t('.project_sponsors') .panel-body - %iframe{ src: "/coingiving/project_sponsors?url=#{project_url @project}", scrolling: "no", style: 'width:100%; height:500px; border:0px; padding:0;overflow:hidden'} + %iframe{ src: "//coingiving.com/project_sponsors?url=#{project_url @project}", scrolling: "no", style: 'width:100%; height:500px; border:0px; padding:0;overflow:hidden'} .hidden %span(data-coingiving="title")= "[tip4commit] " + @project.full_name %span(data-coingiving="description")= @project.description From b60cf08fcfd6fcf7b828fd3b2c6eab066c79fc76 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Thu, 7 Aug 2014 09:18:01 +0800 Subject: [PATCH 007/415] always use https project url --- app/views/projects/show.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 3ac725a8..1c7194f9 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -18,7 +18,7 @@ .panel-heading %h4.panel-title= t('.project_sponsors') .panel-body - %iframe{ src: "//coingiving.com/project_sponsors?url=#{project_url @project}", scrolling: "no", style: 'width:100%; height:500px; border:0px; padding:0;overflow:hidden'} + %iframe{ src: "//coingiving.com/?url=#{project_url(@project, :protocol => 'https')}", scrolling: "no", style: 'width:100%; height:500px; border:0px; padding:0;overflow:hidden'} .hidden %span(data-coingiving="title")= "[tip4commit] " + @project.full_name %span(data-coingiving="description")= @project.description From 203e1be924a70db051f3816ffe07a89d8e3b444e Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Thu, 7 Aug 2014 09:22:53 +0800 Subject: [PATCH 008/415] fixed url --- app/views/projects/show.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 1c7194f9..62e385ed 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -18,7 +18,7 @@ .panel-heading %h4.panel-title= t('.project_sponsors') .panel-body - %iframe{ src: "//coingiving.com/?url=#{project_url(@project, :protocol => 'https')}", scrolling: "no", style: 'width:100%; height:500px; border:0px; padding:0;overflow:hidden'} + %iframe{ src: "//coingiving.com/project_sponsors?url=#{project_url(@project, :protocol => 'https')}", scrolling: "no", style: 'width:100%; height:500px; border:0px; padding:0;overflow:hidden'} .hidden %span(data-coingiving="title")= "[tip4commit] " + @project.full_name %span(data-coingiving="description")= @project.description From e908efd3026b16829e98288b5f88ba4b45b4b6d3 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Thu, 7 Aug 2014 11:18:19 +0800 Subject: [PATCH 009/415] added project deposits page --- app/assets/javascripts/deposits.js.coffee | 3 +++ app/assets/stylesheets/deposits.css.scss | 3 +++ app/controllers/deposits_controller.rb | 17 ++++++++++++ app/helpers/deposits_helper.rb | 2 ++ app/models/deposit.rb | 9 +++++++ app/models/project.rb | 4 +-- app/views/deposits/index.html.haml | 28 ++++++++++++++++++++ app/views/projects/show.html.haml | 7 +++-- config/locales/en.yml | 14 +++++++++- config/routes.rb | 2 ++ features/step_definitions/common.rb | 2 +- spec/controllers/deposits_controller_spec.rb | 12 +++++++++ 12 files changed, 97 insertions(+), 6 deletions(-) create mode 100644 app/assets/javascripts/deposits.js.coffee create mode 100644 app/assets/stylesheets/deposits.css.scss create mode 100644 app/controllers/deposits_controller.rb create mode 100644 app/helpers/deposits_helper.rb create mode 100644 app/views/deposits/index.html.haml create mode 100644 spec/controllers/deposits_controller_spec.rb diff --git a/app/assets/javascripts/deposits.js.coffee b/app/assets/javascripts/deposits.js.coffee new file mode 100644 index 00000000..24f83d18 --- /dev/null +++ b/app/assets/javascripts/deposits.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/stylesheets/deposits.css.scss b/app/assets/stylesheets/deposits.css.scss new file mode 100644 index 00000000..a47ad02e --- /dev/null +++ b/app/assets/stylesheets/deposits.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Deposits controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/deposits_controller.rb b/app/controllers/deposits_controller.rb new file mode 100644 index 00000000..2305f7fc --- /dev/null +++ b/app/controllers/deposits_controller.rb @@ -0,0 +1,17 @@ +class DepositsController < ApplicationController + before_action :load_project + + def index + if params[:project_id] + @deposits = @project.deposits.order(created_at: :desc).page(params[:page]).per(30) + else + @deposits = Deposit.includes(:project).order(created_at: :desc).page(params[:page]).per(30) + end + end + + private + + def load_project + super(params[:project_id]) if params[:project_id].present? + end +end diff --git a/app/helpers/deposits_helper.rb b/app/helpers/deposits_helper.rb new file mode 100644 index 00000000..3cf0cb4a --- /dev/null +++ b/app/helpers/deposits_helper.rb @@ -0,0 +1,2 @@ +module DepositsHelper +end diff --git a/app/models/deposit.rb b/app/models/deposit.rb index 6dd62b74..79830947 100644 --- a/app/models/deposit.rb +++ b/app/models/deposit.rb @@ -1,6 +1,15 @@ class Deposit < ActiveRecord::Base belongs_to :project + CONFIRMATIONS_NEEDED = 2 + + scope :confirmed, -> { where("confirmations >= #{CONFIRMATIONS_NEEDED}") } + scope :unconfirmed, -> { where("confirmations < #{CONFIRMATIONS_NEEDED}") } + + def confirmed? + confirmations.to_i >= CONFIRMATIONS_NEEDED + end + def fee (amount * fee_size).to_i end diff --git a/app/models/project.rb b/app/models/project.rb index a5f93ba9..b9cfa394 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -126,7 +126,7 @@ def tip_for commit end def donated - self.deposits.where("confirmations > 0").map(&:available_amount).sum + self.deposits.confirmed.map(&:available_amount).sum end def available_amount @@ -134,7 +134,7 @@ def available_amount end def unconfirmed_amount - self.deposits.where(:confirmations => 0).where('created_at > ?', 7.days.ago).map(&:available_amount).sum + self.deposits.unconfirmed.where('created_at > ?', 7.days.ago).map(&:available_amount).sum end def tips_paid_amount diff --git a/app/views/deposits/index.html.haml b/app/views/deposits/index.html.haml new file mode 100644 index 00000000..07e9da27 --- /dev/null +++ b/app/views/deposits/index.html.haml @@ -0,0 +1,28 @@ +%h1 + - if @project + = raw t('.project_deposits', project: link_to(@project.full_name, pretty_project_path(@project))) + - else + = t('.deposits') +%p + %table.table + %thead + %tr + %th= t('.created_at') + - unless @project + %th= t('.project') + %th= t('.amount') + %th= t('.fee') + %th= t('.transaction') + %th= t('.confirmed') + %tbody + - @deposits.each do |deposit| + %tr + %td= l deposit.created_at, format: :short + - unless @project + %td= link_to(deposit.project.full_name, deposit.project) + %td= btc_human deposit.amount + %td= btc_human deposit.fee + %td= link_to deposit.txid, "https://blockchain.info/tx/#{deposit.txid}", target: :blank + %td= deposit.confirmed? ? t('.confirmed_yes') : t('.confirmed_no') + + = paginate @deposits diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 62e385ed..9cc1b089 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -27,7 +27,10 @@ .col-md-8 - unless @project.description.blank? .well.well-sm= @project.description - %h4= t('.balance') + %h4 + = t('.balance') + - if @project.deposits.count > 0 + %small= link_to t('.deposits'), project_deposits_path(@project) = btc_human @project.available_amount - if @project.hold_tips? = t('.custom_tip_size') @@ -58,7 +61,7 @@ %h4 =t('.last_tips') - if @project_tips.count > 5 - = link_to t('.see_all'), project_tips_path(@project) + %small= link_to t('.see_all'), project_tips_path(@project) %ul - @recent_tips.each do |tip| %li diff --git a/config/locales/en.yml b/config/locales/en.yml index 3ae10a18..cc3a95f8 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -81,6 +81,7 @@ en: project_sponsors: Project Sponsors fee: "%{percentage} of deposited funds will be used to tip for new commits." balance: Balance + deposits: deposits custom_tip_size: (each new commit receives a percentage of available balance) default_tip_size: "(each new commit receives %{percentage} of available balance)" unconfirmed_amount: "(%{amount} unconfirmed)" @@ -120,7 +121,7 @@ en: tips: index: tips: Tips - project_tips: "%{project} tips" + project_tips: '%{project} tips' user_tips: "%{user} tips" created_at: Created At commiter: Commiter @@ -133,6 +134,17 @@ en: below_threshold: "User's balance is below withdrawal threshold" waiting: Waiting for withdrawal error: (error sending transaction) + deposits: + index: + project_deposits: '%{project} deposits' + deposits: Deposits + created_at: Created At + project: Project + amount: Amount + transaction: Transaction + confirmed: Confirmed + confirmed_yes: 'Yes' + confirmed_no: 'No' users: index: title: Top Contributors diff --git a/config/routes.rb b/config/routes.rb index e11e8e36..f2f3be29 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -26,8 +26,10 @@ patch :decide_tip_amounts end resources :tips, :only => [:index] + resources :deposits, :only => [:index] end resources :tips, :only => [:index] + resources :deposits, :only => [:index] resources :withdrawals, :only => [:index] # The priority is based upon order of creation: first created -> highest priority. diff --git a/features/step_definitions/common.rb b/features/step_definitions/common.rb index 3f963502..633b40ec 100644 --- a/features/step_definitions/common.rb +++ b/features/step_definitions/common.rb @@ -27,7 +27,7 @@ end Given(/^a deposit of "(.*?)"$/) do |arg1| - Deposit.create!(project: @project, amount: arg1.to_d * 1e8, confirmations: 1) + Deposit.create!(project: @project, amount: arg1.to_d * 1e8, confirmations: 2) end Given(/^the last known commit is "(.*?)"$/) do |arg1| diff --git a/spec/controllers/deposits_controller_spec.rb b/spec/controllers/deposits_controller_spec.rb new file mode 100644 index 00000000..3180085e --- /dev/null +++ b/spec/controllers/deposits_controller_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +describe DepositsController do + + describe "GET 'index'" do + it "returns http success" do + get 'index' + expect(response).to be_success + end + end + +end From 2cec4643e237685ac3b662e5ddc0a6ec5f4afd90 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 11 Aug 2014 11:15:14 +0800 Subject: [PATCH 010/415] send transaction only if there are more than 2 users are waiting for withdrawals --- lib/bitcoin_tipper.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/bitcoin_tipper.rb b/lib/bitcoin_tipper.rb index c3a3d646..f9f215dd 100644 --- a/lib/bitcoin_tipper.rb +++ b/lib/bitcoin_tipper.rb @@ -23,15 +23,15 @@ def self.work withdraw = true if withdraw Rails.logger.info "Traversing users..." - is_sendmany_needed = false + users_waiting_for_withdrawal = 0 User.find_each do |user| if user.bitcoin_address.present? && user.balance > CONFIG["min_payout"] - is_sendmany_needed = true + users_waiting_for_withdrawal += 1 Rails.logger.info "Sendmany is needed" end end - self.create_sendmany if is_sendmany_needed + self.create_sendmany if users_waiting_for_withdrawal > 2 Rails.logger.info "Traversing sendmanies..." Sendmany.where(txid: nil).each do |sendmany| From 5e5cfb0047f25b387fa04338a3ede5a611719ca9 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 11 Aug 2014 11:38:47 +0800 Subject: [PATCH 011/415] configure pages count for specific repositories --- app/services/github.rb | 3 ++- config/config.yml.sample | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/services/github.rb b/app/services/github.rb index 1f03ed94..08fdd84b 100644 --- a/app/services/github.rb +++ b/app/services/github.rb @@ -15,7 +15,8 @@ def commits project commits = client.commits project.full_name last_response = client.last_response - (CONFIG['github']['pages'].to_i - 1).times do + pages = (CONFIG['github']['project_pages'][project.full_name] || CONFIG['github']['pages'] || 1).to_i + (pages - 1).times do if last_response.rels[:next] last_response = last_response.rels[:next].get commits += last_response.data diff --git a/config/config.yml.sample b/config/config.yml.sample index 71b5ee55..6d292b47 100644 --- a/config/config.yml.sample +++ b/config/config.yml.sample @@ -2,7 +2,9 @@ github: key: "111111111111" secret: "111111111111" auto_paginate: false - pages: 1 + pages: 3 + project_pages: + "torvalds/linux": 30 blockchain_info: guid: "111111111111" From 049521bd9d0687a00760db303c3a8e2ab0635540 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 11 Aug 2014 11:49:11 +0800 Subject: [PATCH 012/415] typo --- lib/bitcoin_tipper.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/bitcoin_tipper.rb b/lib/bitcoin_tipper.rb index f9f215dd..0c61921a 100644 --- a/lib/bitcoin_tipper.rb +++ b/lib/bitcoin_tipper.rb @@ -27,11 +27,13 @@ def self.work withdraw = true User.find_each do |user| if user.bitcoin_address.present? && user.balance > CONFIG["min_payout"] users_waiting_for_withdrawal += 1 - Rails.logger.info "Sendmany is needed" + Rails.logger.info "User ##{user.id} is waiting for withdrawal" end end - self.create_sendmany if users_waiting_for_withdrawal > 2 + if users_waiting_for_withdrawal > 2 + self.create_sendmany + end Rails.logger.info "Traversing sendmanies..." Sendmany.where(txid: nil).each do |sendmany| From a6cb942f2f2cee3a4369e3fcbbb8c723bd8473d3 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 11 Aug 2014 17:41:08 +0800 Subject: [PATCH 013/415] refacotred project creation and added search --- Gemfile | 1 + Gemfile.lock | 6 +++ app/controllers/projects_controller.rb | 21 +++------- app/models/project.rb | 18 +++++++++ app/services/github.rb | 29 ++++++++++++-- app/views/projects/index.html.haml | 53 ++++++++++++++------------ config/routes.rb | 3 +- 7 files changed, 87 insertions(+), 44 deletions(-) diff --git a/Gemfile b/Gemfile index ec2ef4b3..976f7d06 100644 --- a/Gemfile +++ b/Gemfile @@ -27,6 +27,7 @@ gem 'bootstrap_form', github: 'sigmike/rails-bootstrap-forms', branch: 'removed_ gem 'sdoc', group: :doc, require: false gem 'cancancan' gem "i18n-js" +gem 'dusen' group :development do gem 'capistrano', '~> 3.0.1' diff --git a/Gemfile.lock b/Gemfile.lock index 06a8a32d..10d196ef 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -127,6 +127,11 @@ GEM thread_safe (~> 0.1) warden (~> 1.2.3) diff-lcs (1.2.5) + dusen (0.4.10) + activerecord + edge_rider (>= 0.2.5) + edge_rider (0.3.0) + activerecord erubis (2.7.0) execjs (2.0.2) factory_girl (4.3.0) @@ -313,6 +318,7 @@ DEPENDENCIES database_cleaner debugger (~> 1.6.5) devise (~> 3.2.2) + dusen factory_girl_rails (~> 4.3.0) haml-rails (~> 0.5.3) i18n-js diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 29e6f4ab..4e57506c 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -79,21 +79,12 @@ def decide_tip_amounts end end - def create - project_name = params[:full_name]. - gsub(/https?\:\/\/github.com\//, ''). - gsub(/\#.+$/, ''). - gsub(' ', '') - client = Octokit::Client.new \ - :client_id => CONFIG['github']['key'], - :client_secret => CONFIG['github']['secret'] - begin - repo = client.repo project_name - @project = Project.find_or_create_by host: "github", full_name: repo.full_name - @project.update_repository_info repo - redirect_to pretty_project_path(@project) - rescue Octokit::NotFound - redirect_to projects_path, alert: I18n.t('errors.project_not_found') + def search + if project = Project.find_or_create_by_url(params[:query]) + redirect_to project + else + @projects = Project.search(params[:query]).page(params[:page]).per(30) + render :index end end diff --git a/app/models/project.rb b/app/models/project.rb index b9cfa394..c7e99b57 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -10,6 +10,13 @@ class Project < ActiveRecord::Base validates :full_name, :github_id, uniqueness: true, presence: true validates :host, inclusion: [ "github", "bitbucket" ], presence: true + search_syntax do + search_by :text do |scope, phrases| + columns = [:full_name, :host, :description, :language] + scope.where_like(columns => phrases) + end + end + # before_save :check_tips_to_pay_against_avaiable_amount def update_repository_info repo @@ -188,4 +195,15 @@ def check_tips_to_pay_against_avaiable_amount raise "Not enough funds to pay the pending tips on #{inspect} (#{available_amount} < 0)" end end + + def self.find_or_create_by_url project_url + + project_name = project_url. + gsub(/https?\:\/\/github.com\//, ''). + gsub(/\#.+$/, ''). + gsub(' ', '') + + Github.new.find_or_create_project project_name + + end end diff --git a/app/services/github.rb b/app/services/github.rb index 08fdd84b..aab9a1fe 100644 --- a/app/services/github.rb +++ b/app/services/github.rb @@ -27,10 +27,33 @@ def commits project end def repository_info project - if project.github_id.present? - client.get "/repositories/#{project.github_id}" + if project.is_a?(String) + client.repo project + elsif project.is_a?(Project) + if project.github_id.present? + client.get "/repositories/#{project.github_id}" + else + client.repo project.full_name + end + else + raise 'Unknown parameter class' + end + end + + def find_or_create_project project_name + if project = Project.find_by(host: "github", full_name: project_name) + project + elsif project_name =~ /\w+\/\w+/ + begin + repo = repository_info project_name + project = Project.find_or_create_by host: "github", full_name: repo.full_name + project.update_repository_info repo + project + rescue Octokit::NotFound + nil + end else - client.repo project.full_name + nil end end diff --git a/app/views/projects/index.html.haml b/app/views/projects/index.html.haml index 5d5a5478..d34bd927 100644 --- a/app/views/projects/index.html.haml +++ b/app/views/projects/index.html.haml @@ -1,34 +1,37 @@ %h1= t('menu.projects') %p - = form_tag projects_path, role: 'form', method: :post do |f| + = form_tag search_projects_path, role: 'form', method: :post do |f| .form-group .row .col-lg-10 - = text_field_tag :full_name, '', class: 'form-control', placeholder: t('.find_project.placeholder') + = text_field_tag :query, '', class: 'form-control', placeholder: t('.find_project.placeholder'), :value => params[:query] .col-lg-2 = button_tag t('.find_project.button'), class: "btn form-control btn-default" %p - %table.table - %thead - %tr - %th= t('.repository') - %th= t('.description') - %th= link_to_unless_current t('.watchers'), by_watchers_projects_path - %th= link_to_unless_current t('.balance'), projects_path - %th - %tbody - - @projects.each do |project| + - if @projects.count > 0 + %table.table + %thead %tr - %td - %strong= link_to project.full_name, pretty_project_path(project) - - if !project.source_full_name.blank? - %br - %nobr - %small - = t('.forked_from') - = link_to project.source_full_name, project.source_github_url, target: '_blank' - %td= project.description - %td= project.watchers_count - %td= btc_human project.available_amount_cache - %td= link_to t('.support'), pretty_project_path(project), class: 'btn btn-success' - = paginate @projects + %th= t('.repository') + %th= t('.description') + %th= link_to_unless_current t('.watchers'), by_watchers_projects_path + %th= link_to_unless_current t('.balance'), projects_path + %th + %tbody + - @projects.each do |project| + %tr + %td + %strong= link_to project.full_name, pretty_project_path(project) + - if !project.source_full_name.blank? + %br + %nobr + %small + = t('.forked_from') + = link_to project.source_full_name, project.source_github_url, target: '_blank' + %td= project.description + %td= project.watchers_count + %td= btc_human project.available_amount_cache + %td= link_to t('.support'), pretty_project_path(project), class: 'btn btn-success' + = paginate @projects + - else + .alert.alert-warning{role: 'alert'}= I18n.t('errors.project_not_found') diff --git a/config/routes.rb b/config/routes.rb index f2f3be29..86e37e4f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -17,9 +17,10 @@ end resources :tips, :only => [:index] end - resources :projects, :only => [:show, :index, :create, :edit, :update] do + resources :projects, :only => [:show, :index, :edit, :update] do collection do get 'by_watchers' + post 'search' end member do get :decide_tip_amounts From d55c351e6a9b7cc5286f480b952c7b95091aef00 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 11 Aug 2014 19:53:45 +0800 Subject: [PATCH 014/415] improved project search and sorting --- app/controllers/projects_controller.rb | 30 +++++++++++++++----------- app/views/deposits/index.html.haml | 2 +- app/views/projects/index.html.haml | 13 +++++------ app/views/tips/index.html.haml | 2 +- config/locales/en.yml | 2 +- config/routes.rb | 3 +-- 6 files changed, 28 insertions(+), 24 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 4e57506c..209162d7 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -5,12 +5,16 @@ class ProjectsController < ApplicationController before_filter :load_project, only: [:show, :edit, :update, :decide_tip_amounts] def index - @projects = Project.order(available_amount_cache: :desc, watchers_count: :desc, full_name: :asc).page(params[:page]).per(30) + @projects = Project.order(projects_order).page(params[:page]).per(30) end - def by_watchers - @projects = Project.order(watchers_count: :desc, available_amount_cache: :desc, full_name: :asc).page(params[:page]).per(30) - render "index" + def search + if project = Project.find_or_create_by_url(params[:query]) + redirect_to pretty_project_path(project) + else + @projects = Project.search(params[:query]).order(projects_order).page(params[:page]).per(30) + render :index + end end # Redirect to pretty url for html format @@ -79,15 +83,6 @@ def decide_tip_amounts end end - def search - if project = Project.find_or_create_by_url(params[:query]) - redirect_to project - else - @projects = Project.search(params[:query]).page(params[:page]).per(30) - render :index - end - end - private def load_project @@ -104,4 +99,13 @@ def load_project def project_params params.require(:project).permit(:hold_tips, tipping_policies_text_attributes: [:text]) end + + def projects_order + { + 'balance' => {available_amount_cache: :desc, watchers_count: :desc, full_name: :asc}, + 'watchers' => {watchers_count: :desc, available_amount_cache: :desc, full_name: :asc}, + 'repository' => {full_name: :asc, available_amount_cache: :desc, watchers_count: :desc}, + 'description' => {description: :desc, available_amount_cache: :desc, watchers_count: :desc, full_name: :asc} + }.[](params[:order] || 'balance') + end end diff --git a/app/views/deposits/index.html.haml b/app/views/deposits/index.html.haml index 07e9da27..d179cb56 100644 --- a/app/views/deposits/index.html.haml +++ b/app/views/deposits/index.html.haml @@ -19,7 +19,7 @@ %tr %td= l deposit.created_at, format: :short - unless @project - %td= link_to(deposit.project.full_name, deposit.project) + %td= link_to(deposit.project.full_name, pretty_project_path(deposit.project)) %td= btc_human deposit.amount %td= btc_human deposit.fee %td= link_to deposit.txid, "https://blockchain.info/tx/#{deposit.txid}", target: :blank diff --git a/app/views/projects/index.html.haml b/app/views/projects/index.html.haml index d34bd927..a61bcfe2 100644 --- a/app/views/projects/index.html.haml +++ b/app/views/projects/index.html.haml @@ -1,21 +1,22 @@ %h1= t('menu.projects') %p - = form_tag search_projects_path, role: 'form', method: :post do |f| + = form_tag search_projects_path, role: 'form', method: :get do |f| .form-group .row .col-lg-10 = text_field_tag :query, '', class: 'form-control', placeholder: t('.find_project.placeholder'), :value => params[:query] + = hidden_field_tag :order, params[:order] || 'balance' .col-lg-2 - = button_tag t('.find_project.button'), class: "btn form-control btn-default" + = button_tag t('.find_project.button'), class: "btn form-control btn-default", name: nil %p - if @projects.count > 0 %table.table %thead %tr - %th= t('.repository') - %th= t('.description') - %th= link_to_unless_current t('.watchers'), by_watchers_projects_path - %th= link_to_unless_current t('.balance'), projects_path + %th= link_to_unless_current t('.repository'), params.merge(:order => 'repository') + %th= link_to_unless_current t('.description'), params.merge(:order => 'description') + %th= link_to_unless_current t('.watchers'), params.merge(:order => 'watchers') + %th= link_to_unless params[:order].blank? || params[:order] == 'balance', t('.balance'), params.merge(:order => 'balance') %th %tbody - @projects.each do |project| diff --git a/app/views/tips/index.html.haml b/app/views/tips/index.html.haml index 3d5b5082..a7ab46b7 100644 --- a/app/views/tips/index.html.haml +++ b/app/views/tips/index.html.haml @@ -28,7 +28,7 @@ - else = link_to tip.user.display_name, "https://github.com/#{tip.user.nickname}", target: '_blank' - unless @project - %td= link_to tip.project.full_name, tip.project + %td= link_to tip.project.full_name, pretty_project_path(tip.project) %td= link_to tip.commit[0..6], "https://github.com/#{tip.project.full_name}/commit/#{tip.commit}", target: :blank %td= btc_human tip.amount %td diff --git a/config/locales/en.yml b/config/locales/en.yml index cc3a95f8..168c31e3 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -66,7 +66,7 @@ en: projects: index: find_project: - placeholder: Enter GitHub project URL to find or add a project e.g. rails/rails + placeholder: Enter GitHub project URL to add a project or any keyword to find it... button: Find or add project repository: Repository description: Description diff --git a/config/routes.rb b/config/routes.rb index 86e37e4f..16cdf7ad 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -19,8 +19,7 @@ end resources :projects, :only => [:show, :index, :edit, :update] do collection do - get 'by_watchers' - post 'search' + get 'search' end member do get :decide_tip_amounts From e8f124841ef8d78a5dbd5a86bdc2a9616309f922 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 11 Aug 2014 22:18:16 +0800 Subject: [PATCH 015/415] fixed sort order --- app/controllers/projects_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 209162d7..1944e6c9 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -105,7 +105,7 @@ def projects_order 'balance' => {available_amount_cache: :desc, watchers_count: :desc, full_name: :asc}, 'watchers' => {watchers_count: :desc, available_amount_cache: :desc, full_name: :asc}, 'repository' => {full_name: :asc, available_amount_cache: :desc, watchers_count: :desc}, - 'description' => {description: :desc, available_amount_cache: :desc, watchers_count: :desc, full_name: :asc} + 'description' => {description: :asc, available_amount_cache: :desc, watchers_count: :desc, full_name: :asc} }.[](params[:order] || 'balance') end end From ac6b1a72bae68bdcffaa2dd8d9c9e39e69b42e91 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 16 Aug 2014 11:14:01 +0700 Subject: [PATCH 016/415] don't create duplicate users if github email has been changed --- app/controllers/users/omniauth_callbacks_controller.rb | 7 ++++++- app/models/user.rb | 6 ++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb index 07231a8c..ebefbc65 100644 --- a/app/controllers/users/omniauth_callbacks_controller.rb +++ b/app/controllers/users/omniauth_callbacks_controller.rb @@ -5,7 +5,12 @@ def github @user = User.find_by(nickname: @omniauth_info.nickname) || User.find_by(email: @omniauth_info.verified_emails) - if @user.blank? + if @user.present? + if @omniauth_info.primary_email.present? && @user.email != @omniauth_info.primary_email + # update email if it has been changed + @user.update email: @omniauth_info.primary_email + end + else # user not found if @omniauth_info.primary_email.present? @user = User.create_with_omniauth!(@omniauth_info) else diff --git a/app/models/user.rb b/app/models/user.rb index 915dd0ff..90ec7df1 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -52,11 +52,13 @@ def self.create_with_omniauth!(auth_info) def self.find_or_create_with_commit commit author = commit.commit.author - where(email: author.email).first_or_create do |user| + nickname = commit.author.try(:login) + user = find_by(nickname: nickname) if nickname + user || where(email: author.email).first_or_create do |user| user.email = author.email user.password = Devise.friendly_token.first(Devise.password_length.min) user.name = author.name - user.nickname = commit.author.try(:login) + user.nickname = nickname user.skip_confirmation! end end From fa678df3ce2805f0a907ad631f5ec6b6e835945e Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 16 Aug 2014 11:45:31 +0700 Subject: [PATCH 017/415] fixed nil query param error --- app/controllers/projects_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 1944e6c9..4a4fece2 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -9,10 +9,10 @@ def index end def search - if project = Project.find_or_create_by_url(params[:query]) + if params[:query].present? && project = Project.find_or_create_by_url(params[:query]) redirect_to pretty_project_path(project) else - @projects = Project.search(params[:query]).order(projects_order).page(params[:page]).per(30) + @projects = Project.search(params[:query].to_s).order(projects_order).page(params[:page]).per(30) render :index end end From dedc43da18a66d2d112f31ae6971dd02514700bc Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 16 Aug 2014 13:48:18 +0700 Subject: [PATCH 018/415] removed unused fields --- db/migrate/20140816062159_remove_paid_out_from_deposits.rb | 6 ++++++ db/schema.rb | 4 +--- 2 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20140816062159_remove_paid_out_from_deposits.rb diff --git a/db/migrate/20140816062159_remove_paid_out_from_deposits.rb b/db/migrate/20140816062159_remove_paid_out_from_deposits.rb new file mode 100644 index 00000000..b7726e56 --- /dev/null +++ b/db/migrate/20140816062159_remove_paid_out_from_deposits.rb @@ -0,0 +1,6 @@ +class RemovePaidOutFromDeposits < ActiveRecord::Migration + def change + remove_column :deposits, :paid_out, :integer, :limit => 8 + remove_column :deposits, :paid_out_at, :datetime + end +end diff --git a/db/schema.rb b/db/schema.rb index 5a0eaaaf..76d556ec 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140725054216) do +ActiveRecord::Schema.define(version: 20140816062159) do create_table "collaborators", force: true do |t| t.integer "project_id" @@ -26,8 +26,6 @@ t.integer "project_id" t.string "txid" t.integer "confirmations" - t.integer "paid_out", limit: 8 - t.datetime "paid_out_at" t.datetime "created_at" t.datetime "updated_at" t.integer "amount", limit: 8 From 05affae642a673363da76467aa4acba19e726726 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 16 Aug 2014 13:48:39 +0700 Subject: [PATCH 019/415] addded tips and deposits csv export --- Gemfile | 1 + Gemfile.lock | 3 +++ app/controllers/deposits_controller.rb | 11 +++++++++-- app/controllers/home_controller.rb | 4 +--- app/controllers/tips_controller.rb | 11 ++++++++--- app/models/deposit.rb | 4 ++++ app/models/project.rb | 2 +- app/models/tip.rb | 19 +++++++++++++++++++ 8 files changed, 46 insertions(+), 9 deletions(-) diff --git a/Gemfile b/Gemfile index 976f7d06..6aea2ac1 100644 --- a/Gemfile +++ b/Gemfile @@ -28,6 +28,7 @@ gem 'sdoc', group: :doc, require: false gem 'cancancan' gem "i18n-js" gem 'dusen' +gem 'render_csv' group :development do gem 'capistrano', '~> 3.0.1' diff --git a/Gemfile.lock b/Gemfile.lock index 10d196ef..37602497 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -228,6 +228,8 @@ GEM rdoc (4.1.1) json (~> 1.4) ref (1.0.5) + render_csv (2.0.0) + rails (>= 3.0) rspec-collection_matchers (0.0.2) rspec-expectations (>= 2.99.0.beta1) rspec-core (3.0.0.beta1) @@ -332,6 +334,7 @@ DEPENDENCIES omniauth (~> 1.1.4) omniauth-github! rails (= 4.0.2) + render_csv rspec-rails (~> 3.0.0.beta) sass-rails (~> 4.0.0) sawyer (~> 0.5.2) diff --git a/app/controllers/deposits_controller.rb b/app/controllers/deposits_controller.rb index 2305f7fc..67a2b25c 100644 --- a/app/controllers/deposits_controller.rb +++ b/app/controllers/deposits_controller.rb @@ -3,9 +3,16 @@ class DepositsController < ApplicationController def index if params[:project_id] - @deposits = @project.deposits.order(created_at: :desc).page(params[:page]).per(30) + @deposits = @project.deposits else - @deposits = Deposit.includes(:project).order(created_at: :desc).page(params[:page]).per(30) + @deposits = Deposit.includes(:project) + end + @deposits = @deposits.order(created_at: :desc). + page(params[:page]). + per(params[:per_page] || 30) + respond_to do |format| + format.html + format.csv { render csv: @deposits, except: [:updated_at, :confirmations, :fee_size], add_methods: [:project_name, :fee, :confirmed?] } end end diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 220a14e3..2b145420 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -42,9 +42,7 @@ def blockchain_info_callback project_id: project.id, txid: params[:transaction_hash], confirmations: params[:confirmations], - amount: params[:value].to_i, - paid_out: 0, - paid_out_at: Time.now + amount: params[:value].to_i }) project.update_cache end diff --git a/app/controllers/tips_controller.rb b/app/controllers/tips_controller.rb index 14cfed58..8fc4670b 100644 --- a/app/controllers/tips_controller.rb +++ b/app/controllers/tips_controller.rb @@ -4,11 +4,16 @@ class TipsController < ApplicationController def index if params[:project_id] - @tips = @project.tips.includes(:user).order(created_at: :desc).page(params[:page]).per(30) + @tips = @project.tips.includes(:user) elsif params[:user_id] && @user = User.find(params[:user_id]) - @tips = @user.tips.includes(:project).order(created_at: :desc).page(params[:page]).per(30) + @tips = @user.tips.includes(:project) else - @tips = Tip.includes(:user, :project).order(created_at: :desc).page(params[:page]).per(30) + @tips = Tip.includes(:user, :project) + end + @tips = @tips.order(created_at: :desc).page(params[:page]).per(30) + respond_to do |format| + format.html + format.csv { render csv: @tips, except: [:updated_at, :commit, :commit_message, :refunded_at, :decided_at], add_methods: [:user_name, :project_name, :decided?, :claimed?, :paid?, :refunded?, :txid] } end end diff --git a/app/models/deposit.rb b/app/models/deposit.rb index 79830947..5891a98a 100644 --- a/app/models/deposit.rb +++ b/app/models/deposit.rb @@ -22,4 +22,8 @@ def available_amount self.fee_size = CONFIG["our_fee"] end + def project_name + project.full_name + end + end diff --git a/app/models/project.rb b/app/models/project.rb index c7e99b57..1a057929 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1,5 +1,5 @@ class Project < ActiveRecord::Base - has_many :deposits # todo: only confirmed deposits that have amount > paid_out + has_many :deposits # todo: only confirmed deposits has_many :tips, inverse_of: :project accepts_nested_attributes_for :tips has_many :collaborators, autosave: true diff --git a/app/models/tip.rb b/app/models/tip.rb index 9a775e9b..d0c67bb9 100644 --- a/app/models/tip.rb +++ b/app/models/tip.rb @@ -54,6 +54,12 @@ def non_refunded? scope :unclaimed, -> { joins(:user). unpaid. where('users.bitcoin_address' => ['', nil]) } + def claimed? + paid? || user.bitcoin_address.present? + end + def unclaimed? + !claimed? + end scope :with_address, -> { joins(:user).where.not('users.bitcoin_address' => ['', nil]) } def with_address? @@ -135,4 +141,17 @@ def check_amount_against_project def touch_decided_at_if_decided self.decided_at = Time.now if amount_changed? && decided? end + + def project_name + project.full_name + end + + def user_name + user.display_name + end + + def txid + try(:sendmany).try(:txid) + end + end From da204f14c21f5abc838be6e8dc3a7712f3c6fee7 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 16 Aug 2014 13:50:49 +0700 Subject: [PATCH 020/415] fixed factory --- spec/factories/deposit.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/factories/deposit.rb b/spec/factories/deposit.rb index e9f2ca10..e76681b0 100644 --- a/spec/factories/deposit.rb +++ b/spec/factories/deposit.rb @@ -3,8 +3,6 @@ association :project txid "txid" confirmations 1 - paid_out 1 - paid_out_at "2013-10-19 23:01:22" amount 100 end end From 74e8dbd42699ec5f393c1c29c9844f6506b9395f Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 16 Aug 2014 14:50:20 +0700 Subject: [PATCH 021/415] fixed pagination #99 --- app/controllers/tips_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/tips_controller.rb b/app/controllers/tips_controller.rb index 8fc4670b..99a91dfa 100644 --- a/app/controllers/tips_controller.rb +++ b/app/controllers/tips_controller.rb @@ -10,7 +10,9 @@ def index else @tips = Tip.includes(:user, :project) end - @tips = @tips.order(created_at: :desc).page(params[:page]).per(30) + @tips = @tips.order(created_at: :desc). + page(params[:page]). + per(params[:per_page] || 30) respond_to do |format| format.html format.csv { render csv: @tips, except: [:updated_at, :commit, :commit_message, :refunded_at, :decided_at], add_methods: [:user_name, :project_name, :decided?, :claimed?, :paid?, :refunded?, :txid] } From 1dc8b49203211b3ad76ae529c23e48ab40e98c1e Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Wed, 20 Aug 2014 09:05:56 +0700 Subject: [PATCH 022/415] fixed sign in link #101 --- app/views/projects/show.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 9cc1b089..91123fdc 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -90,7 +90,7 @@ - if current_user.bitcoin_address.blank? = raw t('.tell_us_bitcoin_address', tell_us_link: link_to(t('.tell_us_link'), current_user)) - else - = t('.sign_in', sign_in_link: link_to(new_user_session_path, t('links.sign_in'))) + = raw t('.sign_in', sign_in_link: link_to(t('links.sign_in'), new_user_session_path)) %h4= t('.promote_project', project: @project.full_name) %p From 908d21525089327b054ddc2f67391c1e9dadefa4 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Wed, 20 Aug 2014 09:07:36 +0700 Subject: [PATCH 023/415] stripped tables #100 --- app/views/deposits/index.html.haml | 2 +- app/views/projects/index.html.haml | 2 +- app/views/tips/index.html.haml | 2 +- app/views/users/index.html.haml | 2 +- app/views/withdrawals/index.html.haml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/deposits/index.html.haml b/app/views/deposits/index.html.haml index d179cb56..7950e74d 100644 --- a/app/views/deposits/index.html.haml +++ b/app/views/deposits/index.html.haml @@ -4,7 +4,7 @@ - else = t('.deposits') %p - %table.table + %table.table.table-striped %thead %tr %th= t('.created_at') diff --git a/app/views/projects/index.html.haml b/app/views/projects/index.html.haml index a61bcfe2..95c1a613 100644 --- a/app/views/projects/index.html.haml +++ b/app/views/projects/index.html.haml @@ -10,7 +10,7 @@ = button_tag t('.find_project.button'), class: "btn form-control btn-default", name: nil %p - if @projects.count > 0 - %table.table + %table.table.table-striped %thead %tr %th= link_to_unless_current t('.repository'), params.merge(:order => 'repository') diff --git a/app/views/tips/index.html.haml b/app/views/tips/index.html.haml index a7ab46b7..ded8f6e0 100644 --- a/app/views/tips/index.html.haml +++ b/app/views/tips/index.html.haml @@ -6,7 +6,7 @@ - else = t('.tips') %p - %table.table + %table.table.table-striped %thead %tr %th= t('.created_at') diff --git a/app/views/users/index.html.haml b/app/views/users/index.html.haml index 23b89916..13b5d405 100644 --- a/app/views/users/index.html.haml +++ b/app/views/users/index.html.haml @@ -1,6 +1,6 @@ %h1= t('.title') %p - %table.table + %table.table.table-striped %thead %tr %th= t('.name') diff --git a/app/views/withdrawals/index.html.haml b/app/views/withdrawals/index.html.haml index 4e6e6275..9e0825e2 100644 --- a/app/views/withdrawals/index.html.haml +++ b/app/views/withdrawals/index.html.haml @@ -1,6 +1,6 @@ %h1= t('.title') %p - %table.table + %table.table.table-striped %thead %tr %th= t('.created_at') From 445154a74b9d8a878bf0c4c257ce58f476a64139 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 23 Aug 2014 12:13:43 +0700 Subject: [PATCH 024/415] added branches support #102 --- app/controllers/projects_controller.rb | 2 +- app/models/project.rb | 9 ++++++++- app/services/bitbucket.rb | 6 ++++++ app/services/github.rb | 4 ++++ app/views/projects/edit.html.haml | 1 + app/views/projects/show.html.haml | 2 +- config/locales/en.yml | 3 ++- db/migrate/20140823035950_add_branch_to_projects.rb | 5 +++++ db/schema.rb | 3 ++- features/step_definitions/common.rb | 3 +++ 10 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 db/migrate/20140823035950_add_branch_to_projects.rb diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 4a4fece2..582c0852 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -97,7 +97,7 @@ def load_project end def project_params - params.require(:project).permit(:hold_tips, tipping_policies_text_attributes: [:text]) + params.require(:project).permit(:branch, :hold_tips, tipping_policies_text_attributes: [:text]) end def projects_order diff --git a/app/models/project.rb b/app/models/project.rb index 1a057929..dad8d048 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -9,6 +9,7 @@ class Project < ActiveRecord::Base validates :full_name, :github_id, uniqueness: true, presence: true validates :host, inclusion: [ "github", "bitbucket" ], presence: true + validates :branch, presence: true search_syntax do search_by :text do |scope, phrases| @@ -77,6 +78,10 @@ def collaborators_info repository_client.collaborators_info self end + def branches + repository_client.branches self + end + def new_commits begin commits = Timeout::timeout(90) do @@ -87,7 +92,9 @@ def new_commits select{|c| c.commit.author.email =~ Devise::email_regexp }. # Filter commited after t4c project creation select{|c| c.commit.committer.date > self.deposits.first.created_at }. - to_a + to_a. + # tip for older commits first + reverse end rescue Octokit::BadGateway, Octokit::NotFound, Octokit::InternalServerError, Octokit::Forbidden, Errno::ETIMEDOUT, Net::ReadTimeout, Faraday::Error::ConnectionFailed => e diff --git a/app/services/bitbucket.rb b/app/services/bitbucket.rb index 3d1bf549..207e050a 100644 --- a/app/services/bitbucket.rb +++ b/app/services/bitbucket.rb @@ -32,7 +32,13 @@ def collaborators_info project [] end + def branches project + # TODO + ['master'] + end + def commits repository + # todo use repository.branch data = request :get, changesets_path(repository.full_name) data.changesets.map do |cs| diff --git a/app/services/github.rb b/app/services/github.rb index aab9a1fe..63641e7e 100644 --- a/app/services/github.rb +++ b/app/services/github.rb @@ -62,6 +62,10 @@ def collaborators_info project (client.get("/orgs/#{project.full_name.split('/').first}/members") rescue []) end + def branches project + client.get("/repos/#{project.full_name}/branches").map(&:name) + end + def repository_url project "https://github.com/#{project.full_name}" end diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml index 767d9e15..a11658f8 100644 --- a/app/views/projects/edit.html.haml +++ b/app/views/projects/edit.html.haml @@ -5,6 +5,7 @@ .row .col-md-12 = bootstrap_form_for @project do |f| + = f.select :branch, @project.branches, label: t('.branch') = f.fields_for :tipping_policies_text, @project.tipping_policies_text || @project.build_tipping_policies_text do |fields| = fields.text_area :text, rows: 10, label: t('.tipping_policies') = f.check_box :hold_tips, label: t('.hold_tips') diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 91123fdc..19bfc4f9 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -84,7 +84,7 @@ = btc_human @project.next_tip_amount %h4= t('.contribute_and_earn') - = raw t('.cocontribute_and_earn_description', make_commits_link: link_to(t('.make_commits_link'), @project.github_url, target: '_blank')) + = raw t('.contribute_and_earn_description', make_commits_link: link_to(t('.make_commits_link'), @project.github_url, target: '_blank'), branch: @project.branch) - if current_user - if current_user.bitcoin_address.blank? diff --git a/config/locales/en.yml b/config/locales/en.yml index 168c31e3..26e1feaf 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -98,7 +98,7 @@ en: when_decided: when its amount is decided next_tip: Next Tip contribute_and_earn: Contribute and Earn - cocontribute_and_earn_description: "Donate bitcoins to this project or %{make_commits_link} and get tips for it. If your commit is accepted by the project maintainer and there are bitcoins on its balance, you will get a tip!" + contribute_and_earn_description: "Donate bitcoins to this project or %{make_commits_link} and get tips for it. If your commit is accepted by the project maintainer (merged into %{branch} branch) and there are bitcoins on its balance, you will get a tip!" make_commits_link: make commits tell_us_bitcoin_address: "Just %{tell_us_link} your bitcoin address." tell_us_link: tell us @@ -109,6 +109,7 @@ en: shield_title: tip for next commit edit: project_settings: "%{project} project settings" + branch: Branch tipping_policies: Tipping policies hold_tips: "Do not send the tips immediatly. Give collaborators the ability to modify the tips before they're sent" save: Save the project settings diff --git a/db/migrate/20140823035950_add_branch_to_projects.rb b/db/migrate/20140823035950_add_branch_to_projects.rb new file mode 100644 index 00000000..d514601c --- /dev/null +++ b/db/migrate/20140823035950_add_branch_to_projects.rb @@ -0,0 +1,5 @@ +class AddBranchToProjects < ActiveRecord::Migration + def change + add_column :projects, :branch, :string, default: 'master' + end +end diff --git a/db/schema.rb b/db/schema.rb index 76d556ec..6721269e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140816062159) do +ActiveRecord::Schema.define(version: 20140823035950) do create_table "collaborators", force: true do |t| t.integer "project_id" @@ -51,6 +51,7 @@ t.string "host", default: "github" t.boolean "hold_tips", default: false t.datetime "info_updated_at" + t.string "branch", default: "master" end add_index "projects", ["full_name"], name: "index_projects_on_full_name", unique: true diff --git a/features/step_definitions/common.rb b/features/step_definitions/common.rb index 633b40ec..28b359c9 100644 --- a/features/step_definitions/common.rb +++ b/features/step_definitions/common.rb @@ -1,5 +1,8 @@ Before do ActionMailer::Base.deliveries.clear + + # mock branches method to prevent api call + Project.any_instance.stub(:branches).and_return(%w(master)) end Then(/^there should be (\d+) email sent$/) do |arg1| From 5de4d26ecfc20ad1400ab72eba1b803345c9dc32 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 23 Aug 2014 13:11:55 +0700 Subject: [PATCH 025/415] load all branches #102 --- app/services/github.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/github.rb b/app/services/github.rb index 63641e7e..45cd78c6 100644 --- a/app/services/github.rb +++ b/app/services/github.rb @@ -63,7 +63,7 @@ def collaborators_info project end def branches project - client.get("/repos/#{project.full_name}/branches").map(&:name) + Octokit::Client.new(:auto_paginate => true).get("/repos/#{project.full_name}/branches").map(&:name) end def repository_url project From 8a88625d1fb4c975b750c7f916ee03a2424f67e3 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 23 Aug 2014 13:12:15 +0700 Subject: [PATCH 026/415] leave branch blank by default #102 --- app/models/project.rb | 1 - app/services/github.rb | 6 +++++- app/views/projects/edit.html.haml | 2 +- app/views/projects/show.html.haml | 2 +- config/locales/en.yml | 4 +++- db/migrate/20140823060921_make_default_branch_blank.rb | 5 +++++ db/schema.rb | 4 ++-- 7 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 db/migrate/20140823060921_make_default_branch_blank.rb diff --git a/app/models/project.rb b/app/models/project.rb index dad8d048..5affe082 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -9,7 +9,6 @@ class Project < ActiveRecord::Base validates :full_name, :github_id, uniqueness: true, presence: true validates :host, inclusion: [ "github", "bitbucket" ], presence: true - validates :branch, presence: true search_syntax do search_by :text do |scope, phrases| diff --git a/app/services/github.rb b/app/services/github.rb index 45cd78c6..1500aca4 100644 --- a/app/services/github.rb +++ b/app/services/github.rb @@ -12,7 +12,11 @@ def initialize attr_reader :client def commits project - commits = client.commits project.full_name + if project.branch.blank? + commits = client.commits project.full_name + else + commits = client.commits project.full_name, sha: project.branch + end last_response = client.last_response pages = (CONFIG['github']['project_pages'][project.full_name] || CONFIG['github']['pages'] || 1).to_i diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml index a11658f8..8cae05db 100644 --- a/app/views/projects/edit.html.haml +++ b/app/views/projects/edit.html.haml @@ -5,7 +5,7 @@ .row .col-md-12 = bootstrap_form_for @project do |f| - = f.select :branch, @project.branches, label: t('.branch') + = f.select :branch, @project.branches, label: t('.branch'), include_blank: t('.default_branch') = f.fields_for :tipping_policies_text, @project.tipping_policies_text || @project.build_tipping_policies_text do |fields| = fields.text_area :text, rows: 10, label: t('.tipping_policies') = f.check_box :hold_tips, label: t('.hold_tips') diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 19bfc4f9..adf91c39 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -84,7 +84,7 @@ = btc_human @project.next_tip_amount %h4= t('.contribute_and_earn') - = raw t('.contribute_and_earn_description', make_commits_link: link_to(t('.make_commits_link'), @project.github_url, target: '_blank'), branch: @project.branch) + = raw t('.contribute_and_earn_description', make_commits_link: link_to(t('.make_commits_link'), @project.github_url, target: '_blank'), branch: @project.branch.present? ? t('.contribute_and_earn_branch', branch: @project.branch) : '') - if current_user - if current_user.bitcoin_address.blank? diff --git a/config/locales/en.yml b/config/locales/en.yml index 26e1feaf..8172c06f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -98,7 +98,8 @@ en: when_decided: when its amount is decided next_tip: Next Tip contribute_and_earn: Contribute and Earn - contribute_and_earn_description: "Donate bitcoins to this project or %{make_commits_link} and get tips for it. If your commit is accepted by the project maintainer (merged into %{branch} branch) and there are bitcoins on its balance, you will get a tip!" + contribute_and_earn_description: "Donate bitcoins to this project or %{make_commits_link} and get tips for it. If your commit is accepted %{branch} by a project maintainer and there are bitcoins on its balance, you will get a tip!" + contribute_and_earn_branch: "to %{branch} branch" make_commits_link: make commits tell_us_bitcoin_address: "Just %{tell_us_link} your bitcoin address." tell_us_link: tell us @@ -110,6 +111,7 @@ en: edit: project_settings: "%{project} project settings" branch: Branch + default_branch: Default branch tipping_policies: Tipping policies hold_tips: "Do not send the tips immediatly. Give collaborators the ability to modify the tips before they're sent" save: Save the project settings diff --git a/db/migrate/20140823060921_make_default_branch_blank.rb b/db/migrate/20140823060921_make_default_branch_blank.rb new file mode 100644 index 00000000..b191d00b --- /dev/null +++ b/db/migrate/20140823060921_make_default_branch_blank.rb @@ -0,0 +1,5 @@ +class MakeDefaultBranchBlank < ActiveRecord::Migration + def change + change_column :projects, :branch, :string, default: nil + end +end diff --git a/db/schema.rb b/db/schema.rb index 6721269e..9a468895 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140823035950) do +ActiveRecord::Schema.define(version: 20140823060921) do create_table "collaborators", force: true do |t| t.integer "project_id" @@ -51,7 +51,7 @@ t.string "host", default: "github" t.boolean "hold_tips", default: false t.datetime "info_updated_at" - t.string "branch", default: "master" + t.string "branch" end add_index "projects", ["full_name"], name: "index_projects_on_full_name", unique: true From 2bba7ead93375250cf67c5e970511e656b5fe63f Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 23 Aug 2014 13:18:11 +0700 Subject: [PATCH 027/415] use api_key to load branches #102 --- app/services/github.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/github.rb b/app/services/github.rb index 1500aca4..d2b474d8 100644 --- a/app/services/github.rb +++ b/app/services/github.rb @@ -67,7 +67,7 @@ def collaborators_info project end def branches project - Octokit::Client.new(:auto_paginate => true).get("/repos/#{project.full_name}/branches").map(&:name) + Octokit::Client.new(client_id: CONFIG['github']['key'], client_secret: CONFIG['github']['secret'], auto_paginate: true).get("/repos/#{project.full_name}/branches").map(&:name) end def repository_url project From ed45e3a7c449cde4c2195ed21ad770315a5c816a Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 23 Aug 2014 13:41:04 +0700 Subject: [PATCH 028/415] load all branches --- app/services/github.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/services/github.rb b/app/services/github.rb index d2b474d8..103c3cb9 100644 --- a/app/services/github.rb +++ b/app/services/github.rb @@ -67,7 +67,13 @@ def collaborators_info project end def branches project - Octokit::Client.new(client_id: CONFIG['github']['key'], client_secret: CONFIG['github']['secret'], auto_paginate: true).get("/repos/#{project.full_name}/branches").map(&:name) + branches = client.get("/repos/#{project.full_name}/branches") + last_response = client.last_response + while last_response && last_response.rels[:next] + last_response = last_response.rels[:next].get + branches += last_response.data + end + branches.map(&:name) end def repository_url project From 24ae5aeb98d676cfa6fb9adeedd828bddd57eaa3 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Tue, 26 Aug 2014 10:46:19 +0700 Subject: [PATCH 029/415] fixed emoji. a workaround until Rails adds support for UTF8MB4 --- Gemfile | 1 + Gemfile.lock | 2 ++ config/initializers/demoji.rb | 1 + 3 files changed, 4 insertions(+) create mode 100644 config/initializers/demoji.rb diff --git a/Gemfile b/Gemfile index 6aea2ac1..102e51fd 100644 --- a/Gemfile +++ b/Gemfile @@ -29,6 +29,7 @@ gem 'cancancan' gem "i18n-js" gem 'dusen' gem 'render_csv' +gem 'demoji' group :development do gem 'capistrano', '~> 3.0.1' diff --git a/Gemfile.lock b/Gemfile.lock index 37602497..e392291c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -120,6 +120,7 @@ GEM debugger-ruby_core_source (~> 1.3.5) debugger-linecache (1.2.0) debugger-ruby_core_source (1.3.5) + demoji (0.0.5) devise (3.2.2) bcrypt-ruby (~> 3.0) orm_adapter (~> 0.1) @@ -319,6 +320,7 @@ DEPENDENCIES cucumber-rails database_cleaner debugger (~> 1.6.5) + demoji devise (~> 3.2.2) dusen factory_girl_rails (~> 4.3.0) diff --git a/config/initializers/demoji.rb b/config/initializers/demoji.rb new file mode 100644 index 00000000..d4121d33 --- /dev/null +++ b/config/initializers/demoji.rb @@ -0,0 +1 @@ +ActiveRecord::Base.send :include, Demoji From f2882c01681075bf47f6d07b752f54200ba22e40 Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Sat, 30 Aug 2014 00:26:19 +0800 Subject: [PATCH 030/415] Use svg instead of png to get better image quality --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 21fea313..a88a4506 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Tip4commit ========== -[![tip for next commit](https://tip4commit.com/projects/307.svg)](https://tip4commit.com/projects/307) [![Build Status](https://travis-ci.org/tip4commit/tip4commit.png?branch=master)](https://travis-ci.org/tip4commit/tip4commit) +[![tip for next commit](https://tip4commit.com/projects/307.svg)](https://tip4commit.com/projects/307) [![Build Status](https://travis-ci.org/tip4commit/tip4commit.svg?branch=master)](https://travis-ci.org/tip4commit/tip4commit) Donate bitcoins to open source projects or make commits and get tips for it. From 62cfe57fcbfb639572ff066a5a37145e2d65c0ff Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 31 Aug 2014 21:52:04 +0900 Subject: [PATCH 031/415] added crawl-delay directive to robots.txt --- public/robots.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/public/robots.txt b/public/robots.txt index fdf08c9f..4860601a 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -1,2 +1,3 @@ User-agent: * Disallow: /users/ +Crawl-delay: 10 From 95afb67f6dbcdcb586b0844ccdb86229f9d970a2 Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Tue, 2 Sep 2014 03:06:22 +0800 Subject: [PATCH 032/415] Should use protocol-relative URL to load fonts. fix #104 --- app/views/projects/show.svg.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/show.svg.erb b/app/views/projects/show.svg.erb index 0957c105..c987d9fc 100644 --- a/app/views/projects/show.svg.erb +++ b/app/views/projects/show.svg.erb @@ -63,7 +63,7 @@ font-family: 'Open Sans'; font-style: normal; font-weight: 400; - src: local('Open Sans'), local('OpenSans'), url(http://themes.googleusercontent.com/static/fonts/opensans/v6/cJZKeOuBrn4kERxqtaUH3bO3LdcAZYWl9Si6vvxL-qU.woff) format('woff'); + src: local('Open Sans'), local('OpenSans'), url(//themes.googleusercontent.com/static/fonts/opensans/v6/cJZKeOuBrn4kERxqtaUH3bO3LdcAZYWl9Si6vvxL-qU.woff) format('woff'); } ]]> From 791c05055d58531b5e9aca7172ebddb46d2a1e96 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Wed, 3 Sep 2014 10:59:36 +0900 Subject: [PATCH 033/415] added https protocol. protocol-relative url in svg doesn't work in firefox #104 --- app/views/projects/show.svg.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/show.svg.erb b/app/views/projects/show.svg.erb index c987d9fc..c4fd0a57 100644 --- a/app/views/projects/show.svg.erb +++ b/app/views/projects/show.svg.erb @@ -63,7 +63,7 @@ font-family: 'Open Sans'; font-style: normal; font-weight: 400; - src: local('Open Sans'), local('OpenSans'), url(//themes.googleusercontent.com/static/fonts/opensans/v6/cJZKeOuBrn4kERxqtaUH3bO3LdcAZYWl9Si6vvxL-qU.woff) format('woff'); + src: local('Open Sans'), local('OpenSans'), url(https://themes.googleusercontent.com/static/fonts/opensans/v6/cJZKeOuBrn4kERxqtaUH3bO3LdcAZYWl9Si6vvxL-qU.woff) format('woff'); } ]]> From 510bf7f66348f2941343407fbbf802e01dfd57c1 Mon Sep 17 00:00:00 2001 From: Jan Keromnes Date: Thu, 11 Sep 2014 23:36:16 +0000 Subject: [PATCH 034/415] Add French translation to locales. --- config/locales/fr.yml | 212 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 212 insertions(+) create mode 100644 config/locales/fr.yml diff --git a/config/locales/fr.yml b/config/locales/fr.yml new file mode 100644 index 00000000..8519093d --- /dev/null +++ b/config/locales/fr.yml @@ -0,0 +1,212 @@ +fr: + tip4commit: Tip4Commit + meta: + title: Contribuez aux logiciels libres + description: Faites don de bitcoins à des projets open source ou contribuez et recevez des pourboires. + menu: + home: Accueil + projects: Projets supportés + footer: + text: "Code source disponible sur %{github_link} et vous pouvez également %{support_link} son développement." + github_link: GitHub + support_link: subventionner + follow_link: Suivez @tip4commit + links: + sign_in: Se connecter + sign_out: Se déconnecter + errors: + project_not_found: Projet non trouvé. + access_denied: Accès refusé + can_assign_more_tips: "Vous ne pouvez pas attribuer plus de 100% de vos fonds disponibles." + wrong_bitcoin_address: Echec de mise à jour de l'adresse bitcoin + user_not_found: Utilisateur non trouvé + access_denied: "Vous n'avez pas le droit d'effectuer cette action !" + notices: + project_updated: Les paramètres du projet ont été mis à jour + tips_decided: Les montants des pourboires ont été définis + user_updated: Vos informations ont été enregistrées ! + user_unsubscribed: "Vous avez été désinscrit ! Désolé de vous avoir dérangé. Celà dit, vous pouvez toujours nous donner votre adresse bitcoin pour recevoir vos fonds." + tip_amounts: + undecided: "Non défini" + free: "Gratuit : 0%" + tiny: "Minuscule : 0.1%" + small: "Petit : 0.5%" + normal: "Normal : 1%" + big: "Grand : 2%" + huge: "Géant : 5%" + js: + errors: + value: + invalid: Valeur non valide + email: + invalid: Adresse Email non valide + blank: L'Email est requis et doit être renseigné + password: + blank: Les mot de passe est requis et doit être renseigné + invalid: Le mot de passe et sa confirmation ne sont pas identiques + password_confirmation: + blank: La confirmation du mot de passe est requise et doit être renseignée + invalid: Le mot de passe et sa confirmation ne sont pas identiques + home: + index: + see_projects: Voir les projets + how_does_it_work: + title: Comment ça marche ? + text: Des gens donnent des bitcoins à des projets. Lorsque quelqu'une contribution est acceptée par un projet, nous donnons automatiquement un pourboire à son auteur. + button: En savoir plus sur le Bitcoin + donate: + title: Faire un don + text: Trouvez un projet que vous soutenez et désposez-y des bitcoins. Votre don d'ajoutera aux fonds des autres donnateurs pour récompenser les nouvelles contributions. + button: Trouver ou ajouter un projet + contribute: + title: Contribuer + text: Améliorez un projet ! Si votre contribution est acceptée par le mainteneur du projet, vous recevrez un pourboire ! + sign_in_text: "Vérifiez simplement vos emails ou %{sign_in_link}." + button: Projets subventionnés + projects: + index: + find_project: + placeholder: "Indiquez l'URL d'un projet GitHub pour l'ajouter ou n'importe quel mot clef pour le trouver..." + button: Trouver ou ajouter un projet + repository: Dépôt + description: Description + watchers: Observateurs + balance: Fonds + forked_from: forké depuis + support: Subventionner + show: + title: "Contribuer à %{project}" + edit_project: Changer les paramètres du projet + decide_tip_amounts: Choisir un montant de pourboire + project_sponsors: Sponsors du projet + fee: "%{percentage} des fonds déposés seront utilisés pour récompenser les nouvelles contributions." + balance: Fonds + deposits: dépôts + custom_tip_size: (chaque nouvelle contribution reçoit un pourcentage des fonds disponibles) + default_tip_size: "(chaque contribution reçoit %{percentage} des fonds disponsibles)" + unconfirmed_amount: "(%{amount} non confirmé)" + tipping_policies: Politique des pourboires + updated_by_user: "(Dernière mise à jour par %{name} le %{date})" + updated_by_unknown: "(Dernière mise à jour le %{date})" + tips_paid: Pourboires Payés + unclaimed_amount: "(%{amount} n'ont pas été réclamés, et seront rendus au projet s'ils le restent pendant 1 mois.)" + last_tips: Derniers Pourboires + see_all: tout voir + received: "%{amount} reçus" + will_receive: recevra un pourboire + for_commit: pour la contribution + when_decided: lorsque le montant sera choisi + next_tip: Prochain Pourboire + contribute_and_earn: Contribuez et Gagnez + contribute_and_earn_description: "Donner des bitcoins à ce projet ou %{make_commits_link} et recevez des pourboires. Si votre contribution est acceptée %{branch} par un mainteneur du projet et qu'un fond de bitcoins est disponible, vous recevrez un pourboire !" + contribute_and_earn_branch: "sur la branche %{branch}" + make_commits_link: contribuer + tell_us_bitcoin_address: "%{tell_us_link} simplement votre adresse bitcoin." + tell_us_link: Renseignez + sign_in: "Verifiez simplement vos emails ou %{sign_in_link}." + promote_project: Promouvoir %{project} + embedding: Intégration + image_url: "URL de l'image:" + shield_title: prochain pourboire + edit: + project_settings: "Paramètres du projet %{project}" + branch: Branche + default_branch: Branche par défaut + tipping_policies: Politique des pourboires + hold_tips: "N'envoyez pas les bourboires tout de suite. Laissez à vos collaborateurs la possibilité de modifier les pourboires avant qu'ils ne soient envoyés" + save: Enregistrer les paramètres du projet + decide_tip_amounts: + commit: Contribution + author: Auteur + message: Message + tip: Pourboire (en fonction des fonds du projet) + submit: Envoyer les pourboires + tips: + index: + tips: Pourboires + project_tips: 'Pourboires pour %{project}' + user_tips: "Pourboires pour %{user}" + created_at: Créé à + commiter: Contributeur + project: Projet + commit: Contribution + amount: Montant + refunded: Rendus aux fonds du projet + undecided: Le montant du pourboire n'a pas encore été décidé + no_bitcoin_address: "L'utilisateur n'a pas indiqué d'adresse de retrait" + below_threshold: "Les fonds de l'utilisateur sont sous le seuil de retrait" + waiting: En attente de retrait + error: (erreur d'envoi de la transaction) + deposits: + index: + project_deposits: 'Versements pour %{project}' + deposits: Versements + created_at: Créé à + project: Projet + amount: Montant + transaction: Transaction + confirmed: Confirmée + confirmed_yes: 'Oui' + confirmed_no: 'Non' + users: + index: + title: Meilleurs Contributeurs + name: Nom + commits_count: Contributions récompensées + withdrawn: Retiré + show: + balance: Fonds + threshold: "Vous recevrez vos fonds dès qu'ils atteindront le seuil de %{threshold}" + see_all: tout voir + received: "%{time} %{amount} reçus pour avoir contribué %{commit} à %{project}" + bitcoin_address_placeholder: Votre adresse bitcoin + notify: Me tenir au courant des nouveaux pourboires (pas plus d'un email par mois) + submit_user: Mettre à jour + change_password: Modifier votre mot de passe + submit_password: Modifier mon mot de passe + withdrawals: + index: + title: Derniers Retraits + created_at: Créé à + transaction: Transaction + result: Résultat + error: Erreur + success: Succès + devise: + sessions: + new: + title: Se connecter + remember_me: Se souvenir de moi + submit: Se connecter + registrations: + new: + title: S'enregistrer + submit: S'enregistrer + passwords: + new: + title: Mot de passe oublié ? + submit: Envoyez-moi des instructions pour réinitialiser mon mot de passe + edit: + title: Modifier votre mot de passe + submit: Modifier mon mot de passe + confirmations: + new: + title: Renvoyer les instructions de confirmation + submit: Renvoyer les instructions de confirmation + links: + sign_in: Se connecter + sign_up: S'enregistrer + recover: Mot de passe oublié ? + confirm: "Vous n'avez pas reçu d'instructions de confirmation ?" + sign_in_with: "Se connecter avec %{provider}" + errors: + primary_email: votre adresse email principale doit être vérifiée. + onmiauth_info: impossible d'obtenir vos informations. + activerecord: + attributes: + user: + email: E-mail + bitcoin_address: Adresse bitcoin + password: Mot de passe + password_confirmation: Confirmation + display_name: Nom affiché From 5fd68303af68a13ecf324a1cb293cda11b26acb8 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Fri, 12 Sep 2014 11:54:55 +0900 Subject: [PATCH 035/415] allowed locale selection. added public domain flag icons --- Gemfile | 5 ++++- Gemfile.lock | 6 ++++++ app/assets/images/flags/en.png | Bin 0 -> 599 bytes app/assets/images/flags/fr.png | Bin 0 -> 545 bytes app/controllers/application_controller.rb | 13 +++++++++++++ app/views/layouts/application.html.haml | 3 +++ config/application.rb | 1 + 7 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 app/assets/images/flags/en.png create mode 100755 app/assets/images/flags/fr.png diff --git a/Gemfile b/Gemfile index 102e51fd..a6834913 100644 --- a/Gemfile +++ b/Gemfile @@ -26,11 +26,14 @@ gem 'twitter-bootstrap-rails', github: 'seyhunak/twitter-bootstrap-rails', br gem 'bootstrap_form', github: 'sigmike/rails-bootstrap-forms', branch: 'removed_for_on_radio_label' gem 'sdoc', group: :doc, require: false gem 'cancancan' -gem "i18n-js" gem 'dusen' gem 'render_csv' gem 'demoji' +gem "http_accept_language" +gem 'rails-i18n' +gem "i18n-js" + group :development do gem 'capistrano', '~> 3.0.1' gem 'capistrano-rvm', '~> 0.1.0', github: 'capistrano/rvm' diff --git a/Gemfile.lock b/Gemfile.lock index e392291c..49d79947 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -153,6 +153,7 @@ GEM railties (>= 4.0.1) hashie (2.0.5) hike (1.2.3) + http_accept_language (2.0.2) httpauth (0.2.1) i18n (0.6.9) i18n-js (2.1.2) @@ -220,6 +221,9 @@ GEM bundler (>= 1.3.0, < 2.0) railties (= 4.0.2) sprockets-rails (~> 2.0.0) + rails-i18n (4.0.3) + i18n (~> 0.6) + railties (~> 4.0) railties (4.0.2) actionpack (= 4.0.2) activesupport (= 4.0.2) @@ -325,6 +329,7 @@ DEPENDENCIES dusen factory_girl_rails (~> 4.3.0) haml-rails (~> 0.5.3) + http_accept_language i18n-js jbuilder (~> 1.5.3) jquery-rails (~> 3.0.4) @@ -336,6 +341,7 @@ DEPENDENCIES omniauth (~> 1.1.4) omniauth-github! rails (= 4.0.2) + rails-i18n render_csv rspec-rails (~> 3.0.0.beta) sass-rails (~> 4.0.0) diff --git a/app/assets/images/flags/en.png b/app/assets/images/flags/en.png new file mode 100644 index 0000000000000000000000000000000000000000..258228e88cf66d8f6633fea6b641a595db9ed2a1 GIT binary patch literal 599 zcmV-d0;v6oP)F!`e#okFI$hXy-zSVkh@Z#(&OW#F(7TVn9zXy5 z?|(*BMIkjqZiZh!|0@c4n#unD^VddO*!0j$hBaN2wq9r2cjx4301to!!KY#vlaQOf0*T3Jt{{cn*{$$jysP*=%mt%=F{OA8}!}r8C{-*Ytm!J16ywi{QJWc6RR5SukoX!@{)aQ<2Q35p1=S9GcamOGipiz9V4qQ6cfMZu%@l( zoH?1N>$4MWS)RXsJIyU^y{i4Wr3Zii`Tpnc-^4K0ZO1?S|MSQF`kR#-_cHwZyL#&( l5jnxi?yg&v(*Xhu01d=J3gt_FfdBvi07*qoM6N<$f(k(nI?4b5 literal 0 HcmV?d00001 diff --git a/app/assets/images/flags/fr.png b/app/assets/images/flags/fr.png new file mode 100755 index 0000000000000000000000000000000000000000..22836232bcb13f71b46e3c2c288a5bbfc5f832c3 GIT binary patch literal 545 zcmV++0^a?JP)a#_wV1IKYs$rKY#u(GBPT;82@4uuZ@Bjb*LEQg9?mr;O+S2#`&+mV~e*ORb`)x%NKmdU>F#Kou{O$MOzaSM~ zzkdA>20%8@c%VIe&z}7I_4EI)pA5nxKuZ7ukT?c80Dv$EOZfkT-E`F^-Z->CoUvPa z;LJ@TE&78Ry{KaAw3nU$V)^suA5iJvzd-aK$OI|^Dg6g=4#;gl)j;F_{rb)L>(?&^ z27mw*k3kLqFbKjh`2Po^af3Uh(9&KEH^%mnOc-dpGpYiN{Gr?pd;!D)R1b8?@4rCu zA5i2!5&(JtME&~t7wF?(znQ=`00a=rk6(X4uK)87qz8!qL0tn>4Pk>-1O4!u0T@;c z3;+Sd^5e%JkZPbkfBphVECA>vpwi#J8UOqRh7v#kv3vu1;?F-WPG%tQ&mSg8_(0;3 z5e%5cC4q)90{! I18n.t('errors.access_denied') end + before_filter :load_locale + private + def load_locale + if params[:locale] && ::Rails.application.config.available_locales.include?(params[:locale]) + I18n.locale = session[:locale] = params[:locale].to_sym + redirect_to :back rescue true + elsif session[:locale] + I18n.locale = session[:locale] + elsif l = http_accept_language.compatible_language_from(::Rails.application.config.available_locales).to_sym rescue nil + I18n.locale = session[:locale] = l + end + end + def load_project(project) if project.is_a? Project @project = project diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 64551ad7..41519924 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -53,6 +53,9 @@ = yield .footer + %p.pull-right + - ::Rails.application.config.available_locales.each do |locale| + = link_to image_tag("flags/#{locale}.png"), "?locale=#{locale}" %p © = link_to t('tip4commit'), 'http://tip4commit.com/', target: '_blank' diff --git a/config/application.rb b/config/application.rb index 15b76d87..17bf72cb 100644 --- a/config/application.rb +++ b/config/application.rb @@ -25,6 +25,7 @@ class Application < Rails::Application config.autoload_paths += %W(#{config.root}/lib) config.assets.initialize_on_precompile = true + config.available_locales = %w(en fr) end end From 1b87c2866cd31ae2ee0f0737963897d3a41a7ac6 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 15 Sep 2014 11:24:40 +0700 Subject: [PATCH 036/415] fixed flags --- app/assets/images/flags/en.png | Bin 599 -> 599 bytes app/assets/images/flags/fr.png | Bin 545 -> 545 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/app/assets/images/flags/en.png b/app/assets/images/flags/en.png index 258228e88cf66d8f6633fea6b641a595db9ed2a1..ff701e19f6d2c0658fb23b1d94124cba4ce60851 100644 GIT binary patch delta 14 Vcmcc4a-D^>Gr-TCcOy#>696Sj1V8`) delta 15 Wcmcc4a-D^xGr-S%BWn;7BNqTFO9Vau diff --git a/app/assets/images/flags/fr.png b/app/assets/images/flags/fr.png index 22836232bcb13f71b46e3c2c288a5bbfc5f832c3..8332c4ec23c853944c29b02d7b32a88033f48a71 100755 GIT binary patch delta 14 VcmZ3;vXF(fGr-TCcO#1o696A#1D*f? delta 15 WcmZ3;vXF(PGr-S%BdZJ(BNqT8ivyeh From a9473c0b55f17ea8641a3eed037dbae7c0c52031 Mon Sep 17 00:00:00 2001 From: arsenische Date: Mon, 15 Sep 2014 10:32:33 +0600 Subject: [PATCH 037/415] french flag image --- app/assets/images/flags/fr.png | Bin 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 app/assets/images/flags/fr.png diff --git a/app/assets/images/flags/fr.png b/app/assets/images/flags/fr.png old mode 100755 new mode 100644 From a1b15b7d23a9f20330a1d4bad86570affc8a6c7f Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 15 Sep 2014 14:16:12 +0700 Subject: [PATCH 038/415] don't reload js and css with turbolinks --- app/assets/javascripts/projects.js.coffee | 3 +-- app/assets/javascripts/users.js.coffee | 3 ++- app/views/layouts/application.html.haml | 11 ++++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/projects.js.coffee b/app/assets/javascripts/projects.js.coffee index 124a2fc9..849796e7 100644 --- a/app/assets/javascripts/projects.js.coffee +++ b/app/assets/javascripts/projects.js.coffee @@ -6,5 +6,4 @@ init = () -> $('.qrcode').each () -> $(this).qrcode($(this).attr('data-qrcode')); -$ init -$(document).on 'page:load', init \ No newline at end of file +$(document).on 'ready page:load', init diff --git a/app/assets/javascripts/users.js.coffee b/app/assets/javascripts/users.js.coffee index b0a9140b..b7fcd1a7 100644 --- a/app/assets/javascripts/users.js.coffee +++ b/app/assets/javascripts/users.js.coffee @@ -1,4 +1,4 @@ -$(document).ready ()-> +load_bootstrap_validator = -> $('.registration_form').bootstrapValidator message: I18n.t('js.errors.value.invalid') fields: @@ -39,3 +39,4 @@ $(document).ready ()-> notEmpty: message: I18n.t('js.errors.password_confirmation.blank') +$(document).on "ready page:load", load_bootstrap_validator diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 41519924..e2105bdd 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -14,11 +14,7 @@ / %meta{:property => 'og:image', :content => asset_path('logo.png')} / %link{:rel => 'image_src', :type => 'image/png', :href => asset_path('logo.png')} - = stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true - = javascript_include_tag "application", "data-turbolinks-track" => true - - :javascript - I18n.locale = #{I18n.locale.to_json}; + = stylesheet_link_tag "application", media: "all" = csrf_meta_tags %body @@ -62,3 +58,8 @@ 2013-#{Date.today.year}. = raw t('footer.text', github_link: link_to(t('footer.github_link'), 'https://github.com/tip4commit/tip4commit', target: '_blank'), support_link: link_to(t('footer.support_link'), 'http://tip4commit.com/projects/307')) = link_to t('footer.follow_link'), 'https://twitter.com/tip4commit', target: '_blank' + + = javascript_include_tag "application" + + :javascript + I18n.locale = #{I18n.locale.to_json}; From 8c78b9d1ec62330ef6d811f55856887d47263a67 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 15 Sep 2014 14:24:11 +0700 Subject: [PATCH 039/415] added kaminari and devise i18n. fixed missing translation --- Gemfile | 2 ++ Gemfile.lock | 6 ++++++ app/controllers/projects_controller.rb | 2 +- app/views/layouts/application.html.haml | 4 ++-- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index a6834913..025850a6 100644 --- a/Gemfile +++ b/Gemfile @@ -33,6 +33,8 @@ gem 'demoji' gem "http_accept_language" gem 'rails-i18n' gem "i18n-js" +gem 'kaminari-i18n' +gem 'devise-i18n' group :development do gem 'capistrano', '~> 3.0.1' diff --git a/Gemfile.lock b/Gemfile.lock index 49d79947..d9dcf137 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -127,6 +127,7 @@ GEM railties (>= 3.2.6, < 5) thread_safe (~> 0.1) warden (~> 1.2.3) + devise-i18n (0.11.0) diff-lcs (1.2.5) dusen (0.4.10) activerecord @@ -173,6 +174,9 @@ GEM kaminari (0.15.0) actionpack (>= 3.0.0) activesupport (>= 3.0.0) + kaminari-i18n (0.2.0) + kaminari + rails less (2.4.0) commonjs (~> 0.2.7) less-rails (2.4.2) @@ -326,6 +330,7 @@ DEPENDENCIES debugger (~> 1.6.5) demoji devise (~> 3.2.2) + devise-i18n dusen factory_girl_rails (~> 4.3.0) haml-rails (~> 0.5.3) @@ -335,6 +340,7 @@ DEPENDENCIES jquery-rails (~> 3.0.4) jquery-turbolinks kaminari (~> 0.15.0) + kaminari-i18n less-rails (~> 2.4.2) mysql2 octokit (~> 2.7.0) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 582c0852..07d776e7 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -5,7 +5,7 @@ class ProjectsController < ApplicationController before_filter :load_project, only: [:show, :edit, :update, :decide_tip_amounts] def index - @projects = Project.order(projects_order).page(params[:page]).per(30) + @projects = Project.order(projects_order).page(params[:page]).per(1) end def search diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index e2105bdd..a04dcf62 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -35,9 +35,9 @@ \/ = link_to btc_human(current_user.balance), current_user \/ - = link_to t('sign_out'), destroy_user_session_path, method: :delete + = link_to t('links.sign_out'), destroy_user_session_path, method: :delete - else - = link_to t('sign_in'), new_user_session_path + = link_to t('links.sign_in'), new_user_session_path %h3.text-muted.code-pro= t('tip4commit') = render 'common/menu' From f543992d3d12416affc6dba5e0ae8b7a5610d380 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 15 Sep 2014 14:26:26 +0700 Subject: [PATCH 040/415] fixed pagination --- app/controllers/projects_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 07d776e7..582c0852 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -5,7 +5,7 @@ class ProjectsController < ApplicationController before_filter :load_project, only: [:show, :edit, :update, :decide_tip_amounts] def index - @projects = Project.order(projects_order).page(params[:page]).per(1) + @projects = Project.order(projects_order).page(params[:page]).per(30) end def search From 25441ef407dfd9d868ed78deb74c81999a4a33bd Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 15 Sep 2014 14:46:48 +0700 Subject: [PATCH 041/415] removed needless translation files. attempt to fix 18n-js --- app/assets/javascripts/i18n/translations.js | 2 + config/locales/devise.en.yml | 60 --------------------- config/locales/en.bootstrap.yml | 18 ------- 3 files changed, 2 insertions(+), 78 deletions(-) create mode 100644 app/assets/javascripts/i18n/translations.js delete mode 100644 config/locales/devise.en.yml delete mode 100644 config/locales/en.bootstrap.yml diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js new file mode 100644 index 00000000..7bd072cb --- /dev/null +++ b/app/assets/javascripts/i18n/translations.js @@ -0,0 +1,2 @@ +var I18n = I18n || {}; +I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}}}; diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml deleted file mode 100644 index e7445b31..00000000 --- a/config/locales/devise.en.yml +++ /dev/null @@ -1,60 +0,0 @@ -# Additional translations at https://github.com/plataformatec/devise/wiki/I18n - -en: - devise: - confirmations: - confirmed: "Your account was successfully confirmed. Please sign in." - confirmed_and_signed_in: "Your account was successfully confirmed. You are now signed in." - send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes." - send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes." - failure: - already_authenticated: "You are already signed in." - inactive: "Your account is not activated yet." - invalid: "Invalid email or password." - invalid_token: "Invalid authentication token." - locked: "Your account is locked." - not_found_in_database: "Invalid email or password." - timeout: "Your session expired. Please sign in again to continue." - unauthenticated: "You need to sign in or sign up before continuing." - unconfirmed: "You have to confirm your account before continuing." - mailer: - confirmation_instructions: - subject: "Confirmation instructions" - reset_password_instructions: - subject: "Reset password instructions" - unlock_instructions: - subject: "Unlock Instructions" - omniauth_callbacks: - failure: "Could not authenticate you from %{kind} because \"%{reason}\"." - success: "Successfully authenticated from %{kind} account." - passwords: - no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided." - send_instructions: "You will receive an email with instructions about how to reset your password in a few minutes." - send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes." - updated: "Your password was changed successfully. You are now signed in." - updated_not_active: "Your password was changed successfully." - registrations: - destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon." - signed_up: "Welcome! You have signed up successfully." - signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated." - signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked." - signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please open the link to activate your account." - update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address." - updated: "You updated your account successfully." - sessions: - signed_in: "Signed in successfully." - signed_out: "Signed out successfully." - unlocks: - send_instructions: "You will receive an email with instructions about how to unlock your account in a few minutes." - send_paranoid_instructions: "If your account exists, you will receive an email with instructions about how to unlock it in a few minutes." - unlocked: "Your account has been unlocked successfully. Please sign in to continue." - errors: - messages: - already_confirmed: "was already confirmed, please try signing in" - confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one" - expired: "has expired, please request a new one" - not_found: "not found" - not_locked: "was not locked" - not_saved: - one: "1 error prohibited this %{resource} from being saved:" - other: "%{count} errors prohibited this %{resource} from being saved:" diff --git a/config/locales/en.bootstrap.yml b/config/locales/en.bootstrap.yml deleted file mode 100644 index c98d8d85..00000000 --- a/config/locales/en.bootstrap.yml +++ /dev/null @@ -1,18 +0,0 @@ -# Sample localization file for English. Add more files in this directory for other locales. -# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. - -en: - helpers: - actions: "Actions" - links: - back: "Back" - cancel: "Cancel" - confirm: "Are you sure?" - destroy: "Delete" - new: "New" - edit: "Edit" - titles: - edit: "Edit %{model}" - save: "Save %{model}" - new: "New %{model}" - delete: "Delete %{model}" From 436d2ca6d0c4d27f9850ef4f0d1e54732f787eff Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 15 Sep 2014 15:16:08 +0700 Subject: [PATCH 042/415] fixed reloading locale using turbo-links --- app/views/layouts/application.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index a04dcf62..6a0b8821 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -61,5 +61,5 @@ = javascript_include_tag "application" - :javascript - I18n.locale = #{I18n.locale.to_json}; + %script{"data-turbolinks-track" => "true"} + I18n.locale = #{raw I18n.locale.to_s.to_json}; From e237e0e5fcd7205e50706f831a55d8b52e2fb0f8 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 15 Sep 2014 15:29:22 +0700 Subject: [PATCH 043/415] fixed tests --- features/step_definitions/web.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/step_definitions/web.rb b/features/step_definitions/web.rb index a3cb037d..c3a6c65c 100644 --- a/features/step_definitions/web.rb +++ b/features/step_definitions/web.rb @@ -8,7 +8,7 @@ }, }.to_ostruct visit root_path - click_on "Sign in" + first(:link, "Sign in").click click_on "Sign in with Github" page.should have_content("Successfully authenticated") end From 1c8198745e50a9db853f40a8713c2db9b4b976c8 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 15 Sep 2014 15:29:30 +0700 Subject: [PATCH 044/415] fixed i18n-js --- app/views/layouts/application.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 6a0b8821..31fbd336 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -61,5 +61,5 @@ = javascript_include_tag "application" - %script{"data-turbolinks-track" => "true"} - I18n.locale = #{raw I18n.locale.to_s.to_json}; + %script{"type" => "text/javascript", "data-turbolinks-track" => "true"} + I18n.locale = #{raw I18n.locale.to_json}; From c436ee0f888c14ac04a3809e90e7a627bdce53e2 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 15 Sep 2014 15:34:19 +0700 Subject: [PATCH 045/415] fixed js --- app/views/layouts/application.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 31fbd336..df09296e 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -61,5 +61,5 @@ = javascript_include_tag "application" - %script{"type" => "text/javascript", "data-turbolinks-track" => "true"} - I18n.locale = #{raw I18n.locale.to_json}; + %script{"data-turbolinks-track" => "true"} + I18n.locale = #{raw I18n.locale.to_json}; From e3c05cdbf4251b1589e629a62b9d87908b23fb95 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 15 Sep 2014 15:43:34 +0700 Subject: [PATCH 046/415] fixed turbo-links and i18n-js --- app/views/layouts/application.html.haml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index df09296e..7984afd8 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -51,7 +51,7 @@ .footer %p.pull-right - ::Rails.application.config.available_locales.each do |locale| - = link_to image_tag("flags/#{locale}.png"), "?locale=#{locale}" + = link_to image_tag("flags/#{locale}.png"), "?locale=#{locale}", data: {no_turbolink: true} %p © = link_to t('tip4commit'), 'http://tip4commit.com/', target: '_blank' @@ -61,5 +61,5 @@ = javascript_include_tag "application" - %script{"data-turbolinks-track" => "true"} - I18n.locale = #{raw I18n.locale.to_json}; + :javascript + I18n.locale = #{I18n.locale.to_json}; From e3b384a9a85ae8a08ab31a37ab061e082fb22463 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 15 Sep 2014 15:56:00 +0700 Subject: [PATCH 047/415] fixed turbo-links + i18n-js --- app/views/layouts/application.html.haml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 7984afd8..39ce810d 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -15,6 +15,10 @@ / %link{:rel => 'image_src', :type => 'image/png', :href => asset_path('logo.png')} = stylesheet_link_tag "application", media: "all" + = javascript_include_tag "application" + + :javascript + I18n.locale = #{I18n.locale.to_json}; = csrf_meta_tags %body @@ -58,8 +62,3 @@ 2013-#{Date.today.year}. = raw t('footer.text', github_link: link_to(t('footer.github_link'), 'https://github.com/tip4commit/tip4commit', target: '_blank'), support_link: link_to(t('footer.support_link'), 'http://tip4commit.com/projects/307')) = link_to t('footer.follow_link'), 'https://twitter.com/tip4commit', target: '_blank' - - = javascript_include_tag "application" - - :javascript - I18n.locale = #{I18n.locale.to_json}; From 31911c2ec2b5b16f15ced644045e04baf4eee011 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 15 Sep 2014 16:14:29 +0700 Subject: [PATCH 048/415] localized addthis. locale passed to coingiving in params --- app/views/layouts/application.html.haml | 2 +- app/views/projects/show.html.haml | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 39ce810d..70244692 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -18,7 +18,7 @@ = javascript_include_tag "application" :javascript - I18n.locale = #{I18n.locale.to_json}; + I18n.locale = "#{I18n.locale}"; = csrf_meta_tags %body diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index adf91c39..cca16a66 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -18,7 +18,7 @@ .panel-heading %h4.panel-title= t('.project_sponsors') .panel-body - %iframe{ src: "//coingiving.com/project_sponsors?url=#{project_url(@project, :protocol => 'https')}", scrolling: "no", style: 'width:100%; height:500px; border:0px; padding:0;overflow:hidden'} + %iframe{ src: "//coingiving.com/project_sponsors?url=#{project_url(@project, :protocol => 'https')}?locale=#{I18n.locale}", scrolling: "no", style: 'width:100%; height:500px; border:0px; padding:0;overflow:hidden'} .hidden %span(data-coingiving="title")= "[tip4commit] " + @project.full_name %span(data-coingiving="description")= @project.description @@ -95,7 +95,8 @@ %h4= t('.promote_project', project: @project.full_name) %p / AddThis Button BEGIN - .addthis_toolbox.addthis_default_style.addthis_32x32_style(addthis:data_track_clickback="false" addthis:data_track_addressbar="false") + .addthis_toolbox.addthis_default_style.addthis_32x32_style(addthis:data_track_clickback="false" addthis:data_track_addressbar="false" + addthis:ui_language="#{I18n.locale}") %a.addthis_button_preferred_1 %a.addthis_button_preferred_2 %a.addthis_button_preferred_3 From c84b2cb806318d39c656a96ea0115b534c747c89 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 15 Sep 2014 16:45:34 +0700 Subject: [PATCH 049/415] fixed coingiving --- app/assets/images/flags/en.png | Bin 599 -> 599 bytes app/assets/images/flags/fr.png | Bin 545 -> 545 bytes app/views/projects/show.html.haml | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/images/flags/en.png b/app/assets/images/flags/en.png index ff701e19f6d2c0658fb23b1d94124cba4ce60851..258228e88cf66d8f6633fea6b641a595db9ed2a1 100644 GIT binary patch delta 15 Wcmcc4a-D^xGr-S%BWn;7BNqTFO9Vau delta 14 Vcmcc4a-D^>Gr-TCcOy#>696Sj1V8`) diff --git a/app/assets/images/flags/fr.png b/app/assets/images/flags/fr.png index 8332c4ec23c853944c29b02d7b32a88033f48a71..22836232bcb13f71b46e3c2c288a5bbfc5f832c3 100644 GIT binary patch delta 15 WcmZ3;vXF(PGr-S%BdZJ(BNqT8ivyeh delta 14 VcmZ3;vXF(fGr-TCcO#1o696A#1D*f? diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index cca16a66..61de66dd 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -18,7 +18,7 @@ .panel-heading %h4.panel-title= t('.project_sponsors') .panel-body - %iframe{ src: "//coingiving.com/project_sponsors?url=#{project_url(@project, :protocol => 'https')}?locale=#{I18n.locale}", scrolling: "no", style: 'width:100%; height:500px; border:0px; padding:0;overflow:hidden'} + %iframe{ src: "//coingiving.com/project_sponsors?locale=#{I18n.locale}&url=#{project_url(@project, :protocol => 'https')}", scrolling: "no", style: 'width:100%; height:500px; border:0px; padding:0;overflow:hidden'} .hidden %span(data-coingiving="title")= "[tip4commit] " + @project.full_name %span(data-coingiving="description")= @project.description From e1758976bb8e4d87bd910e6a7f04ec2316e617e9 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 15 Sep 2014 17:55:29 +0700 Subject: [PATCH 050/415] reverted flags --- app/assets/images/flags/en.png | Bin 599 -> 599 bytes app/assets/images/flags/fr.png | Bin 545 -> 545 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/app/assets/images/flags/en.png b/app/assets/images/flags/en.png index 258228e88cf66d8f6633fea6b641a595db9ed2a1..ff701e19f6d2c0658fb23b1d94124cba4ce60851 100644 GIT binary patch delta 14 Vcmcc4a-D^>Gr-TCcOy#>696Sj1V8`) delta 15 Wcmcc4a-D^xGr-S%BWn;7BNqTFO9Vau diff --git a/app/assets/images/flags/fr.png b/app/assets/images/flags/fr.png index 22836232bcb13f71b46e3c2c288a5bbfc5f832c3..8332c4ec23c853944c29b02d7b32a88033f48a71 100644 GIT binary patch delta 14 VcmZ3;vXF(fGr-TCcO#1o696A#1D*f? delta 15 WcmZ3;vXF(PGr-S%BdZJ(BNqT8ivyeh From c7188fdfa5617ac05503f50f6533d3790c898a5e Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 15 Sep 2014 17:59:23 +0700 Subject: [PATCH 051/415] removed broken icons --- app/assets/images/flags/en.png | Bin 599 -> 0 bytes app/assets/images/flags/fr.png | Bin 545 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 app/assets/images/flags/en.png delete mode 100644 app/assets/images/flags/fr.png diff --git a/app/assets/images/flags/en.png b/app/assets/images/flags/en.png deleted file mode 100644 index ff701e19f6d2c0658fb23b1d94124cba4ce60851..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 599 zcmV-d0;v6oP)U(k2*|8J(R-+sudaynhucHbwAMTnor{mwqO^w7JHzaBsT z{O^B8RYf5+LvDs&KmRKVd78=o{`1#HTiEo_OolaGleS)G+IQ#sUI`b*pv<`1zCJ=H0jd{{2S>p`ri%{LsXJ%FbMS z$#S`6f|?OG!^Jxczkf6Q`UNF{l0Sd`ad7zm>({^EzyAS6{{CgrkluOb3l1A>ZU2~A zK+FZ=zkmP!`TOVhpFbzBzFaPmD2$N3;+$pK?>zdet`f0002ovPDHLkV1gy;I?Vt8 diff --git a/app/assets/images/flags/fr.png b/app/assets/images/flags/fr.png deleted file mode 100644 index 8332c4ec23c853944c29b02d7b32a88033f48a71..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 545 zcmV++0^a?JP)lgG%);U`26kn-@hOg zU%!6+4+cOs(0HIde9xZz`}Onxub&LUB0x(30+2WcIRJn#2ut|?gWYu1Cf+!-K%B8# zdf?1WA}#uZ8oj7u>$I1i0Al&`=O0k%-@icgAIJnM0xA6maSq6BK-ECw|NZ*S`0Lj% z1_pot6puj;05Ax`F!=umqj7^frO?t|3^&I1kxUq9yECc+jQpY84SWH_0#pxl$?v~F z@*hy-KN0|X07U)z`4{NpU%#2aHUI<=%a31wK(7Du52Oc(|3O^?R1IN+RRjI-n*kVB z3=9AP#PZ|EACPLGJ%9cJNh|>9B%spYzZw7h1%?tp0I_@ndg9MNE>313@6R75NcceF zkr51-#U+7;F#`Sf7i0rK0I_`g_NQ&Z Date: Mon, 15 Sep 2014 17:59:45 +0700 Subject: [PATCH 052/415] added icons --- app/assets/images/flags/en.png | Bin 0 -> 599 bytes app/assets/images/flags/fr.png | Bin 0 -> 545 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 app/assets/images/flags/en.png create mode 100644 app/assets/images/flags/fr.png diff --git a/app/assets/images/flags/en.png b/app/assets/images/flags/en.png new file mode 100644 index 0000000000000000000000000000000000000000..ff701e19f6d2c0658fb23b1d94124cba4ce60851 GIT binary patch literal 599 zcmV-d0;v6oP)U(k2*|8J(R-+sudaynhucHbwAMTnor{mwqO^w7JHzaBsT z{O^B8RYf5+LvDs&KmRKVd78=o{`1#HTiEo_OolaGleS)G+IQ#sUI`b*pv<`1zCJ=H0jd{{2S>p`ri%{LsXJ%FbMS z$#S`6f|?OG!^Jxczkf6Q`UNF{l0Sd`ad7zm>({^EzyAS6{{CgrkluOb3l1A>ZU2~A zK+FZ=zkmP!`TOVhpFbzBzFaPmD2$N3;+$pK?>zdet`f0002ovPDHLkV1gy;I?Vt8 literal 0 HcmV?d00001 diff --git a/app/assets/images/flags/fr.png b/app/assets/images/flags/fr.png new file mode 100644 index 0000000000000000000000000000000000000000..8332c4ec23c853944c29b02d7b32a88033f48a71 GIT binary patch literal 545 zcmV++0^a?JP)lgG%);U`26kn-@hOg zU%!6+4+cOs(0HIde9xZz`}Onxub&LUB0x(30+2WcIRJn#2ut|?gWYu1Cf+!-K%B8# zdf?1WA}#uZ8oj7u>$I1i0Al&`=O0k%-@icgAIJnM0xA6maSq6BK-ECw|NZ*S`0Lj% z1_pot6puj;05Ax`F!=umqj7^frO?t|3^&I1kxUq9yECc+jQpY84SWH_0#pxl$?v~F z@*hy-KN0|X07U)z`4{NpU%#2aHUI<=%a31wK(7Du52Oc(|3O^?R1IN+RRjI-n*kVB z3=9AP#PZ|EACPLGJ%9cJNh|>9B%spYzZw7h1%?tp0I_@ndg9MNE>313@6R75NcceF zkr51-#U+7;F#`Sf7i0rK0I_`g_NQ&Z Date: Thu, 18 Sep 2014 12:59:31 +0700 Subject: [PATCH 053/415] allow project maintainers to disable notifying of new users notify new users only if their balance hits 0.005 btc #111 --- app/controllers/projects_controller.rb | 2 +- app/models/tip.rb | 4 +++- app/views/projects/edit.html.haml | 1 + app/views/projects/show.html.haml | 3 +++ config/locales/en.yml | 4 +++- config/locales/fr.yml | 2 ++ .../20140918051752_add_disable_notifications_to_projects.rb | 5 +++++ db/schema.rb | 3 ++- 8 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 db/migrate/20140918051752_add_disable_notifications_to_projects.rb diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 582c0852..ee02fbfa 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -97,7 +97,7 @@ def load_project end def project_params - params.require(:project).permit(:branch, :hold_tips, tipping_policies_text_attributes: [:text]) + params.require(:project).permit(:branch, :disable_notifications, :hold_tips, tipping_policies_text_attributes: [:text]) end def projects_order diff --git a/app/models/tip.rb b/app/models/tip.rb index d0c67bb9..0b5ac7de 100644 --- a/app/models/tip.rb +++ b/app/models/tip.rb @@ -112,7 +112,9 @@ def amount_percentage=(percentage) end def notify_user - if amount and amount > 0 and user.bitcoin_address.blank? and !user.unsubscribed + if amount && amount > 0 && user.bitcoin_address.blank? && + !user.unsubscribed && !project.disable_notifications && + user.balance > 0.005 if user.notified_at.nil? or user.notified_at < 30.days.ago begin UserMailer.new_tip(user, self).deliver diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml index 8cae05db..5e4e5104 100644 --- a/app/views/projects/edit.html.haml +++ b/app/views/projects/edit.html.haml @@ -9,4 +9,5 @@ = f.fields_for :tipping_policies_text, @project.tipping_policies_text || @project.build_tipping_policies_text do |fields| = fields.text_area :text, rows: 10, label: t('.tipping_policies') = f.check_box :hold_tips, label: t('.hold_tips') + = f.check_box :disable_notifications, label: t('.disable_notifications') = f.submit t('.save'), class: "btn btn-default" diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 61de66dd..b057d869 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -3,6 +3,9 @@ - content_for :description do = @project.description +- if @project.disable_notifications + .alert.alert-danger= t('.disabled_notifications') + %h1 = @project.full_name %small= link_to glyph(:github), @project.github_url, target: '_blank' diff --git a/config/locales/en.yml b/config/locales/en.yml index 8172c06f..ccf68ca9 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -78,6 +78,7 @@ en: title: "Contribute to %{project}" edit_project: Change project settings decide_tip_amounts: Decide tip amounts + disabled_notifications: "Project maintainers have decided not to notify new contributors about tips and they probably don't like this way of funding." project_sponsors: Project Sponsors fee: "%{percentage} of deposited funds will be used to tip for new commits." balance: Balance @@ -115,6 +116,7 @@ en: tipping_policies: Tipping policies hold_tips: "Do not send the tips immediatly. Give collaborators the ability to modify the tips before they're sent" save: Save the project settings + disable_notifications: Don't notify new contributors decide_tip_amounts: commit: Commit author: Author @@ -209,4 +211,4 @@ en: bitcoin_address: Bitcoin address password: Password password_confirmation: Password confirmation - display_name: Display name + display_name: Display name \ No newline at end of file diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 8519093d..0b610082 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -78,6 +78,7 @@ fr: title: "Contribuer à %{project}" edit_project: Changer les paramètres du projet decide_tip_amounts: Choisir un montant de pourboire + disabled_notifications: "Project maintainers have decided not to notify new contributors about tips and they probably don't like this way of funding." project_sponsors: Sponsors du projet fee: "%{percentage} des fonds déposés seront utilisés pour récompenser les nouvelles contributions." balance: Fonds @@ -115,6 +116,7 @@ fr: tipping_policies: Politique des pourboires hold_tips: "N'envoyez pas les bourboires tout de suite. Laissez à vos collaborateurs la possibilité de modifier les pourboires avant qu'ils ne soient envoyés" save: Enregistrer les paramètres du projet + disable_notifications: Don't notify new contributors decide_tip_amounts: commit: Contribution author: Auteur diff --git a/db/migrate/20140918051752_add_disable_notifications_to_projects.rb b/db/migrate/20140918051752_add_disable_notifications_to_projects.rb new file mode 100644 index 00000000..98c03469 --- /dev/null +++ b/db/migrate/20140918051752_add_disable_notifications_to_projects.rb @@ -0,0 +1,5 @@ +class AddDisableNotificationsToProjects < ActiveRecord::Migration + def change + add_column :projects, :disable_notifications, :boolean + end +end diff --git a/db/schema.rb b/db/schema.rb index 9a468895..b9683cf3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140823060921) do +ActiveRecord::Schema.define(version: 20140918051752) do create_table "collaborators", force: true do |t| t.integer "project_id" @@ -52,6 +52,7 @@ t.boolean "hold_tips", default: false t.datetime "info_updated_at" t.string "branch" + t.boolean "disable_notifications" end add_index "projects", ["full_name"], name: "index_projects_on_full_name", unique: true From 8949f0f235901f22ec11f5942acf741ad45c5563 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Thu, 18 Sep 2014 15:49:53 +0700 Subject: [PATCH 054/415] fixed notification threshold --- app/models/tip.rb | 2 +- features/notification_threshold.feature | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 features/notification_threshold.feature diff --git a/app/models/tip.rb b/app/models/tip.rb index 0b5ac7de..969bd19a 100644 --- a/app/models/tip.rb +++ b/app/models/tip.rb @@ -114,7 +114,7 @@ def amount_percentage=(percentage) def notify_user if amount && amount > 0 && user.bitcoin_address.blank? && !user.unsubscribed && !project.disable_notifications && - user.balance > 0.005 + user.balance > 500000 if user.notified_at.nil? or user.notified_at < 30.days.ago begin UserMailer.new_tip(user, self).deliver diff --git a/features/notification_threshold.feature b/features/notification_threshold.feature new file mode 100644 index 00000000..5e613f6e --- /dev/null +++ b/features/notification_threshold.feature @@ -0,0 +1,19 @@ +Feature: Users should not be notified if their balance is small + Background: + Given a project "django" + And a deposit of "0.1" + And 2 new commits + + Scenario: Without big deposits + When the new commits are read + Then there should be 0 email sent + + Scenario: User's balance hits threshold + When 100 new commits + And the new commits are read + Then there should be 1 email sent + + Scenario: With bigger donation + When a deposit of "2" + And the new commits are read + Then there should be 1 email sent \ No newline at end of file From fc871f69c729da473ef054d99d1aa17d95f14767 Mon Sep 17 00:00:00 2001 From: yunixon Date: Thu, 25 Sep 2014 17:46:20 +0400 Subject: [PATCH 055/415] RU Locale --- config/locales/ru.yml | 214 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 214 insertions(+) create mode 100644 config/locales/ru.yml diff --git a/config/locales/ru.yml b/config/locales/ru.yml new file mode 100644 index 00000000..f573be31 --- /dev/null +++ b/config/locales/ru.yml @@ -0,0 +1,214 @@ +ru: + tip4commit: Tip4Commit + meta: + title: Помощь проектам с открытым исходным кодом + description: Пожертвования в биткойнах проектам с открытым исходным кодом или создание коммита и получение чаевых за него. + menu: + home: Главная + projects: Проекты + footer: + text: "Исходный код доступен на %{github_link} и также вы можете %{support_link} для развития." + github_link: GitHub + support_link: поддержка + follow_link: Следуй за @tip4commit + links: + sign_in: Войти + sign_out: Выйти + errors: + project_not_found: Проект не найден. + access_denied: Доступ запрещен + can_assign_more_tips: "Нельзя использовать более чем 100% свободных средств." + wrong_bitcoin_address: Ошибка обновления биткоин адреса + user_not_found: Пользователь не найден + access_denied: Вы не авторизованы для выполнения данного действия! + notices: + project_updated: Настройки проекта обновлены + tips_decided: Сумма для чаевых определена + user_updated: Ваш профиль обновлен! + user_unsubscribed: "Вы отписались! Приносим извинения за предоставленные неудобства. Однако, вы все равно можете оставить нам свой Биткоин адрес, чтобы получать вознагрождения" + tip_amounts: + undecided: "Не определено" + free: "Free: 0%" + tiny: "Tiny: 0.1%" + small: "Small: 0.5%" + normal: "Normal: 1%" + big: "Big: 2%" + huge: "Huge: 5%" + js: + errors: + value: + invalid: Неверное значение + email: + invalid: Ошибка в Email адресе + blank: Email не может быть пустым + password: + blank: Пароль не может быть пустым + invalid: Пароль и его подтверждение не совпадают + password_confirmation: + blank: Подтверждение пароля не может быть пустым + invalid: Пароль и его подтверждение не совпадают + home: + index: + see_projects: Проекты + how_does_it_work: + title: Как это работает? + text: Люди жертвуют биткоин монеты на проекты. Когда кто-либо принимает коммит в проекте своего репозитория, мы автоматически начисляем чаевые автору. + button: Узнать о Биткоин + donate: + title: Пожертвования + text: Найдите проект, который вам по душе и перечислите биткоин монеты на него. Ваши пожертвования вместе с пожертвованиями других автоматически будут зачисляться в качестве чаевых за новые коммиты. + button: Найти или Добавить проект + contribute: + title: Сопровождение + text: Идите и почините что-либо! Если ваш коммит будет принят контрибьютором проекта, вам будут начислены чаевые! + sign_in_text: "Просто проверьте ваш email или %{sign_in_link}." + button: Проекты + projects: + index: + find_project: + placeholder: Введите GitHub адрес вашего проекта для добавления или ключевое слово для поиска... + button: Найти или добавить проект + repository: Репозитроий + description: Описание + watchers: Наблюдателей + balance: Баланс + forked_from: forked from + support: Поддержка + show: + title: "Сопровождать: %{project}" + edit_project: Изменить настройки проекта + decide_tip_amounts: Установить сумму чаевых + disabled_notifications: "Контрибьюторы проекта решили не уведомлять новых участников о чаевых и вероятно им не нравиться такой способ финансирования." + project_sponsors: Спонсоры Проекта + fee: "%{percentage} средств будет использоваться в качестве чаевых за новый коммит." + balance: Баланс + deposits: депозиты + custom_tip_size: (каждый новый коммит получает процент от доступного остатка) + default_tip_size: "(каждый новый коммит получает %{percentage} от доступного остатка)" + unconfirmed_amount: "(%{amount} не подтверждено)" + tipping_policies: Чаевые + updated_by_user: "(Последние изменения %{name} на %{date})" + updated_by_unknown: "(Последния изменения на %{date})" + tips_paid: Оплаченные Чаевые + unclaimed_amount: "(%{amount} от суммы являются невостребованными, и будут возвращены проекту через месяц.)" + last_tips: Недавние Чаевые + see_all: смотреть все + received: "получено %{amount}" + will_receive: получат чаевые + for_commit: за коммит + when_decided: когда сумма задана + next_tip: Следующие чаевые + contribute_and_earn: Сопровождение и Заработок + contribute_and_earn_description: "Пожертвовать биткойны этому проекту или %{make_commits_link} и получить чаевые. Если ваш коммит будет принят в %{branch} контрибьютором проекта и есть биткойны на балансе проекта, то вы получите чаевые!" + contribute_and_earn_branch: "в %{branch} ветку" + make_commits_link: сделать коммит + tell_us_bitcoin_address: "Просто %{tell_us_link} ваш биткоин адрес." + tell_us_link: укажите + sign_in: "Просто проверьте ваш email или %{sign_in_link}." + promote_project: Содействовать %{project} + embedding: Внедрять + image_url: "URL изображения:" + shield_title: чаевые за следующий коммит + edit: + project_settings: "%{project} настройки проекта" + branch: Ветка + default_branch: Ветка по умолчанию + tipping_policies: Чаевые + hold_tips: "Не отправляйте чаевые сразу. Предоставьте коллабораторам возможность изменить чаевые перед тем как они будут отправлены" + save: Сохранить настройки проекта + disable_notifications: Не оповещать новых контрибьюторов + decide_tip_amounts: + commit: Коммит + author: Автор + message: Сообщение + tip: Чаевые (зависят от баланса проекта) + submit: Отправить выбранную сумму чаевых + tips: + index: + tips: Чаевые + project_tips: '%{project} чаевые' + user_tips: "%{user} чаевые" + created_at: Создано + commiter: Коммитер + project: Проект + commit: Коммит + amount: Сумма + refunded: Возвращено на депозит проекта + undecided: Сумма чаевых пока не может быть определена + no_bitcoin_address: Адрес вывода не указан + below_threshold: "Баланс пользователя ниже порога вывода" + waiting: Ожидает вывода + error: (ошибка при отправке) + deposits: + index: + project_deposits: '%{project} депозиты' + deposits: Депозиты + created_at: Создано + project: Проект + amount: Сумма + transaction: Транзакция + confirmed: Подтверждена + confirmed_yes: 'Да' + confirmed_no: 'Нет' + users: + index: + title: Топ Контрибьюторов + name: Имя + commits_count: Чаевых за коммиты + withdrawn: Выведено + show: + balance: Баланс + threshold: "Вы получите свои деньги, когда ваш баланс достигнет %{threshold}" + see_all: смотреть все + received: "%{time} получено %{amount} за коммит %{commit} в %{project}" + bitcoin_address_placeholder: Ваш биткоин адрес + notify: Сообщать мне о новых чаевых (не больше чем одно email в месяц) + submit_user: Обновить информацию пользователя + change_password: Смена пароля + submit_password: Сменить пароль + withdrawals: + index: + title: Последние Выводы + created_at: Создано + transaction: Транзакция + result: Результат + error: Ошибка + success: Успешно + devise: + sessions: + new: + title: Вход + remember_me: Запомнить меня + submit: Войти + registrations: + new: + title: Регистрация + submit: Войти + passwords: + new: + title: Забыли ваш пароль? + submit: Сбросить пароль + edit: + title: Смена пароля + submit: Сменить пароль + confirmations: + new: + title: Выслать еще раз письмо с подтверждением + submit: Выслать + links: + sign_in: Вход + sign_up: Регистрация + recover: Забыли ваш пароль? + confirm: Не получили письмо с подтверждением? + sign_in_with: "Войти с %{provider}" + errors: + primary_email: ваш email адрес подтвержден. + onmiauth_info: не удалось получить информацию. + activerecord: + attributes: + user: + email: E-mail + bitcoin_address: Биткоин адрес + password: Пароль + password_confirmation: Пароль еще раз + display_name: Имя \ No newline at end of file From 05b890d49d4fd0a58794e1240da0d4ca8e4d96da Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Fri, 26 Sep 2014 11:35:18 +0600 Subject: [PATCH 056/415] fixed russian translation --- app/assets/javascripts/i18n/translations.js | 2 +- app/views/projects/show.html.haml | 2 +- config/application.rb | 2 +- config/locales/en.yml | 1 + config/locales/fr.yml | 1 + config/locales/ru.yml | 79 +++++++++++---------- spec/spec_helper.rb | 2 +- 7 files changed, 46 insertions(+), 43 deletions(-) diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js index 7bd072cb..8f971fc2 100644 --- a/app/assets/javascripts/i18n/translations.js +++ b/app/assets/javascripts/i18n/translations.js @@ -1,2 +1,2 @@ var I18n = I18n || {}; -I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}}}; +I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}}}; \ No newline at end of file diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index b057d869..48043f1f 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -93,7 +93,7 @@ - if current_user.bitcoin_address.blank? = raw t('.tell_us_bitcoin_address', tell_us_link: link_to(t('.tell_us_link'), current_user)) - else - = raw t('.sign_in', sign_in_link: link_to(t('links.sign_in'), new_user_session_path)) + = raw t('.sign_in', sign_in_link: link_to(t('links.sign_in_imp'), new_user_session_path)) %h4= t('.promote_project', project: @project.full_name) %p diff --git a/config/application.rb b/config/application.rb index 17bf72cb..884f54ff 100644 --- a/config/application.rb +++ b/config/application.rb @@ -25,7 +25,7 @@ class Application < Rails::Application config.autoload_paths += %W(#{config.root}/lib) config.assets.initialize_on_precompile = true - config.available_locales = %w(en fr) + config.available_locales = %w(en fr ru) end end diff --git a/config/locales/en.yml b/config/locales/en.yml index ccf68ca9..ef53d6d9 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -13,6 +13,7 @@ en: follow_link: Follow @tip4commit links: sign_in: Sign in + sign_in_imp: sign in sign_out: Sign Out errors: project_not_found: Project not found. diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 0b610082..e00b0980 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -13,6 +13,7 @@ fr: follow_link: Suivez @tip4commit links: sign_in: Se connecter + sign_in_imp: se connecter sign_out: Se déconnecter errors: project_not_found: Projet non trouvé. diff --git a/config/locales/ru.yml b/config/locales/ru.yml index f573be31..7482c2cc 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -2,17 +2,18 @@ ru: tip4commit: Tip4Commit meta: title: Помощь проектам с открытым исходным кодом - description: Пожертвования в биткойнах проектам с открытым исходным кодом или создание коммита и получение чаевых за него. + description: Жертвуйте биткойны проектам с открытым исходным кодом или создавайте коммиты и получайте чаевые за них. menu: home: Главная projects: Проекты footer: - text: "Исходный код доступен на %{github_link} и также вы можете %{support_link} для развития." + text: "Исходный код доступен на %{github_link}. Также вы можете %{support_link} разработку проекта." github_link: GitHub - support_link: поддержка - follow_link: Следуй за @tip4commit + support_link: поддержать + follow_link: Следите за @tip4commit links: sign_in: Войти + sign_in_imp: войдите sign_out: Выйти errors: project_not_found: Проект не найден. @@ -23,7 +24,7 @@ ru: access_denied: Вы не авторизованы для выполнения данного действия! notices: project_updated: Настройки проекта обновлены - tips_decided: Сумма для чаевых определена + tips_decided: Сумма чаевых определена user_updated: Ваш профиль обновлен! user_unsubscribed: "Вы отписались! Приносим извинения за предоставленные неудобства. Однако, вы все равно можете оставить нам свой Биткоин адрес, чтобы получать вознагрождения" tip_amounts: @@ -52,61 +53,61 @@ ru: see_projects: Проекты how_does_it_work: title: Как это работает? - text: Люди жертвуют биткоин монеты на проекты. Когда кто-либо принимает коммит в проекте своего репозитория, мы автоматически начисляем чаевые автору. + text: Люди жертвуют биткоины на проекты. Если владелец проекта принимает коммит в репозиторий, мы автоматически начисляем чаевые автору этого коммита. button: Узнать о Биткоин donate: - title: Пожертвования - text: Найдите проект, который вам по душе и перечислите биткоин монеты на него. Ваши пожертвования вместе с пожертвованиями других автоматически будут зачисляться в качестве чаевых за новые коммиты. - button: Найти или Добавить проект + title: Жертвуйте + text: Найдите проект который вам по душе и перечислите биткоины на него. Ваши пожертвования вместе с пожертвованиями других людей будут автоматически выплачиваться авторам новых коммитов в виде чаевых. + button: Найти или добавить проект contribute: - title: Сопровождение - text: Идите и почините что-либо! Если ваш коммит будет принят контрибьютором проекта, вам будут начислены чаевые! + title: Участвуйте + text: Идите и почините что-нибудь! Если ваш коммит будет принят владельцами проекта, вам будут выплачены чаевые! sign_in_text: "Просто проверьте ваш email или %{sign_in_link}." button: Проекты projects: index: find_project: - placeholder: Введите GitHub адрес вашего проекта для добавления или ключевое слово для поиска... + placeholder: Введите GitHub адрес вашего проекта чтобы добавить его или ключевое слово для поиска... button: Найти или добавить проект repository: Репозитроий description: Описание watchers: Наблюдателей balance: Баланс - forked_from: forked from - support: Поддержка + forked_from: ответвление от + support: Поддержать show: - title: "Сопровождать: %{project}" + title: "Помогайте %{project}" edit_project: Изменить настройки проекта decide_tip_amounts: Установить сумму чаевых disabled_notifications: "Контрибьюторы проекта решили не уведомлять новых участников о чаевых и вероятно им не нравиться такой способ финансирования." - project_sponsors: Спонсоры Проекта - fee: "%{percentage} средств будет использоваться в качестве чаевых за новый коммит." + project_sponsors: Спонсоры проекта + fee: "%{percentage} средств будет выплачено в качестве чаевых за новый коммит." balance: Баланс deposits: депозиты custom_tip_size: (каждый новый коммит получает процент от доступного остатка) default_tip_size: "(каждый новый коммит получает %{percentage} от доступного остатка)" unconfirmed_amount: "(%{amount} не подтверждено)" - tipping_policies: Чаевые + tipping_policies: Политика чаевых updated_by_user: "(Последние изменения %{name} на %{date})" updated_by_unknown: "(Последния изменения на %{date})" - tips_paid: Оплаченные Чаевые + tips_paid: Выплаченные чаевые unclaimed_amount: "(%{amount} от суммы являются невостребованными, и будут возвращены проекту через месяц.)" - last_tips: Недавние Чаевые + last_tips: Недавние чаевые see_all: смотреть все received: "получено %{amount}" will_receive: получат чаевые for_commit: за коммит when_decided: когда сумма задана next_tip: Следующие чаевые - contribute_and_earn: Сопровождение и Заработок - contribute_and_earn_description: "Пожертвовать биткойны этому проекту или %{make_commits_link} и получить чаевые. Если ваш коммит будет принят в %{branch} контрибьютором проекта и есть биткойны на балансе проекта, то вы получите чаевые!" - contribute_and_earn_branch: "в %{branch} ветку" - make_commits_link: сделать коммит + contribute_and_earn: Помогайте и зарабатывайте + contribute_and_earn_description: "Жертвуйте биткойны этому проекту или %{make_commits_link} и получайте чаевые за них. Если ваш коммит будет принят %{branch} владельцами проекта, а баланс этого проекта положительный, то вы получите чаевые!" + contribute_and_earn_branch: "в ветку %{branch}" + make_commits_link: создавайте коммиты tell_us_bitcoin_address: "Просто %{tell_us_link} ваш биткоин адрес." tell_us_link: укажите sign_in: "Просто проверьте ваш email или %{sign_in_link}." - promote_project: Содействовать %{project} - embedding: Внедрять + promote_project: Продвигайте %{project} + embedding: Код для вставки image_url: "URL изображения:" shield_title: чаевые за следующий коммит edit: @@ -114,7 +115,7 @@ ru: branch: Ветка default_branch: Ветка по умолчанию tipping_policies: Чаевые - hold_tips: "Не отправляйте чаевые сразу. Предоставьте коллабораторам возможность изменить чаевые перед тем как они будут отправлены" + hold_tips: "Не отправляйте чаевые сразу. Предоставьте владельцам проекта возможность изменить чаевые перед тем как они будут отправлены" save: Сохранить настройки проекта disable_notifications: Не оповещать новых контрибьюторов decide_tip_amounts: @@ -126,24 +127,24 @@ ru: tips: index: tips: Чаевые - project_tips: '%{project} чаевые' - user_tips: "%{user} чаевые" - created_at: Создано - commiter: Коммитер + project_tips: 'Чаевые %{project}' + user_tips: "Чаевые %{user}" + created_at: Время создания + commiter: Автор project: Проект commit: Коммит amount: Сумма refunded: Возвращено на депозит проекта - undecided: Сумма чаевых пока не может быть определена + undecided: Сумма чаевых ещё не определена no_bitcoin_address: Адрес вывода не указан below_threshold: "Баланс пользователя ниже порога вывода" waiting: Ожидает вывода error: (ошибка при отправке) deposits: index: - project_deposits: '%{project} депозиты' + project_deposits: 'Депозиты %{project}' deposits: Депозиты - created_at: Создано + created_at: Время создания project: Проект amount: Сумма transaction: Транзакция @@ -154,22 +155,22 @@ ru: index: title: Топ Контрибьюторов name: Имя - commits_count: Чаевых за коммиты - withdrawn: Выведено + commits_count: Количество коммитов + withdrawn: Выплачено show: balance: Баланс threshold: "Вы получите свои деньги, когда ваш баланс достигнет %{threshold}" see_all: смотреть все received: "%{time} получено %{amount} за коммит %{commit} в %{project}" bitcoin_address_placeholder: Ваш биткоин адрес - notify: Сообщать мне о новых чаевых (не больше чем одно email в месяц) + notify: Сообщать мне о новых чаевых (не чаще чем одно сообщение в месяц) submit_user: Обновить информацию пользователя change_password: Смена пароля submit_password: Сменить пароль withdrawals: index: - title: Последние Выводы - created_at: Создано + title: Последние выплаты + created_at: Время выплаты transaction: Транзакция result: Результат error: Ошибка diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c857851f..cee30cb5 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -6,7 +6,7 @@ require File.expand_path("../../config/environment", __FILE__) require 'rspec/rails' require 'rspec/autorun' - +# # Requires supporting ruby files with custom matchers and macros, etc, in # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are # run as spec files by default. This means that files in spec/support that end From 46ac18a810db5cddd5b8205d1cf05a94a364e598 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Fri, 26 Sep 2014 11:39:03 +0600 Subject: [PATCH 057/415] flags --- app/assets/images/flags/de.png | Bin 0 -> 545 bytes app/assets/images/flags/ru.png | Bin 0 -> 420 bytes public/javascripts/translations.js | 2 ++ 3 files changed, 2 insertions(+) create mode 100755 app/assets/images/flags/de.png create mode 100755 app/assets/images/flags/ru.png create mode 100644 public/javascripts/translations.js diff --git a/app/assets/images/flags/de.png b/app/assets/images/flags/de.png new file mode 100755 index 0000000000000000000000000000000000000000..ac4a977362738ca7daa20784717f10f9617136b4 GIT binary patch literal 545 zcmV++0^a?JP)h<6BFn%a z@b8~2SoNP@zd$;E{sbbRuHQd?{QCI=sNwhbA3*&Qe}GP900=;09NYi^fU@pUdVa9*13;+Sd!tjgXKhXQEMobL97(p6<{RLvMGBN!7 j!N9=G@a-1^K!5=NcXWu!7_DDe00000NkvXXu0mjfeQx^H literal 0 HcmV?d00001 diff --git a/app/assets/images/flags/ru.png b/app/assets/images/flags/ru.png new file mode 100755 index 0000000000000000000000000000000000000000..47da4214fd9edb383687c1d4f84fe8b42a51ceb2 GIT binary patch literal 420 zcmV;V0bBlwP)X|NRSO0LlM<{-BURBqYRGSojej zfLOL~|EH_V_~;P>Nc10*D0|Jxss< zFi1)Q<$$6LU}rIc*dU*QNFV}+9T))>0|XG`SD?F)5CbX~O$rDA0t^5@iDe$xIAIn5 O0000 Date: Fri, 26 Sep 2014 11:33:34 +0400 Subject: [PATCH 058/415] Fixed russian translation --- config/locales/ru.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 7482c2cc..0601048d 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -29,12 +29,12 @@ ru: user_unsubscribed: "Вы отписались! Приносим извинения за предоставленные неудобства. Однако, вы все равно можете оставить нам свой Биткоин адрес, чтобы получать вознагрождения" tip_amounts: undecided: "Не определено" - free: "Free: 0%" - tiny: "Tiny: 0.1%" - small: "Small: 0.5%" - normal: "Normal: 1%" - big: "Big: 2%" - huge: "Huge: 5%" + free: "Нет: 0%" + tiny: "Крошечные: 0.1%" + small: "Маленькие: 0.5%" + normal: "Обычные: 1%" + big: "Большие: 2%" + huge: "Огромные: 5%" js: errors: value: @@ -95,9 +95,9 @@ ru: last_tips: Недавние чаевые see_all: смотреть все received: "получено %{amount}" - will_receive: получат чаевые + will_receive: получит чаевые for_commit: за коммит - when_decided: когда сумма задана + when_decided: когда сумма будет определена next_tip: Следующие чаевые contribute_and_earn: Помогайте и зарабатывайте contribute_and_earn_description: "Жертвуйте биткойны этому проекту или %{make_commits_link} и получайте чаевые за них. Если ваш коммит будет принят %{branch} владельцами проекта, а баланс этого проекта положительный, то вы получите чаевые!" @@ -203,7 +203,7 @@ ru: confirm: Не получили письмо с подтверждением? sign_in_with: "Войти с %{provider}" errors: - primary_email: ваш email адрес подтвержден. + primary_email: ваш email адрес должен быть подтвержден. onmiauth_info: не удалось получить информацию. activerecord: attributes: From 24948534745868fc90ff5e07c7d7d38cc1593809 Mon Sep 17 00:00:00 2001 From: msizov Date: Fri, 26 Sep 2014 18:53:52 +0700 Subject: [PATCH 059/415] =?UTF-8?q?Fixed=20a=20typo=20in=20a=20russian=20w?= =?UTF-8?q?ord=20"=D0=A0=D0=B5=D0=BF=D0=BE=D0=B7=D0=B8=D1=82=D0=BE=D1=80?= =?UTF-8?q?=D0=B8=D0=B9"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/locales/ru.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 7482c2cc..20fc45f6 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -69,7 +69,7 @@ ru: find_project: placeholder: Введите GitHub адрес вашего проекта чтобы добавить его или ключевое слово для поиска... button: Найти или добавить проект - repository: Репозитроий + repository: Репозиторий description: Описание watchers: Наблюдателей balance: Баланс @@ -212,4 +212,4 @@ ru: bitcoin_address: Биткоин адрес password: Пароль password_confirmation: Пароль еще раз - display_name: Имя \ No newline at end of file + display_name: Имя From 03fce9f70362029dbd7a2e5976a24f8dac637727 Mon Sep 17 00:00:00 2001 From: Jan Keromnes Date: Sat, 27 Sep 2014 18:14:34 +0000 Subject: [PATCH 060/415] Update French locale. --- config/locales/fr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/fr.yml b/config/locales/fr.yml index e00b0980..3acd3398 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -79,7 +79,7 @@ fr: title: "Contribuer à %{project}" edit_project: Changer les paramètres du projet decide_tip_amounts: Choisir un montant de pourboire - disabled_notifications: "Project maintainers have decided not to notify new contributors about tips and they probably don't like this way of funding." + disabled_notifications: "Les responsables du projet ont décidé de ne pas prévenir les nouveaux contributeurs au sujet des pourboires, et n'apprécient probablement pas ce type de rémunération." project_sponsors: Sponsors du projet fee: "%{percentage} des fonds déposés seront utilisés pour récompenser les nouvelles contributions." balance: Fonds @@ -117,7 +117,7 @@ fr: tipping_policies: Politique des pourboires hold_tips: "N'envoyez pas les bourboires tout de suite. Laissez à vos collaborateurs la possibilité de modifier les pourboires avant qu'ils ne soient envoyés" save: Enregistrer les paramètres du projet - disable_notifications: Don't notify new contributors + disable_notifications: Ne pas prévenir les nouveaux contributeurs decide_tip_amounts: commit: Contribution author: Auteur From cae59eae495616dcbec329ba4090695e83663381 Mon Sep 17 00:00:00 2001 From: Nikita Date: Sun, 28 Sep 2014 18:53:42 +0400 Subject: [PATCH 061/415] fix promote text --- config/locales/ru.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 77652f75..30b7f782 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -106,7 +106,7 @@ ru: tell_us_bitcoin_address: "Просто %{tell_us_link} ваш биткоин адрес." tell_us_link: укажите sign_in: "Просто проверьте ваш email или %{sign_in_link}." - promote_project: Продвигайте %{project} + promote_project: расскажите о %{project} embedding: Код для вставки image_url: "URL изображения:" shield_title: чаевые за следующий коммит From 55e46e04a76afb7a272c83962c8b097bd600803b Mon Sep 17 00:00:00 2001 From: bill auger Date: Sat, 18 Oct 2014 03:59:52 +0000 Subject: [PATCH 062/415] prevent travis from bulding debugger gem --- .travis.yml | 5 +++++ Gemfile | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 24f8a5bd..c31607c3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,14 @@ language: ruby + rvm: - 2.0.0 + +bundler_args: --without development + before_script: - cp config/config.yml.sample config/config.yml - cp config/database.yml.sample config/database.yml + script: - bundle exec rake spec - bundle exec rake cucumber diff --git a/Gemfile b/Gemfile index 025850a6..0eb84dc3 100644 --- a/Gemfile +++ b/Gemfile @@ -42,12 +42,12 @@ group :development do gem 'capistrano-bundler', '>= 1.1.0' gem 'capistrano-rails', '~> 1.1.0' gem 'sqlite3', '~> 1.3.8' + gem 'debugger', '~> 1.6.5' end group :development, :test do gem 'factory_girl_rails', '~> 4.3.0' gem 'rspec-rails', '~> 3.0.0.beta' - gem 'debugger', '~> 1.6.5' end group :test do From bbfbf8b0f3743ceddb7af758426d1f408d91edbc Mon Sep 17 00:00:00 2001 From: bill auger Date: Sat, 18 Oct 2014 04:16:10 +0000 Subject: [PATCH 063/415] add sqlite3 to the test environment bundle for travis --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 0eb84dc3..0108e6d9 100644 --- a/Gemfile +++ b/Gemfile @@ -41,11 +41,11 @@ group :development do gem 'capistrano-rvm', '~> 0.1.0', github: 'capistrano/rvm' gem 'capistrano-bundler', '>= 1.1.0' gem 'capistrano-rails', '~> 1.1.0' - gem 'sqlite3', '~> 1.3.8' gem 'debugger', '~> 1.6.5' end group :development, :test do + gem 'sqlite3', '~> 1.3.8' gem 'factory_girl_rails', '~> 4.3.0' gem 'rspec-rails', '~> 3.0.0.beta' end From 6702a4fbfe3d725a60e1b414698a8db4e14866f9 Mon Sep 17 00:00:00 2001 From: bill auger Date: Sat, 18 Oct 2014 19:12:05 +0000 Subject: [PATCH 064/415] add sign_up link to header and home page * site-wide header filters 'sign_up' and 'sign_in' links based on controller * added sign_up message machine translations for 'fr' and 'ru' locales --- app/assets/javascripts/i18n/translations.js | 2 +- app/views/home/index.html.haml | 2 ++ app/views/layouts/application.html.haml | 7 ++++++- config/locales/en.yml | 3 ++- config/locales/fr.yml | 1 + config/locales/ru.yml | 1 + 6 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js index 8f971fc2..356c6e1d 100644 --- a/app/assets/javascripts/i18n/translations.js +++ b/app/assets/javascripts/i18n/translations.js @@ -1,2 +1,2 @@ var I18n = I18n || {}; -I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}}}; \ No newline at end of file +I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}}}; \ No newline at end of file diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml index f82c13d5..76c75087 100644 --- a/app/views/home/index.html.haml +++ b/app/views/home/index.html.haml @@ -25,6 +25,8 @@ = t('.contribute.text') - if !current_user = raw t('.contribute.sign_in_text', sign_in_link: link_to(t('links.sign_in'), new_user_session_path)) + - if Devise.mappings[:user].registerable? + = raw t('.contribute.sign_up_text', sign_up_link: link_to(t('links.sign_up'), new_user_registration_path)) %p %a.btn.btn-primary{href: projects_path} = t('.contribute.button') diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 70244692..4caf47b9 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -41,7 +41,12 @@ \/ = link_to t('links.sign_out'), destroy_user_session_path, method: :delete - else - = link_to t('links.sign_in'), new_user_session_path + - if controller_name != 'registrations' + = link_to t('links.sign_up'), new_user_registration_path + - unless %w{sessions registrations}.include? controller_name + = " or " + - if controller_name != 'sessions' + = link_to t('links.sign_in'), new_user_session_path %h3.text-muted.code-pro= t('tip4commit') = render 'common/menu' diff --git a/config/locales/en.yml b/config/locales/en.yml index ef53d6d9..108c3985 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -62,7 +62,8 @@ en: contribute: title: Contribute text: Go and fix something! If your commit is accepted by the project maintainer, you will get a tip! - sign_in_text: "Just check your email or %{sign_in_link}." + sign_in_text: "Just check your email for an invitation or %{sign_in_link}." + sign_up_text: "If you have not yet received an invitation, you can %{sign_up_link} with a valid email address or via GitHub." button: Supported projects projects: index: diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 3acd3398..861ad848 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -63,6 +63,7 @@ fr: title: Contribuer text: Améliorez un projet ! Si votre contribution est acceptée par le mainteneur du projet, vous recevrez un pourboire ! sign_in_text: "Vérifiez simplement vos emails ou %{sign_in_link}." + sign_up_text: "Si vous n'avez pas encore reçu une invitation, vous pouvez %{sign_up_link} avec une adresse de courriel valide ou via GitHub." button: Projets subventionnés projects: index: diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 77652f75..84489ce8 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -63,6 +63,7 @@ ru: title: Участвуйте text: Идите и почините что-нибудь! Если ваш коммит будет принят владельцами проекта, вам будут выплачены чаевые! sign_in_text: "Просто проверьте ваш email или %{sign_in_link}." + sign_up_text: "Если вы еще не получил приглашение, вы можете %{sign_up_link} с действительным адресом электронной почты или через GitHub." button: Проекты projects: index: From 69f3a75d95d57d2174f01f738266659c4598a0b8 Mon Sep 17 00:00:00 2001 From: Nikita Date: Sat, 27 Sep 2014 23:32:08 +0400 Subject: [PATCH 065/415] changed search string Changed the search string. now in the search button, you can accommodate any number of characters. Words don't come out for button borders in languages other than English --- app/views/projects/index.html.haml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/views/projects/index.html.haml b/app/views/projects/index.html.haml index 95c1a613..e6d8debb 100644 --- a/app/views/projects/index.html.haml +++ b/app/views/projects/index.html.haml @@ -3,11 +3,12 @@ = form_tag search_projects_path, role: 'form', method: :get do |f| .form-group .row - .col-lg-10 - = text_field_tag :query, '', class: 'form-control', placeholder: t('.find_project.placeholder'), :value => params[:query] - = hidden_field_tag :order, params[:order] || 'balance' - .col-lg-2 - = button_tag t('.find_project.button'), class: "btn form-control btn-default", name: nil + .col-lg-12 + .input-group + = text_field_tag :query, '', class: 'form-control', placeholder: t('.find_project.placeholder'), :value => params[:query] + = hidden_field_tag :order, params[:order] || 'balance' + %span.input-group-btn + = button_tag t('.find_project.button'), class: "btn btn-default", name: nil %p - if @projects.count > 0 %table.table.table-striped From 9d865ad717afc444c20e8d218957de2e9dd01795 Mon Sep 17 00:00:00 2001 From: Nikita Date: Sat, 27 Sep 2014 23:44:08 +0400 Subject: [PATCH 066/415] Resize the button support Resize the button "support" for the line size, line height --- app/views/projects/index.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/index.html.haml b/app/views/projects/index.html.haml index e6d8debb..a6c1445a 100644 --- a/app/views/projects/index.html.haml +++ b/app/views/projects/index.html.haml @@ -33,7 +33,7 @@ %td= project.description %td= project.watchers_count %td= btc_human project.available_amount_cache - %td= link_to t('.support'), pretty_project_path(project), class: 'btn btn-success' + %td= link_to t('.support'), pretty_project_path(project), class: 'btn btn-xs btn-success' = paginate @projects - else .alert.alert-warning{role: 'alert'}= I18n.t('errors.project_not_found') From 9a7720b7d0d0395239afe27f9955afaa843e65ed Mon Sep 17 00:00:00 2001 From: Nikita Date: Sun, 28 Sep 2014 00:07:22 +0400 Subject: [PATCH 067/415] changed text support button changed text support button --- config/locales/en.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index ef53d6d9..0479830e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -74,7 +74,7 @@ en: watchers: Watchers balance: Balance forked_from: forked from - support: Support + support: Support project show: title: "Contribute to %{project}" edit_project: Change project settings @@ -212,4 +212,4 @@ en: bitcoin_address: Bitcoin address password: Password password_confirmation: Password confirmation - display_name: Display name \ No newline at end of file + display_name: Display name From df7d75b1d3ff8a7d18e8986882ee0ef8f69982ba Mon Sep 17 00:00:00 2001 From: Nikita Date: Sun, 28 Sep 2014 00:07:49 +0400 Subject: [PATCH 068/415] changed text support button changed text support button --- config/locales/ru.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 30b7f782..8ccac7c6 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -74,7 +74,7 @@ ru: watchers: Наблюдателей balance: Баланс forked_from: ответвление от - support: Поддержать + support: Поддержать проект show: title: "Помогайте %{project}" edit_project: Изменить настройки проекта From 6ceb270009b006c76d3a919d96451f20f96aa66c Mon Sep 17 00:00:00 2001 From: Nikita Date: Sun, 28 Sep 2014 00:34:21 +0400 Subject: [PATCH 069/415] Update ru.yml added quotes on the problem --- config/locales/ru.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 8ccac7c6..017012de 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -74,7 +74,7 @@ ru: watchers: Наблюдателей balance: Баланс forked_from: ответвление от - support: Поддержать проект + support: "Поддержать проект" show: title: "Помогайте %{project}" edit_project: Изменить настройки проекта From 620f0ec55198af49c286a626144906b8e70ed6d7 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Tue, 21 Oct 2014 12:32:52 +0600 Subject: [PATCH 070/415] capitalized promote_project text --- config/locales/ru.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 017012de..04b37acd 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -106,7 +106,7 @@ ru: tell_us_bitcoin_address: "Просто %{tell_us_link} ваш биткоин адрес." tell_us_link: укажите sign_in: "Просто проверьте ваш email или %{sign_in_link}." - promote_project: расскажите о %{project} + promote_project: "Расскажите о %{project}" embedding: Код для вставки image_url: "URL изображения:" shield_title: чаевые за следующий коммит From 3844df7021c4d02b281dc6ef89068835ca249e89 Mon Sep 17 00:00:00 2001 From: Michael Ford Date: Tue, 7 Oct 2014 22:08:07 +0800 Subject: [PATCH 071/415] Use https links in new_tip.html.haml --- app/views/user_mailer/new_tip.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/user_mailer/new_tip.html.haml b/app/views/user_mailer/new_tip.html.haml index 9d92730c..001c1072 100644 --- a/app/views/user_mailer/new_tip.html.haml +++ b/app/views/user_mailer/new_tip.html.haml @@ -4,13 +4,13 @@ %p Your current balance is #{btc_human @user.balance}. If you don't enter a bitcoin address your tips will be returned to the project in 30 days. -%p If you don't need bitcoins you can redirect your funds to any charity by using its address which you can find at #{link_to 'coingiving.com', 'http://coingiving.com/'}. +%p If you don't need bitcoins you can redirect your funds to any charity by using its address which you can find at #{link_to 'coingiving.com', 'https://coingiving.com/'}. %p= link_to 'Sign In', login_users_url(token: @user.login_token) %p Thanks for contributing to Open Source! -%p= link_to "tip4commit.com", "http://tip4commit.com/" +%p= link_to "tip4commit.com", "https://tip4commit.com/" %p %small From f22a9707dff7f55277c43266d90a6565271c187b Mon Sep 17 00:00:00 2001 From: bill auger Date: Tue, 14 Oct 2014 16:48:20 +0000 Subject: [PATCH 072/415] allow config.yml to be loaded pre-processed --- config/application.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index 884f54ff..86f72d3b 100644 --- a/config/application.rb +++ b/config/application.rb @@ -6,7 +6,9 @@ # you've limited to :test, :development, or :production. Bundler.require(:default, Rails.env) -CONFIG ||= YAML::load(File.open("config/config.yml")) +# load config.yaml preprocessed +CONFIG ||= YAML::load(ERB.new(File.read("config/config.yml")).result) + module T4c class Application < Rails::Application From b415de2b12fef6d6ad4d2bb1a9783b697975e273 Mon Sep 17 00:00:00 2001 From: bill auger Date: Sat, 18 Oct 2014 02:15:05 +0000 Subject: [PATCH 073/415] add developer README and prettify README.md --- README.md | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index a88a4506..e045c2d0 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,24 @@ Tip4commit ========== -[![tip for next commit](https://tip4commit.com/projects/307.svg)](https://tip4commit.com/projects/307) [![Build Status](https://travis-ci.org/tip4commit/tip4commit.svg?branch=master)](https://travis-ci.org/tip4commit/tip4commit) +[![tip for next commit](https://tip4commit.com/projects/307.svg)](https://tip4commit.com/projects/307) +[![Build Status](https://travis-ci.org/tip4commit/tip4commit.svg?branch=master)](https://travis-ci.org/tip4commit/tip4commit) -Donate bitcoins to open source projects or make commits and get tips for it. +Donate bitcoins to open source projects or receive tips for code contributions. -Official site: https://tip4commit.com/ +| | | +| -------------- | ------------------------------------------------- | +| Official site: | https://tip4commit.com/ | +| Discussions: | https://bitcointalk.org/index.php?topic=315802 | +| FAQs: | https://github.com/tip4commit/tip4commit/wiki/FAQ | +| Issues: | https://github.com/tip4commit/tip4commit/issues | -Forum thread: https://bitcointalk.org/index.php?topic=315802 -FAQ: https://github.com/tip4commit/tip4commit/wiki/FAQ +Developers +========== + +If you would like to contribute to the development of tip4commit, you can find the contribution guidelines and installation instructions on the [developer README](https://github.com/tip4commit/tip4commit/wiki/README---Developers) -ToDo: https://github.com/tip4commit/tip4commit/issues License ======= From 3282c7c1536388bccaeb97fc0305a7f1ac2c534c Mon Sep 17 00:00:00 2001 From: kjanku1 Date: Sun, 12 Oct 2014 02:54:18 +0200 Subject: [PATCH 074/415] Added a polish translation Not fully finished yet --- app/assets/javascripts/i18n/translations.js | 4 +- config/locales/pl.yml | 215 ++++++++++++++++++++ 2 files changed, 217 insertions(+), 2 deletions(-) create mode 100644 config/locales/pl.yml diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js index 8f971fc2..bbe206d5 100644 --- a/app/assets/javascripts/i18n/translations.js +++ b/app/assets/javascripts/i18n/translations.js @@ -1,2 +1,2 @@ -var I18n = I18n || {}; -I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}}}; \ No newline at end of file +var I18n = I18n || {}; +I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}}},"pl":{"js":{"errors":{"value":{"invalid":"Niepoprawna wartość"},"email":{"invalid":"Niepoprawny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasła nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i potwierdzenie nie są takie same"}}}}; \ No newline at end of file diff --git a/config/locales/pl.yml b/config/locales/pl.yml new file mode 100644 index 00000000..5e3023c6 --- /dev/null +++ b/config/locales/pl.yml @@ -0,0 +1,215 @@ +en: + tip4commit: Tip4Commit + meta: + title: Wspieraj Open Source + description: Podaruj Bitcoiny na projekty Open Source lub współpracuj tworząc nowe "commits" i otrzymuj napiwki. + menu: + home: Strona Główna + projects: Wspierane Projekty + footer: + text: "Kod żródłowy dostępny jest na %{github_link} możesz także %{support_link} jego rozwój." + github_link: GitHub + support_link: wsparcie + follow_link: Obserwuj @tip4commit + links: + sign_in: Zaloguj się + sign_in_imp: zaloguj się + sign_out: Wyloguj się + errors: + project_not_found: Nie znaleziono projektu. + access_denied: Odmowa dostępu + can_assign_more_tips: "Nie możesz przydzielić więcej niż 100% dostępnych środków." + wrong_bitcoin_address: Błąd w aktualizowaniu adresu bitcoin + user_not_found: Nie znaleziono użytkownika + access_denied: Nie masz uprawnień do wykonania tej czynności! + notices: + project_updated: Ustawienia prjektu zostały zaktualizowane + tips_decided: Rozmiary napiwków zostały zdefiniowane + user_updated: Informacje zostały zapisane! + user_unsubscribed: "Zrezygnowałeś z subskrypcji! Przepraszamy za wszelkie niedogodności. Nadal możesz zostawić swój adres bitcoin i otrzymywać napiwki." + tip_amounts: + undecided: "Nieokreślony" + free: "Darmowy: 0%" + tiny: "Bardzo mały: 0.1%" + small: "Mały: 0.5%" + normal: "Średni: 1%" + big: "Duży: 2%" + huge: "Bardzo duży: 5%" + js: + errors: + value: + invalid: Wartość jest niepoprawna + email: + invalid: Błędny adres E-mail + blank: E-mail jest wymagany i nie może być pusty + password: + blank: Hasło jest wymagane i nie może być puste + invalid: Hasło i jego potwierdzenie nie są takie same + password_confirmation: + blank: Potwierdzenie hasła jest wymagane i nie może być puste + invalid: Hasło i jego potwierdzenie nie są takie same + home: + index: + see_projects: Zobacz projekty + how_does_it_work: + title: Jak to działa? + text: Ludzie przesyłają bitcoiny. Kiedy kogoś "commit" zostanie zaakceptowany do repozytorium projektu, automatycznie płacimy autorowi. + button: Dowiedz się więcej o Bitcoin + donate: + title: Podaruj + text: Znajdź projekt, który ci się podoba i prześlij na niego bitcoiny. Twoje bitcoiny będzią zsumowana z innymi aby dać napiwki za nowe "commits". + button: Znajdż lub dodaj projekt + contribute: + title: Współpracuj + text: Idź i coś napraw! Jeśli twój commit zostanie zaakceptowany przez nadzorcę projektu, dostaniesz napiwek! + sign_in_text: "Wystarczy sprawdzić e-mail lub %{sign_in_link}." + button: Wspierane projekty + projects: + index: + find_project: + placeholder: Enter GitHub project URL to add a project or any keyword to find it... + button: Find or add project + repository: Repozytorium + description: Opis + watchers: Obserwujący + balance: Saldo + forked_from: "zforkowany" z + support: Pomoc + show: + title: "Współpracuj z %{project}" + edit_project: Zmień ustawienia projektu + decide_tip_amounts: Ustal rozmiary napiwków + disabled_notifications: "Nadzorcy projektów zdecydowali nie powiadamiac nowych współpracowników o napiwkach i prawdopodobnie nie lubią tego typu finansowania." + project_sponsors: Sponsorzy projektu + fee: "%{percentage} of deposited funds will be used to tip for new commits." + balance: Balance + deposits: deposits + custom_tip_size: (each new commit receives a percentage of available balance) + default_tip_size: "(each new commit receives %{percentage} of available balance)" + unconfirmed_amount: "(%{amount} unconfirmed)" + tipping_policies: Tipping policies + updated_by_user: "(Last updated by %{name} on %{date})" + updated_by_unknown: "(Last updated on %{date})" + tips_paid: Tips Paid + unclaimed_amount: "(%{amount} of this is unclaimed, and will be refunded to the project after being unclaimed for 1 month.)" + last_tips: Last Tips + see_all: see all + received: "received %{amount}" + will_receive: will receive a tip + for_commit: for commit + when_decided: when its amount is decided + next_tip: Next Tip + contribute_and_earn: Contribute and Earn + contribute_and_earn_description: "Donate bitcoins to this project or %{make_commits_link} and get tips for it. If your commit is accepted %{branch} by a project maintainer and there are bitcoins on its balance, you will get a tip!" + contribute_and_earn_branch: "to %{branch} branch" + make_commits_link: make commits + tell_us_bitcoin_address: "Just %{tell_us_link} your bitcoin address." + tell_us_link: tell us + sign_in: "Just check your email or %{sign_in_link}." + promote_project: Promote %{project} + embedding: Embedding + image_url: "Image URL:" + shield_title: tip for next commit + edit: + project_settings: "%{project} project settings" + branch: Branch + default_branch: Default branch + tipping_policies: Tipping policies + hold_tips: "Do not send the tips immediatly. Give collaborators the ability to modify the tips before they're sent" + save: Save the project settings + disable_notifications: Don't notify new contributors + decide_tip_amounts: + commit: Commit + author: Author + message: Message + tip: Tip (relative to the project balance) + submit: Send the selected tip amounts + tips: + index: + tips: Tips + project_tips: '%{project} tips' + user_tips: "%{user} tips" + created_at: Created At + commiter: Commiter + project: Project + commit: Commit + amount: Amount + refunded: Refunded to project's deposit + undecided: The amount of the tip has not been decided yet + no_bitcoin_address: User didn't specify withdrawal address + below_threshold: "User's balance is below withdrawal threshold" + waiting: Waiting for withdrawal + error: (error sending transaction) + deposits: + index: + project_deposits: '%{project} deposits' + deposits: Deposits + created_at: Created At + project: Project + amount: Amount + transaction: Transaction + confirmed: Confirmed + confirmed_yes: 'Yes' + confirmed_no: 'No' + users: + index: + title: Top Contributors + name: Name + commits_count: Commits tipped + withdrawn: Withdrawn + show: + balance: Balance + threshold: "You will get your money when your balance hits the threshold of %{threshold}" + see_all: see all + received: "%{time} received %{amount} for commit %{commit} in %{project}" + bitcoin_address_placeholder: Your bitcoin address + notify: Notify me about new tips (no more than one email per month) + submit_user: Update user info + change_password: Change your password + submit_password: Change my password + withdrawals: + index: + title: Last Withdrawals + created_at: Created At + transaction: Transaction + result: Result + error: Error + success: Success + devise: + sessions: + new: + title: Sign in + remember_me: Remember me + submit: Sign in + registrations: + new: + title: Sign up + submit: Sign up + passwords: + new: + title: Forgot your password? + submit: Send me reset password instructions + edit: + title: Change your password + submit: Change my password + confirmations: + new: + title: Resend confirmation instructions + submit: Resend confirmation instructions + links: + sign_in: Sign in + sign_up: Sign up + recover: Forgot your password? + confirm: Didn't receive confirmation instructions? + sign_in_with: "Sign in with %{provider}" + errors: + primary_email: your primary email address should be verified. + onmiauth_info: we were unable to fetch your information. + activerecord: + attributes: + user: + email: E-mail + bitcoin_address: Bitcoin address + password: Password + password_confirmation: Password confirmation + display_name: Display name \ No newline at end of file From 3a98f957a12409d90c043634763e3cd9fd03d66a Mon Sep 17 00:00:00 2001 From: kjanku1 Date: Sun, 19 Oct 2014 15:15:55 +0200 Subject: [PATCH 075/415] sign_up_text traslation --- config/locales/pl.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 5e3023c6..83b67b7d 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -63,12 +63,13 @@ en: title: Współpracuj text: Idź i coś napraw! Jeśli twój commit zostanie zaakceptowany przez nadzorcę projektu, dostaniesz napiwek! sign_in_text: "Wystarczy sprawdzić e-mail lub %{sign_in_link}." + sign_up_text: "Jeśli nadal nie otrzymałeś zaproszenia, możesz %{sign_up_link} za pomocą adresu e-mail lub przez GitHub." button: Wspierane projekty projects: index: find_project: placeholder: Enter GitHub project URL to add a project or any keyword to find it... - button: Find or add project + button: Znajdź lub dodaj projekt repository: Repozytorium description: Opis watchers: Obserwujący @@ -197,8 +198,8 @@ en: title: Resend confirmation instructions submit: Resend confirmation instructions links: - sign_in: Sign in - sign_up: Sign up + sign_in: Zaloguj się + sign_up: Zarejestruj się recover: Forgot your password? confirm: Didn't receive confirmation instructions? sign_in_with: "Sign in with %{provider}" From 248084c04e8b0a440b37df37998b4f8e0db4b6c4 Mon Sep 17 00:00:00 2001 From: darthxjanus Date: Wed, 15 Oct 2014 18:43:57 +0200 Subject: [PATCH 076/415] Added Croatian locale. --- config/locales/hr.yml | 215 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 215 insertions(+) create mode 100644 config/locales/hr.yml diff --git a/config/locales/hr.yml b/config/locales/hr.yml new file mode 100644 index 00000000..04c0404f --- /dev/null +++ b/config/locales/hr.yml @@ -0,0 +1,215 @@ +en: + tip4commit: Tip4Commit + meta: + title: Doprinosite otvorenom izvoru + description: Donirajte bitcoine u otvoreni izvor projekata ili napravite cinove i dobite napojnice. + menu: + home: Pocetna stranica + projects: Podrzavani Projekti + footer: + text: "Izvorni kod dostupan na %{github_link} i mozete takoder %{support_link} razvoj." + github_link: GitHub + support_link: podrzi + follow_link: Follow @tip4commit + links: + sign_in: Prijava + sign_in_imp: prijava + sign_out: Odjava + errors: + project_not_found: Projekt nije nadjen. + access_denied: Pristup odbijen + can_assign_more_tips: "Ne mozete dodijeliti vise od 100% dostupnih sredstva." + wrong_bitcoin_address: Greska u updejtanju bitcoin adrese + user_not_found: Korisnik nije naden + access_denied: Niste ovlasteni da napravite ovu akciju! + notices: + project_updated: Postavke projekta su primijenjena + tips_decided: Broj napojnica je bio definiran + user_updated: Vasa informacija je sacuvana! + user_unsubscribed: "Maknuli ste vasu pretplatu! Zao nam je sto smo vam smetali. Svejedno mozete ostaviti vasu bitcoin adresu da dobite svoje napojnice." + tip_amounts: + undecided: "Neodluceno" + free: "Besplatno: 0%" + tiny: "Vrlo malo: 0.1%" + small: "Malo: 0.5%" + normal: "Normalno: 1%" + big: "Veliko: 2%" + huge: "Ogromno: 5%" + js: + errors: + value: + invalid: Vrijednost nevazeca + email: + invalid: Nezaveca email adresa + blank: Email je potreban i ne moze biti prazno + password: + blank: Lozinka je potrebna i ne moze biti prazno + invalid: Lozinka i njezina potvrda nisu isti + password_confirmation: + blank: Potvrda lozinke je potrebna i ne moze biti prazno + invalid: Lozinka i potvrda lozinke nisu isti + home: + index: + see_projects: Vidjeti projekte + how_does_it_work: + title: Kako ovo radi? + text: Ljudi doniraju bitcoine projektima. Kada se neciji cin potvrdi u repozitorij projekta, mi automatski posaljemo napojnicu autoru. + button: Nauciti o Bitcoin + donate: + title: Donirati + text: Pronadite projekt u koji zelite posvojiti svoje bitcoine. Vase donacije ce biti akumulirane sa fundovima ostalih donatora kao napojnice za nove cinove. + button: Pronaci ili dodati pojekt + contribute: + title: Doprinositi + text: Idite i popravite nesto! Ako je vas cin odobren od odrzavatelja projekta, dobiti cete napojnicu! + sign_in_text: "Samo provjerite vas email ili %{sign_in_link}." + button: Podrzavani projekti + projects: + index: + find_project: + placeholder: Upisite GitHub URL projekta kako biste dodati projekt ili bilo koju kljucnu rijec da biste je nasli... + button: Nadi ili dodaj projekt + repository: Repozitorij + description: Opis + watchers: Gledatelji + balance: Ravnoteza + forked_from: Odvojeno od + support: Podrzavaj + show: + title: "Doprinosi %{project}" + edit_project: Promijeni postavke projekta + decide_tip_amounts: Odredi kolicinu napojnica + disabled_notifications: "Odrzavatelji projekata su odlucili da nece obavjestiti nove doprinositelje o napojnicama i najvjerovatnije ne vole ovaj nacin isplate." + project_sponsors: Sponzori projekta + fee: "%{percentage} od polozenih isplata ce se koristiti kao napojnice za nove cinove." + balance: Ravnoteza + deposits: polozenja + custom_tip_size: (Svaki novi cin dobiva postotak dostune ravnoteze) + default_tip_size: "(Svaki novi cin dobiva %{percentage} dostupne ravnoteze)" + unconfirmed_amount: "(%{amount} nepotvrdeno)" + tipping_policies: Pravila o napojnicama + updated_by_user: "(Zadnje updejtao %{name} na %{date})" + updated_by_unknown: "(Zadnje updejtano %{date})" + tips_paid: Napojnice placene + unclaimed_amount: "(%{amount} od ovog neostvarenog, i biti ce natrag isplaceno u projekt nakon jednog mjeseca.)" + last_tips: Zadnje napojnice + see_all: Vidjeti sve + received: "dobiveno %{amount}" + will_receive: ce dobiti napojnicu + for_commit: za cin + when_decided: kada je kolicina odlucena + next_tip: Sljedeca Napojnica + contribute_and_earn: Contribute and Earn + contribute_and_earn_description: "Donate bitcoins to this project or %{make_commits_link} and get tips for it. If your commit is accepted %{branch} by a project maintainer and there are bitcoins on its balance, you will get a tip!" + contribute_and_earn_branch: "to %{branch} branch" + make_commits_link: make commits + tell_us_bitcoin_address: "Just %{tell_us_link} your bitcoin address." + tell_us_link: tell us + sign_in: "Just check your email or %{sign_in_link}." + promote_project: Promote %{project} + embedding: Embedding + image_url: "Image URL:" + shield_title: tip for next commit + edit: + project_settings: "%{project} project settings" + branch: Branch + default_branch: Default branch + tipping_policies: Tipping policies + hold_tips: "Do not send the tips immediatly. Give collaborators the ability to modify the tips before they're sent" + save: Save the project settings + disable_notifications: Don't notify new contributors + decide_tip_amounts: + commit: Commit + author: Author + message: Message + tip: Tip (relative to the project balance) + submit: Send the selected tip amounts + tips: + index: + tips: Tips + project_tips: '%{project} tips' + user_tips: "%{user} tips" + created_at: Created At + commiter: Commiter + project: Project + commit: Commit + amount: Amount + refunded: Refunded to project's deposit + undecided: The amount of the tip has not been decided yet + no_bitcoin_address: User didn't specify withdrawal address + below_threshold: "User's balance is below withdrawal threshold" + waiting: Waiting for withdrawal + error: (error sending transaction) + deposits: + index: + project_deposits: '%{project} deposits' + deposits: Deposits + created_at: Created At + project: Project + amount: Amount + transaction: Transaction + confirmed: Confirmed + confirmed_yes: 'Yes' + confirmed_no: 'No' + users: + index: + title: Top Contributors + name: Name + commits_count: Commits tipped + withdrawn: Withdrawn + show: + balance: Balance + threshold: "You will get your money when your balance hits the threshold of %{threshold}" + see_all: see all + received: "%{time} received %{amount} for commit %{commit} in %{project}" + bitcoin_address_placeholder: Your bitcoin address + notify: Notify me about new tips (no more than one email per month) + submit_user: Update user info + change_password: Change your password + submit_password: Change my password + withdrawals: + index: + title: Last Withdrawals + created_at: Created At + transaction: Transaction + result: Result + error: Error + success: Success + devise: + sessions: + new: + title: Sign in + remember_me: Remember me + submit: Sign in + registrations: + new: + title: Sign up + submit: Sign up + passwords: + new: + title: Forgot your password? + submit: Send me reset password instructions + edit: + title: Change your password + submit: Change my password + confirmations: + new: + title: Resend confirmation instructions + submit: Resend confirmation instructions + links: + sign_in: Sign in + sign_up: Sign up + recover: Forgot your password? + confirm: Didn't receive confirmation instructions? + sign_in_with: "Sign in with %{provider}" + errors: + primary_email: your primary email address should be verified. + onmiauth_info: we were unable to fetch your information. + activerecord: + attributes: + user: + email: E-mail + bitcoin_address: Bitcoin address + password: Password + password_confirmation: Password confirmation + display_name: Display name From e9d007733232d98345b0ae23ec7f7a9dcd6d605a Mon Sep 17 00:00:00 2001 From: darthxjanus Date: Sat, 18 Oct 2014 22:07:57 +0200 Subject: [PATCH 077/415] Added sign_up_text (#125) to Croatian locale. --- config/locales/hr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/locales/hr.yml b/config/locales/hr.yml index 04c0404f..cc9fd081 100644 --- a/config/locales/hr.yml +++ b/config/locales/hr.yml @@ -63,6 +63,7 @@ en: title: Doprinositi text: Idite i popravite nesto! Ako je vas cin odobren od odrzavatelja projekta, dobiti cete napojnicu! sign_in_text: "Samo provjerite vas email ili %{sign_in_link}." + sign_up_text: "Ako jos niste dobili pozivnicu, moze te se %{sign_up_link} sa valjanom email adresom ili GitHub-om." button: Podrzavani projekti projects: index: From fc9eede718ff648a9bcc0f95240c0f077f47d054 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Tue, 21 Oct 2014 15:46:27 +0600 Subject: [PATCH 078/415] fixed locales --- app/assets/javascripts/i18n/translations.js | 2 +- config/locales/hr.yml | 2 +- config/locales/pl.yml | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js index f62c41d8..029f45b8 100644 --- a/app/assets/javascripts/i18n/translations.js +++ b/app/assets/javascripts/i18n/translations.js @@ -1,2 +1,2 @@ var I18n = I18n || {}; -I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}}},"pl":{"js":{"errors":{"value":{"invalid":"Niepoprawna wartość"},"email":{"invalid":"Niepoprawny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasła nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i potwierdzenie nie są takie same"}}}}; \ No newline at end of file +I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}}}; \ No newline at end of file diff --git a/config/locales/hr.yml b/config/locales/hr.yml index cc9fd081..e4c614af 100644 --- a/config/locales/hr.yml +++ b/config/locales/hr.yml @@ -1,4 +1,4 @@ -en: +hr: tip4commit: Tip4Commit meta: title: Doprinosite otvorenom izvoru diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 83b67b7d..4c3905c2 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -1,4 +1,4 @@ -en: +pl: tip4commit: Tip4Commit meta: title: Wspieraj Open Source @@ -53,17 +53,17 @@ en: see_projects: Zobacz projekty how_does_it_work: title: Jak to działa? - text: Ludzie przesyłają bitcoiny. Kiedy kogoś "commit" zostanie zaakceptowany do repozytorium projektu, automatycznie płacimy autorowi. + text: 'Ludzie przesyłają bitcoiny. Kiedy kogoś "commit" zostanie zaakceptowany do repozytorium projektu, automatycznie płacimy autorowi.' button: Dowiedz się więcej o Bitcoin donate: title: Podaruj - text: Znajdź projekt, który ci się podoba i prześlij na niego bitcoiny. Twoje bitcoiny będzią zsumowana z innymi aby dać napiwki za nowe "commits". - button: Znajdż lub dodaj projekt + text: 'Znajdź projekt, który ci się podoba i prześlij na niego bitcoiny. Twoje bitcoiny będzią zsumowana z innymi aby dać napiwki za nowe "commits".' + button: 'Znajdż lub dodaj projekt' contribute: - title: Współpracuj - text: Idź i coś napraw! Jeśli twój commit zostanie zaakceptowany przez nadzorcę projektu, dostaniesz napiwek! + title: 'Współpracuj' + text: 'Idź i coś napraw! Jeśli twój commit zostanie zaakceptowany przez nadzorcę projektu, dostaniesz napiwek!' sign_in_text: "Wystarczy sprawdzić e-mail lub %{sign_in_link}." - sign_up_text: "Jeśli nadal nie otrzymałeś zaproszenia, możesz %{sign_up_link} za pomocą adresu e-mail lub przez GitHub." + sign_up_text: "Jeśli nadal nie otrzymałeś zaproszenia, możesz %{sign_up_link} za pomocą adresu e-mail lub przez GitHub." button: Wspierane projekty projects: index: @@ -74,7 +74,7 @@ en: description: Opis watchers: Obserwujący balance: Saldo - forked_from: "zforkowany" z + forked_from: "zforkowany" support: Pomoc show: title: "Współpracuj z %{project}" From 6a7c6b9af1a7a43db8521e5e3f53fe32ee41fb6e Mon Sep 17 00:00:00 2001 From: win32re Date: Tue, 21 Oct 2014 17:56:20 +0200 Subject: [PATCH 079/415] Update en.yml --- config/locales/en.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 441583a8..a496ef53 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -81,7 +81,7 @@ en: edit_project: Change project settings decide_tip_amounts: Decide tip amounts disabled_notifications: "Project maintainers have decided not to notify new contributors about tips and they probably don't like this way of funding." - project_sponsors: Project Sponsors + project_sponsors: Project sponsors fee: "%{percentage} of deposited funds will be used to tip for new commits." balance: Balance deposits: deposits @@ -116,7 +116,7 @@ en: branch: Branch default_branch: Default branch tipping_policies: Tipping policies - hold_tips: "Do not send the tips immediatly. Give collaborators the ability to modify the tips before they're sent" + hold_tips: "Do not send the tips immediately. Give collaborators the ability to modify the tips before they're sent" save: Save the project settings disable_notifications: Don't notify new contributors decide_tip_amounts: From 2c7eac5225e3594b1787c03415309d7f9cb9ceee Mon Sep 17 00:00:00 2001 From: win32re Date: Tue, 21 Oct 2014 20:37:02 +0200 Subject: [PATCH 080/415] Fix Travis CI build --- features/tip_modifier_interface.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/tip_modifier_interface.feature b/features/tip_modifier_interface.feature index 206cbfaa..b4fa3a0f 100644 --- a/features/tip_modifier_interface.feature +++ b/features/tip_modifier_interface.feature @@ -23,7 +23,7 @@ Feature: A project collaborator can change the tips of commits Given I'm logged in as "seldon" And I go to the project page And I click on "Change project settings" - And I check "Do not send the tips immediatly. Give collaborators the ability to modify the tips before they're sent" + And I check "Do not send the tips immediately. Give collaborators the ability to modify the tips before they're sent" And I click on "Save the project settings" Then I should see "The project settings have been updated" From b051b0b01bcc4577f972b8011428ed287eef8874 Mon Sep 17 00:00:00 2001 From: bill auger Date: Fri, 24 Oct 2014 22:01:00 +0000 Subject: [PATCH 081/415] allow users to define email domain in config/config.yml * removed the hard-coded default mail domain in config/environment/production.rb that was explicitly over-riding the one defined in config/config.yml --- config/environments/production.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 7dfac981..27cba157 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -61,15 +61,15 @@ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. # config.assets.precompile += %w( search.js ) - config.action_mailer.default_url_options = { :host => CONFIG['smtp_settings']['domain'] } - + smtp_settings = CONFIG['smtp_settings'] + domain = smtp_settings['domain'] config.action_mailer.delivery_method = :smtp - config.action_mailer.smtp_settings = CONFIG['smtp_settings'].to_options + config.action_mailer.smtp_settings = smtp_settings.to_options config.action_mailer.perform_deliveries = true config.action_mailer.raise_delivery_errors = true - config.action_mailer.default_url_options = { :host => 'tip4commit.com', :protocol => 'https' } - config.action_mailer.default_options = {from: 'no-reply@' + CONFIG['smtp_settings']['domain'] } + config.action_mailer.default_url_options = { :host => domain, :protocol => 'https' } + config.action_mailer.default_options = {from: 'no-reply@' + domain } # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation can not be found). From 7dfeed31f7a37901b1312ddc3c9b3d033fb6785c Mon Sep 17 00:00:00 2001 From: bill auger Date: Fri, 24 Oct 2014 22:42:40 +0000 Subject: [PATCH 082/415] add cross-development config skeletons * added cross-fork config skeletons to config/cross-fork-dev/ * added cross-fork-dev-README.md to config/cross-fork-dev/ * add db/seeds.rb to .gitignore --- .gitignore | 2 + config/cross-fork-dev/config.yml.dev | 116 ++++++++++++++++++ .../cross-fork-dev/cross-fork-dev-REAMDE.md | 49 ++++++++ config/cross-fork-dev/database.yml.dev | 45 +++++++ 4 files changed, 212 insertions(+) create mode 100644 config/cross-fork-dev/config.yml.dev create mode 100644 config/cross-fork-dev/cross-fork-dev-REAMDE.md create mode 100644 config/cross-fork-dev/database.yml.dev diff --git a/.gitignore b/.gitignore index 69f75261..e55074aa 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,5 @@ .rspec coverage + +/db/seeds.rb diff --git a/config/cross-fork-dev/config.yml.dev b/config/cross-fork-dev/config.yml.dev new file mode 100644 index 00000000..8a96d72c --- /dev/null +++ b/config/cross-fork-dev/config.yml.dev @@ -0,0 +1,116 @@ + +<% +# list local feature branches in their appropriate *_BRANCHES lists below +MY_BRANCHES = %w{master} +TIP4COMMIT_BRANCHES = %w{tip4commit-master tip4commit-new-feature} +PEER4COMMIT_BRANCHES = %w{peer4commit-master peer4commit-new-feature} +PRIME4COMMIT_BRANCHES = %w{prime4commit-master peer4commit-new-feature} +BRANCHES_LISTS_FILENAME = 'config/config.yml' # DEBUG + +BRANCH_NAME = `git rev-parse --abbrev-ref HEAD`.strip +IS_MYFORK = MY_BRANCHES.include? BRANCH_NAME +IS_TIP4COMMIT_FORK = TIP4COMMIT_BRANCHES.include? BRANCH_NAME +IS_PEER4COMMIT_FORK = PEER4COMMIT_BRANCHES.include? BRANCH_NAME +IS_PRIME4COMMIT_FORK = PRIME4COMMIT_BRANCHES.include? BRANCH_NAME +%> + + +<% if IS_MY_FORK %> +<% puts "no app config defined for local branch: '#{BRANCH_NAME}'" %> +<% elsif IS_TIP4COMMIT_FORK %> +github: + key: "111111111111" + secret: "111111111111" + auto_paginate: false + pages: 3 + project_pages: {} + +blockchain_info: + guid: "111111111111" + password: "111111111111" + callback_secret: "111111111111" + +tip: 0.01 +min_payout: 100000 +our_fee: 0.05 + +deposit_address: 1M4bS4gPyA6Kb8w7aXsgth9oUZWcRk73tQ + +address_versions: # 0/5 for bitcoin addresses, 111/196 for testnet, see chainparams.cpp + - 0 + - 5 + + +<% elsif IS_PEER4COMMIT_FORK %> +github: + key: "111111111111" + secret: "111111111111" + +daemon: + username: rpcuser + password: rpcpassword + host: localhost + port: 9904 + path: /path/to/ppcoin/src/ppcoind + +tip: 0.01 +min_payout: 1.0 # in PPC +our_fee: 0.05 +tipper_delay: "1.hour" + +address_versions: # 55/117 for peercoin, 111/196 for testnet, see base58.h + - 111 + - 196 + +# canonical_host: peer4commit.example.com # will redirect all other hostnames to this one + + +<% elsif IS_PRIME4COMMIT_FORK %> +github: + key: "111111111111" + secret: "111111111111" + +daemon: + username: rpcuser + password: rpcpassword + host: localhost + port: 9914 + path: /path/to/primecoin/src/primecoind + +tip: 0.01 +min_payout: 1.0 # in XPM +our_fee: 0.05 +tipper_delay: "1.hour" + +address_versions: # 23/83 for primecoin, 111/196 for testnet, see base58.h + - 111 + - 196 + +# canonical_host: prime4commit.example.com # will redirect all other hostnames to this one + + +<% else %> +<% puts "ERROR: config/config.yml - no app config defined for branch: '#{BRANCH_NAME}'" + + " - you must add it to one of the *_BRANCHES lists in #{BRANCHES_LISTS_FILENAME}" %> +<% end %> + + +devise: + secret: "111111111111" + +application: + secret: "111111111111" + +smtp_settings: + address: smtp.gmail.com + port: 587 + domain: example.com + user_name: example@example.com + password: MY_PASSWORD + authentication: plain + enable_starttls_auto: true + +# Uncomment to use airbrake/errbit +# airbrake: +# api_key: 111111111111 +# host: errbit.tip4commit.com diff --git a/config/cross-fork-dev/cross-fork-dev-REAMDE.md b/config/cross-fork-dev/cross-fork-dev-REAMDE.md new file mode 100644 index 00000000..a8749b45 --- /dev/null +++ b/config/cross-fork-dev/cross-fork-dev-REAMDE.md @@ -0,0 +1,49 @@ +### cross-fork development + +the files in this directory exist to aid cross-fork development of the various tip4commit forks from within the same local clone - if you will be working on only one fork then use Gemfile, config/config.yml.sample, and config/database.yml.sample instead + +the various forks have drifted apart significantly and require different configuratons - these files will allow these all to be functional within in the same clone without manual config swapping - the only routine maintenance required is in adding new feature branches to the appropriate *_BRANCHES list in config.yml.dev and re-bundling when switching between forks + + +#### config/cross-fork-dev/config.yml.dev + + config.yml.dev includes a separate configuration for each known tip4commit variant - switched per the current git branch + + config.yml.dev also defines which feature branches should share configurations - you will need to manually add each new branch to the appropriate *_BRANCHES list + + +#### config/cross-fork-dev/database.yml.dev + database.yml.dev also includes a separate configuration for each known tip4commit variant - switched per the current git branch (requires the *_BRANCHES list in config.yml.dev) + + +### setup + + * fork any of the tip4commit forks then clone your fork + * copy config/cross-fork-dev/config.yml.dev to config/config.yml and + copy config/cross-fork-dev/database.yml.dev to config/database.yml +``` + cp config/cross-fork-dev/config.yml.dev config/config.yml + cp config/cross-fork-dev/database.yml.dev config/database.yml +``` + * customize config/config.yml and config/database.yml + * repeat the following flow for each fork including the one you forked from +``` + git remote add tip4commit https://github.com/tip4commit/tip4commit.git + git checkout -b tip4commit-master + git fetch tip4commit + git merge tip4commit/master +``` + * add each fork branch created above its corresponding *_BRANCHES list + + +### maintenance + * add new local feature branches in their appropriate *_BRANCHES lists + (e.g. to reduce ambiguity use your local master branch for experimentaion only) + * re-bundle each time you switch to a new fork configuration +``` + # for tip4commit + bundle install --without production + + # for peer4commit amd prime4commit + bundle install --without mysql postgresql +``` diff --git a/config/cross-fork-dev/database.yml.dev b/config/cross-fork-dev/database.yml.dev new file mode 100644 index 00000000..d22fc1f4 --- /dev/null +++ b/config/cross-fork-dev/database.yml.dev @@ -0,0 +1,45 @@ + +development: + adapter: sqlite3 + pool: 5 + timeout: 5000 +<% if IS_MY_FORK %> + database: db/my_development.sqlite3 +<% elsif IS_TIP4COMMIT_FORK %> + database: db/tip4commit_development.sqlite3 +<% elsif IS_PEER4COMMIT_FORK %> + database: db/peer4commit_development.sqlite3 +<% elsif IS_PRIME4COMMIT_FORK %> + database: db/prime4commit_development.sqlite3 +<% else %> +<% puts "ERROR: config/database.yml - no development db specified for branch: '#{branch_name}'" + + + " - you must add it to one of the *_BRANCHES lists in #{BRANCHES_LISTS_FILENAME}" %> +<% end %> + + +test: + adapter: sqlite3 + pool: 5 + timeout: 5000 +<% if IS_MY_FORK %> + database: db/my_test.sqlite3 +<% elsif IS_TIP4COMMIT_FORK %> + database: db/tip4commit_test.sqlite3 +<% elsif IS_PEER4COMMIT_FORK %> + database: db/peer4commit_test.sqlite3 +<% elsif IS_PRIME4COMMIT_FORK %> + database: db/prime4commit_test.sqlite3 +<% else %> +<% puts "ERROR: config/database.yml - no test db specified for branch: '#{branch_name}'" + + " - you must add it to one of the *_BRANCHES lists in #{BRANCHES_LISTS_FILENAME}" %> +<% end %> + + +production: + adapter: mysql2 + encoding: utf8 + database: tip4commit + username: root + password: + socket: /var/run/mysqld/mysqld.sock From e4980b6549fde4a6ec5eea3100fbb149ee693e1c Mon Sep 17 00:00:00 2001 From: win32re Date: Tue, 21 Oct 2014 17:54:57 +0200 Subject: [PATCH 083/415] Update hr.yml --- config/locales/hr.yml | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/config/locales/hr.yml b/config/locales/hr.yml index e4c614af..c25c287c 100644 --- a/config/locales/hr.yml +++ b/config/locales/hr.yml @@ -99,17 +99,17 @@ hr: will_receive: ce dobiti napojnicu for_commit: za cin when_decided: kada je kolicina odlucena - next_tip: Sljedeca Napojnica - contribute_and_earn: Contribute and Earn - contribute_and_earn_description: "Donate bitcoins to this project or %{make_commits_link} and get tips for it. If your commit is accepted %{branch} by a project maintainer and there are bitcoins on its balance, you will get a tip!" - contribute_and_earn_branch: "to %{branch} branch" + next_tip: Sljedeca napojnica + contribute_and_earn: Contribute and earn + contribute_and_earn_description: "Doniraj Bitcone u ovaj projekt ili %{make_commits_link} i dobij napojnicu. Ako je commit prihvacen %{branch} od strane voditelja projekta i ima Bitcoina na racunu, dobit ce te napojnicu." + contribute_and_earn_branch: "u %{branch} branch" make_commits_link: make commits - tell_us_bitcoin_address: "Just %{tell_us_link} your bitcoin address." + tell_us_bitcoin_address: "Samo %{tell_us_link} vasu bitcoin adresu." tell_us_link: tell us - sign_in: "Just check your email or %{sign_in_link}." - promote_project: Promote %{project} + sign_in: "Samo provjerite vas email ili %{sign_in_link}." + promote_project: Promoviraj %{project} embedding: Embedding - image_url: "Image URL:" + image_url: "URL slike:" shield_title: tip for next commit edit: project_settings: "%{project} project settings" @@ -128,13 +128,13 @@ hr: tips: index: tips: Tips - project_tips: '%{project} tips' - user_tips: "%{user} tips" - created_at: Created At + project_tips: '%{project} napojnice' + user_tips: "%{user} napojnice" + created_at: Stvoreno na commiter: Commiter - project: Project + project: Projekt commit: Commit - amount: Amount + amount: Kolicina refunded: Refunded to project's deposit undecided: The amount of the tip has not been decided yet no_bitcoin_address: User didn't specify withdrawal address @@ -143,19 +143,19 @@ hr: error: (error sending transaction) deposits: index: - project_deposits: '%{project} deposits' + project_deposits: '%{project} uplate' deposits: Deposits - created_at: Created At - project: Project - amount: Amount + created_at: "Stvoreno na" + project: Projekt + amount: Kolicina transaction: Transaction confirmed: Confirmed - confirmed_yes: 'Yes' - confirmed_no: 'No' + confirmed_yes: 'Da' + confirmed_no: 'Ne' users: index: title: Top Contributors - name: Name + name: Ime commits_count: Commits tipped withdrawn: Withdrawn show: From 1340fda19b64ad2378953c27f7601e95a0e83f7d Mon Sep 17 00:00:00 2001 From: darthxjanus Date: Tue, 21 Oct 2014 18:00:22 +0200 Subject: [PATCH 084/415] Update hr.yml --- config/locales/hr.yml | 74 +++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/config/locales/hr.yml b/config/locales/hr.yml index c25c287c..9b65dff7 100644 --- a/config/locales/hr.yml +++ b/config/locales/hr.yml @@ -159,58 +159,58 @@ hr: commits_count: Commits tipped withdrawn: Withdrawn show: - balance: Balance - threshold: "You will get your money when your balance hits the threshold of %{threshold}" - see_all: see all - received: "%{time} received %{amount} for commit %{commit} in %{project}" - bitcoin_address_placeholder: Your bitcoin address - notify: Notify me about new tips (no more than one email per month) - submit_user: Update user info - change_password: Change your password - submit_password: Change my password + balance: Ravnoteza + threshold: "Dobiti ce te vase novce kada vasa ravnoteza prijede prag od %{threshold}" + see_all: vidjeti sve + received: "%{time} primljeno %{amount} za cin %{commit} u %{project}" + bitcoin_address_placeholder: Vasa bitcoin adresa + notify: Notificirati me o novim savjetima (ne vise od jednog emaila po mjesecu) + submit_user: Azurirati informaciju korisnika + change_password: Promijeniti vasu lozinku + submit_password: Promijeniti moju lozinku withdrawals: index: - title: Last Withdrawals - created_at: Created At - transaction: Transaction - result: Result - error: Error - success: Success + title: Zadnje povlacenje + created_at: Stvoreno + transaction: Transakcije + result: Rezultat + error: Greska + success: Uspjesno devise: sessions: new: - title: Sign in - remember_me: Remember me - submit: Sign in + title: Prijava + remember_me: Zapamti me + submit: Prijava registrations: new: - title: Sign up - submit: Sign up + title: Prijava + submit: Registracija passwords: new: - title: Forgot your password? - submit: Send me reset password instructions + title: Zaboravili ste vasu lozinku? + submit: Poslati mi uputstva za resetiranje lozinke edit: - title: Change your password - submit: Change my password + title: Promijenite vasu lozinku + submit: Promijeniti svoju lozinku confirmations: new: - title: Resend confirmation instructions - submit: Resend confirmation instructions + title: Ponovno poslati uputstva za potvrdivanje + submit: Ponovno poslati uputstva za potvrdivanje links: - sign_in: Sign in - sign_up: Sign up - recover: Forgot your password? - confirm: Didn't receive confirmation instructions? - sign_in_with: "Sign in with %{provider}" + sign_in: Prijava + sign_up: Registracija + recover: Zaboravili ste vasu lozinku? + confirm: Niste primili uputstva za potvrdivanje? + sign_in_with: "Prijavi se sa %{provider}" errors: - primary_email: your primary email address should be verified. - onmiauth_info: we were unable to fetch your information. + primary_email: vasa glavna email adresa bi trebala biti potvrdena. + onmiauth_info: Nismo bili u stanju dohvatiti vasu informaciju. activerecord: attributes: user: email: E-mail - bitcoin_address: Bitcoin address - password: Password - password_confirmation: Password confirmation - display_name: Display name + bitcoin_address: Bitcoin adresa + password: Lozinka + password_confirmation: Potvrda lozinke + display_name: Prikazno ime From a2cafb44bab376efea6960fc193cbc3f3e3f5ac1 Mon Sep 17 00:00:00 2001 From: kjanku1 Date: Wed, 22 Oct 2014 22:06:30 +0200 Subject: [PATCH 085/415] Finished polish translation --- config/locales/pl.yml | 202 +++++++++++++++++++++--------------------- 1 file changed, 101 insertions(+), 101 deletions(-) diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 4c3905c2..b65ef9ab 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -68,7 +68,7 @@ pl: projects: index: find_project: - placeholder: Enter GitHub project URL to add a project or any keyword to find it... + placeholder: Wpisz URL projektu GitHub aby dodać projekt lub słowo kluczowe aby go znaleźć... button: Znajdź lub dodaj projekt repository: Repozytorium description: Opis @@ -80,137 +80,137 @@ pl: title: "Współpracuj z %{project}" edit_project: Zmień ustawienia projektu decide_tip_amounts: Ustal rozmiary napiwków - disabled_notifications: "Nadzorcy projektów zdecydowali nie powiadamiac nowych współpracowników o napiwkach i prawdopodobnie nie lubią tego typu finansowania." + disabled_notifications: "Nadzorcy projektów zdecydowali nie powiadamiać nowych współpracowników o napiwkach i prawdopodobnie nie lubią tego typu finansowania." project_sponsors: Sponsorzy projektu - fee: "%{percentage} of deposited funds will be used to tip for new commits." - balance: Balance - deposits: deposits - custom_tip_size: (each new commit receives a percentage of available balance) - default_tip_size: "(each new commit receives %{percentage} of available balance)" - unconfirmed_amount: "(%{amount} unconfirmed)" - tipping_policies: Tipping policies - updated_by_user: "(Last updated by %{name} on %{date})" - updated_by_unknown: "(Last updated on %{date})" - tips_paid: Tips Paid - unclaimed_amount: "(%{amount} of this is unclaimed, and will be refunded to the project after being unclaimed for 1 month.)" - last_tips: Last Tips - see_all: see all - received: "received %{amount}" - will_receive: will receive a tip - for_commit: for commit - when_decided: when its amount is decided - next_tip: Next Tip - contribute_and_earn: Contribute and Earn - contribute_and_earn_description: "Donate bitcoins to this project or %{make_commits_link} and get tips for it. If your commit is accepted %{branch} by a project maintainer and there are bitcoins on its balance, you will get a tip!" - contribute_and_earn_branch: "to %{branch} branch" - make_commits_link: make commits - tell_us_bitcoin_address: "Just %{tell_us_link} your bitcoin address." - tell_us_link: tell us - sign_in: "Just check your email or %{sign_in_link}." - promote_project: Promote %{project} - embedding: Embedding - image_url: "Image URL:" - shield_title: tip for next commit + fee: "%{percentage} z salda zostanie użyte jako następny napiwek." + balance: saldo + deposits: wpłaty + custom_tip_size: (Każdy nowy "commit" dostaje część z dostępnego salda) + default_tip_size: "(Każdy nowy "commit" dostaje %{percentage} z dostępnego salda)" + unconfirmed_amount: "(%{amount} niepotwierdzone)" + tipping_policies: Zasady napiwków + updated_by_user: "(Ostatnio zaktualizowane przez %{name} w dniu %{date})" + updated_by_unknown: "(Ostatnia aktualizacja: %{date})" + tips_paid: Zapłacone napiwki + unclaimed_amount: "(%{amount} z tego jest niezebrane, i zostanie zwrócone do projektu po jednym miesiącu.)" + last_tips: Ostatnie napiwki + see_all: zobacz wszystko + received: "otrzymano %{amount}" + will_receive: dostanie napiwek + for_commit: za "commit" + when_decided: kiedy jego rozmiar zostanie określony + next_tip: Następny napiwek + contribute_and_earn: Pomagaj i zarabiaj + contribute_and_earn_description: "Wyślij bitcoiny na ten projekt lub %{make_commits_link} i otrzymaj za nie napiwki. Jeśli zostaną zaakceptowane %{branch} przez nadzorce projektu i jeśli są pieniądze na koncie projektu, otrzymasz napiwek!" + contribute_and_earn_branch: "do %{branch} gałęzi" + make_commits_link: twórz "commits" + tell_us_bitcoin_address: "Tylko %{tell_us_link} twój adres bitcoin." + tell_us_link: powiedz nam + sign_in: "Sprawdż e-mail lub %{sign_in_link}." + promote_project: Promuj %{project} + embedding: Umieść + image_url: "URL obrazka:" + shield_title: napiwek za następny "commit" edit: - project_settings: "%{project} project settings" - branch: Branch - default_branch: Default branch - tipping_policies: Tipping policies - hold_tips: "Do not send the tips immediatly. Give collaborators the ability to modify the tips before they're sent" - save: Save the project settings - disable_notifications: Don't notify new contributors + project_settings: "%{project} ustawienia projektu" + branch: Gałąź + default_branch: Domyślna gałąź + tipping_policies: Zasady napiwków + hold_tips: "Nie wysyłaj napiwków od razu. Daj współpracownikom możliwość zmiany napiwków zanim zostaną wysłane" + save: Zapisz ustawienia projektu + disable_notifications: Nie powiadamiaj nowych kontrybutorów decide_tip_amounts: commit: Commit - author: Author - message: Message - tip: Tip (relative to the project balance) - submit: Send the selected tip amounts + author: Autor + message: Wiadomość + tip: Napiwek (zależy od salda projektu) + submit: Wyślij wybrane ilości napiwków tips: index: - tips: Tips - project_tips: '%{project} tips' - user_tips: "%{user} tips" - created_at: Created At + tips: Napiwki + project_tips: '%{project} napiwki' + user_tips: "%{user} napiwki" + created_at: Utworzony Na commiter: Commiter - project: Project + project: Projekt commit: Commit - amount: Amount - refunded: Refunded to project's deposit - undecided: The amount of the tip has not been decided yet - no_bitcoin_address: User didn't specify withdrawal address - below_threshold: "User's balance is below withdrawal threshold" - waiting: Waiting for withdrawal - error: (error sending transaction) + amount: Ilość + refunded: Zwrócone do projektu + undecided: Rozmiar napiwku nie został jeszcze określony + no_bitcoin_address: Użytkownik nie sprecyzował adresu do wypłaty + below_threshold: "Saldo użytkownika jest poniżej wymaganego do wypłaty" + waiting: Oczekiwanie na wypłate + error: (błąd w wysyłaniu transakcji) deposits: index: - project_deposits: '%{project} deposits' - deposits: Deposits - created_at: Created At - project: Project - amount: Amount - transaction: Transaction - confirmed: Confirmed - confirmed_yes: 'Yes' - confirmed_no: 'No' + project_deposits: '%{project} wpłaty' + deposits: Wpłaty + created_at: Utworzono Na + project: Projekt + amount: Ilość + transaction: Transakcja + confirmed: Potwierdzone + confirmed_yes: 'Tak' + confirmed_no: 'Nie' users: index: - title: Top Contributors - name: Name - commits_count: Commits tipped - withdrawn: Withdrawn + title: Najlepsi kontrybutorzy + name: Imie + commits_count: Opłacone "commity" + withdrawn: Wypłacone show: - balance: Balance - threshold: "You will get your money when your balance hits the threshold of %{threshold}" - see_all: see all - received: "%{time} received %{amount} for commit %{commit} in %{project}" - bitcoin_address_placeholder: Your bitcoin address + balance: Saldo + threshold: "Otrzymasz pieniądze kiedy twoje saldo przekroczy limit %{threshold}" + see_all: zobacz wszystko + received: "%{time} otrzymano %{amount} za commit %{commit} w %{project}" + bitcoin_address_placeholder: Twój adres bitcoin notify: Notify me about new tips (no more than one email per month) - submit_user: Update user info - change_password: Change your password - submit_password: Change my password + submit_user: Zaktualizuj dane użytkownika + change_password: Zmień Twoje hasło + submit_password: Zmień moje hasło withdrawals: index: - title: Last Withdrawals - created_at: Created At - transaction: Transaction - result: Result - error: Error - success: Success + title: Ostatnie wypłaty + created_at: Utworzono na + transaction: Transakcje + result: Wynik + error: Błąd + success: Sukces devise: sessions: new: - title: Sign in - remember_me: Remember me - submit: Sign in + title: Zaloguj się + remember_me: Zapamiętaj mnie + submit: Zaloguj się registrations: new: - title: Sign up - submit: Sign up + title: Zarejestruj się + submit: Zarejestruj się passwords: new: - title: Forgot your password? - submit: Send me reset password instructions + title: Zapomniałeś hasło? + submit: Wyślij mi instrukcje resetowania hasła edit: - title: Change your password - submit: Change my password + title: Zmień Twoje hasło + submit: Zmień moje hasło confirmations: new: - title: Resend confirmation instructions - submit: Resend confirmation instructions + title: Ponownie wyślij instrukcje potwierdzenia + submit: Ponownie wyślij instrukcje potwierdzenia links: sign_in: Zaloguj się sign_up: Zarejestruj się - recover: Forgot your password? - confirm: Didn't receive confirmation instructions? - sign_in_with: "Sign in with %{provider}" + recover: Zapomniałeś hasło? + confirm: Nie otrzymałeś instrukcji potwierdzenia? + sign_in_with: "Zaloguj się za pomocą %{provider}" errors: - primary_email: your primary email address should be verified. - onmiauth_info: we were unable to fetch your information. + primary_email: Twój główny e-mail musi być potwierdzony. + onmiauth_info: Nie byliśmy w stanie otrzymać twoich danych. activerecord: attributes: user: email: E-mail - bitcoin_address: Bitcoin address - password: Password - password_confirmation: Password confirmation - display_name: Display name \ No newline at end of file + bitcoin_address: AAdres Bitcoin + password: Hasło + password_confirmation: Potwierdzenie hasła + display_name: Wyświetlana nazwa \ No newline at end of file From f285cf7b68da3e631e707cbcaf7e564817368b2d Mon Sep 17 00:00:00 2001 From: kjanku1 Date: Sun, 12 Oct 2014 03:19:31 +0200 Subject: [PATCH 086/415] pl flag --- app/assets/images/flags/pl.png | Bin 0 -> 288 bytes config/application.rb | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 app/assets/images/flags/pl.png diff --git a/app/assets/images/flags/pl.png b/app/assets/images/flags/pl.png new file mode 100644 index 0000000000000000000000000000000000000000..cca0e7dd46fd4254f58e7270800db7f4a1486b39 GIT binary patch literal 288 zcmeAS@N?(olHy`uVBq!ia0vp^0zk~o!3HGD9`RZNDVB6cUq=Rp^(V|(yIunMoCO|{ z#S9F5M?jcysy3fAP*AeOHKHUqKdq!Zu_%?nF(p4KRlzeiF+DXXH8G{K@MNkDP|;jZ z7sn8d;H8reavd_@X`9R^+U6dg`u@Mr?iWXIOK>!8GCX2t=$jSlvf(znV*TZ3?Nc6D z7#(J3aq;w2vpsUFykcii^R8`db)St+?i4HLa5PrRdiPsVs$!kieEDe?O2Z2R&t%pu zV)Ks3X>gyJaNWeAy;ke*`Ja>iEf8^H-+ndhs}8fe^@g4Nt3Goq{a|u%W$sypt96^E fZK$njW&FT!)*xyAn_Cf}FktX>^>bP0l+XkKS*mH} literal 0 HcmV?d00001 diff --git a/config/application.rb b/config/application.rb index 86f72d3b..e801a593 100644 --- a/config/application.rb +++ b/config/application.rb @@ -27,7 +27,7 @@ class Application < Rails::Application config.autoload_paths += %W(#{config.root}/lib) config.assets.initialize_on_precompile = true - config.available_locales = %w(en fr ru) + config.available_locales = %w(en fr ru pl) end end From cedcf2476c294809e37bc56582f1f6e8d9a13c59 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Tue, 28 Oct 2014 15:07:09 +0500 Subject: [PATCH 087/415] fixed locale file --- config/locales/pl.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/pl.yml b/config/locales/pl.yml index b65ef9ab..319c60d9 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -86,7 +86,7 @@ pl: balance: saldo deposits: wpłaty custom_tip_size: (Każdy nowy "commit" dostaje część z dostępnego salda) - default_tip_size: "(Każdy nowy "commit" dostaje %{percentage} z dostępnego salda)" + default_tip_size: "(Każdy nowy \"commit\" dostaje %{percentage} z dostępnego salda)" unconfirmed_amount: "(%{amount} niepotwierdzone)" tipping_policies: Zasady napiwków updated_by_user: "(Ostatnio zaktualizowane przez %{name} w dniu %{date})" From 998b508790456ff032386ecd8ebb537221e868e9 Mon Sep 17 00:00:00 2001 From: bill auger Date: Wed, 29 Oct 2014 07:37:03 +0000 Subject: [PATCH 088/415] add "sync pending" notice and more pretty urls * "sync pending" notice appears initially in place of project management buttons * project management buttons replace "sync pending" notice after worker syncs * added pretty_project_edit_path and pretty_project_decide_tip_amounts_path to ProjectHelper mostly to satisfy the new generalized "I visit ..." test paths but also helps the app url scheme be more consistent * refactored ProjectsController#show action * refactored bitcoin address update procedure to split long lines and abstract some magic numbers into config/initializers/constants.rb * moved bitcoin address update procedure into Project#update_bitcoin_address * defined blochain url constants in the CONFIG hash --- app/assets/javascripts/i18n/translations.js | 2 +- app/controllers/projects_controller.rb | 47 +++++++++++---------- app/helpers/projects_helper.rb | 8 ++++ app/models/project.rb | 13 ++++++ app/models/sendmany.rb | 2 +- app/views/deposits/index.html.haml | 2 +- app/views/projects/show.html.haml | 2 + app/views/tips/index.html.haml | 2 +- app/views/withdrawals/index.html.haml | 2 +- config/application.rb | 8 ++++ config/routes.rb | 4 +- 11 files changed, 63 insertions(+), 29 deletions(-) diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js index 029f45b8..ac0ec161 100644 --- a/app/assets/javascripts/i18n/translations.js +++ b/app/assets/javascripts/i18n/translations.js @@ -1,2 +1,2 @@ var I18n = I18n || {}; -I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}}}; \ No newline at end of file +I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}}}; \ No newline at end of file diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index ee02fbfa..c39ee948 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -1,8 +1,10 @@ require 'net/http' class ProjectsController < ApplicationController + include ProjectsHelper - before_filter :load_project, only: [:show, :edit, :update, :decide_tip_amounts] + before_filter :load_project, only: [:show, :edit, :decide_tip_amounts, :update] + before_filter :redirect_to_pretty_url, only: [:show, :edit, :decide_tip_amounts] def index @projects = Project.order(projects_order).page(params[:page]).per(30) @@ -17,29 +19,9 @@ def search end end - # Redirect to pretty url for html format - include ProjectsHelper - before_filter only: [:show] do - if params[:id].present? - begin - respond_to do |format| - format.html { redirect_to pretty_project_path(@project) } - end - rescue ActionController::UnknownFormat - end - end - end - def show - if @project.bitcoin_address.nil? - uri = URI("https://blockchain.info/merchant/#{CONFIG["blockchain_info"]["guid"]}/new_address") - params = { password: CONFIG["blockchain_info"]["password"], label:"#{@project.full_name}@tip4commit" } - uri.query = URI.encode_www_form(params) - res = Net::HTTP.get_response(uri) - if res.is_a?(Net::HTTPSuccess) && (bitcoin_address = JSON.parse(res.body)["address"]) - @project.update_attribute :bitcoin_address, bitcoin_address - end - end + @project.update_bitcoin_address if @project.bitcoin_address.nil? + @project_tips = @project.tips @recent_tips = @project_tips.includes(:user).order(created_at: :desc).first(5) end @@ -108,4 +90,23 @@ def projects_order 'description' => {description: :asc, available_amount_cache: :desc, watchers_count: :desc, full_name: :asc} }.[](params[:order] || 'balance') end + + def redirect_to_pretty_url + return unless request.get? && params[:id].present? + + begin + respond_to do |format| + case action_name + when 'show' + path = pretty_project_path(@project) + when 'edit' + path = pretty_project_edit_path(@project) + when 'decide_tip_amounts' + path = pretty_project_decide_tip_amounts_path(@project) + end + format.html { redirect_to path } + end + rescue ActionController::UnknownFormat + end + end end diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 6189890b..5911ecd9 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -22,6 +22,14 @@ def pretty_project_path project "/#{project.host}/#{project.full_name}" end + def pretty_project_edit_path project + "#{pretty_project_path project}/edit" + end + + def pretty_project_decide_tip_amounts_path project + "#{pretty_project_path project}/decide_tip_amounts" + end + def pretty_project_url project root_url.gsub(/\/$/,'') + pretty_project_path(project) end diff --git a/app/models/project.rb b/app/models/project.rb index 5affe082..988406f9 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -19,6 +19,19 @@ class Project < ActiveRecord::Base # before_save :check_tips_to_pay_against_avaiable_amount + def update_bitcoin_address + blockchain_uri = URI CONFIG["blockchain_info"]["new_url"] + blockchain_pass = CONFIG["blockchain_info"]["password"] + blockchain_label = "#{self.full_name}@tip4commit" + blockchain_params = { password: blockchain_pass, label: blockchain_label } + blockchain_uri.query = URI.encode_www_form blockchain_params + blockchain_resp = Net::HTTP.get_response blockchain_uri + if blockchain_resp.is_a? Net::HTTPSuccess + self.bitcoin_address = (JSON.parse blockchain_resp.body)["address"] + self.save! unless self.bitcoin_address.nil? + end + end + def update_repository_info repo self.github_id = repo.id self.name = repo.name diff --git a/app/models/sendmany.rb b/app/models/sendmany.rb index 6ef75fbc..169a5fd4 100644 --- a/app/models/sendmany.rb +++ b/app/models/sendmany.rb @@ -10,7 +10,7 @@ def send_transaction update_attribute :is_error, true # it's a lock to prevent duplicates - uri = URI("https://blockchain.info/merchant/#{CONFIG["blockchain_info"]["guid"]}/sendmany") + uri = URI CONFIG["blockchain_info"]["sendmany_url"] params = { password: CONFIG["blockchain_info"]["password"], recipients: data } uri.query = URI.encode_www_form(params) res = Net::HTTP.get_response(uri) diff --git a/app/views/deposits/index.html.haml b/app/views/deposits/index.html.haml index 7950e74d..dfc3d5dd 100644 --- a/app/views/deposits/index.html.haml +++ b/app/views/deposits/index.html.haml @@ -22,7 +22,7 @@ %td= link_to(deposit.project.full_name, pretty_project_path(deposit.project)) %td= btc_human deposit.amount %td= btc_human deposit.fee - %td= link_to deposit.txid, "https://blockchain.info/tx/#{deposit.txid}", target: :blank + %td= link_to deposit.txid, "#{CONFIG["blockchain_info"]["transfer_url"]}/#{deposit.txid}", target: :blank %td= deposit.confirmed? ? t('.confirmed_yes') : t('.confirmed_no') = paginate @deposits diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 48043f1f..6786b191 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -10,6 +10,8 @@ = @project.full_name %small= link_to glyph(:github), @project.github_url, target: '_blank' .pull-right + - if @project.collaborators.empty? + = "(Pending initial sync)" - if can? :update, @project = link_to t('.edit_project'), edit_project_path(@project), class: "btn btn-primary" - if can? :decide_tip_amounts, @project and @project.has_undecided_tips? diff --git a/app/views/tips/index.html.haml b/app/views/tips/index.html.haml index ded8f6e0..317bff72 100644 --- a/app/views/tips/index.html.haml +++ b/app/views/tips/index.html.haml @@ -45,7 +45,7 @@ = t('.waiting') - else - if tip.sendmany.txid.present? - = link_to tip.sendmany.txid, "https://blockchain.info/tx/#{tip.sendmany.txid}", target: :blank + = link_to tip.sendmany.txid, "#{CONFIG["blockchain_info"]["transfer_url"]}/#{tip.sendmany.txid}", target: :blank - else = t('.waiting') - if tip.sendmany.is_error diff --git a/app/views/withdrawals/index.html.haml b/app/views/withdrawals/index.html.haml index 9e0825e2..4b3e2c24 100644 --- a/app/views/withdrawals/index.html.haml +++ b/app/views/withdrawals/index.html.haml @@ -10,5 +10,5 @@ - @sendmanies.each do |sendmany| %tr %td= l(sendmany.created_at, format: :short) - %td= link_to(sendmany.txid, "https://blockchain.info/tx/#{sendmany.txid}", target: '_blank') + %td= link_to(sendmany.txid, "#{CONFIG["blockchain_info"]["transfer_url"]}/#{sendmany.txid}", target: '_blank') %td= sendmany.is_error ? t('.error') : t('.success') diff --git a/config/application.rb b/config/application.rb index e801a593..48be945c 100644 --- a/config/application.rb +++ b/config/application.rb @@ -8,6 +8,14 @@ # load config.yaml preprocessed CONFIG ||= YAML::load(ERB.new(File.read("config/config.yml")).result) +# define default blockchain urls +merchant_url = "https://blockchain.info/merchant" +transfer_url = "https://blockchain.info/tx" +guid = CONFIG["blockchain_info"]["guid"] +CONFIG["blockchain_info"]["merchant_url"] = merchant_url +CONFIG["blockchain_info"]["transfer_url"] = transfer_url +CONFIG["blockchain_info"]["new_url"] = "#{merchant_url}/#{guid}/new_address" +CONFIG["blockchain_info"]["sendmany_url"] = "#{merchant_url}/#{guid}/sendmany" module T4c diff --git a/config/routes.rb b/config/routes.rb index 16cdf7ad..0f2cbaee 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,7 +4,9 @@ get '/blockchain_info_callback' => "home#blockchain_info_callback", :as => "blockchain_info_callback" - get '/:service/:repo' => 'projects#show', :constraints => {:service => /github/, :repo => /.+/} + get '/:service/:repo/:action' => 'projects#edit', :constraints => {:service => /github/, :repo => /.+/, :action => /edit/} + get '/:service/:repo/:action' => 'projects#decide_tip_amounts', :constraints => {:service => /github/, :repo => /.+/, :action => /decide_tip_amounts/} + get '/:service/:repo' => 'projects#show', :constraints => {:service => /github/, :repo => /.+/} devise_for :users, :controllers => { From b7e6dc33d9ab854c3ac3bc530468f891f1f6f9cd Mon Sep 17 00:00:00 2001 From: bill auger Date: Wed, 29 Oct 2014 08:56:11 +0000 Subject: [PATCH 089/415] add project avatar image to Project index and show pages * added :avatar_url field to Project table for efficiency * project avatar image replaces octocat on Project show page * project avatar url updates in Project#update_repository_info --- app/assets/javascripts/i18n/translations.js | 2 +- app/assets/stylesheets/application.css | 2 ++ app/assets/stylesheets/projects.css.scss | 8 +++++--- app/models/project.rb | 14 ++++++++------ app/views/projects/index.html.haml | 9 ++++++--- app/views/projects/show.html.haml | 6 +++--- .../20141029083726_add_avatar_to_projects.rb | 5 +++++ db/schema.rb | 3 ++- 8 files changed, 32 insertions(+), 17 deletions(-) create mode 100644 db/migrate/20141029083726_add_avatar_to_projects.rb diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js index 029f45b8..ac0ec161 100644 --- a/app/assets/javascripts/i18n/translations.js +++ b/app/assets/javascripts/i18n/translations.js @@ -1,2 +1,2 @@ var I18n = I18n || {}; -I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}}}; \ No newline at end of file +I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}}}; \ No newline at end of file diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index fce99d41..5c9d2b71 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -28,3 +28,5 @@ padding: 15px; margin: 0 auto; } + +.rjust { text-align: right ; } diff --git a/app/assets/stylesheets/projects.css.scss b/app/assets/stylesheets/projects.css.scss index 6d95023e..21bb2ec4 100644 --- a/app/assets/stylesheets/projects.css.scss +++ b/app/assets/stylesheets/projects.css.scss @@ -2,6 +2,8 @@ // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ -.commit-sha { - font-family: monospace; -} +.commit-sha { font-family: monospace; } + +.project_avatar_img { position: relative ; width: 32px ; height: 32px ; } +#projects_table .project_avatar_img { top: 3px ; } +#project_header .project_avatar_img { top: -5px ; } diff --git a/app/models/project.rb b/app/models/project.rb index 5affe082..a1afe9b9 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -20,13 +20,15 @@ class Project < ActiveRecord::Base # before_save :check_tips_to_pay_against_avaiable_amount def update_repository_info repo - self.github_id = repo.id - self.name = repo.name - self.full_name = repo.full_name + self.github_id = repo.id + self.name = repo.name + self.full_name = repo.full_name self.source_full_name = repo.source.full_name rescue '' - self.description = repo.description - self.watchers_count = repo.watchers_count - self.language = repo.language + self.description = repo.description + self.watchers_count = repo.watchers_count + self.language = repo.language + self.avatar_url = repo.organization.rels[:avatar].href if repo.organization.present? + self.save! end diff --git a/app/views/projects/index.html.haml b/app/views/projects/index.html.haml index a6c1445a..82c71486 100644 --- a/app/views/projects/index.html.haml +++ b/app/views/projects/index.html.haml @@ -11,9 +11,10 @@ = button_tag t('.find_project.button'), class: "btn btn-default", name: nil %p - if @projects.count > 0 - %table.table.table-striped + %table.table.table-striped#projects_table %thead %tr + %th %th= link_to_unless_current t('.repository'), params.merge(:order => 'repository') %th= link_to_unless_current t('.description'), params.merge(:order => 'description') %th= link_to_unless_current t('.watchers'), params.merge(:order => 'watchers') @@ -22,6 +23,8 @@ %tbody - @projects.each do |project| %tr + %td + = image_tag project.avatar_url , class: 'project_avatar_img' if project.avatar_url %td %strong= link_to project.full_name, pretty_project_path(project) - if !project.source_full_name.blank? @@ -31,8 +34,8 @@ = t('.forked_from') = link_to project.source_full_name, project.source_github_url, target: '_blank' %td= project.description - %td= project.watchers_count - %td= btc_human project.available_amount_cache + %td.rjust= project.watchers_count + %td.rjust= btc_human project.available_amount_cache %td= link_to t('.support'), pretty_project_path(project), class: 'btn btn-xs btn-success' = paginate @projects - else diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 48043f1f..a2bf0e3a 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -6,9 +6,9 @@ - if @project.disable_notifications .alert.alert-danger= t('.disabled_notifications') -%h1 - = @project.full_name - %small= link_to glyph(:github), @project.github_url, target: '_blank' +%h1#project_header + = (@project.avatar_url.nil?)? (glyph :github) : (image_tag @project.avatar_url , class: 'project_avatar_img') + = link_to @project.full_name , @project.github_url, target: '_blank' .pull-right - if can? :update, @project = link_to t('.edit_project'), edit_project_path(@project), class: "btn btn-primary" diff --git a/db/migrate/20141029083726_add_avatar_to_projects.rb b/db/migrate/20141029083726_add_avatar_to_projects.rb new file mode 100644 index 00000000..c4d9f893 --- /dev/null +++ b/db/migrate/20141029083726_add_avatar_to_projects.rb @@ -0,0 +1,5 @@ +class AddAvatarToProjects < ActiveRecord::Migration + def change + add_column :projects, :avatar_url, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index b9683cf3..a75e768d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140918051752) do +ActiveRecord::Schema.define(version: 20141029083726) do create_table "collaborators", force: true do |t| t.integer "project_id" @@ -53,6 +53,7 @@ t.datetime "info_updated_at" t.string "branch" t.boolean "disable_notifications" + t.string "avatar_url" end add_index "projects", ["full_name"], name: "index_projects_on_full_name", unique: true From 11f1eed297a02d58225a5a832969a0aebb4bffed Mon Sep 17 00:00:00 2001 From: bill auger Date: Wed, 29 Oct 2014 21:26:40 +0000 Subject: [PATCH 090/415] add backlog of feature tests and refactor existing tests to use uniform url scheme * added cucumber test for project management ability of collaborators/non-collaborators * added cucumber tests for searching and adding projects (PR #140) * add test for and searching/adding valid and invalid repos * test also for organization avatar image * added features/find_or_create_project.feature * added features/project_steps.rb * added cucumber tests for signup and sign-in links (PR #131) * added features/signup_signin.feature * added features/step_definitions/home_steps.rb * added cucumber tests for "initial sync pending" notice (PR #141) * added features/manage_project.feature * added rspec controller and routing tests for most actions of all controllers * added spec/controllers/tips_controller_spec.rb * added spec/controllers/withdrawals_controller_spec.rb * factored out commonality from some existing steps (ie. "When I visit ...") * deferred loading of collaborators and commits until project actually "syncs" * handles up to three test @project instances NOTES: this commit includes tests for the features implemented on other branches they are not marked as 'pending' and will be failing before those feature branches are merged - so it may be best to hold back this PR unitl all of these are merged PR #131 - fix inconsistent capitalization of signup/sign-in links PR #140 - add project avatar image to Project index and show pages PR #141 - add "sync pending" notice and more pretty urls FAILING TESTS: the steps in features/step_definitions/home_steps.rb "I should see "Sign up" in the header" and "I should see "Sign out" in the header" and the steps in features/step_definitions/web.rb "I'm not logged in"/"I log out" are failing in this commit because they depend on the feature implemented in PR #131 the step in features/find_or_create_project.feature "there should be a project avatar image" is failing in this commit because it depends on the feature implemented in PR #140 the uniform pretty urls feature of project-management branch (PR #141) is so intrinsic to the generalized "I visit ..." testing paths in this commit that this branch incorperates it - as most existing tests would fail without the uniform pretty url routing scheme - the project-management branch and may even merge until all of the PR mentioned here are up to date - in any case to minimize merge conflicts it probably best to merge this one last --- app/assets/javascripts/i18n/translations.js | 2 +- app/controllers/projects_controller.rb | 31 ++- app/helpers/projects_helper.rb | 8 + app/views/projects/show.html.haml | 2 + config/routes.rb | 6 +- features/find_or_create_project.feature | 75 +++++++ features/manage_project.feature | 54 +++++ features/notification_threshold.feature | 18 +- features/sign_up_sign_in.feature | 62 ++++++ features/step_definitions/common.rb | 126 +++++++++--- features/step_definitions/home_steps.rb | 8 + features/step_definitions/project_steps.rb | 21 ++ .../tip_modifier_interface.rb | 37 ++-- features/step_definitions/web.rb | 59 +++++- features/support/finders.rb | 7 +- features/tip_modifier_interface.feature | 190 ++++++++++-------- features/tipping_policies.feature | 30 +-- spec/controllers/deposits_controller_spec.rb | 8 +- spec/controllers/home_controller_spec.rb | 8 + spec/controllers/projects_controller_spec.rb | 167 ++++++++++++++- spec/controllers/tips_controller_spec.rb | 18 ++ spec/controllers/users_controller_spec.rb | 60 ++++++ .../withdrawals_controller_spec.rb | 18 ++ 23 files changed, 844 insertions(+), 171 deletions(-) create mode 100644 features/find_or_create_project.feature create mode 100644 features/manage_project.feature create mode 100644 features/sign_up_sign_in.feature create mode 100644 features/step_definitions/home_steps.rb create mode 100644 features/step_definitions/project_steps.rb create mode 100644 spec/controllers/tips_controller_spec.rb create mode 100644 spec/controllers/withdrawals_controller_spec.rb diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js index 029f45b8..ac0ec161 100644 --- a/app/assets/javascripts/i18n/translations.js +++ b/app/assets/javascripts/i18n/translations.js @@ -1,2 +1,2 @@ var I18n = I18n || {}; -I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}}}; \ No newline at end of file +I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}}}; \ No newline at end of file diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index ee02fbfa..44fac396 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -2,7 +2,8 @@ class ProjectsController < ApplicationController - before_filter :load_project, only: [:show, :edit, :update, :decide_tip_amounts] + before_filter :load_project, only: [:show, :edit, :update, :decide_tip_amounts, + :tips, :deposits] def index @projects = Project.order(projects_order).page(params[:page]).per(30) @@ -19,11 +20,21 @@ def search # Redirect to pretty url for html format include ProjectsHelper - before_filter only: [:show] do + before_filter only: [:show, :edit, :decide_tip_amounts] do |controller| + return unless request.get? + if params[:id].present? begin respond_to do |format| - format.html { redirect_to pretty_project_path(@project) } + case controller.action_name + when 'show' + path = pretty_project_path(@project) + when 'edit' + path = pretty_project_edit_path(@project) + when 'decide_tip_amounts' + path = pretty_project_decide_tip_amounts_path(@project) + end + format.html { redirect_to path } end rescue ActionController::UnknownFormat end @@ -83,6 +94,20 @@ def decide_tip_amounts end end + def tips + @tips = @project.tips.includes(:user).order(created_at: :desc). + page(params[:page]). + per(params[:per_page] || 30) + render :template => 'tips/index' + end + + def deposits + @deposits = @project.deposits.order(created_at: :desc). + page(params[:page]). + per(params[:per_page] || 30) + render :template => 'deposits/index' + end + private def load_project diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 6189890b..5911ecd9 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -22,6 +22,14 @@ def pretty_project_path project "/#{project.host}/#{project.full_name}" end + def pretty_project_edit_path project + "#{pretty_project_path project}/edit" + end + + def pretty_project_decide_tip_amounts_path project + "#{pretty_project_path project}/decide_tip_amounts" + end + def pretty_project_url project root_url.gsub(/\/$/,'') + pretty_project_path(project) end diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 48043f1f..6786b191 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -10,6 +10,8 @@ = @project.full_name %small= link_to glyph(:github), @project.github_url, target: '_blank' .pull-right + - if @project.collaborators.empty? + = "(Pending initial sync)" - if can? :update, @project = link_to t('.edit_project'), edit_project_path(@project), class: "btn btn-primary" - if can? :decide_tip_amounts, @project and @project.has_undecided_tips? diff --git a/config/routes.rb b/config/routes.rb index 16cdf7ad..be386023 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,7 +4,11 @@ get '/blockchain_info_callback' => "home#blockchain_info_callback", :as => "blockchain_info_callback" - get '/:service/:repo' => 'projects#show', :constraints => {:service => /github/, :repo => /.+/} + get '/:service/:repo/edit' => 'projects#edit', :constraints => {:service => /github/, :repo => /.+/} + get '/:service/:repo/decide_tip_amounts' => 'projects#decide_tip_amounts', :constraints => {:service => /github/, :repo => /.+/} + get '/:service/:repo/tips' => 'projects#tips', :constraints => {:service => /github/, :repo => /.+/} + get '/:service/:repo/deposits' => 'projects#deposits', :constraints => {:service => /github/, :repo => /.+/} + get '/:service/:repo' => 'projects#show', :constraints => {:service => /github/, :repo => /.+/} devise_for :users, :controllers => { diff --git a/features/find_or_create_project.feature b/features/find_or_create_project.feature new file mode 100644 index 00000000..3a2dc850 --- /dev/null +++ b/features/find_or_create_project.feature @@ -0,0 +1,75 @@ +Feature: Visitors may search for and add projects + Background: + Given a "github" project named "seldon/seldons-project" exists + + Scenario: Visitors may find existing projects + Given I'm not logged in + And I visit the "projects" page + Then I should be on the "projects" page + When I fill "query" with: "seldons-project" + And I click on "Find or add project" + Then I should be on the "search" page + And I should see "seldon/seldons-project" + But I should not see "project not found" + + Scenario: Visitors may not find non-existing projects + Given I'm not logged in + And I visit the "projects" page + Then I should be on the "projects" page + When I fill "query" with: "no-such-repo" + And I click on "Find or add project" + Then I should be on the "search" page + And I should see "Project not found" + But I should not see "seldon/seldons-project" + + Scenario: Visitors may add new projects + Given I'm not logged in + And I visit the "projects" page + Then I should be on the "projects" page + When I fill "query" with: "https://github.com/tip4commit/tip4commit" + And I click on "Find or add project" + Then I should be on the "tip4commit/tip4commit github-project" page + And I should see "tip4commit/tip4commit" + But I should not see "seldon/seldons-project" + + Scenario: Visitors may not add non-existing projects + Given I'm not logged in + And I visit the "projects" page + Then I should be on the "projects" page + When I fill "query" with: "https://github.com/xxx-no-such-user-xxx/xxx-no-such-repo-xxx" + And I click on "Find or add project" + Then I should be on the "search" page + And I should see "Project not found" + But I should not see "xxx-no-such-repo-xxx" + And I should not see "seldon/seldons-project" + + Scenario: Visitors may not add bogus projects + Given I'm not logged in + And I visit the "projects" page + Then I should be on the "projects" page + When I fill "query" with: "https://shithub.com/nouser/norepo" + And I click on "Find or add project" + Then I should be on the "search" page + And I should see "Project not found" + But I should not see "norepo" + And I should not see "seldon/seldons-project" + + Scenario: Projects with individual owner should not show project avatar + Given I'm not logged in + And I visit the "projects" page + Then I should be on the "projects" page + When I fill "query" with: "seldons-project" + And I click on "Find or add project" + Then I should be on the "search" page + And I should see "seldon/seldons-project" + And there should not be a project avatar image visible + + Scenario: Projects owned by an organization should show project avatar + Given I'm not logged in + And I visit the "projects" page + Then I should be on the "projects" page + When I fill "query" with: "https://github.com/tip4commit/tip4commit" + And I click on "Find or add project" + Then I should be on the "tip4commit/tip4commit github-project" page + And I should see "tip4commit/tip4commit" + And there should be a project avatar image visible diff --git a/features/manage_project.feature b/features/manage_project.feature new file mode 100644 index 00000000..55f72f41 --- /dev/null +++ b/features/manage_project.feature @@ -0,0 +1,54 @@ +Feature: Collaborators may manage project + Background: + Given a "github" project named "seldon/seldons-project" exists + + Scenario: Collaborators must be logged-in to manage project + Given I'm not logged in + When I visit the "seldon/seldons-project github-project" page + Then I should be on the "seldon/seldons-project github-project" page + And I should see "seldon/seldons-project" + And I should see "Pending initial sync" + But I should not see "Change project settings" + And I should not see "Decide tips" + + When the project syncs with the remote repo + And I visit the "seldon/seldons-project github-project" page + Then I should be on the "seldon/seldons-project github-project" page + And I should see "seldon/seldons-project" + But I should not see "Pending initial sync" + And I should not see "Change project settings" + And I should not see "Decide tips" + + Scenario: Non-collaborators should not be able to manage project + Given I'm logged in as "someone-else" + When I visit the "seldon/seldons-project github-project" page + Then I should be on the "seldon/seldons-project github-project" page + And I should see "seldon/seldons-project" + And I should see "Pending initial sync" + But I should not see "Change project settings" + And I should not see "Decide tips" + + When the project syncs with the remote repo + And I visit the "seldon/seldons-project github-project" page + Then I should be on the "seldon/seldons-project github-project" page + And I should see "seldon/seldons-project" + But I should not see "Pending initial sync" + And I should not see "Change project settings" + And I should not see "Decide tips" + + Scenario: New projects should show "Pending initial sync" + Given I'm logged in as "seldon" + When I visit the "seldon/seldons-project github-project" page + Then I should be on the "seldon/seldons-project github-project" page + And I should see "seldon/seldons-project" + And I should see "Pending initial sync" + But I should not see "Change project settings" + And I should not see "Decide tips" + + When the project syncs with the remote repo + And I visit the "seldon/seldons-project github-project" page + Then I should be on the "seldon/seldons-project github-project" page + And I should see "seldon/seldons-project" + But I should not see "Pending initial sync" + And I should see "Change project settings" + But I should not see "Decide tips" diff --git a/features/notification_threshold.feature b/features/notification_threshold.feature index 5e613f6e..1426b015 100644 --- a/features/notification_threshold.feature +++ b/features/notification_threshold.feature @@ -1,19 +1,19 @@ Feature: Users should not be notified if their balance is small Background: - Given a project "django" - And a deposit of "0.1" - And 2 new commits + Given a "github" project named "seldon/seldon-project" exists + And a deposit of "0.1" is made + And 2 new commits are made Scenario: Without big deposits - When the new commits are read + When the project syncs with the remote repo Then there should be 0 email sent Scenario: User's balance hits threshold - When 100 new commits - And the new commits are read + When 100 new commits are made + And the project syncs with the remote repo Then there should be 1 email sent Scenario: With bigger donation - When a deposit of "2" - And the new commits are read - Then there should be 1 email sent \ No newline at end of file + When a deposit of "2" is made + And the project syncs with the remote repo + Then there should be 1 email sent diff --git a/features/sign_up_sign_in.feature b/features/sign_up_sign_in.feature new file mode 100644 index 00000000..62dabb8f --- /dev/null +++ b/features/sign_up_sign_in.feature @@ -0,0 +1,62 @@ +Feature: Visitors should be able to sign_up and sign_in + Background: + Given a "github" project named "seldon/seldons-project" exists + And the project collaborators are: + | seldon | + + Scenario Outline: Visitors should see sign_up and sign_in links on all pages + Given I'm not logged in + When I visit the page + Then I should be on the page + And I should see "Sign up" in the header + And I should see "Sign in" in the header + But I should not see "Sign out" in the header + Examples: + | page | + | "home" | + | "users" | + | "tips" | + | "deposits" | + | "withdrawals" | + | "projects" | + | "seldon/seldons-project github-project" | + | "seldon/seldons-project github-project tips" | + | "seldon/seldons-project github-project deposits" | + + + Scenario: Visitors should see sign_up but not sign_in links on sign_in page + Given I'm not logged in + When I visit the "sign_in" page + Then I should be on the "sign_in" page + And I should see "Sign up" in the header + But I should not see "Sign in" in the header + And I should not see "Sign out" in the header + + Scenario: Visitors should see sign_in but not sign_up links on sign_up page + Given I'm not logged in + When I visit the "sign_up" page + Then I should be on the "sign_up" page + And I should not see "Sign up" in the header + But I should see "Sign in" in the header + And I should not see "Sign out" in the header + + Scenario Outline: Logged in users should see only sign_out link on every page + Given I'm logged in as "seldon" + When I visit the page + Then I should be on the page + And I should not see "Sign up" in the header + And I should not see "Sign in" in the header + But I should see "Sign out" in the header + Examples: + | page | + | "home" | + | "users" | + | "tips" | + | "deposits" | + | "withdrawals" | + | "projects" | + | "seldon/seldons-project github-project" | + | "seldon/seldons-project github-project edit" | + | "seldon/seldons-project github-project decide_tip_amounts" | + | "seldon/seldons-project github-project tips" | + | "seldon/seldons-project github-project deposits" | diff --git a/features/step_definitions/common.rb b/features/step_definitions/common.rb index 28b359c9..0ab39c4f 100644 --- a/features/step_definitions/common.rb +++ b/features/step_definitions/common.rb @@ -13,7 +13,7 @@ ActionMailer::Base.deliveries.clear end -Given(/^the tip for commit is "(.*?)"$/) do |arg1| +Given(/^the tip percentage per commit is "(.*?)"$/) do |arg1| CONFIG["tip"] = arg1.to_f end @@ -21,26 +21,56 @@ CONFIG["our_fee"] = arg1.to_f end -Given(/^a project$/) do - @project = Project.create!(full_name: "example/test", github_id: 123, bitcoin_address: 'mq4NtnmQoQoPfNWEPbhSvxvncgtGo6L8WY') +def create_github_project project_name + if (@github_project_1.present? && (project_name.eql? @github_project_1.full_name)) || + (@github_project_2.present? && (project_name.eql? @github_project_2.full_name)) + raise "duplicate project_name '#{project_name}'" + elsif @github_project_3.present? + raise "the maximum of three test projects already exist" + end + +# @current_project is also assigned in the "considering the .. project named ..." step + @current_project = Project.create! :full_name => project_name , # e.g. "me/my-project" + :github_id => Digest::SHA1.hexdigest(project_name) , + :bitcoin_address => 'mq4NtnmQoQoPfNWEPbhSvxvncgtGo6L8WY' + if @github_project_2.present? ; @github_project_3 = @current_project ; + elsif @github_project_1.present? ; @github_project_2 = @current_project ; + else @github_project_1 = @current_project ; + end +end + +def create_bitbicket_project project_name + raise "unknown service" # nyi +end + +When /^regarding the "(.*?)" project named "(.*?)"$/ do |service , project_name| +# @current_project is also assigned in create_github_project and create_bitbucket_project + + @current_project = find_project service , project_name end -Given(/^a project "(.*?)"$/) do |arg1| - @project = Project.create!(full_name: "example/#{arg1}", github_id: Digest::SHA1.hexdigest(arg1), bitcoin_address: 'mq4NtnmQoQoPfNWEPbhSvxvncgtGo6L8WY') +def service_do service , method_dict +=begin e.g. + service_do 'github' , {'github' => lambda {create_github_project project_name} , + 'bitbucket' => lambda {create_bitbicket_project project_name} } +=end + (method_dict.has_key? service)? method_dict[service].call : (raise "unknown service") end -Given(/^a deposit of "(.*?)"$/) do |arg1| - Deposit.create!(project: @project, amount: arg1.to_d * 1e8, confirmations: 2) +Given(/^a "(.*?)" project named "(.*?)" exists$/) do |service , project_name| + service_do service , {'github' => lambda {create_github_project project_name} , + 'bitbucket' => lambda {create_bitbicket_project project_name} } end -Given(/^the last known commit is "(.*?)"$/) do |arg1| - @project.update!(last_commit: arg1) +Given(/^a deposit of "(.*?)" is made$/) do |deposit| + Deposit.create!(project: @current_project, amount: deposit.to_d * 1e8, confirmations: 2) end -def add_new_commit(id, params = {}) - @new_commits ||= {} +def add_new_commit commit_id , params = {} + raise "dplicate commit_id" if (find_new_commit commit_id).present? + defaults = { - sha: id, + sha: commit_id, commit: { message: "Some changes", author: { @@ -48,11 +78,19 @@ def add_new_commit(id, params = {}) }, }, } - @new_commits[id] = defaults.deep_merge(params) + + project_id = @current_project.id + @new_commits ||= {} + @new_commits[project_id] ||= {} + @new_commits[project_id][commit_id] = defaults.deep_merge params end -def find_new_commit(id) - @new_commits[id] +def find_new_commit commit_id + (@new_commits || {}).each_value do |commits| + return commits[commit_id] unless commits[commit_id].nil? + end + + nil end Given(/^a new commit "(.*?)" with parent "([^"]*?)"$/) do |arg1, arg2| @@ -63,7 +101,7 @@ def find_new_commit(id) add_new_commit(arg1, parents: [{sha: arg2}, {sha: arg3}], commit: {message: "Merge #{arg2} and #{arg3}"}) end -Given(/^(\d+) new commits$/) do |arg1| +Given(/^(\d+) new commit.? (?:is|are) made$/) do |arg1| arg1.to_i.times do add_new_commit(Digest::SHA1.hexdigest(SecureRandom.hex)) end @@ -73,18 +111,36 @@ def find_new_commit(id) add_new_commit(arg1) end -Given(/^the project holds tips$/) do - @project.update(hold_tips: true) +Given(/^the message of commit "(.*?)" is "(.*?)"$/) do |arg1, arg2| + commit = find_new_commit(arg1) + raise "no such commit" if commit.nil? + + commit.deep_merge!(commit: {message: arg2}) end -Given(/^the message of commit "(.*?)" is "(.*?)"$/) do |arg1, arg2| - find_new_commit(arg1).deep_merge!(commit: {message: arg2}) +Given(/^the most recent commit is "(.*?)"$/) do |commit| + @current_project.update!(last_commit: commit) +end + +Then(/^the most recent commit should be "(.*?)"$/) do |arg1| + @current_project.reload.last_commit.should eq(arg1) +end + +When(/^the new commits are loaded$/) do + raise "no commits have been assigned" if @new_commits.nil? + + [@github_project_1 , @github_project_2 , @github_project_3].each do |project| + next if project.nil? + + project.reload + new_commits = @new_commits[project.id].values.map(&:to_ostruct) + project.should_receive(:new_commits).and_return(new_commits) + project.tip_commits + end end -When(/^the new commits are read$/) do - @project.reload - @project.should_receive(:new_commits).and_return(@new_commits.values.map(&:to_ostruct)) - @project.tip_commits +Given(/^the project holds tips$/) do + @current_project.update(hold_tips: true) end Then(/^there should be no tip for commit "(.*?)"$/) do |arg1| @@ -101,20 +157,26 @@ def find_new_commit(id) Tip.find_by(commit: arg1).undecided?.should eq(true) end -Then(/^the new last known commit should be "(.*?)"$/) do |arg1| - @project.reload.last_commit.should eq(arg1) +Given(/^the project collaborators are:$/) do |table| + @collaborators = [] + table.raw.each do |collaborator_name,| + @collaborators << collaborator_name unless @collaborators.include? collaborator_name + end end -Given(/^the project collaborators are:$/) do |table| - @project.reload - @project.collaborators.each(&:destroy) - table.raw.each do |name,| - @project.collaborators.create!(login: name) +Given(/^the project collaborators are loaded$/) do + @current_project.reload + @current_project.collaborators.each(&:destroy) + @collaborators.each do |name,| + @current_project.collaborators.create!(login: name) end end Given(/^the author of commit "(.*?)" is "(.*?)"$/) do |arg1, arg2| - find_new_commit(arg1).deep_merge!(author: {login: arg2}, commit: {author: {email: "#{arg2}@example.com"}}) + commit = find_new_commit(arg1) + raise "no such commit" if commit.nil? + + commit.deep_merge!(author: {login: arg2}, commit: {author: {email: "#{arg2}@example.com"}}) end Given(/^an illustration of the history is:$/) do |string| diff --git a/features/step_definitions/home_steps.rb b/features/step_definitions/home_steps.rb new file mode 100644 index 00000000..11dcaa36 --- /dev/null +++ b/features/step_definitions/home_steps.rb @@ -0,0 +1,8 @@ + +Then(/^I should (.*)\s*see "(.*?)" in the header$/) do |should , text| + if should.eql? 'not ' + page.find('.masthead').should have_no_content(text) + else + page.find('.masthead').should have_content(text) + end +end diff --git a/features/step_definitions/project_steps.rb b/features/step_definitions/project_steps.rb new file mode 100644 index 00000000..084817bf --- /dev/null +++ b/features/step_definitions/project_steps.rb @@ -0,0 +1,21 @@ + +When /^the project syncs with the remote repo$/ do + # in the real world a project has no information regarding commits + # nor collaborators until the project initially syncs + project_owner_name = (@current_project.full_name.split '/').first + @new_commits ||= {@current_project.id => Hash.new} + @collaborators ||= [project_owner_name] + @collaborators << project_owner_name unless @collaborators.include? project_owner_name + + step 'the new commits are loaded' + step "the project collaborators are loaded" +end + +Then /^there should (.*)\s*be a project avatar image visible$/ do |should| + avatar_xpath = "//img[contains(@src, \"githubusercontent\")]" + if should.eql? 'not ' + page.should_not have_xpath avatar_xpath + else + page.should have_xpath avatar_xpath + end +end diff --git a/features/step_definitions/tip_modifier_interface.rb b/features/step_definitions/tip_modifier_interface.rb index 9ebc31da..d89eac8e 100644 --- a/features/step_definitions/tip_modifier_interface.rb +++ b/features/step_definitions/tip_modifier_interface.rb @@ -12,12 +12,8 @@ end end -When(/^I go to the edit page of the project$/) do - visit edit_project_path(@project) -end - When(/^I send a forged request to enable tip holding on the project$/) do - page.driver.browser.process_and_follow_redirects(:patch, project_path(@project), project: {hold_tips: "1"}) + page.driver.browser.process_and_follow_redirects(:patch, project_path(@current_project), project: {hold_tips: "1"}) end Then(/^I should see an access denied$/) do @@ -25,26 +21,26 @@ end Then(/^the project should not hold tips$/) do - @project.reload.hold_tips.should eq(false) + @current_project.reload.hold_tips.should eq(false) end Then(/^the project should hold tips$/) do - @project.reload.hold_tips.should eq(true) + @current_project.reload.hold_tips.should eq(true) end Given(/^the project has undedided tips$/) do - create(:undecided_tip, project: @project) - @project.reload.should have_undecided_tips + create(:undecided_tip, project: @current_project) + @current_project.reload.should have_undecided_tips end Given(/^the project has (\d+) undecided tip$/) do |arg1| - @project.tips.undecided.each(&:destroy) - create(:undecided_tip, project: @project) - @project.reload.should have_undecided_tips + @current_project.tips.undecided.each(&:destroy) + create(:undecided_tip, project: @current_project) + @current_project.reload.should have_undecided_tips end Given(/^I send a forged request to set the amount of the first undecided tip of the project$/) do - tip = @project.tips.undecided.first + tip = @current_project.tips.undecided.first tip.should_not be_nil params = { project: { @@ -57,28 +53,27 @@ }, } - page.driver.browser.process_and_follow_redirects(:patch, decide_tip_amounts_project_path(@project), params) + page.driver.browser.process_and_follow_redirects(:patch, decide_tip_amounts_project_path(@current_project), params) end -When(/^I send a forged request to change the percentage of commit "(.*?)" on project "(.*?)" to "(.*?)"$/) do |arg1, arg2, arg3| - project = find_project(arg2) - tip = project.tips.detect { |t| t.commit == arg1 } +When(/^I send a forged request to change the percentage of commit "(.*?)" to "(.*?)"$/) do |commit , percentage| + tip = @current_project.tips.detect { |t| t.commit == commit } tip.should_not be_nil params = { project: { tips_attributes: { "0" => { id: tip.id, - amount_percentage: arg3, + amount_percentage: percentage, }, }, }, } - page.driver.browser.process_and_follow_redirects(:patch, decide_tip_amounts_project_path(project), params) + path = decide_tip_amounts_project_path @current_project + page.driver.browser.process_and_follow_redirects :patch , path , params end Then(/^the project should have (\d+) undecided tips$/) do |arg1| - @project.tips.undecided.size.should eq(arg1.to_i) + @current_project.tips.undecided.size.should eq(arg1.to_i) end - diff --git a/features/step_definitions/web.rb b/features/step_definitions/web.rb index c3a6c65c..0ec4001b 100644 --- a/features/step_definitions/web.rb +++ b/features/step_definitions/web.rb @@ -13,18 +13,64 @@ page.should have_content("Successfully authenticated") end -Given(/^I'm not logged in$/) do +Given(/^I log out$/) do visit root_path - if page.has_content?("Sign Out") - click_on "Sign Out" + if page.has_content?("Sign out") + click_on "Sign out" page.should have_content("Signed out successfully") else page.should have_content("Sign in") end end -Given(/^I go to the project page$/) do - visit project_path(@project) +Given(/^I'm not logged in$/) { step "I log out" } + +def parse_path_from_page_string page_string + path = nil + + # explicit cases + tokens = page_string.split ' ' + name = tokens[0] + model = tokens[1] + action = tokens[2] || '' + is_user = model.eql? 'user' + is_project = ['github-project' , 'bitbucket-project'].include? model + if is_project # e.g. "me/my-project github project edit" + projects_paths = ['' , 'edit' , 'decide_tip_amounts' , 'tips' , 'deposits'] # '' => 'show' + is_valid_path = projects_paths.include? action + service = model.split('-').first + path = "/#{service}/#{name}/#{action}" if is_valid_path + elsif is_user + projects_paths = ['show' , 'edit'] + is_valid_path = projects_paths.include? action + path = "/users/#{name}/#{action}" if is_valid_path + + # implicit cases + else case page_string + when 'home' ; path = root_path ; + when 'sign_up' ; path = new_user_registration_path ; + when 'sign_in' ; path = new_user_session_path ; + when 'users' ; path = users_path ; + when 'projects' ; path = projects_path ; + when 'search' ; path = search_projects_path ; + when 'tips' ; path = tips_path ; + when 'deposits' ; path = deposits_path ; + when 'withdrawals' ; path = withdrawals_path ; + end + end + + path || (raise "unknown page") +end + +Given(/^I visit the "(.*?)" page$/) do |page_string| + visit parse_path_from_page_string page_string +end + +Then(/^I should be on the "(.*?)" page$/) do |page_string| + expected = parse_path_from_page_string page_string + actual = page.current_path + + (expected.index actual).should eq 0 # ignore trailing '/' end Given(/^I click on "(.*?)"$/) do |arg1| @@ -47,3 +93,6 @@ fill_in arg1, with: string end +Given(/^I fill "(.*?)" with: "(.*?)"$/) do |text_field, string| + fill_in text_field, with: string +end diff --git a/features/support/finders.rb b/features/support/finders.rb index 47334b17..4d4b59c2 100644 --- a/features/support/finders.rb +++ b/features/support/finders.rb @@ -1,4 +1,5 @@ -def find_project(name) - project = Project.where(full_name: "example/#{name}").first - project or raise "Project #{name.inspect} not found" +def find_project service , project_name +# TODO: subclass GithubProject , BitbucketProject , etc. (:host becomes :type) + project = Project.where(:host => service , :full_name => project_name).first + project or raise "Project '#{project_name.inspect}' not found" end diff --git a/features/tip_modifier_interface.feature b/features/tip_modifier_interface.feature index 206cbfaa..0d45b935 100644 --- a/features/tip_modifier_interface.feature +++ b/features/tip_modifier_interface.feature @@ -1,90 +1,114 @@ Feature: A project collaborator can change the tips of commits Background: - Given a project "a" - And the project collaborators are: + Given a "github" project named "seldon/seldons-project" exists + And the project collaborators are: | seldon | | daneel | - And our fee is "0" - And a deposit of "500" - And the last known commit is "AAA" - And a new commit "BBB" with parent "AAA" - And a new commit "CCC" with parent "BBB" - And the author of commit "BBB" is "yugo" - And the message of commit "BBB" is "Tiny change" - And the author of commit "CCC" is "gaal" + And our fee is "0" + And a deposit of "500" is made + And the most recent commit is "AAA" + And a new commit "BBB" with parent "AAA" + And a new commit "CCC" with parent "BBB" + And the author of commit "BBB" is "yugo" + And the author of commit "CCC" is "gaal" Scenario: Without anything modified - When the new commits are read + When the project syncs with the remote repo Then there should be a tip of "5" for commit "BBB" - And there should be a tip of "4.95" for commit "CCC" - And there should be 2 email sent + And there should be a tip of "4.95" for commit "CCC" + And there should be 2 email sent Scenario: A collaborator wants to alter the tips Given I'm logged in as "seldon" - And I go to the project page - And I click on "Change project settings" - And I check "Do not send the tips immediatly. Give collaborators the ability to modify the tips before they're sent" - And I click on "Save the project settings" - Then I should see "The project settings have been updated" - - When the new commits are read - Then the tip amount for commit "BBB" should be undecided - And the tip amount for commit "CCC" should be undecided - And there should be 0 email sent - - When I go to the project page - And I click on "Decide tip amounts" - Then I should see "BBB" - And I should see "Tiny change" - And I should see "CCC" - And I should not see "AAA" - - When I choose the amount "Tiny: 0.1%" on commit "BBB" - And I click on "Send the selected tip amounts" - Then there should be a tip of "0.5" for commit "BBB" - And the tip amount for commit "CCC" should be undecided - And there should be 1 email sent - - When the email counters are reset - And I choose the amount "Free: 0%" on commit "CCC" - And I click on "Send the selected tip amounts" - Then there should be a tip of "0.5" for commit "BBB" - And there should be a tip of "0" for commit "CCC" - And there should be 0 email sent + When the project syncs with the remote repo + And I visit the "seldon/seldons-project github-project" page + Then I should be on the "seldon/seldons-project github-project" page + When I click on "Change project settings" + Then I should be on the "seldon/seldons-project github-project edit" page + When I check "Do not send the tips immediatly." + And I click on "Save the project settings" + Then I should be on the "seldon/seldons-project github-project" page + And I should see "The project settings have been updated" + + When a new commit "DDD" with parent "CCC" + And the author of commit "DDD" is "sumdood" + And the message of commit "DDD" is "sumdood's tiny commit DDD" + And a new commit "EEE" with parent "DDD" + And the author of commit "EEE" is "sumotherdood" + When the project syncs with the remote repo + Then there should be a tip of "5" for commit "BBB" + And there should be a tip of "4.95" for commit "CCC" + And the tip amount for commit "DDD" should be undecided + And there should be 2 email sent + + When I visit the "seldon/seldons-project github-project" page + Then I should be on the "seldon/seldons-project github-project" page + When I click on "Decide tip amounts" + Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page + And I should not see "AAA" + And I should not see "BBB" + And I should not see "CCC" + But I should see "DDD" + And I should see "sumdood's tiny commit DDD" + And I should see "EEE" + And the most recent commit should be "EEE" + + When I choose the amount "Tiny: 0.1%" on commit "DDD" + And I click on "Send the selected tip amounts" + Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page + And there should be a tip of "0.49005" for commit "DDD" + And the tip amount for commit "EEE" should be undecided + And there should be 3 email sent + + When the email counters are reset + And I choose the amount "Free: 0%" on commit "EEE" + And I click on "Send the selected tip amounts" + Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page + And there should be a tip of "0.49005" for commit "DDD" + And there should be a tip of "0" for commit "EEE" + And there should be 0 email sent Scenario: A non collaborator does not see the settings button Given I'm logged in as "yugo" - And I go to the project page - Then I should not see "Change project settings" + And I visit the "seldon/seldons-project github-project" page + Then I should be on the "seldon/seldons-project github-project" page + And I should not see "Change project settings" Scenario: A non collaborator does not see the decide tip amounts button Given the project has undedided tips - And I'm logged in as "yugo" - And I go to the project page - Then I should not see "Decide tip amounts" + And I'm logged in as "yugo" + And I visit the "seldon/seldons-project github-project" page + Then I should be on the "seldon/seldons-project github-project" page + And I should not see "Decide tip amounts" Scenario: A non collaborator goes to the edit page of a project Given I'm logged in as "yugo" - When I go to the edit page of the project - Then I should see an access denied + When I visit the "seldon/seldons-project github-project edit" page + Then I should be on the "home" page + And I should see "You are not authorized to perform this action!" Scenario: A non collaborator sends a forged update on a project Given I'm logged in as "yugo" - When I send a forged request to enable tip holding on the project - Then I should see an access denied - And the project should not hold tips + When I send a forged request to enable tip holding on the project + Then I should be on the "home" page + And I should see "You are not authorized to perform this action!" + And the project should not hold tips Scenario: A collaborator sends a forged update on a project Given I'm logged in as "daneel" - When I send a forged request to enable tip holding on the project - Then the project should hold tips + When the project syncs with the remote repo + When I send a forged request to enable tip holding on the project + Then I should be on the "seldon/seldons-project github-project" page + And the project should hold tips Scenario Outline: A user sends a forged request to set a tip amount + When the project syncs with the remote repo Given the project has 1 undecided tip - And I'm logged in as "" - And I go to the project page - And I send a forged request to set the amount of the first undecided tip of the project - Then the project should have undecided tips + When I'm logged in as "" + And I visit the "seldon/seldons-project github-project" page + Then I should be on the "seldon/seldons-project github-project" page + And I send a forged request to set the amount of the first undecided tip of the project + And the project should have undecided tips Examples: | user | remaining undecided tips | @@ -92,34 +116,38 @@ Feature: A project collaborator can change the tips of commits | yugo | 1 | Scenario: A collaborator sends large amounts in tips - Given 20 new commits - And a new commit "last" - And the project holds tips - When the new commits are read - And I'm logged in as "seldon" - And I go to the project page - And I click on "Decide tip amounts" - And I choose the amount "Huge: 5%" on all commits - And I click on "Send the selected tip amounts" - Then I should see "You can't assign more than 100% of available funds." - And the tip amount for commit "BBB" should be undecided - And the tip amount for commit "CCC" should be undecided + Given 20 new commits are made + And a new commit "last" + And the project holds tips + When the project syncs with the remote repo + And I'm logged in as "seldon" + And I visit the "seldon/seldons-project github-project" page + Then I should be on the "seldon/seldons-project github-project" page + And I should see "Decide tip amounts" + When I click on "Decide tip amounts" + Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page + When I choose the amount "Huge: 5%" on all commits + And I click on "Send the selected tip amounts" + Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page + And I should see "You can't assign more than 100% of available funds." + And the tip amount for commit "BBB" should be undecided + And the tip amount for commit "CCC" should be undecided Scenario Outline: A collaborator changes the amount of a tip on another project Given the project holds tips - And the new commits are read - And a project "fake" - And the project collaborators are: + And the project syncs with the remote repo + And a "github" project named "fake/fake" exists + And the project collaborators are: | bad guy | - And a new commit "fake commit" - And the project holds tips - When the new commits are read - And I'm logged in as "" - And I send a forged request to change the percentage of commit "BBB" on project "a" to "5" - Then + And a new commit "fake commit" + And the project holds tips + When the project syncs with the remote repo + And I'm logged in as "" + When regarding the "github" project named "seldon/seldons-project" + And I send a forged request to change the percentage of commit "BBB" to "5" + Then Examples: | user | consequences | | seldon | there should be a tip of "25" for commit "BBB" | | bad guy | the tip amount for commit "BBB" should be undecided | - diff --git a/features/tipping_policies.feature b/features/tipping_policies.feature index 3b3c3e8a..02f1bd72 100644 --- a/features/tipping_policies.feature +++ b/features/tipping_policies.feature @@ -1,25 +1,29 @@ Feature: A project collaborator can display the tipping policies of the project Background: - Given a project - And the project collaborators are: + Given a "github" project named "seldon/seldons-project" exists + And the project collaborators are: | seldon | | daneel | + And the project syncs with the remote repo Scenario: A collaborator changes the tipping policies - Given I'm logged in as "seldon" - And I go to the project page - And I click on "Change project settings" - And I fill "Tipping policies" with: + Given I'm logged in as "daneel" + When I visit the "seldon/seldons-project github-project" page + Then I should be on the "seldon/seldons-project github-project" page + And I click on "Change project settings" + And I fill "Tipping policies" with: """ All commits are huge! Blah blah """ - And I click on "Save the project settings" - Then I should see "The project settings have been updated" + And I click on "Save the project settings" + Then I should be on the "seldon/seldons-project github-project" page + Then I should see "The project settings have been updated" - Given I'm not logged in - And I go to the project page - Then I should see "All commits are huge!" - And I should see "Blah blah" - And I should see "seldon" + Given I log out + When I visit the "seldon/seldons-project github-project" page + Then I should be on the "seldon/seldons-project github-project" page + Then I should see "All commits are huge!" + And I should see "Blah blah" + And I should see "daneel" diff --git a/spec/controllers/deposits_controller_spec.rb b/spec/controllers/deposits_controller_spec.rb index 3180085e..d24745b4 100644 --- a/spec/controllers/deposits_controller_spec.rb +++ b/spec/controllers/deposits_controller_spec.rb @@ -1,7 +1,6 @@ require 'spec_helper' describe DepositsController do - describe "GET 'index'" do it "returns http success" do get 'index' @@ -9,4 +8,11 @@ end end + describe "routing" do + it "routes GET / to Deposits#index" do + { :get => "/deposits" }.should route_to( + :controller => "deposits" , + :action => "index" ) + end + end end diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb index 10af3c4a..da4a82ee 100644 --- a/spec/controllers/home_controller_spec.rb +++ b/spec/controllers/home_controller_spec.rb @@ -12,4 +12,12 @@ expect(subject.status).to eq 200 end end + + describe "routing" do + it "routes GET / to Home#index" do + { :get => "/" }.should route_to( + :controller => "home" , + :action => "index" ) + end + end end diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index 02c5bb9d..e03b8787 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe ProjectsController do - describe '#index' do + describe 'GET #index' do let(:subject) { get :index } before do allow(Project).to receive(:order).with(available_amount_cache: :desc, watchers_count: :desc, full_name: :asc).and_return(Project) @@ -37,4 +37,169 @@ expect(assigns[:projects].name).to eq 'Project' end end + + describe 'POST #search' do + it 'returns 200 status code' do + post :search + response.should be_success + end + end + +=begin TODO: NFG + describe '#update' do + it 'returns 200 status code' do + put :update + response.should be_success + end + end +=end + + describe 'GET #show' do + it 'returns 302 status code' do + get :show , :service => 'github' , :repo => 'test/test' + response.should be_redirect + end + end + + describe 'GET #edit' do + it 'returns 302 status code' do + get :edit , :service => 'github' , :repo => 'test/test' + response.should be_redirect + end + end + + describe 'GET #decide_tip_amounts' do + it 'returns 302 status code' do + get :decide_tip_amounts , :service => 'github' , :repo => 'test/test' + response.should be_redirect + end + end + + describe 'PATCH #decide_tip_amounts' do + it 'returns 302 status code' do + patch :decide_tip_amounts , :service => 'github' , :repo => 'test/test' + response.should be_redirect + end + end + + describe 'GET #tips' do + it 'returns 302 status code' do + get :tips , :service => 'github' , :repo => 'test/test' + response.should be_redirect + end + end + + describe 'GET #deposits' do + it 'returns 302 status code' do + get :deposits , :service => 'github' , :repo => 'test/test' + response.should be_redirect + end + end + + describe "routing" do + it "routes GET /projects to Project#index" do + { :get => "/projects" }.should route_to( + :controller => "projects" , + :action => "index" ) + end + + it "routes GET /projects/search?query= to Project#search" do + { :get => "/projects/search?query=seldon&order=balance" }.should route_to( + :controller => "projects" , + :action => "search" , + :query => "seldon" , + :order => "balance" ) + end + + it "routes GET /projects/1 to Project#show" do + { :get => "/projects/1" }.should route_to( + :controller => "projects" , + :action => "show" , + :id => "1" ) + end + + it "routes GET /projects/1/edit to Project#edit" do + { :get => "/projects/1/edit" }.should route_to( + :controller => "projects" , + :action => "edit" , + :id => "1" ) + end + + it "routes PUT /projects/1 to Project#update" do + { :put => "/projects/1" }.should route_to( + :controller => "projects" , + :action => "update" , + :id => "1" ) + end + + it "routes GET /projects/1/decide_tip_amounts to Project#decide_tip_amounts" do + { :get => "/projects/1/decide_tip_amounts" }.should route_to( + :controller => "projects" , + :action => "decide_tip_amounts" , + :id => "1" ) + end + + it "routes PATCH /projects/1/decide_tip_amounts to Project#decide_tip_amounts" do + { :patch => "/projects/1/decide_tip_amounts" }.should route_to( + :controller => "projects" , + :action => "decide_tip_amounts" , + :id => "1" ) + end + + it "routes GET /projects/1/tips to Tips#index" do + { :get => "/projects/1/tips" }.should route_to( + :controller => "tips" , + :action => "index" , + :project_id => "1" ) + end + + it "routes GET /projects/1/deposits to Deposits#index" do + { :get => "/projects/1/deposits" }.should route_to( + :controller => "deposits" , + :action => "index" , + :project_id => "1" ) + end + end + + describe "Project pretty url routing" do + it "routes GET /:provider/:repo to Project#show" do + { :get => "/github/test/test" }.should route_to( + :controller => "projects" , + :action => "show" , + :service => "github" , + :repo => "test/test") + end + + it "routes GET /:provider/:repo/edit to Project#edit" do + { :get => "/github/test/test/edit" }.should route_to( + :controller => "projects" , + :action => "edit" , + :service => "github" , + :repo => "test/test") + end + + it "routes GET /:provider/:repo/decide_tip_amounts to Project#decide_tip_amounts" do + { :get => "/github/test/test/decide_tip_amounts" }.should route_to( + :controller => "projects" , + :action => "decide_tip_amounts" , + :service => "github" , + :repo => "test/test" ) + end + + it "routes GET /:provider/:repo/tips to Project#tips" do + { :get => "/github/test/test/tips" }.should route_to( + :controller => "projects" , + :action => "tips" , + :service => "github" , + :repo => "test/test") + end + + it "routes GET /:provider/:repo/deposits to Project#deposits" do + { :get => "/github/test/test/deposits" }.should route_to( + :controller => "projects" , + :action => "deposits" , + :service => "github" , + :repo => "test/test") + end + end end diff --git a/spec/controllers/tips_controller_spec.rb b/spec/controllers/tips_controller_spec.rb new file mode 100644 index 00000000..1159b37e --- /dev/null +++ b/spec/controllers/tips_controller_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' + +describe TipsController do + describe "GET 'index'" do + it "returns http success" do + get 'index' + expect(response).to be_success + end + end + + describe "routing" do + it "routes GET / to Tips#index" do + { :get => "/tips" }.should route_to( + :controller => "tips" , + :action => "index" ) + end + end +end diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index f5f09135..5097b6c2 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -1,6 +1,23 @@ require 'spec_helper' describe UsersController do + describe '#index' do + let(:subject) { get :index } + + it 'renders index template' do + expect(subject).to render_template :index + end + + it 'returns 200 status code' do + expect(subject.status).to eq 200 + end + + it 'assigns @users' do + subject + expect(assigns[:users].name).to eq 'User' + end + end + describe '#show' do let(:user) { mock_model User, id: 100000000 } let(:subject) { get :show, id: user.id } @@ -18,6 +35,21 @@ it 'returns 200 status code' do expect(subject.status).to eq 200 end + + it 'assigns @user' do + subject + expect(assigns[:user].name).to eq 'kd' + end + + it 'assigns @user_tips' do + subject + expect(assigns[:user_tips].name).to eq 'Tip' + end + + it 'assigns @recent_tips' do + subject + expect(assigns[:recent_tips].class).to eq Array + end end context 'when viewing other\'s page' do @@ -58,4 +90,32 @@ end end end + + describe "routing" do + it "routes GET /users to Project#index" do + { :get => "/users" }.should route_to( + :controller => "users" , + :action => "index" ) + end + + it "routes GET /users to Project#show" do + { :get => "/users/1" }.should route_to( + :controller => "users" , + :action => "show" , + :id => "1" ) + end + + it "routes GET /login to Project#login" do + { :get => "/users/login" }.should route_to( + :controller => "users" , + :action => "login" ) + end + + it "routes GET /users/1/tips to Tips#index" do + { :get => "/users/1/tips" }.should route_to( + :controller => "tips" , + :action => "index" , + :user_id => "1" ) + end + end end diff --git a/spec/controllers/withdrawals_controller_spec.rb b/spec/controllers/withdrawals_controller_spec.rb new file mode 100644 index 00000000..53af5ea4 --- /dev/null +++ b/spec/controllers/withdrawals_controller_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' + +describe WithdrawalsController do + describe "GET 'index'" do + it "returns http success" do + get 'index' + expect(response).to be_success + end + end + + describe "routing" do + it "routes GET / to Withdrawals#index" do + { :get => "/withdrawals" }.should route_to( + :controller => "withdrawals" , + :action => "index" ) + end + end +end From 824b259e4d9347a010a79adcf6f5209de9ce5581 Mon Sep 17 00:00:00 2001 From: bill auger Date: Sat, 1 Nov 2014 07:52:04 +0000 Subject: [PATCH 091/415] fix inconsistent capitalization of sign-up/sign-in links * merged latest upstream master * made consistent capitalization of all Sign-Up and Sign-in links * added links:sign_up: translation placeholders for all languages (need translations) * added general:or: transations for all languages * all oauth providers are listed in Home#index 'Contribute' section * added ApplicationHelper#list_friendly_text method for the previous feature --- app/helpers/application_helper.rb | 10 ++++++++++ app/views/home/index.html.haml | 1 + config/locales/en.yml | 10 ++++++++-- config/locales/fr.yml | 8 +++++++- config/locales/hr.yml | 10 ++++++++-- config/locales/pl.yml | 10 ++++++++-- config/locales/ru.yml | 8 +++++++- features/step_definitions/web.rb | 4 ++-- 8 files changed, 51 insertions(+), 10 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 9b58333c..a9f68c07 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -25,4 +25,14 @@ def render_flash_messages def commit_tag(sha1) content_tag(:span, truncate(sha1, length: 10, omission: ""), class: "commit-sha") end + + def list_friendly_text a_list , conjunction + # e.g. ['a'] => "a" + # ['a','b'] => "a or b" + # ['a','b','c'] => "a, b, or c" + list = a_list.map { |ea| ea.to_s } ; last = list.pop ; + (list.join ', ') + + ((list.size < 2) ? "" : ",") + + ((list.empty?) ? "" : " #{conjunction} ") + last + end end diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml index 76c75087..1622b605 100644 --- a/app/views/home/index.html.haml +++ b/app/views/home/index.html.haml @@ -27,6 +27,7 @@ = raw t('.contribute.sign_in_text', sign_in_link: link_to(t('links.sign_in'), new_user_session_path)) - if Devise.mappings[:user].registerable? = raw t('.contribute.sign_up_text', sign_up_link: link_to(t('links.sign_up'), new_user_registration_path)) + = raw " #{list_friendly_text (User.omniauth_providers.map { |provider| t(provider , scope: :omniauth_providers)}) , t('general.or')}." %p %a.btn.btn-primary{href: projects_path} = t('.contribute.button') diff --git a/config/locales/en.yml b/config/locales/en.yml index a496ef53..f0196de5 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -12,9 +12,10 @@ en: support_link: support follow_link: Follow @tip4commit links: + sign_up: Sign up sign_in: Sign in sign_in_imp: sign in - sign_out: Sign Out + sign_out: Sign out errors: project_not_found: Project not found. access_denied: Access denied @@ -63,7 +64,7 @@ en: title: Contribute text: Go and fix something! If your commit is accepted by the project maintainer, you will get a tip! sign_in_text: "Just check your email for an invitation or %{sign_in_link}." - sign_up_text: "If you have not yet received an invitation, you can %{sign_up_link} with a valid email address or via GitHub." + sign_up_text: "If you have not yet received an invitation, you can %{sign_up_link} with a valid email address or via" button: Supported projects projects: index: @@ -214,3 +215,8 @@ en: password: Password password_confirmation: Password confirmation display_name: Display name + omniauth_providers: + github: GitHub + bitbucket: BitBucket + general: + or: or diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 861ad848..ac389f6e 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -12,6 +12,7 @@ fr: support_link: subventionner follow_link: Suivez @tip4commit links: + sign_up: Sign up sign_in: Se connecter sign_in_imp: se connecter sign_out: Se déconnecter @@ -63,7 +64,7 @@ fr: title: Contribuer text: Améliorez un projet ! Si votre contribution est acceptée par le mainteneur du projet, vous recevrez un pourboire ! sign_in_text: "Vérifiez simplement vos emails ou %{sign_in_link}." - sign_up_text: "Si vous n'avez pas encore reçu une invitation, vous pouvez %{sign_up_link} avec une adresse de courriel valide ou via GitHub." + sign_up_text: "Si vous n'avez pas encore reçu une invitation, vous pouvez %{sign_up_link} avec une adresse de courriel valide ou via" button: Projets subventionnés projects: index: @@ -214,3 +215,8 @@ fr: password: Mot de passe password_confirmation: Confirmation display_name: Nom affiché + omniauth_providers: + github: GitHub + bitbucket: BitBucket + general: + or: ou diff --git a/config/locales/hr.yml b/config/locales/hr.yml index 9b65dff7..ffec3b58 100644 --- a/config/locales/hr.yml +++ b/config/locales/hr.yml @@ -12,13 +12,14 @@ hr: support_link: podrzi follow_link: Follow @tip4commit links: + sign_up: Sign up sign_in: Prijava sign_in_imp: prijava sign_out: Odjava errors: project_not_found: Projekt nije nadjen. access_denied: Pristup odbijen - can_assign_more_tips: "Ne mozete dodijeliti vise od 100% dostupnih sredstva." + can_assign_more_tips: "Ne mozete dodijeliti vise od 100% dostupnih sredstva." wrong_bitcoin_address: Greska u updejtanju bitcoin adrese user_not_found: Korisnik nije naden access_denied: Niste ovlasteni da napravite ovu akciju! @@ -63,7 +64,7 @@ hr: title: Doprinositi text: Idite i popravite nesto! Ako je vas cin odobren od odrzavatelja projekta, dobiti cete napojnicu! sign_in_text: "Samo provjerite vas email ili %{sign_in_link}." - sign_up_text: "Ako jos niste dobili pozivnicu, moze te se %{sign_up_link} sa valjanom email adresom ili GitHub-om." + sign_up_text: "Ako jos niste dobili pozivnicu, moze te se %{sign_up_link} sa valjanom email adresom ili" button: Podrzavani projekti projects: index: @@ -214,3 +215,8 @@ hr: password: Lozinka password_confirmation: Potvrda lozinke display_name: Prikazno ime + omniauth_providers: + github: GitHub + bitbucket: BitBucket + general: + or: ili diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 319c60d9..ee9dda71 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -12,6 +12,7 @@ pl: support_link: wsparcie follow_link: Obserwuj @tip4commit links: + sign_up: Sign up sign_in: Zaloguj się sign_in_imp: zaloguj się sign_out: Wyloguj się @@ -63,7 +64,7 @@ pl: title: 'Współpracuj' text: 'Idź i coś napraw! Jeśli twój commit zostanie zaakceptowany przez nadzorcę projektu, dostaniesz napiwek!' sign_in_text: "Wystarczy sprawdzić e-mail lub %{sign_in_link}." - sign_up_text: "Jeśli nadal nie otrzymałeś zaproszenia, możesz %{sign_up_link} za pomocą adresu e-mail lub przez GitHub." + sign_up_text: "Jeśli nadal nie otrzymałeś zaproszenia, możesz %{sign_up_link} za pomocą adresu e-mail lub przez" button: Wspierane projekty projects: index: @@ -213,4 +214,9 @@ pl: bitcoin_address: AAdres Bitcoin password: Hasło password_confirmation: Potwierdzenie hasła - display_name: Wyświetlana nazwa \ No newline at end of file + display_name: Wyświetlana nazwa + omniauth_providers: + github: GitHub + bitbucket: BitBucket + general: + or: czy diff --git a/config/locales/ru.yml b/config/locales/ru.yml index ce98929f..56866eea 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -12,6 +12,7 @@ ru: support_link: поддержать follow_link: Следите за @tip4commit links: + sign_up: Sign up sign_in: Войти sign_in_imp: войдите sign_out: Выйти @@ -63,7 +64,7 @@ ru: title: Участвуйте text: Идите и почините что-нибудь! Если ваш коммит будет принят владельцами проекта, вам будут выплачены чаевые! sign_in_text: "Просто проверьте ваш email или %{sign_in_link}." - sign_up_text: "Если вы еще не получил приглашение, вы можете %{sign_up_link} с действительным адресом электронной почты или через GitHub." + sign_up_text: "Если вы еще не получил приглашение, вы можете %{sign_up_link} с действительным адресом электронной почты или через" button: Проекты projects: index: @@ -214,3 +215,8 @@ ru: password: Пароль password_confirmation: Пароль еще раз display_name: Имя + omniauth_providers: + github: GitHub + bitbucket: BitBucket + general: + or: или diff --git a/features/step_definitions/web.rb b/features/step_definitions/web.rb index c3a6c65c..710ce0f7 100644 --- a/features/step_definitions/web.rb +++ b/features/step_definitions/web.rb @@ -15,8 +15,8 @@ Given(/^I'm not logged in$/) do visit root_path - if page.has_content?("Sign Out") - click_on "Sign Out" + if page.has_content?("Sign out") + click_on "Sign out" page.should have_content("Signed out successfully") else page.should have_content("Sign in") From 20fceb8cac4734bb9a635fe27f41c46e17e9aa9b Mon Sep 17 00:00:00 2001 From: bill auger Date: Sat, 1 Nov 2014 09:02:41 +0000 Subject: [PATCH 092/415] add cross-dev Gemfile * added cross-dev Gemfile * fixed some typos * updated dev wiki link in README.md * updated 'bootstrap_form' gem in Gemfile the 'sigmike/bootstrap_form' gem added to the Gemfile in https://github.com/tip4commit/tip4commit/pull/74 has been merged upstream https://github.com/bootstrap-ruby/rails-bootstrap-forms/pull/76 it was added apparently as a bugfix but is now quite outdated it was upgraded in the peer4commit repo in june https://github.com/sigmike/peer4commit/commit/ 608980f7bd7b9fde5366180142f050d7baaf27a1 --- Gemfile | 2 +- README.md | 2 +- config/cross-fork-dev/Gemfile.dev | 174 ++++++++++++++++++ config/cross-fork-dev/config.yml.dev | 2 +- .../cross-fork-dev/cross-fork-dev-REAMDE.md | 45 +++-- 5 files changed, 209 insertions(+), 16 deletions(-) create mode 100644 config/cross-fork-dev/Gemfile.dev diff --git a/Gemfile b/Gemfile index 0108e6d9..49340961 100644 --- a/Gemfile +++ b/Gemfile @@ -23,7 +23,7 @@ gem 'octokit', '~> 2.7.0' gem 'sawyer', '~> 0.5.2' gem 'twitter_bootstrap_form_for', github: 'stouset/twitter_bootstrap_form_for' gem 'twitter-bootstrap-rails', github: 'seyhunak/twitter-bootstrap-rails', branch: 'bootstrap3' -gem 'bootstrap_form', github: 'sigmike/rails-bootstrap-forms', branch: 'removed_for_on_radio_label' +gem 'bootstrap_form', github: 'bootstrap-ruby/rails-bootstrap-forms' gem 'sdoc', group: :doc, require: false gem 'cancancan' gem 'dusen' diff --git a/README.md b/README.md index e045c2d0..49017eb5 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Donate bitcoins to open source projects or receive tips for code contributions. Developers ========== -If you would like to contribute to the development of tip4commit, you can find the contribution guidelines and installation instructions on the [developer README](https://github.com/tip4commit/tip4commit/wiki/README---Developers) +If you would like to contribute to the development of tip4commit, you can find the contribution guidelines and installation instructions on the [developer README](https://github.com/tip4commit/tip4commit/wiki/Developer-README) License diff --git a/config/cross-fork-dev/Gemfile.dev b/config/cross-fork-dev/Gemfile.dev new file mode 100644 index 00000000..91f22eb4 --- /dev/null +++ b/config/cross-fork-dev/Gemfile.dev @@ -0,0 +1,174 @@ +=begin + ** DO NOT COMMIT THIS FILE IN THE RAILS ROOT DIR ** + bundle then then restore the original + (see: config/cross-fork-dev/cross-fork-dev-REAMDE.md) + cd RAILS_ROOT + mv Gemfile ./Gemfile.bak + cp config/cross-fork-dev/Gemfile.dev ./Gemfile + bundle install --without production mysql postgresql + mv Gemfile.bak ./Gemfile +=end + + +source 'https://rubygems.org' + +ruby '2.0.0' + +gem 'rails', '4.0.2' +gem 'mysql2', group: :production +gem 'sass-rails', '~> 4.0.0' +gem 'haml-rails', '~> 0.5.3' +gem 'less-rails', '~> 2.4.2' +gem 'kaminari', '~> 0.15.0' +gem 'uglifier', '>= 1.3.0' +gem 'coffee-rails', '~> 4.0.0' +gem 'therubyracer', '~> 0.12.0', platforms: :ruby +gem 'jquery-rails', '~> 3.0.4' +gem 'turbolinks', '~> 2.2.0' +gem 'jquery-turbolinks' +gem 'jbuilder', '~> 1.5.3' +gem 'airbrake', '~> 3.1.15' +gem 'devise', '~> 3.2.2' +gem 'omniauth', '~> 1.1.4' +gem 'omniauth-github', github: 'alexandrz/omniauth-github', branch: 'provide_emails' +gem 'octokit', '~> 2.7.0' +gem 'sawyer', '~> 0.5.2' +gem 'twitter_bootstrap_form_for', github: 'stouset/twitter_bootstrap_form_for' +gem 'twitter-bootstrap-rails', github: 'seyhunak/twitter-bootstrap-rails', branch: 'bootstrap3' +# sigmike 'bootstrap_form' bugfix added in https://github.com/tip4commit/tip4commit/pull/74 +# has been merged upstream https://github.com/bootstrap-ruby/rails-bootstrap-forms/pull/76 +#gem 'bootstrap_form', github: 'sigmike/rails-bootstrap-forms', branch: 'removed_for_on_radio_label' +gem 'bootstrap_form', github: 'bootstrap-ruby/rails-bootstrap-forms' +gem 'sdoc', group: :doc, require: false +gem 'cancancan' +gem 'dusen' +gem 'render_csv' +gem 'demoji' + +gem "http_accept_language" +gem 'rails-i18n' +gem "i18n-js" +gem 'kaminari-i18n' +gem 'devise-i18n' + +group :development do + gem 'capistrano', '~> 3.0.1' + gem 'capistrano-rvm', '~> 0.1.0', github: 'capistrano/rvm' + gem 'capistrano-bundler', '>= 1.1.0' + gem 'capistrano-rails', '~> 1.1.0' + gem 'debugger', '~> 1.6.5' +end + +group :development, :test do + gem 'sqlite3', '~> 1.3.8' + gem 'factory_girl_rails', '~> 4.3.0' + gem 'rspec-rails', '~> 3.0.0.beta' +end + +group :test do + gem 'simplecov' + gem 'shoulda-matchers', '~> 2.5.0' + gem 'cucumber-rails', require: false + gem 'database_cleaner' +end + + + + + + + +# peer4commit + +source 'https://rubygems.org' + +# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' +gem 'rails', '4.0.2' + +# Databases +gem 'sqlite3', '~> 1.3.8' , group: :development +gem 'mysql2', group: :mysql +gem 'pg', group: :postgresql + +# Use SCSS for stylesheets +gem 'sass-rails', '~> 4.0.0' +gem 'haml-rails', '~> 0.5.3' +gem "less-rails", '~> 2.4.2' + +gem 'twitter-bootstrap-rails', github: 'seyhunak/twitter-bootstrap-rails', branch: 'bootstrap3' + +gem 'kaminari', '~> 0.15.0' + +# Use Uglifier as compressor for JavaScript assets +gem 'uglifier', '>= 1.3.0' + +# Use CoffeeScript for .js.coffee assets and views +gem 'coffee-rails', '~> 4.0.0' + +# See https://github.com/sstephenson/execjs#readme for more supported runtimes +gem 'therubyracer', '~> 0.12.0', platforms: :ruby + +# Use jquery as the JavaScript library +gem 'jquery-rails', '~> 3.0.4' + +# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks +gem 'turbolinks', '~> 2.2.0' + +# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder +gem 'jbuilder', '~> 1.5.3' + +group :doc do + # bundle exec rake doc:rails generates the API under doc/api. + gem 'sdoc', require: false +end + +gem 'devise', '~> 3.2.2' +gem 'omniauth', '~> 1.1.4' +gem 'omniauth-github', github: 'alexandrz/omniauth-github', branch: 'provide_emails' +gem 'cancancan' +gem 'twitter_bootstrap_form_for', github: 'stouset/twitter_bootstrap_form_for' + +gem 'octokit', '~> 2.7.0' + +# Use ActiveModel has_secure_password +# gem 'bcrypt-ruby', '~> 3.0.0' + +# Use unicorn as the app server +# gem 'unicorn' + +# Use debugger +# gem 'debugger', group: [:development, :test] + +group :development do + gem 'capistrano', '~> 3.0.1' + gem 'capistrano-rvm', '~> 0.1.0', github: 'capistrano/rvm' + gem 'capistrano-bundler', '>= 1.1.0' + gem 'capistrano-rails', '~> 1.1.0' + gem 'quiet_assets' +end + +gem 'airbrake', '~> 3.1.15' +gem 'httparty' +gem 'whenever' +gem 'rqrcode-rails3' +gem 'exception_notification' +gem 'rack-canonical-host' +gem 'bootstrap_form', github: 'bootstrap-ruby/rails-bootstrap-forms' +gem 'html_pipeline_rails' +gem 'rails_autolink' +gem 'redcarpet' +gem 'sanitize' +gem 'twitter-typeahead-rails' +gem 'commontator', '~> 4.6.0' +gem 'compass-rails' + +group :test do + gem 'cucumber-rails', :require => false + # database_cleaner is not required, but highly recommended + gem 'database_cleaner' + gem 'rspec-rails', '~> 3.0.0.beta' + gem 'factory_girl_rails', '~> 4.3.0' + gem 'poltergeist' + gem 'timecop' + gem 'capybara-screenshot' +end diff --git a/config/cross-fork-dev/config.yml.dev b/config/cross-fork-dev/config.yml.dev index 8a96d72c..d9d65350 100644 --- a/config/cross-fork-dev/config.yml.dev +++ b/config/cross-fork-dev/config.yml.dev @@ -8,7 +8,7 @@ PRIME4COMMIT_BRANCHES = %w{prime4commit-master peer4commit-new-feature} BRANCHES_LISTS_FILENAME = 'config/config.yml' # DEBUG BRANCH_NAME = `git rev-parse --abbrev-ref HEAD`.strip -IS_MYFORK = MY_BRANCHES.include? BRANCH_NAME +IS_MY_FORK = MY_BRANCHES.include? BRANCH_NAME IS_TIP4COMMIT_FORK = TIP4COMMIT_BRANCHES.include? BRANCH_NAME IS_PEER4COMMIT_FORK = PEER4COMMIT_BRANCHES.include? BRANCH_NAME IS_PRIME4COMMIT_FORK = PRIME4COMMIT_BRANCHES.include? BRANCH_NAME diff --git a/config/cross-fork-dev/cross-fork-dev-REAMDE.md b/config/cross-fork-dev/cross-fork-dev-REAMDE.md index a8749b45..fc418a23 100644 --- a/config/cross-fork-dev/cross-fork-dev-REAMDE.md +++ b/config/cross-fork-dev/cross-fork-dev-REAMDE.md @@ -2,7 +2,14 @@ the files in this directory exist to aid cross-fork development of the various tip4commit forks from within the same local clone - if you will be working on only one fork then use Gemfile, config/config.yml.sample, and config/database.yml.sample instead -the various forks have drifted apart significantly and require different configuratons - these files will allow these all to be functional within in the same clone without manual config swapping - the only routine maintenance required is in adding new feature branches to the appropriate *_BRANCHES list in config.yml.dev and re-bundling when switching between forks +the various forks have drifted apart significantly and require different configuratons - these files will allow these all to be functional within in the same clone without manual config swapping - the only routine maintenance required is in adding new feature branches to the appropriate *_BRANCHES list in config.yml.dev and re-bundling when Gemfiles change + + +#### config/cross-fork-dev/Gemfile.dev + +Gemfile.dev is a concatenation of the Gemfiles from the tip4commit and peer4commit forks with some version conflicts resolved by favoring the more specific requirement + +this o/c is brittle and must be maintained and is not guaranteed 100% bug-free but has so far worked out well for development #### config/cross-fork-dev/config.yml.dev @@ -13,14 +20,25 @@ the various forks have drifted apart significantly and require different configu #### config/cross-fork-dev/database.yml.dev + database.yml.dev also includes a separate configuration for each known tip4commit variant - switched per the current git branch (requires the *_BRANCHES list in config.yml.dev) ### setup * fork any of the tip4commit forks then clone your fork - * copy config/cross-fork-dev/config.yml.dev to config/config.yml and - copy config/cross-fork-dev/database.yml.dev to config/database.yml + * backup Gemfile then copy Gemfile.dev to the rails root dir +``` + cd RAILS_ROOT + mv Gemfile ./Gemfile.bak + cp config/cross-fork-dev/Gemfile.dev ./Gemfile +``` + * bundle then restore Gemfile +``` + bundle install --without production mysql postgresql + mv Gemfile.bak ./Gemfile +``` + * copy config.yml.dev and database.yml.dev to config ``` cp config/cross-fork-dev/config.yml.dev config/config.yml cp config/cross-fork-dev/database.yml.dev config/database.yml @@ -28,22 +46,23 @@ the various forks have drifted apart significantly and require different configu * customize config/config.yml and config/database.yml * repeat the following flow for each fork including the one you forked from ``` - git remote add tip4commit https://github.com/tip4commit/tip4commit.git - git checkout -b tip4commit-master - git fetch tip4commit - git merge tip4commit/master + git remote add tip4commit https://github.com/tip4commit/tip4commit.git + git checkout -b tip4commit-master + git fetch tip4commit + git merge tip4commit/master ``` * add each fork branch created above its corresponding *_BRANCHES list ### maintenance + * add new local feature branches in their appropriate *_BRANCHES lists (e.g. to reduce ambiguity use your local master branch for experimentaion only) - * re-bundle each time you switch to a new fork configuration + * re-bundle as above when any of the forked Gemfiles change (updating and committing config/cross-fork-dev/Gemfile.dev if necessary) ``` - # for tip4commit - bundle install --without production - - # for peer4commit amd prime4commit - bundle install --without mysql postgresql + cd RAILS_ROOT + mv Gemfile ./Gemfile.bak + cp config/cross-fork-dev/Gemfile.dev ./Gemfile + bundle install --without production mysql postgresql + mv Gemfile.bak ./Gemfile ``` From 89daf607c7d4ffa3b6b877d9c3ab5beea0954ddc Mon Sep 17 00:00:00 2001 From: arsenische Date: Sat, 1 Nov 2014 21:48:48 +0500 Subject: [PATCH 093/415] *temporary* solution to #136, need to come up with a better text and place --- app/views/layouts/application.html.haml | 5 +++++ app/views/user_mailer/new_tip.html.haml | 3 +++ 2 files changed, 8 insertions(+) diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 4caf47b9..fb318476 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -49,6 +49,7 @@ = link_to t('links.sign_in'), new_user_session_path %h3.text-muted.code-pro= t('tip4commit') + = render 'common/menu' %br @@ -58,6 +59,10 @@ = yield .footer + .alert.alert-warning + We are not affiliated with most of the projects, their owners might not endorse use of tip4commit. + + %p.pull-right - ::Rails.application.config.available_locales.each do |locale| = link_to image_tag("flags/#{locale}.png"), "?locale=#{locale}", data: {no_turbolink: true} diff --git a/app/views/user_mailer/new_tip.html.haml b/app/views/user_mailer/new_tip.html.haml index 001c1072..cb7f9d30 100644 --- a/app/views/user_mailer/new_tip.html.haml +++ b/app/views/user_mailer/new_tip.html.haml @@ -15,3 +15,6 @@ %p %small = link_to "Don't notify me anymore, I don't need tips.", login_users_url(token: @user.login_token, unsubscribe: true) + + +.alert.alert-warning We are not affiliated with most of the projects, their owners might not endorse use of tip4commit. From 0bdf807cd8f58f154db3c34cc73518a907317507 Mon Sep 17 00:00:00 2001 From: arsenische Date: Sun, 2 Nov 2014 01:50:01 +0500 Subject: [PATCH 094/415] temporary fix to comply with https://help.github.com/articles/github-terms-of-service/ --- app/models/tip.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/tip.rb b/app/models/tip.rb index 969bd19a..31085713 100644 --- a/app/models/tip.rb +++ b/app/models/tip.rb @@ -114,7 +114,7 @@ def amount_percentage=(percentage) def notify_user if amount && amount > 0 && user.bitcoin_address.blank? && !user.unsubscribed && !project.disable_notifications && - user.balance > 500000 + user.balance > 21*1e8 if user.notified_at.nil? or user.notified_at < 30.days.ago begin UserMailer.new_tip(user, self).deliver From 3f9ca27be098fbdcadbc415fba3ae599dae7bdf0 Mon Sep 17 00:00:00 2001 From: arsenische Date: Sun, 2 Nov 2014 01:52:26 +0500 Subject: [PATCH 095/415] fixed the fix: 21000000*1e8 satoshis will never exist --- app/models/tip.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/tip.rb b/app/models/tip.rb index 31085713..4620d4e5 100644 --- a/app/models/tip.rb +++ b/app/models/tip.rb @@ -114,7 +114,7 @@ def amount_percentage=(percentage) def notify_user if amount && amount > 0 && user.bitcoin_address.blank? && !user.unsubscribed && !project.disable_notifications && - user.balance > 21*1e8 + user.balance > 21000000*1e8 if user.notified_at.nil? or user.notified_at < 30.days.ago begin UserMailer.new_tip(user, self).deliver From d28794db60411275602fcc18d92782ebd0f5bd61 Mon Sep 17 00:00:00 2001 From: Adam Tanner Date: Sat, 1 Nov 2014 20:24:42 -0700 Subject: [PATCH 096/415] Developers must opt-in to receive tips. --- app/models/project.rb | 4 +++- app/models/user.rb | 14 ++++--------- features/developer_opt_in_for_tips.feature | 23 ++++++++++++++++++++++ features/step_definitions/common.rb | 17 ++++++++++++++++ features/step_definitions/web.rb | 6 ++++-- features/tip_modifier_interface.feature | 2 ++ 6 files changed, 53 insertions(+), 13 deletions(-) create mode 100644 features/developer_opt_in_for_tips.feature diff --git a/app/models/project.rb b/app/models/project.rb index 5affe082..ec4fdc8c 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -117,7 +117,9 @@ def tip_commits def tip_for commit if (next_tip_amount > 0) && !Tip.exists?(commit: commit.sha) - user = User.find_or_create_with_commit commit + user = User.find_by_commit(commit) + return unless user + user.update(nickname: commit.author.login) if commit.author.try(:login) if hold_tips diff --git a/app/models/user.rb b/app/models/user.rb index 90ec7df1..5d8a9ab5 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -50,17 +50,11 @@ def self.create_with_omniauth!(auth_info) end end - def self.find_or_create_with_commit commit - author = commit.commit.author + def self.find_by_commit(commit) + email = commit.commit.author.email nickname = commit.author.try(:login) - user = find_by(nickname: nickname) if nickname - user || where(email: author.email).first_or_create do |user| - user.email = author.email - user.password = Devise.friendly_token.first(Devise.password_length.min) - user.name = author.name - user.nickname = nickname - user.skip_confirmation! - end + + find_by(email: email) || find_by(nickname: nickname) end private diff --git a/features/developer_opt_in_for_tips.feature b/features/developer_opt_in_for_tips.feature new file mode 100644 index 00000000..f6fa0a0f --- /dev/null +++ b/features/developer_opt_in_for_tips.feature @@ -0,0 +1,23 @@ +Feature: Developers must opt-in to create an account and receive tips + Background: + Given a project "my-project" + And our fee is "0" + And a deposit of "500" + And the last known commit is "COMMIT1" + + Scenario: Tipping a opted-in developer + And a user "yugo" has opted-in + And a new commit "COMMIT2" with parent "COMMIT1" + And the author of commit "COMMIT2" is "yugo" + And the message of commit "COMMIT2" is "Tiny change" + When the new commits are read + Then there should be a tip of "5" for commit "COMMIT2" + And there should be 1 email sent + + Scenario: Tipping a developer that has not opted-in + And a new commit "COMMIT2" with parent "COMMIT1" + And the author of commit "COMMIT2" is "yugo" + And the message of commit "COMMIT2" is "Tiny change" + When the new commits are read + Then there should be no tip for commit "COMMIT2" + And there should be 0 email sent diff --git a/features/step_definitions/common.rb b/features/step_definitions/common.rb index 28b359c9..3b284663 100644 --- a/features/step_definitions/common.rb +++ b/features/step_definitions/common.rb @@ -29,6 +29,15 @@ @project = Project.create!(full_name: "example/#{arg1}", github_id: Digest::SHA1.hexdigest(arg1), bitcoin_address: 'mq4NtnmQoQoPfNWEPbhSvxvncgtGo6L8WY') end +Given(/^a user "(.*?)" has opted\-in$/) do |arg1| + User.find_or_create_by!(nickname: arg1) do |user| + user.nickname = arg1 + user.password = "password" + user.email = "#{arg1.parameterize}@example.com" + user.skip_confirmation! + end +end + Given(/^a deposit of "(.*?)"$/) do |arg1| Deposit.create!(project: @project, amount: arg1.to_d * 1e8, confirmations: 2) end @@ -48,6 +57,14 @@ def add_new_commit(id, params = {}) }, }, } + + User.find_or_create_by(email: "anonymous@example.com") do |user| + user.nickname = "anonymous" + user.email = "anonymous@example.com" + user.password = "password" + user.skip_confirmation! + end + @new_commits[id] = defaults.deep_merge(params) end diff --git a/features/step_definitions/web.rb b/features/step_definitions/web.rb index c3a6c65c..a317944d 100644 --- a/features/step_definitions/web.rb +++ b/features/step_definitions/web.rb @@ -1,10 +1,12 @@ Given(/^I'm logged in as "(.*?)"$/) do |arg1| + email = "#{arg1.parameterize}@example.com" + OmniAuth.config.test_mode = true OmniAuth.config.mock_auth[:github] = { "info" => { "nickname" => arg1, - "primary_email" => "#{arg1.gsub(/\s+/,'')}@example.com", - "verified_emails" => [], + "primary_email" => email, + "verified_emails" => [email], }, }.to_ostruct visit root_path diff --git a/features/tip_modifier_interface.feature b/features/tip_modifier_interface.feature index b4fa3a0f..4c0788bc 100644 --- a/features/tip_modifier_interface.feature +++ b/features/tip_modifier_interface.feature @@ -1,6 +1,8 @@ Feature: A project collaborator can change the tips of commits Background: Given a project "a" + And a user "yugo" has opted-in + And a user "gaal" has opted-in And the project collaborators are: | seldon | | daneel | From 84ea2dd62ed7b5db1a2b590a22140d0042052787 Mon Sep 17 00:00:00 2001 From: Adam Tanner Date: Sat, 1 Nov 2014 15:27:58 -0700 Subject: [PATCH 097/415] Allow projects to be blacklisted for tips. --- app/controllers/projects_controller.rb | 17 ++++++-- app/models/project.rb | 2 - app/views/projects/blacklisted.html.haml | 5 +++ config/blacklist.yml | 15 +++++++ config/initializers/blacklist.rb | 2 + config/locales/en.yml | 3 ++ lib/blacklist.rb | 42 ++++++++++++++++++++ spec/controllers/projects_controller_spec.rb | 21 ++++++++++ spec/lib/blacklist_spec.rb | 29 ++++++++++++++ spec/models/project_spec.rb | 2 +- 10 files changed, 132 insertions(+), 6 deletions(-) create mode 100644 app/views/projects/blacklisted.html.haml create mode 100644 config/blacklist.yml create mode 100644 config/initializers/blacklist.rb create mode 100644 lib/blacklist.rb create mode 100644 spec/lib/blacklist_spec.rb diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index ee02fbfa..b23115d7 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -6,14 +6,21 @@ class ProjectsController < ApplicationController def index @projects = Project.order(projects_order).page(params[:page]).per(30) + + # This will cause pages not to always include 30 results, but... oh well. + @projects = @projects.to_a.reject! {|p| BLACKLIST.include?(p.github_url) } end def search - if params[:query].present? && project = Project.find_or_create_by_url(params[:query]) + if params[:query].present? + if BLACKLIST.include?(params[:query]) + return render :blacklisted + end + + project = Project.find_or_create_by_url(params[:query]) redirect_to pretty_project_path(project) else - @projects = Project.search(params[:query].to_s).order(projects_order).page(params[:page]).per(30) - render :index + redirect_to :index end end @@ -31,6 +38,10 @@ def search end def show + if BLACKLIST.include?(@project.github_url) + return render :blacklisted + end + if @project.bitcoin_address.nil? uri = URI("https://blockchain.info/merchant/#{CONFIG["blockchain_info"]["guid"]}/new_address") params = { password: CONFIG["blockchain_info"]["password"], label:"#{@project.full_name}@tip4commit" } diff --git a/app/models/project.rb b/app/models/project.rb index 5affe082..0084d6e0 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -203,13 +203,11 @@ def check_tips_to_pay_against_avaiable_amount end def self.find_or_create_by_url project_url - project_name = project_url. gsub(/https?\:\/\/github.com\//, ''). gsub(/\#.+$/, ''). gsub(' ', '') Github.new.find_or_create_project project_name - end end diff --git a/app/views/projects/blacklisted.html.haml b/app/views/projects/blacklisted.html.haml new file mode 100644 index 00000000..095c0a8b --- /dev/null +++ b/app/views/projects/blacklisted.html.haml @@ -0,0 +1,5 @@ +%h1= t(".title") + +.row + .col-md-12 + .alert.alert-danger= t(".message") diff --git a/config/blacklist.yml b/config/blacklist.yml new file mode 100644 index 00000000..05eeddac --- /dev/null +++ b/config/blacklist.yml @@ -0,0 +1,15 @@ +- https://github.com/adamtanner/* +- https://github.com/f-list/* +- https://github.com/gae-init/gae-init +- https://github.com/ggreer/the_silver_searcher +- https://github.com/iros/* +- https://github.com/jsocol/* +- https://github.com/libretro/* +- https://github.com/lipis/* +- https://github.com/meowy/* +- https://github.com/misoproject/* +- https://github.com/mitsuhiko/* +- https://github.com/mplewis/* +- https://github.com/sczizzo/* +- https://github.com/tcrayford/* +- https://github.com/unitaker/* diff --git a/config/initializers/blacklist.rb b/config/initializers/blacklist.rb new file mode 100644 index 00000000..c1b09c04 --- /dev/null +++ b/config/initializers/blacklist.rb @@ -0,0 +1,2 @@ +# Load the blacklist. +BLACKLIST ||= Blacklist.new(YAML.load_file("config/blacklist.yml")) diff --git a/config/locales/en.yml b/config/locales/en.yml index a496ef53..82d2ef52 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -125,6 +125,9 @@ en: message: Message tip: Tip (relative to the project balance) submit: Send the selected tip amounts + blacklisted: + title: Sorry, this project doesn't accept tips! + message: The author of this project has chosen to disallow tips for this project. tips: index: tips: Tips diff --git a/lib/blacklist.rb b/lib/blacklist.rb new file mode 100644 index 00000000..c1ef8f2c --- /dev/null +++ b/lib/blacklist.rb @@ -0,0 +1,42 @@ +require "set" + +class Blacklist + def initialize(urls) + urls = urls.map {|u| normalize_url(u) } + + @urls = Set.new(urls) + end + + def include?(url) + url = normalize_url(url) + + if @urls.include?(url) + return true + end + + # Check for the author path. + # https://github.com/author/* + url[url.rindex("/")..-1] = "/*" + + @urls.include?(url) + end + + private + def normalize_url(url) + url = url.clone + + if !url.start_with?("http://", "https://", "//") + if !url.start_with?("github.com", "bitbucket.org") + # Assume it is a shortened "author/project" path and + # default to Github. + url.prepend("github.com/") + end + url.prepend("https://") + end + + uri = URI.parse(url) + + # Ignore irrelevant differences such as HTTP/HTTPS. + [uri.host, uri.path].join + end +end diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index 02c5bb9d..576e717d 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -7,6 +7,8 @@ allow(Project).to receive(:order).with(available_amount_cache: :desc, watchers_count: :desc, full_name: :asc).and_return(Project) allow(Project).to receive(:page).with(nil).and_return(Project) allow(Project).to receive(:per).with(30).and_return(Project) + allow(Project).to receive(:to_a).and_return(Project) + allow(Project).to receive(:reject!).and_return(Project) end it 'renders index template' do @@ -37,4 +39,23 @@ expect(assigns[:projects].name).to eq 'Project' end end + + describe '#search' do + let(:subject) { get :search, query: "https://github.com/mitsuhiko/flask" } + + it 'renders blacklisted template' do + expect(subject).to render_template :blacklisted + end + end + + describe '#show' do + context 'with existing project that has been blacklisted' do + let(:blacklisted_project) { create(:project, host: "github", full_name: "mitsuhiko/flask") } + let(:subject) { get :show, service: "github", repo: blacklisted_project.full_name } + + it 'renders blacklisted template' do + expect(subject).to render_template :blacklisted + end + end + end end diff --git a/spec/lib/blacklist_spec.rb b/spec/lib/blacklist_spec.rb new file mode 100644 index 00000000..08ab8d61 --- /dev/null +++ b/spec/lib/blacklist_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' + +describe Blacklist do + it 'handles blacklisted URLs' do + urls = [ + "https://github.com/author/notips", + "https://bitbucket.org/author/notips", + "https://github.com/notips/*", + "https://bitbucket.org/notips/*", + ] + + list = Blacklist.new(urls) + + # Blacklisted projects. + expect(list.include?("https://github.com/author/notips")).to eq(true) + expect(list.include?("http://github.com/author/notips?tips=true")).to eq(true) + expect(list.include?("https://bitbucket.org/author/notips")).to eq(true) + expect(list.include?("github.com/author/notips")).to eq(true) + expect(list.include?("author/notips")).to eq(true) + + # Non-blacklisted projects. + expect(list.include?("https://github.com/author/tipme")).to eq(false) + expect(list.include?("https://bitbucket.org/author/tipme")).to eq(false) + + # Blacklisted authors. + expect(list.include?("https://github.com/notips/tipme")).to eq(true) + expect(list.include?("https://bitbucket.org/notips/tipme")).to eq(true) + end +end diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index c1a604fb..594e378b 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -39,4 +39,4 @@ end end end -end \ No newline at end of file +end From ca6bac2d74adefdf945825cdcc55aaae8b5cc816 Mon Sep 17 00:00:00 2001 From: bill auger Date: Sun, 2 Nov 2014 11:33:30 +0000 Subject: [PATCH 098/415] add pretty user urls * rerouted Project#tips and Project#deposits to Tips#index and Deposits#index * added TipsController#load_project method * added pretty user paths for #tips and #show * added pretty user paths tests * added features/step_definitions/users_steps.rb * added features/view_tips.feature NOTE: TipsController#load_project method is nearly identical to ProjectsController#load_project - they could probably be refactored into ApplicationController method --- app/controllers/projects_controller.rb | 17 +------- app/controllers/tips_controller.rb | 19 +++++++-- app/controllers/users_controller.rb | 2 +- app/views/tips/index.html.haml | 2 - config/routes.rb | 9 ++++- features/step_definitions/users_steps.rb | 15 +++++++ features/step_definitions/web.rb | 11 +++-- features/view_tips.feature | 42 ++++++++++++++++++++ spec/controllers/projects_controller_spec.rb | 22 ++-------- spec/controllers/users_controller_spec.rb | 19 +++++++-- 10 files changed, 109 insertions(+), 49 deletions(-) create mode 100644 features/step_definitions/users_steps.rb create mode 100644 features/view_tips.feature diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 44fac396..a5c22e0a 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -51,8 +51,8 @@ def show @project.update_attribute :bitcoin_address, bitcoin_address end end - @project_tips = @project.tips - @recent_tips = @project_tips.includes(:user).order(created_at: :desc).first(5) + @project_tips = @project.tips.with_address + @recent_tips = @project_tips.with_address.order(created_at: :desc).first(5) end def edit @@ -94,19 +94,6 @@ def decide_tip_amounts end end - def tips - @tips = @project.tips.includes(:user).order(created_at: :desc). - page(params[:page]). - per(params[:per_page] || 30) - render :template => 'tips/index' - end - - def deposits - @deposits = @project.deposits.order(created_at: :desc). - page(params[:page]). - per(params[:per_page] || 30) - render :template => 'deposits/index' - end private diff --git a/app/controllers/tips_controller.rb b/app/controllers/tips_controller.rb index 99a91dfa..eb4481f7 100644 --- a/app/controllers/tips_controller.rb +++ b/app/controllers/tips_controller.rb @@ -3,12 +3,17 @@ class TipsController < ApplicationController before_action :load_project def index - if params[:project_id] - @tips = @project.tips.includes(:user) + if @project + @tips = @project.tips.includes(:user).with_address elsif params[:user_id] && @user = User.find(params[:user_id]) + if @user.nil? || @user.bitcoin_address.blank? + flash[:error] = I18n.t('errors.user_not_found') + redirect_to users_path and return + end + @tips = @user.tips.includes(:project) else - @tips = Tip.includes(:user, :project) + @tips = Tip.with_address.includes(:project) end @tips = @tips.order(created_at: :desc). page(params[:page]). @@ -19,9 +24,15 @@ def index end end + private def load_project - super(params[:project_id]) if params[:project_id].present? + if params[:project_id].present? + super params[:project_id] + elsif params[:service].present? && params[:repo].present? + super Project.where(host: params[:service]). + where('lower(`full_name`) = ?' , params[:repo].downcase).first + end end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index f3e5a8db..4286f7b1 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -8,7 +8,7 @@ def show end def index - @users = User.order(withdrawn_amount: :desc, commits_count: :desc).where('commits_count > 0').page(params[:page]).per(30) + @users = User.order(withdrawn_amount: :desc, commits_count: :desc).where('commits_count > 0 AND withdrawn_amount > 0').page(params[:page]).per(30) end def update diff --git a/app/views/tips/index.html.haml b/app/views/tips/index.html.haml index ded8f6e0..0d66d4ec 100644 --- a/app/views/tips/index.html.haml +++ b/app/views/tips/index.html.haml @@ -37,8 +37,6 @@ = t('.refunded') - elsif tip.undecided? = t('.undecided') - - elsif tip.user.bitcoin_address.blank? - = t('.no_bitcoin_address') - elsif tip.user.balance < CONFIG["min_payout"] = t('.below_threshold') - else diff --git a/config/routes.rb b/config/routes.rb index be386023..c5ef08e2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,10 +4,15 @@ get '/blockchain_info_callback' => "home#blockchain_info_callback", :as => "blockchain_info_callback" + # reserved routes (rejected pertty url usernames) + RESERVED_USER_ROUTES_REGEX = /(^(?:(?!^\d+$|\b(sign_in|cancel|sign_up|edit|confirmation|login)\b).)*$)/ + get '/users/:name/tips' => 'tips#index', :constraints => {:name => /\RESERVED_USER_ROUTES_REGEX/} + get '/users/:name' => 'users#show', :constraints => {:name => /\RESERVED_USER_ROUTES_REGEX/} + get '/:service/:repo/edit' => 'projects#edit', :constraints => {:service => /github/, :repo => /.+/} get '/:service/:repo/decide_tip_amounts' => 'projects#decide_tip_amounts', :constraints => {:service => /github/, :repo => /.+/} - get '/:service/:repo/tips' => 'projects#tips', :constraints => {:service => /github/, :repo => /.+/} - get '/:service/:repo/deposits' => 'projects#deposits', :constraints => {:service => /github/, :repo => /.+/} + get '/:service/:repo/tips' => 'tips#index', :constraints => {:service => /github/, :repo => /.+/} + get '/:service/:repo/deposits' => 'deposits#index', :constraints => {:service => /github/, :repo => /.+/} get '/:service/:repo' => 'projects#show', :constraints => {:service => /github/, :repo => /.+/} devise_for :users, diff --git a/features/step_definitions/users_steps.rb b/features/step_definitions/users_steps.rb new file mode 100644 index 00000000..ff9576b2 --- /dev/null +++ b/features/step_definitions/users_steps.rb @@ -0,0 +1,15 @@ + +def create_user nickname , has_bitcoiin_address + User.create do |user| + user.name = nickname + user.email = "#{nickname}@example.com" + user.bitcoin_address = '1AFgARu7e5d8Lox6P2DSFX3MW8BtsVXEn5' if has_bitcoiin_address + user.nickname = nickname + user.password = Devise.friendly_token.first(Devise.password_length.min) + user.skip_confirmation! + end +end + +Given /^a user named "(.*?)" exists (with|without?) a bitcoin address$/ do |nickname , with| + (@users ||= {})[nickname] = (create_user nickname , (with.eql? 'with')) +end diff --git a/features/step_definitions/web.rb b/features/step_definitions/web.rb index 0ec4001b..31249236 100644 --- a/features/step_definitions/web.rb +++ b/features/step_definitions/web.rb @@ -29,21 +29,24 @@ def parse_path_from_page_string page_string path = nil # explicit cases + # e.g. "a-user/a-project github project edit" + # e.g. "a-user user edit" tokens = page_string.split ' ' name = tokens[0] model = tokens[1] action = tokens[2] || '' is_user = model.eql? 'user' is_project = ['github-project' , 'bitbucket-project'].include? model - if is_project # e.g. "me/my-project github project edit" + if is_project projects_paths = ['' , 'edit' , 'decide_tip_amounts' , 'tips' , 'deposits'] # '' => 'show' is_valid_path = projects_paths.include? action service = model.split('-').first path = "/#{service}/#{name}/#{action}" if is_valid_path elsif is_user - projects_paths = ['show' , 'edit'] - is_valid_path = projects_paths.include? action - path = "/users/#{name}/#{action}" if is_valid_path + user_paths = ['' , 'edit' , 'tips'] + is_valid_path = user_paths.include? action +# path = "/users/#{name}/#{action}" if is_valid_path # TODO: nyi + path = "/users/#{@users[name].id}/#{action}" if is_valid_path # implicit cases else case page_string diff --git a/features/view_tips.feature b/features/view_tips.feature new file mode 100644 index 00000000..97e94277 --- /dev/null +++ b/features/view_tips.feature @@ -0,0 +1,42 @@ +Feature: Visitors should be able to see claimed tips + Background: + Given a "github" project named "seldon/seldons-project" exists + And a user named "yugo" exists with a bitcoin address + And a user named "gaal" exists without a bitcoin address + And our fee is "0" + And a deposit of "500" is made + And the most recent commit is "AAA" + And a new commit "BBB" with parent "AAA" + And a new commit "CCC" with parent "BBB" + And the author of commit "BBB" is "yugo" + And the author of commit "CCC" is "gaal" + When the project syncs with the remote repo + Then there should be a tip of "5" for commit "BBB" + And there should be a tip of "4.95" for commit "CCC" + Given I'm not logged in + + Scenario: Visitors should see all claimed tips but not unclaimed tips + When I visit the "tips" page + Then I should be on the "tips" page + And I should see "yugo" + But I should not see "gaal" + + Scenario: Visitors should see all claimed tips per project but not unclaimed tips + When I visit the "seldon/seldons-project github-project" page + Then I should be on the "seldon/seldons-project github-project" page + And I should see "yugo" + But I should not see "gaal" + When I visit the "seldon/seldons-project github-project tips" page + Then I should be on the "seldon/seldons-project github-project tips" page + And I should see "yugo" + But I should not see "gaal" + + Scenario: Visitors should see all claimed tips per user but not unclaimed tips + When I visit the "yugo user tips" page + Then I should be on the "yugo user tips" page + And I should see "yugo" + When I visit the "gaal user tips" page + Then I should be on the "users" page + And I should see "yugo" + And I should not see "gaal" + But I should see "User not found" diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index e03b8787..7e997c1a 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -82,20 +82,6 @@ end end - describe 'GET #tips' do - it 'returns 302 status code' do - get :tips , :service => 'github' , :repo => 'test/test' - response.should be_redirect - end - end - - describe 'GET #deposits' do - it 'returns 302 status code' do - get :deposits , :service => 'github' , :repo => 'test/test' - response.should be_redirect - end - end - describe "routing" do it "routes GET /projects to Project#index" do { :get => "/projects" }.should route_to( @@ -188,16 +174,16 @@ it "routes GET /:provider/:repo/tips to Project#tips" do { :get => "/github/test/test/tips" }.should route_to( - :controller => "projects" , - :action => "tips" , + :controller => "tips" , + :action => "index" , :service => "github" , :repo => "test/test") end it "routes GET /:provider/:repo/deposits to Project#deposits" do { :get => "/github/test/test/deposits" }.should route_to( - :controller => "projects" , - :action => "deposits" , + :controller => "deposits" , + :action => "index" , :service => "github" , :repo => "test/test") end diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index 5097b6c2..1d8f59ee 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -92,20 +92,20 @@ end describe "routing" do - it "routes GET /users to Project#index" do + it "routes GET /users to User#index" do { :get => "/users" }.should route_to( :controller => "users" , :action => "index" ) end - it "routes GET /users to Project#show" do + it "routes GET /users to User#show" do { :get => "/users/1" }.should route_to( :controller => "users" , :action => "show" , :id => "1" ) end - it "routes GET /login to Project#login" do + it "routes GET /login to User#login" do { :get => "/users/login" }.should route_to( :controller => "users" , :action => "login" ) @@ -118,4 +118,17 @@ :user_id => "1" ) end end + + describe "pretty user url routing" do + it "routes regex rejects reserved user paths" do + # accepted pertty url usernames + should_accept = %w{logi ogin s4c2 42x} + # reserved routes (rejected pertty url usernames) + should_reject = %w{sign_in cancel sign_up edit confirmation login} + + accepted = should_accept.select {|ea| ea =~ RESERVED_USER_ROUTES_REGEX} + rejected = should_reject.select {|ea| (ea =~ RESERVED_USER_ROUTES_REGEX).nil? } + accepted.size.should eq should_accept.size and rejected.size.should eq should_reject.size + end + end end From a4a194a7da1165724c7707a36c22ecf5167ee626 Mon Sep 17 00:00:00 2001 From: bill auger Date: Sun, 2 Nov 2014 11:40:59 +0000 Subject: [PATCH 099/415] supress visibility of unclaimed tips issue #146 * filtered all Tips relations through the Tips:with_address scope except for UsersController#show (private page) * filtered users with zero withdrawn_amount in UsersController#index * removed :no_bitcoin_address message from Tips#index NOTES: i do not have a full setup (blockchain account , etc) so i could not test this feature manually - it was implemented driven by cucumber tests which are not included in this PR because they were implemented on the tip of my HEAD using an incompatible routing/testing scheme implemented in PR #141 and would cause travis to fail today - they are included in PR #142 along with tests for several other recent features pending merge of the new pretty url routing scheme regarding the TipsController#index action switched on no params - # the original query Tip.includes(:user , :project) # the replacement query Tip.with_address.includes(:project) the Tips:with_address scope joins(:user) so this should not have broken anything but unfortunately no tests exist for the Tips view so this should be verified manually on a staging system rearding the UsersController#index action - im a bit uncertain of the semantics here but the User :withdrawn_amount is based on the tips.paid scope which is based on the existence of a :sendmany_id - so im assuming that this means that a tip that was offered to someone without bitcoin_address would not have a sendmany_id and any so such user would have a zero withdrawn_amount --- app/controllers/projects_controller.rb | 4 ++-- app/controllers/tips_controller.rb | 9 +++++++-- app/controllers/users_controller.rb | 2 +- app/views/tips/index.html.haml | 2 -- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index ee02fbfa..eb1be713 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -40,8 +40,8 @@ def show @project.update_attribute :bitcoin_address, bitcoin_address end end - @project_tips = @project.tips - @recent_tips = @project_tips.includes(:user).order(created_at: :desc).first(5) + @project_tips = @project.tips.with_address + @recent_tips = @project_tips.with_address.order(created_at: :desc).first(5) end def edit diff --git a/app/controllers/tips_controller.rb b/app/controllers/tips_controller.rb index 99a91dfa..3a0185bf 100644 --- a/app/controllers/tips_controller.rb +++ b/app/controllers/tips_controller.rb @@ -4,11 +4,16 @@ class TipsController < ApplicationController def index if params[:project_id] - @tips = @project.tips.includes(:user) + @tips = @project.tips.includes(:user).with_address elsif params[:user_id] && @user = User.find(params[:user_id]) + if @user.nil? || @user.bitcoin_address.blank? + flash[:error] = I18n.t('errors.user_not_found') + redirect_to users_path and return + end + @tips = @user.tips.includes(:project) else - @tips = Tip.includes(:user, :project) + @tips = Tip.with_address.includes(:project) end @tips = @tips.order(created_at: :desc). page(params[:page]). diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index f3e5a8db..4286f7b1 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -8,7 +8,7 @@ def show end def index - @users = User.order(withdrawn_amount: :desc, commits_count: :desc).where('commits_count > 0').page(params[:page]).per(30) + @users = User.order(withdrawn_amount: :desc, commits_count: :desc).where('commits_count > 0 AND withdrawn_amount > 0').page(params[:page]).per(30) end def update diff --git a/app/views/tips/index.html.haml b/app/views/tips/index.html.haml index ded8f6e0..0d66d4ec 100644 --- a/app/views/tips/index.html.haml +++ b/app/views/tips/index.html.haml @@ -37,8 +37,6 @@ = t('.refunded') - elsif tip.undecided? = t('.undecided') - - elsif tip.user.bitcoin_address.blank? - = t('.no_bitcoin_address') - elsif tip.user.balance < CONFIG["min_payout"] = t('.below_threshold') - else From 3c2500e963ca35749ab20ae10ea9b4220d7a9187 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 2 Nov 2014 17:45:47 +0500 Subject: [PATCH 100/415] fixed tests --- features/developer_opt_in_for_tips.feature | 2 +- features/notification_threshold.feature | 19 ------------------- features/tip_modifier_interface.feature | 4 ++-- 3 files changed, 3 insertions(+), 22 deletions(-) delete mode 100644 features/notification_threshold.feature diff --git a/features/developer_opt_in_for_tips.feature b/features/developer_opt_in_for_tips.feature index f6fa0a0f..de68e489 100644 --- a/features/developer_opt_in_for_tips.feature +++ b/features/developer_opt_in_for_tips.feature @@ -12,7 +12,7 @@ Feature: Developers must opt-in to create an account and receive tips And the message of commit "COMMIT2" is "Tiny change" When the new commits are read Then there should be a tip of "5" for commit "COMMIT2" - And there should be 1 email sent + And there should be 0 email sent Scenario: Tipping a developer that has not opted-in And a new commit "COMMIT2" with parent "COMMIT1" diff --git a/features/notification_threshold.feature b/features/notification_threshold.feature deleted file mode 100644 index 5e613f6e..00000000 --- a/features/notification_threshold.feature +++ /dev/null @@ -1,19 +0,0 @@ -Feature: Users should not be notified if their balance is small - Background: - Given a project "django" - And a deposit of "0.1" - And 2 new commits - - Scenario: Without big deposits - When the new commits are read - Then there should be 0 email sent - - Scenario: User's balance hits threshold - When 100 new commits - And the new commits are read - Then there should be 1 email sent - - Scenario: With bigger donation - When a deposit of "2" - And the new commits are read - Then there should be 1 email sent \ No newline at end of file diff --git a/features/tip_modifier_interface.feature b/features/tip_modifier_interface.feature index 4c0788bc..cf8e9122 100644 --- a/features/tip_modifier_interface.feature +++ b/features/tip_modifier_interface.feature @@ -19,7 +19,7 @@ Feature: A project collaborator can change the tips of commits When the new commits are read Then there should be a tip of "5" for commit "BBB" And there should be a tip of "4.95" for commit "CCC" - And there should be 2 email sent + And there should be 0 email sent Scenario: A collaborator wants to alter the tips Given I'm logged in as "seldon" @@ -45,7 +45,7 @@ Feature: A project collaborator can change the tips of commits And I click on "Send the selected tip amounts" Then there should be a tip of "0.5" for commit "BBB" And the tip amount for commit "CCC" should be undecided - And there should be 1 email sent + And there should be 0 email sent When the email counters are reset And I choose the amount "Free: 0%" on commit "CCC" From 191a2fe49075bad70fdc6c5ef8407bb8bc1d98d5 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 2 Nov 2014 19:50:13 +0500 Subject: [PATCH 101/415] fixed projects#index --- app/controllers/projects_controller.rb | 3 --- app/views/projects/index.html.haml | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 7384dc29..1963ce52 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -6,9 +6,6 @@ class ProjectsController < ApplicationController def index @projects = Project.order(projects_order).page(params[:page]).per(30) - - # This will cause pages not to always include 30 results, but... oh well. - @projects = @projects.to_a.reject! {|p| BLACKLIST.include?(p.github_url) } end def search diff --git a/app/views/projects/index.html.haml b/app/views/projects/index.html.haml index a6c1445a..f0a17dcd 100644 --- a/app/views/projects/index.html.haml +++ b/app/views/projects/index.html.haml @@ -20,7 +20,7 @@ %th= link_to_unless params[:order].blank? || params[:order] == 'balance', t('.balance'), params.merge(:order => 'balance') %th %tbody - - @projects.each do |project| + - @projects.to_a.reject{|p| BLACKLIST.include?(p.github_url) }.each do |project| %tr %td %strong= link_to project.full_name, pretty_project_path(project) From 5cfaeb1e839303e6b30c391be12b94ff837af488 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 2 Nov 2014 20:01:42 +0500 Subject: [PATCH 102/415] fixed projects#search --- app/controllers/projects_controller.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 1963ce52..1a4b6722 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -14,10 +14,14 @@ def search return render :blacklisted end - project = Project.find_or_create_by_url(params[:query]) - redirect_to pretty_project_path(project) + if project = Project.find_or_create_by_url(params[:query]) + redirect_to pretty_project_path(project) + else + @projects = Project.search(params[:query].to_s).order(projects_order).page(params[:page]).per(30) + render :index + end else - redirect_to :index + redirect_to projects_path end end From 8d26f615bba6960a94c04baabc3830abd3a8a7c3 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 2 Nov 2014 20:40:29 +0500 Subject: [PATCH 103/415] blacklisted joomla/joomla-cms, lavagetto/* and jplana/python-etcd solved #169 and #170 --- config/blacklist.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/blacklist.yml b/config/blacklist.yml index 05eeddac..bc418c30 100644 --- a/config/blacklist.yml +++ b/config/blacklist.yml @@ -13,3 +13,6 @@ - https://github.com/sczizzo/* - https://github.com/tcrayford/* - https://github.com/unitaker/* +- https://github.com/joomla/joomla-cms +- https://github.com/lavagetto/* +- https://github.com/jplana/python-etcd \ No newline at end of file From f9bb2f2239c1882dfebf9c4f3820d541ee3632aa Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 2 Nov 2014 20:43:09 +0500 Subject: [PATCH 104/415] typo. fixes #153 --- config/blacklist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/blacklist.yml b/config/blacklist.yml index bc418c30..191dc845 100644 --- a/config/blacklist.yml +++ b/config/blacklist.yml @@ -12,7 +12,7 @@ - https://github.com/mplewis/* - https://github.com/sczizzo/* - https://github.com/tcrayford/* -- https://github.com/unitaker/* +- https://github.com/untitaker/* - https://github.com/joomla/joomla-cms - https://github.com/lavagetto/* - https://github.com/jplana/python-etcd \ No newline at end of file From 2430b8042fe76e5b7f88a0f49039fe97f0fb0b22 Mon Sep 17 00:00:00 2001 From: arsenische Date: Sun, 2 Nov 2014 23:42:29 +0500 Subject: [PATCH 105/415] fixing #173 --- config/blacklist.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/blacklist.yml b/config/blacklist.yml index 191dc845..7b23cc88 100644 --- a/config/blacklist.yml +++ b/config/blacklist.yml @@ -15,4 +15,6 @@ - https://github.com/untitaker/* - https://github.com/joomla/joomla-cms - https://github.com/lavagetto/* -- https://github.com/jplana/python-etcd \ No newline at end of file +- https://github.com/jplana/python-etcd +- https://github.com/sitaramc/* +- https://github.com/gitolite/* \ No newline at end of file From 013150aced915b22b9a62bdc16f5c9d54b5a225d Mon Sep 17 00:00:00 2001 From: arsenische Date: Mon, 3 Nov 2014 02:55:29 +0500 Subject: [PATCH 106/415] fixing #174 --- config/blacklist.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/blacklist.yml b/config/blacklist.yml index 7b23cc88..ad89f735 100644 --- a/config/blacklist.yml +++ b/config/blacklist.yml @@ -17,4 +17,5 @@ - https://github.com/lavagetto/* - https://github.com/jplana/python-etcd - https://github.com/sitaramc/* -- https://github.com/gitolite/* \ No newline at end of file +- https://github.com/gitolite/* +- https://github.com/MarkusH/* \ No newline at end of file From bf0849e1cc6f1658f4539287aeddbecb5254638d Mon Sep 17 00:00:00 2001 From: Jonathan Rudenberg Date: Sun, 2 Nov 2014 20:37:30 -0500 Subject: [PATCH 107/415] Add titanous/* and flynn/* to blacklist --- config/blacklist.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/blacklist.yml b/config/blacklist.yml index ad89f735..6e5e42e1 100644 --- a/config/blacklist.yml +++ b/config/blacklist.yml @@ -18,4 +18,6 @@ - https://github.com/jplana/python-etcd - https://github.com/sitaramc/* - https://github.com/gitolite/* -- https://github.com/MarkusH/* \ No newline at end of file +- https://github.com/MarkusH/* +- https://github.com/titanous/* +- https://github.com/flynn/* From a12196ee05c8eb82109db0ca038d728d10929b69 Mon Sep 17 00:00:00 2001 From: Michael Babker Date: Sun, 2 Nov 2014 21:06:46 -0500 Subject: [PATCH 108/415] Blacklist mbabker/*, BabDev/*/ and joomla* --- config/blacklist.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/config/blacklist.yml b/config/blacklist.yml index ad89f735..00b4e6cb 100644 --- a/config/blacklist.yml +++ b/config/blacklist.yml @@ -13,9 +13,14 @@ - https://github.com/sczizzo/* - https://github.com/tcrayford/* - https://github.com/untitaker/* -- https://github.com/joomla/joomla-cms +- https://github.com/joomla/* - https://github.com/lavagetto/* - https://github.com/jplana/python-etcd - https://github.com/sitaramc/* - https://github.com/gitolite/* -- https://github.com/MarkusH/* \ No newline at end of file +- https://github.com/MarkusH/* +- https://github.com/mbabker/* +- https://github.com/BabDev/* +- https://github.com/joomla-framework/* +- https://github.com/joomla-extensions/* +- https://github.com/joomla-projects/* From 321d3ff06469f385ac92fa6b649463fd4c2819e3 Mon Sep 17 00:00:00 2001 From: Baurzhan Muftakhidinov Date: Mon, 3 Nov 2014 08:43:09 +0600 Subject: [PATCH 109/415] Fixes to Russian spelling. --- config/locales/ru.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/config/locales/ru.yml b/config/locales/ru.yml index ce98929f..2380f392 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -19,14 +19,14 @@ ru: project_not_found: Проект не найден. access_denied: Доступ запрещен can_assign_more_tips: "Нельзя использовать более чем 100% свободных средств." - wrong_bitcoin_address: Ошибка обновления биткоин адреса + wrong_bitcoin_address: Ошибка обновления биткойн адреса user_not_found: Пользователь не найден access_denied: Вы не авторизованы для выполнения данного действия! notices: project_updated: Настройки проекта обновлены tips_decided: Сумма чаевых определена user_updated: Ваш профиль обновлен! - user_unsubscribed: "Вы отписались! Приносим извинения за предоставленные неудобства. Однако, вы все равно можете оставить нам свой Биткоин адрес, чтобы получать вознагрождения" + user_unsubscribed: "Вы отписались! Приносим извинения за предоставленные неудобства. Однако, вы все равно можете оставить нам свой Биткойн адрес, чтобы получать вознаграждения" tip_amounts: undecided: "Не определено" free: "Нет: 0%" @@ -53,17 +53,17 @@ ru: see_projects: Проекты how_does_it_work: title: Как это работает? - text: Люди жертвуют биткоины на проекты. Если владелец проекта принимает коммит в репозиторий, мы автоматически начисляем чаевые автору этого коммита. - button: Узнать о Биткоин + text: Люди жертвуют биткойны на проекты. Если владелец проекта принимает коммит в репозиторий, мы автоматически начисляем чаевые автору этого коммита. + button: Узнать о Биткойн donate: title: Жертвуйте - text: Найдите проект который вам по душе и перечислите биткоины на него. Ваши пожертвования вместе с пожертвованиями других людей будут автоматически выплачиваться авторам новых коммитов в виде чаевых. + text: Найдите проект который вам по душе и перечислите биткойны на него. Ваши пожертвования вместе с пожертвованиями других людей будут автоматически выплачиваться авторам новых коммитов в виде чаевых. button: Найти или добавить проект contribute: title: Участвуйте text: Идите и почините что-нибудь! Если ваш коммит будет принят владельцами проекта, вам будут выплачены чаевые! sign_in_text: "Просто проверьте ваш email или %{sign_in_link}." - sign_up_text: "Если вы еще не получил приглашение, вы можете %{sign_up_link} с действительным адресом электронной почты или через GitHub." + sign_up_text: "Если вы еще не получили приглашение, вы можете %{sign_up_link} с действительным адресом электронной почты или через GitHub." button: Проекты projects: index: @@ -80,7 +80,7 @@ ru: title: "Помогайте %{project}" edit_project: Изменить настройки проекта decide_tip_amounts: Установить сумму чаевых - disabled_notifications: "Контрибьюторы проекта решили не уведомлять новых участников о чаевых и вероятно им не нравиться такой способ финансирования." + disabled_notifications: "Контрибьюторы проекта решили не уведомлять новых участников о чаевых и, вероятно, им не нравится такой способ финансирования." project_sponsors: Спонсоры проекта fee: "%{percentage} средств будет выплачено в качестве чаевых за новый коммит." balance: Баланс @@ -90,7 +90,7 @@ ru: unconfirmed_amount: "(%{amount} не подтверждено)" tipping_policies: Политика чаевых updated_by_user: "(Последние изменения %{name} на %{date})" - updated_by_unknown: "(Последния изменения на %{date})" + updated_by_unknown: "(Последние изменения на %{date})" tips_paid: Выплаченные чаевые unclaimed_amount: "(%{amount} от суммы являются невостребованными, и будут возвращены проекту через месяц.)" last_tips: Недавние чаевые @@ -104,7 +104,7 @@ ru: contribute_and_earn_description: "Жертвуйте биткойны этому проекту или %{make_commits_link} и получайте чаевые за них. Если ваш коммит будет принят %{branch} владельцами проекта, а баланс этого проекта положительный, то вы получите чаевые!" contribute_and_earn_branch: "в ветку %{branch}" make_commits_link: создавайте коммиты - tell_us_bitcoin_address: "Просто %{tell_us_link} ваш биткоин адрес." + tell_us_bitcoin_address: "Просто %{tell_us_link} ваш биткойн адрес." tell_us_link: укажите sign_in: "Просто проверьте ваш email или %{sign_in_link}." promote_project: "Расскажите о %{project}" @@ -116,7 +116,7 @@ ru: branch: Ветка default_branch: Ветка по умолчанию tipping_policies: Чаевые - hold_tips: "Не отправляйте чаевые сразу. Предоставьте владельцам проекта возможность изменить чаевые перед тем как они будут отправлены" + hold_tips: "Не отправляйте чаевые сразу. Предоставьте владельцам проекта возможность изменить чаевые перед тем как они будут отправлены." save: Сохранить настройки проекта disable_notifications: Не оповещать новых контрибьюторов decide_tip_amounts: @@ -154,7 +154,7 @@ ru: confirmed_no: 'Нет' users: index: - title: Топ Контрибьюторов + title: Топ контрибьюторов name: Имя commits_count: Количество коммитов withdrawn: Выплачено @@ -163,7 +163,7 @@ ru: threshold: "Вы получите свои деньги, когда ваш баланс достигнет %{threshold}" see_all: смотреть все received: "%{time} получено %{amount} за коммит %{commit} в %{project}" - bitcoin_address_placeholder: Ваш биткоин адрес + bitcoin_address_placeholder: Ваш биткойн адрес notify: Сообщать мне о новых чаевых (не чаще чем одно сообщение в месяц) submit_user: Обновить информацию пользователя change_password: Смена пароля @@ -195,7 +195,7 @@ ru: submit: Сменить пароль confirmations: new: - title: Выслать еще раз письмо с подтверждением + title: Выслать письмо с подтверждением еще раз submit: Выслать links: sign_in: Вход @@ -210,7 +210,7 @@ ru: attributes: user: email: E-mail - bitcoin_address: Биткоин адрес + bitcoin_address: Биткойн адрес password: Пароль - password_confirmation: Пароль еще раз + password_confirmation: Подтверждение пароля display_name: Имя From 0731f7c645ce223a12fad6a5852c0ac4bd408755 Mon Sep 17 00:00:00 2001 From: arsenische Date: Mon, 3 Nov 2014 20:44:00 +0500 Subject: [PATCH 110/415] fixing #180 --- config/blacklist.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/blacklist.yml b/config/blacklist.yml index 257fe774..7ea49980 100644 --- a/config/blacklist.yml +++ b/config/blacklist.yml @@ -26,3 +26,4 @@ - https://github.com/joomla-framework/* - https://github.com/joomla-extensions/* - https://github.com/joomla-projects/* +- https://github.com/ForumPostAssistant/FPA \ No newline at end of file From 09c6748777c0b944d6efc4e5ca19faf37e393cdd Mon Sep 17 00:00:00 2001 From: arsenische Date: Mon, 3 Nov 2014 21:05:43 +0500 Subject: [PATCH 111/415] fixing #175 --- config/blacklist.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/blacklist.yml b/config/blacklist.yml index 7ea49980..d3dbe16c 100644 --- a/config/blacklist.yml +++ b/config/blacklist.yml @@ -26,4 +26,5 @@ - https://github.com/joomla-framework/* - https://github.com/joomla-extensions/* - https://github.com/joomla-projects/* -- https://github.com/ForumPostAssistant/FPA \ No newline at end of file +- https://github.com/ForumPostAssistant/FPA +- https://github.com/ipython/* \ No newline at end of file From 7f2c5de4ea1b4109ff747d9a7f3a6eeb2759fbd3 Mon Sep 17 00:00:00 2001 From: bill auger Date: Tue, 4 Nov 2014 08:30:29 +0000 Subject: [PATCH 112/415] merge the remainder of project-management branch --- app/controllers/projects_controller.rb | 62 +++++++++++--------------- app/models/project.rb | 13 ++++++ app/models/sendmany.rb | 30 ++++++------- app/views/deposits/index.html.haml | 2 +- app/views/tips/index.html.haml | 2 +- app/views/withdrawals/index.html.haml | 2 +- config/application.rb | 9 ++++ 7 files changed, 65 insertions(+), 55 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 681ad827..e0d7b219 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -1,9 +1,10 @@ require 'net/http' class ProjectsController < ApplicationController + include ProjectsHelper - before_filter :load_project, only: [:show, :edit, :update, :decide_tip_amounts, - :tips, :deposits] + before_filter :load_project, only: [:show, :edit, :update, :decide_tip_amounts] + before_filter :redirect_to_pretty_url, only: [:show, :edit, :decide_tip_amounts] def index @projects = Project.order(projects_order).page(params[:page]).per(30) @@ -22,43 +23,11 @@ def search render :index end - # Redirect to pretty url for html format - include ProjectsHelper - before_filter only: [:show, :edit, :decide_tip_amounts] do |controller| - return unless request.get? - - if params[:id].present? - begin - respond_to do |format| - case controller.action_name - when 'show' - path = pretty_project_path(@project) - when 'edit' - path = pretty_project_edit_path(@project) - when 'decide_tip_amounts' - path = pretty_project_decide_tip_amounts_path(@project) - end - format.html { redirect_to path } - end - rescue ActionController::UnknownFormat - end - end - end - def show - if BLACKLIST.include?(@project.github_url) - return render :blacklisted - end + render :blacklisted and return if BLACKLIST.include? @project.github_url + + @project.update_bitcoin_address if @project.bitcoin_address.nil? - if @project.bitcoin_address.nil? - uri = URI("https://blockchain.info/merchant/#{CONFIG["blockchain_info"]["guid"]}/new_address") - params = { password: CONFIG["blockchain_info"]["password"], label:"#{@project.full_name}@tip4commit" } - uri.query = URI.encode_www_form(params) - res = Net::HTTP.get_response(uri) - if res.is_a?(Net::HTTPSuccess) && (bitcoin_address = JSON.parse(res.body)["address"]) - @project.update_attribute :bitcoin_address, bitcoin_address - end - end @project_tips = @project.tips.with_address @recent_tips = @project_tips.with_address.order(created_at: :desc).first(5) end @@ -128,4 +97,23 @@ def projects_order 'description' => {description: :asc, available_amount_cache: :desc, watchers_count: :desc, full_name: :asc} }.[](params[:order] || 'balance') end + + def redirect_to_pretty_url + return unless request.get? && params[:id].present? + + begin + respond_to do |format| + case action_name + when 'show' + path = pretty_project_path(@project) + when 'edit' + path = pretty_project_edit_path(@project) + when 'decide_tip_amounts' + path = pretty_project_decide_tip_amounts_path(@project) + end + format.html { redirect_to path } + end + rescue ActionController::UnknownFormat + end + end end diff --git a/app/models/project.rb b/app/models/project.rb index 56a8b2ee..82bd3ebb 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -19,6 +19,19 @@ class Project < ActiveRecord::Base # before_save :check_tips_to_pay_against_avaiable_amount + def update_bitcoin_address + blockchain_uri = URI CONFIG["blockchain_info"]["new_url"] + blockchain_pass = CONFIG["blockchain_info"]["password"] + blockchain_label = "#{self.full_name}@tip4commit" + blockchain_params = { password: blockchain_pass, label: blockchain_label } + blockchain_uri.query = URI.encode_www_form blockchain_params + blockchain_resp = Net::HTTP.get_response blockchain_uri + if blockchain_resp.is_a? Net::HTTPSuccess + self.bitcoin_address = (JSON.parse blockchain_resp.body)["address"] + self.save! unless self.bitcoin_address.nil? + end + end + def update_repository_info repo self.github_id = repo.id self.name = repo.name diff --git a/app/models/sendmany.rb b/app/models/sendmany.rb index 6ef75fbc..63be4035 100644 --- a/app/models/sendmany.rb +++ b/app/models/sendmany.rb @@ -8,21 +8,21 @@ def total_amount def send_transaction return if txid || is_error - update_attribute :is_error, true # it's a lock to prevent duplicates + update_attribute :is_error, true # it's a lock to prevent duplicates - uri = URI("https://blockchain.info/merchant/#{CONFIG["blockchain_info"]["guid"]}/sendmany") - params = { password: CONFIG["blockchain_info"]["password"], recipients: data } - uri.query = URI.encode_www_form(params) - res = Net::HTTP.get_response(uri) - if res.is_a?(Net::HTTPSuccess) && (json = JSON.parse(res.body)) - Rails.logger.info res.body - update_attribute :result, json - if !(txid = json["tx_hash"]).blank? - update_attribute :is_error, false - update_attribute :txid, json["tx_hash"] - end - else - Rails.logger.error "Failed to get correct response from blockchain.info" + uri = URI CONFIG["blockchain_info"]["sendmany_url"] + params = { password: CONFIG["blockchain_info"]["password"], recipients: data } + uri.query = URI.encode_www_form(params) + res = Net::HTTP.get_response(uri) + if res.is_a?(Net::HTTPSuccess) && (json = JSON.parse(res.body)) + Rails.logger.info res.body + update_attribute :result, json + if !(txid = json["tx_hash"]).blank? + update_attribute :is_error, false + update_attribute :txid, json["tx_hash"] end - end + else + Rails.logger.error "Failed to get correct response from blockchain.info" + end + end end diff --git a/app/views/deposits/index.html.haml b/app/views/deposits/index.html.haml index 7950e74d..dfc3d5dd 100644 --- a/app/views/deposits/index.html.haml +++ b/app/views/deposits/index.html.haml @@ -22,7 +22,7 @@ %td= link_to(deposit.project.full_name, pretty_project_path(deposit.project)) %td= btc_human deposit.amount %td= btc_human deposit.fee - %td= link_to deposit.txid, "https://blockchain.info/tx/#{deposit.txid}", target: :blank + %td= link_to deposit.txid, "#{CONFIG["blockchain_info"]["transfer_url"]}/#{deposit.txid}", target: :blank %td= deposit.confirmed? ? t('.confirmed_yes') : t('.confirmed_no') = paginate @deposits diff --git a/app/views/tips/index.html.haml b/app/views/tips/index.html.haml index 0d66d4ec..e5e4bb42 100644 --- a/app/views/tips/index.html.haml +++ b/app/views/tips/index.html.haml @@ -43,7 +43,7 @@ = t('.waiting') - else - if tip.sendmany.txid.present? - = link_to tip.sendmany.txid, "https://blockchain.info/tx/#{tip.sendmany.txid}", target: :blank + = link_to tip.sendmany.txid, "#{CONFIG["blockchain_info"]["transfer_url"]}/#{tip.sendmany.txid}", target: :blank - else = t('.waiting') - if tip.sendmany.is_error diff --git a/app/views/withdrawals/index.html.haml b/app/views/withdrawals/index.html.haml index 9e0825e2..00b2c671 100644 --- a/app/views/withdrawals/index.html.haml +++ b/app/views/withdrawals/index.html.haml @@ -10,5 +10,5 @@ - @sendmanies.each do |sendmany| %tr %td= l(sendmany.created_at, format: :short) - %td= link_to(sendmany.txid, "https://blockchain.info/tx/#{sendmany.txid}", target: '_blank') + %td= link_to sendmany.txid, "#{CONFIG["blockchain_info"]["transfer_url"]}/#{sendmany.txid}", target: '_blank' %td= sendmany.is_error ? t('.error') : t('.success') diff --git a/config/application.rb b/config/application.rb index e801a593..db09dd01 100644 --- a/config/application.rb +++ b/config/application.rb @@ -9,6 +9,15 @@ # load config.yaml preprocessed CONFIG ||= YAML::load(ERB.new(File.read("config/config.yml")).result) +# define default blockchain urls +merchant_url = "https://blockchain.info/merchant" +transfer_url = "https://blockchain.info/tx" +guid = CONFIG["blockchain_info"]["guid"] +CONFIG["blockchain_info"]["merchant_url"] = merchant_url +CONFIG["blockchain_info"]["transfer_url"] = transfer_url +CONFIG["blockchain_info"]["new_url"] = "#{merchant_url}/#{guid}/new_address" +CONFIG["blockchain_info"]["sendmany_url"] = "#{merchant_url}/#{guid}/sendmany" + module T4c class Application < Rails::Application From 994ac47adf0230d4b3094411caf1a32daba2201b Mon Sep 17 00:00:00 2001 From: bill auger Date: Tue, 4 Nov 2014 11:57:29 +0000 Subject: [PATCH 113/415] separate developer opt-in and tips visibility testing concerns * re-instate features/developer-opt-in.feature it was realized that the original features/developer-opt-in-for-tips.feature did indeed test an aspect that ./features/view-tips.feature did not namely whether a tip actually exists for an unknown user the view-tips feature only tests whether any such tip is visible or not the original developer-opt-in scenarios were recreated and elaborated on including what happens after a previously unknown user signs-up --- app/models/project.rb | 4 +-- config/application.rb | 4 +-- features/developer-opt-in.feature | 33 +++++++++++++++++ features/sign_up_sign_in.feature | 1 - features/step_definitions/common.rb | 45 +++++++++++++----------- features/step_definitions/users_steps.rb | 2 +- features/step_definitions/web.rb | 18 ++++++---- features/tip_modifier_interface.feature | 10 +++--- features/view_tips.feature | 4 +-- 9 files changed, 80 insertions(+), 41 deletions(-) create mode 100644 features/developer-opt-in.feature diff --git a/app/models/project.rb b/app/models/project.rb index 82bd3ebb..728fe7d1 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -129,9 +129,7 @@ def tip_commits def tip_for commit if (next_tip_amount > 0) && !Tip.exists?(commit: commit.sha) - - user = User.find_by_commit(commit) - return unless user + return unless (user = User.find_by_commit commit) user.update(nickname: commit.author.login) if commit.author.try(:login) diff --git a/config/application.rb b/config/application.rb index db09dd01..10122413 100644 --- a/config/application.rb +++ b/config/application.rb @@ -12,10 +12,10 @@ # define default blockchain urls merchant_url = "https://blockchain.info/merchant" transfer_url = "https://blockchain.info/tx" -guid = CONFIG["blockchain_info"]["guid"] +guid = CONFIG["blockchain_info"]["guid"] CONFIG["blockchain_info"]["merchant_url"] = merchant_url CONFIG["blockchain_info"]["transfer_url"] = transfer_url -CONFIG["blockchain_info"]["new_url"] = "#{merchant_url}/#{guid}/new_address" +CONFIG["blockchain_info"]["new_url"] = "#{merchant_url}/#{guid}/new_address" CONFIG["blockchain_info"]["sendmany_url"] = "#{merchant_url}/#{guid}/sendmany" diff --git a/features/developer-opt-in.feature b/features/developer-opt-in.feature new file mode 100644 index 00000000..f02eec1c --- /dev/null +++ b/features/developer-opt-in.feature @@ -0,0 +1,33 @@ +Feature: Developers may sign-up to receive tip offers + Background: + Given a "github" project named "seldon/seldons-project" exists + And a user named "yugo" exists with a bitcoin address + And our fee is "0" + And a deposit of "500" is made + And the most recent commit is "AAA" + And a new commit "BBB" is made with parent "AAA" + And a new commit "CCC" is made with parent "BBB" + And the author of commit "BBB" is "yugo" + And the author of commit "CCC" is "gaal" + + Scenario: A commit is merged from an known developer + When the project syncs with the remote repo + Then there should be a tip of "5" for commit "BBB" + And there should be 0 email sent + + Scenario: A commit is merged from an unknown developer + When the project syncs with the remote repo + Then there should be no tip for commit "CCC" + And there should be 0 email sent + + Scenario: A developer signs-up to receive tip offers + When the project syncs with the remote repo + Then there should be no tip for commit "CCC" + And there should be 0 email sent + + When I sign in as "gaal" + And a new commit "DDD" is made by a user named "gaal" + When the project syncs with the remote repo + Then there should be a tip of "4.95" for commit "CCC" + Then there should be a tip of "4.9005" for commit "DDD" + And there should be 0 email sent diff --git a/features/sign_up_sign_in.feature b/features/sign_up_sign_in.feature index 62dabb8f..422134ac 100644 --- a/features/sign_up_sign_in.feature +++ b/features/sign_up_sign_in.feature @@ -23,7 +23,6 @@ Feature: Visitors should be able to sign_up and sign_in | "seldon/seldons-project github-project tips" | | "seldon/seldons-project github-project deposits" | - Scenario: Visitors should see sign_up but not sign_in links on sign_in page Given I'm not logged in When I visit the "sign_in" page diff --git a/features/step_definitions/common.rb b/features/step_definitions/common.rb index 426f4104..b52971ad 100644 --- a/features/step_definitions/common.rb +++ b/features/step_definitions/common.rb @@ -66,7 +66,7 @@ def service_do service , method_dict Deposit.create!(project: @current_project, amount: deposit.to_d * 1e8, confirmations: 2) end -def add_new_commit commit_id , author , params = {} +def add_new_commit commit_id , nickname , params = {} raise "duplicate commit_id" if (find_new_commit commit_id).present? defaults = { @@ -74,7 +74,7 @@ def add_new_commit commit_id , author , params = {} commit: { message: "Some changes", author: { - email: "#{author}@example.com", + email: "#{nickname}@example.com", }, }, } @@ -93,44 +93,49 @@ def find_new_commit commit_id nil end -Given(/^a new commit "([^"]*?)" is made$/) do |arg1| - add_new_commit arg1 , "anonymous" +Given(/^a new commit "([^"]*?)" is made by a user named "(.*?)"$/) do |commit_id , nickname| + add_new_commit commit_id , nickname end -Given(/^(\d+) new commit.? (?:is|are) made by a user named "(.*?)"$/) do |n_commits , author| +Given(/^(\d+) new commit.? (?:is|are) made by a user named "(.*?)"$/) do |n_commits , nickname| n_commits.to_i.times do - add_new_commit Digest::SHA1.hexdigest(SecureRandom.hex) , author + add_new_commit Digest::SHA1.hexdigest(SecureRandom.hex) , nickname end end -Given(/^a new commit "(.*?)" with parent "([^"]*?)"$/) do |arg1, arg2| - add_new_commit arg1 , "anonymous" , parents: [{sha: arg2}] +Given(/^a new commit "([^"]*?)" is made$/) do |commit_id| + add_new_commit commit_id , "unknown-user" end -Given(/^a new commit "(.*?)" with parent "(.*?)" and "(.*?)"$/) do |arg1, arg2, arg3| - add_new_commit arg1 , "anonymous" , { parents: [{sha: arg2}, {sha: arg3}], commit: {message: "Merge #{arg2} and #{arg3}"} } +Given(/^a new commit "(.*?)" is made with parent "([^"]*?)"$/) do |commit_id, parent_commit_id| + add_new_commit commit_id , "unknown-user" , parents: [{sha: parent_commit_id}] end -Given(/^the author of commit "(.*?)" is "(.*?)"$/) do |arg1, arg2| - commit = find_new_commit(arg1) +Given(/^a new commit "(.*?)" is made with parent "(.*?)" and "(.*?)"$/) do |commit_id, parentA_commit_id, parentB_commit_id| + params = { parents: [{sha: parentA_commit_id}, {sha: parentB_commit_id}], commit: {message: "Merge #{parentA_commit_id} and #{parentB_commit_id}"} } + add_new_commit commit_id , "unknown-user" , params +end + +Given(/^the author of commit "(.*?)" is "(.*?)"$/) do |commit_id , nickname| + commit = find_new_commit commit_id raise "no such commit" if commit.nil? - commit.deep_merge!(author: {login: arg2}, commit: {author: {email: "#{arg2}@example.com"}}) + commit.deep_merge!(author: {login: nickname}, commit: {author: {email: "#{nickname}@example.com"}}) end -Given(/^the message of commit "(.*?)" is "(.*?)"$/) do |arg1, arg2| - commit = find_new_commit(arg1) +Given(/^the message of commit "(.*?)" is "(.*?)"$/) do |commit_id , commit_msg| + commit = find_new_commit commit_id raise "no such commit" if commit.nil? - commit.deep_merge!(commit: {message: arg2}) + commit.deep_merge!(commit: {message: commit_msg}) end -Given(/^the most recent commit is "(.*?)"$/) do |commit| - @current_project.update!(last_commit: commit) +Given(/^the most recent commit is "(.*?)"$/) do |commit_id| + @current_project.update! last_commit: commit_id end -Then(/^the most recent commit should be "(.*?)"$/) do |arg1| - @current_project.reload.last_commit.should eq(arg1) +Then(/^the most recent commit should be "(.*?)"$/) do |commit_id| + @current_project.reload.last_commit.should eq commit_id end When(/^the new commits are loaded$/) do diff --git a/features/step_definitions/users_steps.rb b/features/step_definitions/users_steps.rb index ff9576b2..118a869a 100644 --- a/features/step_definitions/users_steps.rb +++ b/features/step_definitions/users_steps.rb @@ -11,5 +11,5 @@ def create_user nickname , has_bitcoiin_address end Given /^a user named "(.*?)" exists (with|without?) a bitcoin address$/ do |nickname , with| - (@users ||= {})[nickname] = (create_user nickname , (with.eql? 'with')) + (@users ||= {})[nickname] ||= (create_user nickname , (with.eql? 'with')) end diff --git a/features/step_definitions/web.rb b/features/step_definitions/web.rb index c9138ad6..5eec7462 100644 --- a/features/step_definitions/web.rb +++ b/features/step_definitions/web.rb @@ -1,21 +1,23 @@ -Given(/^I'm logged in as "(.*?)"$/) do |arg1| - email = "#{arg1.parameterize}@example.com" +Given /^I'm signed in as "(.*?)"$/ do |nickname| + email = "#{nickname.parameterize}@example.com" OmniAuth.config.test_mode = true OmniAuth.config.mock_auth[:github] = { "info" => { - "nickname" => arg1, - "primary_email" => email, - "verified_emails" => [email], + "nickname" => nickname , + "primary_email" => email , + "verified_emails" => [email] , }, }.to_ostruct visit root_path first(:link, "Sign in").click click_on "Sign in with Github" page.should have_content("Successfully authenticated") + + step "a user named \"#{nickname}\" exists without a bitcoin address" end -Given(/^I log out$/) do +Given /^I'm not signed in$/ do visit root_path if page.has_content?("Sign out") click_on "Sign out" @@ -25,7 +27,9 @@ end end -Given(/^I'm not logged in$/) { step "I log out" } +Given (/^I sign in as "(.*?)"$/) { |nickname| step "I'm signed in as \"#{nickname}\"" } + +Given (/^I sign out$/) { step "I sign out" } def parse_path_from_page_string page_string path = nil diff --git a/features/tip_modifier_interface.feature b/features/tip_modifier_interface.feature index d246a561..74f95041 100644 --- a/features/tip_modifier_interface.feature +++ b/features/tip_modifier_interface.feature @@ -9,8 +9,8 @@ Feature: A project collaborator can change the tips of commits And our fee is "0" And a deposit of "500" is made And the most recent commit is "AAA" - And a new commit "BBB" with parent "AAA" - And a new commit "CCC" with parent "BBB" + And a new commit "BBB" with parent "AAA" is made + And a new commit "CCC" with parent "BBB" is made And the author of commit "BBB" is "yugo" And the author of commit "CCC" is "gaal" @@ -32,13 +32,13 @@ Feature: A project collaborator can change the tips of commits Then I should be on the "seldon/seldons-project github-project" page And I should see "The project settings have been updated" - When a new commit "DDD" with parent "CCC" + When a new commit "DDD" with parent "CCC" is made And the author of commit "DDD" is "yugo" And the message of commit "DDD" is "yugo's trivial commit DDD" - And a new commit "EEE" with parent "DDD" + And a new commit "EEE" with parent "DDD" is made And the author of commit "EEE" is "gaal" And the message of commit "EEE" is "gaal's tiny commit EEE" - When a new commit "FFF" with parent "EEE" + When a new commit "FFF" with parent "EEE" is made And the author of commit "FFF" is "newguy" And the message of commit "FFF" is "newguy's unrewarded commit EEE" When the project syncs with the remote repo diff --git a/features/view_tips.feature b/features/view_tips.feature index 13cf84e7..26d93252 100644 --- a/features/view_tips.feature +++ b/features/view_tips.feature @@ -6,8 +6,8 @@ Feature: Visitors should be able to see claimed tips And our fee is "0" And a deposit of "500" is made And the most recent commit is "AAA" - And a new commit "BBB" with parent "AAA" - And a new commit "CCC" with parent "BBB" + And a new commit "BBB" with parent "AAA" is made + And a new commit "CCC" with parent "BBB" is made And the author of commit "BBB" is "yugo" And the author of commit "CCC" is "gaal" When the project syncs with the remote repo From fa25d715e255f16ddd9f9396ca4bebf0284754dd Mon Sep 17 00:00:00 2001 From: Maciej Pasternacki Date: Tue, 4 Nov 2014 14:50:29 +0100 Subject: [PATCH 114/415] Blacklist my personal (mpasternacki) and my organization's (3ofcoins) repos --- config/blacklist.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/blacklist.yml b/config/blacklist.yml index d3dbe16c..7f289578 100644 --- a/config/blacklist.yml +++ b/config/blacklist.yml @@ -27,4 +27,6 @@ - https://github.com/joomla-extensions/* - https://github.com/joomla-projects/* - https://github.com/ForumPostAssistant/FPA -- https://github.com/ipython/* \ No newline at end of file +- https://github.com/ipython/* +- https://github.com/mpasternacki/* +- https://github.com/3ofcoins/* From 9d45fd456ba2798c09e5e519790cff95a0e2dfd0 Mon Sep 17 00:00:00 2001 From: nalesnikld Date: Tue, 4 Nov 2014 17:07:32 +0100 Subject: [PATCH 115/415] fixed polish translation --- config/locales/pl.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/config/locales/pl.yml b/config/locales/pl.yml index ee9dda71..246e8eda 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -12,7 +12,7 @@ pl: support_link: wsparcie follow_link: Obserwuj @tip4commit links: - sign_up: Sign up + sign_up: Rejestracja sign_in: Zaloguj się sign_in_imp: zaloguj się sign_out: Wyloguj się @@ -140,7 +140,7 @@ pl: undecided: Rozmiar napiwku nie został jeszcze określony no_bitcoin_address: Użytkownik nie sprecyzował adresu do wypłaty below_threshold: "Saldo użytkownika jest poniżej wymaganego do wypłaty" - waiting: Oczekiwanie na wypłate + waiting: Oczekiwanie na wypłatę error: (błąd w wysyłaniu transakcji) deposits: index: @@ -156,7 +156,7 @@ pl: users: index: title: Najlepsi kontrybutorzy - name: Imie + name: Imię commits_count: Opłacone "commity" withdrawn: Wypłacone show: @@ -165,7 +165,7 @@ pl: see_all: zobacz wszystko received: "%{time} otrzymano %{amount} za commit %{commit} w %{project}" bitcoin_address_placeholder: Twój adres bitcoin - notify: Notify me about new tips (no more than one email per month) + notify: Informuj mnie o nowych napiwkach (nie więcej niż jeden email na miesiąc) submit_user: Zaktualizuj dane użytkownika change_password: Zmień Twoje hasło submit_password: Zmień moje hasło @@ -211,7 +211,7 @@ pl: attributes: user: email: E-mail - bitcoin_address: AAdres Bitcoin + bitcoin_address: Adres Bitcoin password: Hasło password_confirmation: Potwierdzenie hasła display_name: Wyświetlana nazwa From 9afa8147b7f29325777816bf625dcb6b98308ff9 Mon Sep 17 00:00:00 2001 From: bill auger Date: Tue, 4 Nov 2014 20:07:51 +0000 Subject: [PATCH 116/415] implement friendly user urls and more friendly project urls * routed Project#tips and Project#deposits to Tips#index and Deposits#index * added ProjectsHelper#pretty_project_tips_path * added ProjectsHelper#pretty_project_deposits_path * added friendly routes for User#show and User#tips * refactored ProjectsController#load_project into ApplicationController method to be shared with TipsController and DepositsController --- app/controllers/application_controller.rb | 27 ++++++-- app/controllers/deposits_controller.rb | 10 +-- app/controllers/projects_controller.rb | 45 ++++++------- app/controllers/tips_controller.rb | 20 ++---- app/helpers/projects_helper.rb | 8 +++ app/models/project.rb | 6 +- app/models/sendmany.rb | 30 ++++----- app/views/withdrawals/index.html.haml | 2 +- config/application.rb | 1 + config/routes.rb | 79 +++++------------------ 10 files changed, 94 insertions(+), 134 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d87ef354..04bf89af 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -22,13 +22,28 @@ def load_locale end end - def load_project(project) - if project.is_a? Project - @project = project - else - @project = Project.where(id: project).first + def load_project params + (is_project = self.is_a? ProjectsController) || + (is_tips = self.is_a? TipsController ) || + (is_deposits = self.is_a? DepositsController) + + if params[:project_id].present? || params[:id].present? + return unless project_id = (is_project && params[:id]) || + ((is_tips || is_deposits) && params[:project_id]) + + @project = Project.where(:id => project_id).first + + if is_tips + redirect_to project_tips_pretty_path @project.host , @project.full_name + elsif is_deposits + redirect_to project_deposits_pretty_path @project.host , @project.full_name + end + elsif params[:service].present? && params[:repo].present? + @project = Project.where(host: params[:service]). + where('lower(`full_name`) = ?' , params[:repo].downcase).first end - unless @project + + if @project.nil? && is_project flash[:error] = I18n.t('errors.project_not_found') redirect_to projects_path end diff --git a/app/controllers/deposits_controller.rb b/app/controllers/deposits_controller.rb index 67a2b25c..b0b15d93 100644 --- a/app/controllers/deposits_controller.rb +++ b/app/controllers/deposits_controller.rb @@ -1,8 +1,8 @@ class DepositsController < ApplicationController - before_action :load_project + before_action { load_project params } def index - if params[:project_id] + if @project @deposits = @project.deposits else @deposits = Deposit.includes(:project) @@ -15,10 +15,4 @@ def index format.csv { render csv: @deposits, except: [:updated_at, :confirmations, :fee_size], add_methods: [:project_name, :fee, :confirmed?] } end end - - private - - def load_project - super(params[:project_id]) if params[:project_id].present? - end end diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 1a8e95b9..8f63fcfa 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -3,8 +3,9 @@ class ProjectsController < ApplicationController include ProjectsHelper - before_filter :load_project, only: [:show, :edit, :decide_tip_amounts, :update] - before_filter :redirect_to_pretty_url, only: [:show, :edit, :decide_tip_amounts] + before_filter :load_project, only: [:show, :edit, :update, :decide_tip_amounts] + before_filter :redirect_to_pretty_url, only: [:show, :edit, :decide_tip_amounts, + :tips, :deposits] def index @projects = Project.order(projects_order).page(params[:page]).per(30) @@ -13,21 +14,19 @@ def index def search if params[:query].present? if BLACKLIST.include?(params[:query]) - return render :blacklisted + render :blacklisted and return + elsif project = Project.find_or_create_by_url(params[:query]) + redirect_to pretty_project_path(project) and return end - - if project = Project.find_or_create_by_url(params[:query]) - redirect_to pretty_project_path(project) - else - @projects = Project.search(params[:query].to_s).order(projects_order).page(params[:page]).per(30) - render :index - end - else - redirect_to projects_path end + + @projects = Project.search(params[:query].to_s).order(projects_order).page(params[:page]).per(30) + render :index end def show + render :blacklisted and return if BLACKLIST.include? @project.github_url + @project.update_bitcoin_address if @project.bitcoin_address.nil? @project_tips = @project.tips.with_address @@ -73,18 +72,10 @@ def decide_tip_amounts end end + private - def load_project - if params[:id].present? - super(params[:id]) - elsif params[:service].present? && params[:repo].present? - super( - Project.where(host: params[:service]). - where('lower(`full_name`) = ?', params[:repo].downcase).first - ) - end - end + def load_project ; super params ; end ; def project_params params.require(:project).permit(:branch, :disable_notifications, :hold_tips, tipping_policies_text_attributes: [:text]) @@ -106,11 +97,15 @@ def redirect_to_pretty_url respond_to do |format| case action_name when 'show' - path = pretty_project_path(@project) + path = pretty_project_path @project when 'edit' - path = pretty_project_edit_path(@project) + path = pretty_project_edit_path @project when 'decide_tip_amounts' - path = pretty_project_decide_tip_amounts_path(@project) + path = pretty_project_decide_tip_amounts_path @project + when 'tips' + path = pretty_project_tips_path @project + when 'deposits' + path = pretty_project_deposits_path @project end format.html { redirect_to path } end diff --git a/app/controllers/tips_controller.rb b/app/controllers/tips_controller.rb index 3a0185bf..46c52463 100644 --- a/app/controllers/tips_controller.rb +++ b/app/controllers/tips_controller.rb @@ -1,17 +1,17 @@ class TipsController < ApplicationController - - before_action :load_project + before_filter { load_project params } def index - if params[:project_id] + if @project @tips = @project.tips.includes(:user).with_address - elsif params[:user_id] && @user = User.find(params[:user_id]) - if @user.nil? || @user.bitcoin_address.blank? + elsif params[:user_id] + @user = User.find params[:user_id] + if @user.present? && @user.bitcoin_address.present? + @tips = @user.tips.includes(:project) + else flash[:error] = I18n.t('errors.user_not_found') redirect_to users_path and return end - - @tips = @user.tips.includes(:project) else @tips = Tip.with_address.includes(:project) end @@ -23,10 +23,4 @@ def index format.csv { render csv: @tips, except: [:updated_at, :commit, :commit_message, :refunded_at, :decided_at], add_methods: [:user_name, :project_name, :decided?, :claimed?, :paid?, :refunded?, :txid] } end end - - private - - def load_project - super(params[:project_id]) if params[:project_id].present? - end end diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 5911ecd9..7d0376fd 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -30,6 +30,14 @@ def pretty_project_decide_tip_amounts_path project "#{pretty_project_path project}/decide_tip_amounts" end + def pretty_project_tips_path project + "#{pretty_project_path project}/tips" + end + + def pretty_project_deposits_path project + "#{pretty_project_path project}/deposits" + end + def pretty_project_url project root_url.gsub(/\/$/,'') + pretty_project_path(project) end diff --git a/app/models/project.rb b/app/models/project.rb index 3b305c86..728fe7d1 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -20,7 +20,7 @@ class Project < ActiveRecord::Base # before_save :check_tips_to_pay_against_avaiable_amount def update_bitcoin_address - blockchain_uri = URI CONFIG["blockchain_info"]["new_url"] + blockchain_uri = URI CONFIG["blockchain_info"]["new_url"] blockchain_pass = CONFIG["blockchain_info"]["password"] blockchain_label = "#{self.full_name}@tip4commit" blockchain_params = { password: blockchain_pass, label: blockchain_label } @@ -129,9 +129,7 @@ def tip_commits def tip_for commit if (next_tip_amount > 0) && !Tip.exists?(commit: commit.sha) - - user = User.find_by_commit(commit) - return unless user + return unless (user = User.find_by_commit commit) user.update(nickname: commit.author.login) if commit.author.try(:login) diff --git a/app/models/sendmany.rb b/app/models/sendmany.rb index 169a5fd4..63be4035 100644 --- a/app/models/sendmany.rb +++ b/app/models/sendmany.rb @@ -8,21 +8,21 @@ def total_amount def send_transaction return if txid || is_error - update_attribute :is_error, true # it's a lock to prevent duplicates + update_attribute :is_error, true # it's a lock to prevent duplicates - uri = URI CONFIG["blockchain_info"]["sendmany_url"] - params = { password: CONFIG["blockchain_info"]["password"], recipients: data } - uri.query = URI.encode_www_form(params) - res = Net::HTTP.get_response(uri) - if res.is_a?(Net::HTTPSuccess) && (json = JSON.parse(res.body)) - Rails.logger.info res.body - update_attribute :result, json - if !(txid = json["tx_hash"]).blank? - update_attribute :is_error, false - update_attribute :txid, json["tx_hash"] - end - else - Rails.logger.error "Failed to get correct response from blockchain.info" + uri = URI CONFIG["blockchain_info"]["sendmany_url"] + params = { password: CONFIG["blockchain_info"]["password"], recipients: data } + uri.query = URI.encode_www_form(params) + res = Net::HTTP.get_response(uri) + if res.is_a?(Net::HTTPSuccess) && (json = JSON.parse(res.body)) + Rails.logger.info res.body + update_attribute :result, json + if !(txid = json["tx_hash"]).blank? + update_attribute :is_error, false + update_attribute :txid, json["tx_hash"] end - end + else + Rails.logger.error "Failed to get correct response from blockchain.info" + end + end end diff --git a/app/views/withdrawals/index.html.haml b/app/views/withdrawals/index.html.haml index 4b3e2c24..00b2c671 100644 --- a/app/views/withdrawals/index.html.haml +++ b/app/views/withdrawals/index.html.haml @@ -10,5 +10,5 @@ - @sendmanies.each do |sendmany| %tr %td= l(sendmany.created_at, format: :short) - %td= link_to(sendmany.txid, "#{CONFIG["blockchain_info"]["transfer_url"]}/#{sendmany.txid}", target: '_blank') + %td= link_to sendmany.txid, "#{CONFIG["blockchain_info"]["transfer_url"]}/#{sendmany.txid}", target: '_blank' %td= sendmany.is_error ? t('.error') : t('.success') diff --git a/config/application.rb b/config/application.rb index 48be945c..10122413 100644 --- a/config/application.rb +++ b/config/application.rb @@ -8,6 +8,7 @@ # load config.yaml preprocessed CONFIG ||= YAML::load(ERB.new(File.read("config/config.yml")).result) + # define default blockchain urls merchant_url = "https://blockchain.info/merchant" transfer_url = "https://blockchain.info/tx" diff --git a/config/routes.rb b/config/routes.rb index 0f2cbaee..7c32ee7b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,14 +4,21 @@ get '/blockchain_info_callback' => "home#blockchain_info_callback", :as => "blockchain_info_callback" - get '/:service/:repo/:action' => 'projects#edit', :constraints => {:service => /github/, :repo => /.+/, :action => /edit/} - get '/:service/:repo/:action' => 'projects#decide_tip_amounts', :constraints => {:service => /github/, :repo => /.+/, :action => /decide_tip_amounts/} - get '/:service/:repo' => 'projects#show', :constraints => {:service => /github/, :repo => /.+/} + # reserved devise routes (rejected pertty url usernames) + RESERVED_USER_ROUTES_REGEX = /(^(?:(?!^\d+$|\b(sign_in|cancel|sign_up|edit|confirmation|login)\b).)*$)/ + get '/users/:name/tips' => 'tips#index', :constraints => {:name => /\RESERVED_USER_ROUTES_REGEX/} + get '/users/:name' => 'users#show', :constraints => {:name => /\RESERVED_USER_ROUTES_REGEX/} + + get '/projects/:project_id/tips' => 'tips#index', :constraints => {:project_id => /\d+/}, :as => 'project_tips' + get '/projects/:project_id/deposits' => 'deposits#index', :constraints => {:project_id => /\d+/}, :as => 'project_deposits' + get '/:service/:repo/edit' => 'projects#edit', :constraints => {:service => /github/, :repo => /.+/} + get '/:service/:repo/decide_tip_amounts' => 'projects#decide_tip_amounts', :constraints => {:service => /github/, :repo => /.+/} + get '/:service/:repo/tips' => 'tips#index', :constraints => {:service => /github/, :repo => /.+/}, :as => 'project_tips_pretty' + get '/:service/:repo/deposits' => 'deposits#index', :constraints => {:service => /github/, :repo => /.+/}, :as => 'project_deposits_pretty' + get '/:service/:repo' => 'projects#show', :constraints => {:service => /github/, :repo => /.+/} devise_for :users, - :controllers => { - :omniauth_callbacks => "users/omniauth_callbacks" - } + :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" } resources :users, :only => [:show, :update, :index] do collection do @@ -24,65 +31,13 @@ get 'search' end member do - get :decide_tip_amounts + get :decide_tip_amounts patch :decide_tip_amounts end - resources :tips, :only => [:index] - resources :deposits, :only => [:index] end - resources :tips, :only => [:index] - resources :deposits, :only => [:index] + resources :tips, :only => [:index] + resources :deposits, :only => [:index] resources :withdrawals, :only => [:index] - # The priority is based upon order of creation: first created -> highest priority. - # See how all your routes lay out with "rake routes". - - # Example of regular route: - # get 'products/:id' => 'catalog#view' - - # Example of named route that can be invoked with purchase_url(id: product.id) - # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase - - # Example resource route (maps HTTP verbs to controller actions automatically): - # resources :products - - # Example resource route with options: - # resources :products do - # member do - # get 'short' - # post 'toggle' - # end - # - # collection do - # get 'sold' - # end - # end - - # Example resource route with sub-resources: - # resources :products do - # resources :comments, :sales - # resource :seller - # end - - # Example resource route with more complex sub-resources: - # resources :products do - # resources :comments - # resources :sales do - # get 'recent', on: :collection - # end - # end - - # Example resource route with concerns: - # concern :toggleable do - # post 'toggle' - # end - # resources :posts, concerns: :toggleable - # resources :photos, concerns: :toggleable - - # Example resource route within a namespace: - # namespace :admin do - # # Directs /admin/products/* to Admin::ProductsController - # # (app/controllers/admin/products_controller.rb) - # resources :products - # end + get '*path' => 'home#index' end From 4172d9af50d0dccc812d91a105105392f6e028e2 Mon Sep 17 00:00:00 2001 From: bill auger Date: Tue, 4 Nov 2014 20:16:56 +0000 Subject: [PATCH 117/415] seperate test concerns by model * merge in the latest project-management branch PR #141 * seperated concerns out of features/step_definitions/common.rb into features/step_definitions/project_steps.rb features/step_definitions/tips_steps.rb features/step_definitions/user_steps.rb * merged features/step_definitions/web.rb into features/step_definitions/common.rb * merged features/step_definitions/tip_modifier_interface.rb into features/step_definitions/tips_steps.rb --- app/controllers/application_controller.rb | 27 +- app/controllers/deposits_controller.rb | 10 +- app/controllers/projects_controller.rb | 24 +- app/controllers/tips_controller.rb | 15 +- app/helpers/projects_helper.rb | 8 + config/routes.rb | 82 +----- features/find_or_create_project.feature | 14 +- features/manage_project.feature | 8 +- features/pretty_paths.feature | 45 ++++ features/sign_up_sign_in.feature | 8 +- features/step_definitions/common.rb | 241 +++++++----------- features/step_definitions/project_steps.rb | 56 ++++ .../tip_modifier_interface.rb | 79 ------ features/step_definitions/tips_steps.rb | 195 ++++++++++++++ features/step_definitions/web.rb | 107 -------- features/tip_modifier_interface.feature | 28 +- features/tipping_policies.feature | 4 +- features/view_tips.feature | 6 +- spec/controllers/users_controller_spec.rb | 24 +- 19 files changed, 495 insertions(+), 486 deletions(-) create mode 100644 features/pretty_paths.feature delete mode 100644 features/step_definitions/tip_modifier_interface.rb create mode 100644 features/step_definitions/tips_steps.rb delete mode 100644 features/step_definitions/web.rb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d87ef354..04bf89af 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -22,13 +22,28 @@ def load_locale end end - def load_project(project) - if project.is_a? Project - @project = project - else - @project = Project.where(id: project).first + def load_project params + (is_project = self.is_a? ProjectsController) || + (is_tips = self.is_a? TipsController ) || + (is_deposits = self.is_a? DepositsController) + + if params[:project_id].present? || params[:id].present? + return unless project_id = (is_project && params[:id]) || + ((is_tips || is_deposits) && params[:project_id]) + + @project = Project.where(:id => project_id).first + + if is_tips + redirect_to project_tips_pretty_path @project.host , @project.full_name + elsif is_deposits + redirect_to project_deposits_pretty_path @project.host , @project.full_name + end + elsif params[:service].present? && params[:repo].present? + @project = Project.where(host: params[:service]). + where('lower(`full_name`) = ?' , params[:repo].downcase).first end - unless @project + + if @project.nil? && is_project flash[:error] = I18n.t('errors.project_not_found') redirect_to projects_path end diff --git a/app/controllers/deposits_controller.rb b/app/controllers/deposits_controller.rb index 67a2b25c..b0b15d93 100644 --- a/app/controllers/deposits_controller.rb +++ b/app/controllers/deposits_controller.rb @@ -1,8 +1,8 @@ class DepositsController < ApplicationController - before_action :load_project + before_action { load_project params } def index - if params[:project_id] + if @project @deposits = @project.deposits else @deposits = Deposit.includes(:project) @@ -15,10 +15,4 @@ def index format.csv { render csv: @deposits, except: [:updated_at, :confirmations, :fee_size], add_methods: [:project_name, :fee, :confirmed?] } end end - - private - - def load_project - super(params[:project_id]) if params[:project_id].present? - end end diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index e0d7b219..8f63fcfa 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -4,7 +4,8 @@ class ProjectsController < ApplicationController include ProjectsHelper before_filter :load_project, only: [:show, :edit, :update, :decide_tip_amounts] - before_filter :redirect_to_pretty_url, only: [:show, :edit, :decide_tip_amounts] + before_filter :redirect_to_pretty_url, only: [:show, :edit, :decide_tip_amounts, + :tips, :deposits] def index @projects = Project.order(projects_order).page(params[:page]).per(30) @@ -74,16 +75,7 @@ def decide_tip_amounts private - def load_project - if params[:id].present? - super(params[:id]) - elsif params[:service].present? && params[:repo].present? - super( - Project.where(host: params[:service]). - where('lower(`full_name`) = ?', params[:repo].downcase).first - ) - end - end + def load_project ; super params ; end ; def project_params params.require(:project).permit(:branch, :disable_notifications, :hold_tips, tipping_policies_text_attributes: [:text]) @@ -105,11 +97,15 @@ def redirect_to_pretty_url respond_to do |format| case action_name when 'show' - path = pretty_project_path(@project) + path = pretty_project_path @project when 'edit' - path = pretty_project_edit_path(@project) + path = pretty_project_edit_path @project when 'decide_tip_amounts' - path = pretty_project_decide_tip_amounts_path(@project) + path = pretty_project_decide_tip_amounts_path @project + when 'tips' + path = pretty_project_tips_path @project + when 'deposits' + path = pretty_project_deposits_path @project end format.html { redirect_to path } end diff --git a/app/controllers/tips_controller.rb b/app/controllers/tips_controller.rb index 08d8fd35..46c52463 100644 --- a/app/controllers/tips_controller.rb +++ b/app/controllers/tips_controller.rb @@ -1,6 +1,5 @@ class TipsController < ApplicationController - - before_action :load_project + before_filter { load_project params } def index if @project @@ -24,16 +23,4 @@ def index format.csv { render csv: @tips, except: [:updated_at, :commit, :commit_message, :refunded_at, :decided_at], add_methods: [:user_name, :project_name, :decided?, :claimed?, :paid?, :refunded?, :txid] } end end - - - private - - def load_project - if params[:project_id].present? - super params[:project_id] - elsif params[:service].present? && params[:repo].present? - super Project.where(host: params[:service]). - where('lower(`full_name`) = ?' , params[:repo].downcase).first - end - end end diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 5911ecd9..7d0376fd 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -30,6 +30,14 @@ def pretty_project_decide_tip_amounts_path project "#{pretty_project_path project}/decide_tip_amounts" end + def pretty_project_tips_path project + "#{pretty_project_path project}/tips" + end + + def pretty_project_deposits_path project + "#{pretty_project_path project}/deposits" + end + def pretty_project_url project root_url.gsub(/\/$/,'') + pretty_project_path(project) end diff --git a/config/routes.rb b/config/routes.rb index a75c653e..7c32ee7b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,21 +4,21 @@ get '/blockchain_info_callback' => "home#blockchain_info_callback", :as => "blockchain_info_callback" - # reserved routes (rejected pertty url usernames) + # reserved devise routes (rejected pertty url usernames) RESERVED_USER_ROUTES_REGEX = /(^(?:(?!^\d+$|\b(sign_in|cancel|sign_up|edit|confirmation|login)\b).)*$)/ - get '/users/:name/tips' => 'tips#index', :constraints => {:name => /\RESERVED_USER_ROUTES_REGEX/} - get '/users/:name' => 'users#show', :constraints => {:name => /\RESERVED_USER_ROUTES_REGEX/} + get '/users/:name/tips' => 'tips#index', :constraints => {:name => /\RESERVED_USER_ROUTES_REGEX/} + get '/users/:name' => 'users#show', :constraints => {:name => /\RESERVED_USER_ROUTES_REGEX/} - get '/:service/:repo/edit' => 'projects#edit', :constraints => {:service => /github/, :repo => /.+/} - get '/:service/:repo/decide_tip_amounts' => 'projects#decide_tip_amounts', :constraints => {:service => /github/, :repo => /.+/} - get '/:service/:repo/tips' => 'tips#index', :constraints => {:service => /github/, :repo => /.+/} - get '/:service/:repo/deposits' => 'deposits#index', :constraints => {:service => /github/, :repo => /.+/} - get '/:service/:repo' => 'projects#show', :constraints => {:service => /github/, :repo => /.+/} + get '/projects/:project_id/tips' => 'tips#index', :constraints => {:project_id => /\d+/}, :as => 'project_tips' + get '/projects/:project_id/deposits' => 'deposits#index', :constraints => {:project_id => /\d+/}, :as => 'project_deposits' + get '/:service/:repo/edit' => 'projects#edit', :constraints => {:service => /github/, :repo => /.+/} + get '/:service/:repo/decide_tip_amounts' => 'projects#decide_tip_amounts', :constraints => {:service => /github/, :repo => /.+/} + get '/:service/:repo/tips' => 'tips#index', :constraints => {:service => /github/, :repo => /.+/}, :as => 'project_tips_pretty' + get '/:service/:repo/deposits' => 'deposits#index', :constraints => {:service => /github/, :repo => /.+/}, :as => 'project_deposits_pretty' + get '/:service/:repo' => 'projects#show', :constraints => {:service => /github/, :repo => /.+/} devise_for :users, - :controllers => { - :omniauth_callbacks => "users/omniauth_callbacks" - } + :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" } resources :users, :only => [:show, :update, :index] do collection do @@ -31,67 +31,13 @@ get 'search' end member do - get :decide_tip_amounts + get :decide_tip_amounts patch :decide_tip_amounts end - resources :tips, :only => [:index] - resources :deposits, :only => [:index] end - resources :tips, :only => [:index] - resources :deposits, :only => [:index] + resources :tips, :only => [:index] + resources :deposits, :only => [:index] resources :withdrawals, :only => [:index] - # The priority is based upon order of creation: first created -> highest priority. - # See how all your routes lay out with "rake routes". - - # Example of regular route: - # get 'products/:id' => 'catalog#view' - - # Example of named route that can be invoked with purchase_url(id: product.id) - # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase - - # Example resource route (maps HTTP verbs to controller actions automatically): - # resources :products - - # Example resource route with options: - # resources :products do - # member do - # get 'short' - # post 'toggle' - # end - # - # collection do - # get 'sold' - # end - # end - - # Example resource route with sub-resources: - # resources :products do - # resources :comments, :sales - # resource :seller - # end - - # Example resource route with more complex sub-resources: - # resources :products do - # resources :comments - # resources :sales do - # get 'recent', on: :collection - # end - # end - - # Example resource route with concerns: - # concern :toggleable do - # post 'toggle' - # end - # resources :posts, concerns: :toggleable - # resources :photos, concerns: :toggleable - - # Example resource route within a namespace: - # namespace :admin do - # # Directs /admin/products/* to Admin::ProductsController - # # (app/controllers/admin/products_controller.rb) - # resources :products - # end - get '*path' => 'home#index' end diff --git a/features/find_or_create_project.feature b/features/find_or_create_project.feature index 3a2dc850..bf77b2c5 100644 --- a/features/find_or_create_project.feature +++ b/features/find_or_create_project.feature @@ -3,7 +3,7 @@ Feature: Visitors may search for and add projects Given a "github" project named "seldon/seldons-project" exists Scenario: Visitors may find existing projects - Given I'm not logged in + Given I'm not signed in And I visit the "projects" page Then I should be on the "projects" page When I fill "query" with: "seldons-project" @@ -13,7 +13,7 @@ Feature: Visitors may search for and add projects But I should not see "project not found" Scenario: Visitors may not find non-existing projects - Given I'm not logged in + Given I'm not signed in And I visit the "projects" page Then I should be on the "projects" page When I fill "query" with: "no-such-repo" @@ -23,7 +23,7 @@ Feature: Visitors may search for and add projects But I should not see "seldon/seldons-project" Scenario: Visitors may add new projects - Given I'm not logged in + Given I'm not signed in And I visit the "projects" page Then I should be on the "projects" page When I fill "query" with: "https://github.com/tip4commit/tip4commit" @@ -33,7 +33,7 @@ Feature: Visitors may search for and add projects But I should not see "seldon/seldons-project" Scenario: Visitors may not add non-existing projects - Given I'm not logged in + Given I'm not signed in And I visit the "projects" page Then I should be on the "projects" page When I fill "query" with: "https://github.com/xxx-no-such-user-xxx/xxx-no-such-repo-xxx" @@ -44,7 +44,7 @@ Feature: Visitors may search for and add projects And I should not see "seldon/seldons-project" Scenario: Visitors may not add bogus projects - Given I'm not logged in + Given I'm not signed in And I visit the "projects" page Then I should be on the "projects" page When I fill "query" with: "https://shithub.com/nouser/norepo" @@ -55,7 +55,7 @@ Feature: Visitors may search for and add projects And I should not see "seldon/seldons-project" Scenario: Projects with individual owner should not show project avatar - Given I'm not logged in + Given I'm not signed in And I visit the "projects" page Then I should be on the "projects" page When I fill "query" with: "seldons-project" @@ -65,7 +65,7 @@ Feature: Visitors may search for and add projects And there should not be a project avatar image visible Scenario: Projects owned by an organization should show project avatar - Given I'm not logged in + Given I'm not signed in And I visit the "projects" page Then I should be on the "projects" page When I fill "query" with: "https://github.com/tip4commit/tip4commit" diff --git a/features/manage_project.feature b/features/manage_project.feature index 55f72f41..975e2f84 100644 --- a/features/manage_project.feature +++ b/features/manage_project.feature @@ -2,8 +2,8 @@ Feature: Collaborators may manage project Background: Given a "github" project named "seldon/seldons-project" exists - Scenario: Collaborators must be logged-in to manage project - Given I'm not logged in + Scenario: Collaborators must be signed in to manage project + Given I'm not signed in When I visit the "seldon/seldons-project github-project" page Then I should be on the "seldon/seldons-project github-project" page And I should see "seldon/seldons-project" @@ -20,7 +20,7 @@ Feature: Collaborators may manage project And I should not see "Decide tips" Scenario: Non-collaborators should not be able to manage project - Given I'm logged in as "someone-else" + Given I'm signed in as "someone-else" When I visit the "seldon/seldons-project github-project" page Then I should be on the "seldon/seldons-project github-project" page And I should see "seldon/seldons-project" @@ -37,7 +37,7 @@ Feature: Collaborators may manage project And I should not see "Decide tips" Scenario: New projects should show "Pending initial sync" - Given I'm logged in as "seldon" + Given I'm signed in as "seldon" When I visit the "seldon/seldons-project github-project" page Then I should be on the "seldon/seldons-project github-project" page And I should see "seldon/seldons-project" diff --git a/features/pretty_paths.feature b/features/pretty_paths.feature new file mode 100644 index 00000000..c7606fb4 --- /dev/null +++ b/features/pretty_paths.feature @@ -0,0 +1,45 @@ +Feature: The site routes pretty paths uniformly + Background: + Given a "github" project named "seldon/seldons-project" exists + And a user named "yugo" exists with a bitcoin address + + + Scenario: Project show page is accessible via pretty path + When I visit the "seldon/seldons-project github-project" page + Then I should be on the "seldon/seldons-project github-project" page + + Scenario: Project show page is accessible via id + When I browse to the explicit path "projects/1" + Then I should be on the "seldon/seldons-project github-project" page + + Scenario: Project edit page is accessible via pretty path + When I visit the "seldon/seldons-project github-project edit" page + Then I should be on the "seldon/seldons-project github-project edit" page + + Scenario: Project show page is accessible via id + When I browse to the explicit path "projects/1/edit" + Then I should be on the "seldon/seldons-project github-project edit" page + + Scenario: Project decide_tip_amounts page is accessible via pretty path + When I visit the "seldon/seldons-project github-project decide_tip_amounts" page + Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page + + Scenario: Project decide_tip_amounts page is accessible via id + When I browse to the explicit path "projects/1/decide_tip_amounts" + Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page + + Scenario: Project tips page is accessible via pretty path + When I visit the "seldon/seldons-project github-project tips" page + Then I should be on the "seldon/seldons-project github-project tips" page + + Scenario: Project tips page is accessible via id + When I browse to the explicit path "projects/1/tips" + Then I should be on the "seldon/seldons-project github-project tips" page + + Scenario: Project deposits page is accessible via pretty path + When I visit the "seldon/seldons-project github-project deposits" page + Then I should be on the "seldon/seldons-project github-project deposits" page + + Scenario: Project deposits page is accessible via id + When I browse to the explicit path "projects/1/deposits" + Then I should be on the "seldon/seldons-project github-project deposits" page diff --git a/features/sign_up_sign_in.feature b/features/sign_up_sign_in.feature index 422134ac..c88e6ead 100644 --- a/features/sign_up_sign_in.feature +++ b/features/sign_up_sign_in.feature @@ -5,7 +5,7 @@ Feature: Visitors should be able to sign_up and sign_in | seldon | Scenario Outline: Visitors should see sign_up and sign_in links on all pages - Given I'm not logged in + Given I'm not signed in When I visit the page Then I should be on the page And I should see "Sign up" in the header @@ -24,7 +24,7 @@ Feature: Visitors should be able to sign_up and sign_in | "seldon/seldons-project github-project deposits" | Scenario: Visitors should see sign_up but not sign_in links on sign_in page - Given I'm not logged in + Given I'm not signed in When I visit the "sign_in" page Then I should be on the "sign_in" page And I should see "Sign up" in the header @@ -32,7 +32,7 @@ Feature: Visitors should be able to sign_up and sign_in And I should not see "Sign out" in the header Scenario: Visitors should see sign_in but not sign_up links on sign_up page - Given I'm not logged in + Given I'm not signed in When I visit the "sign_up" page Then I should be on the "sign_up" page And I should not see "Sign up" in the header @@ -40,7 +40,7 @@ Feature: Visitors should be able to sign_up and sign_in And I should not see "Sign out" in the header Scenario Outline: Logged in users should see only sign_out link on every page - Given I'm logged in as "seldon" + Given I'm signed in as "seldon" When I visit the page Then I should be on the page And I should not see "Sign up" in the header diff --git a/features/step_definitions/common.rb b/features/step_definitions/common.rb index b52971ad..b349a73d 100644 --- a/features/step_definitions/common.rb +++ b/features/step_definitions/common.rb @@ -5,185 +5,122 @@ Project.any_instance.stub(:branches).and_return(%w(master)) end -Then(/^there should be (\d+) email sent$/) do |arg1| - ActionMailer::Base.deliveries.size.should eq(arg1.to_i) -end - -When(/^the email counters are reset$/) do - ActionMailer::Base.deliveries.clear -end - -Given(/^the tip percentage per commit is "(.*?)"$/) do |arg1| - CONFIG["tip"] = arg1.to_f -end - -Given(/^our fee is "(.*?)"$/) do |arg1| - CONFIG["our_fee"] = arg1.to_f -end - -def create_github_project project_name - if (@github_project_1.present? && (project_name.eql? @github_project_1.full_name)) || - (@github_project_2.present? && (project_name.eql? @github_project_2.full_name)) - raise "duplicate project_name '#{project_name}'" - elsif @github_project_3.present? - raise "the maximum of three test projects already exist" - end - -# @current_project is also assigned in the "considering the .. project named ..." step - @current_project = Project.create! :full_name => project_name , # e.g. "me/my-project" - :github_id => Digest::SHA1.hexdigest(project_name) , - :bitcoin_address => 'mq4NtnmQoQoPfNWEPbhSvxvncgtGo6L8WY' - if @github_project_2.present? ; @github_project_3 = @current_project ; - elsif @github_project_1.present? ; @github_project_2 = @current_project ; - else @github_project_1 = @current_project ; - end -end - -def create_bitbicket_project project_name - raise "unknown service" # nyi -end - -When /^regarding the "(.*?)" project named "(.*?)"$/ do |service , project_name| -# @current_project is also assigned in create_github_project and create_bitbucket_project - - @current_project = find_project service , project_name -end - -def service_do service , method_dict -=begin e.g. - service_do 'github' , {'github' => lambda {create_github_project project_name} , - 'bitbucket' => lambda {create_bitbicket_project project_name} } -=end - (method_dict.has_key? service)? method_dict[service].call : (raise "unknown service") -end - -Given(/^a "(.*?)" project named "(.*?)" exists$/) do |service , project_name| - service_do service , {'github' => lambda {create_github_project project_name} , - 'bitbucket' => lambda {create_bitbicket_project project_name} } -end - -Given(/^a deposit of "(.*?)" is made$/) do |deposit| - Deposit.create!(project: @current_project, amount: deposit.to_d * 1e8, confirmations: 2) -end - -def add_new_commit commit_id , nickname , params = {} - raise "duplicate commit_id" if (find_new_commit commit_id).present? - - defaults = { - sha: commit_id, - commit: { - message: "Some changes", - author: { - email: "#{nickname}@example.com", - }, +Given /^I'm signed in as "(.*?)"$/ do |nickname| + email = "#{nickname.parameterize}@example.com" + + OmniAuth.config.test_mode = true + OmniAuth.config.mock_auth[:github] = { + "info" => { + "nickname" => nickname , + "primary_email" => email , + "verified_emails" => [email] , }, - } - - project_id = @current_project.id - @new_commits ||= {} - @new_commits[project_id] ||= {} - @new_commits[project_id][commit_id] = defaults.deep_merge params -end - -def find_new_commit commit_id - (@new_commits || {}).each_value do |commits| - return commits[commit_id] unless commits[commit_id].nil? + }.to_ostruct + visit root_path + first(:link, "Sign in").click + click_on "Sign in with Github" + page.should have_content("Successfully authenticated") + + step "a user named \"#{nickname}\" exists without a bitcoin address" +end + +Given /^I'm not signed in$/ do + visit root_path + if page.has_content?("Sign out") + click_on "Sign out" + page.should have_content("Signed out successfully") + else + page.should have_content("Sign in") end - - nil end -Given(/^a new commit "([^"]*?)" is made by a user named "(.*?)"$/) do |commit_id , nickname| - add_new_commit commit_id , nickname -end - -Given(/^(\d+) new commit.? (?:is|are) made by a user named "(.*?)"$/) do |n_commits , nickname| - n_commits.to_i.times do - add_new_commit Digest::SHA1.hexdigest(SecureRandom.hex) , nickname +Given (/^I sign in as "(.*?)"$/) { |nickname| step "I'm signed in as \"#{nickname}\"" } + +Given (/^I sign out$/) { step "I'm not signed in" } + +def parse_path_from_page_string page_string + path = nil + + # explicit cases + # e.g. "a-user/a-project github project edit" + # e.g. "a-user user edit" + tokens = page_string.split ' ' + name = tokens[0] + model = tokens[1] + action = tokens[2] || '' # '' => 'show' + is_user = model.eql? 'user' + is_project = ['github-project' , 'bitbucket-project'].include? model + if is_project + projects_paths = ['' , 'edit' , 'decide_tip_amounts' , 'tips' , 'deposits'] + is_valid_path = projects_paths.include? action + service = model.split('-').first + path = "/#{service}/#{name}/#{action}" if is_valid_path + elsif is_user + user_paths = ['' , 'tips'] + is_valid_path = user_paths.include? action +# path = "/users/#{name}/#{action}" if is_valid_path # TODO: nyi + path = "/users/#{@users[name].id}/#{action}" if is_valid_path + + # implicit cases + else case page_string + when 'home' ; path = root_path ; + when 'sign_up' ; path = new_user_registration_path ; + when 'sign_in' ; path = new_user_session_path ; + when 'users' ; path = users_path ; + when 'projects' ; path = projects_path ; + when 'search' ; path = search_projects_path ; + when 'tips' ; path = tips_path ; + when 'deposits' ; path = deposits_path ; + when 'withdrawals' ; path = withdrawals_path ; + end end -end - -Given(/^a new commit "([^"]*?)" is made$/) do |commit_id| - add_new_commit commit_id , "unknown-user" -end - -Given(/^a new commit "(.*?)" is made with parent "([^"]*?)"$/) do |commit_id, parent_commit_id| - add_new_commit commit_id , "unknown-user" , parents: [{sha: parent_commit_id}] -end -Given(/^a new commit "(.*?)" is made with parent "(.*?)" and "(.*?)"$/) do |commit_id, parentA_commit_id, parentB_commit_id| - params = { parents: [{sha: parentA_commit_id}, {sha: parentB_commit_id}], commit: {message: "Merge #{parentA_commit_id} and #{parentB_commit_id}"} } - add_new_commit commit_id , "unknown-user" , params + path || (raise "unknown page") end -Given(/^the author of commit "(.*?)" is "(.*?)"$/) do |commit_id , nickname| - commit = find_new_commit commit_id - raise "no such commit" if commit.nil? - - commit.deep_merge!(author: {login: nickname}, commit: {author: {email: "#{nickname}@example.com"}}) +Given(/^I visit the "(.*?)" page$/) do |page_string| + visit parse_path_from_page_string page_string end -Given(/^the message of commit "(.*?)" is "(.*?)"$/) do |commit_id , commit_msg| - commit = find_new_commit commit_id - raise "no such commit" if commit.nil? - - commit.deep_merge!(commit: {message: commit_msg}) +Given(/^I browse to the explicit path "(.*?)"$/) do |url| + visit url end -Given(/^the most recent commit is "(.*?)"$/) do |commit_id| - @current_project.update! last_commit: commit_id -end +Then(/^I should be on the "(.*?)" page$/) do |page_string| + expected = parse_path_from_page_string page_string + actual = page.current_path -Then(/^the most recent commit should be "(.*?)"$/) do |commit_id| - @current_project.reload.last_commit.should eq commit_id + (expected.index actual).should eq 0 # ignore trailing '/' end -When(/^the new commits are loaded$/) do - raise "no commits have been assigned" if @new_commits.nil? - - [@github_project_1 , @github_project_2 , @github_project_3].each do |project| - next if project.nil? - - project.reload - new_commits = @new_commits[project.id].values.map(&:to_ostruct) - project.should_receive(:new_commits).and_return(new_commits) - project.tip_commits - end +Given(/^I click on "(.*?)"$/) do |arg1| + click_on(arg1) end -Given(/^the project holds tips$/) do - @current_project.update(hold_tips: true) +Given(/^I check "(.*?)"$/) do |arg1| + check(arg1) end -Then(/^there should be no tip for commit "(.*?)"$/) do |arg1| - Tip.where(commit: arg1).to_a.should eq([]) +Then(/^I should see "(.*?)"$/) do |arg1| + page.should have_content(arg1) end -Then(/^there should be a tip of "(.*?)" for commit "(.*?)"$/) do |arg1, arg2| - amount = Tip.find_by(commit: arg2).amount - amount.should_not be_nil - (amount.to_d / 1e8).should eq(arg1.to_d) +Then(/^I should not see "(.*?)"$/) do |arg1| + page.should have_no_content(arg1) end -Then(/^the tip amount for commit "(.*?)" should be undecided$/) do |arg1| - Tip.find_by(commit: arg1).undecided?.should eq(true) +Given(/^I fill "(.*?)" with:$/) do |arg1, string| + fill_in arg1, with: string end -Given(/^the project collaborators are:$/) do |table| - @collaborators = [] - table.raw.each do |collaborator_name,| - @collaborators << collaborator_name unless @collaborators.include? collaborator_name - end +Given(/^I fill "(.*?)" with: "(.*?)"$/) do |text_field, string| + fill_in text_field, with: string end -Given(/^the project collaborators are loaded$/) do - @current_project.reload - @current_project.collaborators.each(&:destroy) - @collaborators.each do |name,| - @current_project.collaborators.create!(login: name) - end +Then(/^there should be (\d+) email sent$/) do |arg1| + ActionMailer::Base.deliveries.size.should eq(arg1.to_i) end -Given(/^an illustration of the history is:$/) do |string| - # not checked +When(/^the email counters are reset$/) do + ActionMailer::Base.deliveries.clear end diff --git a/features/step_definitions/project_steps.rb b/features/step_definitions/project_steps.rb index 084817bf..12f96c66 100644 --- a/features/step_definitions/project_steps.rb +++ b/features/step_definitions/project_steps.rb @@ -1,4 +1,45 @@ +def create_github_project project_name + if (@github_project_1.present? && (project_name.eql? @github_project_1.full_name)) || + (@github_project_2.present? && (project_name.eql? @github_project_2.full_name)) + raise "duplicate project_name '#{project_name}'" + elsif @github_project_3.present? + raise "the maximum of three test projects already exist" + end + +# @current_project is also assigned in the "considering the .. project named ..." step + @current_project = Project.create! :full_name => project_name , # e.g. "me/my-project" + :github_id => Digest::SHA1.hexdigest(project_name) , + :bitcoin_address => 'mq4NtnmQoQoPfNWEPbhSvxvncgtGo6L8WY' + if @github_project_2.present? ; @github_project_3 = @current_project ; + elsif @github_project_1.present? ; @github_project_2 = @current_project ; + else @github_project_1 = @current_project ; + end +end + +def create_bitbicket_project project_name + raise "unknown service" # nyi +end + +When /^regarding the "(.*?)" project named "(.*?)"$/ do |service , project_name| +# @current_project is also assigned in create_github_project and create_bitbucket_project + + @current_project = find_project service , project_name +end + +def service_do service , method_dict +=begin e.g. + service_do 'github' , {'github' => lambda {create_github_project project_name} , + 'bitbucket' => lambda {create_bitbicket_project project_name} } +=end + (method_dict.has_key? service)? method_dict[service].call : (raise "unknown service") +end + +Given(/^a "(.*?)" project named "(.*?)" exists$/) do |service , project_name| + service_do service , {'github' => lambda {create_github_project project_name} , + 'bitbucket' => lambda {create_bitbicket_project project_name} } +end + When /^the project syncs with the remote repo$/ do # in the real world a project has no information regarding commits # nor collaborators until the project initially syncs @@ -19,3 +60,18 @@ page.should have_xpath avatar_xpath end end + +Given(/^the project collaborators are:$/) do |table| + @collaborators = [] + table.raw.each do |collaborator_name,| + @collaborators << collaborator_name unless @collaborators.include? collaborator_name + end +end + +Given(/^the project collaborators are loaded$/) do + @current_project.reload + @current_project.collaborators.each(&:destroy) + @collaborators.each do |name,| + @current_project.collaborators.create!(login: name) + end +end diff --git a/features/step_definitions/tip_modifier_interface.rb b/features/step_definitions/tip_modifier_interface.rb deleted file mode 100644 index d89eac8e..00000000 --- a/features/step_definitions/tip_modifier_interface.rb +++ /dev/null @@ -1,79 +0,0 @@ -When(/^I choose the amount "(.*?)" on commit "(.*?)"$/) do |arg1, arg2| - within find(".decide-tip-amounts-table tbody tr", text: arg2) do - choose arg1 - end -end - -When(/^I choose the amount "(.*?)" on all commits$/) do |arg1| - all(".decide-tip-amounts-table tbody tr").each do |tr| - within tr do - choose arg1 - end - end -end - -When(/^I send a forged request to enable tip holding on the project$/) do - page.driver.browser.process_and_follow_redirects(:patch, project_path(@current_project), project: {hold_tips: "1"}) -end - -Then(/^I should see an access denied$/) do - page.should have_content("You are not authorized to perform this action!") -end - -Then(/^the project should not hold tips$/) do - @current_project.reload.hold_tips.should eq(false) -end - -Then(/^the project should hold tips$/) do - @current_project.reload.hold_tips.should eq(true) -end - -Given(/^the project has undedided tips$/) do - create(:undecided_tip, project: @current_project) - @current_project.reload.should have_undecided_tips -end - -Given(/^the project has (\d+) undecided tip$/) do |arg1| - @current_project.tips.undecided.each(&:destroy) - create(:undecided_tip, project: @current_project) - @current_project.reload.should have_undecided_tips -end - -Given(/^I send a forged request to set the amount of the first undecided tip of the project$/) do - tip = @current_project.tips.undecided.first - tip.should_not be_nil - params = { - project: { - tips_attributes: { - "0" => { - id: tip.id, - amount_percentage: "5", - }, - }, - }, - } - - page.driver.browser.process_and_follow_redirects(:patch, decide_tip_amounts_project_path(@current_project), params) -end - -When(/^I send a forged request to change the percentage of commit "(.*?)" to "(.*?)"$/) do |commit , percentage| - tip = @current_project.tips.detect { |t| t.commit == commit } - tip.should_not be_nil - params = { - project: { - tips_attributes: { - "0" => { - id: tip.id, - amount_percentage: percentage, - }, - }, - }, - } - - path = decide_tip_amounts_project_path @current_project - page.driver.browser.process_and_follow_redirects :patch , path , params -end - -Then(/^the project should have (\d+) undecided tips$/) do |arg1| - @current_project.tips.undecided.size.should eq(arg1.to_i) -end diff --git a/features/step_definitions/tips_steps.rb b/features/step_definitions/tips_steps.rb new file mode 100644 index 00000000..a27fea9f --- /dev/null +++ b/features/step_definitions/tips_steps.rb @@ -0,0 +1,195 @@ + +Given(/^the tip percentage per commit is "(.*?)"$/) do |arg1| + CONFIG["tip"] = arg1.to_f +end + +Given(/^our fee is "(.*?)"$/) do |arg1| + CONFIG["our_fee"] = arg1.to_f +end + +Given(/^a deposit of "(.*?)" is made$/) do |deposit| + Deposit.create!(project: @current_project, amount: deposit.to_d * 1e8, confirmations: 2) +end + +def add_new_commit commit_id , nickname , params = {} + raise "duplicate commit_id" if (find_new_commit commit_id).present? + + defaults = { + sha: commit_id, + commit: { + message: "Some changes", + author: { + email: "#{nickname}@example.com", + }, + }, + } + + project_id = @current_project.id + @new_commits ||= {} + @new_commits[project_id] ||= {} + @new_commits[project_id][commit_id] = defaults.deep_merge params +end + +def find_new_commit commit_id + (@new_commits || {}).each_value do |commits| + return commits[commit_id] unless commits[commit_id].nil? + end + + nil +end + +Given(/^a new commit "([^"]*?)" is made by a user named "(.*?)"$/) do |commit_id , nickname| + add_new_commit commit_id , nickname +end + +Given(/^(\d+) new commit.? (?:is|are) made by a user named "(.*?)"$/) do |n_commits , nickname| + n_commits.to_i.times do + add_new_commit Digest::SHA1.hexdigest(SecureRandom.hex) , nickname + end +end + +Given(/^a new commit "([^"]*?)" is made$/) do |commit_id| + add_new_commit commit_id , "unknown-user" +end + +Given(/^a new commit "(.*?)" is made with parent "([^"]*?)"$/) do |commit_id, parent_commit_id| + add_new_commit commit_id , "unknown-user" , parents: [{sha: parent_commit_id}] +end + +Given(/^a new commit "(.*?)" is made with parent "(.*?)" and "(.*?)"$/) do |commit_id, parentA_commit_id, parentB_commit_id| + params = { parents: [{sha: parentA_commit_id}, {sha: parentB_commit_id}], commit: {message: "Merge #{parentA_commit_id} and #{parentB_commit_id}"} } + add_new_commit commit_id , "unknown-user" , params +end + +Given(/^the author of commit "(.*?)" is "(.*?)"$/) do |commit_id , nickname| + commit = find_new_commit commit_id + raise "no such commit" if commit.nil? + + commit.deep_merge!(author: {login: nickname}, commit: {author: {email: "#{nickname}@example.com"}}) +end + +Given(/^the message of commit "(.*?)" is "(.*?)"$/) do |commit_id , commit_msg| + commit = find_new_commit commit_id + raise "no such commit" if commit.nil? + + commit.deep_merge!(commit: {message: commit_msg}) +end + +Given(/^the most recent commit is "(.*?)"$/) do |commit_id| + @current_project.update! last_commit: commit_id +end + +Then(/^the most recent commit should be "(.*?)"$/) do |commit_id| + @current_project.reload.last_commit.should eq commit_id +end + +When(/^the new commits are loaded$/) do + raise "no commits have been assigned" if @new_commits.nil? + + [@github_project_1 , @github_project_2 , @github_project_3].each do |project| + next if project.nil? + + project.reload + new_commits = @new_commits[project.id].values.map(&:to_ostruct) + project.should_receive(:new_commits).and_return(new_commits) + project.tip_commits + end +end + +Given(/^the project holds tips$/) do + @current_project.update(hold_tips: true) +end + +Then(/^there should be no tip for commit "(.*?)"$/) do |arg1| + Tip.where(commit: arg1).to_a.should eq([]) +end + +Then(/^there should be a tip of "(.*?)" for commit "(.*?)"$/) do |arg1, arg2| + amount = Tip.find_by(commit: arg2).amount + amount.should_not be_nil + (amount.to_d / 1e8).should eq(arg1.to_d) +end + +Then(/^the tip amount for commit "(.*?)" should be undecided$/) do |arg1| + Tip.find_by(commit: arg1).undecided?.should eq(true) +end + +When(/^I choose the amount "(.*?)" on commit "(.*?)"$/) do |arg1, arg2| + within find(".decide-tip-amounts-table tbody tr", text: arg2) do + choose arg1 + end +end + +When(/^I choose the amount "(.*?)" on all commits$/) do |arg1| + all(".decide-tip-amounts-table tbody tr").each do |tr| + within tr do + choose arg1 + end + end +end + +When(/^I send a forged request to enable tip holding on the project$/) do + page.driver.browser.process_and_follow_redirects(:patch, project_path(@current_project), project: {hold_tips: "1"}) +end + +Then(/^I should see an access denied$/) do + page.should have_content("You are not authorized to perform this action!") +end + +Then(/^the project should not hold tips$/) do + @current_project.reload.hold_tips.should eq(false) +end + +Then(/^the project should hold tips$/) do + @current_project.reload.hold_tips.should eq(true) +end + +Given(/^the project has undedided tips$/) do + create(:undecided_tip, project: @current_project) + @current_project.reload.should have_undecided_tips +end + +Given(/^the project has (\d+) undecided tip$/) do |arg1| + @current_project.tips.undecided.each(&:destroy) + create(:undecided_tip, project: @current_project) + @current_project.reload.should have_undecided_tips +end + +Given(/^I send a forged request to set the amount of the first undecided tip of the project$/) do + tip = @current_project.tips.undecided.first + tip.should_not be_nil + params = { + project: { + tips_attributes: { + "0" => { + id: tip.id, + amount_percentage: "5", + }, + }, + }, + } + + page.driver.browser.process_and_follow_redirects(:patch, decide_tip_amounts_project_path(@current_project), params) +end + +When(/^I send a forged request to change the percentage of commit "(.*?)" to "(.*?)"$/) do |commit , percentage| + tip = @current_project.tips.detect { |t| t.commit == commit } + tip.should_not be_nil + params = { + project: { + tips_attributes: { + "0" => { + id: tip.id, + amount_percentage: percentage, + }, + }, + }, + } + + path = decide_tip_amounts_project_path @current_project + page.driver.browser.process_and_follow_redirects :patch , path , params +end + +Then(/^the project should have (\d+) undecided tips$/) do |arg1| + @current_project.tips.undecided.size.should eq(arg1.to_i) +end diff --git a/features/step_definitions/web.rb b/features/step_definitions/web.rb deleted file mode 100644 index 5eec7462..00000000 --- a/features/step_definitions/web.rb +++ /dev/null @@ -1,107 +0,0 @@ -Given /^I'm signed in as "(.*?)"$/ do |nickname| - email = "#{nickname.parameterize}@example.com" - - OmniAuth.config.test_mode = true - OmniAuth.config.mock_auth[:github] = { - "info" => { - "nickname" => nickname , - "primary_email" => email , - "verified_emails" => [email] , - }, - }.to_ostruct - visit root_path - first(:link, "Sign in").click - click_on "Sign in with Github" - page.should have_content("Successfully authenticated") - - step "a user named \"#{nickname}\" exists without a bitcoin address" -end - -Given /^I'm not signed in$/ do - visit root_path - if page.has_content?("Sign out") - click_on "Sign out" - page.should have_content("Signed out successfully") - else - page.should have_content("Sign in") - end -end - -Given (/^I sign in as "(.*?)"$/) { |nickname| step "I'm signed in as \"#{nickname}\"" } - -Given (/^I sign out$/) { step "I sign out" } - -def parse_path_from_page_string page_string - path = nil - - # explicit cases - # e.g. "a-user/a-project github project edit" - # e.g. "a-user user edit" - tokens = page_string.split ' ' - name = tokens[0] - model = tokens[1] - action = tokens[2] || '' - is_user = model.eql? 'user' - is_project = ['github-project' , 'bitbucket-project'].include? model - if is_project - projects_paths = ['' , 'edit' , 'decide_tip_amounts' , 'tips' , 'deposits'] # '' => 'show' - is_valid_path = projects_paths.include? action - service = model.split('-').first - path = "/#{service}/#{name}/#{action}" if is_valid_path - elsif is_user - user_paths = ['' , 'tips'] - is_valid_path = user_paths.include? action -# path = "/users/#{name}/#{action}" if is_valid_path # TODO: nyi - path = "/users/#{@users[name].id}/#{action}" if is_valid_path - - # implicit cases - else case page_string - when 'home' ; path = root_path ; - when 'sign_up' ; path = new_user_registration_path ; - when 'sign_in' ; path = new_user_session_path ; - when 'users' ; path = users_path ; - when 'projects' ; path = projects_path ; - when 'search' ; path = search_projects_path ; - when 'tips' ; path = tips_path ; - when 'deposits' ; path = deposits_path ; - when 'withdrawals' ; path = withdrawals_path ; - end - end - - path || (raise "unknown page") -end - -Given(/^I visit the "(.*?)" page$/) do |page_string| - visit parse_path_from_page_string page_string -end - -Then(/^I should be on the "(.*?)" page$/) do |page_string| - expected = parse_path_from_page_string page_string - actual = page.current_path - - (expected.index actual).should eq 0 # ignore trailing '/' -end - -Given(/^I click on "(.*?)"$/) do |arg1| - click_on(arg1) -end - -Given(/^I check "(.*?)"$/) do |arg1| - check(arg1) -end - -Then(/^I should see "(.*?)"$/) do |arg1| - page.should have_content(arg1) -end - -Then(/^I should not see "(.*?)"$/) do |arg1| - page.should have_no_content(arg1) -end - -Given(/^I fill "(.*?)" with:$/) do |arg1, string| - fill_in arg1, with: string -end - -Given(/^I fill "(.*?)" with: "(.*?)"$/) do |text_field, string| - fill_in text_field, with: string -end diff --git a/features/tip_modifier_interface.feature b/features/tip_modifier_interface.feature index 74f95041..c5c06313 100644 --- a/features/tip_modifier_interface.feature +++ b/features/tip_modifier_interface.feature @@ -9,8 +9,8 @@ Feature: A project collaborator can change the tips of commits And our fee is "0" And a deposit of "500" is made And the most recent commit is "AAA" - And a new commit "BBB" with parent "AAA" is made - And a new commit "CCC" with parent "BBB" is made + And a new commit "BBB" is made with parent "AAA" + And a new commit "CCC" is made with parent "BBB" And the author of commit "BBB" is "yugo" And the author of commit "CCC" is "gaal" @@ -21,7 +21,7 @@ Feature: A project collaborator can change the tips of commits And there should be 0 email sent Scenario: A collaborator wants to alter the tips - Given I'm logged in as "seldon" + Given I'm signed in as "seldon" When the project syncs with the remote repo And I visit the "seldon/seldons-project github-project" page Then I should be on the "seldon/seldons-project github-project" page @@ -32,13 +32,13 @@ Feature: A project collaborator can change the tips of commits Then I should be on the "seldon/seldons-project github-project" page And I should see "The project settings have been updated" - When a new commit "DDD" with parent "CCC" is made + When a new commit "DDD" is made with parent "CCC" And the author of commit "DDD" is "yugo" And the message of commit "DDD" is "yugo's trivial commit DDD" - And a new commit "EEE" with parent "DDD" is made + And a new commit "EEE" is made with parent "DDD" And the author of commit "EEE" is "gaal" And the message of commit "EEE" is "gaal's tiny commit EEE" - When a new commit "FFF" with parent "EEE" is made + When a new commit "FFF" is made with parent "EEE" And the author of commit "FFF" is "newguy" And the message of commit "FFF" is "newguy's unrewarded commit EEE" When the project syncs with the remote repo @@ -82,33 +82,33 @@ Feature: A project collaborator can change the tips of commits And there should be 0 email sent Scenario: A non collaborator does not see the settings button - Given I'm logged in as "yugo" + Given I'm signed in as "yugo" And I visit the "seldon/seldons-project github-project" page Then I should be on the "seldon/seldons-project github-project" page And I should not see "Change project settings" Scenario: A non collaborator does not see the decide tip amounts button Given the project has undedided tips - And I'm logged in as "yugo" + And I'm signed in as "yugo" And I visit the "seldon/seldons-project github-project" page Then I should be on the "seldon/seldons-project github-project" page And I should not see "Decide tip amounts" Scenario: A non collaborator goes to the edit page of a project - Given I'm logged in as "yugo" + Given I'm signed in as "yugo" When I visit the "seldon/seldons-project github-project edit" page Then I should be on the "home" page And I should see "You are not authorized to perform this action!" Scenario: A non collaborator sends a forged update on a project - Given I'm logged in as "yugo" + Given I'm signed in as "yugo" When I send a forged request to enable tip holding on the project Then I should be on the "home" page And I should see "You are not authorized to perform this action!" And the project should not hold tips Scenario: A collaborator sends a forged update on a project - Given I'm logged in as "daneel" + Given I'm signed in as "daneel" When the project syncs with the remote repo When I send a forged request to enable tip holding on the project Then I should be on the "seldon/seldons-project github-project" page @@ -117,7 +117,7 @@ Feature: A project collaborator can change the tips of commits Scenario Outline: A user sends a forged request to set a tip amount When the project syncs with the remote repo Given the project has 1 undecided tip - When I'm logged in as "" + When I'm signed in as "" And I visit the "seldon/seldons-project github-project" page Then I should be on the "seldon/seldons-project github-project" page And I send a forged request to set the amount of the first undecided tip of the project @@ -133,7 +133,7 @@ Feature: A project collaborator can change the tips of commits And a new commit "last" is made And the project holds tips When the project syncs with the remote repo - And I'm logged in as "seldon" + And I'm signed in as "seldon" And I visit the "seldon/seldons-project github-project" page Then I should be on the "seldon/seldons-project github-project" page And I should see "Decide tip amounts" @@ -155,7 +155,7 @@ Feature: A project collaborator can change the tips of commits And a new commit "fake commit" is made And the project holds tips When the project syncs with the remote repo - And I'm logged in as "" + And I'm signed in as "" When regarding the "github" project named "seldon/seldons-project" And I send a forged request to change the percentage of commit "BBB" to "5" Then diff --git a/features/tipping_policies.feature b/features/tipping_policies.feature index 02f1bd72..6d0b0ed5 100644 --- a/features/tipping_policies.feature +++ b/features/tipping_policies.feature @@ -7,7 +7,7 @@ Feature: A project collaborator can display the tipping policies of the project And the project syncs with the remote repo Scenario: A collaborator changes the tipping policies - Given I'm logged in as "daneel" + Given I'm signed in as "daneel" When I visit the "seldon/seldons-project github-project" page Then I should be on the "seldon/seldons-project github-project" page And I click on "Change project settings" @@ -21,7 +21,7 @@ Feature: A project collaborator can display the tipping policies of the project Then I should be on the "seldon/seldons-project github-project" page Then I should see "The project settings have been updated" - Given I log out + Given I sign out When I visit the "seldon/seldons-project github-project" page Then I should be on the "seldon/seldons-project github-project" page Then I should see "All commits are huge!" diff --git a/features/view_tips.feature b/features/view_tips.feature index 26d93252..0084e3da 100644 --- a/features/view_tips.feature +++ b/features/view_tips.feature @@ -6,14 +6,14 @@ Feature: Visitors should be able to see claimed tips And our fee is "0" And a deposit of "500" is made And the most recent commit is "AAA" - And a new commit "BBB" with parent "AAA" is made - And a new commit "CCC" with parent "BBB" is made + And a new commit "BBB" is made with parent "AAA" + And a new commit "CCC" is made with parent "BBB" And the author of commit "BBB" is "yugo" And the author of commit "CCC" is "gaal" When the project syncs with the remote repo Then there should be a tip of "5" for commit "BBB" And there should be a tip of "4.95" for commit "CCC" - Given I'm not logged in + Given I'm not signed in Scenario: Visitors should see all claimed tips but not unclaimed tips When I visit the "tips" page diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index 1d8f59ee..32e0acfb 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -98,14 +98,14 @@ :action => "index" ) end - it "routes GET /users to User#show" do + it "routes GET /users/1 to User#show" do { :get => "/users/1" }.should route_to( :controller => "users" , :action => "show" , :id => "1" ) end - it "routes GET /login to User#login" do + it "routes GET /users/login to User#login" do { :get => "/users/login" }.should route_to( :controller => "users" , :action => "login" ) @@ -119,8 +119,10 @@ end end - describe "pretty user url routing" do - it "routes regex rejects reserved user paths" do + describe "pretty url routing" do + let(:user) { create(:user) } + + it "regex rejects reserved user paths" do # accepted pertty url usernames should_accept = %w{logi ogin s4c2 42x} # reserved routes (rejected pertty url usernames) @@ -130,5 +132,19 @@ rejected = should_reject.select {|ea| (ea =~ RESERVED_USER_ROUTES_REGEX).nil? } accepted.size.should eq should_accept.size and rejected.size.should eq should_reject.size end + + it "routes GET /users/friendly-name to User#show" do + { :get => "/users/#{user.nickname}" }.should route_to( + :controller => "users" , + :action => "show" , + :id => "kd" ) + end + + it "routes GET /users/friendly-name/tips to Tips#index" do + { :get => "/users/#{user.nickname}/tips" }.should route_to( + :controller => "tips" , + :action => "index" , + :user_id => "kd" ) + end end end From 2e87fa6cc8dfc05d7438ed73d6f5566a0d2922e6 Mon Sep 17 00:00:00 2001 From: arsenische Date: Wed, 5 Nov 2014 04:39:52 +0500 Subject: [PATCH 118/415] fixing #182; also added some text to warning to prevent further confusion --- app/views/layouts/application.html.haml | 8 +++++++- config/blacklist.yml | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index fb318476..3c0fade0 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -60,8 +60,14 @@ .footer .alert.alert-warning - We are not affiliated with most of the projects, their owners might not endorse use of tip4commit. + %p + We are not affiliated with most of the projects, their owners may be unaware of or actively against using tip4commit. Due to potential ethical and legal issues we may remove any project from the list by request of project maintainers. + %p + Also we are not notifying developers about their tips anymore. Thus we can't guarantee that donated funds will really reach them. + + %p + By donating funds you agree that they can be sent to Free Software Foundation or elsewhere at Tip4Commit's discretion. %p.pull-right - ::Rails.application.config.available_locales.each do |locale| diff --git a/config/blacklist.yml b/config/blacklist.yml index 7f289578..266d412f 100644 --- a/config/blacklist.yml +++ b/config/blacklist.yml @@ -30,3 +30,4 @@ - https://github.com/ipython/* - https://github.com/mpasternacki/* - https://github.com/3ofcoins/* +- https://github.com/ggventurini/python-deltasigma \ No newline at end of file From 28058022e5bcc2aebe3848c657c737e3e4b80f79 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Wed, 5 Nov 2014 10:57:31 +0500 Subject: [PATCH 119/415] updated Gemfile.lock --- Gemfile.lock | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index d9dcf137..94dfdf35 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,6 +7,12 @@ GIT omniauth (~> 1.0) omniauth-oauth2 (~> 1.1) +GIT + remote: git://github.com/bootstrap-ruby/rails-bootstrap-forms.git + revision: bb5e1ca8b8fdb6405feb162338e45468dac83c30 + specs: + bootstrap_form (2.2.0) + GIT remote: git://github.com/capistrano/rvm.git revision: 19e8d15ae3d705499c610370f159d523bbedbd94 @@ -26,13 +32,6 @@ GIT rails (>= 3.1) railties (>= 3.1) -GIT - remote: git://github.com/sigmike/rails-bootstrap-forms.git - revision: a1c8420ab999df56b13d3de8a097528b77a02217 - branch: removed_for_on_radio_label - specs: - bootstrap_form (2.0.1) - GIT remote: git://github.com/stouset/twitter_bootstrap_form_for.git revision: 830dbfd439ebb1194e1ae025100fc0e790be37cf From 8449fdb6875cf91832cbd49daf4a3698f547dde2 Mon Sep 17 00:00:00 2001 From: win32re Date: Wed, 5 Nov 2014 17:30:40 +0100 Subject: [PATCH 120/415] Update hr.yml --- config/locales/hr.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/config/locales/hr.yml b/config/locales/hr.yml index ffec3b58..87339483 100644 --- a/config/locales/hr.yml +++ b/config/locales/hr.yml @@ -10,7 +10,7 @@ hr: text: "Izvorni kod dostupan na %{github_link} i mozete takoder %{support_link} razvoj." github_link: GitHub support_link: podrzi - follow_link: Follow @tip4commit + follow_link: Prati @tip4commit links: sign_up: Sign up sign_in: Prijava @@ -70,7 +70,7 @@ hr: index: find_project: placeholder: Upisite GitHub URL projekta kako biste dodati projekt ili bilo koju kljucnu rijec da biste je nasli... - button: Nadi ili dodaj projekt + button: Nadji ili dodaj projekt repository: Repozitorij description: Opis watchers: Gledatelji @@ -101,12 +101,12 @@ hr: for_commit: za cin when_decided: kada je kolicina odlucena next_tip: Sljedeca napojnica - contribute_and_earn: Contribute and earn + contribute_and_earn: Doprinesi i zaradi contribute_and_earn_description: "Doniraj Bitcone u ovaj projekt ili %{make_commits_link} i dobij napojnicu. Ako je commit prihvacen %{branch} od strane voditelja projekta i ima Bitcoina na racunu, dobit ce te napojnicu." contribute_and_earn_branch: "u %{branch} branch" make_commits_link: make commits tell_us_bitcoin_address: "Samo %{tell_us_link} vasu bitcoin adresu." - tell_us_link: tell us + tell_us_link: recite nam sign_in: "Samo provjerite vas email ili %{sign_in_link}." promote_project: Promoviraj %{project} embedding: Embedding @@ -122,13 +122,13 @@ hr: disable_notifications: Don't notify new contributors decide_tip_amounts: commit: Commit - author: Author - message: Message - tip: Tip (relative to the project balance) - submit: Send the selected tip amounts + author: Autor + message: Poruka + tip: Napojnica (relativna iznosu na racunu) + submit: Posaljite odabrane iznose napojnica tips: index: - tips: Tips + tips: Napojnice project_tips: '%{project} napojnice' user_tips: "%{user} napojnice" created_at: Stvoreno na @@ -145,12 +145,12 @@ hr: deposits: index: project_deposits: '%{project} uplate' - deposits: Deposits + deposits: Uplate created_at: "Stvoreno na" project: Projekt amount: Kolicina - transaction: Transaction - confirmed: Confirmed + transaction: Transakcija + confirmed: Potvrdjeno confirmed_yes: 'Da' confirmed_no: 'Ne' users: @@ -165,7 +165,7 @@ hr: see_all: vidjeti sve received: "%{time} primljeno %{amount} za cin %{commit} u %{project}" bitcoin_address_placeholder: Vasa bitcoin adresa - notify: Notificirati me o novim savjetima (ne vise od jednog emaila po mjesecu) + notify: Obavjesti me o novim savjetima (ne vise od jednog emaila po mjesecu) submit_user: Azurirati informaciju korisnika change_password: Promijeniti vasu lozinku submit_password: Promijeniti moju lozinku From b09992e8dfd5280946bd5210385dfe38868b00b4 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Thu, 6 Nov 2014 14:35:55 +0500 Subject: [PATCH 121/415] Admins can set minimum tip amount in the configuration file --- app/models/project.rb | 6 ++++-- config/config.yml.sample | 1 + features/min_tip_amount.feature | 17 +++++++++++++++++ features/step_definitions/common.rb | 4 ++++ features/tip_modifier_interface.feature | 1 + 5 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 features/min_tip_amount.feature diff --git a/app/models/project.rb b/app/models/project.rb index 56a8b2ee..785f4bb0 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -134,7 +134,7 @@ def tip_for commit commit: commit.sha, commit_message: commit.commit.message }) - tip.notify_user + # tip.notify_user Rails.logger.info " Tip created #{tip.inspect}" end @@ -161,7 +161,9 @@ def tips_paid_unclaimed_amount end def next_tip_amount - (CONFIG["tip"]*available_amount).ceil + next_tip_amount = (CONFIG["tip"]*available_amount).ceil + next_tip_amount = [next_tip_amount, CONFIG["min_tip"]].max if CONFIG["min_tip"] + next_tip_amount = [next_tip_amount, available_amount].min end def update_cache diff --git a/config/config.yml.sample b/config/config.yml.sample index 6d292b47..ba0b5573 100644 --- a/config/config.yml.sample +++ b/config/config.yml.sample @@ -35,6 +35,7 @@ smtp_settings: tip: 0.01 min_payout: 100000 our_fee: 0.05 +min_tip: 50000 # optional deposit_address: 1M4bS4gPyA6Kb8w7aXsgth9oUZWcRk73tQ diff --git a/features/min_tip_amount.feature b/features/min_tip_amount.feature new file mode 100644 index 00000000..1ea889fb --- /dev/null +++ b/features/min_tip_amount.feature @@ -0,0 +1,17 @@ +Feature: Admins can set minimum tip amount in the configuration file + Background: + Given a project "my-project" + And our fee is "0" + And min tip amount is "300" + And a deposit of "500" + And the last known commit is "COMMIT1" + + Scenario: Developer gets more than 1% of funds, but less than available_amount + And a user "yugo" has opted-in + And a new commit "COMMIT2" with parent "COMMIT1" + And the author of commit "COMMIT2" is "yugo" + And a new commit "COMMIT3" with parent "COMMIT2" + And the author of commit "COMMIT3" is "yugo" + When the new commits are read + Then there should be a tip of "300" for commit "COMMIT2" + And there should be a tip of "200" for commit "COMMIT3" \ No newline at end of file diff --git a/features/step_definitions/common.rb b/features/step_definitions/common.rb index 3b284663..343c734e 100644 --- a/features/step_definitions/common.rb +++ b/features/step_definitions/common.rb @@ -21,6 +21,10 @@ CONFIG["our_fee"] = arg1.to_f end +Given(/^min tip amount is "(.*?)"$/) do |arg1| + CONFIG["min_tip"] = arg1.to_f * 1e8 +end + Given(/^a project$/) do @project = Project.create!(full_name: "example/test", github_id: 123, bitcoin_address: 'mq4NtnmQoQoPfNWEPbhSvxvncgtGo6L8WY') end diff --git a/features/tip_modifier_interface.feature b/features/tip_modifier_interface.feature index cf8e9122..2026fb6c 100644 --- a/features/tip_modifier_interface.feature +++ b/features/tip_modifier_interface.feature @@ -7,6 +7,7 @@ Feature: A project collaborator can change the tips of commits | seldon | | daneel | And our fee is "0" + And min tip amount is "0" And a deposit of "500" And the last known commit is "AAA" And a new commit "BBB" with parent "AAA" From 3fc56f97669367d1355264b2aa56182d056fd700 Mon Sep 17 00:00:00 2001 From: bill auger Date: Fri, 7 Nov 2014 22:58:00 +0000 Subject: [PATCH 122/415] complete friendly user and project routes fetaure * fixed buggy routing * added named routes to all custom routes * removed ProjectsHelper#pretty_project_tips_path in favor of named route * removed ProjectsHelper#pretty_project_deposits_path in favor of named route * refactored UserController#load_user into ApplicationController#load_user to be shared with TipsController * added project:fetch_pending to locales (translation required) * fixed bug in 'I should be on the "" page' step that matchd '/' to everything --- app/controllers/application_controller.rb | 49 +++++++++++++++++------ app/controllers/deposits_controller.rb | 2 +- app/controllers/projects_controller.rb | 7 +--- app/controllers/tips_controller.rb | 8 ++-- app/controllers/users_controller.rb | 39 +++++++++++------- app/helpers/projects_helper.rb | 8 ---- app/views/projects/show.html.haml | 2 +- config/locales/en.yml | 1 + config/locales/fr.yml | 1 + config/locales/hr.yml | 1 + config/locales/pl.yml | 1 + config/locales/ru.yml | 1 + config/routes.rb | 43 +++++++++----------- spec/controllers/users_controller_spec.rb | 12 ++++-- 14 files changed, 101 insertions(+), 74 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 04bf89af..0c334652 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -23,29 +23,54 @@ def load_locale end def load_project params - (is_project = self.is_a? ProjectsController) || - (is_tips = self.is_a? TipsController ) || - (is_deposits = self.is_a? DepositsController) + return unless (is_via_project = self.is_a? ProjectsController) || + (is_via_tips = self.is_a? TipsController ) || + (is_via_deposits = self.is_a? DepositsController) - if params[:project_id].present? || params[:id].present? - return unless project_id = (is_project && params[:id]) || - ((is_tips || is_deposits) && params[:project_id]) + is_standard_path = params[:id] .present? && is_via_project + is_association_path = params[:project_id].present? + is_pretty_path = params[:service] .present? && params[:repo].present? + return unless is_standard_path || is_association_path || is_pretty_path - @project = Project.where(:id => project_id).first - - if is_tips + if (is_standard_path || is_association_path) && + (project_id = (is_via_project)? params[:id] : params[:project_id]) && + (@project = (Project.where :id => project_id).first) + if is_via_tips redirect_to project_tips_pretty_path @project.host , @project.full_name - elsif is_deposits + elsif is_via_deposits redirect_to project_deposits_pretty_path @project.host , @project.full_name end - elsif params[:service].present? && params[:repo].present? + elsif is_pretty_path @project = Project.where(host: params[:service]). where('lower(`full_name`) = ?' , params[:repo].downcase).first end - if @project.nil? && is_project + if @project.nil? flash[:error] = I18n.t('errors.project_not_found') redirect_to projects_path end end + + def load_user params + return unless (is_via_user = self.is_a? UsersController) || + (is_via_tips = self.is_a? TipsController) + + return unless (is_standard_path = params[:id] .present? && is_via_user) || + (is_association_path = params[:user_id] .present?) || + (is_pretty_path = params[:nickname].present?) + + if (is_standard_path || is_association_path) && + (user_id = (is_via_user && params[:id]) || + (is_via_tips && params[:user_id])) && + (@user = User.where(:id => user_id).first) + redirect_to user_tips_pretty_path @user.nickname if is_via_tips + elsif is_pretty_path + @user = User.where('lower(`nickname`) = ?' , params[:nickname].downcase).first + end + + if @user.nil? + flash[:error] = I18n.t('errors.user_not_found') + redirect_to users_path + end + end end diff --git a/app/controllers/deposits_controller.rb b/app/controllers/deposits_controller.rb index b0b15d93..39c77758 100644 --- a/app/controllers/deposits_controller.rb +++ b/app/controllers/deposits_controller.rb @@ -2,7 +2,7 @@ class DepositsController < ApplicationController before_action { load_project params } def index - if @project + if @project.present? @deposits = @project.deposits else @deposits = Deposit.includes(:project) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 8f63fcfa..b3f12d7f 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -4,8 +4,7 @@ class ProjectsController < ApplicationController include ProjectsHelper before_filter :load_project, only: [:show, :edit, :update, :decide_tip_amounts] - before_filter :redirect_to_pretty_url, only: [:show, :edit, :decide_tip_amounts, - :tips, :deposits] + before_filter :redirect_to_pretty_url, only: [:show, :edit, :decide_tip_amounts] def index @projects = Project.order(projects_order).page(params[:page]).per(30) @@ -102,10 +101,6 @@ def redirect_to_pretty_url path = pretty_project_edit_path @project when 'decide_tip_amounts' path = pretty_project_decide_tip_amounts_path @project - when 'tips' - path = pretty_project_tips_path @project - when 'deposits' - path = pretty_project_deposits_path @project end format.html { redirect_to path } end diff --git a/app/controllers/tips_controller.rb b/app/controllers/tips_controller.rb index 46c52463..333fcf22 100644 --- a/app/controllers/tips_controller.rb +++ b/app/controllers/tips_controller.rb @@ -1,12 +1,12 @@ class TipsController < ApplicationController before_filter { load_project params } + before_filter { load_user params } def index - if @project + if @project.present? @tips = @project.tips.includes(:user).with_address - elsif params[:user_id] - @user = User.find params[:user_id] - if @user.present? && @user.bitcoin_address.present? + elsif @user.present? + if @user.bitcoin_address.present? @tips = @user.tips.includes(:project) else flash[:error] = I18n.t('errors.user_not_found') diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 4286f7b1..2dfbc84d 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,6 +1,6 @@ class UsersController < ApplicationController - before_action :authenticate_user!, :load_user, :valid_user!, except: [:login, :index] + before_filter :redirect_to_pretty_url, only: [:show] def show @user_tips = @user.tips @@ -34,23 +34,34 @@ def login end end + private - def users_params - params.require(:user).permit(:bitcoin_address, :password, :password_confirmation, :unsubscribed, :display_name) - end - def load_user - @user = User.where(id: params[:id]).first - unless @user - flash[:error] = I18n.t('errors.user_not_found') - redirect_to root_path and return - end + def users_params + params.require(:user).permit(:bitcoin_address, :password, :password_confirmation, :unsubscribed, :display_name) + end + + def load_user ; super params ; end ; + + def valid_user! + if current_user != @user + flash[:error] = I18n.t('errors.access_denied') + redirect_to root_path and return end + end - def valid_user! - if current_user != @user - flash[:error] = I18n.t('errors.access_denied') - redirect_to root_path and return + def redirect_to_pretty_url + return unless request.get? && params[:id].present? && @user.nickname.present? + + begin + respond_to do |format| + case action_name + when 'show' + path = user_pretty_path @user.nickname + end + format.html { redirect_to path } end + rescue ActionController::UnknownFormat end + end end diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 7d0376fd..5911ecd9 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -30,14 +30,6 @@ def pretty_project_decide_tip_amounts_path project "#{pretty_project_path project}/decide_tip_amounts" end - def pretty_project_tips_path project - "#{pretty_project_path project}/tips" - end - - def pretty_project_deposits_path project - "#{pretty_project_path project}/deposits" - end - def pretty_project_url project root_url.gsub(/\/$/,'') + pretty_project_path(project) end diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 6786b191..4793efed 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -11,7 +11,7 @@ %small= link_to glyph(:github), @project.github_url, target: '_blank' .pull-right - if @project.collaborators.empty? - = "(Pending initial sync)" + = t('.fetch_pending') - if can? :update, @project = link_to t('.edit_project'), edit_project_path(@project), class: "btn btn-primary" - if can? :decide_tip_amounts, @project and @project.has_undecided_tips? diff --git a/config/locales/en.yml b/config/locales/en.yml index 7c951c67..58c23604 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -79,6 +79,7 @@ en: support: Support project show: title: "Contribute to %{project}" + fetch_pending: (Pending initial fetch) edit_project: Change project settings decide_tip_amounts: Decide tip amounts disabled_notifications: "Project maintainers have decided not to notify new contributors about tips and they probably don't like this way of funding." diff --git a/config/locales/fr.yml b/config/locales/fr.yml index ac389f6e..fbda1b23 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -79,6 +79,7 @@ fr: support: Subventionner show: title: "Contribuer à %{project}" + fetch_pending: (Pending initial fetch) edit_project: Changer les paramètres du projet decide_tip_amounts: Choisir un montant de pourboire disabled_notifications: "Les responsables du projet ont décidé de ne pas prévenir les nouveaux contributeurs au sujet des pourboires, et n'apprécient probablement pas ce type de rémunération." diff --git a/config/locales/hr.yml b/config/locales/hr.yml index 87339483..ebfdb6c7 100644 --- a/config/locales/hr.yml +++ b/config/locales/hr.yml @@ -79,6 +79,7 @@ hr: support: Podrzavaj show: title: "Doprinosi %{project}" + fetch_pending: (Pending initial fetch) edit_project: Promijeni postavke projekta decide_tip_amounts: Odredi kolicinu napojnica disabled_notifications: "Odrzavatelji projekata su odlucili da nece obavjestiti nove doprinositelje o napojnicama i najvjerovatnije ne vole ovaj nacin isplate." diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 246e8eda..d47796a5 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -79,6 +79,7 @@ pl: support: Pomoc show: title: "Współpracuj z %{project}" + fetch_pending: (Pending initial fetch) edit_project: Zmień ustawienia projektu decide_tip_amounts: Ustal rozmiary napiwków disabled_notifications: "Nadzorcy projektów zdecydowali nie powiadamiać nowych współpracowników o napiwkach i prawdopodobnie nie lubią tego typu finansowania." diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 8bb708d0..77692d4d 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -79,6 +79,7 @@ ru: support: "Поддержать проект" show: title: "Помогайте %{project}" + fetch_pending: (Pending initial fetch) edit_project: Изменить настройки проекта decide_tip_amounts: Установить сумму чаевых disabled_notifications: "Контрибьюторы проекта решили не уведомлять новых участников о чаевых и, вероятно, им не нравится такой способ финансирования." diff --git a/config/routes.rb b/config/routes.rb index 7c32ee7b..3e841aa4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,31 +2,29 @@ root 'home#index' - get '/blockchain_info_callback' => "home#blockchain_info_callback", :as => "blockchain_info_callback" + devise_for :users, + :controllers => { :omniauth_callbacks => 'users/omniauth_callbacks' } - # reserved devise routes (rejected pertty url usernames) - RESERVED_USER_ROUTES_REGEX = /(^(?:(?!^\d+$|\b(sign_in|cancel|sign_up|edit|confirmation|login)\b).)*$)/ - get '/users/:name/tips' => 'tips#index', :constraints => {:name => /\RESERVED_USER_ROUTES_REGEX/} - get '/users/:name' => 'users#show', :constraints => {:name => /\RESERVED_USER_ROUTES_REGEX/} + get '/blockchain_info_callback' => 'home#blockchain_info_callback' , :as => 'blockchain_info_callback' - get '/projects/:project_id/tips' => 'tips#index', :constraints => {:project_id => /\d+/}, :as => 'project_tips' - get '/projects/:project_id/deposits' => 'deposits#index', :constraints => {:project_id => /\d+/}, :as => 'project_deposits' - get '/:service/:repo/edit' => 'projects#edit', :constraints => {:service => /github/, :repo => /.+/} - get '/:service/:repo/decide_tip_amounts' => 'projects#decide_tip_amounts', :constraints => {:service => /github/, :repo => /.+/} - get '/:service/:repo/tips' => 'tips#index', :constraints => {:service => /github/, :repo => /.+/}, :as => 'project_tips_pretty' - get '/:service/:repo/deposits' => 'deposits#index', :constraints => {:service => /github/, :repo => /.+/}, :as => 'project_deposits_pretty' - get '/:service/:repo' => 'projects#show', :constraints => {:service => /github/, :repo => /.+/} + get '/users/login' => 'users#login' , :as => 'login_users' + get '/users/:user_id/tips' => 'tips#index' , :constraints => {:user_id => /\d+/} , :as => 'user_tips' + get '/users/:nickname/tips' => 'tips#index' , :constraints => {:nickname => /\D+/} , :as => 'user_tips_pretty' + get '/users/:nickname' => 'users#show' , :constraints => {:nickname => /\D+/} , :as => 'user_pretty' - devise_for :users, - :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" } + get '/projects/:project_id/tips' => 'tips#index' , :constraints => {:project_id => /\d+/} , :as => 'project_tips' + get '/projects/:project_id/deposits' => 'deposits#index' , :constraints => {:project_id => /\d+/} , :as => 'project_deposits' + get '/:service/:repo/edit' => 'projects#edit' , :constraints => {:service => /github/ , :repo => /.+/} , :as => 'project_edit_pretty' + get '/:service/:repo/decide_tip_amounts' => 'projects#decide_tip_amounts' , :constraints => {:service => /github/ , :repo => /.+/} , :as => 'project_decide_tips_pretty' + get '/:service/:repo/tips' => 'tips#index' , :constraints => {:service => /github/ , :repo => /.+/} , :as => 'project_tips_pretty' + get '/:service/:repo/deposits' => 'deposits#index' , :constraints => {:service => /github/ , :repo => /.+/} , :as => 'project_deposits_pretty' + get '/:service/:repo' => 'projects#show' , :constraints => {:service => /github/ , :repo => /.+/} , :as => 'project_pretty' - resources :users, :only => [:show, :update, :index] do - collection do - get :login - end - resources :tips, :only => [:index] - end - resources :projects, :only => [:show, :index, :edit, :update] do + resources :tips , :only => [:index] + resources :deposits , :only => [:index] + resources :withdrawals , :only => [:index] + resources :users , :only => [:index , :show , :update] + resources :projects , :only => [:index , :show , :update , :edit ] do collection do get 'search' end @@ -35,9 +33,6 @@ patch :decide_tip_amounts end end - resources :tips, :only => [:index] - resources :deposits, :only => [:index] - resources :withdrawals, :only => [:index] get '*path' => 'home#index' end diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index f5f09135..b1cb90cd 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -2,8 +2,10 @@ describe UsersController do describe '#show' do - let(:user) { mock_model User, id: 100000000 } - let(:subject) { get :show, id: user.id } +# let(:user) { mock_model User, id: 100000000 } +# let(:subject) { get :show, id: user.id } + let(:user) { create(:user) } + let(:subject) { get :show , :nickname => user.nickname } context 'when logged in' do login_user @@ -36,8 +38,10 @@ end context 'when user not found' do - it 'redirect to root_path' do - expect(subject).to redirect_to root_path + let(:subject) { get :show , :nickname => 'unknown-user' } + + it 'redirect to users_path' do + expect(subject).to redirect_to users_path end it 'sets flash error message' do From bae2c1b45527afd4aa558f454c6a696410477cec Mon Sep 17 00:00:00 2001 From: bill auger Date: Sat, 8 Nov 2014 00:26:43 +0000 Subject: [PATCH 123/415] add more tests * merged latest project-management branch * added more examples to spec/controllers/users_controller_spec.rb * added more examples to spec/controllers/projects_controller_spec.rb * added more scenarios to features/manage_project.feature * added more scenarios to features/pretty_paths.feature * added more scenarios to features/sign_up_sign_in.feature --- app/assets/javascripts/i18n/translations.js | 2 +- app/controllers/application_controller.rb | 49 +++-- app/controllers/deposits_controller.rb | 2 +- app/controllers/projects_controller.rb | 7 +- app/controllers/tips_controller.rb | 8 +- app/controllers/users_controller.rb | 39 ++-- app/helpers/projects_helper.rb | 8 - app/views/projects/show.html.haml | 2 +- config/locales/en.yml | 1 + config/locales/fr.yml | 1 + config/locales/hr.yml | 1 + config/locales/pl.yml | 1 + config/locales/ru.yml | 1 + config/routes.rb | 43 ++--- features/find_or_create_project.feature | 14 +- features/manage_project.feature | 29 ++- features/pretty_paths.feature | 192 ++++++++++++++++--- features/sign_up_sign_in.feature | 138 +++++++++++-- features/step_definitions/common.rb | 66 +++++-- features/step_definitions/home_steps.rb | 9 +- features/tip_modifier_interface.feature | 18 +- features/tipping_policies.feature | 4 +- spec/controllers/projects_controller_spec.rb | 68 +++++-- spec/controllers/users_controller_spec.rb | 31 +-- 24 files changed, 553 insertions(+), 181 deletions(-) diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js index ac0ec161..e07bd2ae 100644 --- a/app/assets/javascripts/i18n/translations.js +++ b/app/assets/javascripts/i18n/translations.js @@ -1,2 +1,2 @@ var I18n = I18n || {}; -I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}}}; \ No newline at end of file +I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}}}; \ No newline at end of file diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 04bf89af..0c334652 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -23,29 +23,54 @@ def load_locale end def load_project params - (is_project = self.is_a? ProjectsController) || - (is_tips = self.is_a? TipsController ) || - (is_deposits = self.is_a? DepositsController) + return unless (is_via_project = self.is_a? ProjectsController) || + (is_via_tips = self.is_a? TipsController ) || + (is_via_deposits = self.is_a? DepositsController) - if params[:project_id].present? || params[:id].present? - return unless project_id = (is_project && params[:id]) || - ((is_tips || is_deposits) && params[:project_id]) + is_standard_path = params[:id] .present? && is_via_project + is_association_path = params[:project_id].present? + is_pretty_path = params[:service] .present? && params[:repo].present? + return unless is_standard_path || is_association_path || is_pretty_path - @project = Project.where(:id => project_id).first - - if is_tips + if (is_standard_path || is_association_path) && + (project_id = (is_via_project)? params[:id] : params[:project_id]) && + (@project = (Project.where :id => project_id).first) + if is_via_tips redirect_to project_tips_pretty_path @project.host , @project.full_name - elsif is_deposits + elsif is_via_deposits redirect_to project_deposits_pretty_path @project.host , @project.full_name end - elsif params[:service].present? && params[:repo].present? + elsif is_pretty_path @project = Project.where(host: params[:service]). where('lower(`full_name`) = ?' , params[:repo].downcase).first end - if @project.nil? && is_project + if @project.nil? flash[:error] = I18n.t('errors.project_not_found') redirect_to projects_path end end + + def load_user params + return unless (is_via_user = self.is_a? UsersController) || + (is_via_tips = self.is_a? TipsController) + + return unless (is_standard_path = params[:id] .present? && is_via_user) || + (is_association_path = params[:user_id] .present?) || + (is_pretty_path = params[:nickname].present?) + + if (is_standard_path || is_association_path) && + (user_id = (is_via_user && params[:id]) || + (is_via_tips && params[:user_id])) && + (@user = User.where(:id => user_id).first) + redirect_to user_tips_pretty_path @user.nickname if is_via_tips + elsif is_pretty_path + @user = User.where('lower(`nickname`) = ?' , params[:nickname].downcase).first + end + + if @user.nil? + flash[:error] = I18n.t('errors.user_not_found') + redirect_to users_path + end + end end diff --git a/app/controllers/deposits_controller.rb b/app/controllers/deposits_controller.rb index b0b15d93..39c77758 100644 --- a/app/controllers/deposits_controller.rb +++ b/app/controllers/deposits_controller.rb @@ -2,7 +2,7 @@ class DepositsController < ApplicationController before_action { load_project params } def index - if @project + if @project.present? @deposits = @project.deposits else @deposits = Deposit.includes(:project) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 8f63fcfa..b3f12d7f 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -4,8 +4,7 @@ class ProjectsController < ApplicationController include ProjectsHelper before_filter :load_project, only: [:show, :edit, :update, :decide_tip_amounts] - before_filter :redirect_to_pretty_url, only: [:show, :edit, :decide_tip_amounts, - :tips, :deposits] + before_filter :redirect_to_pretty_url, only: [:show, :edit, :decide_tip_amounts] def index @projects = Project.order(projects_order).page(params[:page]).per(30) @@ -102,10 +101,6 @@ def redirect_to_pretty_url path = pretty_project_edit_path @project when 'decide_tip_amounts' path = pretty_project_decide_tip_amounts_path @project - when 'tips' - path = pretty_project_tips_path @project - when 'deposits' - path = pretty_project_deposits_path @project end format.html { redirect_to path } end diff --git a/app/controllers/tips_controller.rb b/app/controllers/tips_controller.rb index 46c52463..333fcf22 100644 --- a/app/controllers/tips_controller.rb +++ b/app/controllers/tips_controller.rb @@ -1,12 +1,12 @@ class TipsController < ApplicationController before_filter { load_project params } + before_filter { load_user params } def index - if @project + if @project.present? @tips = @project.tips.includes(:user).with_address - elsif params[:user_id] - @user = User.find params[:user_id] - if @user.present? && @user.bitcoin_address.present? + elsif @user.present? + if @user.bitcoin_address.present? @tips = @user.tips.includes(:project) else flash[:error] = I18n.t('errors.user_not_found') diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 4286f7b1..2dfbc84d 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,6 +1,6 @@ class UsersController < ApplicationController - before_action :authenticate_user!, :load_user, :valid_user!, except: [:login, :index] + before_filter :redirect_to_pretty_url, only: [:show] def show @user_tips = @user.tips @@ -34,23 +34,34 @@ def login end end + private - def users_params - params.require(:user).permit(:bitcoin_address, :password, :password_confirmation, :unsubscribed, :display_name) - end - def load_user - @user = User.where(id: params[:id]).first - unless @user - flash[:error] = I18n.t('errors.user_not_found') - redirect_to root_path and return - end + def users_params + params.require(:user).permit(:bitcoin_address, :password, :password_confirmation, :unsubscribed, :display_name) + end + + def load_user ; super params ; end ; + + def valid_user! + if current_user != @user + flash[:error] = I18n.t('errors.access_denied') + redirect_to root_path and return end + end - def valid_user! - if current_user != @user - flash[:error] = I18n.t('errors.access_denied') - redirect_to root_path and return + def redirect_to_pretty_url + return unless request.get? && params[:id].present? && @user.nickname.present? + + begin + respond_to do |format| + case action_name + when 'show' + path = user_pretty_path @user.nickname + end + format.html { redirect_to path } end + rescue ActionController::UnknownFormat end + end end diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 7d0376fd..5911ecd9 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -30,14 +30,6 @@ def pretty_project_decide_tip_amounts_path project "#{pretty_project_path project}/decide_tip_amounts" end - def pretty_project_tips_path project - "#{pretty_project_path project}/tips" - end - - def pretty_project_deposits_path project - "#{pretty_project_path project}/deposits" - end - def pretty_project_url project root_url.gsub(/\/$/,'') + pretty_project_path(project) end diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 6786b191..4793efed 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -11,7 +11,7 @@ %small= link_to glyph(:github), @project.github_url, target: '_blank' .pull-right - if @project.collaborators.empty? - = "(Pending initial sync)" + = t('.fetch_pending') - if can? :update, @project = link_to t('.edit_project'), edit_project_path(@project), class: "btn btn-primary" - if can? :decide_tip_amounts, @project and @project.has_undecided_tips? diff --git a/config/locales/en.yml b/config/locales/en.yml index 7c951c67..58c23604 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -79,6 +79,7 @@ en: support: Support project show: title: "Contribute to %{project}" + fetch_pending: (Pending initial fetch) edit_project: Change project settings decide_tip_amounts: Decide tip amounts disabled_notifications: "Project maintainers have decided not to notify new contributors about tips and they probably don't like this way of funding." diff --git a/config/locales/fr.yml b/config/locales/fr.yml index ac389f6e..fbda1b23 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -79,6 +79,7 @@ fr: support: Subventionner show: title: "Contribuer à %{project}" + fetch_pending: (Pending initial fetch) edit_project: Changer les paramètres du projet decide_tip_amounts: Choisir un montant de pourboire disabled_notifications: "Les responsables du projet ont décidé de ne pas prévenir les nouveaux contributeurs au sujet des pourboires, et n'apprécient probablement pas ce type de rémunération." diff --git a/config/locales/hr.yml b/config/locales/hr.yml index ffec3b58..6250d53f 100644 --- a/config/locales/hr.yml +++ b/config/locales/hr.yml @@ -79,6 +79,7 @@ hr: support: Podrzavaj show: title: "Doprinosi %{project}" + fetch_pending: (Pending initial fetch) edit_project: Promijeni postavke projekta decide_tip_amounts: Odredi kolicinu napojnica disabled_notifications: "Odrzavatelji projekata su odlucili da nece obavjestiti nove doprinositelje o napojnicama i najvjerovatnije ne vole ovaj nacin isplate." diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 246e8eda..d47796a5 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -79,6 +79,7 @@ pl: support: Pomoc show: title: "Współpracuj z %{project}" + fetch_pending: (Pending initial fetch) edit_project: Zmień ustawienia projektu decide_tip_amounts: Ustal rozmiary napiwków disabled_notifications: "Nadzorcy projektów zdecydowali nie powiadamiać nowych współpracowników o napiwkach i prawdopodobnie nie lubią tego typu finansowania." diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 8bb708d0..77692d4d 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -79,6 +79,7 @@ ru: support: "Поддержать проект" show: title: "Помогайте %{project}" + fetch_pending: (Pending initial fetch) edit_project: Изменить настройки проекта decide_tip_amounts: Установить сумму чаевых disabled_notifications: "Контрибьюторы проекта решили не уведомлять новых участников о чаевых и, вероятно, им не нравится такой способ финансирования." diff --git a/config/routes.rb b/config/routes.rb index 7c32ee7b..3e841aa4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,31 +2,29 @@ root 'home#index' - get '/blockchain_info_callback' => "home#blockchain_info_callback", :as => "blockchain_info_callback" + devise_for :users, + :controllers => { :omniauth_callbacks => 'users/omniauth_callbacks' } - # reserved devise routes (rejected pertty url usernames) - RESERVED_USER_ROUTES_REGEX = /(^(?:(?!^\d+$|\b(sign_in|cancel|sign_up|edit|confirmation|login)\b).)*$)/ - get '/users/:name/tips' => 'tips#index', :constraints => {:name => /\RESERVED_USER_ROUTES_REGEX/} - get '/users/:name' => 'users#show', :constraints => {:name => /\RESERVED_USER_ROUTES_REGEX/} + get '/blockchain_info_callback' => 'home#blockchain_info_callback' , :as => 'blockchain_info_callback' - get '/projects/:project_id/tips' => 'tips#index', :constraints => {:project_id => /\d+/}, :as => 'project_tips' - get '/projects/:project_id/deposits' => 'deposits#index', :constraints => {:project_id => /\d+/}, :as => 'project_deposits' - get '/:service/:repo/edit' => 'projects#edit', :constraints => {:service => /github/, :repo => /.+/} - get '/:service/:repo/decide_tip_amounts' => 'projects#decide_tip_amounts', :constraints => {:service => /github/, :repo => /.+/} - get '/:service/:repo/tips' => 'tips#index', :constraints => {:service => /github/, :repo => /.+/}, :as => 'project_tips_pretty' - get '/:service/:repo/deposits' => 'deposits#index', :constraints => {:service => /github/, :repo => /.+/}, :as => 'project_deposits_pretty' - get '/:service/:repo' => 'projects#show', :constraints => {:service => /github/, :repo => /.+/} + get '/users/login' => 'users#login' , :as => 'login_users' + get '/users/:user_id/tips' => 'tips#index' , :constraints => {:user_id => /\d+/} , :as => 'user_tips' + get '/users/:nickname/tips' => 'tips#index' , :constraints => {:nickname => /\D+/} , :as => 'user_tips_pretty' + get '/users/:nickname' => 'users#show' , :constraints => {:nickname => /\D+/} , :as => 'user_pretty' - devise_for :users, - :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" } + get '/projects/:project_id/tips' => 'tips#index' , :constraints => {:project_id => /\d+/} , :as => 'project_tips' + get '/projects/:project_id/deposits' => 'deposits#index' , :constraints => {:project_id => /\d+/} , :as => 'project_deposits' + get '/:service/:repo/edit' => 'projects#edit' , :constraints => {:service => /github/ , :repo => /.+/} , :as => 'project_edit_pretty' + get '/:service/:repo/decide_tip_amounts' => 'projects#decide_tip_amounts' , :constraints => {:service => /github/ , :repo => /.+/} , :as => 'project_decide_tips_pretty' + get '/:service/:repo/tips' => 'tips#index' , :constraints => {:service => /github/ , :repo => /.+/} , :as => 'project_tips_pretty' + get '/:service/:repo/deposits' => 'deposits#index' , :constraints => {:service => /github/ , :repo => /.+/} , :as => 'project_deposits_pretty' + get '/:service/:repo' => 'projects#show' , :constraints => {:service => /github/ , :repo => /.+/} , :as => 'project_pretty' - resources :users, :only => [:show, :update, :index] do - collection do - get :login - end - resources :tips, :only => [:index] - end - resources :projects, :only => [:show, :index, :edit, :update] do + resources :tips , :only => [:index] + resources :deposits , :only => [:index] + resources :withdrawals , :only => [:index] + resources :users , :only => [:index , :show , :update] + resources :projects , :only => [:index , :show , :update , :edit ] do collection do get 'search' end @@ -35,9 +33,6 @@ patch :decide_tip_amounts end end - resources :tips, :only => [:index] - resources :deposits, :only => [:index] - resources :withdrawals, :only => [:index] get '*path' => 'home#index' end diff --git a/features/find_or_create_project.feature b/features/find_or_create_project.feature index bf77b2c5..dccda37f 100644 --- a/features/find_or_create_project.feature +++ b/features/find_or_create_project.feature @@ -7,7 +7,7 @@ Feature: Visitors may search for and add projects And I visit the "projects" page Then I should be on the "projects" page When I fill "query" with: "seldons-project" - And I click on "Find or add project" + And I click "Find or add project" Then I should be on the "search" page And I should see "seldon/seldons-project" But I should not see "project not found" @@ -17,7 +17,7 @@ Feature: Visitors may search for and add projects And I visit the "projects" page Then I should be on the "projects" page When I fill "query" with: "no-such-repo" - And I click on "Find or add project" + And I click "Find or add project" Then I should be on the "search" page And I should see "Project not found" But I should not see "seldon/seldons-project" @@ -27,7 +27,7 @@ Feature: Visitors may search for and add projects And I visit the "projects" page Then I should be on the "projects" page When I fill "query" with: "https://github.com/tip4commit/tip4commit" - And I click on "Find or add project" + And I click "Find or add project" Then I should be on the "tip4commit/tip4commit github-project" page And I should see "tip4commit/tip4commit" But I should not see "seldon/seldons-project" @@ -37,7 +37,7 @@ Feature: Visitors may search for and add projects And I visit the "projects" page Then I should be on the "projects" page When I fill "query" with: "https://github.com/xxx-no-such-user-xxx/xxx-no-such-repo-xxx" - And I click on "Find or add project" + And I click "Find or add project" Then I should be on the "search" page And I should see "Project not found" But I should not see "xxx-no-such-repo-xxx" @@ -48,7 +48,7 @@ Feature: Visitors may search for and add projects And I visit the "projects" page Then I should be on the "projects" page When I fill "query" with: "https://shithub.com/nouser/norepo" - And I click on "Find or add project" + And I click "Find or add project" Then I should be on the "search" page And I should see "Project not found" But I should not see "norepo" @@ -59,7 +59,7 @@ Feature: Visitors may search for and add projects And I visit the "projects" page Then I should be on the "projects" page When I fill "query" with: "seldons-project" - And I click on "Find or add project" + And I click "Find or add project" Then I should be on the "search" page And I should see "seldon/seldons-project" And there should not be a project avatar image visible @@ -69,7 +69,7 @@ Feature: Visitors may search for and add projects And I visit the "projects" page Then I should be on the "projects" page When I fill "query" with: "https://github.com/tip4commit/tip4commit" - And I click on "Find or add project" + And I click "Find or add project" Then I should be on the "tip4commit/tip4commit github-project" page And I should see "tip4commit/tip4commit" And there should be a project avatar image visible diff --git a/features/manage_project.feature b/features/manage_project.feature index 975e2f84..25ef620c 100644 --- a/features/manage_project.feature +++ b/features/manage_project.feature @@ -1,8 +1,10 @@ Feature: Collaborators may manage project Background: Given a "github" project named "seldon/seldons-project" exists + # NOTE: "seldon" is automatically a collaborator - Scenario: Collaborators must be signed in to manage project + + Scenario: Visitors may not manage projects Given I'm not signed in When I visit the "seldon/seldons-project github-project" page Then I should be on the "seldon/seldons-project github-project" page @@ -19,6 +21,10 @@ Feature: Collaborators may manage project And I should not see "Change project settings" And I should not see "Decide tips" + When I visit the "seldon/seldons-project github-project edit" page + Then I should be on the "home" page + And I should see "You are not authorized to perform this action" + Scenario: Non-collaborators should not be able to manage project Given I'm signed in as "someone-else" When I visit the "seldon/seldons-project github-project" page @@ -36,6 +42,10 @@ Feature: Collaborators may manage project And I should not see "Change project settings" And I should not see "Decide tips" + When I visit the "seldon/seldons-project github-project edit" page + Then I should be on the "home" page + And I should see "You are not authorized to perform this action" + Scenario: New projects should show "Pending initial sync" Given I'm signed in as "seldon" When I visit the "seldon/seldons-project github-project" page @@ -52,3 +62,20 @@ Feature: Collaborators may manage project But I should not see "Pending initial sync" And I should see "Change project settings" But I should not see "Decide tips" + + Scenario: Collaborators may sign in to manage project + Given I'm signed in as "seldon" + When the project syncs with the remote repo + And I visit the "seldon/seldons-project github-project" page + Then I should be on the "seldon/seldons-project github-project" page + And I should see "seldon/seldons-project" + And I should see "Change project settings" + But I should not see "Pending initial sync" + And I should not see "Decide tips" + + When I click "Change project settings" + Then I should be on the "seldon/seldons-project github-project edit" page + And I should see "seldon/seldons-project project settings" + When I click "Save the project settings" + Then I should be on the "seldon/seldons-project github-project" page + And I should see "The project settings have been updated" diff --git a/features/pretty_paths.feature b/features/pretty_paths.feature index c7606fb4..343952d7 100644 --- a/features/pretty_paths.feature +++ b/features/pretty_paths.feature @@ -1,45 +1,175 @@ Feature: The site routes pretty paths uniformly Background: Given a "github" project named "seldon/seldons-project" exists - And a user named "yugo" exists with a bitcoin address + And a user named "seldon" exists with a bitcoin address + And a user named "yugo" exists without a bitcoin address - Scenario: Project show page is accessible via pretty path - When I visit the "seldon/seldons-project github-project" page - Then I should be on the "seldon/seldons-project github-project" page + ### Project routes ### - Scenario: Project show page is accessible via id - When I browse to the explicit path "projects/1" - Then I should be on the "seldon/seldons-project github-project" page + Scenario: Project index page is accessible via standard path + When I visit the "projects" page + Then I should be on the "projects" page - Scenario: Project edit page is accessible via pretty path - When I visit the "seldon/seldons-project github-project edit" page - Then I should be on the "seldon/seldons-project github-project edit" page + Scenario: Project show page is accessible via project name + When I visit the "seldon/seldons-project github-project" page + Then I should be on the "seldon/seldons-project github-project" page - Scenario: Project show page is accessible via id - When I browse to the explicit path "projects/1/edit" - Then I should be on the "seldon/seldons-project github-project edit" page + Scenario: Project show page is accessible via project id + When I browse to the explicit path "projects/1" + Then I should be on the "seldon/seldons-project github-project" page - Scenario: Project decide_tip_amounts page is accessible via pretty path - When I visit the "seldon/seldons-project github-project decide_tip_amounts" page - Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page + Scenario: Project edit page is accessible via project name + Given I'm signed in as "seldon" + When the project syncs with the remote repo + And I visit the "seldon/seldons-project github-project edit" page + Then I should be on the "seldon/seldons-project github-project edit" page - Scenario: Project decide_tip_amounts page is accessible via id - When I browse to the explicit path "projects/1/decide_tip_amounts" - Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page + Scenario: Project edit page is accessible via project id + Given I'm signed in as "seldon" + When the project syncs with the remote repo + And I browse to the explicit path "projects/1/edit" + Then I should be on the "seldon/seldons-project github-project edit" page - Scenario: Project tips page is accessible via pretty path - When I visit the "seldon/seldons-project github-project tips" page - Then I should be on the "seldon/seldons-project github-project tips" page + Scenario: Project decide_tip_amounts page is accessible via project name + Given I'm signed in as "seldon" + When the project syncs with the remote repo + When I visit the "seldon/seldons-project github-project decide_tip_amounts" page + Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page - Scenario: Project tips page is accessible via id - When I browse to the explicit path "projects/1/tips" - Then I should be on the "seldon/seldons-project github-project tips" page + Scenario: Project decide_tip_amounts page is accessible via project id + Given I'm signed in as "seldon" + When the project syncs with the remote repo + When I browse to the explicit path "projects/1/decide_tip_amounts" + Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page - Scenario: Project deposits page is accessible via pretty path - When I visit the "seldon/seldons-project github-project deposits" page - Then I should be on the "seldon/seldons-project github-project deposits" page + Scenario: Project tips page is accessible via project name + When I visit the "seldon/seldons-project github-project tips" page + Then I should be on the "seldon/seldons-project github-project tips" page - Scenario: Project deposits page is accessible via id - When I browse to the explicit path "projects/1/deposits" - Then I should be on the "seldon/seldons-project github-project deposits" page + Scenario: Project tips page is accessible via project id + When I browse to the explicit path "projects/1/tips" + Then I should be on the "seldon/seldons-project github-project tips" page + + Scenario: Project deposits page is accessible via project name + When I visit the "seldon/seldons-project github-project deposits" page + Then I should be on the "seldon/seldons-project github-project deposits" page + + Scenario: Project deposits page is accessible via project id + When I browse to the explicit path "projects/1/deposits" + Then I should be on the "seldon/seldons-project github-project deposits" page + + Scenario: Unknown project show page via project name redirects to projects page + When I visit the "yugo/yugos-project github-project" page + Then I should be on the "projects" page + + Scenario: Unknown project show page via project id redirects to projects page + When I browse to the explicit path "projects/999999" + Then I should be on the "projects" page + + Scenario: Unknown project edit page via project name redirects to projects page + When I visit the "yugo/yugos-project github-project edit" page + Then I should be on the "projects" page + + Scenario: Unknown project edit page via project id redirects to projects page + When I browse to the explicit path "projects/999999/edit" + Then I should be on the "projects" page + + Scenario: Unknown project decide_tip_amounts page via project name redirects to projects page + When I visit the "yugo/yugos-project github-project decide_tip_amounts" page + Then I should be on the "projects" page + + Scenario: Unknown project decide_tip_amounts page via project id redirects to projects page + When I browse to the explicit path "projects/999999/decide_tip_amounts" + Then I should be on the "projects" page + + Scenario: Unknown project tips page via project name redirects to projects page + When I visit the "yugo/yugos-project github-project tips" page + Then I should be on the "projects" page + + Scenario: Unknown project tips page via project id redirects to projects page + When I browse to the explicit path "projects/999999/tips" + Then I should be on the "projects" page + + Scenario: Unknown project deposits page via project name redirects to projects page + When I visit the "yugo/yugos-project github-project deposits" page + Then I should be on the "projects" page + + Scenario: Unknown project deposits page via project id redirects to projects page + When I browse to the explicit path "projects/999999/deposits" + Then I should be on the "projects" page + + + ### User routes ### + + Scenario: User index page is accessible via standard path + When I visit the "users" page + Then I should be on the "users" page + + Scenario: User show page is inaccessible via user name when not signed in + When I visit the "seldon user" page + Then I should be on the "sign_in" page + And I should see "You need to sign in or sign up before continuing" + + Scenario: User show page is inaccessible via user id when not signed in + When I browse to the explicit path "users/1" + Then I should be on the "sign_in" page + And I should see "You need to sign in or sign up before continuing" + + Scenario: User show page is inaccessible via user name to other users + Given I'm signed in as "yugo" + When I visit the "seldon user" page + Then I should be on the "home" page + And I should see "You are not authorized to perform this action" + + Scenario: User show page is inaccessible via user id to other users + Given I'm signed in as "yugo" + When I browse to the explicit path "users/1" + Then I should be on the "home" page + And I should see "You are not authorized to perform this action" + + Scenario: User show page is accessible via user name to that user + Given I'm signed in as "seldon" + When I visit the "seldon user" page + Then I should be on the "seldon user" page + And I should see "seldon Balance 0.00000000 Ƀ" + And I should see "E-mail seldon@example.com" + And I should see "Bitcoin address" + + Scenario: User show page is accessible via user id to that user + Given I'm signed in as "seldon" + When I browse to the explicit path "users/1" + Then I should be on the "seldon user" page + And I should see "seldon Balance 0.00000000 Ƀ" + And I should see "E-mail seldon@example.com" + And I should see "Bitcoin address" + + Scenario: Unknown user tips page user name redirects to users page + When I visit the "unknown-user user tips" page + Then I should be on the "users" page + And I should see "User not found" + + Scenario: Unknown user tips page pretty id redirects to users page + When I browse to the explicit path "users/999999/tips" + Then I should be on the "users" page + And I should see "User not found" + + Scenario: User without bitcoin address tips page via user name redirects to users page + When I visit the "yugo user tips" page + Then I should be on the "users" page + And I should see "User not found" + + Scenario: User without bitcoin address tips page via user id redirects to users page + When I browse to the explicit path "users/2/tips" + Then I should be on the "users" page + And I should see "User not found" + + Scenario: User with bitcoin address tips page is accessible via user name + When I visit the "seldon user tips" page + Then I should be on the "seldon user tips" page + And I should see "seldon tips" + + Scenario: User with bitcoin address tips page is accessible via user id + When I browse to the explicit path "users/1/tips" + Then I should be on the "seldon user tips" page + And I should see "seldon tips" diff --git a/features/sign_up_sign_in.feature b/features/sign_up_sign_in.feature index c88e6ead..00c83c17 100644 --- a/features/sign_up_sign_in.feature +++ b/features/sign_up_sign_in.feature @@ -1,16 +1,16 @@ Feature: Visitors should be able to sign_up and sign_in Background: Given a "github" project named "seldon/seldons-project" exists - And the project collaborators are: - | seldon | + And a user named "seldon" exists without a bitcoin address + Scenario Outline: Visitors should see sign_up and sign_in links on all pages Given I'm not signed in When I visit the page Then I should be on the page - And I should see "Sign up" in the header - And I should see "Sign in" in the header - But I should not see "Sign out" in the header + And I should see "Sign up" in the "header" area + And I should see "Sign in" in the "header" area + But I should not see "Sign out" in the "header" area Examples: | page | | "home" | @@ -27,25 +27,26 @@ Feature: Visitors should be able to sign_up and sign_in Given I'm not signed in When I visit the "sign_in" page Then I should be on the "sign_in" page - And I should see "Sign up" in the header - But I should not see "Sign in" in the header - And I should not see "Sign out" in the header + And I should see "Sign up" in the "header" area + But I should not see "Sign in" in the "header" area + And I should not see "Sign out" in the "header" area Scenario: Visitors should see sign_in but not sign_up links on sign_up page Given I'm not signed in When I visit the "sign_up" page Then I should be on the "sign_up" page - And I should not see "Sign up" in the header - But I should see "Sign in" in the header - And I should not see "Sign out" in the header + And I should not see "Sign up" in the "header" area + But I should see "Sign in" in the "header" area + And I should not see "Sign out" in the "header" area Scenario Outline: Logged in users should see only sign_out link on every page Given I'm signed in as "seldon" - When I visit the page + When the project syncs with the remote repo + And I visit the page Then I should be on the page - And I should not see "Sign up" in the header - And I should not see "Sign in" in the header - But I should see "Sign out" in the header + And I should not see "Sign up" in the "header" area + And I should not see "Sign in" in the "header" area + But I should see "Sign out" in the "header" area Examples: | page | | "home" | @@ -59,3 +60,110 @@ Feature: Visitors should be able to sign_up and sign_in | "seldon/seldons-project github-project decide_tip_amounts" | | "seldon/seldons-project github-project tips" | | "seldon/seldons-project github-project deposits" | + + Scenario: Devise rejects invalid logins + Given I'm not signed in + When I visit the "sign_in" page + Then I should be on the "sign_in" page + And I should see "Sign in E-mail Password Remember me" + When I fill "E-mail" with: "unknown-user@somehost.net" + And I fill "Password" with: "unknown-users-password" + And I click "Sign in" + Then I should be on the "sign_in" page + And I should see "Invalid email or password" + When I fill "E-mail" with: "seldon@example.com" + And I fill "Password" with: "incorrect-password" + And I click "Sign in" + Then I should be on the "sign_in" page + And I should see "Invalid email or password" + + Scenario: Visitors should be able to sign up with an email address + Given I'm not signed in + When I visit the "home" page + When I click "Sign up" within the "header" area + Then I should be on the "sign_up" page + And I should see "Sign up E-mail Password Password confirmation" + + When I fill "E-mail" with: "new-guy@example.com" + And I fill "Password" with: "new-guys-password" + And I fill "Password confirmation" with: "NOT-new-guys-password" + And I click "Sign up" +# NOTE: this is not the actual behavior of the app +# validations are client-side and prevent the button from being pressed +# (this applies to the next two clauses as well) + Then I should be on the "users" page + And I should see "Password confirmation doesn't match Password" +# if we were testing with javascript support - this is the actual behavior +# Then I should be on the "sign_up" page +# And I should see "The password and its confirmation are not same" + + When I fill "E-mail" with: "new-guy@example.com" + And I fill "Password" with: "new-guys-password" + And I click "Sign up" + Then I should be on the "users" page + And I should see "Password confirmation doesn't match Password" +# Then I should be on the "sign_up" page +# And I should see "The password and its confirmation are not same" +# And I should see "The password confirmation is required and can't be empty" + + When I fill "E-mail" with: "new-guy@example.com" + And I fill "Password confirmation" with: "new-guys-password" + And I click "Sign up" + Then I should be on the "users" page + And I should see "Password confirmation doesn't match Password" +# Then I should be on the "sign_up" page +# And I should see "The password and its confirmation are not same" +# And I should see "The password is required and can't be empty" + + When I fill "E-mail" with: "seldon@example.com" + And I fill "Password" with: "new-guys-password" + And I fill "Password confirmation" with: "new-guys-password" + And I click "Sign up" + Then I should be on the "users" page + And I should see "E-mail has already been taken" + And there should be 0 email sent + + When I fill "E-mail" with: "new-guy@example.com" + And I fill "Password" with: "new-guys-password" + And I fill "Password confirmation" with: "new-guys-password" + And I click "Sign up" + Then I should be on the "home" page + And I should see "Sign up or Sign in" + And I should see "A message with a confirmation link has been sent" + And there should be 1 email sent + + When I visit the "sign_in" page + Then I should be on the "sign_in" page + And I should see "Sign in E-mail Password Remember me" + When I fill "E-mail" with: "new-guy@example.com" + And I fill "Password" with: "new-guys-password" + And I click "Sign in" + Then I should be on the "sign_in" page + And I should see "You have to confirm your account before continuing" + + When I confirm the email address: "new-guy@example.com" + Then I should be on the "sign_in" page + And I should see "Your account was successfully confirmed" + When I fill "E-mail" with: "new-guy@example.com" + And I fill "Password" with: "new-guys-password" + And I click "Sign in" + Then I should be on the "home" page + And I should see "new-guy@example.com / 0.00000000 Ƀ / Sign out" + And I should see "Signed in successfully" + + Scenario: Visitors should be able to sign up with GitHub oauth + Given I'm not signed in + When I visit the "sign_up" page + And I click "Sign in with Github" + Then I should be on the "/login/oauth/authorize" page + Then some magic stuff happens in the cloud + + Given a GitHib user named "seldon" exists + When I visit the "sign_in" page + And I click "Sign in with Github" + Then I should be on the "home" page + And I should see "seldon / 0.00000000 Ƀ / Sign out" + And I should see "Successfully authenticated from GitHub account" + +# TODO: +# Scenario: Users signed up via email should be able to merge via GitHub oauth diff --git a/features/step_definitions/common.rb b/features/step_definitions/common.rb index b349a73d..66ddd16f 100644 --- a/features/step_definitions/common.rb +++ b/features/step_definitions/common.rb @@ -5,7 +5,12 @@ Project.any_instance.stub(:branches).and_return(%w(master)) end -Given /^I'm signed in as "(.*?)"$/ do |nickname| +After do |scenario| +# Cucumber.wants_to_quit = true if scenario.failed? + OmniAuth.config.test_mode = false +end + +def mock_github_user nickname email = "#{nickname.parameterize}@example.com" OmniAuth.config.test_mode = true @@ -16,12 +21,20 @@ "verified_emails" => [email] , }, }.to_ostruct + + step "a user named \"#{nickname}\" exists without a bitcoin address" +end + +Given /^a GitHib user named "(.*?)" exists$/ do |nickname| + mock_github_user nickname +end + +Given /^I'm signed in as "(.*?)"$/ do |nickname| + mock_github_user nickname visit root_path first(:link, "Sign in").click click_on "Sign in with Github" page.should have_content("Successfully authenticated") - - step "a user named \"#{nickname}\" exists without a bitcoin address" end Given /^I'm not signed in$/ do @@ -32,6 +45,8 @@ else page.should have_content("Sign in") end + + OmniAuth.config.test_mode = false end Given (/^I sign in as "(.*?)"$/) { |nickname| step "I'm signed in as \"#{nickname}\"" } @@ -42,14 +57,14 @@ def parse_path_from_page_string page_string path = nil # explicit cases - # e.g. "a-user/a-project github project edit" + # e.g. "a-user/a-project github-project edit" # e.g. "a-user user edit" - tokens = page_string.split ' ' - name = tokens[0] - model = tokens[1] - action = tokens[2] || '' # '' => 'show' - is_user = model.eql? 'user' - is_project = ['github-project' , 'bitbucket-project'].include? model + tokens = page_string.split ' ' + name = tokens[0] + model = tokens[1] + action = tokens[2] || '' # '' => 'show' + is_user = model.eql? 'user' + is_project = ['github-project' , 'bitbucket-project'].include? model if is_project projects_paths = ['' , 'edit' , 'decide_tip_amounts' , 'tips' , 'deposits'] is_valid_path = projects_paths.include? action @@ -58,8 +73,7 @@ def parse_path_from_page_string page_string elsif is_user user_paths = ['' , 'tips'] is_valid_path = user_paths.include? action -# path = "/users/#{name}/#{action}" if is_valid_path # TODO: nyi - path = "/users/#{@users[name].id}/#{action}" if is_valid_path + path = "/users/#{name}/#{action}" if is_valid_path # TODO: nyi # implicit cases else case page_string @@ -87,16 +101,29 @@ def parse_path_from_page_string page_string end Then(/^I should be on the "(.*?)" page$/) do |page_string| - expected = parse_path_from_page_string page_string + expected = parse_path_from_page_string page_string rescue expected = page_string actual = page.current_path - (expected.index actual).should eq 0 # ignore trailing '/' + expected.chop! if (expected.end_with? '/') && (expected.size > 1) + actual .chop! if (actual .end_with? '/') && (actual .size > 1) + + actual.should eq expected +end + +def find_element node_name + case node_name + when "header" ; page.find '.masthead' + end end -Given(/^I click on "(.*?)"$/) do |arg1| +Given(/^I click "(.*?)"$/) do |arg1| click_on(arg1) end +Given(/^I click "(.*?)" within the "(.*?)" area$/) do |link_text , node_name| + within (find_element node_name) { click_on link_text } +end + Given(/^I check "(.*?)"$/) do |arg1| check(arg1) end @@ -124,3 +151,12 @@ def parse_path_from_page_string page_string When(/^the email counters are reset$/) do ActionMailer::Base.deliveries.clear end + +When(/^I confirm the email address: "(.*?)"$/) do |email| + mail = ActionMailer::Base.deliveries.select {|ea| ea.to.first.eql? email}.first + mail_body = mail.body.raw_source + token = mail_body.split('?confirmation_token=')[1].split('">Confirm my account').first + visit "/users/confirmation?confirmation_token=#{token}" +end + +Then /^some magic stuff happens in the cloud$/ do ; true ; end ; diff --git a/features/step_definitions/home_steps.rb b/features/step_definitions/home_steps.rb index 11dcaa36..ce685958 100644 --- a/features/step_definitions/home_steps.rb +++ b/features/step_definitions/home_steps.rb @@ -1,8 +1,5 @@ -Then(/^I should (.*)\s*see "(.*?)" in the header$/) do |should , text| - if should.eql? 'not ' - page.find('.masthead').should have_no_content(text) - else - page.find('.masthead').should have_content(text) - end +Then(/^I should (.*)\s*see "(.*?)" in the "(.*?)" area$/) do |should , text , node_name| + element = find_element node_name + element.should ((should.eql? 'not ')? (have_no_content text) : (have_content text)) end diff --git a/features/tip_modifier_interface.feature b/features/tip_modifier_interface.feature index c5c06313..ee675e28 100644 --- a/features/tip_modifier_interface.feature +++ b/features/tip_modifier_interface.feature @@ -25,10 +25,10 @@ Feature: A project collaborator can change the tips of commits When the project syncs with the remote repo And I visit the "seldon/seldons-project github-project" page Then I should be on the "seldon/seldons-project github-project" page - When I click on "Change project settings" + When I click "Change project settings" Then I should be on the "seldon/seldons-project github-project edit" page When I check "Do not send the tips immediately. Give collaborators the ability to modify the tips before they're sent" - And I click on "Save the project settings" + And I click "Save the project settings" Then I should be on the "seldon/seldons-project github-project" page And I should see "The project settings have been updated" @@ -51,7 +51,7 @@ Feature: A project collaborator can change the tips of commits When I visit the "seldon/seldons-project github-project" page Then I should be on the "seldon/seldons-project github-project" page - When I click on "Decide tip amounts" + When I click "Decide tip amounts" Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page And I should not see "AAA" And I should not see "BBB" @@ -65,8 +65,9 @@ Feature: A project collaborator can change the tips of commits And the most recent commit should be "FFF" When I choose the amount "Free: 0%" on commit "DDD" - And I click on "Send the selected tip amounts" + And I click "Send the selected tip amounts" Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page + And I should see "The tip amounts have been defined" And there should be a tip of "0" for commit "DDD" And the tip amount for commit "EEE" should be undecided But there should be no tip for commit "FFF" @@ -74,8 +75,9 @@ Feature: A project collaborator can change the tips of commits When the email counters are reset And I choose the amount "Tiny: 0.1%" on commit "EEE" - And I click on "Send the selected tip amounts" - Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page + And I click "Send the selected tip amounts" + Then I should be on the "seldon/seldons-project github-project" page + And I should see "The tip amounts have been defined" And there should be a tip of "0" for commit "DDD" And there should be a tip of "0.49005" for commit "EEE" But there should be no tip for commit "FFF" @@ -137,10 +139,10 @@ Feature: A project collaborator can change the tips of commits And I visit the "seldon/seldons-project github-project" page Then I should be on the "seldon/seldons-project github-project" page And I should see "Decide tip amounts" - When I click on "Decide tip amounts" + When I click "Decide tip amounts" Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page When I choose the amount "Huge: 5%" on all commits - And I click on "Send the selected tip amounts" + And I click "Send the selected tip amounts" Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page And I should see "You can't assign more than 100% of available funds." And the tip amount for commit "BBB" should be undecided diff --git a/features/tipping_policies.feature b/features/tipping_policies.feature index 6d0b0ed5..cdfe45f8 100644 --- a/features/tipping_policies.feature +++ b/features/tipping_policies.feature @@ -10,14 +10,14 @@ Feature: A project collaborator can display the tipping policies of the project Given I'm signed in as "daneel" When I visit the "seldon/seldons-project github-project" page Then I should be on the "seldon/seldons-project github-project" page - And I click on "Change project settings" + And I click "Change project settings" And I fill "Tipping policies" with: """ All commits are huge! Blah blah """ - And I click on "Save the project settings" + And I click "Save the project settings" Then I should be on the "seldon/seldons-project github-project" page Then I should see "The project settings have been updated" diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index 8feabba1..b0064169 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -40,6 +40,16 @@ end end + describe 'GET #search' do + context 'with existing repo that has been blacklisted' do + let(:subject) { get :search, query: "https://github.com/mitsuhiko/flask" } + + it 'renders blacklisted template' do + expect(subject).to render_template :blacklisted + end + end + end + describe 'POST #search' do it 'returns 200 status code' do post :search @@ -56,25 +66,52 @@ end =end - describe 'GET #show' do - it 'returns 302 status code' do - get :show , :service => 'github' , :repo => 'test/test' - response.should be_redirect + shared_context 'accessing_project' do |verb , action| + let(:a_project) { create :project , :host => 'github' , :full_name => "test/test" } + + context 'existing_project' do + it 'via project id returns 302 status code' do + case verb + when :get ; get action , :id => a_project.id + when :patch ; patch action , :id => a_project.id + end + response.should be_redirect + end + + it 'via project name returns 200 status code' do + case verb + when :get ; get action , :service => 'github' , :repo => a_project.full_name + when :patch ; patch action , :service => 'github' , :repo => a_project.full_name + end + response.should be_success + end end - context 'with existing repo that has been blacklisted' do - let(:blacklisted_repo) { create(:project, host: "github", full_name: "mitsuhiko/flask") } - let(:subject) { get :show, service: "github", repo: blacklisted_repo.full_name } + context 'nonexisting_project' do + it 'via project id returns 302 status code' do + case verb + when :get ; get action , :id => 999999 + when :patch ; patch action , :id => 999999 + end + response.should be_redirect + end - it 'renders blacklisted template' do - expect(subject).to render_template :blacklisted + it 'via project name returns 200 status code' do + case verb + when :get ; get action , :service => 'github' , :repo => 'no-such/project' ; + when :patch ; patch action , :service => 'github' , :repo => 'no-such/project' ; + end + response.should be_redirect end end end - describe 'GET #search' do + describe 'GET #show' do + include_context 'accessing_project' , :get , :show + context 'with existing repo that has been blacklisted' do - let(:subject) { get :search, query: "https://github.com/mitsuhiko/flask" } + let(:blacklisted_repo) { create(:project, host: "github", full_name: "mitsuhiko/flask") } + let(:subject) { get :show, service: "github", repo: blacklisted_repo.full_name } it 'renders blacklisted template' do expect(subject).to render_template :blacklisted @@ -84,12 +121,18 @@ describe 'GET #edit' do it 'returns 302 status code' do +# TODO: requires logged in user who is project collaborator +# include_context 'accessing_project' , :get , :edit + get :edit , :service => 'github' , :repo => 'test/test' response.should be_redirect end end describe 'GET #decide_tip_amounts' do +# TODO: requires logged in user who is project collaborator and some tips +# include_context 'accessing_project' , :get , :decide_tip_amounts + it 'returns 302 status code' do get :decide_tip_amounts , :service => 'github' , :repo => 'test/test' response.should be_redirect @@ -97,6 +140,9 @@ end describe 'PATCH #decide_tip_amounts' do +# TODO: requires logged in user who is project collaborator and some tips +# include_context 'accessing_project' , :patch , :decide_tip_amounts + it 'returns 302 status code' do patch :decide_tip_amounts , :service => 'github' , :repo => 'test/test' response.should be_redirect diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index 32e0acfb..afa57358 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe UsersController do - describe '#index' do + describe 'GET #index' do let(:subject) { get :index } it 'renders index template' do @@ -19,8 +19,8 @@ end describe '#show' do - let(:user) { mock_model User, id: 100000000 } - let(:subject) { get :show, id: user.id } + let(:user) { create(:user) } + let(:subject) { get :show , :nickname => user.nickname } context 'when logged in' do login_user @@ -68,8 +68,10 @@ end context 'when user not found' do - it 'redirect to root_path' do - expect(subject).to redirect_to root_path + let(:subject) { get :show , :nickname => 'unknown-user' } + + it 'redirect to users_path' do + expect(subject).to redirect_to users_path end it 'sets flash error message' do @@ -124,27 +126,28 @@ it "regex rejects reserved user paths" do # accepted pertty url usernames - should_accept = %w{logi ogin s4c2 42x} + should_accept = [' ' , 'logi' , 'ogin' , 's4c2' , '42x' , 'nick name' , 'kd'] # reserved routes (rejected pertty url usernames) - should_reject = %w{sign_in cancel sign_up edit confirmation login} + should_reject = ['' , '1' , '42'] - accepted = should_accept.select {|ea| ea =~ RESERVED_USER_ROUTES_REGEX} - rejected = should_reject.select {|ea| (ea =~ RESERVED_USER_ROUTES_REGEX).nil? } - accepted.size.should eq should_accept.size and rejected.size.should eq should_reject.size + accepted = should_accept.select {|ea| ea =~ /\D+/} + rejected = should_reject.select {|ea| (ea =~ /\D+/).nil? } + (accepted.size.should eq should_accept.size) && + (rejected.size.should eq should_reject.size) end - it "routes GET /users/friendly-name to User#show" do + it "routes GET /users/:nickname to User#show" do { :get => "/users/#{user.nickname}" }.should route_to( :controller => "users" , :action => "show" , - :id => "kd" ) + :nickname => "kd" ) end - it "routes GET /users/friendly-name/tips to Tips#index" do + it "routes GET /users/:nickname/tips to Tips#index" do { :get => "/users/#{user.nickname}/tips" }.should route_to( :controller => "tips" , :action => "index" , - :user_id => "kd" ) + :nickname => "kd" ) end end end From d0e77c4e4534ffd35b1726851ce242966a0758e4 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sat, 8 Nov 2014 23:01:28 -0700 Subject: [PATCH 124/415] Blacklist several projects --- config/blacklist.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/config/blacklist.yml b/config/blacklist.yml index 266d412f..19f7c9d6 100644 --- a/config/blacklist.yml +++ b/config/blacklist.yml @@ -30,4 +30,8 @@ - https://github.com/ipython/* - https://github.com/mpasternacki/* - https://github.com/3ofcoins/* -- https://github.com/ggventurini/python-deltasigma \ No newline at end of file +- https://github.com/ggventurini/python-deltasigma +- https://github.com/SirCmpwn/* +- https://github.com/MediaCrush/* +- https://github.com/KnightOS/* +- https://github.com/KerbalStuff/* From c69353929a5cba55b6ed225f1297e9287ea4007b Mon Sep 17 00:00:00 2001 From: IreuN Date: Sun, 9 Nov 2014 22:25:56 +0100 Subject: [PATCH 125/415] Update pl.yml --- config/locales/pl.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 246e8eda..3820698e 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -126,6 +126,9 @@ pl: message: Wiadomość tip: Napiwek (zależy od salda projektu) submit: Wyślij wybrane ilości napiwków + blacklisted: + title: Wybacz, ten projekt nie akceptuje napiwków! + message: Autor tego projektu zdecydował o wyłączeniu napiwków dla tego projektu. tips: index: tips: Napiwki From 5d01078396eea6dd8ab190283e17d84854f761f2 Mon Sep 17 00:00:00 2001 From: IreuN Date: Mon, 10 Nov 2014 23:48:59 +0100 Subject: [PATCH 126/415] Polished up Polish translation :) --- config/locales/pl.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 3820698e..bbd49ca6 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -2,14 +2,14 @@ pl: tip4commit: Tip4Commit meta: title: Wspieraj Open Source - description: Podaruj Bitcoiny na projekty Open Source lub współpracuj tworząc nowe "commits" i otrzymuj napiwki. + description: Podaruj Bitcoiny na projekty Open Source lub współpracuj tworząc nowe commity i otrzymuj napiwki. menu: home: Strona Główna projects: Wspierane Projekty footer: text: "Kod żródłowy dostępny jest na %{github_link} możesz także %{support_link} jego rozwój." github_link: GitHub - support_link: wsparcie + support_link: wesprzeć follow_link: Obserwuj @tip4commit links: sign_up: Rejestracja @@ -54,11 +54,11 @@ pl: see_projects: Zobacz projekty how_does_it_work: title: Jak to działa? - text: 'Ludzie przesyłają bitcoiny. Kiedy kogoś "commit" zostanie zaakceptowany do repozytorium projektu, automatycznie płacimy autorowi.' - button: Dowiedz się więcej o Bitcoin + text: 'Ludzie przesyłają bitcoiny. Kiedy czyiś commit zostanie zaakceptowany do repozytorium projektu, automatycznie płacimy autorowi.' + button: Dowiedz się więcej o Bitcoinie donate: title: Podaruj - text: 'Znajdź projekt, który ci się podoba i prześlij na niego bitcoiny. Twoje bitcoiny będzią zsumowana z innymi aby dać napiwki za nowe "commits".' + text: 'Znajdź projekt, który ci się podoba i prześlij na niego bitcoiny. Twoje bitcoiny zostaną zsumowane z innymi aby dać napiwki za nowe commity.' button: 'Znajdż lub dodaj projekt' contribute: title: 'Współpracuj' @@ -96,7 +96,7 @@ pl: unclaimed_amount: "(%{amount} z tego jest niezebrane, i zostanie zwrócone do projektu po jednym miesiącu.)" last_tips: Ostatnie napiwki see_all: zobacz wszystko - received: "otrzymano %{amount}" + received: "otrzymał %{amount}" will_receive: dostanie napiwek for_commit: za "commit" when_decided: kiedy jego rozmiar zostanie określony @@ -104,7 +104,7 @@ pl: contribute_and_earn: Pomagaj i zarabiaj contribute_and_earn_description: "Wyślij bitcoiny na ten projekt lub %{make_commits_link} i otrzymaj za nie napiwki. Jeśli zostaną zaakceptowane %{branch} przez nadzorce projektu i jeśli są pieniądze na koncie projektu, otrzymasz napiwek!" contribute_and_earn_branch: "do %{branch} gałęzi" - make_commits_link: twórz "commits" + make_commits_link: twórz "commity" tell_us_bitcoin_address: "Tylko %{tell_us_link} twój adres bitcoin." tell_us_link: powiedz nam sign_in: "Sprawdż e-mail lub %{sign_in_link}." From 7aa6198ddf0478391a8fda91bd04ed8d8ae7f844 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Tue, 11 Nov 2014 15:52:38 +0500 Subject: [PATCH 127/415] fixed collobarators --- app/assets/javascripts/i18n/translations.js | 2 +- app/services/github.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js index ac0ec161..029f45b8 100644 --- a/app/assets/javascripts/i18n/translations.js +++ b/app/assets/javascripts/i18n/translations.js @@ -1,2 +1,2 @@ var I18n = I18n || {}; -I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}}}; \ No newline at end of file +I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}}}; \ No newline at end of file diff --git a/app/services/github.rb b/app/services/github.rb index 103c3cb9..2f3fb92d 100644 --- a/app/services/github.rb +++ b/app/services/github.rb @@ -62,7 +62,7 @@ def find_or_create_project project_name end def collaborators_info project - client.get("/repos/#{project.full_name}/collaborators") + + (client.get("/repos/#{project.full_name}/collaborators") rescue []) + (client.get("/orgs/#{project.full_name.split('/').first}/members") rescue []) end From 07e7e46a46929c4e72b773becb8e8a4208e6bf61 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Tue, 11 Nov 2014 15:53:10 +0500 Subject: [PATCH 128/415] update info for 100 projects per iteration --- lib/bitcoin_tipper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bitcoin_tipper.rb b/lib/bitcoin_tipper.rb index 0c61921a..2034f8ff 100644 --- a/lib/bitcoin_tipper.rb +++ b/lib/bitcoin_tipper.rb @@ -15,7 +15,7 @@ def self.work withdraw = true end Rails.logger.info "Updating projects info..." - Project.order(:info_updated_at => :desc).last(20).each do |project| + Project.order(:info_updated_at => :desc).last(100).each do |project| Rails.logger.info " Project #{project.id} #{project.full_name}" project.update_info project.touch(:info_updated_at) From 37fdeef3d0e14510e2d7f143d0537b1d1e25c644 Mon Sep 17 00:00:00 2001 From: arsenische Date: Tue, 11 Nov 2014 17:48:30 +0500 Subject: [PATCH 129/415] hint regarding min tip size --- app/assets/javascripts/application.js.coffee | 3 +++ app/assets/javascripts/bootstrap.js.coffee | 4 ++-- app/assets/javascripts/i18n/translations.js | 2 +- app/views/projects/show.html.haml | 8 +++++++- config/config.yml.sample | 2 +- config/locales/en.yml | 1 + config/locales/ru.yml | 1 + 7 files changed, 16 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee index a2a76b69..1f23d93f 100644 --- a/app/assets/javascripts/application.js.coffee +++ b/app/assets/javascripts/application.js.coffee @@ -16,3 +16,6 @@ $(document).on "ready page:change", -> # Finally, load addthis $.getScript "//s7.addthis.com/js/250/addthis_widget.js#pubid=ra-526425ac0ea0780b" + + $('.noclick').click () -> + return false \ No newline at end of file diff --git a/app/assets/javascripts/bootstrap.js.coffee b/app/assets/javascripts/bootstrap.js.coffee index 94406798..f617be7e 100644 --- a/app/assets/javascripts/bootstrap.js.coffee +++ b/app/assets/javascripts/bootstrap.js.coffee @@ -1,3 +1,3 @@ -jQuery -> +$(document).on "ready page:change", () -> $("a[rel~=popover], .has-popover").popover() - $("a[rel~=tooltip], .has-tooltip").tooltip() + $("a[rel~=tooltip], .has-tooltip").tooltip() \ No newline at end of file diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js index 029f45b8..3448b4af 100644 --- a/app/assets/javascripts/i18n/translations.js +++ b/app/assets/javascripts/i18n/translations.js @@ -1,2 +1,2 @@ var I18n = I18n || {}; -I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}}}; \ No newline at end of file +I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}}}; \ No newline at end of file diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 48043f1f..f5b83739 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -26,7 +26,9 @@ %span(data-coingiving="title")= "[tip4commit] " + @project.full_name %span(data-coingiving="description")= @project.description %span(data-coingiving="bitcoin-address")= @project.bitcoin_address - %p= t('.fee', percentage: number_to_percentage(100-CONFIG["our_fee"]*100, precision: 0)) + %p + = t('.fee', percentage: number_to_percentage(100-CONFIG["our_fee"]*100, precision: 0)) + .col-md-8 - unless @project.description.blank? .well.well-sm= @project.description @@ -39,6 +41,10 @@ = t('.custom_tip_size') - else = t('.default_tip_size', percentage: number_to_percentage(CONFIG["tip"]*100, precision: 0)) + - if CONFIG["min_tip"].present? + %a.noclick{href:'#', data: {toggle: 'tooltip'}, title: t('.min_tip_size', min_tip: btc_human(CONFIG["min_tip"], {nobr: false})), rel: 'tooltip'} + * + - if @project.unconfirmed_amount > 0 = raw t('.unconfirmed_amount', amount: btc_human(@project.unconfirmed_amount)) diff --git a/config/config.yml.sample b/config/config.yml.sample index ba0b5573..3713bf2f 100644 --- a/config/config.yml.sample +++ b/config/config.yml.sample @@ -34,7 +34,7 @@ smtp_settings: tip: 0.01 min_payout: 100000 -our_fee: 0.05 +our_fee: 0.01 min_tip: 50000 # optional deposit_address: 1M4bS4gPyA6Kb8w7aXsgth9oUZWcRk73tQ diff --git a/config/locales/en.yml b/config/locales/en.yml index 7c951c67..4825f785 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -88,6 +88,7 @@ en: deposits: deposits custom_tip_size: (each new commit receives a percentage of available balance) default_tip_size: "(each new commit receives %{percentage} of available balance)" + min_tip_size: "Minimum tip size is set to %{min_tip}, but if available balance is less than that then it will be sent as a smaller tip" unconfirmed_amount: "(%{amount} unconfirmed)" tipping_policies: Tipping policies updated_by_user: "(Last updated by %{name} on %{date})" diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 8bb708d0..97e41ad8 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -88,6 +88,7 @@ ru: deposits: депозиты custom_tip_size: (каждый новый коммит получает процент от доступного остатка) default_tip_size: "(каждый новый коммит получает %{percentage} от доступного остатка)" + min_tip_size: "Минимальный размер чаевых установлен в %{min_tip}, но если он превышает доступный остаток, то весь остаток будет выплачен в качестве чаевых" unconfirmed_amount: "(%{amount} не подтверждено)" tipping_policies: Политика чаевых updated_by_user: "(Последние изменения %{name} на %{date})" From 53cd0bd184687aac9c17ee5da09fe5c54acaabb6 Mon Sep 17 00:00:00 2001 From: X-NicON Date: Tue, 11 Nov 2014 19:04:15 +0300 Subject: [PATCH 130/415] update ru.yml --- config/locales/ru.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 97e41ad8..013dc4b2 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -127,6 +127,9 @@ ru: message: Сообщение tip: Чаевые (зависят от баланса проекта) submit: Отправить выбранную сумму чаевых + blacklisted: + title: К сожалению, проект не принимает чаевые! + message: Автор этого проекта запретил принимать чаевые. tips: index: tips: Чаевые From 6bc653ff004501d3f45c9bb39dfe2108c136ef3b Mon Sep 17 00:00:00 2001 From: nalesnikld Date: Tue, 11 Nov 2014 22:31:59 +0100 Subject: [PATCH 131/415] update spelling in Polish translation --- config/locales/pl.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/locales/pl.yml b/config/locales/pl.yml index bbd49ca6..68d5581e 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -7,7 +7,7 @@ pl: home: Strona Główna projects: Wspierane Projekty footer: - text: "Kod żródłowy dostępny jest na %{github_link} możesz także %{support_link} jego rozwój." + text: "Kod źródłowy dostępny jest na %{github_link} możesz także %{support_link} jego rozwój." github_link: GitHub support_link: wesprzeć follow_link: Obserwuj @tip4commit @@ -24,7 +24,7 @@ pl: user_not_found: Nie znaleziono użytkownika access_denied: Nie masz uprawnień do wykonania tej czynności! notices: - project_updated: Ustawienia prjektu zostały zaktualizowane + project_updated: Ustawienia projektu zostały zaktualizowane tips_decided: Rozmiary napiwków zostały zdefiniowane user_updated: Informacje zostały zapisane! user_unsubscribed: "Zrezygnowałeś z subskrypcji! Przepraszamy za wszelkie niedogodności. Nadal możesz zostawić swój adres bitcoin i otrzymywać napiwki." @@ -59,7 +59,7 @@ pl: donate: title: Podaruj text: 'Znajdź projekt, który ci się podoba i prześlij na niego bitcoiny. Twoje bitcoiny zostaną zsumowane z innymi aby dać napiwki za nowe commity.' - button: 'Znajdż lub dodaj projekt' + button: 'Znajdź lub dodaj projekt' contribute: title: 'Współpracuj' text: 'Idź i coś napraw! Jeśli twój commit zostanie zaakceptowany przez nadzorcę projektu, dostaniesz napiwek!' @@ -107,7 +107,7 @@ pl: make_commits_link: twórz "commity" tell_us_bitcoin_address: "Tylko %{tell_us_link} twój adres bitcoin." tell_us_link: powiedz nam - sign_in: "Sprawdż e-mail lub %{sign_in_link}." + sign_in: "Sprawdź e-mail lub %{sign_in_link}." promote_project: Promuj %{project} embedding: Umieść image_url: "URL obrazka:" From 9462a58d236dc2544e85929e2ae90e0883db8557 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Wed, 12 Nov 2014 10:58:24 +0500 Subject: [PATCH 132/415] archiving inactive addresses --- app/models/project.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/models/project.rb b/app/models/project.rb index 91df5d49..bea8f6d0 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -216,4 +216,11 @@ def self.find_or_create_by_url project_url Github.new.find_or_create_project project_name end + + # Removes inactive addresses from the wallet + # Description: https://blockchain.info/api/blockchain_wallet_api + def self.consolidate_addresses + uri = URI("https://blockchain.info/merchant/#{CONFIG["blockchain_info"]["guid"]}/auto_consolidate?password=#{CONFIG["blockchain_info"]["password"]}&days=60") + res = Net::HTTP.get_response(uri) + end end From 93e8ecdd4cf171f0f680670efa1c2eedf18be706 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Wed, 12 Nov 2014 11:12:04 +0500 Subject: [PATCH 133/415] archive/unarchive address --- app/models/project.rb | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/app/models/project.rb b/app/models/project.rb index bea8f6d0..e40a89dd 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -221,6 +221,24 @@ def self.find_or_create_by_url project_url # Description: https://blockchain.info/api/blockchain_wallet_api def self.consolidate_addresses uri = URI("https://blockchain.info/merchant/#{CONFIG["blockchain_info"]["guid"]}/auto_consolidate?password=#{CONFIG["blockchain_info"]["password"]}&days=60") - res = Net::HTTP.get_response(uri) + return Net::HTTP.get_response(uri) + end + + def archive_address! + if self.bitcoin_address.present? + uri = URI("https://blockchain.info/merchant/#{CONFIG["blockchain_info"]["guid"]}/archive_address?password=#{CONFIG["blockchain_info"]["password"]}&address=#{self.bitcoin_address}") + return Net::HTTP.get_response(uri) + else + return nil + end + end + + def unarchive_address! + if self.bitcoin_address.present? + uri = URI("https://blockchain.info/merchant/#{CONFIG["blockchain_info"]["guid"]}/unarchive_address?password=#{CONFIG["blockchain_info"]["password"]}&address=#{self.bitcoin_address}") + return Net::HTTP.get_response(uri) + else + return nil + end end end From 68f3e22cfaa3bc10aa107d4038c494b52b90f37f Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Wed, 12 Nov 2014 11:44:02 +0500 Subject: [PATCH 134/415] opt-in for projects --- Gemfile | 1 + Gemfile.lock | 9 +++++++++ app/controllers/projects_controller.rb | 2 +- app/models/project.rb | 11 +++++++++++ app/services/github.rb | 6 +++++- app/views/projects/index.html.haml | 4 +++- config/locales/en.yml | 5 +++-- config/locales/ru.yml | 4 ++-- .../20141112064004_add_deleted_at_to_projects.rb | 5 +++++ db/schema.rb | 3 ++- 10 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 db/migrate/20141112064004_add_deleted_at_to_projects.rb diff --git a/Gemfile b/Gemfile index 49340961..da830df9 100644 --- a/Gemfile +++ b/Gemfile @@ -29,6 +29,7 @@ gem 'cancancan' gem 'dusen' gem 'render_csv' gem 'demoji' +gem 'acts_as_paranoid', github: 'ActsAsParanoid/acts_as_paranoid' gem "http_accept_language" gem 'rails-i18n' diff --git a/Gemfile.lock b/Gemfile.lock index 94dfdf35..01c09e02 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,11 @@ +GIT + remote: git://github.com/ActsAsParanoid/acts_as_paranoid.git + revision: ddcd1915179c73f74985af6bc8935321ca2fe08d + specs: + acts_as_paranoid (0.5.0.beta1) + activerecord (~> 4.0) + activesupport (~> 4.0) + GIT remote: git://github.com/alexandrz/omniauth-github.git revision: 37a030aa37659831ef80af21b5c7270fe1384b3c @@ -316,6 +324,7 @@ PLATFORMS ruby DEPENDENCIES + acts_as_paranoid! airbrake (~> 3.1.15) bootstrap_form! cancancan diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 1a4b6722..5603766a 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -14,7 +14,7 @@ def search return render :blacklisted end - if project = Project.find_or_create_by_url(params[:query]) + if project = Project.find_by_url(params[:query]) redirect_to pretty_project_path(project) else @projects = Project.search(params[:query].to_s).order(projects_order).page(params[:page]).per(30) diff --git a/app/models/project.rb b/app/models/project.rb index e40a89dd..7c4b9ce2 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1,4 +1,6 @@ class Project < ActiveRecord::Base + acts_as_paranoid + has_many :deposits # todo: only confirmed deposits has_many :tips, inverse_of: :project accepts_nested_attributes_for :tips @@ -217,6 +219,15 @@ def self.find_or_create_by_url project_url Github.new.find_or_create_project project_name end + def self.find_by_url project_url + project_name = project_url. + gsub(/https?\:\/\/github.com\//, ''). + gsub(/\#.+$/, ''). + gsub(' ', '') + + Github.new.find_project project_name + end + # Removes inactive addresses from the wallet # Description: https://blockchain.info/api/blockchain_wallet_api def self.consolidate_addresses diff --git a/app/services/github.rb b/app/services/github.rb index 2f3fb92d..7c07a3db 100644 --- a/app/services/github.rb +++ b/app/services/github.rb @@ -45,7 +45,7 @@ def repository_info project end def find_or_create_project project_name - if project = Project.find_by(host: "github", full_name: project_name) + if project = find_project(project_name) project elsif project_name =~ /\w+\/\w+/ begin @@ -61,6 +61,10 @@ def find_or_create_project project_name end end + def find_project project_name + return Project.find_by(host: "github", full_name: project_name) + end + def collaborators_info project (client.get("/repos/#{project.full_name}/collaborators") rescue []) + (client.get("/orgs/#{project.full_name.split('/').first}/members") rescue []) diff --git a/app/views/projects/index.html.haml b/app/views/projects/index.html.haml index eea2801e..8c254d99 100644 --- a/app/views/projects/index.html.haml +++ b/app/views/projects/index.html.haml @@ -39,4 +39,6 @@ %td= link_to t('.support'), pretty_project_path(project), class: 'btn btn-xs btn-success' = paginate @projects - else - .alert.alert-warning{role: 'alert'}= I18n.t('errors.project_not_found') + .alert.alert-warning{role: 'alert'} + = I18n.t('errors.project_not_found') + = I18n.t('errors.opt_in_notice') diff --git a/config/locales/en.yml b/config/locales/en.yml index 4825f785..5a9057c0 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -18,6 +18,7 @@ en: sign_out: Sign out errors: project_not_found: Project not found. + opt_in_notice: Because of multiple complains to GitHub we had to make Tip4Commit opt-in for project maintainers and removed all projects that don't have deposits. If you want to add your project please create an issue at GitHub. access_denied: Access denied can_assign_more_tips: "You can't assign more than 100% of available funds." wrong_bitcoin_address: Error updating bitcoin address @@ -69,8 +70,8 @@ en: projects: index: find_project: - placeholder: Enter GitHub project URL to add a project or any keyword to find it... - button: Find or add project + placeholder: Enter GitHub project URL or any keyword to find it... + button: Find project repository: Repository description: Description watchers: Watchers diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 013dc4b2..bdf9d963 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -69,8 +69,8 @@ ru: projects: index: find_project: - placeholder: Введите GitHub адрес вашего проекта чтобы добавить его или ключевое слово для поиска... - button: Найти или добавить проект + placeholder: Введите GitHub адрес проекта или ключевое слово для поиска... + button: Найти проект repository: Репозиторий description: Описание watchers: Наблюдателей diff --git a/db/migrate/20141112064004_add_deleted_at_to_projects.rb b/db/migrate/20141112064004_add_deleted_at_to_projects.rb new file mode 100644 index 00000000..032050f9 --- /dev/null +++ b/db/migrate/20141112064004_add_deleted_at_to_projects.rb @@ -0,0 +1,5 @@ +class AddDeletedAtToProjects < ActiveRecord::Migration + def change + add_column :projects, :deleted_at, :timestamp + end +end diff --git a/db/schema.rb b/db/schema.rb index a75e768d..9e45e735 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20141029083726) do +ActiveRecord::Schema.define(version: 20141112064004) do create_table "collaborators", force: true do |t| t.integer "project_id" @@ -54,6 +54,7 @@ t.string "branch" t.boolean "disable_notifications" t.string "avatar_url" + t.datetime "deleted_at" end add_index "projects", ["full_name"], name: "index_projects_on_full_name", unique: true From 34e75d85f5bdb05ba5020c6a2324a48e4449f1df Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Wed, 12 Nov 2014 11:45:23 +0500 Subject: [PATCH 135/415] ignored translation.js --- .gitignore | 2 ++ app/assets/javascripts/i18n/translations.js | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 app/assets/javascripts/i18n/translations.js diff --git a/.gitignore b/.gitignore index e55074aa..7b4c987d 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,5 @@ coverage /db/seeds.rb + +/app/assets/javascripts/i18n/translations.js diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js deleted file mode 100644 index 3448b4af..00000000 --- a/app/assets/javascripts/i18n/translations.js +++ /dev/null @@ -1,2 +0,0 @@ -var I18n = I18n || {}; -I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}}}; \ No newline at end of file From 9a3b38aadc8b87552c609555b3e211b4b2ce1db6 Mon Sep 17 00:00:00 2001 From: arsenische Date: Wed, 12 Nov 2014 12:22:03 +0500 Subject: [PATCH 136/415] opt_in_notice --- app/views/projects/index.html.haml | 2 +- config/locales/en.yml | 3 ++- config/locales/ru.yml | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/views/projects/index.html.haml b/app/views/projects/index.html.haml index 8c254d99..659b7ba0 100644 --- a/app/views/projects/index.html.haml +++ b/app/views/projects/index.html.haml @@ -41,4 +41,4 @@ - else .alert.alert-warning{role: 'alert'} = I18n.t('errors.project_not_found') - = I18n.t('errors.opt_in_notice') + = I18n.t('errors.opt_in_notice', create_issue_link: link_to(t('links.create_issue'), 'https://github.com/tip4commit/tip4commit/issues/new', target: '_blank')).html_safe diff --git a/config/locales/en.yml b/config/locales/en.yml index 5a9057c0..2596cb25 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -16,9 +16,10 @@ en: sign_in: Sign in sign_in_imp: sign in sign_out: Sign out + create_issue: create an issue errors: project_not_found: Project not found. - opt_in_notice: Because of multiple complains to GitHub we had to make Tip4Commit opt-in for project maintainers and removed all projects that don't have deposits. If you want to add your project please create an issue at GitHub. + opt_in_notice: "Due to complaints from project maintainers we don't add projects automatically anymore. Existing projects without deposits have been removed. If you want to add your project, please %{create_issue_link}." access_denied: Access denied can_assign_more_tips: "You can't assign more than 100% of available funds." wrong_bitcoin_address: Error updating bitcoin address diff --git a/config/locales/ru.yml b/config/locales/ru.yml index bdf9d963..2027132b 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -16,6 +16,8 @@ ru: sign_in: Войти sign_in_imp: войдите sign_out: Выйти + create_issue: создайте тикет + errors: project_not_found: Проект не найден. access_denied: Доступ запрещен @@ -23,6 +25,8 @@ ru: wrong_bitcoin_address: Ошибка обновления биткойн адреса user_not_found: Пользователь не найден access_denied: Вы не авторизованы для выполнения данного действия! + opt_in_notice: "В связи с многочисленными жалобами мы более не добавляем проекты автоматически. Существующие проекты, не получившие пожертвований, были удалены. Если Вы хотите добавить свой проект, пожалуйста, %{create_issue_link}." + notices: project_updated: Настройки проекта обновлены tips_decided: Сумма чаевых определена @@ -211,6 +215,7 @@ ru: errors: primary_email: ваш email адрес должен быть подтвержден. onmiauth_info: не удалось получить информацию. + activerecord: attributes: user: From aa4e7b8290770d2396224bfd936271abbcd57cd3 Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Thu, 13 Nov 2014 16:34:36 +0800 Subject: [PATCH 137/415] Speed up bundle install --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c31607c3..7f28cef1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ language: ruby rvm: - 2.0.0 -bundler_args: --without development +bundler_args: --without development --jobs=9 --retry=2 --quiet before_script: - cp config/config.yml.sample config/config.yml From 0d480c2e6811b6502b434d4a381fcc410f455408 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Thu, 20 Nov 2014 16:51:31 +0500 Subject: [PATCH 138/415] updated links --- app/views/layouts/application.html.haml | 5 ++++- app/views/projects/show.html.haml | 6 +++--- app/views/users/show.html.haml | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 3c0fade0..82bd610a 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -37,7 +37,10 @@ - if current_user = current_user.display_name \/ - = link_to btc_human(current_user.balance), current_user + - if current_user.nickname.present? + = link_to btc_human(current_user.balance), user_pretty_path(current_user.nickname) + - else + = link_to btc_human(current_user.balance), current_user \/ = link_to t('links.sign_out'), destroy_user_session_path, method: :delete - else diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 18a709dc..87b1ab2e 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -13,9 +13,9 @@ - if @project.collaborators.empty? = t('.fetch_pending') - if can? :update, @project - = link_to t('.edit_project'), edit_project_path(@project), class: "btn btn-primary" + = link_to t('.edit_project'), pretty_project_edit_path(@project), class: "btn btn-primary" - if can? :decide_tip_amounts, @project and @project.has_undecided_tips? - = link_to t('.decide_tip_amounts'), decide_tip_amounts_project_path(@project), class: "btn btn-warning" + = link_to t('.decide_tip_amounts'), pretty_project_decide_tip_amounts_path(@project), class: "btn btn-warning" .row .col-md-4 @@ -37,7 +37,7 @@ %h4 = t('.balance') - if @project.deposits.count > 0 - %small= link_to t('.deposits'), project_deposits_path(@project) + %small= link_to t('.deposits'), project_deposits_pretty_path(@project.host, @project.full_name) = btc_human @project.available_amount - if @project.hold_tips? = t('.custom_tip_size') diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index 41e3ff16..20fcb7aa 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -5,7 +5,7 @@ = btc_human @user.balance %p %small= raw t('.threshold', threshold: btc_human(CONFIG["min_payout"])) - + - if @user_tips.count > 0 %p %strong Last Tips @@ -14,7 +14,7 @@ %ul - @recent_tips.each do |tip| %li - = raw t('.received', time: l(tip.created_at, format: :short), amount: btc_human(tip.amount), commit: link_to(tip.commit[0..6], "https://github.com/#{tip.project.full_name}/commit/#{tip.commit}", target: :blank), project: link_to(tip.project.full_name, tip.project)) + = raw t('.received', time: l(tip.created_at, format: :short), amount: btc_human(tip.amount), commit: link_to(tip.commit[0..6], "https://github.com/#{tip.project.full_name}/commit/#{tip.commit}", target: :blank), project: link_to(tip.project.full_name, pretty_project_path(tip.project))) %p %strong= User.human_attribute_name(:email) From 4bac05aa3aca1b58e059b507d60292185f0cff18 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 24 Nov 2014 14:18:51 +0500 Subject: [PATCH 139/415] fixed blank nickname bug --- app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 5d8a9ab5..b8aa54c9 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -54,7 +54,7 @@ def self.find_by_commit(commit) email = commit.commit.author.email nickname = commit.author.try(:login) - find_by(email: email) || find_by(nickname: nickname) + find_by(email: email) || (nickname.blank? ? nil : find_by(nickname: nickname)) end private From 968e0c539861ed5305df76ef2699d8a0854cb366 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 8 Dec 2014 12:06:53 +0500 Subject: [PATCH 140/415] fixes #201 --- config/routes.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index 3e841aa4..ea9913e6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -9,8 +9,8 @@ get '/users/login' => 'users#login' , :as => 'login_users' get '/users/:user_id/tips' => 'tips#index' , :constraints => {:user_id => /\d+/} , :as => 'user_tips' - get '/users/:nickname/tips' => 'tips#index' , :constraints => {:nickname => /\D+/} , :as => 'user_tips_pretty' - get '/users/:nickname' => 'users#show' , :constraints => {:nickname => /\D+/} , :as => 'user_pretty' + get '/users/:nickname/tips' => 'tips#index' , :constraints => {:nickname => /\D\w*/} , :as => 'user_tips_pretty' + get '/users/:nickname' => 'users#show' , :constraints => {:nickname => /\D\w*/} , :as => 'user_pretty' get '/projects/:project_id/tips' => 'tips#index' , :constraints => {:project_id => /\d+/} , :as => 'project_tips' get '/projects/:project_id/deposits' => 'deposits#index' , :constraints => {:project_id => /\d+/} , :as => 'project_deposits' From 3ffacf9681c55c0fc521ee40154430933deaae17 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 8 Dec 2014 12:08:50 +0500 Subject: [PATCH 141/415] fixed #201 --- config/routes.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index ea9913e6..4e6fe432 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -9,8 +9,8 @@ get '/users/login' => 'users#login' , :as => 'login_users' get '/users/:user_id/tips' => 'tips#index' , :constraints => {:user_id => /\d+/} , :as => 'user_tips' - get '/users/:nickname/tips' => 'tips#index' , :constraints => {:nickname => /\D\w*/} , :as => 'user_tips_pretty' - get '/users/:nickname' => 'users#show' , :constraints => {:nickname => /\D\w*/} , :as => 'user_pretty' + get '/users/:nickname/tips' => 'tips#index' , :constraints => {:nickname => /\S+/} , :as => 'user_tips_pretty' + get '/users/:nickname' => 'users#show' , :constraints => {:nickname => /\S+/} , :as => 'user_pretty' get '/projects/:project_id/tips' => 'tips#index' , :constraints => {:project_id => /\d+/} , :as => 'project_tips' get '/projects/:project_id/deposits' => 'deposits#index' , :constraints => {:project_id => /\d+/} , :as => 'project_deposits' From cf2fbab3d346d3f60d56c09409f78c9aa7898dc5 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Wed, 10 Dec 2014 15:16:18 +0500 Subject: [PATCH 142/415] fixed ActionView::MissingTemplate error --- app/controllers/home_controller.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 2b145420..2ef282df 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,5 +1,8 @@ class HomeController < ApplicationController def index + respond_to do |format| + format.html + end end def blockchain_info_callback From 9c52eee0bcf917a4db903084f6245c20f20e745a Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Wed, 10 Dec 2014 15:22:05 +0500 Subject: [PATCH 143/415] ignored ActionController::UnknownFormat --- config/initializers/errbit.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/initializers/errbit.rb b/config/initializers/errbit.rb index a161e2af..d6e0dbdf 100644 --- a/config/initializers/errbit.rb +++ b/config/initializers/errbit.rb @@ -6,5 +6,6 @@ config.secure = config.port == 443 config.ignore << "ArgumentError" + config.ignore << "ActionController::UnknownFormat" end -end +end \ No newline at end of file From cb9017a779050914a023059c7df8aa954cf22e86 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 13 Dec 2014 10:39:13 +0500 Subject: [PATCH 144/415] updated project_tips_path --- app/views/projects/show.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 87b1ab2e..9a853120 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -72,7 +72,7 @@ %h4 =t('.last_tips') - if @project_tips.count > 5 - %small= link_to t('.see_all'), project_tips_path(@project) + %small= link_to t('.see_all'), project_tips_pretty_path(@project.host, @project.full_name) %ul - @recent_tips.each do |tip| %li From 4cd4042b9424764acc6fb5d6769d62d4a12919b6 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 13 Dec 2014 10:45:52 +0500 Subject: [PATCH 145/415] fixed collaborators --- app/models/project.rb | 2 +- app/services/github.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/project.rb b/app/models/project.rb index da7192ef..6fe05df3 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -50,7 +50,7 @@ def update_repository_info repo def update_collaborators(repo_collaborators) existing_collaborators = collaborators - repo_logins = repo_collaborators.map(&:login) + repo_logins = repo_collaborators existing_logins = existing_collaborators.map(&:login) existing_collaborators.each do |existing_collaborator| diff --git a/app/services/github.rb b/app/services/github.rb index 7c07a3db..8d8954ba 100644 --- a/app/services/github.rb +++ b/app/services/github.rb @@ -66,8 +66,8 @@ def find_project project_name end def collaborators_info project - (client.get("/repos/#{project.full_name}/collaborators") rescue []) + - (client.get("/orgs/#{project.full_name.split('/').first}/members") rescue []) + (client.get("/repos/#{project.full_name}/collaborators").map(&:login) rescue [project.full_name.split('/').first]) + + (client.get("/orgs/#{project.full_name.split('/').first}/members").map(&:login) rescue []) end def branches project From cae289c57de422d0ac9fec984f0e6db6f9ba2e0d Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 13 Dec 2014 11:06:58 +0500 Subject: [PATCH 146/415] fixed specs --- config/routes.rb | 4 ++-- spec/controllers/users_controller_spec.rb | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index 4e6fe432..ae473de8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -9,8 +9,8 @@ get '/users/login' => 'users#login' , :as => 'login_users' get '/users/:user_id/tips' => 'tips#index' , :constraints => {:user_id => /\d+/} , :as => 'user_tips' - get '/users/:nickname/tips' => 'tips#index' , :constraints => {:nickname => /\S+/} , :as => 'user_tips_pretty' - get '/users/:nickname' => 'users#show' , :constraints => {:nickname => /\S+/} , :as => 'user_pretty' + get '/users/:nickname/tips' => 'tips#index' , :constraints => {:nickname => /\w[\d\w\-]*/} , :as => 'user_tips_pretty' + get '/users/:nickname' => 'users#show' , :constraints => {:nickname => /\w[\d\w\-]*/} , :as => 'user_pretty' get '/projects/:project_id/tips' => 'tips#index' , :constraints => {:project_id => /\d+/} , :as => 'project_tips' get '/projects/:project_id/deposits' => 'deposits#index' , :constraints => {:project_id => /\d+/} , :as => 'project_deposits' diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index 472d6266..8810c5ec 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -102,11 +102,11 @@ :action => "index" ) end - it "routes GET /users/1 to User#show" do - { :get => "/users/1" }.should route_to( + it "routes GET /users/nick-name321 to User#show" do + { :get => "/users/nick-name321" }.should route_to( :controller => "users" , :action => "show" , - :id => "1" ) + :nickname => "nick-name321" ) end it "routes GET /users/login to User#login" do From ca4ac450802bc250e21f95372f1472f5a9175304 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 13 Dec 2014 11:15:42 +0500 Subject: [PATCH 147/415] fixed cucumber features --- features/pretty_paths.feature | 12 ++++++------ features/tip_modifier_interface.feature | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/features/pretty_paths.feature b/features/pretty_paths.feature index dec32ff7..8501491b 100644 --- a/features/pretty_paths.feature +++ b/features/pretty_paths.feature @@ -111,8 +111,8 @@ Feature: The site routes pretty paths uniformly Then I should be on the "sign_in" page And I should see "You need to sign in or sign up before continuing" - Scenario: User show page is inaccessible via user id when not signed in - When I browse to the explicit path "users/1" + Scenario: User show page is inaccessible via user nickname when not signed in + When I browse to the explicit path "users/seldon" Then I should be on the "sign_in" page And I should see "You need to sign in or sign up before continuing" @@ -122,9 +122,9 @@ Feature: The site routes pretty paths uniformly Then I should be on the "home" page And I should see "You are not authorized to perform this action" - Scenario: User show page is inaccessible via user id to other users + Scenario: User show page is inaccessible via nickname to other users Given I'm signed in as "yugo" - When I browse to the explicit path "users/1" + When I browse to the explicit path "users/seldon" Then I should be on the "home" page And I should see "You are not authorized to perform this action" @@ -136,9 +136,9 @@ Feature: The site routes pretty paths uniformly And I should see "E-mail seldon@example.com" And I should see "Bitcoin address" - Scenario: User show page is accessible via user id to that user + Scenario: User show page is accessible via nickname to that user Given I'm signed in as "seldon" - When I browse to the explicit path "users/1" + When I browse to the explicit path "users/seldon" Then I should be on the "seldon user" page And I should see "seldon Balance 0.00000000 Ƀ" And I should see "E-mail seldon@example.com" diff --git a/features/tip_modifier_interface.feature b/features/tip_modifier_interface.feature index ffc76ee1..86880b25 100644 --- a/features/tip_modifier_interface.feature +++ b/features/tip_modifier_interface.feature @@ -153,7 +153,7 @@ Feature: A project collaborator can change the tips of commits And the project syncs with the remote repo And a "github" project named "fake/fake" exists And the project collaborators are: - | bad guy | + | bad-guy | And a new commit "fake commit" is made And the project holds tips When the project syncs with the remote repo @@ -165,4 +165,4 @@ Feature: A project collaborator can change the tips of commits Examples: | user | consequences | | seldon | there should be a tip of "25" for commit "BBB" | - | bad guy | the tip amount for commit "BBB" should be undecided | + | bad-guy | the tip amount for commit "BBB" should be undecided | From abb9ee8a636714d02c4ee23402bd113ba48b8c6a Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 13 Dec 2014 11:16:55 +0500 Subject: [PATCH 148/415] fixed collaborators --- app/models/project.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/project.rb b/app/models/project.rb index 6fe05df3..c954df9c 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -54,14 +54,14 @@ def update_collaborators(repo_collaborators) existing_logins = existing_collaborators.map(&:login) existing_collaborators.each do |existing_collaborator| - unless repo_logins.include?(existing_collaborator.login) + unless repo_logins.include?(existing_collaborator) existing_collaborator.mark_for_destruction end end repo_collaborators.each do |repo_collaborator| - unless existing_logins.include?(repo_collaborator.login) - collaborators.build(login: repo_collaborator.login) + unless existing_logins.include?(repo_collaborator) + collaborators.build(login: repo_collaborator) end end From 1d08576b859538a79565f93d2d5a7f874885a6c7 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 13 Dec 2014 11:20:40 +0500 Subject: [PATCH 149/415] fixed update_collaborators --- app/models/project.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/project.rb b/app/models/project.rb index c954df9c..7a9e567d 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -54,7 +54,7 @@ def update_collaborators(repo_collaborators) existing_logins = existing_collaborators.map(&:login) existing_collaborators.each do |existing_collaborator| - unless repo_logins.include?(existing_collaborator) + unless repo_logins.include?(existing_collaborator.login) existing_collaborator.mark_for_destruction end end From 27fbb5c2720ad29ad05abe0449c52d0dfb18611f Mon Sep 17 00:00:00 2001 From: Waldir Pimenta Date: Sat, 20 Dec 2014 11:05:34 +0000 Subject: [PATCH 150/415] sync w/ app/views/projects/show.svg.erb --- public/shield.svg | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/public/shield.svg b/public/shield.svg index bfa7bfd8..cd2a0a20 100644 --- a/public/shield.svg +++ b/public/shield.svg @@ -57,6 +57,16 @@ + @@ -74,4 +84,4 @@ 0.075 Ƀ - \ No newline at end of file + From f5dca16b0b674882e960d8ae6af89547dc1226db Mon Sep 17 00:00:00 2001 From: Ben Holden-Crowther Date: Mon, 29 Dec 2014 20:38:27 +0000 Subject: [PATCH 151/415] Updated license date Changed 2014 to 2015 in preparation for new year --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 5707826a..69cb66e9 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014 tip4commit +Copyright (c) 2015 tip4commit Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in From 28e90d3fb1dbcf42372b2cfd34b4cfcf017f2079 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 12 Jan 2015 14:18:03 +0530 Subject: [PATCH 152/415] fixed user_path --- app/assets/javascripts/projects.js.coffee | 2 +- app/assets/javascripts/users.js.coffee | 12 ++++++------ app/models/deposit.rb | 2 +- app/views/common/_menu.html.haml | 2 +- .../user_mailer/check_bitcoin_address.html.haml | 6 +++--- app/views/users/index.html.haml | 2 +- config/database.yml.sample | 4 ++-- config/deploy.rb | 2 +- config/environments/development.rb | 2 +- config/i18n-js.yml | 2 +- config/initializers/demoji.rb | 2 +- config/initializers/mime_types.rb | 2 +- config/routes.rb | 1 + db/migrate/20140620123610_add_decided_at_to_tips.rb | 2 +- lib/bitcoin_address_validator.rb | 2 +- public/robots.txt | 2 +- spec/models/user_spec.rb | 2 +- 17 files changed, 25 insertions(+), 24 deletions(-) diff --git a/app/assets/javascripts/projects.js.coffee b/app/assets/javascripts/projects.js.coffee index 849796e7..86bd3f15 100644 --- a/app/assets/javascripts/projects.js.coffee +++ b/app/assets/javascripts/projects.js.coffee @@ -6,4 +6,4 @@ init = () -> $('.qrcode').each () -> $(this).qrcode($(this).attr('data-qrcode')); -$(document).on 'ready page:load', init +$(document).on 'ready page:load', init \ No newline at end of file diff --git a/app/assets/javascripts/users.js.coffee b/app/assets/javascripts/users.js.coffee index b7fcd1a7..69410427 100644 --- a/app/assets/javascripts/users.js.coffee +++ b/app/assets/javascripts/users.js.coffee @@ -8,21 +8,21 @@ load_bootstrap_validator = -> message: I18n.t('js.errors.email.invalid') notEmpty: message: I18n.t('js.errors.email.blank') - + "user[password]": validators: notEmpty: message: I18n.t('js.errors.password.blank') identical: - field: 'user[password_confirmation]' + field: 'user[password_confirmation]' message: I18n.t('js.errors.password.invalid') - + "user[password_confirmation]": validators: notEmpty: message: I18n.t('js.errors.password_confirmation.blank') identical: - field: 'user[password]' + field: 'user[password]' message: I18n.t('js.errors.password_confirmation.invalid') $('.session_form').bootstrapValidator message: I18n.t('js.errors.value.invalid') @@ -33,10 +33,10 @@ load_bootstrap_validator = -> message: I18n.t('js.errors.email.invalid') notEmpty: message: I18n.t('js.errors.email.blank') - + "user[password]": validators: notEmpty: message: I18n.t('js.errors.password_confirmation.blank') -$(document).on "ready page:load", load_bootstrap_validator +$(document).on "ready page:load", load_bootstrap_validator \ No newline at end of file diff --git a/app/models/deposit.rb b/app/models/deposit.rb index 5891a98a..45638f49 100644 --- a/app/models/deposit.rb +++ b/app/models/deposit.rb @@ -26,4 +26,4 @@ def project_name project.full_name end -end +end \ No newline at end of file diff --git a/app/views/common/_menu.html.haml b/app/views/common/_menu.html.haml index a51fce91..98b0543c 100644 --- a/app/views/common/_menu.html.haml +++ b/app/views/common/_menu.html.haml @@ -2,4 +2,4 @@ %li{class: controller_name == 'home' ? 'active' : ''} %a{href: root_path}= t('menu.home') %li{class: controller_name == 'projects' || @project ? 'active' : ''} - %a{href: projects_path}= t('menu.projects') + %a{href: projects_path}= t('menu.projects') \ No newline at end of file diff --git a/app/views/user_mailer/check_bitcoin_address.html.haml b/app/views/user_mailer/check_bitcoin_address.html.haml index 5d19ec4a..4a7ae264 100644 --- a/app/views/user_mailer/check_bitcoin_address.html.haml +++ b/app/views/user_mailer/check_bitcoin_address.html.haml @@ -6,9 +6,9 @@ %strong= @user.bitcoin_address %p - If this address is not yours, please + If this address is not yours, please = link_to 'update it', login_users_url(token: @user.login_token) - + %p Thank you for contributing to Open Source and sorry for troubles! -%p= link_to "tip4commit.com", "http://tip4commit.com/" +%p= link_to "tip4commit.com", "http://tip4commit.com/" \ No newline at end of file diff --git a/app/views/users/index.html.haml b/app/views/users/index.html.haml index 13b5d405..9a4a81d9 100644 --- a/app/views/users/index.html.haml +++ b/app/views/users/index.html.haml @@ -9,7 +9,7 @@ %tbody - @users.each do |user| %tr - %td + %td - if user.nickname.blank? = user.display_name - else diff --git a/config/database.yml.sample b/config/database.yml.sample index 7f623d96..d41fe63b 100644 --- a/config/database.yml.sample +++ b/config/database.yml.sample @@ -23,5 +23,5 @@ production: encoding: utf8 database: tip4commit username: root - password: - socket: /var/run/mysqld/mysqld.sock + password: + socket: /var/run/mysqld/mysqld.sock \ No newline at end of file diff --git a/config/deploy.rb b/config/deploy.rb index c2600939..cd5541a0 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -40,4 +40,4 @@ after :finishing, 'deploy:cleanup' -end +end \ No newline at end of file diff --git a/config/environments/development.rb b/config/environments/development.rb index 33b915ab..42389197 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -16,7 +16,7 @@ # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false - config.action_mailer.default_url_options = { :host => "localhost:3000" } + config.action_mailer.default_url_options = { :host => "localhost:3000" } # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log diff --git a/config/i18n-js.yml b/config/i18n-js.yml index ca77b010..36ef0b86 100644 --- a/config/i18n-js.yml +++ b/config/i18n-js.yml @@ -1,3 +1,3 @@ translations: - file: "app/assets/javascripts/i18n/translations.js" - only: ['*.js'] + only: ['*.js'] \ No newline at end of file diff --git a/config/initializers/demoji.rb b/config/initializers/demoji.rb index d4121d33..f2258a95 100644 --- a/config/initializers/demoji.rb +++ b/config/initializers/demoji.rb @@ -1 +1 @@ -ActiveRecord::Base.send :include, Demoji +ActiveRecord::Base.send :include, Demoji \ No newline at end of file diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb index c0feb58c..d39c83c4 100644 --- a/config/initializers/mime_types.rb +++ b/config/initializers/mime_types.rb @@ -3,4 +3,4 @@ # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register_alias "text/html", :iphone -Mime::Type.register "image/svg+xml", :svg +Mime::Type.register "image/svg+xml", :svg \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index ae473de8..647da251 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -10,6 +10,7 @@ get '/users/login' => 'users#login' , :as => 'login_users' get '/users/:user_id/tips' => 'tips#index' , :constraints => {:user_id => /\d+/} , :as => 'user_tips' get '/users/:nickname/tips' => 'tips#index' , :constraints => {:nickname => /\w[\d\w\-]*/} , :as => 'user_tips_pretty' + get '/users/:id' => 'users#show' , :constraints => {:id => /\d+/} , :as => 'user' get '/users/:nickname' => 'users#show' , :constraints => {:nickname => /\w[\d\w\-]*/} , :as => 'user_pretty' get '/projects/:project_id/tips' => 'tips#index' , :constraints => {:project_id => /\d+/} , :as => 'project_tips' diff --git a/db/migrate/20140620123610_add_decided_at_to_tips.rb b/db/migrate/20140620123610_add_decided_at_to_tips.rb index 3cb03115..c9ae29ed 100644 --- a/db/migrate/20140620123610_add_decided_at_to_tips.rb +++ b/db/migrate/20140620123610_add_decided_at_to_tips.rb @@ -2,4 +2,4 @@ class AddDecidedAtToTips < ActiveRecord::Migration def change add_column :tips, :decided_at, :timestamp end -end +end \ No newline at end of file diff --git a/lib/bitcoin_address_validator.rb b/lib/bitcoin_address_validator.rb index bce980bc..46d75f5f 100644 --- a/lib/bitcoin_address_validator.rb +++ b/lib/bitcoin_address_validator.rb @@ -26,7 +26,7 @@ def valid_bitcoin_address?(address) def version(address) decoded = b58_decode(address, 25) - + version = decoded[0, 1] checksum = decoded[-4, decoded.length] vh160 = decoded[0, decoded.length - 4] diff --git a/public/robots.txt b/public/robots.txt index 4860601a..2b03edd3 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -1,3 +1,3 @@ User-agent: * Disallow: /users/ -Crawl-delay: 10 +Crawl-delay: 10 \ No newline at end of file diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index c95a5918..2a683d72 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -48,4 +48,4 @@ end end -end +end \ No newline at end of file From c300a00661ad2552b40ded22dcf0798103480be5 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Tue, 13 Jan 2015 12:38:24 +0530 Subject: [PATCH 153/415] fixed withdrawals for amounts equal to threshold --- app/models/user.rb | 4 ++++ lib/bitcoin_tipper.rb | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index b8aa54c9..d16465b5 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -57,6 +57,10 @@ def self.find_by_commit(commit) find_by(email: email) || (nickname.blank? ? nil : find_by(nickname: nickname)) end + def ready_for_withdrawal? + self.bitcoin_address.present? && self.balance >= CONFIG["min_payout"] + end + private def set_login_token! diff --git a/lib/bitcoin_tipper.rb b/lib/bitcoin_tipper.rb index fd38eebd..e343bbaf 100644 --- a/lib/bitcoin_tipper.rb +++ b/lib/bitcoin_tipper.rb @@ -25,7 +25,7 @@ def self.work withdraw = true Rails.logger.info "Traversing users..." users_waiting_for_withdrawal = 0 User.find_each do |user| - if user.bitcoin_address.present? && user.balance > CONFIG["min_payout"] + if user.ready_for_withdrawal? users_waiting_for_withdrawal += 1 Rails.logger.info "User ##{user.id} is waiting for withdrawal" end @@ -60,7 +60,7 @@ def self.create_sendmany sendmany = Sendmany.create outs = {} User.find_each do |user| - if user.bitcoin_address.present? && user.balance > CONFIG["min_payout"] + if user.ready_for_withdrawal? user.tips.decided.unpaid.each do |tip| tip.update_attribute :sendmany_id, sendmany.id outs[user.bitcoin_address] = outs[user.bitcoin_address].to_i + tip.amount From fac4e281be803fab52d2decb7e132f129cd64fd3 Mon Sep 17 00:00:00 2001 From: Dennis van de Hoef Date: Wed, 28 Jan 2015 21:02:43 +0100 Subject: [PATCH 154/415] replace debugger gem --- Gemfile | 2 +- Gemfile.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Gemfile b/Gemfile index da830df9..9e61453f 100644 --- a/Gemfile +++ b/Gemfile @@ -42,7 +42,7 @@ group :development do gem 'capistrano-rvm', '~> 0.1.0', github: 'capistrano/rvm' gem 'capistrano-bundler', '>= 1.1.0' gem 'capistrano-rails', '~> 1.1.0' - gem 'debugger', '~> 1.6.5' + gem 'byebug', '~> 3.5.1' end group :development, :test do diff --git a/Gemfile.lock b/Gemfile.lock index 01c09e02..d9298f3b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -83,6 +83,10 @@ GEM atomic (1.1.14) bcrypt-ruby (3.1.2) builder (3.1.4) + byebug (3.5.1) + columnize (~> 0.8) + debugger-linecache (~> 1.2) + slop (~> 3.6) cancancan (1.7.1) capistrano (3.0.1) i18n @@ -107,7 +111,7 @@ GEM coffee-script-source execjs coffee-script-source (1.6.3) - columnize (0.8.9) + columnize (0.9.0) commonjs (0.2.7) cucumber (1.3.14) builder (>= 2.1.2) @@ -121,12 +125,7 @@ GEM nokogiri (>= 1.5.0) rails (>= 3.0.0) database_cleaner (1.2.0) - debugger (1.6.8) - columnize (>= 0.3.1) - debugger-linecache (~> 1.2.0) - debugger-ruby_core_source (~> 1.3.5) debugger-linecache (1.2.0) - debugger-ruby_core_source (1.3.5) demoji (0.0.5) devise (3.2.2) bcrypt-ruby (~> 3.0) @@ -282,6 +281,7 @@ GEM multi_json (~> 1.0) simplecov-html (~> 0.7.1) simplecov-html (0.7.1) + slop (3.6.0) sprockets (2.10.1) hike (~> 1.2) multi_json (~> 1.0) @@ -327,6 +327,7 @@ DEPENDENCIES acts_as_paranoid! airbrake (~> 3.1.15) bootstrap_form! + byebug (~> 3.5.1) cancancan capistrano (~> 3.0.1) capistrano-bundler (>= 1.1.0) @@ -335,7 +336,6 @@ DEPENDENCIES coffee-rails (~> 4.0.0) cucumber-rails database_cleaner - debugger (~> 1.6.5) demoji devise (~> 3.2.2) devise-i18n From ce9e5b41d47a30c2ab217fab859d081cfd1ff3e0 Mon Sep 17 00:00:00 2001 From: Dennis van de Hoef Date: Wed, 28 Jan 2015 21:07:16 +0100 Subject: [PATCH 155/415] alignment --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 9e61453f..b1976865 100644 --- a/Gemfile +++ b/Gemfile @@ -42,7 +42,7 @@ group :development do gem 'capistrano-rvm', '~> 0.1.0', github: 'capistrano/rvm' gem 'capistrano-bundler', '>= 1.1.0' gem 'capistrano-rails', '~> 1.1.0' - gem 'byebug', '~> 3.5.1' + gem 'byebug', '~> 3.5.1' end group :development, :test do From 9d00b6a0195a9d977a3c773d6525bc2af4be7d52 Mon Sep 17 00:00:00 2001 From: Dennis van de Hoef Date: Mon, 2 Feb 2015 21:07:47 +0100 Subject: [PATCH 156/415] add missing translations --- app/views/layouts/application.html.haml | 15 +++++---------- config/locales/en.yml | 4 ++++ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 82bd610a..89a999b0 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -1,5 +1,5 @@ !!! -%html{lang: "en"} +%html{lang: "#{I18n.locale}"} %head %meta{charset: "utf-8"}/ %meta{content: "width=device-width, initial-scale=1.0", name: "viewport"}/ @@ -47,7 +47,7 @@ - if controller_name != 'registrations' = link_to t('links.sign_up'), new_user_registration_path - unless %w{sessions registrations}.include? controller_name - = " or " + = t('general.or') - if controller_name != 'sessions' = link_to t('links.sign_in'), new_user_session_path @@ -63,15 +63,10 @@ .footer .alert.alert-warning - %p - We are not affiliated with most of the projects, their owners may be unaware of or actively against using tip4commit. Due to potential ethical and legal issues we may remove any project from the list by request of project maintainers. + %p= t('general.disclaimer.line1') + %p= t('general.disclaimer.line2') + %p= t('general.disclaimer.line3') - %p - Also we are not notifying developers about their tips anymore. Thus we can't guarantee that donated funds will really reach them. - - %p - By donating funds you agree that they can be sent to Free Software Foundation or elsewhere at Tip4Commit's discretion. - %p.pull-right - ::Rails.application.config.available_locales.each do |locale| = link_to image_tag("flags/#{locale}.png"), "?locale=#{locale}", data: {no_turbolink: true} diff --git a/config/locales/en.yml b/config/locales/en.yml index 3e297f12..03ffa159 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -227,3 +227,7 @@ en: bitbucket: BitBucket general: or: or + disclaimer: + line1: "We are not affiliated with most of the projects, their owners may be unaware of or actively against using tip4commit. Due to potential ethical and legal issues we may remove any project from the list by request of project maintainers." + line2: "Also we are not notifying developers about their tips anymore. Thus we can't guarantee that donated funds will really reach them." + line3: "By donating funds you agree that they can be sent to Free Software Foundation or elsewhere at Tip4Commit's discretion." From a8c7d246c591039cea7e4b5353b30029abd248f2 Mon Sep 17 00:00:00 2001 From: Dennis van de Hoef Date: Mon, 2 Feb 2015 21:16:36 +0100 Subject: [PATCH 157/415] add dutch translation --- app/assets/images/flags/nl.png | Bin 0 -> 453 bytes config/application.rb | 2 +- config/locales/nl.yml | 233 +++++++++++++++++++++++++++++++++ 3 files changed, 234 insertions(+), 1 deletion(-) create mode 100755 app/assets/images/flags/nl.png create mode 100644 config/locales/nl.yml diff --git a/app/assets/images/flags/nl.png b/app/assets/images/flags/nl.png new file mode 100755 index 0000000000000000000000000000000000000000..fe44791e32b790949b0317ab3c258864b9024ebe GIT binary patch literal 453 zcmV;$0XqJPP)@|4`Xj5kLTv#?55wQzKoX38|NjLffBpXj6#2y{D-E;(Ab?mHL=FGT z$TP6>fK>na1GWK({(upf0nrSU5*Gz(00%w4e}91F-@gjtJbOE500a;V!?RECzy5mt@dro_q~YJM-#~SLe}OeX zNT7y4|NilCvNABd0|+1%hF>6clER!2lYo}|1|zVkK=SXOfB*mf{rC6ZKVbL)odgg- vjKFAPVE6?_e~=h|kVO7~qZmRm0R$KTYszPUy89K;00000NkvXXu0mjfB$dbi literal 0 HcmV?d00001 diff --git a/config/application.rb b/config/application.rb index 10122413..cea2c4c2 100644 --- a/config/application.rb +++ b/config/application.rb @@ -36,7 +36,7 @@ class Application < Rails::Application config.autoload_paths += %W(#{config.root}/lib) config.assets.initialize_on_precompile = true - config.available_locales = %w(en fr ru pl) + config.available_locales = %w(en fr nl ru pl) end end diff --git a/config/locales/nl.yml b/config/locales/nl.yml new file mode 100644 index 00000000..06730986 --- /dev/null +++ b/config/locales/nl.yml @@ -0,0 +1,233 @@ +nl: + tip4commit: Tip4Commit + meta: + title: Bijdragen aan Open Source + description: Doneer bitcoins aan open source projecten of commit en krijg er een beloning voor. + menu: + home: Home + projects: Ondersteunde projecten + footer: + text: "Broncode is beschikbaar op %{github_link} en ook jij kunt %{support_link} aan de ontwikkeling." + github_link: GitHub + support_link: bijdragen + follow_link: Follow @tip4commit + links: + sign_up: Registreren + sign_in: Inloggen + sign_in_imp: Inloggen + sign_out: Uitloggen + create_issue: fout melden + errors: + project_not_found: Project niet gevonden. + opt_in_notice: "Door klachten van project eigenaren is het niet meer mogenlijk om automatisch projecten toe te voegen. Bestaande projecten zonder stortingen zijn verwijderd. Als je jouw project(en) wildt aanmelden dan gebruik de %{create_issue_link} optie van github." + access_denied: Geen toegang + can_assign_more_tips: "Het is niet mogelijk om meer als 100% van het beschickbaar saldo over te maken." + wrong_bitcoin_address: Er is een fout opgetreden tijdens het bijwerken van het bitcoin adres + user_not_found: Gebruiker niet gevonden + access_denied: Je bezit niet over de rechten deze actie uit te voeren! + notices: + project_updated: De instellingen van het project zijn bijgewerkt + tips_decided: De beloningen zijn ingesteld + user_updated: Je gegens zijn opgeslagen! + user_unsubscribed: "Je bent afgemeld! Sorry voor het lastig vallen. Je kunt nog steeds je bitcoins adres bij ons opslaan om automatisch de beloningen te ontvangen" + tip_amounts: + undecided: "Onbeslist" + free: "Gratis: 0%" + tiny: "Mini: 0.1%" + small: "Klein: 0.5%" + normal: "Normaal: 1%" + big: "Groot: 2%" + huge: "Enorm: 5%" + js: + errors: + value: + invalid: De waarde is ongeldig + email: + invalid: Ongeldig e-mail adres + blank: E-mail is verplicht en kan niet leeg blijven + password: + blank: Wachtwoord is verplicht en kan niet leeg blijven + invalid: De wachtwoorden komen niet overeen + password_confirmation: + blank: Wachtwoord is verplicht en kan niet leeg blijven + invalid: De wachtwoorden komen niet overeen + home: + index: + see_projects: Bekijk projecten + how_does_it_work: + title: Hoe werkt het? + text: Mensen sponsoren bitcoins aan projecten. Als een commit van een persoon is geaccepteerd (merge in repository), maken we automaitsch een belong over aan deze persoon. + button: Wat zijn Bitcoins + donate: + title: Doneren + text: Zoek een project dat je wilt spponsoren en maak bitcoins over. Je donatie wordt toegevoegd aan het saldo van het project en wordt als beloning voor nieuwe commits uitbetaald. + button: Zoek een project + contribute: + title: Bijdragen + text: Ga en repareer iets! Als je commit wordt egaccepteerd door de eigenaar van het project (merg in master), krijg je een beloning! + sign_in_text: "Conroleer je e-mail voor een e-mail met %{sign_in_link}." + sign_up_text: "Als je nog niet bent geregistreedt kun je je %{sign_up_link} met een geldig e-mail adres of via" + button: Gesteunde projecten + projects: + index: + find_project: + placeholder: Vul een GitHub project URLof een zoekwoord in om hem te vinden... + button: Vind project + repository: Repository + description: Omschrijving + watchers: Watchers + balance: Saldo + forked_from: forked van + support: Steun project + show: + title: "Bijdrage aan %{project}" + fetch_pending: (Wachten initial fetch) + edit_project: project instellingen aanpassen + decide_tip_amounts: Beloningen instellen + disabled_notifications: "Project eigenaren hebben besloten om nieuwe ondersteuners niet in te lichten over beloningen. Ze vinden deze manier van beloningen waarschijnlijk niet goed." + project_sponsors: Project sponsoren + fee: "%{percentage} van gesponsordt geld wordt gebruikt voor de ondersteuning van nieuwe commits." + balance: Saldo + deposits: stortingen + custom_tip_size: (elke nieuwe commit ontvangt een percentage van het beschickbare saldo) + default_tip_size: "(elke nieuwe commit ontvangt %{percentage} van het beschickbare saldo)" + min_tip_size: "De mininmum grote van een beloning is %{min_tip}, echte kan deze kleiner zijn als het saldo van het project daar onder licht." + unconfirmed_amount: "(%{amount} onbevesticht)" + tipping_policies: Beloningspolicy + updated_by_user: "(Laatste update door %{name} op %{date})" + updated_by_unknown: "(Laatste update op %{date})" + tips_paid: Beloningen betaald + unclaimed_amount: "(%{amount} is nog niet geclaimed, en wordt terug gestord naar het project als deze na 1 maand nogaltijd niet geclaimed is.)" + last_tips: Laatste beloningen + see_all: Alles zien + received: "ontvangen %{amount}" + will_receive: Gaan een beloning ontvangen + for_commit: voor commit + when_decided: als de hoogte is vastgesteld + next_tip: Volgende beloning + contribute_and_earn: Bijdragen en beloond worden + contribute_and_earn_description: "Doneer bitcoins aan dit project of %{make_commits_link} en krijg beloningen. Als je commit wordt geaccepteerd %{branch} door een projecteigenaar en er is een positief saldo van bitcoins, krijg je een beloning!" + contribute_and_earn_branch: "in de branch %{branch}" + make_commits_link: maak commits + tell_us_bitcoin_address: "Gewoon je bitcoin adres %{tell_us_link}." + tell_us_link: aan ons vertellen + sign_in: "Gewoon je e-maol controleren of %{sign_in_link}." + promote_project: Promote %{project} + embedding: Laden + image_url: "URL van afbeelding:" + shield_title: beloning voor de volgende commit + edit: + project_settings: "%{project} project instellingen" + branch: Branch + default_branch: Standaard branch + tipping_policies: Beloningspolicies + hold_tips: "Stuur de beloningen niet direct. Geef eigenaren de mogenlijkheid om de hoogte in te stellen voor ze worden verstuurd." + save: Project instellingen opslaan + disable_notifications: Niets melden aan nieuwe bijdragers + decide_tip_amounts: + commit: Commit + author: Auteur + message: Bericht + tip: Beloning (afhangkelijk van het project saldo) + submit: Stuur de geselecteerde hoeveelheid beloningen + blacklisted: + title: Sorry, dit project ondersteund geen beloningen! + message: De auteur van het project heeft ervoor gekozen om geen beloningen toe te staan. + tips: + index: + tips: Beloningen + project_tips: '%{project} beloningen' + user_tips: "%{user} beloningen" + created_at: Aangemaakt op + commiter: Commiter + project: Project + commit: Commit + amount: Bedrag + refunded: Teruggestord aan project saldo + undecided: De hoogte van de beloning is nog niet vastgesteld + no_bitcoin_address: Gebruiker heeft geen bitcoin adres opgegeven + below_threshold: "Gebruikers saldo is onder de terugstorddrempel" + waiting: Wachten om terug gestord te worden + error: (er is een fout opgetreden bij het overmaken) + deposits: + index: + project_deposits: '%{project} stortingen' + deposits: Stortingen + created_at: Toegevoegd op + project: Project + amount: Bedrag + transaction: Transactie + confirmed: Bevestigd + confirmed_yes: 'Ja' + confirmed_no: 'Nee' + users: + index: + title: Top bijdagers + name: Naam + commits_count: Commits beloond + withdrawn: Teruggetrokken + show: + balance: Saldo + threshold: "Je ontvangt he geld zodra je zaldo over het minimum is van: %{threshold}" + see_all: bekijk alles + received: "%{time} ontvangen %{amount} voor commit %{commit} in %{project}" + bitcoin_address_placeholder: Jouw bitcoin adres + notify: Stuur me een bericht over nieuwe beloningen (niet meer als 1 keer per maand) + submit_user: Gegevens opslaan + change_password: Wijzig wachtwoord + submit_password: Wijzig mijn wachtwoord + withdrawals: + index: + title: Laatste terugroepingen + created_at: Aangemaakt op + transaction: Transactiie + result: Resultaat + error: Foutief + success: Success + devise: + sessions: + new: + title: Registreren + remember_me: Mij onthouden + submit: Inloggen + registrations: + new: + title: Registreren + submit: Registreren + passwords: + new: + title: Wachtwoord vergeten? + submit: Stuur me de instructies om mijn wachtwoord te resetten + edit: + title: Wachtwoord aanpassen + submit: Mijn wachtwoord aanpassen + confirmations: + new: + title: Stuur bevestigingsinstructies opnieuw + submit: Stuur bevestigingsinstructies opnieuw + links: + sign_in: Inloggen + sign_up: Registreren + recover: Wachtwoord vergeten? + confirm: Geen bevestigingsintructies ontvangen? + sign_in_with: "Inloggen met %{provider}" + errors: + primary_email: Je e-mail adres moet gevalideerd worden. + onmiauth_info: We kunnen je gegevens niet ophalen. + activerecord: + attributes: + user: + email: E-mail + bitcoin_address: Bitcoin adres + password: Wachtwoord + password_confirmation: Wachtwoord bevestigen + display_name: Weergavenaam + omniauth_providers: + github: GitHub + bitbucket: BitBucket + general: + or: of + disclaimer: + line1: "We zijn niet gerelateerd aan de meeste van de projecten, haar eigenaren zijn zich misschien niet bewust van of actief tegen het gebruik van tip4commit. Door moegenlijke etische en wettelijke problemen moeten we misschien enkele van de projecten uit de lijst wissen (op wens van de prohect eigenaar)." + line2: "Ook sturen we geen melding meer aan de ontwikkelaars. Dus we kunnen niet garanteren dat de donaties ze bereiken." + line3: "Door het doneren van geld gaat u ermee akkoord dat ze naar Free Software Foundation of elders naar Tip4Commit's keuze." From bcd5bed4d612674cbb78ff03a6d31edd3b81311f Mon Sep 17 00:00:00 2001 From: Dennis van de Hoef Date: Mon, 2 Feb 2015 22:25:31 +0100 Subject: [PATCH 158/415] add generated javascipt --- app/assets/javascripts/i18n/translations.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js index 029f45b8..31c58a41 100644 --- a/app/assets/javascripts/i18n/translations.js +++ b/app/assets/javascripts/i18n/translations.js @@ -1,2 +1,2 @@ var I18n = I18n || {}; -I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}}}; \ No newline at end of file +I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"nl":{"js":{"errors":{"value":{"invalid":"De waarde is ongeldig"},"email":{"invalid":"Ongeldig e-mail adres","blank":"E-mail is verplicht en kan niet leeg blijven"},"password":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"},"password_confirmation":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}}}; \ No newline at end of file From d85427cb626568868196348eac22b909c59750e0 Mon Sep 17 00:00:00 2001 From: Stein Inge Morisbak Date: Mon, 9 Feb 2015 21:29:59 +0100 Subject: [PATCH 159/415] Update blacklist.yml --- config/blacklist.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/blacklist.yml b/config/blacklist.yml index 19f7c9d6..42b994c3 100644 --- a/config/blacklist.yml +++ b/config/blacklist.yml @@ -35,3 +35,4 @@ - https://github.com/MediaCrush/* - https://github.com/KnightOS/* - https://github.com/KerbalStuff/* +- https://github.com/digipost From 8eb1ef52fa807d0cd5f5beb5229de21d1fa11588 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Tue, 10 Feb 2015 09:30:25 +0530 Subject: [PATCH 160/415] Update blacklist.yml --- config/blacklist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/blacklist.yml b/config/blacklist.yml index 42b994c3..78b26d62 100644 --- a/config/blacklist.yml +++ b/config/blacklist.yml @@ -35,4 +35,4 @@ - https://github.com/MediaCrush/* - https://github.com/KnightOS/* - https://github.com/KerbalStuff/* -- https://github.com/digipost +- https://github.com/digipost/* From eb1734c00c7676f33e8db494832cb72989c52867 Mon Sep 17 00:00:00 2001 From: Dennis van de Hoef Date: Mon, 9 Feb 2015 22:07:55 +0100 Subject: [PATCH 161/415] add the gravatar gem --- Gemfile | 2 ++ Gemfile.lock | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Gemfile b/Gemfile index b1976865..c29623a2 100644 --- a/Gemfile +++ b/Gemfile @@ -37,6 +37,8 @@ gem "i18n-js" gem 'kaminari-i18n' gem 'devise-i18n' +gem 'easy_gravatar' + group :development do gem 'capistrano', '~> 3.0.1' gem 'capistrano-rvm', '~> 0.1.0', github: 'capistrano/rvm' diff --git a/Gemfile.lock b/Gemfile.lock index d9298f3b..cda584a2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -138,6 +138,7 @@ GEM dusen (0.4.10) activerecord edge_rider (>= 0.2.5) + easy_gravatar (1.0.0) edge_rider (0.3.0) activerecord erubis (2.7.0) @@ -340,6 +341,7 @@ DEPENDENCIES devise (~> 3.2.2) devise-i18n dusen + easy_gravatar factory_girl_rails (~> 4.3.0) haml-rails (~> 0.5.3) http_accept_language From aed307aef219127803175fdfff716fe9ca038d76 Mon Sep 17 00:00:00 2001 From: Dennis van de Hoef Date: Wed, 11 Feb 2015 21:40:13 +0100 Subject: [PATCH 162/415] show gravatar display name and bitcoin adress --- app/assets/stylesheets/users.css.scss | 10 ++++++++++ app/models/user.rb | 12 ++++++++++++ app/views/users/show.html.haml | 8 +++++++- config/locales/en.yml | 1 + config/locales/nl.yml | 1 + 5 files changed, 31 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/users.css.scss b/app/assets/stylesheets/users.css.scss index 31a2eacb..02dd9047 100644 --- a/app/assets/stylesheets/users.css.scss +++ b/app/assets/stylesheets/users.css.scss @@ -1,3 +1,13 @@ // Place all the styles related to the Users controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ + + +.from-gravatar{ + display: block; + margin-bottom: 15px; + cursor: pointer; + font-style: italic; + margin-top: -12px; + padding-left: 14px; +} diff --git a/app/models/user.rb b/app/models/user.rb index d16465b5..5b1cd575 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -24,6 +24,14 @@ def balance tips.decided.unpaid.sum(:amount) end + def gravatar_bitcoin + gravatar.get_value :currency, :bitcoin + end + + def gravatar_display_name + gravatar.get_value :displayName + end + def display_name attributes['display_name'].presence || name.presence || nickname.presence || email end @@ -63,6 +71,10 @@ def ready_for_withdrawal? private + def gravatar + @gravatar ||= Gravatar::new(email) + end + def set_login_token! loop do self.login_token = SecureRandom.urlsafe_base64 diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index 20fcb7aa..fd15340e 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -5,7 +5,7 @@ = btc_human @user.balance %p %small= raw t('.threshold', threshold: btc_human(CONFIG["min_payout"])) - + - if @user_tips.count > 0 %p %strong Last Tips @@ -21,7 +21,13 @@ %p= @user.email = twitter_bootstrap_form_for @user do |f| = f.text_field :bitcoin_address, placeholder: t('.bitcoin_address_placeholder') + - if @user.gravatar_bitcoin.present? + %span.from-gravatar{data:{for: 'user[bitcoin_address]', value: @user.gravatar_bitcoin }} + = "#{t('.use_from_gravatar')}: #{@user.gravatar_bitcoin}" = f.text_field :display_name + - if @user.gravatar_display_name.present? + %span.from-gravatar{data:{for: 'user[display_name]', value: @user.gravatar_display_name }} + = "#{t('.use_from_gravatar')}: #{@user.gravatar_display_name}" - if f.object.bitcoin_address.blank? = f.check_box :unsubscribed, t('.notify'), { checked: !f.object.unsubscribed? }, '0', '1' %br diff --git a/config/locales/en.yml b/config/locales/en.yml index 03ffa159..a3c68bd5 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -176,6 +176,7 @@ en: submit_user: Update user info change_password: Change your password submit_password: Change my password + use_from_gravatar: Use from your gravatar profile withdrawals: index: title: Last Withdrawals diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 06730986..73036b8b 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -176,6 +176,7 @@ nl: submit_user: Gegevens opslaan change_password: Wijzig wachtwoord submit_password: Wijzig mijn wachtwoord + use_from_gravatar: Gebruik van je gravatar profiel withdrawals: index: title: Laatste terugroepingen From 60f6a93142591c55cb4f47e9e031bfebb905c9a8 Mon Sep 17 00:00:00 2001 From: Dennis van de Hoef Date: Wed, 11 Feb 2015 21:40:53 +0100 Subject: [PATCH 163/415] Use gravatar data on-click --- app/assets/javascripts/users.js.coffee | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/users.js.coffee b/app/assets/javascripts/users.js.coffee index 69410427..056e5d7a 100644 --- a/app/assets/javascripts/users.js.coffee +++ b/app/assets/javascripts/users.js.coffee @@ -8,21 +8,21 @@ load_bootstrap_validator = -> message: I18n.t('js.errors.email.invalid') notEmpty: message: I18n.t('js.errors.email.blank') - + "user[password]": validators: notEmpty: message: I18n.t('js.errors.password.blank') identical: - field: 'user[password_confirmation]' + field: 'user[password_confirmation]' message: I18n.t('js.errors.password.invalid') - + "user[password_confirmation]": validators: notEmpty: message: I18n.t('js.errors.password_confirmation.blank') identical: - field: 'user[password]' + field: 'user[password]' message: I18n.t('js.errors.password_confirmation.invalid') $('.session_form').bootstrapValidator message: I18n.t('js.errors.value.invalid') @@ -33,10 +33,14 @@ load_bootstrap_validator = -> message: I18n.t('js.errors.email.invalid') notEmpty: message: I18n.t('js.errors.email.blank') - + "user[password]": validators: notEmpty: message: I18n.t('js.errors.password_confirmation.blank') -$(document).on "ready page:load", load_bootstrap_validator \ No newline at end of file +$(document).on "ready page:load", load_bootstrap_validator + +$ -> + $('.from-gravatar').click (e) -> + $('input[name="'+$(this).data('for')+'"]').val($(this).data('value')) From 3f5462672cd2fe52f4e8b1e47d7590f2530c9109 Mon Sep 17 00:00:00 2001 From: win32re Date: Sun, 15 Feb 2015 20:12:29 +0100 Subject: [PATCH 164/415] Update README.md --- README.md | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 49017eb5..e0401e91 100644 --- a/README.md +++ b/README.md @@ -6,18 +6,17 @@ Tip4commit Donate bitcoins to open source projects or receive tips for code contributions. -| | | -| -------------- | ------------------------------------------------- | -| Official site: | https://tip4commit.com/ | -| Discussions: | https://bitcointalk.org/index.php?topic=315802 | -| FAQs: | https://github.com/tip4commit/tip4commit/wiki/FAQ | -| Issues: | https://github.com/tip4commit/tip4commit/issues | - +Name | Link +----|----| +Official site | https://tip4commit.com/ +Discussions | https://bitcointalk.org/index.php?topic=31580 +FAQs | https://github.com/tip4commit/tip4commit/wiki/FAQ +Issues | https://github.com/tip4commit/tip4commit/issues Developers ========== -If you would like to contribute to the development of tip4commit, you can find the contribution guidelines and installation instructions on the [developer README](https://github.com/tip4commit/tip4commit/wiki/Developer-README) +If you would like to contribute to the development of tip4commit, you can find the contribution guidelines and installation instructions in the [developer README](https://github.com/tip4commit/tip4commit/wiki/Developer-README) License From 03f369c51158540d1fe2eb5d7b25ad8ea96d3c56 Mon Sep 17 00:00:00 2001 From: Dennis van de Hoef Date: Mon, 16 Feb 2015 21:33:27 +0100 Subject: [PATCH 165/415] fix specs --- Gemfile.lock | 2 +- app/models/user.rb | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index cda584a2..2e9158ef 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -138,7 +138,7 @@ GEM dusen (0.4.10) activerecord edge_rider (>= 0.2.5) - easy_gravatar (1.0.0) + easy_gravatar (1.0.1) edge_rider (0.3.0) activerecord erubis (2.7.0) diff --git a/app/models/user.rb b/app/models/user.rb index 5b1cd575..52ac680f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -25,10 +25,12 @@ def balance end def gravatar_bitcoin + return '' unless gravatar gravatar.get_value :currency, :bitcoin end def gravatar_display_name + return '' unless gravatar gravatar.get_value :displayName end @@ -72,7 +74,7 @@ def ready_for_withdrawal? private def gravatar - @gravatar ||= Gravatar::new(email) + @gravatar ||= Gravatar::new(nil) end def set_login_token! From b6dc2fe13c8d65a603f4b315626b38041873b8ba Mon Sep 17 00:00:00 2001 From: win32re Date: Fri, 27 Feb 2015 12:04:11 +0100 Subject: [PATCH 166/415] Add Croatian translation to application.rb --- config/application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index cea2c4c2..d2e107e5 100644 --- a/config/application.rb +++ b/config/application.rb @@ -36,7 +36,7 @@ class Application < Rails::Application config.autoload_paths += %W(#{config.root}/lib) config.assets.initialize_on_precompile = true - config.available_locales = %w(en fr nl ru pl) + config.available_locales = %w(en fr nl ru pl hr) end end From c9997f2bb0a000bd40cf24b5f3d9417167752023 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Wed, 11 Mar 2015 11:30:10 +0530 Subject: [PATCH 167/415] added croatian flag --- app/assets/images/.keep | 0 app/assets/images/flags/hr.png | Bin 0 -> 524 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 app/assets/images/.keep create mode 100755 app/assets/images/flags/hr.png diff --git a/app/assets/images/.keep b/app/assets/images/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/app/assets/images/flags/hr.png b/app/assets/images/flags/hr.png new file mode 100755 index 0000000000000000000000000000000000000000..696b515460ddb670acb7e9de4438aaf21fc5fb77 GIT binary patch literal 524 zcmV+n0`vWeP)@|4`Xj5kLU3fF!G{fyDoR{}_Q36Vv~H|Ns5{^Z)NZrr*Dqe*gae=g)r_`DNuw zfB*t(VEF(4$y0{Ee}M=nS{mB(NB;kxJOBSE{F_{n`2Y8>|G$0##TjK~fi?gH5EIz! z|8Uj6|NiY-l-<0|OxA@1MWlzkmOI;leLR z$De1;{4g{7^y$;LZ{NOt{rct07a;lk`E!5(f@%OM1_PkhC8`eE9egqWbga z&p;hdpFRZ$Adm)#>fe8W4*Ct02B|hR1*-n0rS<;(dx&bFRY1n$$BzL5h>;=uaC^Mc z(+@v?|NZ~x@4w%F|9yUZW7+yTpo@LH>e(bUfFghX{rmIxzpNnpimU?w0mQ=a>kp9s z8>AGffmuv7DrFgv!3yU7{`2q8f1ngFoPlxn4 Date: Wed, 11 Mar 2015 12:01:16 +0530 Subject: [PATCH 168/415] fixed gravatar integration --- app/assets/javascripts/i18n/translations.js | 2 +- app/models/user.rb | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js index 31c58a41..c7a35c14 100644 --- a/app/assets/javascripts/i18n/translations.js +++ b/app/assets/javascripts/i18n/translations.js @@ -1,2 +1,2 @@ var I18n = I18n || {}; -I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"nl":{"js":{"errors":{"value":{"invalid":"De waarde is ongeldig"},"email":{"invalid":"Ongeldig e-mail adres","blank":"E-mail is verplicht en kan niet leeg blijven"},"password":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"},"password_confirmation":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}}}; \ No newline at end of file +I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"nl":{"js":{"errors":{"value":{"invalid":"De waarde is ongeldig"},"email":{"invalid":"Ongeldig e-mail adres","blank":"E-mail is verplicht en kan niet leeg blijven"},"password":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"},"password_confirmation":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}}}; \ No newline at end of file diff --git a/app/models/user.rb b/app/models/user.rb index 52ac680f..b3c3ced7 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -25,13 +25,19 @@ def balance end def gravatar_bitcoin - return '' unless gravatar - gravatar.get_value :currency, :bitcoin + begin + gravatar.get_value :currency, :bitcoin + rescue URI::InvalidURIError => e + nil + end end def gravatar_display_name - return '' unless gravatar - gravatar.get_value :displayName + begin + gravatar.get_value :displayName + rescue URI::InvalidURIError => e + nil + end end def display_name @@ -74,7 +80,7 @@ def ready_for_withdrawal? private def gravatar - @gravatar ||= Gravatar::new(nil) + @gravatar ||= Gravatar::new(email) end def set_login_token! From 49610d41140a79479452bd92108f27150901ad93 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Fri, 19 Jun 2015 14:45:11 +0500 Subject: [PATCH 169/415] fixed gravatar integration #240 --- app/models/user.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index b3c3ced7..45a56054 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -27,7 +27,7 @@ def balance def gravatar_bitcoin begin gravatar.get_value :currency, :bitcoin - rescue URI::InvalidURIError => e + rescue URI::InvalidURIError, NoMethodError => e nil end end @@ -35,7 +35,7 @@ def gravatar_bitcoin def gravatar_display_name begin gravatar.get_value :displayName - rescue URI::InvalidURIError => e + rescue URI::InvalidURIError, NoMethodError => e nil end end From 0a27364c92ac94e6ab0171f3d4ba54586dfeda2e Mon Sep 17 00:00:00 2001 From: sssemil Date: Fri, 19 Jun 2015 23:15:21 +0500 Subject: [PATCH 170/415] =?UTF-8?q?Show=20balance=20and=20next=20tip=20in?= =?UTF-8?q?=20BTC,=20mBTC,=20=CE=BCBTC=20and=20Satoshi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 2 +- app/helpers/application_helper.rb | 28 +++++++++++++++++++++---- app/models/user.rb | 4 ++++ app/views/layouts/application.html.haml | 4 ++-- app/views/users/show.html.haml | 10 ++++++--- db/migrate/20150620054216_add_denom.rb | 5 +++++ 6 files changed, 43 insertions(+), 10 deletions(-) create mode 100755 db/migrate/20150620054216_add_denom.rb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 2dfbc84d..57d67b1a 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -38,7 +38,7 @@ def login private def users_params - params.require(:user).permit(:bitcoin_address, :password, :password_confirmation, :unsubscribed, :display_name) + params.require(:user).permit(:bitcoin_address, :password, :password_confirmation, :unsubscribed, :display_name, :denom) end def load_user ; super params ; end ; diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a9f68c07..d59ec988 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,13 +1,33 @@ module ApplicationHelper - def btc_human amount, options = {} + def btc_human amount, denom, options = {} nobr = options.has_key?(:nobr) ? options[:nobr] : true - btc = "%.8f Ƀ" % to_btc(amount) + if denom === 0 + btc = to_btc(amount) + elsif denom === 1 + btc = to_mbtc(amount) + elsif denom === 2 + btc = to_ubtc(amount) + elsif denom === 3 + btc = to_satoshi(amount) + end btc = "#{btc}" if nobr btc.html_safe end - def to_btc satoshies - (1.0*satoshies.to_i/1e8) + def to_btc satoshies + "%.8f Ƀ" % (1.0*satoshies.to_i/1e8) + end + + def to_mbtc satoshies + "%.5f mɃ" % (1.0*satoshies.to_i/1e5) + end + + def to_ubtc satoshies + "%.2f μɃ" % (1.0*satoshies.to_i/1e2) + end + + def to_satoshi satoshies + "%.0f Satoshi" % satoshies end def render_flash_messages diff --git a/app/models/user.rb b/app/models/user.rb index b3c3ced7..440b89bd 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -24,6 +24,10 @@ def balance tips.decided.unpaid.sum(:amount) end + def denom + attributes['denom'].presence || denom.presence + end + def gravatar_bitcoin begin gravatar.get_value :currency, :bitcoin diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 89a999b0..80fcd22c 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -38,9 +38,9 @@ = current_user.display_name \/ - if current_user.nickname.present? - = link_to btc_human(current_user.balance), user_pretty_path(current_user.nickname) + = link_to btc_human(current_user.balance, current_user.denom), user_pretty_path(current_user.nickname) - else - = link_to btc_human(current_user.balance), current_user + = link_to btc_human(current_user.balance, current_user.denom), current_user \/ = link_to t('links.sign_out'), destroy_user_session_path, method: :delete - else diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index fd15340e..41d48e0b 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -2,9 +2,13 @@ %p %strong= t('.balance') %p - = btc_human @user.balance + = btc_human @user.balance, @user.denom + = form_for(@user) do |f| + = f.select :denom, + options_for_select([["BTC", "0"], ["mBTC", "1"], ["μBTC", "2"], ["Satoshi", "3"]], selected: @user.denom) + = f.submit "save" %p - %small= raw t('.threshold', threshold: btc_human(CONFIG["min_payout"])) + %small= raw t('.threshold', threshold: btc_human(CONFIG["min_payout"], @user.denom)) - if @user_tips.count > 0 %p @@ -14,7 +18,7 @@ %ul - @recent_tips.each do |tip| %li - = raw t('.received', time: l(tip.created_at, format: :short), amount: btc_human(tip.amount), commit: link_to(tip.commit[0..6], "https://github.com/#{tip.project.full_name}/commit/#{tip.commit}", target: :blank), project: link_to(tip.project.full_name, pretty_project_path(tip.project))) + = raw t('.received', time: l(tip.created_at, format: :short), amount: btc_human(tip.amount, @user.denom), commit: link_to(tip.commit[0..6], "https://github.com/#{tip.project.full_name}/commit/#{tip.commit}", target: :blank), project: link_to(tip.project.full_name, pretty_project_path(tip.project))) %p %strong= User.human_attribute_name(:email) diff --git a/db/migrate/20150620054216_add_denom.rb b/db/migrate/20150620054216_add_denom.rb new file mode 100755 index 00000000..91cde8be --- /dev/null +++ b/db/migrate/20150620054216_add_denom.rb @@ -0,0 +1,5 @@ +class AddDenom < ActiveRecord::Migration + def change + add_column :users, :denom, :integer, default: 0 + end +end From 56edc04b98577b3ffdd250191237fa32d013156a Mon Sep 17 00:00:00 2001 From: Emil Suleymanov Date: Sun, 21 Jun 2015 18:51:09 +0500 Subject: [PATCH 171/415] Fix building --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 7f28cef1..2041e869 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,5 +10,6 @@ before_script: - cp config/database.yml.sample config/database.yml script: + - bundle exec rake db:migrate - bundle exec rake spec - bundle exec rake cucumber From 6ec4d717ca509af721e3cea369535d6f55d96ebf Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 25 Jun 2015 15:39:47 +0200 Subject: [PATCH 172/415] Update hr.yml --- config/locales/hr.yml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/config/locales/hr.yml b/config/locales/hr.yml index ebfdb6c7..ba647343 100644 --- a/config/locales/hr.yml +++ b/config/locales/hr.yml @@ -4,12 +4,12 @@ hr: title: Doprinosite otvorenom izvoru description: Donirajte bitcoine u otvoreni izvor projekata ili napravite cinove i dobite napojnice. menu: - home: Pocetna stranica + home: Početna stranica projects: Podrzavani Projekti footer: - text: "Izvorni kod dostupan na %{github_link} i mozete takoder %{support_link} razvoj." + text: "Izvorni kod je dostupan na %{github_link} a možete i %{support_link} razvoj." github_link: GitHub - support_link: podrzi + support_link: podržati follow_link: Prati @tip4commit links: sign_up: Sign up @@ -20,9 +20,9 @@ hr: project_not_found: Projekt nije nadjen. access_denied: Pristup odbijen can_assign_more_tips: "Ne mozete dodijeliti vise od 100% dostupnih sredstva." - wrong_bitcoin_address: Greska u updejtanju bitcoin adrese - user_not_found: Korisnik nije naden - access_denied: Niste ovlasteni da napravite ovu akciju! + wrong_bitcoin_address: Greška u bitcoin adresi + user_not_found: Korisnik nije nađen + access_denied: Niste ovlašteni da ovo napravite! notices: project_updated: Postavke projekta su primijenjena tips_decided: Broj napojnica je bio definiran @@ -54,18 +54,18 @@ hr: see_projects: Vidjeti projekte how_does_it_work: title: Kako ovo radi? - text: Ljudi doniraju bitcoine projektima. Kada se neciji cin potvrdi u repozitorij projekta, mi automatski posaljemo napojnicu autoru. - button: Nauciti o Bitcoin + text: Ljudi doniraju bitcoine projektima. Kada se nečiji commit potvrdi u repozitoriju projekta, mi automatski pošaljemo napojnicu autoru. + button: Nauči više o Bitcoinu donate: - title: Donirati - text: Pronadite projekt u koji zelite posvojiti svoje bitcoine. Vase donacije ce biti akumulirane sa fundovima ostalih donatora kao napojnice za nove cinove. - button: Pronaci ili dodati pojekt + title: Donirajte + text: Pronađite projekt u koji želite uložiti vaše Bitcoine. Vaše donacije ce biti akumulirane sa donacijama ostalih donatora kao napojnice za nove commitove. + button: Pronađi ili dodaj projekt contribute: - title: Doprinositi - text: Idite i popravite nesto! Ako je vas cin odobren od odrzavatelja projekta, dobiti cete napojnicu! - sign_in_text: "Samo provjerite vas email ili %{sign_in_link}." - sign_up_text: "Ako jos niste dobili pozivnicu, moze te se %{sign_up_link} sa valjanom email adresom ili" - button: Podrzavani projekti + title: Doprinesi + text: Idite i popravite nešto! Ako održavatelj projekta odobri vaš commit, dobiti ćete napojnicu! + sign_in_text: "Samo provjerite vaš email ili %{sign_in_link}." + sign_up_text: "Ako još niste dobili pozivnicu, moze te se %{sign_up_link} sa valjanom email adresom ili" + button: Projekti koje podržavamo projects: index: find_project: From 0cb5acd5a05914bcea270b596c0a161eea48c286 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Wed, 1 Jul 2015 14:23:57 +0500 Subject: [PATCH 173/415] fixed tests --- app/helpers/application_helper.rb | 2 +- db/schema.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index d59ec988..e0ed3580 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,5 +1,5 @@ module ApplicationHelper - def btc_human amount, denom, options = {} + def btc_human amount, denom = 0, options = {} nobr = options.has_key?(:nobr) ? options[:nobr] : true if denom === 0 btc = to_btc(amount) diff --git a/db/schema.rb b/db/schema.rb index 9e45e735..03ad325d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20141112064004) do +ActiveRecord::Schema.define(version: 20150620054216) do create_table "collaborators", force: true do |t| t.integer "project_id" @@ -124,6 +124,7 @@ t.string "confirmation_token" t.string "unconfirmed_email" t.string "display_name" + t.integer "denom", default: 0 end add_index "users", ["email"], name: "index_users_on_email", unique: true From 5cde4904b6ae6937c421e3dafde5b15f2b673694 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Wed, 1 Jul 2015 16:06:29 +0500 Subject: [PATCH 174/415] removed coingiving because no one is using it and we are going to close this project --- app/views/projects/show.html.haml | 10 ++++------ app/views/user_mailer/new_tip.html.haml | 2 +- config/locales/en.yml | 1 - config/locales/fr.yml | 1 - config/locales/hr.yml | 1 - config/locales/nl.yml | 1 - config/locales/pl.yml | 1 - config/locales/ru.yml | 1 - 8 files changed, 5 insertions(+), 13 deletions(-) diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 9a853120..952722da 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -21,13 +21,11 @@ .col-md-4 .panel.panel-default .panel-heading - %h4.panel-title= t('.project_sponsors') + %h4.panel-title= t('projects.index.support') .panel-body - %iframe{ src: "//coingiving.com/project_sponsors?locale=#{I18n.locale}&url=#{project_url(@project, :protocol => 'https')}", scrolling: "no", style: 'width:100%; height:500px; border:0px; padding:0;overflow:hidden'} - .hidden - %span(data-coingiving="title")= "[tip4commit] " + @project.full_name - %span(data-coingiving="description")= @project.description - %span(data-coingiving="bitcoin-address")= @project.bitcoin_address + %p + %pre= @project.bitcoin_address + .qrcode.centered{data: {qrcode: "bitcoin:#{@project.bitcoin_address}"}} %p = t('.fee', percentage: number_to_percentage(100-CONFIG["our_fee"]*100, precision: 0)) diff --git a/app/views/user_mailer/new_tip.html.haml b/app/views/user_mailer/new_tip.html.haml index cb7f9d30..b86b4a8a 100644 --- a/app/views/user_mailer/new_tip.html.haml +++ b/app/views/user_mailer/new_tip.html.haml @@ -4,7 +4,7 @@ %p Your current balance is #{btc_human @user.balance}. If you don't enter a bitcoin address your tips will be returned to the project in 30 days. -%p If you don't need bitcoins you can redirect your funds to any charity by using its address which you can find at #{link_to 'coingiving.com', 'https://coingiving.com/'}. +%p If you don't need bitcoins you can redirect your funds to #{link_to 'Free Software Foundation', 'https://www.fsf.org/about/ways-to-donate'}. %p= link_to 'Sign In', login_users_url(token: @user.login_token) diff --git a/config/locales/en.yml b/config/locales/en.yml index a3c68bd5..1b073b13 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -85,7 +85,6 @@ en: edit_project: Change project settings decide_tip_amounts: Decide tip amounts disabled_notifications: "Project maintainers have decided not to notify new contributors about tips and they probably don't like this way of funding." - project_sponsors: Project sponsors fee: "%{percentage} of deposited funds will be used to tip for new commits." balance: Balance deposits: deposits diff --git a/config/locales/fr.yml b/config/locales/fr.yml index fbda1b23..75b80695 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -83,7 +83,6 @@ fr: edit_project: Changer les paramètres du projet decide_tip_amounts: Choisir un montant de pourboire disabled_notifications: "Les responsables du projet ont décidé de ne pas prévenir les nouveaux contributeurs au sujet des pourboires, et n'apprécient probablement pas ce type de rémunération." - project_sponsors: Sponsors du projet fee: "%{percentage} des fonds déposés seront utilisés pour récompenser les nouvelles contributions." balance: Fonds deposits: dépôts diff --git a/config/locales/hr.yml b/config/locales/hr.yml index ba647343..331d5f43 100644 --- a/config/locales/hr.yml +++ b/config/locales/hr.yml @@ -83,7 +83,6 @@ hr: edit_project: Promijeni postavke projekta decide_tip_amounts: Odredi kolicinu napojnica disabled_notifications: "Odrzavatelji projekata su odlucili da nece obavjestiti nove doprinositelje o napojnicama i najvjerovatnije ne vole ovaj nacin isplate." - project_sponsors: Sponzori projekta fee: "%{percentage} od polozenih isplata ce se koristiti kao napojnice za nove cinove." balance: Ravnoteza deposits: polozenja diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 73036b8b..8d154459 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -85,7 +85,6 @@ nl: edit_project: project instellingen aanpassen decide_tip_amounts: Beloningen instellen disabled_notifications: "Project eigenaren hebben besloten om nieuwe ondersteuners niet in te lichten over beloningen. Ze vinden deze manier van beloningen waarschijnlijk niet goed." - project_sponsors: Project sponsoren fee: "%{percentage} van gesponsordt geld wordt gebruikt voor de ondersteuning van nieuwe commits." balance: Saldo deposits: stortingen diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 9b1e612f..633ced1a 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -83,7 +83,6 @@ pl: edit_project: Zmień ustawienia projektu decide_tip_amounts: Ustal rozmiary napiwków disabled_notifications: "Nadzorcy projektów zdecydowali nie powiadamiać nowych współpracowników o napiwkach i prawdopodobnie nie lubią tego typu finansowania." - project_sponsors: Sponsorzy projektu fee: "%{percentage} z salda zostanie użyte jako następny napiwek." balance: saldo deposits: wpłaty diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 9eecd888..8821b7e3 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -87,7 +87,6 @@ ru: edit_project: Изменить настройки проекта decide_tip_amounts: Установить сумму чаевых disabled_notifications: "Контрибьюторы проекта решили не уведомлять новых участников о чаевых и, вероятно, им не нравится такой способ финансирования." - project_sponsors: Спонсоры проекта fee: "%{percentage} средств будет выплачено в качестве чаевых за новый коммит." balance: Баланс deposits: депозиты From 3390768454626cbfc31835e348e97fd7974ff72a Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Fri, 3 Jul 2015 16:23:52 +0500 Subject: [PATCH 175/415] fixed shield --- app/helpers/projects_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 5911ecd9..c7cec444 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -1,7 +1,7 @@ module ProjectsHelper def shield_btc_amount amount - btc_amount = to_btc amount + btc_amount = amount / 1e8 "%.#{9 - btc_amount.to_i.to_s.length}f Ƀ" % btc_amount end From a8bc47716ae4740186b07a7b714125c06ef00185 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Fri, 3 Jul 2015 16:31:36 +0500 Subject: [PATCH 176/415] use current_user.denom everywhere --- app/helpers/application_helper.rb | 3 ++- app/views/layouts/application.html.haml | 4 ++-- app/views/users/show.html.haml | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e0ed3580..04ea5f4d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,6 +1,7 @@ module ApplicationHelper - def btc_human amount, denom = 0, options = {} + def btc_human amount, denom = nil, options = {} nobr = options.has_key?(:nobr) ? options[:nobr] : true + denom = denom || current_user.try(:denom) || 0 if denom === 0 btc = to_btc(amount) elsif denom === 1 diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 80fcd22c..89a999b0 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -38,9 +38,9 @@ = current_user.display_name \/ - if current_user.nickname.present? - = link_to btc_human(current_user.balance, current_user.denom), user_pretty_path(current_user.nickname) + = link_to btc_human(current_user.balance), user_pretty_path(current_user.nickname) - else - = link_to btc_human(current_user.balance, current_user.denom), current_user + = link_to btc_human(current_user.balance), current_user \/ = link_to t('links.sign_out'), destroy_user_session_path, method: :delete - else diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index 41d48e0b..f5608c03 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -2,13 +2,13 @@ %p %strong= t('.balance') %p - = btc_human @user.balance, @user.denom + = btc_human @user.balance = form_for(@user) do |f| = f.select :denom, options_for_select([["BTC", "0"], ["mBTC", "1"], ["μBTC", "2"], ["Satoshi", "3"]], selected: @user.denom) = f.submit "save" %p - %small= raw t('.threshold', threshold: btc_human(CONFIG["min_payout"], @user.denom)) + %small= raw t('.threshold', threshold: btc_human(CONFIG["min_payout"])) - if @user_tips.count > 0 %p @@ -18,7 +18,7 @@ %ul - @recent_tips.each do |tip| %li - = raw t('.received', time: l(tip.created_at, format: :short), amount: btc_human(tip.amount, @user.denom), commit: link_to(tip.commit[0..6], "https://github.com/#{tip.project.full_name}/commit/#{tip.commit}", target: :blank), project: link_to(tip.project.full_name, pretty_project_path(tip.project))) + = raw t('.received', time: l(tip.created_at, format: :short), amount: btc_human(tip.amount), commit: link_to(tip.commit[0..6], "https://github.com/#{tip.project.full_name}/commit/#{tip.commit}", target: :blank), project: link_to(tip.project.full_name, pretty_project_path(tip.project))) %p %strong= User.human_attribute_name(:email) From 3dbba5c43f24129f3560248be14dd578badb2c6c Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Fri, 3 Jul 2015 16:36:45 +0500 Subject: [PATCH 177/415] fixed nil amount bug --- app/helpers/application_helper.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 04ea5f4d..480b0b23 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,7 +1,8 @@ module ApplicationHelper def btc_human amount, denom = nil, options = {} + amount ||= 0 nobr = options.has_key?(:nobr) ? options[:nobr] : true - denom = denom || current_user.try(:denom) || 0 + denom ||= current_user.try(:denom) || 0 if denom === 0 btc = to_btc(amount) elsif denom === 1 From 620839df7110fc845ac68026a2f96773a71040e9 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Fri, 3 Jul 2015 16:47:43 +0500 Subject: [PATCH 178/415] fixed tests. moved denom to options --- app/helpers/application_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 480b0b23..e850cc3a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,8 +1,8 @@ module ApplicationHelper - def btc_human amount, denom = nil, options = {} + def btc_human amount, options = {} amount ||= 0 nobr = options.has_key?(:nobr) ? options[:nobr] : true - denom ||= current_user.try(:denom) || 0 + denom = options.has_key?(:denom) ? options[:denom] : (try(:current_user) ? current_user.denom : 0) if denom === 0 btc = to_btc(amount) elsif denom === 1 From 1d9c7cdcd1b497253c54b26ca1feca20d0ce7972 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sun, 12 Jul 2015 13:00:52 +0200 Subject: [PATCH 179/415] Update hr.yml --- config/locales/hr.yml | 66 +++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/config/locales/hr.yml b/config/locales/hr.yml index 331d5f43..f04af922 100644 --- a/config/locales/hr.yml +++ b/config/locales/hr.yml @@ -1,13 +1,13 @@ hr: tip4commit: Tip4Commit meta: - title: Doprinosite otvorenom izvoru - description: Donirajte bitcoine u otvoreni izvor projekata ili napravite cinove i dobite napojnice. + title: Doprinesite open source-u + description: Donirajte bitcoine open source projektima ili napravite promjene i zaradite napojnice. menu: home: Početna stranica - projects: Podrzavani Projekti + projects: Podržavani projekti footer: - text: "Izvorni kod je dostupan na %{github_link} a možete i %{support_link} razvoj." + text: "Izvorni kod je dostupan na %{github_link}u a možete i %{support_link} razvoj." github_link: GitHub support_link: podržati follow_link: Prati @tip4commit @@ -39,72 +39,72 @@ hr: js: errors: value: - invalid: Vrijednost nevazeca + invalid: Neispravna vrijednost email: - invalid: Nezaveca email adresa - blank: Email je potreban i ne moze biti prazno + invalid: Neispravna email adresa + blank: Email je obavezan password: - blank: Lozinka je potrebna i ne moze biti prazno - invalid: Lozinka i njezina potvrda nisu isti + blank: Lozinka je obavezma + invalid: Lozinka i potvrda nisu isti password_confirmation: - blank: Potvrda lozinke je potrebna i ne moze biti prazno - invalid: Lozinka i potvrda lozinke nisu isti + blank: Potvrda lozinke je obavezna + invalid: Lozinka i potvrda nisu isti home: index: - see_projects: Vidjeti projekte + see_projects: Vidi projekte how_does_it_work: title: Kako ovo radi? - text: Ljudi doniraju bitcoine projektima. Kada se nečiji commit potvrdi u repozitoriju projekta, mi automatski pošaljemo napojnicu autoru. + text: Ljudi doniraju bitcoine projektima. Kada je nečija promjena potvrđena, mi automatski pošaljemo napojnicu autoru promjene. button: Nauči više o Bitcoinu donate: title: Donirajte - text: Pronađite projekt u koji želite uložiti vaše Bitcoine. Vaše donacije ce biti akumulirane sa donacijama ostalih donatora kao napojnice za nove commitove. + text: Pronađite projekt u koji želite uložiti vaše Bitcoine. Vaše donacije će biti akumulirane sa donacijama ostalih donatora kao napojnice za nove commitove. button: Pronađi ili dodaj projekt contribute: title: Doprinesi - text: Idite i popravite nešto! Ako održavatelj projekta odobri vaš commit, dobiti ćete napojnicu! + text: Idite i popravite nešto! Ako održavatelj projekta odobri vašu promjenu, dobiti ćete napojnicu! sign_in_text: "Samo provjerite vaš email ili %{sign_in_link}." sign_up_text: "Ako još niste dobili pozivnicu, moze te se %{sign_up_link} sa valjanom email adresom ili" button: Projekti koje podržavamo projects: index: find_project: - placeholder: Upisite GitHub URL projekta kako biste dodati projekt ili bilo koju kljucnu rijec da biste je nasli... - button: Nadji ili dodaj projekt + placeholder: Upišite GitHub URL projekta kako biste dodati projekt ili bilo koju ključnu rijeć da biste je našli... + button: Nađi ili dodaj projekt repository: Repozitorij description: Opis watchers: Gledatelji balance: Ravnoteza forked_from: Odvojeno od - support: Podrzavaj + support: Podrži show: - title: "Doprinosi %{project}" + title: "Doprinesi %{project}" fetch_pending: (Pending initial fetch) edit_project: Promijeni postavke projekta - decide_tip_amounts: Odredi kolicinu napojnica + decide_tip_amounts: Odredi količinu napojnica disabled_notifications: "Odrzavatelji projekata su odlucili da nece obavjestiti nove doprinositelje o napojnicama i najvjerovatnije ne vole ovaj nacin isplate." fee: "%{percentage} od polozenih isplata ce se koristiti kao napojnice za nove cinove." balance: Ravnoteza - deposits: polozenja - custom_tip_size: (Svaki novi cin dobiva postotak dostune ravnoteze) - default_tip_size: "(Svaki novi cin dobiva %{percentage} dostupne ravnoteze)" + deposits: depoziti + custom_tip_size: (svaka nova promjena dobiva određen postotak dostupnih bitcoina) + default_tip_size: "(svaka nova promjena će dobiti %{percentage} dostupnih bitcoina)" unconfirmed_amount: "(%{amount} nepotvrdeno)" tipping_policies: Pravila o napojnicama - updated_by_user: "(Zadnje updejtao %{name} na %{date})" - updated_by_unknown: "(Zadnje updejtano %{date})" - tips_paid: Napojnice placene + updated_by_user: "(Zadnje promjenio %{name} %{date})" + updated_by_unknown: "(Zadnje promjenjeno %{date})" + tips_paid: Ukupno količina isplaćenih napojnica unclaimed_amount: "(%{amount} od ovog neostvarenog, i biti ce natrag isplaceno u projekt nakon jednog mjeseca.)" last_tips: Zadnje napojnice see_all: Vidjeti sve - received: "dobiveno %{amount}" - will_receive: ce dobiti napojnicu - for_commit: za cin - when_decided: kada je kolicina odlucena - next_tip: Sljedeca napojnica + received: "je dobio %{amount}" + will_receive: će dobiti napojnicu + for_commit: za commit + when_decided: kada je kolicina odlučena + next_tip: Sljedeća napojnica contribute_and_earn: Doprinesi i zaradi - contribute_and_earn_description: "Doniraj Bitcone u ovaj projekt ili %{make_commits_link} i dobij napojnicu. Ako je commit prihvacen %{branch} od strane voditelja projekta i ima Bitcoina na racunu, dobit ce te napojnicu." + contribute_and_earn_description: "Doniraj Bitcone ovom projektu ili %{make_commits_link} i dobij napojnicu. Ako je voditelj projekta prihvatio promjenu u %{branch} i Bitcoini su dostpuni, dobiti će te napojnicu." contribute_and_earn_branch: "u %{branch} branch" - make_commits_link: make commits + make_commits_link: napravi commit tell_us_bitcoin_address: "Samo %{tell_us_link} vasu bitcoin adresu." tell_us_link: recite nam sign_in: "Samo provjerite vas email ili %{sign_in_link}." From 0714dc2b3e10b3c64b6b6a6795daaf93f2a23720 Mon Sep 17 00:00:00 2001 From: Arsen Gasparyan Date: Thu, 23 Jul 2015 22:45:51 +0500 Subject: [PATCH 180/415] simpler warning --- config/locales/en.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 1b073b13..8cb3f63e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -228,6 +228,6 @@ en: general: or: or disclaimer: - line1: "We are not affiliated with most of the projects, their owners may be unaware of or actively against using tip4commit. Due to potential ethical and legal issues we may remove any project from the list by request of project maintainers." - line2: "Also we are not notifying developers about their tips anymore. Thus we can't guarantee that donated funds will really reach them." + line1: "Tip4Commit is not affiliated with most of the projects." + line2: "There is no guarantee that the donated funds will reach the developers." line3: "By donating funds you agree that they can be sent to Free Software Foundation or elsewhere at Tip4Commit's discretion." From c15bbc2be5a8d553174f2c7aa5f284f06241493a Mon Sep 17 00:00:00 2001 From: Arsen Gasparyan Date: Thu, 23 Jul 2015 23:14:55 +0500 Subject: [PATCH 181/415] show the full disclamer only on the project's page --- app/assets/javascripts/i18n/translations.js | 2 +- app/views/layouts/application.html.haml | 2 -- app/views/projects/show.html.haml | 3 +++ config/locales/en.yml | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js index c7a35c14..3bdc6e22 100644 --- a/app/assets/javascripts/i18n/translations.js +++ b/app/assets/javascripts/i18n/translations.js @@ -1,2 +1,2 @@ var I18n = I18n || {}; -I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"nl":{"js":{"errors":{"value":{"invalid":"De waarde is ongeldig"},"email":{"invalid":"Ongeldig e-mail adres","blank":"E-mail is verplicht en kan niet leeg blijven"},"password":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"},"password_confirmation":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}}}; \ No newline at end of file +I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"nl":{"js":{"errors":{"value":{"invalid":"De waarde is ongeldig"},"email":{"invalid":"Ongeldig e-mail adres","blank":"E-mail is verplicht en kan niet leeg blijven"},"password":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"},"password_confirmation":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}}}; \ No newline at end of file diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 89a999b0..50788b9b 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -64,8 +64,6 @@ .footer .alert.alert-warning %p= t('general.disclaimer.line1') - %p= t('general.disclaimer.line2') - %p= t('general.disclaimer.line3') %p.pull-right - ::Rails.application.config.available_locales.each do |locale| diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 952722da..178e02a3 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -28,6 +28,9 @@ .qrcode.centered{data: {qrcode: "bitcoin:#{@project.bitcoin_address}"}} %p = t('.fee', percentage: number_to_percentage(100-CONFIG["our_fee"]*100, precision: 0)) + .alert.alert-warning + %p= t('general.disclaimer.line2') + %p= t('general.disclaimer.line3') .col-md-8 - unless @project.description.blank? diff --git a/config/locales/en.yml b/config/locales/en.yml index 8cb3f63e..197f1925 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -229,5 +229,5 @@ en: or: or disclaimer: line1: "Tip4Commit is not affiliated with most of the projects." - line2: "There is no guarantee that the donated funds will reach the developers." - line3: "By donating funds you agree that they can be sent to Free Software Foundation or elsewhere at Tip4Commit's discretion." + line2: "There is no guarantee that tips will be claimed by developers." + line3: "By donating the funds you agree that they can be sent to the Free Software Foundation or elsewhere at Tip4Commit's discretion." From 150c8ba98a0d415837f185821f0049fa2bf20a68 Mon Sep 17 00:00:00 2001 From: SopaXorzTaker Date: Tue, 28 Jul 2015 17:09:29 +0300 Subject: [PATCH 182/415] Update ru.yml Improve Russian translation --- config/locales/ru.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 8821b7e3..79f216bc 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -12,7 +12,7 @@ ru: support_link: поддержать follow_link: Следите за @tip4commit links: - sign_up: Sign up + sign_up: Регистрация sign_in: Войти sign_in_imp: войдите sign_out: Выйти @@ -22,7 +22,7 @@ ru: project_not_found: Проект не найден. access_denied: Доступ запрещен can_assign_more_tips: "Нельзя использовать более чем 100% свободных средств." - wrong_bitcoin_address: Ошибка обновления биткойн адреса + wrong_bitcoin_address: Ошибка обновления биткоин-адреса user_not_found: Пользователь не найден access_denied: Вы не авторизованы для выполнения данного действия! opt_in_notice: "В связи с многочисленными жалобами мы более не добавляем проекты автоматически. Существующие проекты, не получившие пожертвований, были удалены. Если Вы хотите добавить свой проект, пожалуйста, %{create_issue_link}." @@ -45,8 +45,8 @@ ru: value: invalid: Неверное значение email: - invalid: Ошибка в Email адресе - blank: Email не может быть пустым + invalid: Ошибка в адресе электронной почты + blank: Адрес электронной почты не может быть пустым password: blank: Пароль не может быть пустым invalid: Пароль и его подтверждение не совпадают @@ -73,7 +73,7 @@ ru: projects: index: find_project: - placeholder: Введите GitHub адрес проекта или ключевое слово для поиска... + placeholder: Введите адрес GitHub-проекта или ключевое слово для поиска... button: Найти проект repository: Репозиторий description: Описание @@ -83,7 +83,7 @@ ru: support: "Поддержать проект" show: title: "Помогайте %{project}" - fetch_pending: (Pending initial fetch) + fetch_pending: (Ожидание получения) edit_project: Изменить настройки проекта decide_tip_amounts: Установить сумму чаевых disabled_notifications: "Контрибьюторы проекта решили не уведомлять новых участников о чаевых и, вероятно, им не нравится такой способ финансирования." From 5488a30acdd1af2a6191efcc5634db854e752fea Mon Sep 17 00:00:00 2001 From: SopaXorzTaker Date: Tue, 28 Jul 2015 17:41:45 +0300 Subject: [PATCH 183/415] Update ru.yml --- config/locales/ru.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 79f216bc..d099e7c4 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -2,7 +2,7 @@ ru: tip4commit: Tip4Commit meta: title: Помощь проектам с открытым исходным кодом - description: Жертвуйте биткойны проектам с открытым исходным кодом или создавайте коммиты и получайте чаевые за них. + description: Жертвуйте биткоины проектам с открытым исходным кодом или создавайте коммиты и получайте чаевые за них. menu: home: Главная projects: Проекты @@ -12,7 +12,7 @@ ru: support_link: поддержать follow_link: Следите за @tip4commit links: - sign_up: Регистрация + sign_up: Зарегистрироваться sign_in: Войти sign_in_imp: войдите sign_out: Выйти @@ -31,7 +31,7 @@ ru: project_updated: Настройки проекта обновлены tips_decided: Сумма чаевых определена user_updated: Ваш профиль обновлен! - user_unsubscribed: "Вы отписались! Приносим извинения за предоставленные неудобства. Однако, вы все равно можете оставить нам свой Биткойн адрес, чтобы получать вознаграждения" + user_unsubscribed: "Вы отписались! Приносим извинения за предоставленные неудобства. Однако, вы все равно можете оставить нам свой Биткоин-адрес, чтобы получать вознаграждения" tip_amounts: undecided: "Не определено" free: "Нет: 0%" @@ -58,11 +58,11 @@ ru: see_projects: Проекты how_does_it_work: title: Как это работает? - text: Люди жертвуют биткойны на проекты. Если владелец проекта принимает коммит в репозиторий, мы автоматически начисляем чаевые автору этого коммита. - button: Узнать о Биткойн + text: Люди жертвуют биткоины на проекты. Если владелец проекта принимает коммит в репозиторий, мы автоматически начисляем чаевые автору этого коммита. + button: Узнать о Биткоин donate: title: Жертвуйте - text: Найдите проект который вам по душе и перечислите биткойны на него. Ваши пожертвования вместе с пожертвованиями других людей будут автоматически выплачиваться авторам новых коммитов в виде чаевых. + text: Найдите проект который вам по душе и перечислите биткоины на него. Ваши пожертвования вместе с пожертвованиями других людей будут автоматически выплачиваться авторам новых коммитов в виде чаевых. button: Найти или добавить проект contribute: title: Участвуйте @@ -107,10 +107,10 @@ ru: when_decided: когда сумма будет определена next_tip: Следующие чаевые contribute_and_earn: Помогайте и зарабатывайте - contribute_and_earn_description: "Жертвуйте биткойны этому проекту или %{make_commits_link} и получайте чаевые за них. Если ваш коммит будет принят %{branch} владельцами проекта, а баланс этого проекта положительный, то вы получите чаевые!" + contribute_and_earn_description: "Жертвуйте биткоины этому проекту или %{make_commits_link} и получайте чаевые за них. Если ваш коммит будет принят %{branch} владельцами проекта, а баланс этого проекта положительный, то вы получите чаевые!" contribute_and_earn_branch: "в ветку %{branch}" make_commits_link: создавайте коммиты - tell_us_bitcoin_address: "Просто %{tell_us_link} ваш биткойн адрес." + tell_us_bitcoin_address: "Просто %{tell_us_link} ваш биткоин-адрес." tell_us_link: укажите sign_in: "Просто проверьте ваш email или %{sign_in_link}." promote_project: "Расскажите о %{project}" @@ -172,7 +172,7 @@ ru: threshold: "Вы получите свои деньги, когда ваш баланс достигнет %{threshold}" see_all: смотреть все received: "%{time} получено %{amount} за коммит %{commit} в %{project}" - bitcoin_address_placeholder: Ваш биткойн адрес + bitcoin_address_placeholder: Ваш биткоин-адрес notify: Сообщать мне о новых чаевых (не чаще чем одно сообщение в месяц) submit_user: Обновить информацию пользователя change_password: Смена пароля @@ -220,7 +220,7 @@ ru: attributes: user: email: E-mail - bitcoin_address: Биткойн адрес + bitcoin_address: Биткоин-адрес password: Пароль password_confirmation: Подтверждение пароля display_name: Имя From 29ab8c618a536bb44f158dad31c122d932851548 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 5 Sep 2015 12:23:48 +0500 Subject: [PATCH 184/415] allows to create tips specifying url instead of commit id #250 --- app/views/projects/show.html.haml | 7 +++++-- app/views/tips/index.html.haml | 6 +++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 178e02a3..0b3f6efe 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -86,8 +86,11 @@ = raw t('.received', amount: btc_human(tip.amount)) - else = t('.will_receive') - = t('.for_commit') - = link_to tip.commit[0..6], "https://github.com/#{@project.full_name}/commit/#{tip.commit}", target: :blank + - if tip.commit.start_with? 'http' + = link_to 'details', tip.commit, target: :blank + - else + = t('.for_commit') + = link_to tip.commit[0..6], "https://github.com/#{@project.full_name}/commit/#{tip.commit}", target: :blank - if tip.undecided? = t('.when_decided') diff --git a/app/views/tips/index.html.haml b/app/views/tips/index.html.haml index e5e4bb42..4e1ff7a3 100644 --- a/app/views/tips/index.html.haml +++ b/app/views/tips/index.html.haml @@ -29,7 +29,11 @@ = link_to tip.user.display_name, "https://github.com/#{tip.user.nickname}", target: '_blank' - unless @project %td= link_to tip.project.full_name, pretty_project_path(tip.project) - %td= link_to tip.commit[0..6], "https://github.com/#{tip.project.full_name}/commit/#{tip.commit}", target: :blank + %td + - if tip.commit.start_with? 'http' + = link_to 'details', tip.commit, target: :blank + - else + = link_to tip.commit[0..6], "https://github.com/#{tip.project.full_name}/commit/#{tip.commit}", target: :blank %td= btc_human tip.amount %td - if tip.sendmany.nil? From 31fd6f0016b720847e0b5b36f4737673035f6871 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 5 Sep 2015 13:29:29 +0500 Subject: [PATCH 185/415] fixed user page --- app/views/users/show.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index f5608c03..83ae4fcc 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -18,7 +18,7 @@ %ul - @recent_tips.each do |tip| %li - = raw t('.received', time: l(tip.created_at, format: :short), amount: btc_human(tip.amount), commit: link_to(tip.commit[0..6], "https://github.com/#{tip.project.full_name}/commit/#{tip.commit}", target: :blank), project: link_to(tip.project.full_name, pretty_project_path(tip.project))) + = raw t('.received', time: l(tip.created_at, format: :short), amount: btc_human(tip.amount), commit: (tip.commit.start_with?('http') ? link_to('details', tip.commit, target: :blank) : link_to(tip.commit[0..6], "https://github.com/#{tip.project.full_name}/commit/#{tip.commit}", target: :blank)), project: link_to(tip.project.full_name, pretty_project_path(tip.project))) %p %strong= User.human_attribute_name(:email) From 4f199026d2fd08ec13c13e0ce520f46cc15a3834 Mon Sep 17 00:00:00 2001 From: sssemil Date: Mon, 7 Sep 2015 13:23:29 +0500 Subject: [PATCH 186/415] Add USD --- app/helpers/application_helper.rb | 25 +++++++++++++++++++++---- app/views/users/show.html.haml | 2 +- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e850cc3a..3a391c61 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -11,27 +11,44 @@ def btc_human amount, options = {} btc = to_ubtc(amount) elsif denom === 3 btc = to_satoshi(amount) + elsif denom === 4 + btc = to_usd(amount) end btc = "#{btc}" if nobr btc.html_safe end - def to_btc satoshies + def to_btc satoshies "%.8f Ƀ" % (1.0*satoshies.to_i/1e8) end - def to_mbtc satoshies + def to_mbtc satoshies "%.5f mɃ" % (1.0*satoshies.to_i/1e5) end - def to_ubtc satoshies + def to_ubtc satoshies "%.2f μɃ" % (1.0*satoshies.to_i/1e2) end - def to_satoshi satoshies + def to_satoshi satoshies "%.0f Satoshi" % satoshies end + def to_usd satoshies + "%.2f $" % usd(satoshies) + end + + def usd satoshies + satoshies*0.00000001*usd_cource + end + + def usd_cource + uri = URI('https://api.bitcoinaverage.com/ticker/USD/') + response = Net::HTTP.get_response(uri) + hash = JSON.parse(response.body) + hash["24h_avg"] + end + def render_flash_messages html = [] flash.each do |_type, _message| diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index 83ae4fcc..8620fcf4 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -5,7 +5,7 @@ = btc_human @user.balance = form_for(@user) do |f| = f.select :denom, - options_for_select([["BTC", "0"], ["mBTC", "1"], ["μBTC", "2"], ["Satoshi", "3"]], selected: @user.denom) + options_for_select([["BTC", "0"], ["mBTC", "1"], ["μBTC", "2"], ["Satoshi", "3"], ["USD", "4"]], selected: @user.denom) = f.submit "save" %p %small= raw t('.threshold', threshold: btc_human(CONFIG["min_payout"])) From ae0368a628b752d0ace6390938ef980a87468870 Mon Sep 17 00:00:00 2001 From: sssemil Date: Sat, 12 Sep 2015 20:34:52 +0500 Subject: [PATCH 187/415] Change cources and add EUR --- app/helpers/application_helper.rb | 24 ++++++++++++++++-------- app/views/users/show.html.haml | 2 +- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3a391c61..6b264a5f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -13,6 +13,8 @@ def btc_human amount, options = {} btc = to_satoshi(amount) elsif denom === 4 btc = to_usd(amount) + elsif denom === 5 + btc = to_eur(amount) end btc = "#{btc}" if nobr btc.html_safe @@ -35,20 +37,26 @@ def to_satoshi satoshies end def to_usd satoshies - "%.2f $" % usd(satoshies) + "%.2f $" % cource("USD", satoshies) end - def usd satoshies - satoshies*0.00000001*usd_cource + def to_eur satoshies + "%.2f €" % cource("EUR", satoshies) end - def usd_cource - uri = URI('https://api.bitcoinaverage.com/ticker/USD/') - response = Net::HTTP.get_response(uri) - hash = JSON.parse(response.body) - hash["24h_avg"] + def cource(currency, satoshies) + satoshies*0.00000001*get_cource(currency) end + def get_cource(currency) + Rails.cache.fetch("###" + currency, :expires_in => 24.hours) do + uri = URI('https://api.bitcoinaverage.com/ticker/' + currency + '/') + response = Net::HTTP.get_response(uri) + hash = JSON.parse(response.body) + hash["24h_avg"] + end + end + def render_flash_messages html = [] flash.each do |_type, _message| diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index 8620fcf4..ad433bf2 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -5,7 +5,7 @@ = btc_human @user.balance = form_for(@user) do |f| = f.select :denom, - options_for_select([["BTC", "0"], ["mBTC", "1"], ["μBTC", "2"], ["Satoshi", "3"], ["USD", "4"]], selected: @user.denom) + options_for_select([["BTC", "0"], ["mBTC", "1"], ["μBTC", "2"], ["Satoshi", "3"], ["USD", "4"], ["EUR", "5"]], selected: @user.denom) = f.submit "save" %p %small= raw t('.threshold', threshold: btc_human(CONFIG["min_payout"])) From d2bc07d8b3f66606dcbb5fec4ebcf5627eabad33 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 13 Sep 2015 16:10:21 +0500 Subject: [PATCH 188/415] fixed usd format --- app/helpers/application_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 6b264a5f..7b63d3c8 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -37,7 +37,7 @@ def to_satoshi satoshies end def to_usd satoshies - "%.2f $" % cource("USD", satoshies) + "$%.2f" % cource("USD", satoshies) end def to_eur satoshies From df3e00bbcd879716755fca85049ab5e202da0eb9 Mon Sep 17 00:00:00 2001 From: entity0 Date: Tue, 13 Oct 2015 23:23:55 +0200 Subject: [PATCH 189/415] Update hr.yml --- config/locales/hr.yml | 56 +++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/config/locales/hr.yml b/config/locales/hr.yml index f04af922..45642b59 100644 --- a/config/locales/hr.yml +++ b/config/locales/hr.yml @@ -1,8 +1,8 @@ hr: tip4commit: Tip4Commit meta: - title: Doprinesite open source-u - description: Donirajte bitcoine open source projektima ili napravite promjene i zaradite napojnice. + title: Doprinesite otvorenom kodu + description: Donirajte bitcoine projektima otvorenog koda ili napravite promjene i zaradite napojnice. menu: home: Početna stranica projects: Podržavani projekti @@ -69,12 +69,12 @@ hr: projects: index: find_project: - placeholder: Upišite GitHub URL projekta kako biste dodati projekt ili bilo koju ključnu rijeć da biste je našli... + placeholder: Upišite GitHub URL projekta kako biste dodali projekt ili bilo koju ključnu rijeć da biste ga našli... button: Nađi ili dodaj projekt repository: Repozitorij description: Opis watchers: Gledatelji - balance: Ravnoteza + balance: Ravnoteža forked_from: Odvojeno od support: Podrži show: @@ -82,9 +82,9 @@ hr: fetch_pending: (Pending initial fetch) edit_project: Promijeni postavke projekta decide_tip_amounts: Odredi količinu napojnica - disabled_notifications: "Odrzavatelji projekata su odlucili da nece obavjestiti nove doprinositelje o napojnicama i najvjerovatnije ne vole ovaj nacin isplate." - fee: "%{percentage} od polozenih isplata ce se koristiti kao napojnice za nove cinove." - balance: Ravnoteza + disabled_notifications: "Održavatelji projekata su odlučili da neće obavjestiti nove doprinositelje o napojnicama i najvjerojatnije ne vole ovaj način isplate." + fee: "%{percentage} od položenih isplata će se koristiti kao napojnice za nove promjene." + balance: Ravnoteža deposits: depoziti custom_tip_size: (svaka nova promjena dobiva određen postotak dostupnih bitcoina) default_tip_size: "(svaka nova promjena će dobiti %{percentage} dostupnih bitcoina)" @@ -98,34 +98,34 @@ hr: see_all: Vidjeti sve received: "je dobio %{amount}" will_receive: će dobiti napojnicu - for_commit: za commit - when_decided: kada je kolicina odlučena + for_commit: za promjenu + when_decided: kada je količina odlučena next_tip: Sljedeća napojnica contribute_and_earn: Doprinesi i zaradi contribute_and_earn_description: "Doniraj Bitcone ovom projektu ili %{make_commits_link} i dobij napojnicu. Ako je voditelj projekta prihvatio promjenu u %{branch} i Bitcoini su dostpuni, dobiti će te napojnicu." contribute_and_earn_branch: "u %{branch} branch" - make_commits_link: napravi commit - tell_us_bitcoin_address: "Samo %{tell_us_link} vasu bitcoin adresu." - tell_us_link: recite nam - sign_in: "Samo provjerite vas email ili %{sign_in_link}." + make_commits_link: napravi promjenu + tell_us_bitcoin_address: "Samo %{tell_us_link} Vašu Bitcoin adresu." + tell_us_link: nam recite + sign_in: "Samo provjerite Vaš email ili %{sign_in_link}." promote_project: Promoviraj %{project} embedding: Embedding image_url: "URL slike:" - shield_title: tip for next commit + shield_title: napojnica za sljedeću promjenu edit: project_settings: "%{project} project settings" branch: Branch default_branch: Default branch tipping_policies: Tipping policies hold_tips: "Do not send the tips immediatly. Give collaborators the ability to modify the tips before they're sent" - save: Save the project settings + save: Spremi postavke projekta disable_notifications: Don't notify new contributors decide_tip_amounts: - commit: Commit + commit: Promjena author: Autor message: Poruka tip: Napojnica (relativna iznosu na racunu) - submit: Posaljite odabrane iznose napojnica + submit: Pošaljite odabrane iznose napojnica tips: index: tips: Napojnice @@ -148,9 +148,9 @@ hr: deposits: Uplate created_at: "Stvoreno na" project: Projekt - amount: Kolicina + amount: Količina transaction: Transakcija - confirmed: Potvrdjeno + confirmed: Potvrđeno confirmed_yes: 'Da' confirmed_no: 'Ne' users: @@ -160,23 +160,23 @@ hr: commits_count: Commits tipped withdrawn: Withdrawn show: - balance: Ravnoteza - threshold: "Dobiti ce te vase novce kada vasa ravnoteza prijede prag od %{threshold}" + balance: Ravnoteža + threshold: "Dobiti ćete Vaše novce kada Vaša ravnoteža prijeđe prag od %{threshold}" see_all: vidjeti sve received: "%{time} primljeno %{amount} za cin %{commit} u %{project}" bitcoin_address_placeholder: Vasa bitcoin adresa notify: Obavjesti me o novim savjetima (ne vise od jednog emaila po mjesecu) - submit_user: Azurirati informaciju korisnika - change_password: Promijeniti vasu lozinku - submit_password: Promijeniti moju lozinku + submit_user: Ažuriraj + change_password: Promijeni lozinku + submit_password: Promijeni lozinku withdrawals: index: - title: Zadnje povlacenje + title: Zadnje povlačenje created_at: Stvoreno transaction: Transakcije result: Rezultat - error: Greska - success: Uspjesno + error: Greška + success: Uspješno devise: sessions: new: @@ -189,7 +189,7 @@ hr: submit: Registracija passwords: new: - title: Zaboravili ste vasu lozinku? + title: Zaboravili ste vašu lozinku? submit: Poslati mi uputstva za resetiranje lozinke edit: title: Promijenite vasu lozinku From c10e4049ecec5f76860298d4760a614c4da72152 Mon Sep 17 00:00:00 2001 From: sssemil Date: Tue, 3 Nov 2015 20:56:33 +0400 Subject: [PATCH 190/415] More currencies --- app/helpers/application_helper.rb | 104 +++++++++++++++++++++++++++++- app/views/users/show.html.haml | 2 +- 2 files changed, 104 insertions(+), 2 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 7b63d3c8..04cc461c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -15,6 +15,40 @@ def btc_human amount, options = {} btc = to_usd(amount) elsif denom === 5 btc = to_eur(amount) + elsif denom === 6 + btc = to_aud(amount) + elsif denom === 7 + btc = to_brl(amount) + elsif denom === 8 + btc = to_cad(amount) + elsif denom === 9 + btc = to_cny(amount) + elsif denom === 10 + btc = to_gbp(amount) + elsif denom === 11 + btc = to_idr(amount) + elsif denom === 12 + btc = to_ils(amount) + elsif denom === 13 + btc = to_jpy(amount) + elsif denom === 14 + btc = to_mxn(amount) + elsif denom === 15 + btc = to_nok(amount) + elsif denom === 16 + btc = to_nzd(amount) + elsif denom === 17 + btc = to_pln(amount) + elsif denom === 18 + btc = to_ron(amount) + elsif denom === 19 + btc = to_rub(amount) + elsif denom === 20 + btc = to_sek(amount) + elsif denom === 21 + btc = to_sgd(amount) + elsif denom === 22 + btc = to_zar(amount) end btc = "#{btc}" if nobr btc.html_safe @@ -40,8 +74,76 @@ def to_usd satoshies "$%.2f" % cource("USD", satoshies) end + def to_aud satoshies + "$%.2f" % cource("AUD", satoshies) + end + def to_eur satoshies - "%.2f €" % cource("EUR", satoshies) + "€%.2f" % cource("EUR", satoshies) + end + + def to_brl satoshies + "R$%.2f" % cource("BRL", satoshies) + end + + def to_cad satoshies + "$%.2f" % cource("CAD", satoshies) + end + + def to_cny satoshies + "¥%.2f" % cource("CNY", satoshies) + end + + def to_gbp satoshies + "£%.2f" % cource("GBP", satoshies) + end + + def to_idr satoshies + "Rp%.2f" % cource("IDR", satoshies) + end + + def to_ils satoshies + "₪%.2f" % cource("ILS", satoshies) + end + + def to_jpy satoshies + "¥%.2f" % cource("JPY", satoshies) + end + + def to_mxn satoshies + "$%.2f" % cource("MXN", satoshies) + end + + def to_nok satoshies + "kr%.2f" % cource("NOK", satoshies) + end + + def to_nzd satoshies + "$%.2f" % cource("NZD", satoshies) + end + + def to_pln satoshies + "zł%.2f" % cource("PLN", satoshies) + end + + def to_ron satoshies + "lei%.2f" % cource("RON", satoshies) + end + + def to_rub satoshies + "₽%.2f" % cource("RUB", satoshies) + end + + def to_sek satoshies + "kr%.2f" % cource("SEK", satoshies) + end + + def to_sgd satoshies + "$%.2f" % cource("SGD", satoshies) + end + + def to_zar satoshies + "R%.2f" % cource("ZAR", satoshies) end def cource(currency, satoshies) diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index ad433bf2..1792e2a4 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -5,7 +5,7 @@ = btc_human @user.balance = form_for(@user) do |f| = f.select :denom, - options_for_select([["BTC", "0"], ["mBTC", "1"], ["μBTC", "2"], ["Satoshi", "3"], ["USD", "4"], ["EUR", "5"]], selected: @user.denom) + options_for_select([["BTC", "0"], ["mBTC", "1"], ["μBTC", "2"], ["Satoshi", "3"], ["USD", "4"], ["EUR", "5"], ["AUD", "6"], ["BRL", "7"], ["CAD", "8"], ["CNY", "9"], ["GBP", "10"], ["IDR", "11"], ["ILS", "12"], ["JPY", "13"], ["MXN", "14"], ["NOK", "15"], ["NZD", "16"], ["PLN", "17"], ["RON", "18"], ["RUB", "19"], ["SEK", "20"], ["SGD", "21"], ["ZAR", "22"]], selected: @user.denom) = f.submit "save" %p %small= raw t('.threshold', threshold: btc_human(CONFIG["min_payout"])) From 50ab5103a5a17502417085c738fc2d368f62a523 Mon Sep 17 00:00:00 2001 From: Sanjiv Jha Date: Wed, 4 Nov 2015 16:09:35 +0530 Subject: [PATCH 191/415] Updated the Gemfile to rails 4.2.4 and updated devise as per instruction Replace public_assets in config --- Gemfile | 10 +- Gemfile.lock | 193 ++++++++++++++++++++---------------- config/environments/test.rb | 2 +- 3 files changed, 116 insertions(+), 89 deletions(-) diff --git a/Gemfile b/Gemfile index c29623a2..38067956 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' ruby '2.0.0' -gem 'rails', '4.0.2' +gem 'rails', '4.2.4' gem 'mysql2', group: :production gem 'sass-rails', '~> 4.0.0' gem 'haml-rails', '~> 0.5.3' @@ -16,7 +16,7 @@ gem 'turbolinks', '~> 2.2.0' gem 'jquery-turbolinks' gem 'jbuilder', '~> 1.5.3' gem 'airbrake', '~> 3.1.15' -gem 'devise', '~> 3.2.2' +gem 'devise', '~> 3.5.2' gem 'omniauth', '~> 1.1.4' gem 'omniauth-github', github: 'alexandrz/omniauth-github', branch: 'provide_emails' gem 'octokit', '~> 2.7.0' @@ -39,18 +39,19 @@ gem 'devise-i18n' gem 'easy_gravatar' +gem 'byebug', '~> 3.5.1' + group :development do gem 'capistrano', '~> 3.0.1' gem 'capistrano-rvm', '~> 0.1.0', github: 'capistrano/rvm' gem 'capistrano-bundler', '>= 1.1.0' gem 'capistrano-rails', '~> 1.1.0' - gem 'byebug', '~> 3.5.1' end group :development, :test do gem 'sqlite3', '~> 1.3.8' gem 'factory_girl_rails', '~> 4.3.0' - gem 'rspec-rails', '~> 3.0.0.beta' + gem 'rspec-rails', '~> 3.3.0' end group :test do @@ -58,4 +59,5 @@ group :test do gem 'shoulda-matchers', '~> 2.5.0' gem 'cucumber-rails', require: false gem 'database_cleaner' + gem 'minitest' end diff --git a/Gemfile.lock b/Gemfile.lock index 2e9158ef..3443771d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -51,38 +51,48 @@ GIT GEM remote: https://rubygems.org/ specs: - actionmailer (4.0.2) - actionpack (= 4.0.2) - mail (~> 2.5.4) - actionpack (4.0.2) - activesupport (= 4.0.2) - builder (~> 3.1.0) - erubis (~> 2.7.0) - rack (~> 1.5.2) + actionmailer (4.2.4) + actionpack (= 4.2.4) + actionview (= 4.2.4) + activejob (= 4.2.4) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 1.0, >= 1.0.5) + actionpack (4.2.4) + actionview (= 4.2.4) + activesupport (= 4.2.4) + rack (~> 1.6) rack-test (~> 0.6.2) - activemodel (4.0.2) - activesupport (= 4.0.2) - builder (~> 3.1.0) - activerecord (4.0.2) - activemodel (= 4.0.2) - activerecord-deprecated_finders (~> 1.0.2) - activesupport (= 4.0.2) - arel (~> 4.0.0) - activerecord-deprecated_finders (1.0.3) - activesupport (4.0.2) - i18n (~> 0.6, >= 0.6.4) - minitest (~> 4.2) - multi_json (~> 1.3) - thread_safe (~> 0.1) - tzinfo (~> 0.3.37) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (4.2.4) + activesupport (= 4.2.4) + builder (~> 3.1) + erubis (~> 2.7.0) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + activejob (4.2.4) + activesupport (= 4.2.4) + globalid (>= 0.3.0) + activemodel (4.2.4) + activesupport (= 4.2.4) + builder (~> 3.1) + activerecord (4.2.4) + activemodel (= 4.2.4) + activesupport (= 4.2.4) + arel (~> 6.0) + activesupport (4.2.4) + i18n (~> 0.7) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) addressable (2.3.5) airbrake (3.1.15) builder multi_json - arel (4.0.1) - atomic (1.1.14) - bcrypt-ruby (3.1.2) - builder (3.1.4) + arel (6.0.3) + bcrypt (3.1.10) + builder (3.2.2) byebug (3.5.1) columnize (~> 0.8) debugger-linecache (~> 1.2) @@ -127,10 +137,11 @@ GEM database_cleaner (1.2.0) debugger-linecache (1.2.0) demoji (0.0.5) - devise (3.2.2) - bcrypt-ruby (~> 3.0) + devise (3.5.2) + bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 3.2.6, < 5) + responders thread_safe (~> 0.1) warden (~> 1.2.3) devise-i18n (0.11.0) @@ -152,6 +163,8 @@ GEM multipart-post (~> 1.2.0) gherkin (2.12.2) multi_json (~> 1.3) + globalid (0.3.6) + activesupport (>= 4.1.0) haml (4.0.5) tilt haml-rails (0.5.3) @@ -163,7 +176,7 @@ GEM hike (1.2.3) http_accept_language (2.0.2) httpauth (0.2.1) - i18n (0.6.9) + i18n (0.7.0) i18n-js (2.1.2) i18n jbuilder (1.5.3) @@ -175,7 +188,7 @@ GEM jquery-turbolinks (2.0.1) railties (>= 3.1.0) turbolinks - json (1.8.1) + json (1.8.3) jwt (0.1.11) multi_json (>= 1.5) kaminari (0.15.0) @@ -190,21 +203,22 @@ GEM actionpack (>= 3.1) less (~> 2.4.0) libv8 (3.16.14.3) - mail (2.5.4) - mime-types (~> 1.16) - treetop (~> 1.4.8) - mime-types (1.25.1) - mini_portile (0.5.3) - minitest (4.7.5) - multi_json (1.8.4) + loofah (2.0.3) + nokogiri (>= 1.5.9) + mail (2.6.3) + mime-types (>= 1.16, < 3) + mime-types (2.6.2) + mini_portile (0.6.2) + minitest (5.8.2) + multi_json (1.11.2) multi_test (0.1.1) multipart-post (1.2.0) mysql2 (0.3.14) net-scp (1.1.2) net-ssh (>= 2.6.5) net-ssh (2.7.0) - nokogiri (1.6.1) - mini_portile (~> 0.5.0) + nokogiri (1.6.6.2) + mini_portile (~> 0.6.0) oauth2 (0.8.1) faraday (~> 0.8) httpauth (~> 0.1) @@ -220,51 +234,61 @@ GEM oauth2 (~> 0.8.0) omniauth (~> 1.0) orm_adapter (0.5.0) - polyglot (0.3.3) - rack (1.5.2) - rack-test (0.6.2) + rack (1.6.4) + rack-test (0.6.3) rack (>= 1.0) - rails (4.0.2) - actionmailer (= 4.0.2) - actionpack (= 4.0.2) - activerecord (= 4.0.2) - activesupport (= 4.0.2) + rails (4.2.4) + actionmailer (= 4.2.4) + actionpack (= 4.2.4) + actionview (= 4.2.4) + activejob (= 4.2.4) + activemodel (= 4.2.4) + activerecord (= 4.2.4) + activesupport (= 4.2.4) bundler (>= 1.3.0, < 2.0) - railties (= 4.0.2) - sprockets-rails (~> 2.0.0) + railties (= 4.2.4) + sprockets-rails + rails-deprecated_sanitizer (1.0.3) + activesupport (>= 4.2.0.alpha) + rails-dom-testing (1.0.7) + activesupport (>= 4.2.0.beta, < 5.0) + nokogiri (~> 1.6.0) + rails-deprecated_sanitizer (>= 1.0.1) + rails-html-sanitizer (1.0.2) + loofah (~> 2.0) rails-i18n (4.0.3) i18n (~> 0.6) railties (~> 4.0) - railties (4.0.2) - actionpack (= 4.0.2) - activesupport (= 4.0.2) + railties (4.2.4) + actionpack (= 4.2.4) + activesupport (= 4.2.4) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (10.1.1) + rake (10.4.2) rdoc (4.1.1) json (~> 1.4) ref (1.0.5) render_csv (2.0.0) rails (>= 3.0) - rspec-collection_matchers (0.0.2) - rspec-expectations (>= 2.99.0.beta1) - rspec-core (3.0.0.beta1) - rspec-support (= 3.0.0.beta1) - rspec-expectations (3.0.0.beta1) - diff-lcs (>= 1.1.3, < 2.0) - rspec-support (= 3.0.0.beta1) - rspec-mocks (3.0.0.beta1) - rspec-support (= 3.0.0.beta1) - rspec-rails (3.0.0.beta1) - actionpack (>= 3.0) - activemodel (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-collection_matchers - rspec-core (= 3.0.0.beta1) - rspec-expectations (= 3.0.0.beta1) - rspec-mocks (= 3.0.0.beta1) - rspec-support (3.0.0.beta1) + responders (2.1.0) + railties (>= 4.2.0, < 5) + rspec-core (3.3.2) + rspec-support (~> 3.3.0) + rspec-expectations (3.3.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.3.0) + rspec-mocks (3.3.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.3.0) + rspec-rails (3.3.3) + actionpack (>= 3.0, < 4.3) + activesupport (>= 3.0, < 4.3) + railties (>= 3.0, < 4.3) + rspec-core (~> 3.3.0) + rspec-expectations (~> 3.3.0) + rspec-mocks (~> 3.3.0) + rspec-support (~> 3.3.0) + rspec-support (3.3.0) sass (3.2.13) sass-rails (4.0.1) railties (>= 4.0.0, < 5.0) @@ -283,7 +307,7 @@ GEM simplecov-html (~> 0.7.1) simplecov-html (0.7.1) slop (3.6.0) - sprockets (2.10.1) + sprockets (2.12.4) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) @@ -302,17 +326,14 @@ GEM therubyracer (0.12.0) libv8 (~> 3.16.14.0) ref - thor (0.18.1) - thread_safe (0.1.3) - atomic + thor (0.19.1) + thread_safe (0.3.5) tilt (1.4.1) tins (0.13.1) - treetop (1.4.15) - polyglot - polyglot (>= 0.3.1) turbolinks (2.2.0) coffee-rails - tzinfo (0.3.38) + tzinfo (1.2.2) + thread_safe (~> 0.1) uglifier (2.4.0) execjs (>= 0.3.0) json (>= 1.8.0) @@ -338,7 +359,7 @@ DEPENDENCIES cucumber-rails database_cleaner demoji - devise (~> 3.2.2) + devise (~> 3.5.2) devise-i18n dusen easy_gravatar @@ -352,14 +373,15 @@ DEPENDENCIES kaminari (~> 0.15.0) kaminari-i18n less-rails (~> 2.4.2) + minitest mysql2 octokit (~> 2.7.0) omniauth (~> 1.1.4) omniauth-github! - rails (= 4.0.2) + rails (= 4.2.4) rails-i18n render_csv - rspec-rails (~> 3.0.0.beta) + rspec-rails (~> 3.3.0) sass-rails (~> 4.0.0) sawyer (~> 0.5.2) sdoc @@ -371,3 +393,6 @@ DEPENDENCIES twitter-bootstrap-rails! twitter_bootstrap_form_for! uglifier (>= 1.3.0) + +BUNDLED WITH + 1.10.6 diff --git a/config/environments/test.rb b/config/environments/test.rb index 359f1c92..70a0d8f5 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -13,7 +13,7 @@ config.eager_load = false # Configure static asset server for tests with Cache-Control for performance. - config.serve_static_assets = true + config.serve_static_files = true config.static_cache_control = "public, max-age=3600" # Show full error reports and disable caching. From e9ce3fa7291af2db669584d4e319f64609b70e04 Mon Sep 17 00:00:00 2001 From: Sanjiv Jha Date: Wed, 4 Nov 2015 16:28:20 +0530 Subject: [PATCH 192/415] Fixed the rspec & depreciated warning --- Gemfile | 3 ++- Gemfile.lock | 15 ++++++++++----- spec/controllers/deposits_controller_spec.rb | 2 +- spec/controllers/home_controller_spec.rb | 2 +- spec/controllers/projects_controller_spec.rb | 2 +- spec/controllers/tips_controller_spec.rb | 2 +- spec/controllers/users_controller_spec.rb | 2 +- spec/controllers/withdrawals_controller_spec.rb | 2 +- spec/spec_helper.rb | 1 - 9 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Gemfile b/Gemfile index 38067956..32ce2916 100644 --- a/Gemfile +++ b/Gemfile @@ -12,7 +12,7 @@ gem 'uglifier', '>= 1.3.0' gem 'coffee-rails', '~> 4.0.0' gem 'therubyracer', '~> 0.12.0', platforms: :ruby gem 'jquery-rails', '~> 3.0.4' -gem 'turbolinks', '~> 2.2.0' +gem 'turbolinks', '~> 2.5.0' gem 'jquery-turbolinks' gem 'jbuilder', '~> 1.5.3' gem 'airbrake', '~> 3.1.15' @@ -59,5 +59,6 @@ group :test do gem 'shoulda-matchers', '~> 2.5.0' gem 'cucumber-rails', require: false gem 'database_cleaner' + gem 'rspec-activemodel-mocks' gem 'minitest' end diff --git a/Gemfile.lock b/Gemfile.lock index 3443771d..d513659e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -117,10 +117,10 @@ GEM coffee-rails (4.0.1) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.0) - coffee-script (2.2.0) + coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.6.3) + coffee-script-source (1.9.1.1) columnize (0.9.0) commonjs (0.2.7) cucumber (1.3.14) @@ -153,7 +153,7 @@ GEM edge_rider (0.3.0) activerecord erubis (2.7.0) - execjs (2.0.2) + execjs (2.6.0) factory_girl (4.3.0) activesupport (>= 3.0.0) factory_girl_rails (4.3.0) @@ -272,6 +272,10 @@ GEM rails (>= 3.0) responders (2.1.0) railties (>= 4.2.0, < 5) + rspec-activemodel-mocks (1.0.2) + activemodel (>= 3.0) + activesupport (>= 3.0) + rspec-mocks (>= 2.99, < 4.0) rspec-core (3.3.2) rspec-support (~> 3.3.0) rspec-expectations (3.3.1) @@ -330,7 +334,7 @@ GEM thread_safe (0.3.5) tilt (1.4.1) tins (0.13.1) - turbolinks (2.2.0) + turbolinks (2.5.3) coffee-rails tzinfo (1.2.2) thread_safe (~> 0.1) @@ -381,6 +385,7 @@ DEPENDENCIES rails (= 4.2.4) rails-i18n render_csv + rspec-activemodel-mocks rspec-rails (~> 3.3.0) sass-rails (~> 4.0.0) sawyer (~> 0.5.2) @@ -389,7 +394,7 @@ DEPENDENCIES simplecov sqlite3 (~> 1.3.8) therubyracer (~> 0.12.0) - turbolinks (~> 2.2.0) + turbolinks (~> 2.5.0) twitter-bootstrap-rails! twitter_bootstrap_form_for! uglifier (>= 1.3.0) diff --git a/spec/controllers/deposits_controller_spec.rb b/spec/controllers/deposits_controller_spec.rb index d24745b4..a2e43e76 100644 --- a/spec/controllers/deposits_controller_spec.rb +++ b/spec/controllers/deposits_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe DepositsController do +describe DepositsController, type: :controller do describe "GET 'index'" do it "returns http success" do get 'index' diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb index 7735def2..dd2d3352 100644 --- a/spec/controllers/home_controller_spec.rb +++ b/spec/controllers/home_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe HomeController do +describe HomeController, type: :controller do describe 'GET #index' do let(:subject) { get :index } diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index b0064169..e1cd7df7 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe ProjectsController do +describe ProjectsController, type: :controller do describe 'GET #index' do let(:subject) { get :index } before do diff --git a/spec/controllers/tips_controller_spec.rb b/spec/controllers/tips_controller_spec.rb index 1159b37e..17346cc1 100644 --- a/spec/controllers/tips_controller_spec.rb +++ b/spec/controllers/tips_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe TipsController do +describe TipsController, type: :controller do describe "GET 'index'" do it "returns http success" do get 'index' diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index 8810c5ec..c386eed3 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe UsersController do +describe UsersController, type: :controller do describe 'GET #index' do let(:subject) { get :index } diff --git a/spec/controllers/withdrawals_controller_spec.rb b/spec/controllers/withdrawals_controller_spec.rb index 53af5ea4..f3a369ff 100644 --- a/spec/controllers/withdrawals_controller_spec.rb +++ b/spec/controllers/withdrawals_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe WithdrawalsController do +describe WithdrawalsController, type: :controller do describe "GET 'index'" do it "returns http success" do get 'index' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index cee30cb5..87fd2c24 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -31,7 +31,6 @@ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures config.fixture_path = "#{::Rails.root}/spec/fixtures" - # If you're not using ActiveRecord, or you'd prefer not to run each of your # examples within a transaction, remove the following line or assign false # instead of true. From 3dfbf897d0dfcfa9af578cc5f97c07c081c3c264 Mon Sep 17 00:00:00 2001 From: Sanjiv Jha Date: Wed, 4 Nov 2015 17:00:27 +0530 Subject: [PATCH 193/415] removed the depreciated warning from rspec & updated the rspec to use new method --- spec/controllers/deposits_controller_spec.rb | 2 +- spec/controllers/home_controller_spec.rb | 8 +++--- spec/controllers/projects_controller_spec.rb | 28 +++++++++---------- spec/controllers/tips_controller_spec.rb | 2 +- spec/controllers/users_controller_spec.rb | 16 +++++------ .../withdrawals_controller_spec.rb | 2 +- spec/spec_helper.rb | 1 - spec/support/controller_macros.rb | 2 +- 8 files changed, 30 insertions(+), 31 deletions(-) diff --git a/spec/controllers/deposits_controller_spec.rb b/spec/controllers/deposits_controller_spec.rb index a2e43e76..750b6980 100644 --- a/spec/controllers/deposits_controller_spec.rb +++ b/spec/controllers/deposits_controller_spec.rb @@ -10,7 +10,7 @@ describe "routing" do it "routes GET / to Deposits#index" do - { :get => "/deposits" }.should route_to( + expect({ :get => "/deposits" }).to route_to( :controller => "deposits" , :action => "index" ) end diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb index dd2d3352..992e139b 100644 --- a/spec/controllers/home_controller_spec.rb +++ b/spec/controllers/home_controller_spec.rb @@ -15,26 +15,26 @@ describe "routing" do it "routes GET / to Home#index" do - { :get => "/" }.should route_to( + expect({ :get => "/" }).to route_to( :controller => "home" , :action => "index" ) end it "routes GET /home to Home#index" do - { :get => "/" }.should route_to( + expect({ :get => "/" }).to route_to( :controller => "home" , :action => "index" ) end it "routes GET /users/999999/no-such-path to Home#index" do - { :get => "/users/999999/no-such-path" }.should route_to( + expect({ :get => "/users/999999/no-such-path" }).to route_to( :controller => "home" , :action => "index" , :path => "users/999999/no-such-path") end it "routes GET /any/non-existent/path to Home#index" do - { :get => "/any/non-existent/path" }.should route_to( + expect({ :get => "/any/non-existent/path" }).to route_to( :controller => "home" , :action => "index" , :path => "any/non-existent/path") diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index e1cd7df7..236829e9 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -151,13 +151,13 @@ describe "routing" do it "routes GET /projects to Project#index" do - { :get => "/projects" }.should route_to( + expect({ :get => "/projects" }).to route_to( :controller => "projects" , :action => "index" ) end it "routes GET /projects/search?query= to Project#search" do - { :get => "/projects/search?query=seldon&order=balance" }.should route_to( + expect({ :get => "/projects/search?query=seldon&order=balance" }).to route_to( :controller => "projects" , :action => "search" , :query => "seldon" , @@ -165,49 +165,49 @@ end it "routes GET /projects/1 to Project#show" do - { :get => "/projects/1" }.should route_to( + expect({ :get => "/projects/1" }).to route_to( :controller => "projects" , :action => "show" , :id => "1" ) end it "routes GET /projects/1/edit to Project#edit" do - { :get => "/projects/1/edit" }.should route_to( + expect({ :get => "/projects/1/edit" }).to route_to( :controller => "projects" , :action => "edit" , :id => "1" ) end it "routes PUT /projects/1 to Project#update" do - { :put => "/projects/1" }.should route_to( + expect({ :put => "/projects/1" }).to route_to( :controller => "projects" , :action => "update" , :id => "1" ) end it "routes GET /projects/1/decide_tip_amounts to Project#decide_tip_amounts" do - { :get => "/projects/1/decide_tip_amounts" }.should route_to( + expect({ :get => "/projects/1/decide_tip_amounts" }).to route_to( :controller => "projects" , :action => "decide_tip_amounts" , :id => "1" ) end it "routes PATCH /projects/1/decide_tip_amounts to Project#decide_tip_amounts" do - { :patch => "/projects/1/decide_tip_amounts" }.should route_to( + expect({ :patch => "/projects/1/decide_tip_amounts" }).to route_to( :controller => "projects" , :action => "decide_tip_amounts" , :id => "1" ) end it "routes GET /projects/1/tips to Tips#index" do - { :get => "/projects/1/tips" }.should route_to( + expect({ :get => "/projects/1/tips" }).to route_to( :controller => "tips" , :action => "index" , :project_id => "1" ) end it "routes GET /projects/1/deposits to Deposits#index" do - { :get => "/projects/1/deposits" }.should route_to( + expect({ :get => "/projects/1/deposits" }).to route_to( :controller => "deposits" , :action => "index" , :project_id => "1" ) @@ -216,7 +216,7 @@ describe "Project pretty url routing" do it "routes GET /:provider/:repo to Project#show" do - { :get => "/github/test/test" }.should route_to( + expect({ :get => "/github/test/test" }).to route_to( :controller => "projects" , :action => "show" , :service => "github" , @@ -224,7 +224,7 @@ end it "routes GET /:provider/:repo/edit to Project#edit" do - { :get => "/github/test/test/edit" }.should route_to( + expect({ :get => "/github/test/test/edit" }).to route_to( :controller => "projects" , :action => "edit" , :service => "github" , @@ -232,7 +232,7 @@ end it "routes GET /:provider/:repo/decide_tip_amounts to Project#decide_tip_amounts" do - { :get => "/github/test/test/decide_tip_amounts" }.should route_to( + expect({ :get => "/github/test/test/decide_tip_amounts" }).to route_to( :controller => "projects" , :action => "decide_tip_amounts" , :service => "github" , @@ -240,7 +240,7 @@ end it "routes GET /:provider/:repo/tips to Project#tips" do - { :get => "/github/test/test/tips" }.should route_to( + expect({ :get => "/github/test/test/tips" }).to route_to( :controller => "tips" , :action => "index" , :service => "github" , @@ -248,7 +248,7 @@ end it "routes GET /:provider/:repo/deposits to Project#deposits" do - { :get => "/github/test/test/deposits" }.should route_to( + expect({ :get => "/github/test/test/deposits" }).to route_to( :controller => "deposits" , :action => "index" , :service => "github" , diff --git a/spec/controllers/tips_controller_spec.rb b/spec/controllers/tips_controller_spec.rb index 17346cc1..2453dbe3 100644 --- a/spec/controllers/tips_controller_spec.rb +++ b/spec/controllers/tips_controller_spec.rb @@ -10,7 +10,7 @@ describe "routing" do it "routes GET / to Tips#index" do - { :get => "/tips" }.should route_to( + expect({ :get => "/tips" }).to route_to( :controller => "tips" , :action => "index" ) end diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index c386eed3..3d45dd35 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -97,26 +97,26 @@ describe "routing" do it "routes GET /users to User#index" do - { :get => "/users" }.should route_to( + expect({ :get => "/users" }).to route_to( :controller => "users" , :action => "index" ) end it "routes GET /users/nick-name321 to User#show" do - { :get => "/users/nick-name321" }.should route_to( + expect({ :get => "/users/nick-name321" }).to route_to( :controller => "users" , :action => "show" , :nickname => "nick-name321" ) end it "routes GET /users/login to User#login" do - { :get => "/users/login" }.should route_to( + expect({ :get => "/users/login" }).to route_to( :controller => "users" , :action => "login" ) end it "routes GET /users/1/tips to Tips#index" do - { :get => "/users/1/tips" }.should route_to( + expect({ :get => "/users/1/tips" }).to route_to( :controller => "tips" , :action => "index" , :user_id => "1" ) @@ -134,19 +134,19 @@ accepted = should_accept.select {|ea| ea =~ /\D+/} rejected = should_reject.select {|ea| (ea =~ /\D+/).nil? } - (accepted.size.should eq should_accept.size) && - (rejected.size.should eq should_reject.size) + (expect(accepted.size).to eq(should_accept.size)) && + (expect(rejected.size).to eq(should_reject.size)) end it "routes GET /users/:nickname to User#show" do - { :get => "/users/#{user.nickname}" }.should route_to( + expect({ :get => "/users/#{user.nickname}" }).to route_to( :controller => "users" , :action => "show" , :nickname => "kd" ) end it "routes GET /users/:nickname/tips to Tips#index" do - { :get => "/users/#{user.nickname}/tips" }.should route_to( + expect({ :get => "/users/#{user.nickname}/tips" }).to route_to( :controller => "tips" , :action => "index" , :nickname => "kd" ) diff --git a/spec/controllers/withdrawals_controller_spec.rb b/spec/controllers/withdrawals_controller_spec.rb index f3a369ff..226ec708 100644 --- a/spec/controllers/withdrawals_controller_spec.rb +++ b/spec/controllers/withdrawals_controller_spec.rb @@ -10,7 +10,7 @@ describe "routing" do it "routes GET / to Withdrawals#index" do - { :get => "/withdrawals" }.should route_to( + expect({ :get => "/withdrawals" }).to route_to( :controller => "withdrawals" , :action => "index" ) end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 87fd2c24..faf72d2e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,7 +5,6 @@ ENV["RAILS_ENV"] ||= 'test' require File.expand_path("../../config/environment", __FILE__) require 'rspec/rails' -require 'rspec/autorun' # # Requires supporting ruby files with custom matchers and macros, etc, in # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are diff --git a/spec/support/controller_macros.rb b/spec/support/controller_macros.rb index f8a72269..d1cf5212 100644 --- a/spec/support/controller_macros.rb +++ b/spec/support/controller_macros.rb @@ -3,7 +3,7 @@ def login_user before do @request.env['devise.mapping'] = Devise.mappings[:user] @current_user = create(:user) - @current_user.confirm! + @current_user.confirm sign_in @current_user end end From 2f37c1173e4e5eb3f398067b944400f6ff5fa41f Mon Sep 17 00:00:00 2001 From: Sanjiv Jha Date: Wed, 4 Nov 2015 17:53:18 +0530 Subject: [PATCH 194/415] Removed all instance of should matcher & added expect instead of should --- spec/controllers/projects_controller_spec.rb | 16 ++++++++-------- spec/models/user_spec.rb | 8 ++++---- spec/spec_helper.rb | 3 +++ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index 236829e9..24b24018 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -53,7 +53,7 @@ describe 'POST #search' do it 'returns 200 status code' do post :search - response.should be_success + expect(response).to be_success end end @@ -75,7 +75,7 @@ when :get ; get action , :id => a_project.id when :patch ; patch action , :id => a_project.id end - response.should be_redirect + expect(response).to be_redirect end it 'via project name returns 200 status code' do @@ -83,7 +83,7 @@ when :get ; get action , :service => 'github' , :repo => a_project.full_name when :patch ; patch action , :service => 'github' , :repo => a_project.full_name end - response.should be_success + expect(response).to be_success end end @@ -93,7 +93,7 @@ when :get ; get action , :id => 999999 when :patch ; patch action , :id => 999999 end - response.should be_redirect + expect(response).to be_redirect end it 'via project name returns 200 status code' do @@ -101,7 +101,7 @@ when :get ; get action , :service => 'github' , :repo => 'no-such/project' ; when :patch ; patch action , :service => 'github' , :repo => 'no-such/project' ; end - response.should be_redirect + expect(response).to be_redirect end end end @@ -125,7 +125,7 @@ # include_context 'accessing_project' , :get , :edit get :edit , :service => 'github' , :repo => 'test/test' - response.should be_redirect + expect(response).to be_redirect end end @@ -135,7 +135,7 @@ it 'returns 302 status code' do get :decide_tip_amounts , :service => 'github' , :repo => 'test/test' - response.should be_redirect + expect(response).to be_redirect end end @@ -145,7 +145,7 @@ it 'returns 302 status code' do patch :decide_tip_amounts , :service => 'github' , :repo => 'test/test' - response.should be_redirect + expect(response).to be_redirect end end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 2a683d72..0e62b551 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -29,23 +29,23 @@ context 'when address is blank' do it 'should be valid' do user.bitcoin_address = '' - user.should be_valid + expect(user).to be_valid end end context 'when address is valid' do it 'should be valid' do user.bitcoin_address = '1M4bS4gPyA6Kb8w7aXsgth9oUZWcRk73tQ' - user.should be_valid + expect(user).to be_valid end end context 'when address is not valid' do it 'should not be valid' do user.bitcoin_address = '1M4bS4gPyA6Kb8w7aXsgth9oUZXXXXXXXX' - user.should_not be_valid + expect(user).not_to be_valid end end end -end \ No newline at end of file +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index faf72d2e..600f6dde 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,4 +1,7 @@ + +require "minitest/autorun" require 'simplecov' + SimpleCov.start 'rails' # This file is copied to spec/ when you run 'rails generate rspec:install' From 13d7d4faede1d4cf2a84cd3ad73d418b80cca945 Mon Sep 17 00:00:00 2001 From: Sanjiv Jha Date: Thu, 5 Nov 2015 16:02:38 +0530 Subject: [PATCH 195/415] updated the Cucumber version to match the rails version --- Gemfile.lock | 19 ++++++++++--------- features/support/env.rb | 2 +- spec/spec_helper.rb | 1 - 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index d513659e..abef8c4f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -108,7 +108,7 @@ GEM capistrano-rails (1.1.0) capistrano (>= 3.0.0) capistrano-bundler (>= 1.0.0) - capybara (2.2.1) + capybara (2.5.0) mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) @@ -123,17 +123,18 @@ GEM coffee-script-source (1.9.1.1) columnize (0.9.0) commonjs (0.2.7) - cucumber (1.3.14) + cucumber (1.3.20) builder (>= 2.1.2) diff-lcs (>= 1.1.3) gherkin (~> 2.12) multi_json (>= 1.7.5, < 2.0) - multi_test (>= 0.1.1) - cucumber-rails (1.4.0) - capybara (>= 1.1.2) - cucumber (>= 1.2.0) - nokogiri (>= 1.5.0) - rails (>= 3.0.0) + multi_test (>= 0.1.2) + cucumber-rails (1.4.2) + capybara (>= 1.1.2, < 3) + cucumber (>= 1.3.8, < 2) + mime-types (>= 1.16, < 3) + nokogiri (~> 1.5) + rails (>= 3, < 5) database_cleaner (1.2.0) debugger-linecache (1.2.0) demoji (0.0.5) @@ -211,7 +212,7 @@ GEM mini_portile (0.6.2) minitest (5.8.2) multi_json (1.11.2) - multi_test (0.1.1) + multi_test (0.1.2) multipart-post (1.2.0) mysql2 (0.3.14) net-scp (1.1.2) diff --git a/features/support/env.rb b/features/support/env.rb index 64ddf610..5a4dbb04 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -3,7 +3,7 @@ # newer version of cucumber-rails. Consider adding your own code to a new file # instead of editing this one. Cucumber will automatically load all features/**/*.rb # files. - +require 'minitest/autorun' require 'cucumber/rails' # Capybara defaults to CSS3 selectors rather than XPath. diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 600f6dde..d9fb3d51 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,4 +1,3 @@ - require "minitest/autorun" require 'simplecov' From 9d7b1c0fbeb796a51a4a479099282772901ccede Mon Sep 17 00:00:00 2001 From: Sanjiv Jha Date: Thu, 5 Nov 2015 18:53:06 +0530 Subject: [PATCH 196/415] Fixed the RSpec::Expectations::ExpectationNotMetError --- features/step_definitions/common.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/step_definitions/common.rb b/features/step_definitions/common.rb index b798f914..9f72ab4c 100644 --- a/features/step_definitions/common.rb +++ b/features/step_definitions/common.rb @@ -113,7 +113,7 @@ def parse_path_from_page_string page_string Then(/^I should be on the "(.*?)" page$/) do |page_string| expected = parse_path_from_page_string page_string rescue expected = page_string - actual = page.current_path + actual = URI.decode(page.current_path) expected.chop! if (expected.end_with? '/') && (expected.size > 1) actual .chop! if (actual .end_with? '/') && (actual .size > 1) From 3e8d3b9871cb7cebfc90754d261faa4d9ba4dc63 Mon Sep 17 00:00:00 2001 From: Sanjiv Jha Date: Thu, 19 Nov 2015 16:01:38 +0530 Subject: [PATCH 197/415] Schema updated --- app/assets/javascripts/i18n/translations.js | 2 +- db/schema.rb | 70 ++++++++++----------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js index 3bdc6e22..6b16f141 100644 --- a/app/assets/javascripts/i18n/translations.js +++ b/app/assets/javascripts/i18n/translations.js @@ -1,2 +1,2 @@ var I18n = I18n || {}; -I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"nl":{"js":{"errors":{"value":{"invalid":"De waarde is ongeldig"},"email":{"invalid":"Ongeldig e-mail adres","blank":"E-mail is verplicht en kan niet leeg blijven"},"password":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"},"password_confirmation":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}}}; \ No newline at end of file +I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"nl":{"js":{"errors":{"value":{"invalid":"De waarde is ongeldig"},"email":{"invalid":"Ongeldig e-mail adres","blank":"E-mail is verplicht en kan niet leeg blijven"},"password":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"},"password_confirmation":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в адресе электронной почты","blank":"Адрес электронной почты не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Neispravna vrijednost"},"email":{"invalid":"Neispravna email adresa","blank":"Email je obavezan"},"password":{"blank":"Lozinka je obavezma","invalid":"Lozinka i potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je obavezna","invalid":"Lozinka i potvrda nisu isti"}}}}}; \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index 03ad325d..52c6d93a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -13,7 +13,7 @@ ActiveRecord::Schema.define(version: 20150620054216) do - create_table "collaborators", force: true do |t| + create_table "collaborators", force: :cascade do |t| t.integer "project_id" t.string "login" t.datetime "created_at" @@ -22,9 +22,9 @@ add_index "collaborators", ["project_id"], name: "index_collaborators_on_project_id" - create_table "deposits", force: true do |t| + create_table "deposits", force: :cascade do |t| t.integer "project_id" - t.string "txid" + t.string "txid", limit: 255 t.integer "confirmations" t.datetime "created_at" t.datetime "updated_at" @@ -34,22 +34,22 @@ add_index "deposits", ["project_id"], name: "index_deposits_on_project_id" - create_table "projects", force: true do |t| - t.string "url" - t.string "bitcoin_address" + create_table "projects", force: :cascade do |t| + t.string "url", limit: 255 + t.string "bitcoin_address", limit: 255 t.datetime "created_at" t.datetime "updated_at" - t.string "name" - t.string "full_name" - t.string "source_full_name" + t.string "name", limit: 255 + t.string "full_name", limit: 255 + t.string "source_full_name", limit: 255 t.text "description" t.integer "watchers_count" - t.string "language" - t.string "last_commit" + t.string "language", limit: 255 + t.string "last_commit", limit: 255 t.integer "available_amount_cache" - t.string "github_id" - t.string "host", default: "github" - t.boolean "hold_tips", default: false + t.string "github_id", limit: 255 + t.string "host", default: "github" + t.boolean "hold_tips", default: false t.datetime "info_updated_at" t.string "branch" t.boolean "disable_notifications" @@ -60,16 +60,16 @@ add_index "projects", ["full_name"], name: "index_projects_on_full_name", unique: true add_index "projects", ["github_id"], name: "index_projects_on_github_id", unique: true - create_table "sendmanies", force: true do |t| - t.string "txid" + create_table "sendmanies", force: :cascade do |t| + t.string "txid", limit: 255 t.text "data" - t.string "result" + t.string "result", limit: 255 t.boolean "is_error" t.datetime "created_at" t.datetime "updated_at" end - create_table "tipping_policies_texts", force: true do |t| + create_table "tipping_policies_texts", force: :cascade do |t| t.integer "project_id" t.integer "user_id" t.text "text" @@ -80,13 +80,13 @@ add_index "tipping_policies_texts", ["project_id"], name: "index_tipping_policies_texts_on_project_id" add_index "tipping_policies_texts", ["user_id"], name: "index_tipping_policies_texts_on_user_id" - create_table "tips", force: true do |t| + create_table "tips", force: :cascade do |t| t.integer "user_id" t.integer "amount", limit: 8 t.integer "sendmany_id" t.datetime "created_at" t.datetime "updated_at" - t.string "commit" + t.string "commit", limit: 255 t.integer "project_id" t.datetime "refunded_at" t.text "commit_message" @@ -97,34 +97,34 @@ add_index "tips", ["sendmany_id"], name: "index_tips_on_sendmany_id" add_index "tips", ["user_id"], name: "index_tips_on_user_id" - create_table "users", force: true do |t| - t.string "email", default: "", null: false - t.string "encrypted_password", default: "", null: false - t.string "reset_password_token" + create_table "users", force: :cascade do |t| + t.string "email", limit: 255, default: "", null: false + t.string "encrypted_password", limit: 255, default: "", null: false + t.string "reset_password_token", limit: 255 t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.integer "sign_in_count", default: 0, null: false + t.integer "sign_in_count", default: 0, null: false t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" - t.string "current_sign_in_ip" - t.string "last_sign_in_ip" + t.string "current_sign_in_ip", limit: 255 + t.string "last_sign_in_ip", limit: 255 t.datetime "created_at" t.datetime "updated_at" - t.string "nickname" - t.string "name" - t.string "image" - t.string "bitcoin_address" - t.string "login_token" + t.string "nickname", limit: 255 + t.string "name", limit: 255 + t.string "image", limit: 255 + t.string "bitcoin_address", limit: 255 + t.string "login_token", limit: 255 t.boolean "unsubscribed" t.datetime "notified_at" - t.integer "commits_count", default: 0 - t.integer "withdrawn_amount", limit: 8, default: 0 + t.integer "commits_count", default: 0 + t.integer "withdrawn_amount", limit: 8, default: 0 t.datetime "confirmed_at" t.datetime "confirmation_sent_at" t.string "confirmation_token" t.string "unconfirmed_email" t.string "display_name" - t.integer "denom", default: 0 + t.integer "denom", default: 0 end add_index "users", ["email"], name: "index_users_on_email", unique: true From 4a065b33cf82adf760f188933d40b4c013e80889 Mon Sep 17 00:00:00 2001 From: APerson Date: Sun, 22 Nov 2015 13:33:53 -0500 Subject: [PATCH 198/415] Use a panel for project descriptions When project descriptions were inside a well, the upper portion of a project page was a sea of grayscale boxes. Putting project descriptions inside Bootstrap panels instead of wells lightens up the layout and makes the description more noticeable. --- app/views/projects/show.html.haml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 0b3f6efe..0ab43a02 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -34,7 +34,8 @@ .col-md-8 - unless @project.description.blank? - .well.well-sm= @project.description + .panel.panel-default + .panel-body= @project.description %h4 = t('.balance') - if @project.deposits.count > 0 From 43649b219ffdb4b58e6f26388fef7b57713ee3b2 Mon Sep 17 00:00:00 2001 From: Sanjiv Jha Date: Thu, 19 Nov 2015 17:03:34 +0530 Subject: [PATCH 199/415] Change the Account to email address in feature cucumber spec --- features/sign_up_sign_in.feature | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/features/sign_up_sign_in.feature b/features/sign_up_sign_in.feature index 2a7d1e4e..5363b3c3 100644 --- a/features/sign_up_sign_in.feature +++ b/features/sign_up_sign_in.feature @@ -139,11 +139,11 @@ Feature: Visitors should be able to sign_up and sign_in And I fill "Password" with: "new-guys-password" And I click "Sign in" Then I should be on the "sign_in" page - And I should see "You have to confirm your account before continuing" + And I should see "You have to confirm your email address before continuing" When I confirm the email address: "new-guy@example.com" Then I should be on the "sign_in" page - And I should see "Your account was successfully confirmed" + And I should see "Your email address has been successfully confirmed" When I fill "E-mail" with: "new-guy@example.com" And I fill "Password" with: "new-guys-password" And I click "Sign in" From 07bfc6c9aeec95af2a2e6475b38e0f2336e1972b Mon Sep 17 00:00:00 2001 From: Sanjiv Jha Date: Tue, 15 Dec 2015 00:50:18 +0530 Subject: [PATCH 200/415] Removed minitest Gem from Gemfile --- Gemfile | 1 - Gemfile.lock | 1 - spec/spec_helper.rb | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 32ce2916..aa997b3c 100644 --- a/Gemfile +++ b/Gemfile @@ -60,5 +60,4 @@ group :test do gem 'cucumber-rails', require: false gem 'database_cleaner' gem 'rspec-activemodel-mocks' - gem 'minitest' end diff --git a/Gemfile.lock b/Gemfile.lock index abef8c4f..a851162d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -378,7 +378,6 @@ DEPENDENCIES kaminari (~> 0.15.0) kaminari-i18n less-rails (~> 2.4.2) - minitest mysql2 octokit (~> 2.7.0) omniauth (~> 1.1.4) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d9fb3d51..d1ad52da 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,4 +1,4 @@ -require "minitest/autorun" +require "minitest/spec" require 'simplecov' SimpleCov.start 'rails' From b279f036c901bf8f1a47c8e5b6edc62125d6b9d5 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Wed, 16 Dec 2015 22:10:14 +0500 Subject: [PATCH 201/415] added settings and callback for hd wallet --- Gemfile | 3 +++ Gemfile.lock | 9 +++++++++ app/controllers/home_controller.rb | 8 ++++++++ config/config.yml.sample | 6 ++++++ config/routes.rb | 1 + 5 files changed, 27 insertions(+) diff --git a/Gemfile b/Gemfile index c29623a2..50746679 100644 --- a/Gemfile +++ b/Gemfile @@ -37,6 +37,9 @@ gem "i18n-js" gem 'kaminari-i18n' gem 'devise-i18n' +gem 'money-tree' +gem 'rest-client' + gem 'easy_gravatar' group :development do diff --git a/Gemfile.lock b/Gemfile.lock index 2e9158ef..ed55411f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -150,6 +150,7 @@ GEM railties (>= 3.0.0) faraday (0.8.9) multipart-post (~> 1.2.0) + ffi (1.9.10) gherkin (2.12.2) multi_json (~> 1.3) haml (4.0.5) @@ -196,6 +197,8 @@ GEM mime-types (1.25.1) mini_portile (0.5.3) minitest (4.7.5) + money-tree (0.9.0) + ffi multi_json (1.8.4) multi_test (0.1.1) multipart-post (1.2.0) @@ -203,6 +206,7 @@ GEM net-scp (1.1.2) net-ssh (>= 2.6.5) net-ssh (2.7.0) + netrc (0.7.7) nokogiri (1.6.1) mini_portile (~> 0.5.0) oauth2 (0.8.1) @@ -246,6 +250,9 @@ GEM ref (1.0.5) render_csv (2.0.0) rails (>= 3.0) + rest-client (1.7.2) + mime-types (>= 1.16, < 3.0) + netrc (~> 0.7) rspec-collection_matchers (0.0.2) rspec-expectations (>= 2.99.0.beta1) rspec-core (3.0.0.beta1) @@ -352,6 +359,7 @@ DEPENDENCIES kaminari (~> 0.15.0) kaminari-i18n less-rails (~> 2.4.2) + money-tree mysql2 octokit (~> 2.7.0) omniauth (~> 1.1.4) @@ -359,6 +367,7 @@ DEPENDENCIES rails (= 4.0.2) rails-i18n render_csv + rest-client rspec-rails (~> 3.0.0.beta) sass-rails (~> 4.0.0) sawyer (~> 0.5.2) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 2ef282df..c8f4ada7 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -55,4 +55,12 @@ def blockchain_info_callback end end + def blockchain_info_callback_v2 + if params[:confirmations].to_i < 30 + render json: params + else + render :text => "*ok*" + end + end + end diff --git a/config/config.yml.sample b/config/config.yml.sample index 3713bf2f..94696bbc 100644 --- a/config/config.yml.sample +++ b/config/config.yml.sample @@ -10,6 +10,12 @@ blockchain_info: guid: "111111111111" password: "111111111111" callback_secret: "111111111111" + # api_key for https://alpha.blockchain.info/ + api_key: "111111111111" + +wallet: + xpub: xpub11111111111111 + devise: secret: "111111111111" diff --git a/config/routes.rb b/config/routes.rb index 647da251..7f598e39 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,6 +6,7 @@ :controllers => { :omniauth_callbacks => 'users/omniauth_callbacks' } get '/blockchain_info_callback' => 'home#blockchain_info_callback' , :as => 'blockchain_info_callback' + get '/blockchain_info_callback_v2' => 'home#blockchain_info_callback_v2' , :as => 'blockchain_info_callback_v2' get '/users/login' => 'users#login' , :as => 'login_users' get '/users/:user_id/tips' => 'tips#index' , :constraints => {:user_id => /\d+/} , :as => 'user_tips' From f083e601147b5b4d9ac64d66bf7990858b412660 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Wed, 16 Dec 2015 22:58:02 +0500 Subject: [PATCH 202/415] updated mri, therubyracer and sqlite versions --- .travis.yml | 2 +- Gemfile | 6 +++--- Gemfile.lock | 14 +++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2041e869..6b5f83b2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: ruby rvm: - - 2.0.0 + - 2.2.4 bundler_args: --without development --jobs=9 --retry=2 --quiet diff --git a/Gemfile b/Gemfile index aa997b3c..3082599d 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' -ruby '2.0.0' +ruby '2.2.4' gem 'rails', '4.2.4' gem 'mysql2', group: :production @@ -10,7 +10,7 @@ gem 'less-rails', '~> 2.4.2' gem 'kaminari', '~> 0.15.0' gem 'uglifier', '>= 1.3.0' gem 'coffee-rails', '~> 4.0.0' -gem 'therubyracer', '~> 0.12.0', platforms: :ruby +gem 'therubyracer', '~> 0.12.2', platforms: :ruby gem 'jquery-rails', '~> 3.0.4' gem 'turbolinks', '~> 2.5.0' gem 'jquery-turbolinks' @@ -49,7 +49,7 @@ group :development do end group :development, :test do - gem 'sqlite3', '~> 1.3.8' + gem 'sqlite3', '~> 1.3.11' gem 'factory_girl_rails', '~> 4.3.0' gem 'rspec-rails', '~> 3.3.0' end diff --git a/Gemfile.lock b/Gemfile.lock index a851162d..e80a1e00 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -203,7 +203,7 @@ GEM less-rails (2.4.2) actionpack (>= 3.1) less (~> 2.4.0) - libv8 (3.16.14.3) + libv8 (3.16.14.13) loofah (2.0.3) nokogiri (>= 1.5.9) mail (2.6.3) @@ -268,7 +268,7 @@ GEM rake (10.4.2) rdoc (4.1.1) json (~> 1.4) - ref (1.0.5) + ref (2.0.0) render_csv (2.0.0) rails (>= 3.0) responders (2.1.0) @@ -321,14 +321,14 @@ GEM actionpack (>= 3.0) activesupport (>= 3.0) sprockets (~> 2.8) - sqlite3 (1.3.8) + sqlite3 (1.3.11) sshkit (1.3.0) net-scp (>= 1.1.2) net-ssh term-ansicolor term-ansicolor (1.2.2) tins (~> 0.8) - therubyracer (0.12.0) + therubyracer (0.12.2) libv8 (~> 3.16.14.0) ref thor (0.19.1) @@ -392,12 +392,12 @@ DEPENDENCIES sdoc shoulda-matchers (~> 2.5.0) simplecov - sqlite3 (~> 1.3.8) - therubyracer (~> 0.12.0) + sqlite3 (~> 1.3.11) + therubyracer (~> 0.12.2) turbolinks (~> 2.5.0) twitter-bootstrap-rails! twitter_bootstrap_form_for! uglifier (>= 1.3.0) BUNDLED WITH - 1.10.6 + 1.11.2 From 54ed1683e3b84d293539250e4d4e062be63b12da Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 19 Dec 2015 12:41:00 +0500 Subject: [PATCH 203/415] updated deploy configureation --- config/deploy.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/deploy.rb b/config/deploy.rb index cd5541a0..1f1bfbc5 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -7,7 +7,7 @@ set :scm, :git set :rvm_type, :user -set :rvm_ruby_version, '2.0.0-p247' +set :rvm_ruby_version, '2.2.4' set :rvm_custom_path, '~/.rvm' set :format, :pretty @@ -40,4 +40,4 @@ after :finishing, 'deploy:cleanup' -end \ No newline at end of file +end From dc5a4dcd17f1ce2b9894daec7acbf828992900b6 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 19 Dec 2015 14:07:14 +0500 Subject: [PATCH 204/415] added support for blockchain receiving api v2 --- app/controllers/home_controller.rb | 43 +++++++++++++++++-- app/models/project.rb | 7 +++ config/config.yml.sample | 3 ++ config/routes.rb | 2 +- ...081507_add_bitcoin_address2_to_projects.rb | 12 ++++++ db/schema.rb | 17 ++++---- lib/wallet.rb | 25 +++++++++++ 7 files changed, 96 insertions(+), 13 deletions(-) create mode 100644 db/migrate/20151219081507_add_bitcoin_address2_to_projects.rb create mode 100644 lib/wallet.rb diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index c8f4ada7..9601118e 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -16,7 +16,7 @@ def blockchain_info_callback test = params[:test] if (params[:value].to_i < 0) || Sendmany.find_by(txid: params[:transaction_hash]) - render :text => "*ok*"; + render :text => "*ok*" return end @@ -56,11 +56,46 @@ def blockchain_info_callback end def blockchain_info_callback_v2 - if params[:confirmations].to_i < 30 - render json: params - else + if (params[:secret]!=CONFIG["blockchain_info"]["callback_secret2"]) + render json: {error: 'Forbidden'}, status: 403 + return + end + + if params[:value].to_i < 0 render :text => "*ok*" + return + end + + if project = Project.find_by(bitcoin_address2: params[:address]) + deposit = project.deposits.find_by(txid: params[:transaction_hash]) + else + deposit = nil + end + + if deposit + deposit.update_attribute(:confirmations, confirmations = params[:confirmations]) + project.update_cache + if confirmations.to_i > 10 + render :text => "*ok*" + else + render :text => "Deposit #{deposit.id} updated!" + end + return + end + + if project + deposit = Deposit.create({ + project_id: project.id, + txid: params[:transaction_hash], + confirmations: params[:confirmations], + amount: params[:value].to_i + }) + project.update_cache + render :text => "Deposit #{deposit[:txid]} has been created!" + else + render :text => "Project with deposit address #{params[:address]} is not found!" end + end end diff --git a/app/models/project.rb b/app/models/project.rb index 7a9e567d..b07de0c7 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -263,4 +263,11 @@ def unarchive_address! return nil end end + + # Receiving API v2 + def generate_address2 + new_address = Wallet.generate_address_and_register_callback + Rails.logger.info "Generated: #{new_address.inspect}" + self.update bitcoin_address2: new_address['address'] + end end diff --git a/config/config.yml.sample b/config/config.yml.sample index 94696bbc..28fc9076 100644 --- a/config/config.yml.sample +++ b/config/config.yml.sample @@ -1,3 +1,5 @@ +app_host: 'tip4commit.com' + github: key: "111111111111" secret: "111111111111" @@ -12,6 +14,7 @@ blockchain_info: callback_secret: "111111111111" # api_key for https://alpha.blockchain.info/ api_key: "111111111111" + callback_secret2: "111111111111" wallet: xpub: xpub11111111111111 diff --git a/config/routes.rb b/config/routes.rb index 7f598e39..659819b3 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,7 +6,7 @@ :controllers => { :omniauth_callbacks => 'users/omniauth_callbacks' } get '/blockchain_info_callback' => 'home#blockchain_info_callback' , :as => 'blockchain_info_callback' - get '/blockchain_info_callback_v2' => 'home#blockchain_info_callback_v2' , :as => 'blockchain_info_callback_v2' + get '/blockchain_info_callback_v2/:secret' => 'home#blockchain_info_callback_v2', :as => 'blockchain_info_callback_v2' get '/users/login' => 'users#login' , :as => 'login_users' get '/users/:user_id/tips' => 'tips#index' , :constraints => {:user_id => /\d+/} , :as => 'user_tips' diff --git a/db/migrate/20151219081507_add_bitcoin_address2_to_projects.rb b/db/migrate/20151219081507_add_bitcoin_address2_to_projects.rb new file mode 100644 index 00000000..8ade9884 --- /dev/null +++ b/db/migrate/20151219081507_add_bitcoin_address2_to_projects.rb @@ -0,0 +1,12 @@ +class AddBitcoinAddress2ToProjects < ActiveRecord::Migration + def change + add_column :projects, :bitcoin_address2, :string, index: true + reversible do |dir| + dir.up do + Project.find_each do |project| + project.generate_address2 + end + end + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 52c6d93a..6d9ea3a3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,11 +11,11 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20150620054216) do +ActiveRecord::Schema.define(version: 20151219081507) do create_table "collaborators", force: :cascade do |t| t.integer "project_id" - t.string "login" + t.string "login", limit: 255 t.datetime "created_at" t.datetime "updated_at" end @@ -48,13 +48,14 @@ t.string "last_commit", limit: 255 t.integer "available_amount_cache" t.string "github_id", limit: 255 - t.string "host", default: "github" + t.string "host", limit: 255, default: "github" t.boolean "hold_tips", default: false t.datetime "info_updated_at" - t.string "branch" + t.string "branch", limit: 255 t.boolean "disable_notifications" - t.string "avatar_url" + t.string "avatar_url", limit: 255 t.datetime "deleted_at" + t.string "bitcoin_address2" end add_index "projects", ["full_name"], name: "index_projects_on_full_name", unique: true @@ -121,9 +122,9 @@ t.integer "withdrawn_amount", limit: 8, default: 0 t.datetime "confirmed_at" t.datetime "confirmation_sent_at" - t.string "confirmation_token" - t.string "unconfirmed_email" - t.string "display_name" + t.string "confirmation_token", limit: 255 + t.string "unconfirmed_email", limit: 255 + t.string "display_name", limit: 255 t.integer "denom", default: 0 end diff --git a/lib/wallet.rb b/lib/wallet.rb new file mode 100644 index 00000000..a7e4bbab --- /dev/null +++ b/lib/wallet.rb @@ -0,0 +1,25 @@ +class Wallet + + # @return Hash - {"address"=>"1VhXRDrsBnmqgLzkAizb2RTDWNLqQDaiz", "index"=>0, "callback"=>"https://b27d33dc.ngrok.io/blockchain_info_callback_v2"} + class << self + def generate_address_and_register_callback + callback_url = 'https://'+CONFIG['app_host']+'/blockchain_info_callback_v2/'+CONFIG['blockchain_info']['callback_secret2'] + params = { + xpub: CONFIG['wallet']['xpub'], + callback: callback_url, + key: CONFIG['blockchain_info']['api_key'] + } + response = RestClient.get "https://api.blockchain.info/v2/receive", params: params + return JSON.parse(response) + rescue RestClient::BadRequest => e + return e + end + end + + # Callback response example + # + # GET /blockchain_info_callback_v2?address=1VhXRDrsBnmqgLzkAizb2RTDWNLqQDaiz&transaction_hash=6b3653774e7d71b8b802dc39cc885027eae8e4f1488fcdc39c72bcdcd2abbc67&value=100000&confirmations=0 + # User-Agent: Blockchain.info Receive Payments Callback Client + + +end From 3ef01d2c722b59fb64b20368ce77c2f63be3ce04 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 19 Dec 2015 14:21:30 +0500 Subject: [PATCH 205/415] increased the number of confirmations --- app/models/deposit.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/deposit.rb b/app/models/deposit.rb index 45638f49..6dfba0c9 100644 --- a/app/models/deposit.rb +++ b/app/models/deposit.rb @@ -1,7 +1,7 @@ class Deposit < ActiveRecord::Base belongs_to :project - CONFIRMATIONS_NEEDED = 2 + CONFIRMATIONS_NEEDED = 3 scope :confirmed, -> { where("confirmations >= #{CONFIRMATIONS_NEEDED}") } scope :unconfirmed, -> { where("confirmations < #{CONFIRMATIONS_NEEDED}") } @@ -26,4 +26,4 @@ def project_name project.full_name end -end \ No newline at end of file +end From 6275cd9e041e74e28f6e154fa8ef4c1f98421301 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 19 Dec 2015 14:43:00 +0500 Subject: [PATCH 206/415] fixed tests --- features/step_definitions/tips_steps.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/step_definitions/tips_steps.rb b/features/step_definitions/tips_steps.rb index dae6012b..cedd7673 100644 --- a/features/step_definitions/tips_steps.rb +++ b/features/step_definitions/tips_steps.rb @@ -12,7 +12,7 @@ end Given(/^a deposit of "(.*?)" is made$/) do |deposit| - Deposit.create!(project: @current_project, amount: deposit.to_d * 1e8, confirmations: 2) + Deposit.create!(project: @current_project, amount: deposit.to_d * 1e8, confirmations: 10) end def add_new_commit commit_id , nickname , params = {} From 1c074e50dd586769f2160da0468b8fcb5fb7d8a4 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 19 Dec 2015 17:17:04 +0500 Subject: [PATCH 207/415] fixed rates helper --- app/assets/javascripts/i18n/translations.js | 2 +- app/helpers/application_helper.rb | 44 ++++++++++----------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js index 6b16f141..3831e702 100644 --- a/app/assets/javascripts/i18n/translations.js +++ b/app/assets/javascripts/i18n/translations.js @@ -1,2 +1,2 @@ var I18n = I18n || {}; -I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"nl":{"js":{"errors":{"value":{"invalid":"De waarde is ongeldig"},"email":{"invalid":"Ongeldig e-mail adres","blank":"E-mail is verplicht en kan niet leeg blijven"},"password":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"},"password_confirmation":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в адресе электронной почты","blank":"Адрес электронной почты не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Neispravna vrijednost"},"email":{"invalid":"Neispravna email adresa","blank":"Email je obavezan"},"password":{"blank":"Lozinka je obavezma","invalid":"Lozinka i potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je obavezna","invalid":"Lozinka i potvrda nisu isti"}}}}}; \ No newline at end of file +I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Neispravna vrijednost"},"email":{"invalid":"Neispravna email adresa","blank":"Email je obavezan"},"password":{"blank":"Lozinka je obavezma","invalid":"Lozinka i potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je obavezna","invalid":"Lozinka i potvrda nisu isti"}}}},"nl":{"js":{"errors":{"value":{"invalid":"De waarde is ongeldig"},"email":{"invalid":"Ongeldig e-mail adres","blank":"E-mail is verplicht en kan niet leeg blijven"},"password":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"},"password_confirmation":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в адресе электронной почты","blank":"Адрес электронной почты не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}}}; \ No newline at end of file diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 04cc461c..67915a80 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -71,86 +71,86 @@ def to_satoshi satoshies end def to_usd satoshies - "$%.2f" % cource("USD", satoshies) + "$%.2f" % rate("USD", satoshies) end def to_aud satoshies - "$%.2f" % cource("AUD", satoshies) + "$%.2f" % rate("AUD", satoshies) end def to_eur satoshies - "€%.2f" % cource("EUR", satoshies) + "%.2f€" % rate("EUR", satoshies) end def to_brl satoshies - "R$%.2f" % cource("BRL", satoshies) + "R$%.2f" % rate("BRL", satoshies) end def to_cad satoshies - "$%.2f" % cource("CAD", satoshies) + "$%.2f" % rate("CAD", satoshies) end def to_cny satoshies - "¥%.2f" % cource("CNY", satoshies) + "%.2f¥" % rate("CNY", satoshies) end def to_gbp satoshies - "£%.2f" % cource("GBP", satoshies) + "%.2f£" % rate("GBP", satoshies) end def to_idr satoshies - "Rp%.2f" % cource("IDR", satoshies) + "%.2f Rp" % rate("IDR", satoshies) end def to_ils satoshies - "₪%.2f" % cource("ILS", satoshies) + "%.2f₪" % rate("ILS", satoshies) end def to_jpy satoshies - "¥%.2f" % cource("JPY", satoshies) + "%.2f¥" % rate("JPY", satoshies) end def to_mxn satoshies - "$%.2f" % cource("MXN", satoshies) + "%.2f MXN" % rate("MXN", satoshies) end def to_nok satoshies - "kr%.2f" % cource("NOK", satoshies) + "%.2f kr" % rate("NOK", satoshies) end def to_nzd satoshies - "$%.2f" % cource("NZD", satoshies) + "$%.2f" % rate("NZD", satoshies) end def to_pln satoshies - "zł%.2f" % cource("PLN", satoshies) + "%.2f zł" % rate("PLN", satoshies) end def to_ron satoshies - "lei%.2f" % cource("RON", satoshies) + "%.2f lei" % rate("RON", satoshies) end def to_rub satoshies - "₽%.2f" % cource("RUB", satoshies) + "%.2f₽" % rate("RUB", satoshies) end def to_sek satoshies - "kr%.2f" % cource("SEK", satoshies) + "%.2f kr" % rate("SEK", satoshies) end def to_sgd satoshies - "$%.2f" % cource("SGD", satoshies) + "%.2f S$" % rate("SGD", satoshies) end def to_zar satoshies - "R%.2f" % cource("ZAR", satoshies) + "%.2f R" % rate("ZAR", satoshies) end - def cource(currency, satoshies) - satoshies*0.00000001*get_cource(currency) + def rate(currency, satoshies) + satoshies*0.00000001*get_rate(currency) end - def get_cource(currency) + def get_rate(currency) Rails.cache.fetch("###" + currency, :expires_in => 24.hours) do uri = URI('https://api.bitcoinaverage.com/ticker/' + currency + '/') response = Net::HTTP.get_response(uri) From a21a6c644a9e03975003cc9bd4b6682008b56881 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 19 Dec 2015 17:25:57 +0500 Subject: [PATCH 208/415] removed deprecation warning --- config/environments/production.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 27cba157..1d827f7b 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -20,7 +20,7 @@ # config.action_dispatch.rack_cache = true # Disable Rails's static asset server (Apache or nginx will already do this). - config.serve_static_assets = false + config.serve_static_files = false # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier From 4d46d987fbc4a65142b6193853b906622dab9aad Mon Sep 17 00:00:00 2001 From: Atul Bhosale Date: Sun, 3 Jan 2016 20:45:49 +0530 Subject: [PATCH 209/415] Update copyright notice to 2016 [ci skip] --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 69cb66e9..0b04d721 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2015 tip4commit +Copyright (c) 2016 tip4commit Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in From c824e4572056cae5cd17dd02c6dd80bd70a4a58f Mon Sep 17 00:00:00 2001 From: Arsen Gasparyan Date: Sat, 6 Feb 2016 18:50:22 +0500 Subject: [PATCH 210/415] sendmany via bitcoind json rpc --- app/models/sendmany.rb | 24 ++++++++++++----------- config/config.yml.sample | 5 ++++- lib/bitcoin_rpc.rb | 41 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 12 deletions(-) create mode 100644 lib/bitcoin_rpc.rb diff --git a/app/models/sendmany.rb b/app/models/sendmany.rb index 63be4035..c408fa64 100644 --- a/app/models/sendmany.rb +++ b/app/models/sendmany.rb @@ -10,19 +10,21 @@ def send_transaction update_attribute :is_error, true # it's a lock to prevent duplicates - uri = URI CONFIG["blockchain_info"]["sendmany_url"] - params = { password: CONFIG["blockchain_info"]["password"], recipients: data } - uri.query = URI.encode_www_form(params) - res = Net::HTTP.get_response(uri) - if res.is_a?(Net::HTTPSuccess) && (json = JSON.parse(res.body)) - Rails.logger.info res.body - update_attribute :result, json - if !(txid = json["tx_hash"]).blank? + + bitcoind = BitcoinRPC.new(CONFIG["bitcoind"]["rpc_connection_string"],false) + + begin + txid = bitcoind.sendmany( + CONFIG["bitcoind"]["account"], + JSON.parse(data).map { |address, amount| {address => amount/1e8} }.inject(&:merge) + ) + if txid.present? update_attribute :is_error, false - update_attribute :txid, json["tx_hash"] + update_attribute :txid, txid end - else - Rails.logger.error "Failed to get correct response from blockchain.info" + rescue StandardError => e + update_attribute :result, e.inspect end + end end diff --git a/config/config.yml.sample b/config/config.yml.sample index 28fc9076..b187aa50 100644 --- a/config/config.yml.sample +++ b/config/config.yml.sample @@ -16,10 +16,13 @@ blockchain_info: api_key: "111111111111" callback_secret2: "111111111111" +bitcoind: + rpc_connection_string: https://user:password@rpc.blockchain.info:443 + account: 1M4bS4gPyA6Kb8w7aXsgth9oUZWcRk73tQ + wallet: xpub: xpub11111111111111 - devise: secret: "111111111111" diff --git a/lib/bitcoin_rpc.rb b/lib/bitcoin_rpc.rb new file mode 100644 index 00000000..8d427643 --- /dev/null +++ b/lib/bitcoin_rpc.rb @@ -0,0 +1,41 @@ +require 'net/http' +require 'uri' +require 'json' + +class BitcoinRPC + + def initialize(service_url, batch_mode=false) + @service_url = service_url + @uri = URI.parse(service_url) + set_batch_mode(batch_mode) + end + + def set_batch_mode(m) + @batch_mode = m + end + + def method_missing(name, *args) + if (@batch_mode) + { 'method' => name, 'params' => args, 'id' => 'jsonrpc', 'jsonrpc' => '2.0' } + else + post_body = { 'method' => name, 'params' => args, 'id' => 'jsonrpc'}.to_json + resp = JSON.parse( http_post_request(post_body) ) + raise JSONRPCError, resp['error'] if resp['error'] + resp['result'] + end + end + + def commit(reqs) + post_body = reqs.to_json + resp = JSON.parse( http_post_request(post_body) ) + raise JSONRPCError, resp if resp.length != reqs.length + resp + end + + def http_post_request(post_body) + RestClient.post( @service_url, post_body, :content_type => :json, :accept => :json ).body + end + + class JSONRPCError < RuntimeError; end + +end From 10f813aa60f023792294a7b125301be4c87fca92 Mon Sep 17 00:00:00 2001 From: SopaXorzTaker Date: Sat, 18 Jun 2016 18:41:45 +0300 Subject: [PATCH 211/415] Improve translation --- config/locales/ru.yml | 64 +++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/config/locales/ru.yml b/config/locales/ru.yml index d099e7c4..5175e0d1 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -1,8 +1,8 @@ ru: tip4commit: Tip4Commit meta: - title: Помощь проектам с открытым исходным кодом - description: Жертвуйте биткоины проектам с открытым исходным кодом или создавайте коммиты и получайте чаевые за них. + title: Помощь open-source проектам + description: Жертвуйте биткоины проектам с открытым исходным кодом или создавайте коммиты и получайте вознаграждение за них. menu: home: Главная projects: Проекты @@ -29,7 +29,7 @@ ru: notices: project_updated: Настройки проекта обновлены - tips_decided: Сумма чаевых определена + tips_decided: Сумма вознаграждения определена user_updated: Ваш профиль обновлен! user_unsubscribed: "Вы отписались! Приносим извинения за предоставленные неудобства. Однако, вы все равно можете оставить нам свой Биткоин-адрес, чтобы получать вознаграждения" tip_amounts: @@ -58,15 +58,15 @@ ru: see_projects: Проекты how_does_it_work: title: Как это работает? - text: Люди жертвуют биткоины на проекты. Если владелец проекта принимает коммит в репозиторий, мы автоматически начисляем чаевые автору этого коммита. + text: Люди жертвуют биткоины проектам. Если владелец проекта примет коммит в репозиторий, мы автоматически начислим вознаграждение автору этого коммита. button: Узнать о Биткоин donate: - title: Жертвуйте - text: Найдите проект который вам по душе и перечислите биткоины на него. Ваши пожертвования вместе с пожертвованиями других людей будут автоматически выплачиваться авторам новых коммитов в виде чаевых. + title: Делайте пожертвования! + text: Найдите проект который вам по душе и перечислите биткоины на него. Ваши пожертвования вместе с пожертвованиями других людей будут автоматически выплачиваться авторам новых коммитов в виде вознаграждения. button: Найти или добавить проект contribute: title: Участвуйте - text: Идите и почините что-нибудь! Если ваш коммит будет принят владельцами проекта, вам будут выплачены чаевые! + text: Идите и почините что-нибудь! Если ваш коммит будет принят владельцами проекта, вам будут выплачено вознаграждение! sign_in_text: "Просто проверьте ваш email или %{sign_in_link}." sign_up_text: "Если вы еще не получили приглашение, вы можете %{sign_up_link} с действительным адресом электронной почты или через" button: Проекты @@ -82,32 +82,32 @@ ru: forked_from: ответвление от support: "Поддержать проект" show: - title: "Помогайте %{project}" + title: "Помочь %{project}" fetch_pending: (Ожидание получения) edit_project: Изменить настройки проекта - decide_tip_amounts: Установить сумму чаевых - disabled_notifications: "Контрибьюторы проекта решили не уведомлять новых участников о чаевых и, вероятно, им не нравится такой способ финансирования." - fee: "%{percentage} средств будет выплачено в качестве чаевых за новый коммит." + decide_tip_amounts: Установить сумму вознаграждения + disabled_notifications: "Контрибьюторы проекта решили не уведомлять новых участников о вознаграждениях и, вероятно, им не нравится такой способ финансирования." + fee: "%{percentage} средств будет выплачено в качестве вознаграждения за новый коммит." balance: Баланс deposits: депозиты custom_tip_size: (каждый новый коммит получает процент от доступного остатка) default_tip_size: "(каждый новый коммит получает %{percentage} от доступного остатка)" - min_tip_size: "Минимальный размер чаевых установлен в %{min_tip}, но если он превышает доступный остаток, то весь остаток будет выплачен в качестве чаевых" + min_tip_size: "Минимальный размер вознаграждения установлен в %{min_tip}, но если он превышает доступный остаток, тот будет полностью выплачен в качестве вознаграждения." unconfirmed_amount: "(%{amount} не подтверждено)" - tipping_policies: Политика чаевых + tipping_policies: Политика выплаты вознаграждений updated_by_user: "(Последние изменения %{name} на %{date})" updated_by_unknown: "(Последние изменения на %{date})" - tips_paid: Выплаченные чаевые + tips_paid: Выплаченные вознаграждения unclaimed_amount: "(%{amount} от суммы являются невостребованными, и будут возвращены проекту через месяц.)" - last_tips: Недавние чаевые + last_tips: Недавние вознаграждения see_all: смотреть все received: "получено %{amount}" - will_receive: получит чаевые + will_receive: получит вознаграждение for_commit: за коммит when_decided: когда сумма будет определена - next_tip: Следующие чаевые + next_tip: Следующее вознаграждение contribute_and_earn: Помогайте и зарабатывайте - contribute_and_earn_description: "Жертвуйте биткоины этому проекту или %{make_commits_link} и получайте чаевые за них. Если ваш коммит будет принят %{branch} владельцами проекта, а баланс этого проекта положительный, то вы получите чаевые!" + contribute_and_earn_description: "Жертвуйте биткоины этому проекту или %{make_commits_link} и получайте вознаграждение за них. Если ваш коммит будет принят %{branch} владельцами проекта, а баланс этого проекта будет положительным, то вы будете награждены!" contribute_and_earn_branch: "в ветку %{branch}" make_commits_link: создавайте коммиты tell_us_bitcoin_address: "Просто %{tell_us_link} ваш биткоин-адрес." @@ -116,36 +116,36 @@ ru: promote_project: "Расскажите о %{project}" embedding: Код для вставки image_url: "URL изображения:" - shield_title: чаевые за следующий коммит + shield_title: вознаграждение за следующий коммит edit: - project_settings: "%{project} настройки проекта" + project_settings: "настройки проекта %{project}" branch: Ветка default_branch: Ветка по умолчанию - tipping_policies: Чаевые - hold_tips: "Не отправляйте чаевые сразу. Предоставьте владельцам проекта возможность изменить чаевые перед тем как они будут отправлены." + tipping_policies: Вознаграждение + hold_tips: "Не отправляйте вознагражение сразу. Предоставьте владельцам проекта возможность изменить сумму, перед тем как оно будет отправлено." save: Сохранить настройки проекта disable_notifications: Не оповещать новых контрибьюторов decide_tip_amounts: commit: Коммит author: Автор message: Сообщение - tip: Чаевые (зависят от баланса проекта) - submit: Отправить выбранную сумму чаевых + tip: Вознаграждение (зависит от баланса проекта) + submit: Отправить выбранную сумму вознаграждения blacklisted: - title: К сожалению, проект не принимает чаевые! - message: Автор этого проекта запретил принимать чаевые. + title: К сожалению, проект не принимает вознаграждений! + message: Автор этого проекта запретил принимать вознаграждения. tips: index: - tips: Чаевые - project_tips: 'Чаевые %{project}' - user_tips: "Чаевые %{user}" + tips: Вознаграждения + project_tips: 'Вознаграждения %{project}' + user_tips: "Вознаграждения %{user}" created_at: Время создания commiter: Автор project: Проект commit: Коммит amount: Сумма refunded: Возвращено на депозит проекта - undecided: Сумма чаевых ещё не определена + undecided: Сумма вознаграждения ещё не определена no_bitcoin_address: Адрес вывода не указан below_threshold: "Баланс пользователя ниже порога вывода" waiting: Ожидает вывода @@ -163,7 +163,7 @@ ru: confirmed_no: 'Нет' users: index: - title: Топ контрибьюторов + title: Топ участников name: Имя commits_count: Количество коммитов withdrawn: Выплачено @@ -173,7 +173,7 @@ ru: see_all: смотреть все received: "%{time} получено %{amount} за коммит %{commit} в %{project}" bitcoin_address_placeholder: Ваш биткоин-адрес - notify: Сообщать мне о новых чаевых (не чаще чем одно сообщение в месяц) + notify: Сообщать мне о новых вознаграждениях (не чаще чем одно сообщение в месяц) submit_user: Обновить информацию пользователя change_password: Смена пароля submit_password: Сменить пароль From 9897c62beaa65b77b693a4f0f1691f7e4fced333 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 10 Dec 2016 11:43:43 +0300 Subject: [PATCH 212/415] temporarily disabled automatic sendmany creation because blockchain api is broken again --- app/models/sendmany.rb | 6 ++++++ lib/bitcoin_tipper.rb | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/models/sendmany.rb b/app/models/sendmany.rb index c408fa64..d42aa3d7 100644 --- a/app/models/sendmany.rb +++ b/app/models/sendmany.rb @@ -27,4 +27,10 @@ def send_transaction end end + + def to_csv + JSON.parse(self.data).map do |address, value| + [address, value / 1e8].join(',') + end.join("\n") + end end diff --git a/lib/bitcoin_tipper.rb b/lib/bitcoin_tipper.rb index e343bbaf..88478e28 100644 --- a/lib/bitcoin_tipper.rb +++ b/lib/bitcoin_tipper.rb @@ -31,9 +31,9 @@ def self.work withdraw = true end end - if users_waiting_for_withdrawal > 2 - self.create_sendmany - end + # if users_waiting_for_withdrawal > 2 + # self.create_sendmany + # end Rails.logger.info "Traversing sendmanies..." Sendmany.where(txid: nil).each do |sendmany| From a718beeeebb87b89d7471ef7bdc3b8f29cc5bc2d Mon Sep 17 00:00:00 2001 From: FreakJoe Date: Tue, 27 Dec 2016 11:15:08 +0100 Subject: [PATCH 213/415] Started working on German localization --- config/locales/de.yml | 233 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 233 insertions(+) create mode 100644 config/locales/de.yml diff --git a/config/locales/de.yml b/config/locales/de.yml new file mode 100644 index 00000000..6417b72a --- /dev/null +++ b/config/locales/de.yml @@ -0,0 +1,233 @@ +en: + tip4commit: Tip4Commit + meta: + title: Tragen Sie zu Open-Source-Projekten bei + description: Spenden Sie bitcoins an Projekte die Sie interessieren oder fügen Sie commits hinzu um Trinkgelder zu erhalten + menu: + home: Home + projects: Unterstützte Projekte + footer: + text: "Der Quellcode dieser Anwendung ist auf %{github_link} Verfügbar und Sie können die Entwicklung %{support_link}." + github_link: GitHub + support_link: unterstützen + follow_link: Folgen Sie @tip4commit + links: + sign_up: Registrieren + sign_in: Anmelden + sign_in_imp: anmelden + sign_out: Abmelden + create_issue: Ticket erstellen + errors: + project_not_found: Projekt wurde nicht gefunden + opt_in_notice: "Aufgrund vergangener Beschwerden von Projektleitern fügen wir keine Projekte mehr automatisch hinzu. Projekte ohne verfügbare Spenden wurden entfernt. Wenn Sie ihr Projekt gerne hinzufügen möchten, müssen Sie ein %{create_issue_link}." + access_denied: Zugang verwährt + can_assign_more_tips: "Sie können nicht mehr als 100% der verfügbaren Summe vergeben." + wrong_bitcoin_address: Fehler beim Aktualisieren der Bitcoin-Adresse + user_not_found: Nutzer nicht gefunden + access_denied: Diese Aktion ist Ihnen nicht erlaubt! + notices: + project_updated: Die Projekteinstellungen wurden aktualisiert. + tips_decided: Die Höhe der Trinkgelder wurde eingestellt. + user_updated: Ihre Informationen wurden gespeichert. + user_unsubscribed: "Sie haben das Abo beendet. Es tut uns leid, falls wir Sie belästigt haben. Wenn Sie weiterhin Trinkgelder erhalten wollen, können Sie jedoch trotzdem ihre Bitcoin-Adresse angeben." + tip_amounts: + undecided: "Nicht festgelegt" + free: "Kostenlos: 0%" + tiny: "Minimal: 0.1%" + small: "Klein: 0.5%" + normal: "Normal: 1%" + big: "Groß: 2%" + huge: "Sehr groß: 5%" + js: + errors: + value: + invalid: Der Wert ist ungültig. + email: + invalid: Die E-Mail Adresse ist ungültig. + blank: Sie müssen eine E-Mail Adresse angeben! + password: + blank: Sie müssen ein Passwort angeben! + invalid: Die angegebenen Passwörter stimmen nicht überein! + password_confirmation: + blank: Sie müssen ihr Passwort bestätigen. + invalid: Die angegebenen Passwörter stimmen nicht überein! + home: + index: + see_projects: Projekte anschauen + how_does_it_work: + title: Wie funktioniert das Ganze? + text: Leute spenden Bitcoin an Projekte. Wird ein commit akzeptiert, erhält der Urheber automatisch ein Trinkgeld. + button: Informieren Sie sich über Bitcoin + donate: + title: Spenden + text: Finden Sie ein Projekt, das Ihnen gefällt und spenden Sie. Zusammen mit den Spenden anderer Interessenten wird das Geld verwendet um Trinkgelder an Mitarbeiter zu verteilen. + button: Projekt suchen oder hinzufügen + contribute: + title: Aushelfen + text: Reparieren Sie etwas! Wird ihre Veränderung akzeptiert, erhalten Sie ein Trinkgeld. + sign_in_text: "Sehen Sie nach einer Einladung in ihrem E-Mail-Fach oder folgen Sie diesem Link: %{sign_in_link}." + sign_up_text: "Wenn Sie noch keine Einladung erhalten haben, können Sie sich mit einer gültigen E-Mail Adresse %{sign_up_link}." + button: Unterstützte Projekte + projects: + index: + find_project: + placeholder: Enter GitHub project URL or any keyword to find it... + button: Find project + repository: Repository + description: Description + watchers: Watchers + balance: Balance + forked_from: forked from + support: Support project + show: + title: "Contribute to %{project}" + fetch_pending: (Pending initial fetch) + edit_project: Change project settings + decide_tip_amounts: Decide tip amounts + disabled_notifications: "Project maintainers have decided not to notify new contributors about tips and they probably don't like this way of funding." + fee: "%{percentage} of deposited funds will be used to tip for new commits." + balance: Balance + deposits: deposits + custom_tip_size: (each new commit receives a percentage of available balance) + default_tip_size: "(each new commit receives %{percentage} of available balance)" + min_tip_size: "Minimum tip size is set to %{min_tip}, but if available balance is less than that then it will be sent as a smaller tip" + unconfirmed_amount: "(%{amount} unconfirmed)" + tipping_policies: Tipping policies + updated_by_user: "(Last updated by %{name} on %{date})" + updated_by_unknown: "(Last updated on %{date})" + tips_paid: Tips Paid + unclaimed_amount: "(%{amount} of this is unclaimed, and will be refunded to the project after being unclaimed for 1 month.)" + last_tips: Last Tips + see_all: see all + received: "received %{amount}" + will_receive: will receive a tip + for_commit: for commit + when_decided: when its amount is decided + next_tip: Next Tip + contribute_and_earn: Contribute and Earn + contribute_and_earn_description: "Donate bitcoins to this project or %{make_commits_link} and get tips for it. If your commit is accepted %{branch} by a project maintainer and there are bitcoins on its balance, you will get a tip!" + contribute_and_earn_branch: "to %{branch} branch" + make_commits_link: make commits + tell_us_bitcoin_address: "Just %{tell_us_link} your bitcoin address." + tell_us_link: tell us + sign_in: "Just check your email or %{sign_in_link}." + promote_project: Promote %{project} + embedding: Embedding + image_url: "Image URL:" + shield_title: tip for next commit + edit: + project_settings: "%{project} project settings" + branch: Branch + default_branch: Default branch + tipping_policies: Tipping policies + hold_tips: "Do not send the tips immediately. Give collaborators the ability to modify the tips before they're sent" + save: Save the project settings + disable_notifications: Don't notify new contributors + decide_tip_amounts: + commit: Commit + author: Author + message: Message + tip: Tip (relative to the project balance) + submit: Send the selected tip amounts + blacklisted: + title: Sorry, this project doesn't accept tips! + message: The author of this project has chosen to disallow tips for this project. + tips: + index: + tips: Tips + project_tips: '%{project} tips' + user_tips: "%{user} tips" + created_at: Created At + commiter: Commiter + project: Project + commit: Commit + amount: Amount + refunded: Refunded to project's deposit + undecided: The amount of the tip has not been decided yet + no_bitcoin_address: User didn't specify withdrawal address + below_threshold: "User's balance is below withdrawal threshold" + waiting: Waiting for withdrawal + error: (error sending transaction) + deposits: + index: + project_deposits: '%{project} deposits' + deposits: Deposits + created_at: Created At + project: Project + amount: Amount + transaction: Transaction + confirmed: Confirmed + confirmed_yes: 'Yes' + confirmed_no: 'No' + users: + index: + title: Top Contributors + name: Name + commits_count: Commits tipped + withdrawn: Withdrawn + show: + balance: Balance + threshold: "You will get your money when your balance hits the threshold of %{threshold}" + see_all: see all + received: "%{time} received %{amount} for commit %{commit} in %{project}" + bitcoin_address_placeholder: Your bitcoin address + notify: Notify me about new tips (no more than one email per month) + submit_user: Update user info + change_password: Change your password + submit_password: Change my password + use_from_gravatar: Use from your gravatar profile + withdrawals: + index: + title: Last Withdrawals + created_at: Created At + transaction: Transaction + result: Result + error: Error + success: Success + devise: + sessions: + new: + title: Sign in + remember_me: Remember me + submit: Sign in + registrations: + new: + title: Sign up + submit: Sign up + passwords: + new: + title: Forgot your password? + submit: Send me reset password instructions + edit: + title: Change your password + submit: Change my password + confirmations: + new: + title: Resend confirmation instructions + submit: Resend confirmation instructions + links: + sign_in: Sign in + sign_up: Sign up + recover: Forgot your password? + confirm: Didn't receive confirmation instructions? + sign_in_with: "Sign in with %{provider}" + errors: + primary_email: your primary email address should be verified. + onmiauth_info: we were unable to fetch your information. + activerecord: + attributes: + user: + email: E-mail + bitcoin_address: Bitcoin address + password: Password + password_confirmation: Password confirmation + display_name: Display name + omniauth_providers: + github: GitHub + bitbucket: BitBucket + general: + or: or + disclaimer: + line1: "Tip4Commit is not affiliated with most of the projects." + line2: "There is no guarantee that tips will be claimed by developers." + line3: "By donating the funds you agree that they can be sent to the Free Software Foundation or elsewhere at Tip4Commit's discretion." From 2569aa925abe3fc8724a9495ecb58c14f7f4bc83 Mon Sep 17 00:00:00 2001 From: FreakJoe Date: Tue, 27 Dec 2016 12:12:01 +0100 Subject: [PATCH 214/415] German localization finished --- config/locales/de.yml | 240 +++++++++++++++++++++--------------------- 1 file changed, 120 insertions(+), 120 deletions(-) diff --git a/config/locales/de.yml b/config/locales/de.yml index 6417b72a..278df0a0 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -71,163 +71,163 @@ en: projects: index: find_project: - placeholder: Enter GitHub project URL or any keyword to find it... - button: Find project + placeholder: Nutzen Sie die GitHub-URL eines Projektes oder geben Sie relevante Schlüsselwörter ein... + button: Projekt suchen repository: Repository - description: Description - watchers: Watchers - balance: Balance - forked_from: forked from - support: Support project + description: Beschreibung + watchers: Beobachter + balance: Vorhandene Geldmenge + forked_from: Abzweigung von + support: Projekt unterstützen show: - title: "Contribute to %{project}" - fetch_pending: (Pending initial fetch) - edit_project: Change project settings - decide_tip_amounts: Decide tip amounts - disabled_notifications: "Project maintainers have decided not to notify new contributors about tips and they probably don't like this way of funding." - fee: "%{percentage} of deposited funds will be used to tip for new commits." - balance: Balance - deposits: deposits - custom_tip_size: (each new commit receives a percentage of available balance) - default_tip_size: "(each new commit receives %{percentage} of available balance)" - min_tip_size: "Minimum tip size is set to %{min_tip}, but if available balance is less than that then it will be sent as a smaller tip" - unconfirmed_amount: "(%{amount} unconfirmed)" - tipping_policies: Tipping policies - updated_by_user: "(Last updated by %{name} on %{date})" - updated_by_unknown: "(Last updated on %{date})" - tips_paid: Tips Paid - unclaimed_amount: "(%{amount} of this is unclaimed, and will be refunded to the project after being unclaimed for 1 month.)" - last_tips: Last Tips - see_all: see all - received: "received %{amount}" - will_receive: will receive a tip - for_commit: for commit - when_decided: when its amount is decided - next_tip: Next Tip - contribute_and_earn: Contribute and Earn - contribute_and_earn_description: "Donate bitcoins to this project or %{make_commits_link} and get tips for it. If your commit is accepted %{branch} by a project maintainer and there are bitcoins on its balance, you will get a tip!" - contribute_and_earn_branch: "to %{branch} branch" - make_commits_link: make commits - tell_us_bitcoin_address: "Just %{tell_us_link} your bitcoin address." - tell_us_link: tell us - sign_in: "Just check your email or %{sign_in_link}." - promote_project: Promote %{project} - embedding: Embedding - image_url: "Image URL:" - shield_title: tip for next commit + title: "Tragen Sie etwas zum %{project} bei" + fetch_pending: (Erstes Laden ist im Gang) + edit_project: Projekteinstellungen verändern + decide_tip_amounts: Höhe des Trinkgeldes einstellen + disabled_notifications: "Die Projektleiter haben sich entschlossen, neue Mitarbeiter nicht über Trinkgelder zu informieren." + fee: "%{percentage} der vorhandenen Geldmenge wird pro Beitrag als Trinkgeld vergeben." + balance: Vorhandene Geldmenge + deposits: Spenden + custom_tip_size: (Jeder Beitrag erhält einen Anteil der vorhandenen Geldmenge) + default_tip_size: "Jeder neue Beitrag erhält %{percentage} der vorhandenen Geldmenge" + min_tip_size: "Die minimale Trinkgeldmenge liegt bei %{min_tip}. Sollte aber nicht ausreichend Geld vorhanden sein, wird die Menge heruntergesetzt." + unconfirmed_amount: "(%{amount} nicht bestätigt)" + tipping_policies: Trinkgeld-Regeln + updated_by_user: "(Letzer Beitrag von %{name} am %{date})" + updated_by_unknown: "(Letzter Beitrag am %{date})" + tips_paid: Ausgezahlte Trinkgelder + unclaimed_amount: "(%{amount} hiervon wurden noch nicht beansprucht und werden nach einem Monat an das Projekt zurückgegeben.)" + last_tips: Letzte Trinkgelder + see_all: Alle ansehen + received: "%{amount} erhalten" + will_receive: wird ein Tringeld erhalten + for_commit: für den commit + when_decided: wenn die Menge festgelegt wurde + next_tip: Nächstes Trinkgeld + contribute_and_earn: Tragen Sie etwas bei und verdienen Sie + contribute_and_earn_description: "Spenden Sie Bitcoin an dieses Projekte oder %{make_commits_link} um Trinkgelder zu erhalten. Falls ihr Beitrag %{branch} von einem Projektleiter akzeptiert wird, erhalten Sie falls möglich ein Trinkgeld." + contribute_and_earn_branch: "zur %{branch} branch" + make_commits_link: Beiträge machen + tell_us_bitcoin_address: "Sie sollten ihre Bitcoin-Adresse %{tell_us_link}" + tell_us_link: angeben + sign_in: "Überprüfen Sie ihr E-Mail Fach oder %{sign_in_link}." + promote_project: Fördern Sie %{project} + embedding: Eingebettete + image_url: "Bild-URL:" + shield_title: Zunächst auszuzahlendes Trinkgeld edit: - project_settings: "%{project} project settings" + project_settings: "%{project} Projekteinstellungen" branch: Branch - default_branch: Default branch - tipping_policies: Tipping policies - hold_tips: "Do not send the tips immediately. Give collaborators the ability to modify the tips before they're sent" - save: Save the project settings - disable_notifications: Don't notify new contributors + default_branch: Standard-Branch + tipping_policies: Trinkgeld-Regeln + hold_tips: "Zahlen Sie Trinkgelder nicht sofort. Geben Sie Mitarbeitern die Möglichkeit, Trinkgelder zu ändern bevor diese ausgezahlt werden." + save: Projekteinstellungen speichern + disable_notifications: Neue Mitarbeiter nicht informieren decide_tip_amounts: commit: Commit - author: Author - message: Message - tip: Tip (relative to the project balance) - submit: Send the selected tip amounts + author: Urheber + message: Nachricht + tip: Trinkgeld (in Relation zur vorhanden Geldmenge) + submit: Die ausgewählten Trinkgelder auszahlen blacklisted: - title: Sorry, this project doesn't accept tips! - message: The author of this project has chosen to disallow tips for this project. + title: Verzeihung, dieses Projekt akzeptiert keine Trinkgelder! + message: Der Leiter dieses Projekts hat sich entschieden, für diese Projekt keine Trinkgelder zu erlauben. tips: index: - tips: Tips - project_tips: '%{project} tips' - user_tips: "%{user} tips" - created_at: Created At - commiter: Commiter - project: Project + tips: Trinkgelder + project_tips: '%{project} Trinkgelder' + user_tips: "%{user} Trinkgelder" + created_at: Erstellt am + commiter: Mitareiter + project: Projekt commit: Commit - amount: Amount - refunded: Refunded to project's deposit - undecided: The amount of the tip has not been decided yet - no_bitcoin_address: User didn't specify withdrawal address - below_threshold: "User's balance is below withdrawal threshold" - waiting: Waiting for withdrawal - error: (error sending transaction) + amount: Menge + refunded: An das Projekt zurückgezahlt + undecided: Die Höhe des Trinkgeldes wurde noch nicht festgelegt + no_bitcoin_address: Der Nutzer hat keine Bitcoin-Adresse angegeben + below_threshold: "Der Kontostand des Nutzers liegt unter der benötigten Menge" + waiting: Auf Abheben warten + error: (bei der Übertragung kam es zu einem Fehler) deposits: index: - project_deposits: '%{project} deposits' - deposits: Deposits - created_at: Created At - project: Project - amount: Amount - transaction: Transaction - confirmed: Confirmed - confirmed_yes: 'Yes' - confirmed_no: 'No' + project_deposits: '%{project} Spenden' + deposits: Spenden + created_at: Erstellt am + project: Projekt + amount: Menge + transaction: Transaktion + confirmed: Bestätigt + confirmed_yes: 'Ja' + confirmed_no: 'Nein' users: index: - title: Top Contributors + title: Top-Mitarbeiter name: Name - commits_count: Commits tipped - withdrawn: Withdrawn + commits_count: Bezahlte Beiträge + withdrawn: Abgehoben show: - balance: Balance - threshold: "You will get your money when your balance hits the threshold of %{threshold}" - see_all: see all - received: "%{time} received %{amount} for commit %{commit} in %{project}" - bitcoin_address_placeholder: Your bitcoin address - notify: Notify me about new tips (no more than one email per month) - submit_user: Update user info - change_password: Change your password - submit_password: Change my password - use_from_gravatar: Use from your gravatar profile + balance: Vorhandene Geldmenge + threshold: "Ihr Geld wird ausbezahlt sobald die Grenzmenge von %{threshold} erreicht wird" + see_all: alle ansehen + received: "%{time} hat %{amount} für seinen %{commit} im %{project} erhalten" + bitcoin_address_placeholder: Ihre Bitcoin-Adresse + notify: Informieren Sie mich (mit nicht mehr als einer E-Mail pro Monat) über neue Trinkgelder + submit_user: Nutzerinformationen aktualisieren + change_password: Passwort ändern + submit_password: Passwort ändern + use_from_gravatar: Von Ihrem Gravatarprofil aus nutzen withdrawals: index: - title: Last Withdrawals - created_at: Created At - transaction: Transaction - result: Result - error: Error - success: Success + title: Letzte Abhebungen + created_at: Erstellt am + transaction: Transaktion + result: Ergebnis + error: Fehler + success: Erfolg devise: sessions: new: - title: Sign in - remember_me: Remember me - submit: Sign in + title: Anmelden + remember_me: An mich erinnern + submit: Anmelden registrations: new: - title: Sign up - submit: Sign up + title: Registrieren + submit: Registrieren passwords: new: - title: Forgot your password? - submit: Send me reset password instructions + title: Passwort vergessen? + submit: Passwort zurücksetzen edit: - title: Change your password - submit: Change my password + title: Passwort ändern + submit: Passwort ändern confirmations: new: - title: Resend confirmation instructions - submit: Resend confirmation instructions + title: Bestätigung erneut versenden + submit: Bestätigung erneut versenden links: - sign_in: Sign in - sign_up: Sign up - recover: Forgot your password? - confirm: Didn't receive confirmation instructions? - sign_in_with: "Sign in with %{provider}" + sign_in: Anmelden + sign_up: Registrieren + recover: Passwort vergessen? + confirm: Bestätigung nicht erhalten? + sign_in_with: "Mit %{provider} einloggen" errors: - primary_email: your primary email address should be verified. - onmiauth_info: we were unable to fetch your information. + primary_email: Ihre primäre E-Mail Adresse konnte nicht bestätigt werden. + onmiauth_info: Wir konnten ihre Informationen nicht entnehmen. activerecord: attributes: user: email: E-mail - bitcoin_address: Bitcoin address - password: Password - password_confirmation: Password confirmation - display_name: Display name + bitcoin_address: Bitcoin-Adresse + password: Passwort + password_confirmation: Passwort-Bestätigung + display_name: Anzeigename omniauth_providers: github: GitHub bitbucket: BitBucket general: or: or disclaimer: - line1: "Tip4Commit is not affiliated with most of the projects." - line2: "There is no guarantee that tips will be claimed by developers." - line3: "By donating the funds you agree that they can be sent to the Free Software Foundation or elsewhere at Tip4Commit's discretion." + line1: "Tip4Commit ist mit den meisten Projekten in keiner Weise verbunden." + line2: "Es gibt keine Garantie, dass Entwickler Trinkgelder erhalten werden." + line3: "Durch Spenden akzeptieren Sie, dass ihre Spenden nach Belieben an die Free Software Foundation oder sonstige weitergeleitet werden können." From 641e0625b1150c9fb6b3af87e56a0abe43c1e48d Mon Sep 17 00:00:00 2001 From: FreakJoe Date: Tue, 27 Dec 2016 12:58:04 +0100 Subject: [PATCH 215/415] Fixed file header --- config/locales/de.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/de.yml b/config/locales/de.yml index 278df0a0..b2ea2e77 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -1,4 +1,4 @@ -en: +de: tip4commit: Tip4Commit meta: title: Tragen Sie zu Open-Source-Projekten bei From 4eb3587e962680106c16710e4df4f5f5ced0dc31 Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Sun, 8 Jan 2017 04:44:49 +0800 Subject: [PATCH 216/415] Optimize png imagess losslessly via zopflipng --- app/assets/images/flags/de.png | Bin 545 -> 353 bytes app/assets/images/flags/en.png | Bin 599 -> 526 bytes app/assets/images/flags/fr.png | Bin 545 -> 361 bytes app/assets/images/flags/hr.png | Bin 524 -> 368 bytes app/assets/images/flags/nl.png | Bin 453 -> 298 bytes app/assets/images/flags/pl.png | Bin 288 -> 182 bytes app/assets/images/flags/ru.png | Bin 420 -> 281 bytes 7 files changed, 0 insertions(+), 0 deletions(-) diff --git a/app/assets/images/flags/de.png b/app/assets/images/flags/de.png index ac4a977362738ca7daa20784717f10f9617136b4..934428bdb5f620c4502fa5cd17e0ce370c4396f5 100755 GIT binary patch delta 327 zcmV-N0l5C51mOaZBYy!XNklc*IhD1v6*wM!bLj zX6*YOz_;%|xLK~1Xv${;5#jsr(MQnCS-J^TXQDNdDSs2uCXM4P%%5-r1COm; zjks!7s%RHS01^|R_Kg>oX$>m75 zwxFB)uwcNh1LvxStjIJnmQ8sr6k$b8>a|Wj@(&kKXR;2`MMhDBUc!?IjQziQ3HAOjy7#Xx?g=Dg1KNxPY9D$*26R9u8%#Y?fC0Z0 Z{{c84hhdZ6e-Z!y002ovPDHLkV1k+Rkb3|C delta 521 zcmV+k0`~pk0-*$uBYyw{XF*Lt006JZHwB960000PbVXQnQ*UN;cVTj606}DLVr3vn zZDD6+Qe|Oed2z{QJOBUzvq?ljRCwBA^zm_K`1_sV-#-RsmS2DV{rdgq|G(c14F4E# z0Du5u`ThHQadA12^$!gG{{8d!FNFL91;2m)`3t6g|6aFlHGe<=u`n?)0ac$kc?l!| z7XAeUKS2-ELioQU%x;)e*Od^pswFPe*F6R1E}Hm z_a8w05`TbBWdI03VjSE60D?deiu!{0v$gMo}6 zKY*&C+JLHm{rn454HW{NK{5QFkAdk2!#`j^Ff;u91!Ax=G5q_%z`)G#?H2<;fB^t^bco3qtzTFG0000< LMNUMnLIPldgkbrK diff --git a/app/assets/images/flags/en.png b/app/assets/images/flags/en.png index ff701e19f6d2c0658fb23b1d94124cba4ce60851..b1f517e194cd23fadd61a4061d2568e5f88bdb0e 100644 GIT binary patch delta 501 zcmVe< z9E#Za$m>t`mSMS9KDh6_gW|I5mSa?0p5C5Yx;w99u;_^S!u^)hwi<4}W%YH{i7VgS z$X`uwFw&M1VvT|2n@*pD>}zYOE9zY0sTPvEz2Kpkz} z3L7>8(y>F3nHdD#XDhrJ>Q6kj){b?adH@VZ9<`j$5T0j5pk<0sbLMHNDD!5QaXVVTPPx7?n858QIV zDlEK^w4ki$6L?3 zW6XyPql1PZ>d7+N^`r2PTq)@}W^tZo=s`S4QkjBU5dCv<2f0El8x zPsN~axY>I^hpjtwT?S3-{PpW0pBqPZO;cR{?%3o1AA^1~{9P#H6 r?99f^c}%20>C~tFr6-##FMX&6pO0yX0w!}x00000NkvXXu0mjft=tDU delta 575 zcmV-F0>J%_1lI(RBYyxHbVXQnQ*UN;cVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBUz z`AI}URCwBAoHTQvnvLG!L$_YOVPIhR`}g19iWuE1ZBzdL{i|D>U(k2*|8J(R-+sud zaynhucHbwAMTnor{mwqO^w7JHzaBsT{O^B8RYf5+LvDs&KY#x#3VE8z{{HjVMqAkQ z&`gFkU6Zz6XWDn?`(6nb#^ozi9-NHzS9$*YCnF;R!^OJ{m+k-=kKX=IXT76$cm-o= z^MbWEJDW~00p0QR`TP1edXN4p{cUcj%+vykFns^a@clcG?!G^r+s)=?V3L#9iYqrh z{rLHl;pW}9|9}4dM+c#y|NZ>X#DL1qTzkoKxn+Wy5jVrdI}E>nGyM7mC4rJZfBtcB z`2XwIzu&+A0Y(1)Wzmq{dFBfa8*FX=m{~x~1>(Pd|Ni;==l7pKC$GL>N^3mYH}67p z`p&D@J}|s{`zs{@==A?zzXNRmd4}QtGiRqmb9Ttc&3}tb*=%mt%=F{OA8}!}r8C{- z*Ytm!J16ywi{QJWc6RR5SukoX!@{)aQ z<2Q35p1=S9GcamOGipiz9V4qQ6cfMZu%@l(oH?1N>$4MWS)RXsJIyU^y{i4Wr3Zii z`Tpnc-#ElD)osT={QvXE{ra1g8}~B&`@4GUArU#j%I>aPmD2$N3;+$pK?>zdet`f0 N002ovPDHLkV1g1aIi3Ij diff --git a/app/assets/images/flags/fr.png b/app/assets/images/flags/fr.png index 8332c4ec23c853944c29b02d7b32a88033f48a71..3398f79d1cadd1b57ec8c927e80732e9ebc65174 100644 GIT binary patch delta 335 zcmV-V0kHm|1nB~hBYy!fNkl?VUX7@eZT{3d)0z{#=swhDSdDJtc^p}TkE zLMbH_Qk*}3I3n^fLQ+Kh|Kvr$WftyVA3RD!iL$xlWGc3|w|`?n(ugN{_us!D6<@!8{SO8}HqdyWJ$%oe{QLFu|F546!XiLR z00NLW1~~wLFbGTd|AXCh)h6CJv_PD(TYBKkO(HG&gBrc4V(YY*o&aL`^XDH>>EFLV z^dHCsDgr6}2Y+!6$ZbH?K;!@Y`px+3*DnSJfB+PaK@I>g2*NP<{|BRSgFB_r(q0TV z#`cj+7-+jQssfDsq1+980mK4S4|K`zzd-UIP~<-n0D1sK{rdSA=;L3%nZPyx1Q5%Q zUw=TZ|ML%|2Z;YcT?14NVS`lz{qUOs7*-4n00G4Evpwi#J z8UOqRh7v#kv3vu1;?F-WPG%tQ&mSg8_(0;35e%5cC4q)90{!foBYy!mNklAWUgUxs;r#%Bub6ojc8=j{Njl%zQe# zZQ5}iM14;kjB`5|F_$b$=hJ`z@WSY3wL6;~y}IT^>u;woEPp-M`fJYr+|8J-dZ0PX zQcCd)h2njD^M;!?@z^o0UX4eOissE35Vw8*UPyoe#>tHv8E&3E3)X@NfTF(Jar`(} zt#UUPFD5|N=m3(;czI~S(9d80WuqFh;m60@|4`Xj5kLU3fF!G{fyDoR{}_Q36Vv~H z|Ns5{^Z)NZrr*Dqe*gae=g)r_`DNuwfB*t(VEF(4$y0{Ee}91pC|VlY^GE*wpF98m zDEymTk@)}jum8V(0mT_*Wq~#T1P~M0?Ei4pzyJR2T9n<(@o~c3l*t?)e*gXnQvD06 z2dDucfPl*W{sRLb#^cA20Ro7TA^dQAywcMTKY#!I|L5<&-+%voetcuu`Z}PCeZ1<~ zBsG8{fByaZ^Y_23Ap44}0{{WU!tm=4kpCN`6smz)Ol&nOWf_pc3g-U)^Y71ppcF8i zfpPW^Ab@}xfCl^*;b8@;26_h=5I_fFxK0Kmai^xb9^5^N-=jAD~r0 p%^>mzi~&S{!0f;9h-Lr?FaS86b|o_*@dkVE|G+UYR|Vi^FomkqpmZuom*TjHhrV7}u0;WTdk?Bmb0Jh*7%ZOY zl0Az{PD29*)S_$L2S?D*TDr-&piTydBf%tkx(rAc7Z+`9ZGQmV9YH@KrL?}jUNN)i z4#0l{K(b>0?2bBsgt5h`g^A6h8=+AxQ$uPnW7Q2^cH~Hw|zSPQq zWl^DK+N&mwX01(iz-cXV>Feug5*p)(1e2kuG*>k>Q;nB^IUon~%?baVwijJ_1jd7J VXS{)xE&u=k00>D%PDHLkV1l?WefR(X delta 427 zcmV;c0aX5~0>uN6B!2{FK}|sb0I$e51&Zka000?uMObuGZ)S9NVRB^vL1b@YWgtmy zVP|DhWnpA_ami&o00043Nkl#?55wQzKoX38 z|NjLffBpXj6#2y{D-E;(Ab?mHL=FGT$TP6>fK>na1GWK({(upf0nrSU5*Gz(00V_^6NMkIfb7=MsN{(z$xLNWma7yxU^ VXMno<7100y002ovPDHLkV1j4T#zg=C diff --git a/app/assets/images/flags/pl.png b/app/assets/images/flags/pl.png index cca0e7dd46fd4254f58e7270800db7f4a1486b39..939f9d518edf579a54640fc6bbe291fc4687d168 100644 GIT binary patch delta 165 zcmV;W09yZ`0=5B=8Gix*008-bnr;990DVbBK~#7F&5gAc15peF_ZVWga{U)!=E%&< zS~HWvn~#EdGG;U4j)2n1 delta 272 zcmdnSxPWPbWIY=L14G#(UP~awlJ4m1$iT4vggI;1OCX=Kz$3Dlfr0M`2s2LA=92~r zN|v}rlmzFem6RtIr7}3CbhE}ouhwnuK2 zSL_UG-nEUb?z7R!onpltj>bw^?|v&vRjkvRFF)-;x!SkUYqidQpvee#zBpZOi;{w4c<{CE#; zcun>78M0tz&T7>xZgImbMRq!GuC-f`uAq?#K6ckX3LX|NRSO0LlM<{-BURBqYRGSojejfLOL~|EH_V_~;P>Nc100M{w7(GnC|1d~O0_A|B3}9z5g4iIRfk+?%h8-9I6$1ni o<5!@&kPrhZ7flKX00ImEKZ#`?*f?Pp00000NkvXXt^-0~f)X{V7XSbN From f49a6dd8746188d8ba2c127ef6bc96a8e1646c0f Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Sun, 8 Jan 2017 04:47:56 +0800 Subject: [PATCH 217/415] Migrate Travis CI to Container-Based Infrastructure --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 6b5f83b2..52ba7430 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,7 @@ language: ruby +sudo: false + rvm: - 2.2.4 From 6dae5bd21b7cc644913714eb8e68d5b533d2ccdd Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Sun, 8 Jan 2017 04:49:57 +0800 Subject: [PATCH 218/415] Set Travis CI git clone depth to 10 --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 52ba7430..0f0047ca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,9 @@ language: ruby sudo: false +git: + depth: 10 + rvm: - 2.2.4 From ea69a571a2f00e5a2416d44655c7563fff2a1cf6 Mon Sep 17 00:00:00 2001 From: Thibaut Broggi Date: Sun, 19 Feb 2017 00:08:21 +0000 Subject: [PATCH 219/415] Complete and correct french translation --- config/locales/fr.yml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 75b80695..dc43680d 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -16,11 +16,13 @@ fr: sign_in: Se connecter sign_in_imp: se connecter sign_out: Se déconnecter + create_issue: Créer une issue errors: project_not_found: Projet non trouvé. + opt_in_notice: "En raison de plaintes de la part des mainteneurs de projets nous n'ajoutons plus automatiquement de projet. Les projets sans dépôts déjà existants ont été supprimés. Si vous voulez ajouter un projet, s'il vous plaît %{create_issue_link}." access_denied: Accès refusé can_assign_more_tips: "Vous ne pouvez pas attribuer plus de 100% de vos fonds disponibles." - wrong_bitcoin_address: Echec de mise à jour de l'adresse bitcoin + wrong_bitcoin_address: Échec de mise à jour de l'adresse bitcoin user_not_found: Utilisateur non trouvé access_denied: "Vous n'avez pas le droit d'effectuer cette action !" notices: @@ -35,16 +37,16 @@ fr: small: "Petit : 0.5%" normal: "Normal : 1%" big: "Grand : 2%" - huge: "Géant : 5%" + huge: "Énorme : 5%" js: errors: value: invalid: Valeur non valide email: invalid: Adresse Email non valide - blank: L'Email est requis et doit être renseigné + blank: L'adresse Email est requise et doit être renseignée password: - blank: Les mot de passe est requis et doit être renseigné + blank: Le mot de passe est requis et doit être renseigné invalid: Le mot de passe et sa confirmation ne sont pas identiques password_confirmation: blank: La confirmation du mot de passe est requise et doit être renseignée @@ -88,6 +90,7 @@ fr: deposits: dépôts custom_tip_size: (chaque nouvelle contribution reçoit un pourcentage des fonds disponibles) default_tip_size: "(chaque contribution reçoit %{percentage} des fonds disponsibles)" + min_tipe_size: "La taille minimum de pourboire a été définie à %{min_tip}, mais si les fonds sont inférieurs, un pouboire plus faible sera envoyé." unconfirmed_amount: "(%{amount} non confirmé)" tipping_policies: Politique des pourboires updated_by_user: "(Dernière mise à jour par %{name} le %{date})" @@ -126,6 +129,9 @@ fr: message: Message tip: Pourboire (en fonction des fonds du projet) submit: Envoyer les pourboires + blacklisted: + title: "Désolé, ce projet n'accepte pas de pouboire !" + message: "L'auteur de ce projet a décidé de désactiver les pourboires pour ce projet." tips: index: tips: Pourboires @@ -169,6 +175,7 @@ fr: submit_user: Mettre à jour change_password: Modifier votre mot de passe submit_password: Modifier mon mot de passe + use_from_gravatar: Utiliser votre profil gravatar withdrawals: index: title: Derniers Retraits @@ -220,3 +227,7 @@ fr: bitbucket: BitBucket general: or: ou + disclaimer: + line1: "Tip4Commit n'est pas affilié avec la plupart des projets." + line2: "Il n'y a aucune garantie que les pourboires seront réclamés par les dévelopeurs." + line3: "En donnant des fonds vous acceptez qu'ils puissent être envoyés à la Free Software Foundation ou ailleurs, à la discrétion de Tip4Commit." From 14d8cf0106de63ec7c712d3cb386ce3eee350e5f Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Wed, 8 Mar 2017 18:20:28 +0300 Subject: [PATCH 220/415] refactored bitcoin_tipper --- lib/bitcoin_tipper.rb | 109 +++++++++++++++++++++++++----------------- 1 file changed, 65 insertions(+), 44 deletions(-) diff --git a/lib/bitcoin_tipper.rb b/lib/bitcoin_tipper.rb index 88478e28..80230581 100644 --- a/lib/bitcoin_tipper.rb +++ b/lib/bitcoin_tipper.rb @@ -1,28 +1,22 @@ class BitcoinTipper - def self.work_forever - while true do - self.work - end - end - - def self.work withdraw = true - Rails.logger.info "Traversing projects..." - Project.find_each do |project| - if project.available_amount > 0 - Rails.logger.info " Project #{project.id} #{project.full_name}" - project.tip_commits + class << self + def work_forever + loop do + work end end - Rails.logger.info "Updating projects info..." - Project.order(:info_updated_at => :desc).last(10).each do |project| - Rails.logger.info " Project #{project.id} #{project.full_name}" - project.update_info - project.touch(:info_updated_at) + def work(withdraw = true) + create_tips + update_projects_info + check_and_withdrawal_funds if withdraw + auto_decide_older_tips + refund_unclaimed_tips + update_cache end - if withdraw - Rails.logger.info "Traversing users..." + def check_and_withdrawal_funds + Rails.logger.info 'Traversing users...' users_waiting_for_withdrawal = 0 User.find_each do |user| if user.ready_for_withdrawal? @@ -35,41 +29,68 @@ def self.work withdraw = true # self.create_sendmany # end - Rails.logger.info "Traversing sendmanies..." - Sendmany.where(txid: nil).each do |sendmany| - sendmany.send_transaction + Rails.logger.info 'Traversing sendmanies...' + Sendmany.where(txid: nil).each(&:send_transaction) + end + + def auto_decide_older_tips + Rails.logger.info 'Auto-deciding older tips...' + Tip.auto_decide_older_tips + end + + def refund_unclaimed_tips + Rails.logger.info 'Refunding unclaimed tips...' + Tip.refund_unclaimed + end + + def create_tips + Rails.logger.info 'Traversing projects...' + Project.find_each do |project| + if project.available_amount > 0 + Rails.logger.info " Project #{project.id} #{project.full_name}" + project.tip_commits + end end end - Rails.logger.info "Auto-deciding older tips..." - Tip.auto_decide_older_tips + def update_projects_info + Rails.logger.info 'Updating projects info...' + Project.order(info_updated_at: :desc).last(10).each do |project| + Rails.logger.info " Project #{project.id} #{project.full_name}" + project.update_info + project.touch(:info_updated_at) + end + end - Rails.logger.info "Refunding unclaimed tips..." - Tip.refund_unclaimed + def update_cache + Rails.logger.info 'Updating projects cache...' + Project.update_cache - Rails.logger.info "Updating projects cache..." - Project.update_cache + Rails.logger.info 'Updating users cache...' + User.update_cache + end - Rails.logger.info "Updating users cache..." - User.update_cache - end + def create_sendmany + Rails.logger.info 'Creating sendmany' + ActiveRecord::Base.transaction do + sendmany = Sendmany.create + outs = calculate_outputs + sendmany.update_attribute :data, outs.to_json + Rails.logger.info " #{sendmany.inspect}" + end + end - def self.create_sendmany - Rails.logger.info "Creating sendmany" - ActiveRecord::Base.transaction do - sendmany = Sendmany.create - outs = {} + def calculate_outputs + outputs = {} User.find_each do |user| - if user.ready_for_withdrawal? - user.tips.decided.unpaid.each do |tip| - tip.update_attribute :sendmany_id, sendmany.id - outs[user.bitcoin_address] = outs[user.bitcoin_address].to_i + tip.amount - end + next unless user.ready_for_withdrawal? + user.tips.decided.unpaid.each do |tip| + tip.update_attribute :sendmany_id, sendmany.id + outputs[user.bitcoin_address] ||= 0 + outputs[user.bitcoin_address] += tip.amount end end - sendmany.update_attribute :data, outs.to_json - Rails.logger.info " #{sendmany.inspect}" + outputs end end - end From 27bdaafda178dacb00f996cbf0a93662bf1c8c91 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Wed, 8 Mar 2017 18:20:49 +0300 Subject: [PATCH 221/415] upgraded rspec --- Gemfile | 2 +- Gemfile.lock | 69 +++++++++++++++++++++++++++------------------------- 2 files changed, 37 insertions(+), 34 deletions(-) diff --git a/Gemfile b/Gemfile index 29a98779..dc60a90b 100644 --- a/Gemfile +++ b/Gemfile @@ -54,7 +54,7 @@ end group :development, :test do gem 'sqlite3', '~> 1.3.11' gem 'factory_girl_rails', '~> 4.3.0' - gem 'rspec-rails', '~> 3.3.0' + gem 'rspec-rails', '~> 3.5.0' end group :test do diff --git a/Gemfile.lock b/Gemfile.lock index a9624863..c84bd955 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -92,7 +92,7 @@ GEM multi_json arel (6.0.3) bcrypt (3.1.10) - builder (3.2.2) + builder (3.2.3) byebug (3.5.1) columnize (~> 0.8) debugger-linecache (~> 1.2) @@ -146,7 +146,7 @@ GEM thread_safe (~> 0.1) warden (~> 1.2.3) devise-i18n (0.11.0) - diff-lcs (1.2.5) + diff-lcs (1.3) domain_name (0.5.25) unf (>= 0.0.5, < 1.0.0) dusen (0.4.10) @@ -182,7 +182,7 @@ GEM domain_name (~> 0.5) http_accept_language (2.0.2) httpauth (0.2.1) - i18n (0.7.0) + i18n (0.8.1) i18n-js (2.1.2) i18n jbuilder (1.5.3) @@ -194,7 +194,7 @@ GEM jquery-turbolinks (2.0.1) railties (>= 3.1.0) turbolinks - json (1.8.3) + json (1.8.6) jwt (0.1.11) multi_json (>= 1.5) kaminari (0.15.0) @@ -214,8 +214,8 @@ GEM mail (2.6.3) mime-types (>= 1.16, < 3) mime-types (2.6.2) - mini_portile (0.6.2) - minitest (5.8.2) + mini_portile2 (2.1.0) + minitest (5.10.1) money-tree (0.9.0) ffi multi_json (1.11.2) @@ -226,8 +226,8 @@ GEM net-ssh (>= 2.6.5) net-ssh (2.7.0) netrc (0.11.0) - nokogiri (1.6.6.2) - mini_portile (~> 0.6.0) + nokogiri (1.7.0.1) + mini_portile2 (~> 2.1.0) oauth2 (0.8.1) faraday (~> 0.8) httpauth (~> 0.1) @@ -243,7 +243,7 @@ GEM oauth2 (~> 0.8.0) omniauth (~> 1.0) orm_adapter (0.5.0) - rack (1.6.4) + rack (1.6.5) rack-test (0.6.3) rack (>= 1.0) rails (4.2.4) @@ -259,11 +259,11 @@ GEM sprockets-rails rails-deprecated_sanitizer (1.0.3) activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.7) + rails-dom-testing (1.0.8) activesupport (>= 4.2.0.beta, < 5.0) - nokogiri (~> 1.6.0) + nokogiri (~> 1.6) rails-deprecated_sanitizer (>= 1.0.1) - rails-html-sanitizer (1.0.2) + rails-html-sanitizer (1.0.3) loofah (~> 2.0) rails-i18n (4.0.3) i18n (~> 0.6) @@ -273,7 +273,7 @@ GEM activesupport (= 4.2.4) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (10.4.2) + rake (12.0.0) rdoc (4.1.1) json (~> 1.4) ref (2.0.0) @@ -285,27 +285,27 @@ GEM http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 3.0) netrc (~> 0.7) - rspec-activemodel-mocks (1.0.2) + rspec-activemodel-mocks (1.0.3) activemodel (>= 3.0) activesupport (>= 3.0) rspec-mocks (>= 2.99, < 4.0) - rspec-core (3.3.2) - rspec-support (~> 3.3.0) - rspec-expectations (3.3.1) + rspec-core (3.5.4) + rspec-support (~> 3.5.0) + rspec-expectations (3.5.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.3.0) - rspec-mocks (3.3.2) + rspec-support (~> 3.5.0) + rspec-mocks (3.5.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.3.0) - rspec-rails (3.3.3) - actionpack (>= 3.0, < 4.3) - activesupport (>= 3.0, < 4.3) - railties (>= 3.0, < 4.3) - rspec-core (~> 3.3.0) - rspec-expectations (~> 3.3.0) - rspec-mocks (~> 3.3.0) - rspec-support (~> 3.3.0) - rspec-support (3.3.0) + rspec-support (~> 3.5.0) + rspec-rails (3.5.2) + actionpack (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) + rspec-core (~> 3.5.0) + rspec-expectations (~> 3.5.0) + rspec-mocks (~> 3.5.0) + rspec-support (~> 3.5.0) + rspec-support (3.5.0) sass (3.2.13) sass-rails (4.0.1) railties (>= 4.0.0, < 5.0) @@ -343,8 +343,8 @@ GEM therubyracer (0.12.2) libv8 (~> 3.16.14.0) ref - thor (0.19.1) - thread_safe (0.3.5) + thor (0.19.4) + thread_safe (0.3.6) tilt (1.4.1) tins (0.13.1) turbolinks (2.5.3) @@ -403,7 +403,7 @@ DEPENDENCIES render_csv rest-client rspec-activemodel-mocks - rspec-rails (~> 3.3.0) + rspec-rails (~> 3.5.0) sass-rails (~> 4.0.0) sawyer (~> 0.5.2) sdoc @@ -416,5 +416,8 @@ DEPENDENCIES twitter_bootstrap_form_for! uglifier (>= 1.3.0) +RUBY VERSION + ruby 2.2.4p230 + BUNDLED WITH - 1.11.2 + 1.12.4 From 3b4dd8a5392b10d46741173e1d2c1d3a21e49688 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Wed, 8 Mar 2017 18:21:13 +0300 Subject: [PATCH 222/415] removed blockchain.info api 2 support --- app/models/project.rb | 7 ------- config/config.yml.sample | 3 --- lib/wallet.rb | 25 ------------------------- 3 files changed, 35 deletions(-) delete mode 100644 lib/wallet.rb diff --git a/app/models/project.rb b/app/models/project.rb index b07de0c7..7a9e567d 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -263,11 +263,4 @@ def unarchive_address! return nil end end - - # Receiving API v2 - def generate_address2 - new_address = Wallet.generate_address_and_register_callback - Rails.logger.info "Generated: #{new_address.inspect}" - self.update bitcoin_address2: new_address['address'] - end end diff --git a/config/config.yml.sample b/config/config.yml.sample index b187aa50..2a36e62b 100644 --- a/config/config.yml.sample +++ b/config/config.yml.sample @@ -20,9 +20,6 @@ bitcoind: rpc_connection_string: https://user:password@rpc.blockchain.info:443 account: 1M4bS4gPyA6Kb8w7aXsgth9oUZWcRk73tQ -wallet: - xpub: xpub11111111111111 - devise: secret: "111111111111" diff --git a/lib/wallet.rb b/lib/wallet.rb deleted file mode 100644 index a7e4bbab..00000000 --- a/lib/wallet.rb +++ /dev/null @@ -1,25 +0,0 @@ -class Wallet - - # @return Hash - {"address"=>"1VhXRDrsBnmqgLzkAizb2RTDWNLqQDaiz", "index"=>0, "callback"=>"https://b27d33dc.ngrok.io/blockchain_info_callback_v2"} - class << self - def generate_address_and_register_callback - callback_url = 'https://'+CONFIG['app_host']+'/blockchain_info_callback_v2/'+CONFIG['blockchain_info']['callback_secret2'] - params = { - xpub: CONFIG['wallet']['xpub'], - callback: callback_url, - key: CONFIG['blockchain_info']['api_key'] - } - response = RestClient.get "https://api.blockchain.info/v2/receive", params: params - return JSON.parse(response) - rescue RestClient::BadRequest => e - return e - end - end - - # Callback response example - # - # GET /blockchain_info_callback_v2?address=1VhXRDrsBnmqgLzkAizb2RTDWNLqQDaiz&transaction_hash=6b3653774e7d71b8b802dc39cc885027eae8e4f1488fcdc39c72bcdcd2abbc67&value=100000&confirmations=0 - # User-Agent: Blockchain.info Receive Payments Callback Client - - -end From c4fe2da1ec82651d531b7e61c6bc4e09dfb28bcc Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Wed, 8 Mar 2017 19:48:34 +0300 Subject: [PATCH 223/415] hd wallet support --- app/models/project.rb | 13 +++++++++- app/models/wallet.rb | 21 ++++++++++++++++ db/migrate/20170308152313_create_wallets.rb | 11 +++++++++ ...0170308161814_add_wallet_id_to_projects.rb | 5 ++++ ...163825_add_legacy_addresses_to_projects.rb | 5 ++++ db/schema.rb | 12 +++++++++- spec/factories/project.rb | 1 - spec/factories/wallets.rb | 7 ++++++ spec/models/deposit_spec.rb | 4 ++-- spec/models/project_spec.rb | 24 ++++++++++++++++++- spec/models/user_spec.rb | 2 +- spec/models/wallet_spec.rb | 21 ++++++++++++++++ 12 files changed, 119 insertions(+), 7 deletions(-) create mode 100644 app/models/wallet.rb create mode 100644 db/migrate/20170308152313_create_wallets.rb create mode 100644 db/migrate/20170308161814_add_wallet_id_to_projects.rb create mode 100644 db/migrate/20170308163825_add_legacy_addresses_to_projects.rb create mode 100644 spec/factories/wallets.rb create mode 100644 spec/models/wallet_spec.rb diff --git a/app/models/project.rb b/app/models/project.rb index 7a9e567d..2ffb8160 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1,7 +1,8 @@ class Project < ActiveRecord::Base acts_as_paranoid - has_many :deposits # todo: only confirmed deposits + belongs_to :wallet + has_many :deposits # TODO: only confirmed deposits has_many :tips, inverse_of: :project accepts_nested_attributes_for :tips has_many :collaborators, autosave: true @@ -19,6 +20,8 @@ class Project < ActiveRecord::Base end end + after_create :generate_bitcoin_address + # before_save :check_tips_to_pay_against_avaiable_amount def update_bitcoin_address @@ -263,4 +266,12 @@ def unarchive_address! return nil end end + + def generate_bitcoin_address + wallet = Wallet.order(created_at: :asc).last + return unless wallet + self.wallet = wallet + self.bitcoin_address = wallet.generate_address + save + end end diff --git a/app/models/wallet.rb b/app/models/wallet.rb new file mode 100644 index 00000000..31eb4fb5 --- /dev/null +++ b/app/models/wallet.rb @@ -0,0 +1,21 @@ +class Wallet < ActiveRecord::Base + + validates :name, :xpub, presence: true + + def generate_address + address = hd_wallet.node_for_path("0/#{last_address_index}.pub").to_address + self.last_address_index += 1 + save + address + end + + def address_by_index(index) + hd_wallet.node_for_path("0/#{index}.pub").to_address + end + + private + + def hd_wallet + MoneyTree::Node.from_bip32(xpub) + end +end diff --git a/db/migrate/20170308152313_create_wallets.rb b/db/migrate/20170308152313_create_wallets.rb new file mode 100644 index 00000000..9f349ec3 --- /dev/null +++ b/db/migrate/20170308152313_create_wallets.rb @@ -0,0 +1,11 @@ +class CreateWallets < ActiveRecord::Migration + def change + create_table :wallets do |t| + t.string :name + t.string :xpub + t.integer :last_address_index, default: 1, limit: 4 + + t.timestamps null: false + end + end +end diff --git a/db/migrate/20170308161814_add_wallet_id_to_projects.rb b/db/migrate/20170308161814_add_wallet_id_to_projects.rb new file mode 100644 index 00000000..8e3f71dc --- /dev/null +++ b/db/migrate/20170308161814_add_wallet_id_to_projects.rb @@ -0,0 +1,5 @@ +class AddWalletIdToProjects < ActiveRecord::Migration + def change + add_column :projects, :wallet_id, :integer + end +end diff --git a/db/migrate/20170308163825_add_legacy_addresses_to_projects.rb b/db/migrate/20170308163825_add_legacy_addresses_to_projects.rb new file mode 100644 index 00000000..008f11b9 --- /dev/null +++ b/db/migrate/20170308163825_add_legacy_addresses_to_projects.rb @@ -0,0 +1,5 @@ +class AddLegacyAddressesToProjects < ActiveRecord::Migration + def change + add_column :projects, :legacy_address, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 6d9ea3a3..43f56a9d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20151219081507) do +ActiveRecord::Schema.define(version: 20170308163825) do create_table "collaborators", force: :cascade do |t| t.integer "project_id" @@ -56,6 +56,8 @@ t.string "avatar_url", limit: 255 t.datetime "deleted_at" t.string "bitcoin_address2" + t.integer "wallet_id" + t.string "legacy_address" end add_index "projects", ["full_name"], name: "index_projects_on_full_name", unique: true @@ -131,4 +133,12 @@ add_index "users", ["email"], name: "index_users_on_email", unique: true add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true + create_table "wallets", force: :cascade do |t| + t.string "name" + t.string "xpub" + t.integer "last_address_index", limit: 4, default: 1 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + end diff --git a/spec/factories/project.rb b/spec/factories/project.rb index f900ff1c..1c6657d5 100644 --- a/spec/factories/project.rb +++ b/spec/factories/project.rb @@ -3,7 +3,6 @@ url "MyString" full_name "test/test" github_id "1234567890" - bitcoin_address "bitcoin_address" trait :github do host 'github' diff --git a/spec/factories/wallets.rb b/spec/factories/wallets.rb new file mode 100644 index 00000000..9729b730 --- /dev/null +++ b/spec/factories/wallets.rb @@ -0,0 +1,7 @@ +FactoryGirl.define do + factory :wallet do + name 'test wallet' + xpub 'xpub661MyMwAqRbcFepxYZyGLKMTkTPDvbfLaoYDbw4d4iQT5SycGiJQREuraJ2N6Uh' \ + 'LGPcjXDhnARdtcUhgqN3a2dgQ3Dx8u1chtk8Rx16LrWg' + end +end diff --git a/spec/models/deposit_spec.rb b/spec/models/deposit_spec.rb index d330387b..cd5781e7 100644 --- a/spec/models/deposit_spec.rb +++ b/spec/models/deposit_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Deposit do +describe Deposit, type: :model do let(:deposit) { create(:deposit) } describe 'Associations' do @@ -36,4 +36,4 @@ def with_custom_fee CONFIG["our_fee"] = old_fee end -end \ No newline at end of file +end diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 594e378b..72f01b74 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -1,12 +1,13 @@ require 'spec_helper' -describe Project do +describe Project, type: :model do let(:project) { create(:project) } let(:project_of_bitbucket) { create(:project, :bitbucket) } describe 'Associations' do it { should have_many(:deposits) } it { should have_many(:tips) } + it { should belong_to(:wallet) } end describe 'Validations' do @@ -18,6 +19,27 @@ it { should ensure_inclusion_of(:host).in_array([ "github", "bitbucket" ]) } end + describe 'bitcoin_address' do + let(:wallet) { create(:wallet) } + + before do + create(:wallet, xpub: 'xpub1key') + wallet + end + + it 'should generate a bitcoin address' do + expect(project.bitcoin_address).not_to be_blank + end + + it 'should connect project to the last wallet' do + expect(project.wallet).to eq wallet + end + + it 'should increment wallet\'s last_address_index' do + expect { project }.to change { wallet.reload.last_address_index }.by 1 + end + end + describe '#repository_client' do context 'when host is github' do it 'returns Github instance' do diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 0e62b551..d3d6870c 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe User do +describe User, type: :model do let(:user) { create(:user) } describe 'full_name' do diff --git a/spec/models/wallet_spec.rb b/spec/models/wallet_spec.rb new file mode 100644 index 00000000..32023472 --- /dev/null +++ b/spec/models/wallet_spec.rb @@ -0,0 +1,21 @@ +require 'spec_helper' + +describe Wallet, type: :model do + let(:wallet) { create(:wallet) } + describe 'Validations' do + it { should validate_presence_of(:name) } + it { should validate_presence_of(:xpub) } + end + + describe '#generate_address' do + subject { wallet.generate_address } + + it 'should return a new address' do + expect(subject).to eq '125q4q36PT2gGoeNWXm34RepMcgghLghiZ' + end + + it 'should increment last_address_index' do + expect { subject }.to change { wallet.reload.last_address_index }.by 1 + end + end +end From 27e00a27f8cf33ad8b60dd38e674f86f5c101892 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Wed, 8 Mar 2017 19:52:33 +0300 Subject: [PATCH 224/415] removed blockchain_info deprecated api support --- app/controllers/projects_controller.rb | 2 -- app/models/project.rb | 38 -------------------------- config/config.yml.sample | 8 ------ 3 files changed, 48 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 9cd20dae..a398b242 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -26,8 +26,6 @@ def search def show render :blacklisted and return if BLACKLIST.include? @project.github_url - @project.update_bitcoin_address if @project.bitcoin_address.nil? - @project_tips = @project.tips.with_address @recent_tips = @project_tips.with_address.order(created_at: :desc).first(5) end diff --git a/app/models/project.rb b/app/models/project.rb index 2ffb8160..b3e48817 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -24,19 +24,6 @@ class Project < ActiveRecord::Base # before_save :check_tips_to_pay_against_avaiable_amount - def update_bitcoin_address - blockchain_uri = URI CONFIG["blockchain_info"]["new_url"] - blockchain_pass = CONFIG["blockchain_info"]["password"] - blockchain_label = "#{self.full_name}@tip4commit" - blockchain_params = { password: blockchain_pass, label: blockchain_label } - blockchain_uri.query = URI.encode_www_form blockchain_params - blockchain_resp = Net::HTTP.get_response blockchain_uri - if blockchain_resp.is_a? Net::HTTPSuccess - self.bitcoin_address = (JSON.parse blockchain_resp.body)["address"] - self.save! unless self.bitcoin_address.nil? - end - end - def update_repository_info repo self.github_id = repo.id self.name = repo.name @@ -242,31 +229,6 @@ def self.find_by_url project_url Github.new.find_project project_name end - # Removes inactive addresses from the wallet - # Description: https://blockchain.info/api/blockchain_wallet_api - def self.consolidate_addresses - uri = URI("https://blockchain.info/merchant/#{CONFIG["blockchain_info"]["guid"]}/auto_consolidate?password=#{CONFIG["blockchain_info"]["password"]}&days=60") - return Net::HTTP.get_response(uri) - end - - def archive_address! - if self.bitcoin_address.present? - uri = URI("https://blockchain.info/merchant/#{CONFIG["blockchain_info"]["guid"]}/archive_address?password=#{CONFIG["blockchain_info"]["password"]}&address=#{self.bitcoin_address}") - return Net::HTTP.get_response(uri) - else - return nil - end - end - - def unarchive_address! - if self.bitcoin_address.present? - uri = URI("https://blockchain.info/merchant/#{CONFIG["blockchain_info"]["guid"]}/unarchive_address?password=#{CONFIG["blockchain_info"]["password"]}&address=#{self.bitcoin_address}") - return Net::HTTP.get_response(uri) - else - return nil - end - end - def generate_bitcoin_address wallet = Wallet.order(created_at: :asc).last return unless wallet diff --git a/config/config.yml.sample b/config/config.yml.sample index 2a36e62b..da55e009 100644 --- a/config/config.yml.sample +++ b/config/config.yml.sample @@ -8,14 +8,6 @@ github: project_pages: "torvalds/linux": 30 -blockchain_info: - guid: "111111111111" - password: "111111111111" - callback_secret: "111111111111" - # api_key for https://alpha.blockchain.info/ - api_key: "111111111111" - callback_secret2: "111111111111" - bitcoind: rpc_connection_string: https://user:password@rpc.blockchain.info:443 account: 1M4bS4gPyA6Kb8w7aXsgth9oUZWcRk73tQ From a3035aafe43f829bffe599e00b818a3ae1be0ab9 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Wed, 8 Mar 2017 20:03:56 +0300 Subject: [PATCH 225/415] temporarily added minitest to Gemfile to fix the warning --- Gemfile | 1 + Gemfile.lock | 1 + 2 files changed, 2 insertions(+) diff --git a/Gemfile b/Gemfile index dc60a90b..5331cfea 100644 --- a/Gemfile +++ b/Gemfile @@ -63,4 +63,5 @@ group :test do gem 'cucumber-rails', require: false gem 'database_cleaner' gem 'rspec-activemodel-mocks' + gem 'minitest' end diff --git a/Gemfile.lock b/Gemfile.lock index c84bd955..0aecbd00 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -393,6 +393,7 @@ DEPENDENCIES kaminari (~> 0.15.0) kaminari-i18n less-rails (~> 2.4.2) + minitest money-tree mysql2 octokit (~> 2.7.0) From 4643a5debf4a821f88c80cb283872a0f884c7a31 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Wed, 8 Mar 2017 20:30:52 +0300 Subject: [PATCH 226/415] updated rails --- Gemfile | 3 +-- Gemfile.lock | 76 +++++++++++++++++++++++++--------------------------- 2 files changed, 38 insertions(+), 41 deletions(-) diff --git a/Gemfile b/Gemfile index 5331cfea..7abe111d 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' ruby '2.2.4' -gem 'rails', '4.2.4' +gem 'rails', '4.2.8' gem 'mysql2', group: :production gem 'sass-rails', '~> 4.0.0' gem 'haml-rails', '~> 0.5.3' @@ -63,5 +63,4 @@ group :test do gem 'cucumber-rails', require: false gem 'database_cleaner' gem 'rspec-activemodel-mocks' - gem 'minitest' end diff --git a/Gemfile.lock b/Gemfile.lock index 0aecbd00..73ad1e86 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -51,38 +51,37 @@ GIT GEM remote: https://rubygems.org/ specs: - actionmailer (4.2.4) - actionpack (= 4.2.4) - actionview (= 4.2.4) - activejob (= 4.2.4) + actionmailer (4.2.8) + actionpack (= 4.2.8) + actionview (= 4.2.8) + activejob (= 4.2.8) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.4) - actionview (= 4.2.4) - activesupport (= 4.2.4) + actionpack (4.2.8) + actionview (= 4.2.8) + activesupport (= 4.2.8) rack (~> 1.6) rack-test (~> 0.6.2) rails-dom-testing (~> 1.0, >= 1.0.5) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.4) - activesupport (= 4.2.4) + actionview (4.2.8) + activesupport (= 4.2.8) builder (~> 3.1) erubis (~> 2.7.0) rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - activejob (4.2.4) - activesupport (= 4.2.4) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (4.2.8) + activesupport (= 4.2.8) globalid (>= 0.3.0) - activemodel (4.2.4) - activesupport (= 4.2.4) + activemodel (4.2.8) + activesupport (= 4.2.8) builder (~> 3.1) - activerecord (4.2.4) - activemodel (= 4.2.4) - activesupport (= 4.2.4) + activerecord (4.2.8) + activemodel (= 4.2.8) + activesupport (= 4.2.8) arel (~> 6.0) - activesupport (4.2.4) + activesupport (4.2.8) i18n (~> 0.7) - json (~> 1.7, >= 1.7.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) @@ -90,7 +89,7 @@ GEM airbrake (3.1.15) builder multi_json - arel (6.0.3) + arel (6.0.4) bcrypt (3.1.10) builder (3.2.3) byebug (3.5.1) @@ -167,7 +166,7 @@ GEM ffi (1.9.10) gherkin (2.12.2) multi_json (~> 1.3) - globalid (0.3.6) + globalid (0.3.7) activesupport (>= 4.1.0) haml (4.0.5) tilt @@ -211,14 +210,14 @@ GEM libv8 (3.16.14.13) loofah (2.0.3) nokogiri (>= 1.5.9) - mail (2.6.3) - mime-types (>= 1.16, < 3) - mime-types (2.6.2) + mail (2.6.4) + mime-types (>= 1.16, < 4) + mime-types (2.99.3) mini_portile2 (2.1.0) minitest (5.10.1) money-tree (0.9.0) ffi - multi_json (1.11.2) + multi_json (1.12.1) multi_test (0.1.2) multipart-post (1.2.0) mysql2 (0.3.14) @@ -246,16 +245,16 @@ GEM rack (1.6.5) rack-test (0.6.3) rack (>= 1.0) - rails (4.2.4) - actionmailer (= 4.2.4) - actionpack (= 4.2.4) - actionview (= 4.2.4) - activejob (= 4.2.4) - activemodel (= 4.2.4) - activerecord (= 4.2.4) - activesupport (= 4.2.4) + rails (4.2.8) + actionmailer (= 4.2.8) + actionpack (= 4.2.8) + actionview (= 4.2.8) + activejob (= 4.2.8) + activemodel (= 4.2.8) + activerecord (= 4.2.8) + activesupport (= 4.2.8) bundler (>= 1.3.0, < 2.0) - railties (= 4.2.4) + railties (= 4.2.8) sprockets-rails rails-deprecated_sanitizer (1.0.3) activesupport (>= 4.2.0.alpha) @@ -268,9 +267,9 @@ GEM rails-i18n (4.0.3) i18n (~> 0.6) railties (~> 4.0) - railties (4.2.4) - actionpack (= 4.2.4) - activesupport (= 4.2.4) + railties (4.2.8) + actionpack (= 4.2.8) + activesupport (= 4.2.8) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (12.0.0) @@ -393,13 +392,12 @@ DEPENDENCIES kaminari (~> 0.15.0) kaminari-i18n less-rails (~> 2.4.2) - minitest money-tree mysql2 octokit (~> 2.7.0) omniauth (~> 1.1.4) omniauth-github! - rails (= 4.2.4) + rails (= 4.2.8) rails-i18n render_csv rest-client From 980a82f9afac9de96cf55763c1fa480889beddc5 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Wed, 8 Mar 2017 20:45:56 +0300 Subject: [PATCH 227/415] updated shoulda-matchers --- Gemfile | 4 ++-- Gemfile.lock | 6 +++--- spec/models/project_spec.rb | 2 +- spec/spec_helper.rb | 9 ++++++++- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Gemfile b/Gemfile index 7abe111d..a385a1b7 100644 --- a/Gemfile +++ b/Gemfile @@ -58,9 +58,9 @@ group :development, :test do end group :test do - gem 'simplecov' - gem 'shoulda-matchers', '~> 2.5.0' gem 'cucumber-rails', require: false gem 'database_cleaner' gem 'rspec-activemodel-mocks' + gem 'shoulda-matchers', '~> 3.1' + gem 'simplecov' end diff --git a/Gemfile.lock b/Gemfile.lock index 73ad1e86..f9660598 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -316,8 +316,8 @@ GEM sdoc (0.4.0) json (~> 1.8) rdoc (~> 4.0, < 5.0) - shoulda-matchers (2.5.0) - activesupport (>= 3.0.0) + shoulda-matchers (3.1.1) + activesupport (>= 4.0.0) simplecov (0.7.1) multi_json (~> 1.0) simplecov-html (~> 0.7.1) @@ -406,7 +406,7 @@ DEPENDENCIES sass-rails (~> 4.0.0) sawyer (~> 0.5.2) sdoc - shoulda-matchers (~> 2.5.0) + shoulda-matchers (~> 3.1) simplecov sqlite3 (~> 1.3.11) therubyracer (~> 0.12.2) diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 72f01b74..91fa9a10 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -16,7 +16,7 @@ it { should validate_presence_of(:host) } it { should validate_uniqueness_of(:full_name) } it { should validate_uniqueness_of(:github_id) } - it { should ensure_inclusion_of(:host).in_array([ "github", "bitbucket" ]) } + it { should validate_inclusion_of(:host).in_array %w(github bitbucket) } end describe 'bitcoin_address' do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d1ad52da..746f82d0 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -7,7 +7,7 @@ ENV["RAILS_ENV"] ||= 'test' require File.expand_path("../../config/environment", __FILE__) require 'rspec/rails' -# +# # Requires supporting ruby files with custom matchers and macros, etc, in # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are # run as spec files by default. This means that files in spec/support that end @@ -21,6 +21,13 @@ # If you are not using ActiveRecord, you can remove this line. ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration) +Shoulda::Matchers.configure do |config| + config.integrate do |with| + with.test_framework :rspec + with.library :rails + end +end + RSpec.configure do |config| # ## Mock Framework # From 83ced2234307ba6309e0b7b0820659a260532a0d Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Wed, 8 Mar 2017 20:51:40 +0300 Subject: [PATCH 228/415] removed deprecated blockchain_info configuration --- config/application.rb | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/config/application.rb b/config/application.rb index d2e107e5..293052f5 100644 --- a/config/application.rb +++ b/config/application.rb @@ -9,16 +9,6 @@ # load config.yaml preprocessed CONFIG ||= YAML::load(ERB.new(File.read("config/config.yml")).result) -# define default blockchain urls -merchant_url = "https://blockchain.info/merchant" -transfer_url = "https://blockchain.info/tx" -guid = CONFIG["blockchain_info"]["guid"] -CONFIG["blockchain_info"]["merchant_url"] = merchant_url -CONFIG["blockchain_info"]["transfer_url"] = transfer_url -CONFIG["blockchain_info"]["new_url"] = "#{merchant_url}/#{guid}/new_address" -CONFIG["blockchain_info"]["sendmany_url"] = "#{merchant_url}/#{guid}/sendmany" - - module T4c class Application < Rails::Application From 3affccfe9c98354366fd7c9892ba07e516006599 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Wed, 8 Mar 2017 21:02:09 +0300 Subject: [PATCH 229/415] removed blockchain_info callbacks --- app/controllers/home_controller.rb | 94 ------------------------------ config/routes.rb | 3 - 2 files changed, 97 deletions(-) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 9601118e..1d8291f3 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -2,100 +2,6 @@ class HomeController < ApplicationController def index respond_to do |format| format.html - end - end - - def blockchain_info_callback - # todo: check if remote IP address belongs to blockchain.info - - if (params[:secret]!=CONFIG["blockchain_info"]["callback_secret"]) - render :text => "Invalid secret #{params}!" - return - end - - test = params[:test] - - if (params[:value].to_i < 0) || Sendmany.find_by(txid: params[:transaction_hash]) - render :text => "*ok*" - return - end - - if project = Project.find_by(bitcoin_address: params[:input_address]) - deposit = project.deposits.find_by(txid: params[:transaction_hash]) - else - deposit = nil - end - - if deposit - deposit.update_attribute(:confirmations, confirmations = params[:confirmations]) if !test - if confirmations.to_i > 6 - render :text => "*ok*" - else - render :text => "Deposit #{deposit.id} updated!" - end - return - end - - if params[:input_address] == CONFIG['deposit_address'] - # Deposit from the cold wallet - render :text => "*ok*" - elsif project - if !test - deposit = Deposit.create({ - project_id: project.id, - txid: params[:transaction_hash], - confirmations: params[:confirmations], - amount: params[:value].to_i - }) - project.update_cache - end - render :text => "Deposit #{deposit[:txid]} has been created!" - else - render :text => "Project with deposit address #{params[:input_address]} is not found!" - end - end - - def blockchain_info_callback_v2 - if (params[:secret]!=CONFIG["blockchain_info"]["callback_secret2"]) - render json: {error: 'Forbidden'}, status: 403 - return - end - - if params[:value].to_i < 0 - render :text => "*ok*" - return - end - - if project = Project.find_by(bitcoin_address2: params[:address]) - deposit = project.deposits.find_by(txid: params[:transaction_hash]) - else - deposit = nil - end - - if deposit - deposit.update_attribute(:confirmations, confirmations = params[:confirmations]) - project.update_cache - if confirmations.to_i > 10 - render :text => "*ok*" - else - render :text => "Deposit #{deposit.id} updated!" - end - return - end - - if project - deposit = Deposit.create({ - project_id: project.id, - txid: params[:transaction_hash], - confirmations: params[:confirmations], - amount: params[:value].to_i - }) - project.update_cache - render :text => "Deposit #{deposit[:txid]} has been created!" - else - render :text => "Project with deposit address #{params[:address]} is not found!" end - end - end diff --git a/config/routes.rb b/config/routes.rb index 659819b3..5ec9d7a1 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -5,9 +5,6 @@ devise_for :users, :controllers => { :omniauth_callbacks => 'users/omniauth_callbacks' } - get '/blockchain_info_callback' => 'home#blockchain_info_callback' , :as => 'blockchain_info_callback' - get '/blockchain_info_callback_v2/:secret' => 'home#blockchain_info_callback_v2', :as => 'blockchain_info_callback_v2' - get '/users/login' => 'users#login' , :as => 'login_users' get '/users/:user_id/tips' => 'tips#index' , :constraints => {:user_id => /\d+/} , :as => 'user_tips' get '/users/:nickname/tips' => 'tips#index' , :constraints => {:nickname => /\w[\d\w\-]*/} , :as => 'user_tips_pretty' From dc8bdceaf50eb2d2323099bf8a913bb54ba84380 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Wed, 8 Mar 2017 21:02:44 +0300 Subject: [PATCH 230/415] use tradeblock instead of blockchain.info --- app/helpers/application_helper.rb | 6 +++++- app/views/deposits/index.html.haml | 2 +- app/views/tips/index.html.haml | 2 +- app/views/withdrawals/index.html.haml | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 67915a80..c5054656 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -157,7 +157,7 @@ def get_rate(currency) hash = JSON.parse(response.body) hash["24h_avg"] end - end + end def render_flash_messages html = [] @@ -184,4 +184,8 @@ def list_friendly_text a_list , conjunction ((list.size < 2) ? "" : ",") + ((list.empty?) ? "" : " #{conjunction} ") + last end + + def block_explorer_tx_url(txid) + "https://tradeblock.com/bitcoin/tx/#{txid}" + end end diff --git a/app/views/deposits/index.html.haml b/app/views/deposits/index.html.haml index dfc3d5dd..94cdce69 100644 --- a/app/views/deposits/index.html.haml +++ b/app/views/deposits/index.html.haml @@ -22,7 +22,7 @@ %td= link_to(deposit.project.full_name, pretty_project_path(deposit.project)) %td= btc_human deposit.amount %td= btc_human deposit.fee - %td= link_to deposit.txid, "#{CONFIG["blockchain_info"]["transfer_url"]}/#{deposit.txid}", target: :blank + %td= link_to deposit.txid, "#{block_explorer_tx_url(deposit.txid)}", target: :blank %td= deposit.confirmed? ? t('.confirmed_yes') : t('.confirmed_no') = paginate @deposits diff --git a/app/views/tips/index.html.haml b/app/views/tips/index.html.haml index 4e1ff7a3..308b7487 100644 --- a/app/views/tips/index.html.haml +++ b/app/views/tips/index.html.haml @@ -47,7 +47,7 @@ = t('.waiting') - else - if tip.sendmany.txid.present? - = link_to tip.sendmany.txid, "#{CONFIG["blockchain_info"]["transfer_url"]}/#{tip.sendmany.txid}", target: :blank + = link_to tip.sendmany.txid, "#{block_explorer_tx_url(tip.sendmany.txid)}", target: :blank - else = t('.waiting') - if tip.sendmany.is_error diff --git a/app/views/withdrawals/index.html.haml b/app/views/withdrawals/index.html.haml index 00b2c671..2ce24e30 100644 --- a/app/views/withdrawals/index.html.haml +++ b/app/views/withdrawals/index.html.haml @@ -10,5 +10,5 @@ - @sendmanies.each do |sendmany| %tr %td= l(sendmany.created_at, format: :short) - %td= link_to sendmany.txid, "#{CONFIG["blockchain_info"]["transfer_url"]}/#{sendmany.txid}", target: '_blank' + %td= link_to sendmany.txid, "#{block_explorer_tx_url(sendmany.txid)}", target: '_blank' %td= sendmany.is_error ? t('.error') : t('.success') From 81b2985859c347dbcfbeb70eb79aa20ee0f07cd6 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Wed, 8 Mar 2017 22:02:42 +0300 Subject: [PATCH 231/415] upgraded capistrano --- Gemfile | 11 ++++++++--- Gemfile.lock | 51 +++++++++++++++++++++++++-------------------------- 2 files changed, 33 insertions(+), 29 deletions(-) diff --git a/Gemfile b/Gemfile index a385a1b7..7ce5089b 100644 --- a/Gemfile +++ b/Gemfile @@ -45,10 +45,15 @@ gem 'easy_gravatar' gem 'byebug', '~> 3.5.1' group :development do - gem 'capistrano', '~> 3.0.1' - gem 'capistrano-rvm', '~> 0.1.0', github: 'capistrano/rvm' - gem 'capistrano-bundler', '>= 1.1.0' + gem 'capistrano', '~> 3.4.0' + gem 'capistrano-bundler', '~> 1.1.2' gem 'capistrano-rails', '~> 1.1.0' + gem 'capistrano-rvm', '~> 0.1.0' + + # add ed25519 support to net-ssh + gem 'bcrypt_pbkdf', '~> 1.0.0' + gem 'rbnacl', '~> 3.4.0' + gem 'rbnacl-libsodium', '~> 1.0.0' end group :development, :test do diff --git a/Gemfile.lock b/Gemfile.lock index f9660598..84ec9332 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -21,14 +21,6 @@ GIT specs: bootstrap_form (2.2.0) -GIT - remote: git://github.com/capistrano/rvm.git - revision: 19e8d15ae3d705499c610370f159d523bbedbd94 - specs: - capistrano-rvm (0.1.0) - capistrano (~> 3.0) - sshkit (~> 1.2) - GIT remote: git://github.com/seyhunak/twitter-bootstrap-rails.git revision: 4d0bd4271f7f01d79bbb2b72c04f30a5766db0ef @@ -91,22 +83,26 @@ GEM multi_json arel (6.0.4) bcrypt (3.1.10) + bcrypt_pbkdf (1.0.0) builder (3.2.3) byebug (3.5.1) columnize (~> 0.8) debugger-linecache (~> 1.2) slop (~> 3.6) cancancan (1.7.1) - capistrano (3.0.1) + capistrano (3.4.1) i18n rake (>= 10.0.0) - sshkit (>= 0.0.23) - capistrano-bundler (1.1.1) + sshkit (~> 1.3) + capistrano-bundler (1.1.4) + capistrano (~> 3.1) + sshkit (~> 1.2) + capistrano-rails (1.1.8) + capistrano (~> 3.1) + capistrano-bundler (~> 1.1) + capistrano-rvm (0.1.2) capistrano (~> 3.0) - sshkit (>= 1.2.0) - capistrano-rails (1.1.0) - capistrano (>= 3.0.0) - capistrano-bundler (>= 1.0.0) + sshkit (~> 1.2) capybara (2.5.0) mime-types (>= 1.16) nokogiri (>= 1.3.3) @@ -221,9 +217,9 @@ GEM multi_test (0.1.2) multipart-post (1.2.0) mysql2 (0.3.14) - net-scp (1.1.2) + net-scp (1.2.1) net-ssh (>= 2.6.5) - net-ssh (2.7.0) + net-ssh (4.1.0) netrc (0.11.0) nokogiri (1.7.0.1) mini_portile2 (~> 2.1.0) @@ -273,6 +269,10 @@ GEM rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (12.0.0) + rbnacl (3.4.0) + ffi + rbnacl-libsodium (1.0.11) + rbnacl (>= 3.0.1) rdoc (4.1.1) json (~> 1.4) ref (2.0.0) @@ -333,19 +333,15 @@ GEM activesupport (>= 3.0) sprockets (~> 2.8) sqlite3 (1.3.11) - sshkit (1.3.0) + sshkit (1.12.0) net-scp (>= 1.1.2) - net-ssh - term-ansicolor - term-ansicolor (1.2.2) - tins (~> 0.8) + net-ssh (>= 2.8.0) therubyracer (0.12.2) libv8 (~> 3.16.14.0) ref thor (0.19.4) thread_safe (0.3.6) tilt (1.4.1) - tins (0.13.1) turbolinks (2.5.3) coffee-rails tzinfo (1.2.2) @@ -367,13 +363,14 @@ PLATFORMS DEPENDENCIES acts_as_paranoid! airbrake (~> 3.1.15) + bcrypt_pbkdf (~> 1.0.0) bootstrap_form! byebug (~> 3.5.1) cancancan - capistrano (~> 3.0.1) - capistrano-bundler (>= 1.1.0) + capistrano (~> 3.4.0) + capistrano-bundler (~> 1.1.2) capistrano-rails (~> 1.1.0) - capistrano-rvm (~> 0.1.0)! + capistrano-rvm (~> 0.1.0) coffee-rails (~> 4.0.0) cucumber-rails database_cleaner @@ -399,6 +396,8 @@ DEPENDENCIES omniauth-github! rails (= 4.2.8) rails-i18n + rbnacl (~> 3.4.0) + rbnacl-libsodium (~> 1.0.0) render_csv rest-client rspec-activemodel-mocks From 60346ee955c33becc749b7643d3e872e4e0076e5 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Wed, 8 Mar 2017 22:54:11 +0300 Subject: [PATCH 232/415] enabled german locale --- config/application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index 293052f5..069c8272 100644 --- a/config/application.rb +++ b/config/application.rb @@ -26,7 +26,7 @@ class Application < Rails::Application config.autoload_paths += %W(#{config.root}/lib) config.assets.initialize_on_precompile = true - config.available_locales = %w(en fr nl ru pl hr) + config.available_locales = %w(en fr nl ru pl hr de) end end From 0dddde5d2d3f148acec4fe0868c7c89d03c61451 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Wed, 8 Mar 2017 22:55:40 +0300 Subject: [PATCH 233/415] added a method to export project labels in json format supported by electrum --- app/models/project.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/models/project.rb b/app/models/project.rb index b3e48817..b1d9f580 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -236,4 +236,10 @@ def generate_bitcoin_address self.bitcoin_address = wallet.generate_address save end + + class << self + def export_labels + Hash[pluck(:bitcoin_address, :full_name)].to_json + end + end end From add47de102ffc63c3062aff920307cdce9b6aaca Mon Sep 17 00:00:00 2001 From: Cristian Mircea Messel Date: Sat, 25 Mar 2017 23:24:50 +0200 Subject: [PATCH 234/415] add romanian translations --- config/application.rb | 2 +- config/locales/ro.yml | 233 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 234 insertions(+), 1 deletion(-) create mode 100644 config/locales/ro.yml diff --git a/config/application.rb b/config/application.rb index 069c8272..7c35a615 100644 --- a/config/application.rb +++ b/config/application.rb @@ -26,7 +26,7 @@ class Application < Rails::Application config.autoload_paths += %W(#{config.root}/lib) config.assets.initialize_on_precompile = true - config.available_locales = %w(en fr nl ru pl hr de) + config.available_locales = %w(en fr nl ru pl hr de ro) end end diff --git a/config/locales/ro.yml b/config/locales/ro.yml new file mode 100644 index 00000000..53fc6771 --- /dev/null +++ b/config/locales/ro.yml @@ -0,0 +1,233 @@ +en: + tip4commit: Tip4Commit + meta: + title: Contribuie la Open Source + description: Donează bitcoin la proiecte open source sau fă commit-uri și primești ciubuc. + menu: + home: Acasă + projects: Proiecte + footer: + text: "Codul sursa este aici %{github_link} și poți ajuta %{support_link} development-ul." + github_link: GitHub + support_link: support + follow_link: Urmărește @tip4commit + links: + sign_up: Înscriere + sign_in: Conectare + sign_in_imp: conectare + sign_out: Deconectare + create_issue: creează un tichet + errors: + project_not_found: Proiect de negăsit. + opt_in_notice: "Datorită plângerilor de la maintainers, nu mai adăugăm proiectele automat. Proiectele existente fără fonduri au fost scoase. Dacă vrei să adaugi proiectul tău, te rog %{create_issue_link}." + access_denied: Acces interzis + can_assign_more_tips: "Nu poți assigna mai mult decât 100% din fondurile disponibile." + wrong_bitcoin_address: Eroare la actualizarea adresei de bitcoin + user_not_found: Utilizator de negăsit + access_denied: Nu sunteți autorizat să efectuați această acțiune! + notices: + project_updated: Setările proiectului au fost actualizate + tips_decided: Sumele de ciubuc au fost definite + user_updated: Informațiile dvs. sunt salvate! + user_unsubscribed: V-ați dezabonat! Îmi pare rău că vă deranjăm. Deși, încă mai puteți să ne lăsați adresa dvs. de Bitcoin pentru a obține sfaturi. + tip_amounts: + undecided: Nehotărât + free: "Gratis: 0%" + tiny: "Minusculă: 0.1%" + small: "Mică: 0.5%" + normal: "Normală: 1%" + big: "Mare: 2%" + huge: "Uriașă: 5%" + js: + errors: + value: + invalid: Valoarea este invalidă + email: + invalid: Adresă de email invalidă + blank: E-mail este necesară și nu poate fi gol + password: + blank: Parola este necesară și nu poate fi goală + invalid: Parola și confirmarea acesteia nu sunt aceleași + password_confirmation: + blank: Confirmarea parolei este necesară și nu poate fi goală + invalid: Parola și confirmarea acesteia nu sunt aceleași + home: + index: + see_projects: Vezi proiectele + how_does_it_work: + title: Cum funcționează? + text: Oamenii donează Bitcoins pentru proiecte. Când cineva comite în depozitul de proiect, vom da automat autorului ciubuc. + button: Citește despre Bitcoin + donate: + title: Donează + text: Găsiți un proiect care vă place și depozitați Bitcoins în el. Donația dvs. va fi acumulată cu fondurile altor donatori pentru a da ciubuc pentru noi commit-uri. + button: Găsește sau adaugă proiect + contribute: + title: Contribuie + text: Du-te și repara ceva! În cazul în care commit-ul este acceptat de către maintainerul de proiect, vei primi ciubuc! + sign_in_text: "Verifica e-mail-ul pentru o invitație sau %{sign_in_link}." + sign_up_text: "Dacă nu ați primit încă o invitație, puteți %{sign_up_link} cu un email valid sau via" + button: Proiecte suportate + projects: + index: + find_project: + placeholder: Introduceți URL-ul proiectului GitHub sau orice cuvânt cheie pentru a găsi... + button: Găsește proiect + repository: Repository + description: Descriere + watchers: Urmăritori + balance: Balanță + forked_from: bifurcat din + support: Suportă proiectul + show: + title: "Contribuie la %{project}" + fetch_pending: (Primul fetch în curs) + edit_project: Schimba setările proiectului + decide_tip_amounts: Decide ciubucul + disabled_notifications: "Intretinatorii de proiect au decis să nu notifice noi colaboratori cu privire la sfaturi și, probabil, nu le place acest mod de finanțare." + fee: "%{percentage} din fondurile depozitate vor fi folosite ca si ciubuc." + balance: Balanță + deposits: depozite + custom_tip_size: (fiecare commit nou primeste un procent din balanță) + default_tip_size: "(fiecare commit nout primește %{percentage} din balanță)" + min_tip_size: "Ciubucul minim este %{min_tip}, dar dacă balanța este mai mică decât atâta, va fi trimisă ca un ciubuc mai mic" + unconfirmed_amount: "(%{amount} neconfirmat)" + tipping_policies: Reguli de ciubuc + updated_by_user: "(Ultima dată schimbat de %{name} la %{date})" + updated_by_unknown: "(Ultima schimbare pe %{date})" + tips_paid: Ciubucuri plătite + unclaimed_amount: "(Suma de %{amount} este nerevendicată, și va fi restituită la proiect după ce a fost nerevendicată timp de 1 lună.)" + last_tips: Ultimele ciubucuri + see_all: vezi toate + received: "primit %{amount}" + will_receive: o să primești ciubuc + for_commit: pt commit + when_decided: când cantitatea e decisă + next_tip: următorul ciubuc + contribute_and_earn: Contribuie și câștigă + contribute_and_earn_description: "Donează bitcoin la acest proiect sau %{make_commits_link} și primești ciubuc. Dacă commit-ul este acceptat pe %{branch} de către un maintainer, și există bitcoin în balanță, o să primești ciubuc." + contribute_and_earn_branch: "pe ramura %{branch}" + make_commits_link: fă commit-uri + tell_us_bitcoin_address: "Care e adresa ta de bitcoin %{tell_us_link}." + tell_us_link: spune + sign_in: "Verifică email-ul sau %{sign_in_link}." + promote_project: Promovează %{project} + embedding: Încorporare + image_url: "URL Poză:" + shield_title: ciubuc pentru următorul commit + edit: + project_settings: "%{project} setări proiect" + branch: Ramură + default_branch: Ramură principală + tipping_policies: Reguli de ciubuc + hold_tips: "Nu trimite imediat sfaturi. Dă colaboratori capacitatea de a modifica sfaturile înainte de a fi trimis" + save: Salvează setările proiectului + disable_notifications: Nu notifica contribuitori noi + decide_tip_amounts: + commit: Commit + author: Autor + message: Mesaj + tip: Ciubuc (relativ la balanța proiectului) + submit: Trimite ciubucul ales + blacklisted: + title: Ne pare rău, proiectul nu accepta ciubuc + message: Autorul acestui proiect a ales să interziceți sfaturi pentru acest proiect. + tips: + index: + tips: Ciubucuri + project_tips: '%{project} ciubucuri' + user_tips: "%{user} ciubucuri" + created_at: Creat la + commiter: Commiter + project: Proiect + commit: Commit + amount: Cantitate + refunded: Rambursată depozitul proiectului + undecided: Valoarea ciubucului nu a fost încă decis + no_bitcoin_address: Utilizatorul nu a specificat adresa de retragere + below_threshold: "Soldul utilizatorului este sub pragul de retragere" + waiting: Așteptăm retragere + error: (eroare la trimiterea tranzacției) + deposits: + index: + project_deposits: '%{project} depozite' + deposits: Depozite + created_at: Creat la + project: Proiect + amount: Cantitate + transaction: Tranzacție + confirmed: Confirmată + confirmed_yes: 'Da' + confirmed_no: 'Nu' + users: + index: + title: Contribuitori de top + name: Nume + commits_count: Ciubucuri + withdrawn: Retras + show: + balance: Balanță + threshold: "Vei primi banii atunci când soldul dvs. ajunge la pragul de %{threshold}" + see_all: vezi toate + received: "la %{time} am primit %{amount} pentru %{commit} în %{project}" + bitcoin_address_placeholder: Adresa ta de bitcoin + notify: Anunță-mă despre noi ciubucuri (nu mai mult de un e-mail pe lună) + submit_user: Modifica informațiile utilizatorului + change_password: Schimbă parola + submit_password: Schimbă parola + use_from_gravatar: Folosește din Gravatar + withdrawals: + index: + title: Ultimele retrageri + created_at: Creat la + transaction: Tranzacție + result: Resultat + error: Eroare + success: Succes + devise: + sessions: + new: + title: Înscriere + remember_me: Amintește-ți de mine + submit: Înscriere + registrations: + new: + title: Înregistrare + submit: Înregistrare + passwords: + new: + title: Ai uitat parola? + submit: Trimite instrucțiuni de resetare parolă + edit: + title: Schimbă parola + submit: Schimbă parola + confirmations: + new: + title: Retrimite instrucțiuni de confirmare + submit: Retrimite instrucțiuni de confirmare + links: + sign_in: Înscriere + sign_up: Înregistrare + recover: Ai uitat parola? + confirm: Nu ai primit instrucțiuni de confirmare? + sign_in_with: "Înscriere cu %{provider}" + errors: + primary_email: adresa ta de email principală trebuie verificată. + onmiauth_info: nu am putut aduce informațiile tale + activerecord: + attributes: + user: + email: E-mail + bitcoin_address: Adresă bitcoin + password: Parolă + password_confirmation: Confirmare parolă + display_name: Nume + omniauth_providers: + github: GitHub + bitbucket: BitBucket + general: + or: sau + disclaimer: + line1: "Tip4Commit nu este afiliat cu majoritatea proiectelor." + line2: "Nu există nici o garanție că ciubucurile vor fi luate de developeri" + line3: "Prin donarea fondurilor sunteți de acord că acestea pot fi trimise la Free Software Foundation sau în altă parte, la discreția Tip4Commit" From ebb0e31449206c60eba96022d276c89539a46658 Mon Sep 17 00:00:00 2001 From: Cristian Mircea Messel Date: Sat, 25 Mar 2017 23:38:03 +0200 Subject: [PATCH 235/415] add more association specs --- spec/models/collaborator_spec.rb | 7 +++++++ spec/models/send_many_spec.rb | 7 +++++++ spec/models/sendmany_spec.rb | 7 +++++++ spec/models/tip_spec.rb | 9 +++++++++ spec/models/tipping_policies_text_spec.rb | 8 ++++++++ spec/models/user_spec.rb | 4 ++++ spec/models/wallet_spec.rb | 1 + 7 files changed, 43 insertions(+) create mode 100644 spec/models/collaborator_spec.rb create mode 100644 spec/models/send_many_spec.rb create mode 100644 spec/models/sendmany_spec.rb create mode 100644 spec/models/tip_spec.rb create mode 100644 spec/models/tipping_policies_text_spec.rb diff --git a/spec/models/collaborator_spec.rb b/spec/models/collaborator_spec.rb new file mode 100644 index 00000000..43f31cee --- /dev/null +++ b/spec/models/collaborator_spec.rb @@ -0,0 +1,7 @@ +require 'spec_helper' + +describe Collaborator, type: :model do + describe 'Associations' do + it { should belong_to :project } + end +end diff --git a/spec/models/send_many_spec.rb b/spec/models/send_many_spec.rb new file mode 100644 index 00000000..7fdcf6c7 --- /dev/null +++ b/spec/models/send_many_spec.rb @@ -0,0 +1,7 @@ +require 'spec_helper' + +describe Sendmany, type: :model do + describe 'Associations' do + it { should have_many :tips } + end +end diff --git a/spec/models/sendmany_spec.rb b/spec/models/sendmany_spec.rb new file mode 100644 index 00000000..7fdcf6c7 --- /dev/null +++ b/spec/models/sendmany_spec.rb @@ -0,0 +1,7 @@ +require 'spec_helper' + +describe Sendmany, type: :model do + describe 'Associations' do + it { should have_many :tips } + end +end diff --git a/spec/models/tip_spec.rb b/spec/models/tip_spec.rb new file mode 100644 index 00000000..e307006c --- /dev/null +++ b/spec/models/tip_spec.rb @@ -0,0 +1,9 @@ +require 'spec_helper' + +describe Tip, type: :model do + describe 'Associations' do + it { should belong_to :user } + it { should belong_to :sendmany } + it { should belong_to :project } + end +end diff --git a/spec/models/tipping_policies_text_spec.rb b/spec/models/tipping_policies_text_spec.rb new file mode 100644 index 00000000..c9f98398 --- /dev/null +++ b/spec/models/tipping_policies_text_spec.rb @@ -0,0 +1,8 @@ +require 'spec_helper' + +describe TippingPoliciesText, type: :model do + describe 'Associations' do + it { should belong_to :project } + it { should belong_to :user } + end +end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index d3d6870c..b8fd6051 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -3,6 +3,10 @@ describe User, type: :model do let(:user) { create(:user) } + describe 'Associations' do + it { should have_many :tips } + end + describe 'full_name' do context 'when name is present' do it 'returns name' do diff --git a/spec/models/wallet_spec.rb b/spec/models/wallet_spec.rb index 32023472..c48d5118 100644 --- a/spec/models/wallet_spec.rb +++ b/spec/models/wallet_spec.rb @@ -2,6 +2,7 @@ describe Wallet, type: :model do let(:wallet) { create(:wallet) } + describe 'Validations' do it { should validate_presence_of(:name) } it { should validate_presence_of(:xpub) } From 6cd013089af3776522b9f1d52c55a8be1e2b79a8 Mon Sep 17 00:00:00 2001 From: Cristian Mircea Messel Date: Sat, 25 Mar 2017 23:46:21 +0200 Subject: [PATCH 236/415] use correct locale key --- config/locales/ro.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/ro.yml b/config/locales/ro.yml index 53fc6771..92202c18 100644 --- a/config/locales/ro.yml +++ b/config/locales/ro.yml @@ -1,4 +1,4 @@ -en: +ro: tip4commit: Tip4Commit meta: title: Contribuie la Open Source From 34601204fac22265942ceb19613804be3aaae0fb Mon Sep 17 00:00:00 2001 From: Cristian Mircea Messel Date: Sun, 26 Mar 2017 23:39:17 +0300 Subject: [PATCH 237/415] include ro flag and a test to check for flags --- app/assets/images/flags/ro.png | Bin 0 -> 457 bytes spec/misc_spec.rb | 12 ++++++++++++ 2 files changed, 12 insertions(+) create mode 100644 app/assets/images/flags/ro.png create mode 100644 spec/misc_spec.rb diff --git a/app/assets/images/flags/ro.png b/app/assets/images/flags/ro.png new file mode 100644 index 0000000000000000000000000000000000000000..37461b18983050ae3126a983d4a4a40b68ab27d4 GIT binary patch literal 457 zcmV;)0XF`LP)KmW0Po!Z_V!r){ZaeyVEp`L^%SwzVzog`06(D@@r$$`8KTxs!*cJ*OVWMpi>&=88VK3yY9eylZGLN;I&bt zfgff#hQxyx)h Date: Wed, 29 Mar 2017 11:42:48 +0200 Subject: [PATCH 238/415] Translate a key --- config/locales/fr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/fr.yml b/config/locales/fr.yml index dc43680d..f845747f 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -12,7 +12,7 @@ fr: support_link: subventionner follow_link: Suivez @tip4commit links: - sign_up: Sign up + sign_up: Créer un compte sign_in: Se connecter sign_in_imp: se connecter sign_out: Se déconnecter From cc5152cb30b77c1809a0b41db4c1bb935ea1a2da Mon Sep 17 00:00:00 2001 From: nauadratti Date: Thu, 30 Mar 2017 22:05:28 +0000 Subject: [PATCH 239/415] Update ru.yml --- config/locales/ru.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/config/locales/ru.yml b/config/locales/ru.yml index d099e7c4..b9000124 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -194,7 +194,7 @@ ru: registrations: new: title: Регистрация - submit: Войти + submit: Зарегистрироваться passwords: new: title: Забыли ваш пароль? @@ -211,7 +211,7 @@ ru: sign_up: Регистрация recover: Забыли ваш пароль? confirm: Не получили письмо с подтверждением? - sign_in_with: "Войти с %{provider}" + sign_in_with: "Войти через %{provider}" errors: primary_email: ваш email адрес должен быть подтвержден. onmiauth_info: не удалось получить информацию. @@ -229,3 +229,8 @@ ru: bitbucket: BitBucket general: or: или + disclaimer: + line1: "Tip4Commit не аффилирован с большинством проектов." + line2: "Нет гарантии, что чаевые будут востребованы разработчиками." + line3: "Жертвованием своих средств Вы соглашаетесь, что они могут быть отправлены Free Software Foundation или куда-либо ещё на усмотрение Tip4Commit." + From a74005803b4d219a592370dbc470a4d9320f8b08 Mon Sep 17 00:00:00 2001 From: Awesome Possum Date: Tue, 16 May 2017 09:45:29 +0200 Subject: [PATCH 240/415] Update hr.yml --- config/locales/hr.yml | 58 +++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/config/locales/hr.yml b/config/locales/hr.yml index 45642b59..8bb95e0f 100644 --- a/config/locales/hr.yml +++ b/config/locales/hr.yml @@ -12,24 +12,24 @@ hr: support_link: podržati follow_link: Prati @tip4commit links: - sign_up: Sign up + sign_up: Registracija sign_in: Prijava sign_in_imp: prijava sign_out: Odjava errors: - project_not_found: Projekt nije nadjen. + project_not_found: Projekt nije nađen. access_denied: Pristup odbijen - can_assign_more_tips: "Ne mozete dodijeliti vise od 100% dostupnih sredstva." + can_assign_more_tips: "Ne možete dodijeliti više od 100% dostupnih sredstava." wrong_bitcoin_address: Greška u bitcoin adresi user_not_found: Korisnik nije nađen access_denied: Niste ovlašteni da ovo napravite! notices: - project_updated: Postavke projekta su primijenjena + project_updated: Postavke projekta su primijenjene tips_decided: Broj napojnica je bio definiran - user_updated: Vasa informacija je sacuvana! - user_unsubscribed: "Maknuli ste vasu pretplatu! Zao nam je sto smo vam smetali. Svejedno mozete ostaviti vasu bitcoin adresu da dobite svoje napojnice." + user_updated: Vaša informacija je sacuvana! + user_unsubscribed: "Maknuli ste vašu pretplatu! Žao nam je što smo vam smetali. Svejedno možete ostaviti vašu bitcoin adresu da dobijete svoje napojnice." tip_amounts: - undecided: "Neodluceno" + undecided: "Neodlučeno" free: "Besplatno: 0%" tiny: "Vrlo malo: 0.1%" small: "Malo: 0.5%" @@ -44,11 +44,11 @@ hr: invalid: Neispravna email adresa blank: Email je obavezan password: - blank: Lozinka je obavezma - invalid: Lozinka i potvrda nisu isti + blank: Lozinka je obavezna + invalid: Lozinka i potvrda nisu iste password_confirmation: blank: Potvrda lozinke je obavezna - invalid: Lozinka i potvrda nisu isti + invalid: Lozinka i potvrda nisu iste home: index: see_projects: Vidi projekte @@ -64,12 +64,12 @@ hr: title: Doprinesi text: Idite i popravite nešto! Ako održavatelj projekta odobri vašu promjenu, dobiti ćete napojnicu! sign_in_text: "Samo provjerite vaš email ili %{sign_in_link}." - sign_up_text: "Ako još niste dobili pozivnicu, moze te se %{sign_up_link} sa valjanom email adresom ili" + sign_up_text: "Ako još niste dobili pozivnicu, možete se %{sign_up_link} sa valjanom email adresom ili" button: Projekti koje podržavamo projects: index: find_project: - placeholder: Upišite GitHub URL projekta kako biste dodali projekt ili bilo koju ključnu rijeć da biste ga našli... + placeholder: Upišite GitHub URL projekta kako biste dodali projekt ili bilo koju ključnu riječ da biste ga našli... button: Nađi ili dodaj projekt repository: Repozitorij description: Opis @@ -88,12 +88,12 @@ hr: deposits: depoziti custom_tip_size: (svaka nova promjena dobiva određen postotak dostupnih bitcoina) default_tip_size: "(svaka nova promjena će dobiti %{percentage} dostupnih bitcoina)" - unconfirmed_amount: "(%{amount} nepotvrdeno)" + unconfirmed_amount: "(%{amount} nepotvrđeno)" tipping_policies: Pravila o napojnicama updated_by_user: "(Zadnje promjenio %{name} %{date})" updated_by_unknown: "(Zadnje promjenjeno %{date})" tips_paid: Ukupno količina isplaćenih napojnica - unclaimed_amount: "(%{amount} od ovog neostvarenog, i biti ce natrag isplaceno u projekt nakon jednog mjeseca.)" + unclaimed_amount: "(%{amount} od ovog neostvarenog, i biti će isplaćeno u projekt nakon jednog mjeseca.)" last_tips: Zadnje napojnice see_all: Vidjeti sve received: "je dobio %{amount}" @@ -102,7 +102,7 @@ hr: when_decided: kada je količina odlučena next_tip: Sljedeća napojnica contribute_and_earn: Doprinesi i zaradi - contribute_and_earn_description: "Doniraj Bitcone ovom projektu ili %{make_commits_link} i dobij napojnicu. Ako je voditelj projekta prihvatio promjenu u %{branch} i Bitcoini su dostpuni, dobiti će te napojnicu." + contribute_and_earn_description: "Doniraj Bitcone ovom projektu ili %{make_commits_link} i dobij napojnicu. Ako je voditelj projekta prihvatio promjenu u %{branch} i Bitcoini su dostupni, dobit ćete napojnicu." contribute_and_earn_branch: "u %{branch} branch" make_commits_link: napravi promjenu tell_us_bitcoin_address: "Samo %{tell_us_link} Vašu Bitcoin adresu." @@ -124,7 +124,7 @@ hr: commit: Promjena author: Autor message: Poruka - tip: Napojnica (relativna iznosu na racunu) + tip: Napojnica (relativna iznosu na računu) submit: Pošaljite odabrane iznose napojnica tips: index: @@ -135,7 +135,7 @@ hr: commiter: Commiter project: Projekt commit: Commit - amount: Kolicina + amount: Količina refunded: Refunded to project's deposit undecided: The amount of the tip has not been decided yet no_bitcoin_address: User didn't specify withdrawal address @@ -161,11 +161,11 @@ hr: withdrawn: Withdrawn show: balance: Ravnoteža - threshold: "Dobiti ćete Vaše novce kada Vaša ravnoteža prijeđe prag od %{threshold}" + threshold: "Dobit ćete Vaše novce kada Vaša ravnoteža prijeđe prag od %{threshold}" see_all: vidjeti sve - received: "%{time} primljeno %{amount} za cin %{commit} u %{project}" - bitcoin_address_placeholder: Vasa bitcoin adresa - notify: Obavjesti me o novim savjetima (ne vise od jednog emaila po mjesecu) + received: "%{time} primljeno %{amount} za čin %{commit} u %{project}" + bitcoin_address_placeholder: Vaša bitcoin adresa + notify: Obavijesti me o novim savjetima (ne vise od jednog emaila po mjesecu) submit_user: Ažuriraj change_password: Promijeni lozinku submit_password: Promijeni lozinku @@ -192,21 +192,21 @@ hr: title: Zaboravili ste vašu lozinku? submit: Poslati mi uputstva za resetiranje lozinke edit: - title: Promijenite vasu lozinku + title: Promijenite vašu lozinku submit: Promijeniti svoju lozinku confirmations: new: - title: Ponovno poslati uputstva za potvrdivanje - submit: Ponovno poslati uputstva za potvrdivanje + title: Ponovno poslati uputstva za potvrđivanje + submit: Ponovno poslati uputstva za potvrđivanje links: sign_in: Prijava sign_up: Registracija - recover: Zaboravili ste vasu lozinku? - confirm: Niste primili uputstva za potvrdivanje? + recover: Zaboravili ste vašu lozinku? + confirm: Niste primili uputstva za potvrđivanje? sign_in_with: "Prijavi se sa %{provider}" errors: - primary_email: vasa glavna email adresa bi trebala biti potvrdena. - onmiauth_info: Nismo bili u stanju dohvatiti vasu informaciju. + primary_email: vaša glavna email adresa bi trebala biti potvrđena. + onmiauth_info: Nismo bili u stanju dohvatiti vašu informaciju. activerecord: attributes: user: @@ -214,7 +214,7 @@ hr: bitcoin_address: Bitcoin adresa password: Lozinka password_confirmation: Potvrda lozinke - display_name: Prikazno ime + display_name: Prikazano ime omniauth_providers: github: GitHub bitbucket: BitBucket From 264cc74a6f158061628e359b5a1cc4431eb99799 Mon Sep 17 00:00:00 2001 From: Marcelo Leal Date: Fri, 19 May 2017 15:41:07 +0000 Subject: [PATCH 241/415] Fix render flash messages applying color correctly --- app/helpers/application_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c5054656..17672b77 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -163,8 +163,8 @@ def render_flash_messages html = [] flash.each do |_type, _message| alert_type = case _type - when :notice then :success - when :alert, :error then :danger + when 'notice' then :success + when 'alert', 'error' then :danger end html << content_tag(:div, class: "alert alert-#{alert_type}"){ _message } end From c6e0f759349a9c690367bb595cb294c817e93363 Mon Sep 17 00:00:00 2001 From: BHC Date: Sat, 19 Aug 2017 17:59:20 +0100 Subject: [PATCH 242/415] Updated LICENSE to 2017 Better late than never. --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 0b04d721..01081a42 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2016 tip4commit +Copyright (c) 2017 tip4commit Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in From fb82193c56daa95f39616296bb2a0643923ea296 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 11 Nov 2017 11:38:31 +0100 Subject: [PATCH 243/415] updated ruby to 4.2.4 --- .travis.yml | 2 +- Gemfile | 2 +- Gemfile.lock | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0f0047ca..ec654f5a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ git: depth: 10 rvm: - - 2.2.4 + - 2.4.2 bundler_args: --without development --jobs=9 --retry=2 --quiet diff --git a/Gemfile b/Gemfile index 7ce5089b..3a9a14da 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' -ruby '2.2.4' +ruby '2.4.2' gem 'rails', '4.2.8' gem 'mysql2', group: :production diff --git a/Gemfile.lock b/Gemfile.lock index 84ec9332..76150db4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -415,7 +415,7 @@ DEPENDENCIES uglifier (>= 1.3.0) RUBY VERSION - ruby 2.2.4p230 + ruby 2.4.2p198 BUNDLED WITH - 1.12.4 + 1.16.0 From 01a4db8db72ab1052746b553357c00def449edd3 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 11 Nov 2017 11:38:48 +0100 Subject: [PATCH 244/415] updated rails and some other gems --- Gemfile | 71 +++++++++++++------------- Gemfile.lock | 140 +++++++++++++++++++++++++++------------------------ 2 files changed, 107 insertions(+), 104 deletions(-) diff --git a/Gemfile b/Gemfile index 3a9a14da..181857ca 100644 --- a/Gemfile +++ b/Gemfile @@ -2,47 +2,44 @@ source 'https://rubygems.org' ruby '2.4.2' -gem 'rails', '4.2.8' -gem 'mysql2', group: :production -gem 'sass-rails', '~> 4.0.0' -gem 'haml-rails', '~> 0.5.3' -gem 'less-rails', '~> 2.4.2' -gem 'kaminari', '~> 0.15.0' -gem 'uglifier', '>= 1.3.0' -gem 'coffee-rails', '~> 4.0.0' -gem 'therubyracer', '~> 0.12.2', platforms: :ruby -gem 'jquery-rails', '~> 3.0.4' -gem 'turbolinks', '~> 2.5.0' -gem 'jquery-turbolinks' -gem 'jbuilder', '~> 1.5.3' -gem 'airbrake', '~> 3.1.15' -gem 'devise', '~> 3.5.2' -gem 'omniauth', '~> 1.1.4' -gem 'omniauth-github', github: 'alexandrz/omniauth-github', branch: 'provide_emails' -gem 'octokit', '~> 2.7.0' -gem 'sawyer', '~> 0.5.2' -gem 'twitter_bootstrap_form_for', github: 'stouset/twitter_bootstrap_form_for' -gem 'twitter-bootstrap-rails', github: 'seyhunak/twitter-bootstrap-rails', branch: 'bootstrap3' +gem 'rails', '4.2.10' + +gem 'acts_as_paranoid', github: 'ActsAsParanoid/acts_as_paranoid' +gem 'airbrake', '~> 3.1.15' gem 'bootstrap_form', github: 'bootstrap-ruby/rails-bootstrap-forms' -gem 'sdoc', group: :doc, require: false gem 'cancancan' -gem 'dusen' -gem 'render_csv' +gem 'coffee-rails', '~> 4.0.0' gem 'demoji' -gem 'acts_as_paranoid', github: 'ActsAsParanoid/acts_as_paranoid' - -gem "http_accept_language" -gem 'rails-i18n' -gem "i18n-js" -gem 'kaminari-i18n' +gem 'devise', '~> 3.5.2' gem 'devise-i18n' - -gem 'money-tree' -gem 'rest-client' - +gem 'dusen', '~> 0.6.1' gem 'easy_gravatar' - -gem 'byebug', '~> 3.5.1' +gem 'haml-rails', '~> 0.5.3' +gem 'http_accept_language' +gem 'i18n-js' +gem 'jbuilder', '~> 1.5.3' +gem 'jquery-rails', '~> 3.0.4' +gem 'jquery-turbolinks' +gem 'kaminari', '~> 0.15.0' +gem 'kaminari-i18n' +gem 'less-rails', '~> 2.4.2' +gem 'money-tree', '~> 0.9.0' +gem 'mysql2', group: :production +gem 'octokit', '~> 2.7.0' +gem 'omniauth', '~> 1.1.4' +gem 'omniauth-github', github: 'alexandrz/omniauth-github', branch: 'provide_emails' +gem 'rails-i18n', '~> 4.0.0' +gem 'render_csv' +gem 'rest-client' +gem 'sass-rails', '~> 4.0.0' +gem 'sawyer', '~> 0.5.2' +gem 'sdoc', group: :doc, require: false +gem 'sidekiq' +gem 'therubyracer', '~> 0.12.2', platforms: :ruby +gem 'turbolinks', '~> 2.5.0' +gem 'twitter-bootstrap-rails', github: 'seyhunak/twitter-bootstrap-rails', branch: 'bootstrap3' +gem 'twitter_bootstrap_form_for', github: 'stouset/twitter_bootstrap_form_for' +gem 'uglifier', '>= 1.3.0' group :development do gem 'capistrano', '~> 3.4.0' @@ -57,9 +54,9 @@ group :development do end group :development, :test do - gem 'sqlite3', '~> 1.3.11' gem 'factory_girl_rails', '~> 4.3.0' gem 'rspec-rails', '~> 3.5.0' + gem 'sqlite3', '~> 1.3.11' end group :test do diff --git a/Gemfile.lock b/Gemfile.lock index 76150db4..04e0286e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -43,36 +43,36 @@ GIT GEM remote: https://rubygems.org/ specs: - actionmailer (4.2.8) - actionpack (= 4.2.8) - actionview (= 4.2.8) - activejob (= 4.2.8) + actionmailer (4.2.10) + actionpack (= 4.2.10) + actionview (= 4.2.10) + activejob (= 4.2.10) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.8) - actionview (= 4.2.8) - activesupport (= 4.2.8) + actionpack (4.2.10) + actionview (= 4.2.10) + activesupport (= 4.2.10) rack (~> 1.6) rack-test (~> 0.6.2) rails-dom-testing (~> 1.0, >= 1.0.5) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.8) - activesupport (= 4.2.8) + actionview (4.2.10) + activesupport (= 4.2.10) builder (~> 3.1) erubis (~> 2.7.0) rails-dom-testing (~> 1.0, >= 1.0.5) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (4.2.8) - activesupport (= 4.2.8) + activejob (4.2.10) + activesupport (= 4.2.10) globalid (>= 0.3.0) - activemodel (4.2.8) - activesupport (= 4.2.8) + activemodel (4.2.10) + activesupport (= 4.2.10) builder (~> 3.1) - activerecord (4.2.8) - activemodel (= 4.2.8) - activesupport (= 4.2.8) + activerecord (4.2.10) + activemodel (= 4.2.10) + activesupport (= 4.2.10) arel (~> 6.0) - activesupport (4.2.8) + activesupport (4.2.10) i18n (~> 0.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) @@ -85,10 +85,6 @@ GEM bcrypt (3.1.10) bcrypt_pbkdf (1.0.0) builder (3.2.3) - byebug (3.5.1) - columnize (~> 0.8) - debugger-linecache (~> 1.2) - slop (~> 3.6) cancancan (1.7.1) capistrano (3.4.1) i18n @@ -116,8 +112,10 @@ GEM coffee-script-source execjs coffee-script-source (1.9.1.1) - columnize (0.9.0) commonjs (0.2.7) + concurrent-ruby (1.0.5) + connection_pool (2.2.0) + crass (1.0.2) cucumber (1.3.20) builder (>= 2.1.2) diff-lcs (>= 1.1.3) @@ -131,7 +129,6 @@ GEM nokogiri (~> 1.5) rails (>= 3, < 5) database_cleaner (1.2.0) - debugger-linecache (1.2.0) demoji (0.0.5) devise (3.5.2) bcrypt (~> 3.0) @@ -142,13 +139,14 @@ GEM warden (~> 1.2.3) devise-i18n (0.11.0) diff-lcs (1.3) + docile (1.1.5) domain_name (0.5.25) unf (>= 0.0.5, < 1.0.0) - dusen (0.4.10) - activerecord + dusen (0.6.1) + activerecord (>= 3.0) edge_rider (>= 0.2.5) easy_gravatar (1.0.1) - edge_rider (0.3.0) + edge_rider (0.3.2) activerecord erubis (2.7.0) execjs (2.6.0) @@ -159,11 +157,11 @@ GEM railties (>= 3.0.0) faraday (0.8.9) multipart-post (~> 1.2.0) - ffi (1.9.10) + ffi (1.9.18) gherkin (2.12.2) multi_json (~> 1.3) - globalid (0.3.7) - activesupport (>= 4.1.0) + globalid (0.4.1) + activesupport (>= 4.2.0) haml (4.0.5) tilt haml-rails (0.5.3) @@ -177,7 +175,8 @@ GEM domain_name (~> 0.5) http_accept_language (2.0.2) httpauth (0.2.1) - i18n (0.8.1) + i18n (0.9.1) + concurrent-ruby (~> 1.0) i18n-js (2.1.2) i18n jbuilder (1.5.3) @@ -203,17 +202,19 @@ GEM less-rails (2.4.2) actionpack (>= 3.1) less (~> 2.4.0) - libv8 (3.16.14.13) - loofah (2.0.3) + libv8 (3.16.14.19) + loofah (2.1.1) + crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.6.4) - mime-types (>= 1.16, < 4) + mail (2.7.0) + mini_mime (>= 0.1.1) mime-types (2.99.3) - mini_portile2 (2.1.0) - minitest (5.10.1) + mini_mime (1.0.0) + mini_portile2 (2.3.0) + minitest (5.10.3) money-tree (0.9.0) ffi - multi_json (1.12.1) + multi_json (1.12.2) multi_test (0.1.2) multipart-post (1.2.0) mysql2 (0.3.14) @@ -221,8 +222,8 @@ GEM net-ssh (>= 2.6.5) net-ssh (4.1.0) netrc (0.11.0) - nokogiri (1.7.0.1) - mini_portile2 (~> 2.1.0) + nokogiri (1.8.1) + mini_portile2 (~> 2.3.0) oauth2 (0.8.1) faraday (~> 0.8) httpauth (~> 0.1) @@ -238,19 +239,19 @@ GEM oauth2 (~> 0.8.0) omniauth (~> 1.0) orm_adapter (0.5.0) - rack (1.6.5) + rack (1.6.8) rack-test (0.6.3) rack (>= 1.0) - rails (4.2.8) - actionmailer (= 4.2.8) - actionpack (= 4.2.8) - actionview (= 4.2.8) - activejob (= 4.2.8) - activemodel (= 4.2.8) - activerecord (= 4.2.8) - activesupport (= 4.2.8) + rails (4.2.10) + actionmailer (= 4.2.10) + actionpack (= 4.2.10) + actionview (= 4.2.10) + activejob (= 4.2.10) + activemodel (= 4.2.10) + activerecord (= 4.2.10) + activesupport (= 4.2.10) bundler (>= 1.3.0, < 2.0) - railties (= 4.2.8) + railties (= 4.2.10) sprockets-rails rails-deprecated_sanitizer (1.0.3) activesupport (>= 4.2.0.alpha) @@ -263,18 +264,19 @@ GEM rails-i18n (4.0.3) i18n (~> 0.6) railties (~> 4.0) - railties (4.2.8) - actionpack (= 4.2.8) - activesupport (= 4.2.8) + railties (4.2.10) + actionpack (= 4.2.10) + activesupport (= 4.2.10) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (12.0.0) + rake (12.2.1) rbnacl (3.4.0) ffi rbnacl-libsodium (1.0.11) rbnacl (>= 3.0.1) rdoc (4.1.1) json (~> 1.4) + redis (3.3.0) ref (2.0.0) render_csv (2.0.0) rails (>= 3.0) @@ -318,11 +320,15 @@ GEM rdoc (~> 4.0, < 5.0) shoulda-matchers (3.1.1) activesupport (>= 4.0.0) - simplecov (0.7.1) - multi_json (~> 1.0) - simplecov-html (~> 0.7.1) - simplecov-html (0.7.1) - slop (3.6.0) + sidekiq (4.0.2) + concurrent-ruby (~> 1.0) + connection_pool (~> 2.2, >= 2.2.0) + redis (~> 3.2, >= 3.2.1) + simplecov (0.15.1) + docile (~> 1.1.0) + json (>= 1.8, < 3) + simplecov-html (~> 0.10.0) + simplecov-html (0.10.2) sprockets (2.12.4) hike (~> 1.2) multi_json (~> 1.0) @@ -336,15 +342,15 @@ GEM sshkit (1.12.0) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) - therubyracer (0.12.2) - libv8 (~> 3.16.14.0) + therubyracer (0.12.3) + libv8 (~> 3.16.14.15) ref - thor (0.19.4) + thor (0.20.0) thread_safe (0.3.6) tilt (1.4.1) turbolinks (2.5.3) coffee-rails - tzinfo (1.2.2) + tzinfo (1.2.4) thread_safe (~> 0.1) uglifier (2.4.0) execjs (>= 0.3.0) @@ -365,7 +371,6 @@ DEPENDENCIES airbrake (~> 3.1.15) bcrypt_pbkdf (~> 1.0.0) bootstrap_form! - byebug (~> 3.5.1) cancancan capistrano (~> 3.4.0) capistrano-bundler (~> 1.1.2) @@ -377,7 +382,7 @@ DEPENDENCIES demoji devise (~> 3.5.2) devise-i18n - dusen + dusen (~> 0.6.1) easy_gravatar factory_girl_rails (~> 4.3.0) haml-rails (~> 0.5.3) @@ -389,13 +394,13 @@ DEPENDENCIES kaminari (~> 0.15.0) kaminari-i18n less-rails (~> 2.4.2) - money-tree + money-tree (~> 0.9.0) mysql2 octokit (~> 2.7.0) omniauth (~> 1.1.4) omniauth-github! - rails (= 4.2.8) - rails-i18n + rails (= 4.2.10) + rails-i18n (~> 4.0.0) rbnacl (~> 3.4.0) rbnacl-libsodium (~> 1.0.0) render_csv @@ -406,6 +411,7 @@ DEPENDENCIES sawyer (~> 0.5.2) sdoc shoulda-matchers (~> 3.1) + sidekiq simplecov sqlite3 (~> 1.3.11) therubyracer (~> 0.12.2) From b0f071e5649cdac6787605a7e9100e7fb12ffb5f Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 11 Nov 2017 12:01:09 +0100 Subject: [PATCH 245/415] fixed failing spec --- spec/mailers/user_mailer_spec.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/mailers/user_mailer_spec.rb b/spec/mailers/user_mailer_spec.rb index 4b0f1308..34211ffd 100644 --- a/spec/mailers/user_mailer_spec.rb +++ b/spec/mailers/user_mailer_spec.rb @@ -24,7 +24,11 @@ end it 'assigns users\' balance' do - expect(mail.body.encoded).to match("Please, log in and tell us your bitcoin address to get it.

\r\n

Your current balance is 0.00000010 Ƀ") + expected_text = [ + 'Please, log in and tell us your bitcoin address to get it.

', + '

Your current balance is 0.00000010 Ƀ' + ].join("\n") + expect(mail.body.encoded).to match expected_text end it 'useses secure protocol for links' do From 4c1902fc90d87f5178cbc9148b981ca354bac147 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 12 Nov 2017 13:02:20 +0100 Subject: [PATCH 246/415] updated capistrano config --- config/deploy.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/config/deploy.rb b/config/deploy.rb index 1f1bfbc5..2b4b8bd9 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -3,25 +3,24 @@ # ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp } -set :deploy_to, "/home/apps/t4c" +set :deploy_to, '/home/apps/t4c' set :scm, :git set :rvm_type, :user -set :rvm_ruby_version, '2.2.4' +set :rvm_ruby_version, '2.4.2' set :rvm_custom_path, '~/.rvm' set :format, :pretty # set :log_level, :debug # set :pty, true -set :linked_files, %w{config/database.yml config/config.yml} -set :linked_dirs, %w{log tmp} +set :linked_files, %w[config/database.yml config/config.yml] +set :linked_dirs, %w[log tmp] # set :default_env, { path: "/opt/ruby/bin:$PATH" } set :keep_releases, 5 namespace :deploy do - desc 'Restart application' task :restart do on roles(:app), in: :sequence, wait: 5 do @@ -39,5 +38,4 @@ end after :finishing, 'deploy:cleanup' - end From 117bec49583da861bd5ac5790305617fa9bca040 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 12 Nov 2017 20:41:49 +0100 Subject: [PATCH 247/415] use new bitcoinaverage api + rubocop warnings --- app/helpers/application_helper.rb | 129 +++++++++++++++--------------- 1 file changed, 65 insertions(+), 64 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 17672b77..61a8134f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,8 +1,8 @@ module ApplicationHelper - def btc_human amount, options = {} + def btc_human(amount, options = {}) amount ||= 0 - nobr = options.has_key?(:nobr) ? options[:nobr] : true - denom = options.has_key?(:denom) ? options[:denom] : (try(:current_user) ? current_user.denom : 0) + nobr = options.key?(:nobr) ? options[:nobr] : true + denom = options.key?(:denom) ? options[:denom] : (try(:current_user) ? current_user.denom : 0) if denom === 0 btc = to_btc(amount) elsif denom === 1 @@ -54,135 +54,136 @@ def btc_human amount, options = {} btc.html_safe end - def to_btc satoshies - "%.8f Ƀ" % (1.0*satoshies.to_i/1e8) + def to_btc(satoshies) + format('%.8f Ƀ', (1.0 * satoshies.to_i / 1e8)) end - def to_mbtc satoshies - "%.5f mɃ" % (1.0*satoshies.to_i/1e5) + def to_mbtc(satoshies) + format('%.5f mɃ', (1.0 * satoshies.to_i / 1e5)) end - def to_ubtc satoshies - "%.2f μɃ" % (1.0*satoshies.to_i/1e2) + def to_ubtc(satoshies) + format('%.2f μɃ', (1.0 * satoshies.to_i / 1e2)) end - def to_satoshi satoshies - "%.0f Satoshi" % satoshies + def to_satoshi(satoshies) + format('%.0f Satoshi', satoshies) end - def to_usd satoshies - "$%.2f" % rate("USD", satoshies) + def to_usd(satoshies) + format('$%.2f', rate('USD', satoshies)) end - def to_aud satoshies - "$%.2f" % rate("AUD", satoshies) + def to_aud(satoshies) + format('$%.2f', rate('AUD', satoshies)) end - def to_eur satoshies - "%.2f€" % rate("EUR", satoshies) + def to_eur(satoshies) + format('%.2f€', rate('EUR', satoshies)) end - def to_brl satoshies - "R$%.2f" % rate("BRL", satoshies) + def to_brl(satoshies) + format('R$%.2f', rate('BRL', satoshies)) end - def to_cad satoshies - "$%.2f" % rate("CAD", satoshies) + def to_cad(satoshies) + format('$%.2f', rate('CAD', satoshies)) end - def to_cny satoshies - "%.2f¥" % rate("CNY", satoshies) + def to_cny(satoshies) + format('%.2f¥', rate('CNY', satoshies)) end - def to_gbp satoshies - "%.2f£" % rate("GBP", satoshies) + def to_gbp(satoshies) + format('%.2f£', rate('GBP', satoshies)) end - def to_idr satoshies - "%.2f Rp" % rate("IDR", satoshies) + def to_idr(satoshies) + format('%.2f Rp', rate('IDR', satoshies)) end - def to_ils satoshies - "%.2f₪" % rate("ILS", satoshies) + def to_ils(satoshies) + format('%.2f₪', rate('ILS', satoshies)) end - def to_jpy satoshies - "%.2f¥" % rate("JPY", satoshies) + def to_jpy(satoshies) + format('%.2f¥', rate('JPY', satoshies)) end - def to_mxn satoshies - "%.2f MXN" % rate("MXN", satoshies) + def to_mxn(satoshies) + format('%.2f MXN', rate('MXN', satoshies)) end - def to_nok satoshies - "%.2f kr" % rate("NOK", satoshies) + def to_nok(satoshies) + format('%.2f kr', rate('NOK', satoshies)) end - def to_nzd satoshies - "$%.2f" % rate("NZD", satoshies) + def to_nzd(satoshies) + format('$%.2f', rate('NZD', satoshies)) end - def to_pln satoshies - "%.2f zł" % rate("PLN", satoshies) + def to_pln(satoshies) + format('%.2f zł', rate('PLN', satoshies)) end - def to_ron satoshies - "%.2f lei" % rate("RON", satoshies) + def to_ron(satoshies) + format('%.2f lei', rate('RON', satoshies)) end - def to_rub satoshies - "%.2f₽" % rate("RUB", satoshies) + def to_rub(satoshies) + format('%.2f₽', rate('RUB', satoshies)) end - def to_sek satoshies - "%.2f kr" % rate("SEK", satoshies) + def to_sek(satoshies) + format('%.2f kr', rate('SEK', satoshies)) end - def to_sgd satoshies - "%.2f S$" % rate("SGD", satoshies) + def to_sgd(satoshies) + format('%.2f S$', rate('SGD', satoshies)) end - def to_zar satoshies - "%.2f R" % rate("ZAR", satoshies) + def to_zar(satoshies) + format('%.2f R', rate('ZAR', satoshies)) end def rate(currency, satoshies) - satoshies*0.00000001*get_rate(currency) + satoshies * 0.00000001 * get_rate(currency) end def get_rate(currency) - Rails.cache.fetch("###" + currency, :expires_in => 24.hours) do - uri = URI('https://api.bitcoinaverage.com/ticker/' + currency + '/') + Rails.cache.fetch('###' + currency, expires_in: 24.hours) do + uri = URI('https://apiv2.bitcoinaverage.com/indices/global/ticker/BTC' + currency) response = Net::HTTP.get_response(uri) hash = JSON.parse(response.body) - hash["24h_avg"] + hash['averages']['day'] end end def render_flash_messages html = [] - flash.each do |_type, _message| - alert_type = case _type - when 'notice' then :success - when 'alert', 'error' then :danger - end - html << content_tag(:div, class: "alert alert-#{alert_type}"){ _message } + flash.each do |type, message| + alert_type = case type + when 'notice' then :success + when 'alert', 'error' then :danger + end + html << content_tag(:div, class: "alert alert-#{alert_type}") { message } end html.join("\n").html_safe end def commit_tag(sha1) - content_tag(:span, truncate(sha1, length: 10, omission: ""), class: "commit-sha") + content_tag(:span, truncate(sha1, length: 10, omission: ''), class: 'commit-sha') end - def list_friendly_text a_list , conjunction + def list_friendly_text(a_list, conjunction) # e.g. ['a'] => "a" # ['a','b'] => "a or b" # ['a','b','c'] => "a, b, or c" - list = a_list.map { |ea| ea.to_s } ; last = list.pop ; + list = a_list.map(&:to_s) + last = list.pop (list.join ', ') + - ((list.size < 2) ? "" : ",") + - ((list.empty?) ? "" : " #{conjunction} ") + last + (list.size < 2 ? '' : ',') + + (list.empty? ? '' : " #{conjunction} ") + last end def block_explorer_tx_url(txid) From a56fecdd9d6b10065e7b78a672027a5b2dd6d9c7 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 12 Nov 2017 20:44:41 +0100 Subject: [PATCH 248/415] convert string to float --- app/helpers/application_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 61a8134f..1c7f04c9 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -155,7 +155,7 @@ def get_rate(currency) uri = URI('https://apiv2.bitcoinaverage.com/indices/global/ticker/BTC' + currency) response = Net::HTTP.get_response(uri) hash = JSON.parse(response.body) - hash['averages']['day'] + hash['averages']['day'].to_f end end From dab832f25fd5fd802ed09e60c2314dfd020c8afa Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 12 Nov 2017 22:17:17 +0100 Subject: [PATCH 249/415] set active job adapter to sidekiq + fixed rubocop warnings --- config/application.rb | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/config/application.rb b/config/application.rb index 7c35a615..96f7ab1a 100644 --- a/config/application.rb +++ b/config/application.rb @@ -7,26 +7,26 @@ Bundler.require(:default, Rails.env) # load config.yaml preprocessed -CONFIG ||= YAML::load(ERB.new(File.read("config/config.yml")).result) +CONFIG ||= YAML.safe_load(ERB.new(File.read('config/config.yml')).result) module T4c class Application < Rails::Application - - # Settings in config/environments/* take precedence over those specified here. - # Application configuration should go into files in config/initializers - # -- all .rb files in that directory are automatically loaded. - - # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. - # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. - # config.time_zone = 'Central Time (US & Canada)' - - # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. - # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] - # config.i18n.default_locale = :de - - config.autoload_paths += %W(#{config.root}/lib) - config.assets.initialize_on_precompile = true - config.available_locales = %w(en fr nl ru pl hr de ro) + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. + # config.time_zone = 'Central Time (US & Canada)' + + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. + # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] + # config.i18n.default_locale = :de + + config.autoload_paths += %W[#{config.root}/lib] + config.assets.initialize_on_precompile = true + config.available_locales = %w[en fr nl ru pl hr de ro] + config.active_job.queue_adapter = :sidekiq end end From 80f091660f0ddb36a182014f56bd17754453ff7e Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 12 Nov 2017 22:50:54 +0100 Subject: [PATCH 250/415] updated octokit and bundled vcr --- Gemfile | 6 ++++-- Gemfile.lock | 35 ++++++++++++++++++++++++----------- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/Gemfile b/Gemfile index 181857ca..efdebaf4 100644 --- a/Gemfile +++ b/Gemfile @@ -25,14 +25,14 @@ gem 'kaminari-i18n' gem 'less-rails', '~> 2.4.2' gem 'money-tree', '~> 0.9.0' gem 'mysql2', group: :production -gem 'octokit', '~> 2.7.0' +gem 'octokit', '~> 4.7.0' gem 'omniauth', '~> 1.1.4' gem 'omniauth-github', github: 'alexandrz/omniauth-github', branch: 'provide_emails' gem 'rails-i18n', '~> 4.0.0' gem 'render_csv' gem 'rest-client' gem 'sass-rails', '~> 4.0.0' -gem 'sawyer', '~> 0.5.2' +gem 'sawyer', '~> 0.8.0' gem 'sdoc', group: :doc, require: false gem 'sidekiq' gem 'therubyracer', '~> 0.12.2', platforms: :ruby @@ -65,4 +65,6 @@ group :test do gem 'rspec-activemodel-mocks' gem 'shoulda-matchers', '~> 3.1' gem 'simplecov' + gem 'webmock' + gem 'vcr' end diff --git a/Gemfile.lock b/Gemfile.lock index 04e0286e..09052b33 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -77,7 +77,8 @@ GEM minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - addressable (2.3.5) + addressable (2.5.2) + public_suffix (>= 2.0.2, < 4.0) airbrake (3.1.15) builder multi_json @@ -115,6 +116,8 @@ GEM commonjs (0.2.7) concurrent-ruby (1.0.5) connection_pool (2.2.0) + crack (0.4.3) + safe_yaml (~> 1.0.0) crass (1.0.2) cucumber (1.3.20) builder (>= 2.1.2) @@ -155,8 +158,8 @@ GEM factory_girl_rails (4.3.0) factory_girl (~> 4.3.0) railties (>= 3.0.0) - faraday (0.8.9) - multipart-post (~> 1.2.0) + faraday (0.13.1) + multipart-post (>= 1.2, < 3) ffi (1.9.18) gherkin (2.12.2) multi_json (~> 1.3) @@ -169,6 +172,7 @@ GEM activesupport (>= 4.0.1) haml (>= 3.1, < 5.0) railties (>= 4.0.1) + hashdiff (0.3.7) hashie (2.0.5) hike (1.2.3) http-cookie (1.0.2) @@ -216,7 +220,7 @@ GEM ffi multi_json (1.12.2) multi_test (0.1.2) - multipart-post (1.2.0) + multipart-post (2.0.0) mysql2 (0.3.14) net-scp (1.2.1) net-ssh (>= 2.6.5) @@ -230,8 +234,8 @@ GEM jwt (~> 0.1.4) multi_json (~> 1.0) rack (~> 1.2) - octokit (2.7.0) - sawyer (~> 0.5.2) + octokit (4.7.0) + sawyer (~> 0.8.0, >= 0.5.3) omniauth (1.1.4) hashie (>= 1.2, < 3) rack @@ -239,6 +243,7 @@ GEM oauth2 (~> 0.8.0) omniauth (~> 1.0) orm_adapter (0.5.0) + public_suffix (3.0.1) rack (1.6.8) rack-test (0.6.3) rack (>= 1.0) @@ -307,14 +312,15 @@ GEM rspec-mocks (~> 3.5.0) rspec-support (~> 3.5.0) rspec-support (3.5.0) + safe_yaml (1.0.4) sass (3.2.13) sass-rails (4.0.1) railties (>= 4.0.0, < 5.0) sass (>= 3.1.10) sprockets-rails (~> 2.0.0) - sawyer (0.5.2) - addressable (~> 2.3.5) - faraday (~> 0.8, < 0.10) + sawyer (0.8.1) + addressable (>= 2.3.5, < 2.6) + faraday (~> 0.8, < 1.0) sdoc (0.4.0) json (~> 1.8) rdoc (~> 4.0, < 5.0) @@ -358,8 +364,13 @@ GEM unf (0.1.4) unf_ext unf_ext (0.0.7.1) + vcr (3.0.3) warden (1.2.3) rack (>= 1.0) + webmock (3.1.0) + addressable (>= 2.3.6) + crack (>= 0.3.2) + hashdiff xpath (2.0.0) nokogiri (~> 1.3) @@ -396,7 +407,7 @@ DEPENDENCIES less-rails (~> 2.4.2) money-tree (~> 0.9.0) mysql2 - octokit (~> 2.7.0) + octokit (~> 4.7.0) omniauth (~> 1.1.4) omniauth-github! rails (= 4.2.10) @@ -408,7 +419,7 @@ DEPENDENCIES rspec-activemodel-mocks rspec-rails (~> 3.5.0) sass-rails (~> 4.0.0) - sawyer (~> 0.5.2) + sawyer (~> 0.8.0) sdoc shoulda-matchers (~> 3.1) sidekiq @@ -419,6 +430,8 @@ DEPENDENCIES twitter-bootstrap-rails! twitter_bootstrap_form_for! uglifier (>= 1.3.0) + vcr + webmock RUBY VERSION ruby 2.4.2p198 From c174a4febd4650c27a8f668ea0d8c4f0f9456795 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 12 Nov 2017 22:52:50 +0100 Subject: [PATCH 251/415] added vcr support to cucumber and mocked 3rd party requests --- ...s_accessible_via_nickname_to_that_user.yml | 199 ++++++++++++++++++ ..._accessible_via_user_name_to_that_user.yml | 199 ++++++++++++++++++ ...rganization_should_show_project_avatar.yml | 74 +++++++ features/find_project.feature | 1 + features/pretty_paths.feature | 2 + features/support/env.rb | 4 +- features/support/vcr_setup.rb | 12 ++ 7 files changed, 489 insertions(+), 2 deletions(-) create mode 100644 features/cassettes/The_site_routes_pretty_paths_uniformly/User_show_page_is_accessible_via_nickname_to_that_user.yml create mode 100644 features/cassettes/The_site_routes_pretty_paths_uniformly/User_show_page_is_accessible_via_user_name_to_that_user.yml create mode 100644 features/cassettes/Visitors_may_search_for_and_add_projects/Projects_owned_by_an_organization_should_show_project_avatar.yml create mode 100644 features/support/vcr_setup.rb diff --git a/features/cassettes/The_site_routes_pretty_paths_uniformly/User_show_page_is_accessible_via_nickname_to_that_user.yml b/features/cassettes/The_site_routes_pretty_paths_uniformly/User_show_page_is_accessible_via_nickname_to_that_user.yml new file mode 100644 index 00000000..d79080f7 --- /dev/null +++ b/features/cassettes/The_site_routes_pretty_paths_uniformly/User_show_page_is_accessible_via_nickname_to_that_user.yml @@ -0,0 +1,199 @@ +--- +http_interactions: +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Sun, 12 Nov 2017 21:40:24 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Sun, 12 Nov 2017 21:40:24 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Sun, 12 Nov 2017 21:40:24 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Sun, 12 Nov 2017 21:40:25 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Sun, 12 Nov 2017 21:40:25 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Sun, 12 Nov 2017 21:40:25 GMT +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Sun, 12 Nov 2017 21:40:25 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Sun, 12 Nov 2017 21:40:25 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Sun, 12 Nov 2017 21:40:25 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Sun, 12 Nov 2017 21:40:25 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Sun, 12 Nov 2017 21:40:25 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Sun, 12 Nov 2017 21:40:25 GMT +recorded_with: VCR 3.0.3 diff --git a/features/cassettes/The_site_routes_pretty_paths_uniformly/User_show_page_is_accessible_via_user_name_to_that_user.yml b/features/cassettes/The_site_routes_pretty_paths_uniformly/User_show_page_is_accessible_via_user_name_to_that_user.yml new file mode 100644 index 00000000..e4f37278 --- /dev/null +++ b/features/cassettes/The_site_routes_pretty_paths_uniformly/User_show_page_is_accessible_via_user_name_to_that_user.yml @@ -0,0 +1,199 @@ +--- +http_interactions: +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Sun, 12 Nov 2017 21:40:22 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Sun, 12 Nov 2017 21:40:22 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Sun, 12 Nov 2017 21:40:22 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Sun, 12 Nov 2017 21:40:23 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Sun, 12 Nov 2017 21:40:23 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Sun, 12 Nov 2017 21:40:23 GMT +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Sun, 12 Nov 2017 21:40:23 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Sun, 12 Nov 2017 21:40:23 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Sun, 12 Nov 2017 21:40:23 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Sun, 12 Nov 2017 21:40:24 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Sun, 12 Nov 2017 21:40:24 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Sun, 12 Nov 2017 21:40:24 GMT +recorded_with: VCR 3.0.3 diff --git a/features/cassettes/Visitors_may_search_for_and_add_projects/Projects_owned_by_an_organization_should_show_project_avatar.yml b/features/cassettes/Visitors_may_search_for_and_add_projects/Projects_owned_by_an_organization_should_show_project_avatar.yml new file mode 100644 index 00000000..b895cbb8 --- /dev/null +++ b/features/cassettes/Visitors_may_search_for_and_add_projects/Projects_owned_by_an_organization_should_show_project_avatar.yml @@ -0,0 +1,74 @@ +--- +http_interactions: +- request: + method: get + uri: https://api.github.com/repos/tip4commit/tip4commit?client_id=111111111111&client_secret=111111111111 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/vnd.github.v3+json + User-Agent: + - Octokit Ruby Gem 4.7.0 + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Server: + - GitHub.com + Date: + - Sun, 12 Nov 2017 21:37:40 GMT + Content-Type: + - application/json; charset=utf-8 + Transfer-Encoding: + - chunked + Status: + - 200 OK + X-Ratelimit-Limit: + - '60' + X-Ratelimit-Remaining: + - '58' + X-Ratelimit-Reset: + - '1510526170' + Cache-Control: + - public, max-age=60, s-maxage=60 + Vary: + - Accept + Etag: + - W/"9136158723e4192ed1a473fa2e6a28a4" + Last-Modified: + - Sun, 12 Nov 2017 10:40:50 GMT + X-Github-Media-Type: + - github.v3; format=json + Access-Control-Expose-Headers: + - ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, + X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval + Access-Control-Allow-Origin: + - "*" + Content-Security-Policy: + - default-src 'none' + Strict-Transport-Security: + - max-age=31536000; includeSubdomains; preload + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + X-Xss-Protection: + - 1; mode=block + X-Runtime-Rack: + - '0.033402' + X-Github-Request-Id: + - 92F5:7E2F:32A3DE3:6966BA6:5A08BF24 + body: + encoding: ASCII-8BIT + string: '{"id":15898794,"name":"tip4commit","full_name":"tip4commit/tip4commit","owner":{"login":"tip4commit","id":6398353,"avatar_url":"https://avatars3.githubusercontent.com/u/6398353?v=4","gravatar_id":"","url":"https://api.github.com/users/tip4commit","html_url":"https://github.com/tip4commit","followers_url":"https://api.github.com/users/tip4commit/followers","following_url":"https://api.github.com/users/tip4commit/following{/other_user}","gists_url":"https://api.github.com/users/tip4commit/gists{/gist_id}","starred_url":"https://api.github.com/users/tip4commit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tip4commit/subscriptions","organizations_url":"https://api.github.com/users/tip4commit/orgs","repos_url":"https://api.github.com/users/tip4commit/repos","events_url":"https://api.github.com/users/tip4commit/events{/privacy}","received_events_url":"https://api.github.com/users/tip4commit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tip4commit/tip4commit","description":"Donate + bitcoins to open source projects or make commits and get tips for it.","fork":false,"url":"https://api.github.com/repos/tip4commit/tip4commit","forks_url":"https://api.github.com/repos/tip4commit/tip4commit/forks","keys_url":"https://api.github.com/repos/tip4commit/tip4commit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tip4commit/tip4commit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tip4commit/tip4commit/teams","hooks_url":"https://api.github.com/repos/tip4commit/tip4commit/hooks","issue_events_url":"https://api.github.com/repos/tip4commit/tip4commit/issues/events{/number}","events_url":"https://api.github.com/repos/tip4commit/tip4commit/events","assignees_url":"https://api.github.com/repos/tip4commit/tip4commit/assignees{/user}","branches_url":"https://api.github.com/repos/tip4commit/tip4commit/branches{/branch}","tags_url":"https://api.github.com/repos/tip4commit/tip4commit/tags","blobs_url":"https://api.github.com/repos/tip4commit/tip4commit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tip4commit/tip4commit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tip4commit/tip4commit/git/refs{/sha}","trees_url":"https://api.github.com/repos/tip4commit/tip4commit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tip4commit/tip4commit/statuses/{sha}","languages_url":"https://api.github.com/repos/tip4commit/tip4commit/languages","stargazers_url":"https://api.github.com/repos/tip4commit/tip4commit/stargazers","contributors_url":"https://api.github.com/repos/tip4commit/tip4commit/contributors","subscribers_url":"https://api.github.com/repos/tip4commit/tip4commit/subscribers","subscription_url":"https://api.github.com/repos/tip4commit/tip4commit/subscription","commits_url":"https://api.github.com/repos/tip4commit/tip4commit/commits{/sha}","git_commits_url":"https://api.github.com/repos/tip4commit/tip4commit/git/commits{/sha}","comments_url":"https://api.github.com/repos/tip4commit/tip4commit/comments{/number}","issue_comment_url":"https://api.github.com/repos/tip4commit/tip4commit/issues/comments{/number}","contents_url":"https://api.github.com/repos/tip4commit/tip4commit/contents/{+path}","compare_url":"https://api.github.com/repos/tip4commit/tip4commit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tip4commit/tip4commit/merges","archive_url":"https://api.github.com/repos/tip4commit/tip4commit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tip4commit/tip4commit/downloads","issues_url":"https://api.github.com/repos/tip4commit/tip4commit/issues{/number}","pulls_url":"https://api.github.com/repos/tip4commit/tip4commit/pulls{/number}","milestones_url":"https://api.github.com/repos/tip4commit/tip4commit/milestones{/number}","notifications_url":"https://api.github.com/repos/tip4commit/tip4commit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tip4commit/tip4commit/labels{/name}","releases_url":"https://api.github.com/repos/tip4commit/tip4commit/releases{/id}","deployments_url":"https://api.github.com/repos/tip4commit/tip4commit/deployments","created_at":"2014-01-14T10:26:24Z","updated_at":"2017-11-12T10:40:50Z","pushed_at":"2017-11-12T19:58:10Z","git_url":"git://github.com/tip4commit/tip4commit.git","ssh_url":"git@github.com:tip4commit/tip4commit.git","clone_url":"https://github.com/tip4commit/tip4commit.git","svn_url":"https://github.com/tip4commit/tip4commit","homepage":"https://tip4commit.com/","size":735,"stargazers_count":141,"watchers_count":141,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":97,"mirror_url":null,"archived":false,"open_issues_count":48,"forks":97,"open_issues":48,"watchers":141,"default_branch":"master","organization":{"login":"tip4commit","id":6398353,"avatar_url":"https://avatars3.githubusercontent.com/u/6398353?v=4","gravatar_id":"","url":"https://api.github.com/users/tip4commit","html_url":"https://github.com/tip4commit","followers_url":"https://api.github.com/users/tip4commit/followers","following_url":"https://api.github.com/users/tip4commit/following{/other_user}","gists_url":"https://api.github.com/users/tip4commit/gists{/gist_id}","starred_url":"https://api.github.com/users/tip4commit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tip4commit/subscriptions","organizations_url":"https://api.github.com/users/tip4commit/orgs","repos_url":"https://api.github.com/users/tip4commit/repos","events_url":"https://api.github.com/users/tip4commit/events{/privacy}","received_events_url":"https://api.github.com/users/tip4commit/received_events","type":"Organization","site_admin":false},"network_count":97,"subscribers_count":17}' + http_version: + recorded_at: Sun, 12 Nov 2017 21:37:40 GMT +recorded_with: VCR 3.0.3 diff --git a/features/find_project.feature b/features/find_project.feature index a39da4ce..bb868046 100644 --- a/features/find_project.feature +++ b/features/find_project.feature @@ -44,6 +44,7 @@ Feature: Visitors may search for and add projects And I should see "seldon/seldons-project" And there should not be a project avatar image visible + @vcr-ignore-params Scenario: Projects owned by an organization should show project avatar Given a "real-github" project named "tip4commit/tip4commit" exists And I visit the "projects" page diff --git a/features/pretty_paths.feature b/features/pretty_paths.feature index 8501491b..760dcdc2 100644 --- a/features/pretty_paths.feature +++ b/features/pretty_paths.feature @@ -128,6 +128,7 @@ Feature: The site routes pretty paths uniformly Then I should be on the "home" page And I should see "You are not authorized to perform this action" + @vcr Scenario: User show page is accessible via user name to that user Given I'm signed in as "seldon" When I visit the "seldon user" page @@ -136,6 +137,7 @@ Feature: The site routes pretty paths uniformly And I should see "E-mail seldon@example.com" And I should see "Bitcoin address" + @vcr Scenario: User show page is accessible via nickname to that user Given I'm signed in as "seldon" When I browse to the explicit path "users/seldon" diff --git a/features/support/env.rb b/features/support/env.rb index 5a4dbb04..7b03a8f5 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -5,6 +5,7 @@ # files. require 'minitest/autorun' require 'cucumber/rails' +require 'webmock/cucumber' # Capybara defaults to CSS3 selectors rather than XPath. # If you'd prefer to use XPath, just uncomment this line and adjust any @@ -33,7 +34,7 @@ begin DatabaseCleaner.strategy = :transaction rescue NameError - raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it." + raise 'You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it.' end # You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios. @@ -55,4 +56,3 @@ # The :transaction strategy is faster, but might give you threading problems. # See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature Cucumber::Rails::Database.javascript_strategy = :truncation - diff --git a/features/support/vcr_setup.rb b/features/support/vcr_setup.rb new file mode 100644 index 00000000..1513e025 --- /dev/null +++ b/features/support/vcr_setup.rb @@ -0,0 +1,12 @@ +require 'vcr' + +VCR.configure do |c| + c.cassette_library_dir = 'features/cassettes' + c.hook_into :webmock + c.ignore_localhost = true +end + +VCR.cucumber_tags do |t| + t.tag '@vcr', use_scenario_name: true + t.tag '@vcr-ignore-params', use_scenario_name: true, match_requests_on: %i[method host path] +end From d3e33b69f6c3d31a813b5e0f2709756f6d52caf3 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 25 Nov 2017 10:37:39 +0100 Subject: [PATCH 252/415] updated omniauth --- Gemfile | 2 +- Gemfile.lock | 35 +++++++++++++++++------------------ 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/Gemfile b/Gemfile index efdebaf4..26e5568c 100644 --- a/Gemfile +++ b/Gemfile @@ -26,7 +26,7 @@ gem 'less-rails', '~> 2.4.2' gem 'money-tree', '~> 0.9.0' gem 'mysql2', group: :production gem 'octokit', '~> 4.7.0' -gem 'omniauth', '~> 1.1.4' +gem 'omniauth', '~> 1.7.1' gem 'omniauth-github', github: 'alexandrz/omniauth-github', branch: 'provide_emails' gem 'rails-i18n', '~> 4.0.0' gem 'render_csv' diff --git a/Gemfile.lock b/Gemfile.lock index 09052b33..e9f587c4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -158,7 +158,7 @@ GEM factory_girl_rails (4.3.0) factory_girl (~> 4.3.0) railties (>= 3.0.0) - faraday (0.13.1) + faraday (0.12.2) multipart-post (>= 1.2, < 3) ffi (1.9.18) gherkin (2.12.2) @@ -173,12 +173,11 @@ GEM haml (>= 3.1, < 5.0) railties (>= 4.0.1) hashdiff (0.3.7) - hashie (2.0.5) + hashie (3.5.6) hike (1.2.3) http-cookie (1.0.2) domain_name (~> 0.5) http_accept_language (2.0.2) - httpauth (0.2.1) i18n (0.9.1) concurrent-ruby (~> 1.0) i18n-js (2.1.2) @@ -193,8 +192,7 @@ GEM railties (>= 3.1.0) turbolinks json (1.8.6) - jwt (0.1.11) - multi_json (>= 1.5) + jwt (1.5.6) kaminari (0.15.0) actionpack (>= 3.0.0) activesupport (>= 3.0.0) @@ -220,6 +218,7 @@ GEM ffi multi_json (1.12.2) multi_test (0.1.2) + multi_xml (0.6.0) multipart-post (2.0.0) mysql2 (0.3.14) net-scp (1.2.1) @@ -228,20 +227,20 @@ GEM netrc (0.11.0) nokogiri (1.8.1) mini_portile2 (~> 2.3.0) - oauth2 (0.8.1) - faraday (~> 0.8) - httpauth (~> 0.1) - jwt (~> 0.1.4) - multi_json (~> 1.0) - rack (~> 1.2) + oauth2 (1.4.0) + faraday (>= 0.8, < 0.13) + jwt (~> 1.0) + multi_json (~> 1.3) + multi_xml (~> 0.5) + rack (>= 1.2, < 3) octokit (4.7.0) sawyer (~> 0.8.0, >= 0.5.3) - omniauth (1.1.4) - hashie (>= 1.2, < 3) - rack - omniauth-oauth2 (1.1.1) - oauth2 (~> 0.8.0) - omniauth (~> 1.0) + omniauth (1.7.1) + hashie (>= 3.4.6, < 3.6.0) + rack (>= 1.6.2, < 3) + omniauth-oauth2 (1.4.0) + oauth2 (~> 1.0) + omniauth (~> 1.2) orm_adapter (0.5.0) public_suffix (3.0.1) rack (1.6.8) @@ -408,7 +407,7 @@ DEPENDENCIES money-tree (~> 0.9.0) mysql2 octokit (~> 4.7.0) - omniauth (~> 1.1.4) + omniauth (~> 1.7.1) omniauth-github! rails (= 4.2.10) rails-i18n (~> 4.0.0) From 68a6913425baa98fb42fc1167198905c148a3c90 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 25 Nov 2017 10:39:52 +0100 Subject: [PATCH 253/415] updated jquery-rails --- Gemfile | 2 +- Gemfile.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index 26e5568c..2ca86ae4 100644 --- a/Gemfile +++ b/Gemfile @@ -18,7 +18,7 @@ gem 'haml-rails', '~> 0.5.3' gem 'http_accept_language' gem 'i18n-js' gem 'jbuilder', '~> 1.5.3' -gem 'jquery-rails', '~> 3.0.4' +gem 'jquery-rails', '~> 3.1' gem 'jquery-turbolinks' gem 'kaminari', '~> 0.15.0' gem 'kaminari-i18n' diff --git a/Gemfile.lock b/Gemfile.lock index e9f587c4..a44127ee 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -118,7 +118,7 @@ GEM connection_pool (2.2.0) crack (0.4.3) safe_yaml (~> 1.0.0) - crass (1.0.2) + crass (1.0.3) cucumber (1.3.20) builder (>= 2.1.2) diff-lcs (>= 1.1.3) @@ -185,7 +185,7 @@ GEM jbuilder (1.5.3) activesupport (>= 3.0.0) multi_json (>= 1.2.0) - jquery-rails (3.0.4) + jquery-rails (3.1.4) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) jquery-turbolinks (2.0.1) @@ -273,7 +273,7 @@ GEM activesupport (= 4.2.10) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (12.2.1) + rake (12.3.0) rbnacl (3.4.0) ffi rbnacl-libsodium (1.0.11) @@ -399,7 +399,7 @@ DEPENDENCIES http_accept_language i18n-js jbuilder (~> 1.5.3) - jquery-rails (~> 3.0.4) + jquery-rails (~> 3.1) jquery-turbolinks kaminari (~> 0.15.0) kaminari-i18n From 3d9febb466dd1cd68eb0ae461f7b73e2e39ebc5f Mon Sep 17 00:00:00 2001 From: Seungwon Park Date: Sun, 26 Nov 2017 15:36:45 +0900 Subject: [PATCH 254/415] Add Korean translation to locale --- config/locales/ko.yml | 235 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 235 insertions(+) create mode 100644 config/locales/ko.yml diff --git a/config/locales/ko.yml b/config/locales/ko.yml new file mode 100644 index 00000000..8b339c29 --- /dev/null +++ b/config/locales/ko.yml @@ -0,0 +1,235 @@ +ko: + tip4commit: Tip4Commit + meta: + title: 오픈소스 기여하기 + description: 오픈소스 프로젝트에 비트코인을 기부하거나 직접 커밋하여 팁을 받으세요. + menu: + home: 홈 + projects: 지원되는 프로젝트들 + footer: + text: "소스 코드는 %{github_link}에 있으며, 그의 개발에 %{support_link}할 수 있습니다." + github_link: GitHub + support_link: 기여 + follow_link: \@tip4commit 팔로우 + links: + sign_up: 회원가입 + sign_in: 로그인 + sign_in_imp: 로그인 + sign_out: 로그아웃 + create_issue: 이슈 제기 + errors: + project_not_found: 찾고자 하는 프로젝트가 없습니다. + opt_in_notice: "프로젝트 담당자들의 이의제기로 인하여, 프로젝트들은 여기에 더 이상 자동으로 추가되지 않습니다. + 잔고가 없는 프로젝트들은 삭제되었습니다. 당신의 프로젝트를 여기에 추가하고 싶다면, %{create_issue_link}해주세요. + " + access_denied: 권한 없음 + can_assign_more_tips: "잔고의 100%보다 많은 양을 할당할 수 없습니다." + wrong_bitcoin_address: 비트코인 주소를 업데이트하던 중 에러 발생 + user_not_found: 유저를 찾을 수 없음 + access_denied: 실행 권한이 없습니다. + notices: + project_updated: 프로젝트 설정이 변경되었습니다. + tips_decided: 팁의 액수가 지정되었습니다. + user_updated: 정보가 저장되었습니다. + user_unsubscribed: "탈퇴하셨군요! 번거롭게 해 드려 죄송합니다. 하지만, 당신의 팁을 얻기 위해 당신의 비트코인 계좌를 남겨둘 수 있습니다." + tip_amounts: + undecided: "지정되지 않음" + free: "팁 없음: 0%" + tiny: "매우 조금: 0.1%" + small: "조금: 0.5%" + normal: "보통: 1%" + big: "많이: 2%" + huge: "매우 많이: 5%" + js: + errors: + value: + invalid: 값이 올바르지 않습니다. + email: + invalid: 이메일 주소가 명확하지 않습니다. + blank: 이메일 주소는 반드시 입력되어야 합니다. + password: + blank: 비밀번호는 반드시 입력되어야 합니다. + invalid: 비밀번호 확인란이 비밀번호와 일치하지 않습니다. + password_confirmation: + blank: 비밀번호 확인란은 반드시 입력되어야 합니다. + invalid: 비밀번호 확인란이 비밀번호와 일치하지 않습니다. + home: + index: + see_projects: 프로젝트 보기 + how_does_it_work: + title: 작동 원리 + text: 우선, 사람들이 프로젝트에 비트코인을 기부합니다. 그 후, 누군가의 커밋이 프로젝트에 반영된다면, 이 웹사이트에서 자동적으로 해당 개발자에게 팁을 지급합니다. + button: 비트코인이란? + donate: + title: 기부하기 + text: 마음에 드는 프로젝트를 골라 비트코인을 기부하세요. 당신의 기부금은 다른 사람들의 기부금과 함께 새로운 커밋에 대한 팁으로 사용될 것입니다. + button: 프로젝트 찾기/추가하기 + contribute: + title: 기여하기 + text: 무언가를 고쳐 보세요! 당신의 커밋이 프로젝트 담당자에 의해 반영된다면, 당신은 팁을 얻을 것입니다! + sign_in_text: "초대나 회원 가입을 위해 이메일을 확인해보세요." + sign_up_text: "아직 초대를 받지 못했다면, 이메일로 회원가입할 수 있습니다." + button: 프로젝트 보기 + projects: + index: + find_project: + placeholder: 찾고자 하는 GitHub 프로젝트의 URL이나 키워드 입력 + button: 프로젝트 찾기 + repository: Repository + description: 설명 + watchers: Watchers + balance: 잔고 + forked_from: forked from + support: 프로젝트 보기 + show: + title: "%{project}에 기여" + fetch_pending: (초기 패치 대기중) + edit_project: 프로젝트 설정 변경 + decide_tip_amounts: 팁 액수 지정 + disabled_notifications: "프로젝트 담당자들은 새로운 기여자들에게 팁에 대해 알리지 않기로 했고, 아마 그들은 이런 식으로 지원받는 것을 원치 않을 것입니다." + fee: "잔고의 %{percentage} 가 새로운 커밋에 대한 팁으로 사용될 것입니다." + balance: 잔고 + deposits: 지급 내역 + custom_tip_size: (각각의 커밋에 대해 잔고의 몇 퍼센트가 지급됩니다.) + default_tip_size: "(각각의 커밋에 대해 잔고의 %{percentage}가 지급됩니다.)" + min_tip_size: "최소 팁 액수는 %{min_tip}이며, 잔고가 그보다 적을 경우 그만큼 더 적은 팁이 지급됩니다." + unconfirmed_amount: "(%{amount} 지정되지 않음)" + tipping_policies: 팁 지급 정책 + updated_by_user: "(%{name}에 의해 %{date}에 마지막으로 업데이트됨)" + updated_by_unknown: "(%{date}에 마지막으로 업데이트됨)" + tips_paid: 지급된 팁 액수 + unclaimed_amount: "(%{amount}의 액수가 수령되지 않았으며, 1달동안 수령하지 않을 경우 프로젝트에 반환될 것입니다.)" + last_tips: 가장 최근 팁 액수 + see_all: 모두 보기 + received: "%{amount}를 받음" + will_receive: 를 받을 예정 + for_commit: (커밋당) + when_decided: 액수가 지정되고 났을 때 + next_tip: 다음 팁 + contribute_and_earn: 기여하고 얻기 + contribute_and_earn_description: "이 프로젝트에 비트코인을 기부하거나, %{make_commits_link}하여 팁을 얻으세요. 당신의 커밋이 %{branch}에 프로젝트 담당자에 의해 반영되고, 프로젝트 잔고가 있다면, 당신은 팁을 받을 것입니다." + contribute_and_earn_branch: "to %{branch} branch" + make_commits_link: 커밋하기 + tell_us_bitcoin_address: "당신의 비트코인 계좌를 %{tell_us_link}하세요." + tell_us_link: 입력 + sign_in: "이메일을 확인하거나 %{sign_in_link}." + promote_project: \%{project} 홍보하기 + embedding: 임베딩 + image_url: "사진 URL:" + shield_title: 다음 커밋을 위한 팁 액수 + edit: + project_settings: "%{project} 설정" + branch: 브랜치 + default_branch: 기본 브랜치 + tipping_policies: 팁 지급 정책 + hold_tips: "팁을 즉시 기여하기보다는, 저자에게 팁을 조정하게 하세요." + save: 프로젝트 설정 변경사항 저장 + disable_notifications: 새 기여자에게 알리지 말기 + decide_tip_amounts: + commit: 커밋 + author: 저자 + message: 메시지 + tip: 팁 (프로젝트 잔고에 대한) + submit: 선택한 팁 액수 송금하기 + blacklisted: + title: 죄송합니다. 이 프로젝트는 팁을 지급하지 않습니다. + message: 이 프로젝트의 저자는 이 프로젝트에 대해 팁을 지급하지 않기로 결정했습니다. + tips: + index: + tips: 팁 내역 + project_tips: '%{project} 팁' + user_tips: "%{user} 팁 내역" + created_at: 생성 시각 + commiter: 저자 + project: 프로젝트 + commit: 커밋 + amount: 양 + refunded: 프로젝트 잔고에 반환됨 + undecided: 팁의 액수가 지정되지 않음 + no_bitcoin_address: 유저가 출금계좌를 설정하지 않음 + below_threshold: "유저의 잔고가 최소 출금액수보다 적음" + waiting: 출금 대기중 + error: (송금 중 에러 발생) + deposits: + index: + project_deposits: '%{project} 지급 내역' + deposits: 지급 내역 + created_at: 생성 시각 + project: 프로젝트 + amount: 양 + transaction: 송금 + confirmed: 확인됨 + confirmed_yes: 'Yes' + confirmed_no: 'No' + users: + index: + title: 기여자 순위 + name: 이름 + commits_count: 팁이 지급된 커밋 + withdrawn: 취소됨 + show: + balance: 잔고 + threshold: "최소 %{threshold}보다 클 경우 돈을 지급받게 됩니다." + see_all: 모두 보기 + received: "%{time}에 %{amount}를 %{project}에서의 %{commit}으로 받음" + bitcoin_address_placeholder: 비트코인 계좌 + notify: 새 정보에 대한 알림(1달에 1개 이하의 이메일) + submit_user: 유저 정보 수정 + change_password: 비밀번호 변경 + submit_password: 비밀번호 변경 + use_from_gravatar: Gravatr 프로필 사용 + withdrawals: + index: + title: 최근 출금 + created_at: 생성 시각 + transaction: 송금 + result: 결과 + error: 실패 + success: 성공 + devise: + sessions: + new: + title: 로그인 + remember_me: 유저 기억 + submit: 로그인 + registrations: + new: + title: 회원가입 + submit: 회원가입 + passwords: + new: + title: 비밀번호 찾기 + submit: 비밀번호 재설정 + edit: + title: 비밀번호 변경 + submit: 비밀번호 변경 + confirmations: + new: + title: 확인 절차 재전송 + submit: 확인 절차 재전송 + links: + sign_in: 로그인 + sign_up: 회원가입 + recover: 비밀번호 찾기 + confirm: 확인 절차 재전송 + sign_in_with: "%{provider}으로 로그인" + errors: + primary_email: 이메일이 확인되어야 합니다. + onmiauth_info: 유저 정보 확인 실패 + activerecord: + attributes: + user: + email: 이메일 + bitcoin_address: 비트코인 계좌번호 + password: 비밀번호 + password_confirmation: 비밀번호 확인 + display_name: 닉네임 + omniauth_providers: + github: GitHub + bitbucket: BitBucket + general: + or: 또는 + disclaimer: + line1: "Tip4Commit은 대부분의 프로젝트에 해당되지 않습니다." + line2: "개발자에 의해 팁이 지급될 것이라고 보장하지 못합니다." + line3: "당신이 돈을 기부함으로써, 당신은 그 돈이 Free Software Foundation이나 Tip4Commit에 사용될 수 있음에 동의하게 됩니다." From 901f94cc315ded6bef23eddbcc0d333719d62f39 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 26 Nov 2017 09:54:01 +0100 Subject: [PATCH 255/415] enabled korean locale --- app/assets/images/flags/kr.png | Bin 0 -> 592 bytes config/application.rb | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 app/assets/images/flags/kr.png diff --git a/app/assets/images/flags/kr.png b/app/assets/images/flags/kr.png new file mode 100644 index 0000000000000000000000000000000000000000..9c0a78eb942da568f9cdac7190c17e23cceda7ed GIT binary patch literal 592 zcmV-W0k7RCwBA z{P_JV0}}Z6?;n_iu%H+Q{s1vR05Jij`8c?M=-GouSI=K${m;n9!7aeW#m~(x$j!^i z%zXLG*~fS9it_V|2?zl-00a;V#NgMjUvJ&I^~3uQB4T37ii-d5-u?gQ&wmw_XD?o^ zUAsm=P*7M%NJdr`Xazt3fo%By|Nn;%AAbM-ZD?YwEG7BBxA%WR!T-FR|8><0Vxn$d zUT@yKdH&)BP#Mq$fB<3y`hl076R7Rgt5;mSyo`Gea7>-}|M%}Nf0%y${3VbO@hKwm zAWK?W z+TGp#<;$01Vv<1pdP-ancZ!Qkd3bmLHK?nrgX5I}Ab=R3zkQ1wk#LIP517FKVgLC9 eRt>}e0R{ktF&Q^6#MUGL0000 Date: Sun, 3 Dec 2017 12:06:07 +0100 Subject: [PATCH 256/415] renamed korean locale --- app/assets/images/flags/{kr.png => ko.png} | Bin config/application.rb | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename app/assets/images/flags/{kr.png => ko.png} (100%) diff --git a/app/assets/images/flags/kr.png b/app/assets/images/flags/ko.png similarity index 100% rename from app/assets/images/flags/kr.png rename to app/assets/images/flags/ko.png diff --git a/config/application.rb b/config/application.rb index 05243c97..69ca1e2a 100644 --- a/config/application.rb +++ b/config/application.rb @@ -25,7 +25,7 @@ class Application < Rails::Application config.autoload_paths += %W[#{config.root}/lib] config.assets.initialize_on_precompile = true - config.available_locales = %w[en fr nl ru pl hr de ro kr] + config.available_locales = %w[en fr nl ru pl hr de ro ko] config.active_job.queue_adapter = :sidekiq end end From af770276e615e204a42770d3491d9e2c6a614d23 Mon Sep 17 00:00:00 2001 From: Merco Date: Wed, 6 Dec 2017 16:49:02 -0800 Subject: [PATCH 257/415] Reformated No offense, but it looked really ugly. FTFY --- public/javascripts/translations.js | 513 ++++++++++++++++++++++++++++- 1 file changed, 512 insertions(+), 1 deletion(-) diff --git a/public/javascripts/translations.js b/public/javascripts/translations.js index 0f19fce3..52967aad 100644 --- a/public/javascripts/translations.js +++ b/public/javascripts/translations.js @@ -1,2 +1,513 @@ var I18n = I18n || {}; -I18n.translations = {"en":{"date":{"formats":{"default":"%Y-%m-%d","short":"%b %d","long":"%B %d, %Y"},"day_names":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"abbr_day_names":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"month_names":[null,"January","February","March","April","May","June","July","August","September","October","November","December"],"abbr_month_names":[null,"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],"order":["year","month","day"]},"time":{"formats":{"default":"%a, %d %b %Y %H:%M:%S %z","short":"%d %b %H:%M","long":"%B %d, %Y %H:%M"},"am":"am","pm":"pm"},"support":{"array":{"words_connector":", ","two_words_connector":" and ","last_word_connector":", and "}},"number":{"format":{"separator":".","delimiter":",","precision":3,"significant":false,"strip_insignificant_zeros":false},"currency":{"format":{"format":"%u%n","unit":"$","separator":".","delimiter":",","precision":2,"significant":false,"strip_insignificant_zeros":false}},"percentage":{"format":{"delimiter":"","format":"%n%"}},"precision":{"format":{"delimiter":""}},"human":{"format":{"delimiter":"","precision":3,"significant":true,"strip_insignificant_zeros":true},"storage_units":{"format":"%n %u","units":{"byte":{"one":"Byte","other":"Bytes"},"kb":"KB","mb":"MB","gb":"GB","tb":"TB"}},"decimal_units":{"format":"%n %u","units":{"unit":"","thousand":"Thousand","million":"Million","billion":"Billion","trillion":"Trillion","quadrillion":"Quadrillion"}}}},"errors":{"format":"%{attribute} %{message}","messages":{"inclusion":"is not included in the list","exclusion":"is reserved","invalid":"is invalid","confirmation":"doesn't match %{attribute}","accepted":"must be accepted","empty":"can't be empty","blank":"can't be blank","present":"must be blank","too_long":"is too long (maximum is %{count} characters)","too_short":"is too short (minimum is %{count} characters)","wrong_length":"is the wrong length (should be %{count} characters)","not_a_number":"is not a number","not_an_integer":"must be an integer","greater_than":"must be greater than %{count}","greater_than_or_equal_to":"must be greater than or equal to %{count}","equal_to":"must be equal to %{count}","less_than":"must be less than %{count}","less_than_or_equal_to":"must be less than or equal to %{count}","other_than":"must be other than %{count}","odd":"must be odd","even":"must be even","taken":"has already been taken","already_confirmed":"was already confirmed, please try signing in","confirmation_period_expired":"needs to be confirmed within %{period}, please request a new one","expired":"has expired, please request a new one","not_found":"not found","not_locked":"was not locked","not_saved":{"one":"1 error prohibited this %{resource} from being saved:","other":"%{count} errors prohibited this %{resource} from being saved:"}},"project_not_found":"Project not found.","access_denied":"You are not authorized to perform this action!","can_assign_more_tips":"You can't assign more than 100% of available funds.","wrong_bitcoin_address":"Error updating bitcoin address","user_not_found":"User not found"},"activerecord":{"errors":{"messages":{"record_invalid":"Validation failed: %{errors}","restrict_dependent_destroy":{"one":"Cannot delete record because a dependent %{record} exists","many":"Cannot delete record because dependent %{record} exist"}}},"attributes":{"user":{"email":"E-mail","bitcoin_address":"Bitcoin address","password":"Password","password_confirmation":"Password confirmation"}}},"datetime":{"distance_in_words":{"half_a_minute":"half a minute","less_than_x_seconds":{"one":"less than 1 second","other":"less than %{count} seconds"},"x_seconds":{"one":"1 second","other":"%{count} seconds"},"less_than_x_minutes":{"one":"less than a minute","other":"less than %{count} minutes"},"x_minutes":{"one":"1 minute","other":"%{count} minutes"},"about_x_hours":{"one":"about 1 hour","other":"about %{count} hours"},"x_days":{"one":"1 day","other":"%{count} days"},"about_x_months":{"one":"about 1 month","other":"about %{count} months"},"x_months":{"one":"1 month","other":"%{count} months"},"about_x_years":{"one":"about 1 year","other":"about %{count} years"},"over_x_years":{"one":"over 1 year","other":"over %{count} years"},"almost_x_years":{"one":"almost 1 year","other":"almost %{count} years"}},"prompts":{"year":"Year","month":"Month","day":"Day","hour":"Hour","minute":"Minute","second":"Seconds"}},"helpers":{"select":{"prompt":"Please select"},"submit":{"create":"Create %{model}","update":"Update %{model}","submit":"Save %{model}"},"page_entries_info":{"one_page":{"display_entries":{"zero":"No %{entry_name} found","one":"Displaying \u003Cb\u003E1\u003C/b\u003E %{entry_name}","other":"Displaying \u003Cb\u003Eall %{count}\u003C/b\u003E %{entry_name}"}},"more_pages":{"display_entries":"Displaying %{entry_name} \u003Cb\u003E%{first}\u0026nbsp;-\u0026nbsp;%{last}\u003C/b\u003E of \u003Cb\u003E%{total}\u003C/b\u003E in total"}},"actions":"Actions","links":{"back":"Back","cancel":"Cancel","confirm":"Are you sure?","destroy":"Delete","new":"New","edit":"Edit"},"titles":{"edit":"Edit %{model}","save":"Save %{model}","new":"New %{model}","delete":"Delete %{model}"}},"views":{"pagination":{"first":"\u0026laquo; First","last":"Last \u0026raquo;","previous":"\u0026lsaquo; Prev","next":"Next \u0026rsaquo;","truncate":"\u0026hellip;"}},"devise":{"confirmations":{"confirmed":"Your account was successfully confirmed. Please sign in.","send_instructions":"You will receive an email with instructions about how to confirm your account in a few minutes.","send_paranoid_instructions":"If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes.","confirmed_and_signed_in":"Your account was successfully confirmed. You are now signed in.","new":{"title":"Resend confirmation instructions","submit":"Resend confirmation instructions"}},"failure":{"already_authenticated":"You are already signed in.","inactive":"Your account is not activated yet.","invalid":"Invalid email or password.","locked":"Your account is locked.","last_attempt":"You have one more attempt before your account will be locked.","not_found_in_database":"Invalid email or password.","timeout":"Your session expired. Please sign in again to continue.","unauthenticated":"You need to sign in or sign up before continuing.","unconfirmed":"You have to confirm your account before continuing.","invalid_token":"Invalid authentication token."},"mailer":{"confirmation_instructions":{"subject":"Confirmation instructions"},"reset_password_instructions":{"subject":"Reset password instructions"},"unlock_instructions":{"subject":"Unlock Instructions"}},"omniauth_callbacks":{"failure":"Could not authenticate you from %{kind} because \"%{reason}\".","success":"Successfully authenticated from %{kind} account."},"passwords":{"no_token":"You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided.","send_instructions":"You will receive an email with instructions about how to reset your password in a few minutes.","send_paranoid_instructions":"If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes.","updated":"Your password was changed successfully. You are now signed in.","updated_not_active":"Your password was changed successfully.","new":{"title":"Forgot your password?","submit":"Send me reset password instructions"},"edit":{"title":"Change your password","submit":"Change my password"}},"registrations":{"destroyed":"Bye! Your account was successfully cancelled. We hope to see you again soon.","signed_up":"Welcome! You have signed up successfully.","signed_up_but_inactive":"You have signed up successfully. However, we could not sign you in because your account is not yet activated.","signed_up_but_locked":"You have signed up successfully. However, we could not sign you in because your account is locked.","signed_up_but_unconfirmed":"A message with a confirmation link has been sent to your email address. Please open the link to activate your account.","update_needs_confirmation":"You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address.","updated":"You updated your account successfully.","new":{"title":"Sign up","submit":"Sign up"}},"sessions":{"signed_in":"Signed in successfully.","signed_out":"Signed out successfully.","new":{"title":"Sign in","remember_me":"Remember me","submit":"Sign in"}},"unlocks":{"send_instructions":"You will receive an email with instructions about how to unlock your account in a few minutes.","send_paranoid_instructions":"If your account exists, you will receive an email with instructions about how to unlock it in a few minutes.","unlocked":"Your account has been unlocked successfully. Please sign in to continue."},"links":{"sign_in":"Sign in","sign_up":"Sign up","recover":"Forgot your password?","confirm":"Didn't receive confirmation instructions?","sign_in_with":"Sign in with %{provider}"},"errors":{"primary_email":"your primary email address should be verified.","onmiauth_info":"we were unable to fetch your information."}},"tip4commit":"Tip4Commit","meta":{"title":"Contribute to Open Source","description":"Donate bitcoins to open source projects or make commits and get tips for it."},"menu":{"home":"Home","projects":"Supported Projects"},"footer":{"text":"Source code is available at %{github_link} and you can also %{support_link} its development.","github_link":"GitHub","support_link":"support","follow_link":"Follow @tip4commit"},"links":{"sign_in":"Sign in","sign_out":"Sign Out"},"notices":{"project_updated":"The project settings have been updated","tips_decided":"The tip amounts have been defined","user_updated":"Your information saved!","user_unsubscribed":"You unsubscribed! Sorry for bothering you. Although, you still can leave us your bitcoin address to get your tips."},"tip_amounts":{"undecided":"Undecided","free":"Free: 0%","tiny":"Tiny: 0.1%","small":"Small: 0.5%","normal":"Normal: 1%","big":"Big: 2%","huge":"Huge: 5%"},"home":{"index":{"see_projects":"See projects","how_does_it_work":{"title":"How does it work?","text":"People donate bitcoins to projects. When someone's commit is accepted into the project repository, we automatically tip the author.","button":"Learn about Bitcoin"},"donate":{"title":"Donate","text":"Find a project you like and deposit bitcoins into it. Your donation will be accumulated with the funds of other donators to give as tips for new commits.","button":"Find or add a project"},"contribute":{"title":"Contribute","text":"Go and fix something! If your commit is accepted by the project maintainer, you will get a tip!","sign_in_text":"Just check your email or %{sign_in_link}.","button":"Supported projects"}}},"projects":{"index":{"find_project":{"placeholder":"Enter GitHub project URL to find or add a project e.g. rails/rails","button":"Find or add project"},"repository":"Repository","description":"Description","watchers":"Watchers","balance":"Balance","forked_from":"forked from","support":"Support"},"show":{"title":"Contribute to %{project}","edit_project":"Change project settings","decide_tip_amounts":"Decide tip amounts","project_sponsors":"Project Sponsors","fee":"%{percentage} of deposited funds will be used to tip for new commits.","balance":"Balance","custom_tip_size":"(each new commit receives a percentage of available balance)","default_tip_size":"(each new commit receives %{percentage} of available balance)","unconfirmed_amount":"(%{amount} unconfirmed)","tipping_policies":"Tipping policies","updated_by_user":"(Last updated by %{name} on %{date})","updated_by_unknown":"(Last updated on %{date})","tips_paid":"Tips Paid","unclaimed_amount":"(%{amount} of this is unclaimed, and will be refunded to the project after being unclaimed for 1 month.)","last_tips":"Last Tips","see_all":"see all","received":"received %{amount}","will_receive":"will receive a tip","for_commit":"for commit","when_decided":"when its amount is decided","next_tip":"Next Tip","contribute_and_earn":"Contribute and Earn","cocontribute_and_earn_description":"Donate bitcoins to this project or %{make_commits_link} and get tips for it. If your commit is accepted by the project maintainer and there are bitcoins on its balance, you will get a tip!","make_commits_link":"make commits","tell_us_bitcoin_address":"Just %{tell_us_link} your bitcoin address.","tell_us_link":"tell us","sign_in":"Just check your email or %{sign_in_link}.","promote_project":"Promote %{project}","embedding":"Embedding","image_url":"Image URL:","shield_title":"tip for next commit"},"edit":{"project_settings":"%{project} project settings","tipping_policies":"Tipping policies","hold_tips":"Do not send the tips immediatly. Give collaborators the ability to modify the tips before they're sent","save":"Save the project settings"},"decide_tip_amounts":{"commit":"Commit","author":"Author","message":"Message","tip":"Tip (relative to the project balance)","submit":"Send the selected tip amounts"}},"tips":{"index":{"tips":"Tips","project_tips":"%{project} tips","user_tips":"%{user} tips","created_at":"Created At","commiter":"Commiter","project":"Project","commit":"Commit","amount":"Amount","refunded":"Refunded to project's deposit","undecided":"The amount of the tip has not been decided yet","no_bitcoin_address":"User didn't specify withdrawal address","below_threshold":"User's balance is below withdrawal threshold","waiting":"Waiting for withdrawal","error":"(error sending transaction)"}},"users":{"index":{"title":"Top Contributors","name":"Name","commits_count":"Commits tipped","withdrawn":"Withdrawn"},"show":{"balance":"Balance","threshold":"You will get your money when your balance hits the threshold of %{threshold}","see_all":"see all","received":"%{time} received %{amount} for commit %{commit} in %{project}","bitcoin_address_placeholder":"Your bitcoin address","notify":"Notify me about new tips (no more than one email per month)","submit_bitcoin_address":"Update Bitcoin address","change_password":"Change your password","submit_password":"Change my password"}},"withdrawals":{"index":{"title":"Last Withdrawals","created_at":"Created At","transaction":"Transaction","result":"Result","error":"Error","success":"Success"}}}}; \ No newline at end of file +I18n.translations = { + "en": { + "date": { + "formats": { + "default": "%Y-%m-%d", + "short": "%b %d", + "long": "%B %d, %Y" + }, + "day_names": ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], + "abbr_day_names": ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + "month_names": [null, "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], + "abbr_month_names": [null, "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], + "order": ["year", "month", "day"] + }, + "time": { + "formats": { + "default": "%a, %d %b %Y %H:%M:%S %z", + "short": "%d %b %H:%M", + "long": "%B %d, %Y %H:%M" + }, + "am": "am", + "pm": "pm" + }, + "support": { + "array": { + "words_connector": ", ", + "two_words_connector": " and ", + "last_word_connector": ", and " + } + }, + "number": { + "format": { + "separator": ".", + "delimiter": ",", + "precision": 3, + "significant": false, + "strip_insignificant_zeros": false + }, + "currency": { + "format": { + "format": "%u%n", + "unit": "$", + "separator": ".", + "delimiter": ",", + "precision": 2, + "significant": false, + "strip_insignificant_zeros": false + } + }, + "percentage": { + "format": { + "delimiter": "", + "format": "%n%" + } + }, + "precision": { + "format": { + "delimiter": "" + } + }, + "human": { + "format": { + "delimiter": "", + "precision": 3, + "significant": true, + "strip_insignificant_zeros": true + }, + "storage_units": { + "format": "%n %u", + "units": { + "byte": { + "one": "Byte", + "other": "Bytes" + }, + "kb": "KB", + "mb": "MB", + "gb": "GB", + "tb": "TB" + } + }, + "decimal_units": { + "format": "%n %u", + "units": { + "unit": "", + "thousand": "Thousand", + "million": "Million", + "billion": "Billion", + "trillion": "Trillion", + "quadrillion": "Quadrillion" + } + } + } + }, + "errors": { + "format": "%{attribute} %{message}", + "messages": { + "inclusion": "is not included in the list", + "exclusion": "is reserved", + "invalid": "is invalid", + "confirmation": "doesn't match %{attribute}", + "accepted": "must be accepted", + "empty": "can't be empty", + "blank": "can't be blank", + "present": "must be blank", + "too_long": "is too long (maximum is %{count} characters)", + "too_short": "is too short (minimum is %{count} characters)", + "wrong_length": "is the wrong length (should be %{count} characters)", + "not_a_number": "is not a number", + "not_an_integer": "must be an integer", + "greater_than": "must be greater than %{count}", + "greater_than_or_equal_to": "must be greater than or equal to %{count}", + "equal_to": "must be equal to %{count}", + "less_than": "must be less than %{count}", + "less_than_or_equal_to": "must be less than or equal to %{count}", + "other_than": "must be other than %{count}", + "odd": "must be odd", + "even": "must be even", + "taken": "has already been taken", + "already_confirmed": "was already confirmed, please try signing in", + "confirmation_period_expired": "needs to be confirmed within %{period}, please request a new one", + "expired": "has expired, please request a new one", + "not_found": "not found", + "not_locked": "was not locked", + "not_saved": { + "one": "1 error prohibited this %{resource} from being saved:", + "other": "%{count} errors prohibited this %{resource} from being saved:" + } + }, + "project_not_found": "Project not found.", + "access_denied": "You are not authorized to perform this action!", + "can_assign_more_tips": "You can't assign more than 100% of available funds.", + "wrong_bitcoin_address": "Error updating bitcoin address", + "user_not_found": "User not found" + }, + "activerecord": { + "errors": { + "messages": { + "record_invalid": "Validation failed: %{errors}", + "restrict_dependent_destroy": { + "one": "Cannot delete record because a dependent %{record} exists", + "many": "Cannot delete record because dependent %{record} exist" + } + } + }, + "attributes": { + "user": { + "email": "E-mail", + "bitcoin_address": "Bitcoin address", + "password": "Password", + "password_confirmation": "Password confirmation" + } + } + }, + "datetime": { + "distance_in_words": { + "half_a_minute": "half a minute", + "less_than_x_seconds": { + "one": "less than 1 second", + "other": "less than %{count} seconds" + }, + "x_seconds": { + "one": "1 second", + "other": "%{count} seconds" + }, + "less_than_x_minutes": { + "one": "less than a minute", + "other": "less than %{count} minutes" + }, + "x_minutes": { + "one": "1 minute", + "other": "%{count} minutes" + }, + "about_x_hours": { + "one": "about 1 hour", + "other": "about %{count} hours" + }, + "x_days": { + "one": "1 day", + "other": "%{count} days" + }, + "about_x_months": { + "one": "about 1 month", + "other": "about %{count} months" + }, + "x_months": { + "one": "1 month", + "other": "%{count} months" + }, + "about_x_years": { + "one": "about 1 year", + "other": "about %{count} years" + }, + "over_x_years": { + "one": "over 1 year", + "other": "over %{count} years" + }, + "almost_x_years": { + "one": "almost 1 year", + "other": "almost %{count} years" + } + }, + "prompts": { + "year": "Year", + "month": "Month", + "day": "Day", + "hour": "Hour", + "minute": "Minute", + "second": "Seconds" + } + }, + "helpers": { + "select": { + "prompt": "Please select" + }, + "submit": { + "create": "Create %{model}", + "update": "Update %{model}", + "submit": "Save %{model}" + }, + "page_entries_info": { + "one_page": { + "display_entries": { + "zero": "No %{entry_name} found", + "one": "Displaying \u003Cb\u003E1\u003C/b\u003E %{entry_name}", + "other": "Displaying \u003Cb\u003Eall %{count}\u003C/b\u003E %{entry_name}" + } + }, + "more_pages": { + "display_entries": "Displaying %{entry_name} \u003Cb\u003E%{first}\u0026nbsp;-\u0026nbsp;%{last}\u003C/b\u003E of \u003Cb\u003E%{total}\u003C/b\u003E in total" + } + }, + "actions": "Actions", + "links": { + "back": "Back", + "cancel": "Cancel", + "confirm": "Are you sure?", + "destroy": "Delete", + "new": "New", + "edit": "Edit" + }, + "titles": { + "edit": "Edit %{model}", + "save": "Save %{model}", + "new": "New %{model}", + "delete": "Delete %{model}" + } + }, + "views": { + "pagination": { + "first": "\u0026laquo; First", + "last": "Last \u0026raquo;", + "previous": "\u0026lsaquo; Prev", + "next": "Next \u0026rsaquo;", + "truncate": "\u0026hellip;" + } + }, + "devise": { + "confirmations": { + "confirmed": "Your account was successfully confirmed. Please sign in.", + "send_instructions": "You will receive an email with instructions about how to confirm your account in a few minutes.", + "send_paranoid_instructions": "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes.", + "confirmed_and_signed_in": "Your account was successfully confirmed. You are now signed in.", + "new": { + "title": "Resend confirmation instructions", + "submit": "Resend confirmation instructions" + } + }, + "failure": { + "already_authenticated": "You are already signed in.", + "inactive": "Your account is not activated yet.", + "invalid": "Invalid email or password.", + "locked": "Your account is locked.", + "last_attempt": "You have one more attempt before your account will be locked.", + "not_found_in_database": "Invalid email or password.", + "timeout": "Your session expired. Please sign in again to continue.", + "unauthenticated": "You need to sign in or sign up before continuing.", + "unconfirmed": "You have to confirm your account before continuing.", + "invalid_token": "Invalid authentication token." + }, + "mailer": { + "confirmation_instructions": { + "subject": "Confirmation instructions" + }, + "reset_password_instructions": { + "subject": "Reset password instructions" + }, + "unlock_instructions": { + "subject": "Unlock Instructions" + } + }, + "omniauth_callbacks": { + "failure": "Could not authenticate you from %{kind} because \"%{reason}\".", + "success": "Successfully authenticated from %{kind} account." + }, + "passwords": { + "no_token": "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided.", + "send_instructions": "You will receive an email with instructions about how to reset your password in a few minutes.", + "send_paranoid_instructions": "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes.", + "updated": "Your password was changed successfully. You are now signed in.", + "updated_not_active": "Your password was changed successfully.", + "new": { + "title": "Forgot your password?", + "submit": "Send me reset password instructions" + }, + "edit": { + "title": "Change your password", + "submit": "Change my password" + } + }, + "registrations": { + "destroyed": "Bye! Your account was successfully cancelled. We hope to see you again soon.", + "signed_up": "Welcome! You have signed up successfully.", + "signed_up_but_inactive": "You have signed up successfully. However, we could not sign you in because your account is not yet activated.", + "signed_up_but_locked": "You have signed up successfully. However, we could not sign you in because your account is locked.", + "signed_up_but_unconfirmed": "A message with a confirmation link has been sent to your email address. Please open the link to activate your account.", + "update_needs_confirmation": "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address.", + "updated": "You updated your account successfully.", + "new": { + "title": "Sign up", + "submit": "Sign up" + } + }, + "sessions": { + "signed_in": "Signed in successfully.", + "signed_out": "Signed out successfully.", + "new": { + "title": "Sign in", + "remember_me": "Remember me", + "submit": "Sign in" + } + }, + "unlocks": { + "send_instructions": "You will receive an email with instructions about how to unlock your account in a few minutes.", + "send_paranoid_instructions": "If your account exists, you will receive an email with instructions about how to unlock it in a few minutes.", + "unlocked": "Your account has been unlocked successfully. Please sign in to continue." + }, + "links": { + "sign_in": "Sign in", + "sign_up": "Sign up", + "recover": "Forgot your password?", + "confirm": "Didn't receive confirmation instructions?", + "sign_in_with": "Sign in with %{provider}" + }, + "errors": { + "primary_email": "your primary email address should be verified.", + "onmiauth_info": "we were unable to fetch your information." + } + }, + "tip4commit": "Tip4Commit", + "meta": { + "title": "Contribute to Open Source", + "description": "Donate bitcoins to open source projects or make commits and get tips for it." + }, + "menu": { + "home": "Home", + "projects": "Supported Projects" + }, + "footer": { + "text": "Source code is available at %{github_link} and you can also %{support_link} its development.", + "github_link": "GitHub", + "support_link": "support", + "follow_link": "Follow @tip4commit" + }, + "links": { + "sign_in": "Sign in", + "sign_out": "Sign Out" + }, + "notices": { + "project_updated": "The project settings have been updated", + "tips_decided": "The tip amounts have been defined", + "user_updated": "Your information saved!", + "user_unsubscribed": "You unsubscribed! Sorry for bothering you. Although, you still can leave us your bitcoin address to get your tips." + }, + "tip_amounts": { + "undecided": "Undecided", + "free": "Free: 0%", + "tiny": "Tiny: 0.1%", + "small": "Small: 0.5%", + "normal": "Normal: 1%", + "big": "Big: 2%", + "huge": "Huge: 5%" + }, + "home": { + "index": { + "see_projects": "See projects", + "how_does_it_work": { + "title": "How does it work?", + "text": "People donate bitcoins to projects. When someone's commit is accepted into the project repository, we automatically tip the author.", + "button": "Learn about Bitcoin" + }, + "donate": { + "title": "Donate", + "text": "Find a project you like and deposit bitcoins into it. Your donation will be accumulated with the funds of other donators to give as tips for new commits.", + "button": "Find or add a project" + }, + "contribute": { + "title": "Contribute", + "text": "Go and fix something! If your commit is accepted by the project maintainer, you will get a tip!", + "sign_in_text": "Just check your email or %{sign_in_link}.", + "button": "Supported projects" + } + } + }, + "projects": { + "index": { + "find_project": { + "placeholder": "Enter GitHub project URL to find or add a project e.g. rails/rails", + "button": "Find or add project" + }, + "repository": "Repository", + "description": "Description", + "watchers": "Watchers", + "balance": "Balance", + "forked_from": "forked from", + "support": "Support" + }, + "show": { + "title": "Contribute to %{project}", + "edit_project": "Change project settings", + "decide_tip_amounts": "Decide tip amounts", + "project_sponsors": "Project Sponsors", + "fee": "%{percentage} of deposited funds will be used to tip for new commits.", + "balance": "Balance", + "custom_tip_size": "(each new commit receives a percentage of available balance)", + "default_tip_size": "(each new commit receives %{percentage} of available balance)", + "unconfirmed_amount": "(%{amount} unconfirmed)", + "tipping_policies": "Tipping policies", + "updated_by_user": "(Last updated by %{name} on %{date})", + "updated_by_unknown": "(Last updated on %{date})", + "tips_paid": "Tips Paid", + "unclaimed_amount": "(%{amount} of this is unclaimed, and will be refunded to the project after being unclaimed for 1 month.)", + "last_tips": "Last Tips", + "see_all": "see all", + "received": "received %{amount}", + "will_receive": "will receive a tip", + "for_commit": "for commit", + "when_decided": "when its amount is decided", + "next_tip": "Next Tip", + "contribute_and_earn": "Contribute and Earn", + "cocontribute_and_earn_description": "Donate bitcoins to this project or %{make_commits_link} and get tips for it. If your commit is accepted by the project maintainer and there are bitcoins on its balance, you will get a tip!", + "make_commits_link": "make commits", + "tell_us_bitcoin_address": "Just %{tell_us_link} your bitcoin address.", + "tell_us_link": "tell us", + "sign_in": "Just check your email or %{sign_in_link}.", + "promote_project": "Promote %{project}", + "embedding": "Embedding", + "image_url": "Image URL:", + "shield_title": "tip for next commit" + }, + "edit": { + "project_settings": "%{project} project settings", + "tipping_policies": "Tipping policies", + "hold_tips": "Do not send the tips immediatly. Give collaborators the ability to modify the tips before they're sent", + "save": "Save the project settings" + }, + "decide_tip_amounts": { + "commit": "Commit", + "author": "Author", + "message": "Message", + "tip": "Tip (relative to the project balance)", + "submit": "Send the selected tip amounts" + } + }, + "tips": { + "index": { + "tips": "Tips", + "project_tips": "%{project} tips", + "user_tips": "%{user} tips", + "created_at": "Created At", + "commiter": "Commiter", + "project": "Project", + "commit": "Commit", + "amount": "Amount", + "refunded": "Refunded to project's deposit", + "undecided": "The amount of the tip has not been decided yet", + "no_bitcoin_address": "User didn't specify withdrawal address", + "below_threshold": "User's balance is below withdrawal threshold", + "waiting": "Waiting for withdrawal", + "error": "(error sending transaction)" + } + }, + "users": { + "index": { + "title": "Top Contributors", + "name": "Name", + "commits_count": "Commits tipped", + "withdrawn": "Withdrawn" + }, + "show": { + "balance": "Balance", + "threshold": "You will get your money when your balance hits the threshold of %{threshold}", + "see_all": "see all", + "received": "%{time} received %{amount} for commit %{commit} in %{project}", + "bitcoin_address_placeholder": "Your bitcoin address", + "notify": "Notify me about new tips (no more than one email per month)", + "submit_bitcoin_address": "Update Bitcoin address", + "change_password": "Change your password", + "submit_password": "Change my password" + } + }, + "withdrawals": { + "index": { + "title": "Last Withdrawals", + "created_at": "Created At", + "transaction": "Transaction", + "result": "Result", + "error": "Error", + "success": "Success" + } + } + } +}; From 3fc45979e69c32b636713e7bc3365e128d649619 Mon Sep 17 00:00:00 2001 From: Merco Date: Wed, 6 Dec 2017 16:56:58 -0800 Subject: [PATCH 258/415] Upload Spanish Flag for Spanish Since Spanish is available as a language, a quick image of the Spain Flag, commonly tied with Spanish language. --- app/assets/images/flags/es.png | Bin 0 -> 338 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 app/assets/images/flags/es.png diff --git a/app/assets/images/flags/es.png b/app/assets/images/flags/es.png new file mode 100644 index 0000000000000000000000000000000000000000..fb67bf4ed1a61abb1cee701cb1f2a42d7cba0aaf GIT binary patch literal 338 zcmV-Y0j>UtP)DqGsWIgNiCGYJj8cnT@0001eNklL|U-Wq9BOiu7LXg-$~-pIc4UM1mKU=LRHmuXZPD|W0oL;)=8<9(gxN$ z?>{3UVid(eoN{=-+L^>9ZbiQ203%UVx3GZ(j`9XyM k*8Z-_Sq_3R&bg5J0uGD_JJY|q#Q*>R07*qoM6N<$g1f(;{{R30 literal 0 HcmV?d00001 From fea0931864f1336ab9ec5ca503be3fc08c5b8cde Mon Sep 17 00:00:00 2001 From: Merco Date: Wed, 6 Dec 2017 17:01:35 -0800 Subject: [PATCH 259/415] Added Spanish to available languages Added Spanish to locale, enabling its use. --- config/application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index 69ca1e2a..c8223951 100644 --- a/config/application.rb +++ b/config/application.rb @@ -25,7 +25,7 @@ class Application < Rails::Application config.autoload_paths += %W[#{config.root}/lib] config.assets.initialize_on_precompile = true - config.available_locales = %w[en fr nl ru pl hr de ro ko] + config.available_locales = %w[en es fr nl ru pl hr de ro ko] config.active_job.queue_adapter = :sidekiq end end From da4aa19127f090268c9b8ef40457bf721a8a5ca8 Mon Sep 17 00:00:00 2001 From: Merco Date: Wed, 6 Dec 2017 17:45:32 -0800 Subject: [PATCH 260/415] Fixed some grammar. --- config/locales/en.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 197f1925..6ba186f1 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -19,7 +19,7 @@ en: create_issue: create an issue errors: project_not_found: Project not found. - opt_in_notice: "Due to complaints from project maintainers we don't add projects automatically anymore. Existing projects without deposits have been removed. If you want to add your project, please %{create_issue_link}." + opt_in_notice: "Due to complaints from project maintainers, we don't add projects automatically anymore. Existing projects without deposits have been removed. If you want to add your project, please %{create_issue_link}." access_denied: Access denied can_assign_more_tips: "You can't assign more than 100% of available funds." wrong_bitcoin_address: Error updating bitcoin address @@ -29,7 +29,7 @@ en: project_updated: The project settings have been updated tips_decided: The tip amounts have been defined user_updated: Your information saved! - user_unsubscribed: "You unsubscribed! Sorry for bothering you. Although, you still can leave us your bitcoin address to get your tips." + user_unsubscribed: "You unsubscribed! Sorry for bothering you. Although, you can still leave us your bitcoin address to get your tips." tip_amounts: undecided: "Undecided" free: "Free: 0%" From b9d06b97afbaf2ca80a53fd4323a250485fbb4c0 Mon Sep 17 00:00:00 2001 From: Merco Date: Wed, 6 Dec 2017 23:30:17 -0800 Subject: [PATCH 261/415] Added Spanish This adds Spanish as an available language. It is not perfect but is accurate overall. It will receive minor updates in the future. --- config/locales/es.txt | 233 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 233 insertions(+) create mode 100644 config/locales/es.txt diff --git a/config/locales/es.txt b/config/locales/es.txt new file mode 100644 index 00000000..f3599582 --- /dev/null +++ b/config/locales/es.txt @@ -0,0 +1,233 @@ +es: + tip4commit: Tip4Commit + meta: + title: Contribuye a cdigo abierto + description: Dona Bitcoins a proyectos de cdigo abierto o haz commits y recibe propinas por ellos. + menu: + home: Inicio + projects: Proyectos soportados + footer: + text: "El cdigo fuente est disponible en %{github_link} y tambin puedes %{support_link} su desarollo." + github_link: GitHub + support_link: apoyar + follow_link: Sguenos en @tip4commit + links: + sign_up: registrar + sign_in: inicia sesin + sign_in_imp: inicie sesin + sign_out: Cerrar Sesin + create_issue: crea un problema + errors: + project_not_found: El proyecto no fue encontrado. + opt_in_notice: "Debido a varias quejas de mantenedores de proyectos, no agregamos proyectos automticamente. Proyectos existentes sin depsitos han sido removidos. Si usted quiere agregar su proyecto, por favor %{create_issue_link}. + access_denied: Acceso rechazado + can_assign_more_tips: "No puede asignar ms de 100% de los fondos disponibles." + wrong_bitcoin_address: Ocurri un error al actualizar su direccin de bitcoin + user_not_found: No se pudo encontrar el usuario + access_denied: Usted no est autorizado para realizar esa accin! + notices: + project_updated: Las configuraciones de su proyecto fueron actualizadas. + tips_decided: La cantidad de propina ha sido definida. + user_updated: La informacin ha sido actualizada. + user_unsubscribed: "Usted ya no recibir notificaciones de nosotros. Nos disculpamos por haberte molestado. Pero an puede dejar su direccin de bitcoin para recibir sus propinas." + tip_amounts: + undecided: "Indeciso" + free: "Gratis: 0%" + tiny: "Diminuto: 0.1%" + small: "Pequeo: 0.5%" + normal: "Normal: 1%" + big: "Grande: 2%" + huge: "Enorme: 5%" + js: + errors: + value: + invalid: Valor no vlido. + email: + invalid: Correo electrnico no vlido. + blank: El correo electrnico es requerido y no puede dejarlo en blanco. + password: + blank: La contrasea es requerida y no puede dejarlo en blanco. + invalid: Su contrasea no es igual a la contrasea de confirmacin. + password_confirmation: + blank: La contrasea de confirmacin es requerida y no puede dejarlo en blanco. + invalid: Su contrasea no es igual a la contrasea de confirmacin. + home: + index: + see_projects: Ver proyectos + how_does_it_work: + title: Como funciona? + text: La gente dona bitcoin a proyectos. Cuando el commit de alguien es agregada al proyecto, nosotros automticamente le damos una propina al autor. + button: Aprende ms sobre Bitcoin + donate: + title: Haz donaciones + text: Encuentra un proyecto que te guste y dnale bitcoins. Su donacin ser acumulada con los fondos de otros donadores para poder darse como propinas para nuevos commits. + button: Busca o agrega un proyecto + contribute: + title: Contribuye + text: Ve y arregla algo. Si tu commit es aceptado por el mantenedor del proyecto, recibirs una propina! + sign_in_text: "Solo cheque su bandeja por una invitacin o %{sign_in_link}." + sign_up_text: "Si usted an no ha recibido una invitacin, se puede %{sign_up_link} con un correo electrnico valido." + button: Proyectos soportados + projects: + index: + find_project: + placeholder: Enlace hacia un proyecto de GitHub o busque + button: Busca proyecto + repository: Repositorio + description: Descripcin + watchers: Seguidores + balance: Balance + forked_from: copiado de + support: Soporta este proyecto + show: + title: "Contribuye a %{project} " + fetch_pending: (Obtencin inicial pendiente) + edit_project: Cambiar ajustes del proyecto + decide_tip_amounts: Decide cantidad de propina + disabled_notifications: "Mantenedores de proyectos han decidido no notificarles a nuevos contribuidores sobre las propinas y probablemente no les guste esta manera de financiamiento." + fee: "%{percentage} de los fondos sern usados como propinas para nuevos commits." + balance: Balance + deposits: depositos + custom_tip_size: (cada nuevo commit recibe un porcentaje del balance disponible) + default_tip_size: "(cada nuevo commit recibe %{percentage} del balance disponible)" + min_tip_size: "La propina mnima es de %{min_tip}, pero si el balance disponible es menor de la propina mnima, una propina ms pequea ser enviada" + unconfirmed_amount: "(%{amount} no confirmado)" + tipping_policies: Poltica de propina + updated_by_user: "(Ultimo cambio por %{name} el %{date})" + updated_by_unknown: "(Ultimo cambio el %{date})" + tips_paid: Propinas pagadas + unclaimed_amount: "(%{amount} no han sido reclamado, y ser devuelto al proyecto despus de un mes sin reclamacion.)" + last_tips: Ultimas propinas + see_all: Ver todas + received: "%{amount} recibi" + will_receive: recibir una propina de + for_commit: por el commit + when_decided: cuando la cantidad sea decidida + next_tip: Siguiente Propina + contribute_and_earn: Contribuye y Gana + contribute_and_earn_description: "Dona Bitcoins a este proyecto o %{make_commits_link} y recibe propinas por ellos. Si tu commit es aceptado %{branch} por un mantenedor de proyecto y hay Bitcoins disponibles, recibirs una propina!" + contribute_and_earn_branch: "al %{branch} branch" + make_commits_link: haz commits + tell_us_bitcoin_address: Solo %{tell_us_link} su direccin de Bitcoin. + tell_us_link: dganos + sign_in: "Solo cheque su bandeja o %{sign_in_link}." + promote_project: Promueve %{project} + embedding: Integraciones + image_url: "Enlace de Imagen:" + shield_title: propina para siguiente commit + edit: + project_settings: "Ajustes del proyecto %{project} " + branch: Branch + default_branch: Branch predeterminado + tipping_policies: Poltica de propina + hold_tips: "No envi las propinas inmediatamente. Dele a los colaboradores la habilidad de modificar las propinas antes que sean enviadas" + save: Actualizar ajustes del proyecto + disable_notifications: No notifique a nuevos contribuidores + decide_tip_amounts: + commit: Commit + author: Autor + message: Mensaje + tip: Propina (relativo al balance del proyecto) + submit: Envia las propinas seleccionadas + blacklisted: + title: Lo sentimos mucho, pero esto proyecto no acepta propinas. + message: El autor de este proyecto ha deshabilitado propinas para este proyecto. + tips: + index: + tips: Consejos + project_tips: 'Consejos de %{project}' + user_tips: "Consejos de %{user}" + created_at: Creado en + commiter: Commiter + project: Proyecto + commit: Commit + amount: Cantidad + refunded: Reembolsado al depsito del proyecto + undecided: La cantidad de la propina an no se ha decidido + no_bitcoin_address: El usuario no especifico una direccin de deposito + below_threshold: "El saldo del usuario no ha superado el umbral de retiro " + waiting: Esperando por el retiro + error: (error al procesar la transaccin) + deposits: + index: + project_deposits: 'Depsitos de %{project}' + deposits: Depsitos + created_at: Creado en + project: Proyecto + amount: Cantidad + transaction: Transaccin + confirmed: Confirmado + confirmed_yes: 'Si' + confirmed_no: 'No' + users: + index: + title: Mayores Contribuidores + name: Nombre + commits_count: Commits propinadas + withdrawn: Retirado + show: + balance: Balance + threshold: "Podrs retirar su dinero cuando su balance llegue al umbral de %{threshold}." + see_all: Ver todos + received: "%{time} recibi %{amount} por el commit %{commit} en %{project} " + bitcoin_address_placeholder: Su direccin de Bitcoin + notify: Notifcame sobre nuevas propinas (no ms de un email por mes) + submit_user: Cambiar informacin de usuario + change_password: Cambie su contrasea + submit_password: Actualizar contrasea + use_from_gravatar: Use el de su cuenta de gravatar + withdrawals: + index: + title: Retiros recientes + created_at: Creado en + transaction: Transaccin + result: Resultado + error: Error + success: Exitoso + devise: + sessions: + new: + title: Iniciar Sesin + remember_me: Recurdame + submit: Iniciar Sesin + registrations: + new: + title: Registracin + submit: Registrar + passwords: + new: + title: Olvido su contrasea? + submit: Mndame instrucciones para resetear mi contrasea + edit: + title: Cambie su contrasea + submit: Actualizar contrasea + confirmations: + new: + title: Mndeme de nuevo instrucciones de confirmacin + submit: Mndeme de nuevo instrucciones de confirmacin + links: + sign_in: Iniciar Sesin + sign_up: Registrar + recover: Olvido su contrasea? + confirm: No recibi instrucciones de confirmacin? + sign_in_with: "Iniciar sesin con %{provider} " + errors: + primary_email: Su correo electrnico primario debe ser verificado. + onmiauth_info: No pudimos obtener tu informacin. + activerecord: + attributes: + user: + email: Correo Electrnico + bitcoin_address: Direccin de Bitcoin + password: Contrasea + password_confirmation: Contrasea de confirmacin + display_name: Nombre publico + omniauth_providers: + github: GitHub + bitbucket: BitBucket + general: + or: O + disclaimer: + line1: "Tip4Commit no est asociado con la mayora de los proyectos." + line2: "No hay ninguna garanta que las propinas sean reclamadas por los desarrolladores." + line3: "Al donar fondos, usted esta de acuerdo que los fondos podrn ser enviados a la fundacin de software gratuito (Free Software Foundation) o a otra parte a nuestra discrecin." From 117e67e89b075e83e0bcec8c8b8bdb5acaaee99a Mon Sep 17 00:00:00 2001 From: Merco Date: Wed, 6 Dec 2017 23:42:07 -0800 Subject: [PATCH 262/415] Removed es.txt Obviously, it has an incorrect name. But most importantly, the file was uploaded with incorrect encoding (`windows-1252`). This ended up breaking all the accents, `n`s with tildes and the upside down question marks. Will re-upload with appropriate encoding and correct name file. --- config/locales/es.txt | 233 ------------------------------------------ 1 file changed, 233 deletions(-) delete mode 100644 config/locales/es.txt diff --git a/config/locales/es.txt b/config/locales/es.txt deleted file mode 100644 index f3599582..00000000 --- a/config/locales/es.txt +++ /dev/null @@ -1,233 +0,0 @@ -es: - tip4commit: Tip4Commit - meta: - title: Contribuye a cdigo abierto - description: Dona Bitcoins a proyectos de cdigo abierto o haz commits y recibe propinas por ellos. - menu: - home: Inicio - projects: Proyectos soportados - footer: - text: "El cdigo fuente est disponible en %{github_link} y tambin puedes %{support_link} su desarollo." - github_link: GitHub - support_link: apoyar - follow_link: Sguenos en @tip4commit - links: - sign_up: registrar - sign_in: inicia sesin - sign_in_imp: inicie sesin - sign_out: Cerrar Sesin - create_issue: crea un problema - errors: - project_not_found: El proyecto no fue encontrado. - opt_in_notice: "Debido a varias quejas de mantenedores de proyectos, no agregamos proyectos automticamente. Proyectos existentes sin depsitos han sido removidos. Si usted quiere agregar su proyecto, por favor %{create_issue_link}. - access_denied: Acceso rechazado - can_assign_more_tips: "No puede asignar ms de 100% de los fondos disponibles." - wrong_bitcoin_address: Ocurri un error al actualizar su direccin de bitcoin - user_not_found: No se pudo encontrar el usuario - access_denied: Usted no est autorizado para realizar esa accin! - notices: - project_updated: Las configuraciones de su proyecto fueron actualizadas. - tips_decided: La cantidad de propina ha sido definida. - user_updated: La informacin ha sido actualizada. - user_unsubscribed: "Usted ya no recibir notificaciones de nosotros. Nos disculpamos por haberte molestado. Pero an puede dejar su direccin de bitcoin para recibir sus propinas." - tip_amounts: - undecided: "Indeciso" - free: "Gratis: 0%" - tiny: "Diminuto: 0.1%" - small: "Pequeo: 0.5%" - normal: "Normal: 1%" - big: "Grande: 2%" - huge: "Enorme: 5%" - js: - errors: - value: - invalid: Valor no vlido. - email: - invalid: Correo electrnico no vlido. - blank: El correo electrnico es requerido y no puede dejarlo en blanco. - password: - blank: La contrasea es requerida y no puede dejarlo en blanco. - invalid: Su contrasea no es igual a la contrasea de confirmacin. - password_confirmation: - blank: La contrasea de confirmacin es requerida y no puede dejarlo en blanco. - invalid: Su contrasea no es igual a la contrasea de confirmacin. - home: - index: - see_projects: Ver proyectos - how_does_it_work: - title: Como funciona? - text: La gente dona bitcoin a proyectos. Cuando el commit de alguien es agregada al proyecto, nosotros automticamente le damos una propina al autor. - button: Aprende ms sobre Bitcoin - donate: - title: Haz donaciones - text: Encuentra un proyecto que te guste y dnale bitcoins. Su donacin ser acumulada con los fondos de otros donadores para poder darse como propinas para nuevos commits. - button: Busca o agrega un proyecto - contribute: - title: Contribuye - text: Ve y arregla algo. Si tu commit es aceptado por el mantenedor del proyecto, recibirs una propina! - sign_in_text: "Solo cheque su bandeja por una invitacin o %{sign_in_link}." - sign_up_text: "Si usted an no ha recibido una invitacin, se puede %{sign_up_link} con un correo electrnico valido." - button: Proyectos soportados - projects: - index: - find_project: - placeholder: Enlace hacia un proyecto de GitHub o busque - button: Busca proyecto - repository: Repositorio - description: Descripcin - watchers: Seguidores - balance: Balance - forked_from: copiado de - support: Soporta este proyecto - show: - title: "Contribuye a %{project} " - fetch_pending: (Obtencin inicial pendiente) - edit_project: Cambiar ajustes del proyecto - decide_tip_amounts: Decide cantidad de propina - disabled_notifications: "Mantenedores de proyectos han decidido no notificarles a nuevos contribuidores sobre las propinas y probablemente no les guste esta manera de financiamiento." - fee: "%{percentage} de los fondos sern usados como propinas para nuevos commits." - balance: Balance - deposits: depositos - custom_tip_size: (cada nuevo commit recibe un porcentaje del balance disponible) - default_tip_size: "(cada nuevo commit recibe %{percentage} del balance disponible)" - min_tip_size: "La propina mnima es de %{min_tip}, pero si el balance disponible es menor de la propina mnima, una propina ms pequea ser enviada" - unconfirmed_amount: "(%{amount} no confirmado)" - tipping_policies: Poltica de propina - updated_by_user: "(Ultimo cambio por %{name} el %{date})" - updated_by_unknown: "(Ultimo cambio el %{date})" - tips_paid: Propinas pagadas - unclaimed_amount: "(%{amount} no han sido reclamado, y ser devuelto al proyecto despus de un mes sin reclamacion.)" - last_tips: Ultimas propinas - see_all: Ver todas - received: "%{amount} recibi" - will_receive: recibir una propina de - for_commit: por el commit - when_decided: cuando la cantidad sea decidida - next_tip: Siguiente Propina - contribute_and_earn: Contribuye y Gana - contribute_and_earn_description: "Dona Bitcoins a este proyecto o %{make_commits_link} y recibe propinas por ellos. Si tu commit es aceptado %{branch} por un mantenedor de proyecto y hay Bitcoins disponibles, recibirs una propina!" - contribute_and_earn_branch: "al %{branch} branch" - make_commits_link: haz commits - tell_us_bitcoin_address: Solo %{tell_us_link} su direccin de Bitcoin. - tell_us_link: dganos - sign_in: "Solo cheque su bandeja o %{sign_in_link}." - promote_project: Promueve %{project} - embedding: Integraciones - image_url: "Enlace de Imagen:" - shield_title: propina para siguiente commit - edit: - project_settings: "Ajustes del proyecto %{project} " - branch: Branch - default_branch: Branch predeterminado - tipping_policies: Poltica de propina - hold_tips: "No envi las propinas inmediatamente. Dele a los colaboradores la habilidad de modificar las propinas antes que sean enviadas" - save: Actualizar ajustes del proyecto - disable_notifications: No notifique a nuevos contribuidores - decide_tip_amounts: - commit: Commit - author: Autor - message: Mensaje - tip: Propina (relativo al balance del proyecto) - submit: Envia las propinas seleccionadas - blacklisted: - title: Lo sentimos mucho, pero esto proyecto no acepta propinas. - message: El autor de este proyecto ha deshabilitado propinas para este proyecto. - tips: - index: - tips: Consejos - project_tips: 'Consejos de %{project}' - user_tips: "Consejos de %{user}" - created_at: Creado en - commiter: Commiter - project: Proyecto - commit: Commit - amount: Cantidad - refunded: Reembolsado al depsito del proyecto - undecided: La cantidad de la propina an no se ha decidido - no_bitcoin_address: El usuario no especifico una direccin de deposito - below_threshold: "El saldo del usuario no ha superado el umbral de retiro " - waiting: Esperando por el retiro - error: (error al procesar la transaccin) - deposits: - index: - project_deposits: 'Depsitos de %{project}' - deposits: Depsitos - created_at: Creado en - project: Proyecto - amount: Cantidad - transaction: Transaccin - confirmed: Confirmado - confirmed_yes: 'Si' - confirmed_no: 'No' - users: - index: - title: Mayores Contribuidores - name: Nombre - commits_count: Commits propinadas - withdrawn: Retirado - show: - balance: Balance - threshold: "Podrs retirar su dinero cuando su balance llegue al umbral de %{threshold}." - see_all: Ver todos - received: "%{time} recibi %{amount} por el commit %{commit} en %{project} " - bitcoin_address_placeholder: Su direccin de Bitcoin - notify: Notifcame sobre nuevas propinas (no ms de un email por mes) - submit_user: Cambiar informacin de usuario - change_password: Cambie su contrasea - submit_password: Actualizar contrasea - use_from_gravatar: Use el de su cuenta de gravatar - withdrawals: - index: - title: Retiros recientes - created_at: Creado en - transaction: Transaccin - result: Resultado - error: Error - success: Exitoso - devise: - sessions: - new: - title: Iniciar Sesin - remember_me: Recurdame - submit: Iniciar Sesin - registrations: - new: - title: Registracin - submit: Registrar - passwords: - new: - title: Olvido su contrasea? - submit: Mndame instrucciones para resetear mi contrasea - edit: - title: Cambie su contrasea - submit: Actualizar contrasea - confirmations: - new: - title: Mndeme de nuevo instrucciones de confirmacin - submit: Mndeme de nuevo instrucciones de confirmacin - links: - sign_in: Iniciar Sesin - sign_up: Registrar - recover: Olvido su contrasea? - confirm: No recibi instrucciones de confirmacin? - sign_in_with: "Iniciar sesin con %{provider} " - errors: - primary_email: Su correo electrnico primario debe ser verificado. - onmiauth_info: No pudimos obtener tu informacin. - activerecord: - attributes: - user: - email: Correo Electrnico - bitcoin_address: Direccin de Bitcoin - password: Contrasea - password_confirmation: Contrasea de confirmacin - display_name: Nombre publico - omniauth_providers: - github: GitHub - bitbucket: BitBucket - general: - or: O - disclaimer: - line1: "Tip4Commit no est asociado con la mayora de los proyectos." - line2: "No hay ninguna garanta que las propinas sean reclamadas por los desarrolladores." - line3: "Al donar fondos, usted esta de acuerdo que los fondos podrn ser enviados a la fundacin de software gratuito (Free Software Foundation) o a otra parte a nuestra discrecin." From c398e77ad067faeaaeed8d3b7d49ec963d2857ee Mon Sep 17 00:00:00 2001 From: Merco Date: Wed, 6 Dec 2017 23:44:22 -0800 Subject: [PATCH 263/415] Spanish language re-upload Re-uploaded the Spanish translation with appropriate encoding. --- config/locales/es.yml | 233 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 233 insertions(+) create mode 100644 config/locales/es.yml diff --git a/config/locales/es.yml b/config/locales/es.yml new file mode 100644 index 00000000..4c17bd66 --- /dev/null +++ b/config/locales/es.yml @@ -0,0 +1,233 @@ +es: + tip4commit: Tip4Commit + meta: + title: Contribuye a cdigo abierto + description: Dona Bitcoins a proyectos de cdigo abierto o haz commits y recibe propinas por ellos. + menu: + home: Inicio + projects: Proyectos soportados + footer: + text: "El cdigo fuente est disponible en %{github_link} y tambin puedes %{support_link} su desarollo." + github_link: GitHub + support_link: apoyar + follow_link: Sguenos en @tip4commit + links: + sign_up: registrar + sign_in: inicia sesin + sign_in_imp: inicie sesin + sign_out: Cerrar Sesin + create_issue: crea un problema + errors: + project_not_found: El proyecto no fue encontrado. + opt_in_notice: "Debido a varias quejas de mantenedores de proyectos, no agregamos proyectos automticamente. Proyectos existentes sin depsitos han sido removidos. Si usted quiere agregar su proyecto, por favor %{create_issue_link}. + access_denied: Acceso rechazado + can_assign_more_tips: "No puede asignar ms de 100% de los fondos disponibles." + wrong_bitcoin_address: Ocurri un error al actualizar su direccin de bitcoin + user_not_found: No se pudo encontrar el usuario + access_denied: Usted no est autorizado para realizar esa accin! + notices: + project_updated: Las configuraciones de su proyecto fueron actualizadas. + tips_decided: La cantidad de propina ha sido definida. + user_updated: La informacin ha sido actualizada. + user_unsubscribed: "Usted ya no recibir notificaciones de nosotros. Nos disculpamos por haberte molestado. Pero an puede dejar su direccin de bitcoin para recibir sus propinas." + tip_amounts: + undecided: "Indeciso" + free: "Gratis: 0%" + tiny: "Diminuto: 0.1%" + small: "Pequeo: 0.5%" + normal: "Normal: 1%" + big: "Grande: 2%" + huge: "Enorme: 5%" + js: + errors: + value: + invalid: Valor no vlido. + email: + invalid: Correo electrnico no vlido. + blank: El correo electrnico es requerido y no puede dejarlo en blanco. + password: + blank: La contrasea es requerida y no puede dejarlo en blanco. + invalid: Su contrasea no es igual a la contrasea de confirmacin. + password_confirmation: + blank: La contrasea de confirmacin es requerida y no puede dejarlo en blanco. + invalid: Su contrasea no es igual a la contrasea de confirmacin. + home: + index: + see_projects: Ver proyectos + how_does_it_work: + title: Como funciona? + text: La gente dona bitcoin a proyectos. Cuando el commit de alguien es agregada al proyecto, nosotros automticamente le damos una propina al autor. + button: Aprende ms sobre Bitcoin + donate: + title: Haz donaciones + text: Encuentra un proyecto que te guste y dnale bitcoins. Su donacin ser acumulada con los fondos de otros donadores para poder darse como propinas para nuevos commits. + button: Busca o agrega un proyecto + contribute: + title: Contribuye + text: Ve y arregla algo. Si tu commit es aceptado por el mantenedor del proyecto, recibirs una propina! + sign_in_text: "Solo cheque su bandeja por una invitacin o %{sign_in_link}." + sign_up_text: "Si usted an no ha recibido una invitacin, se puede %{sign_up_link} con un correo electrnico valido." + button: Proyectos soportados + projects: + index: + find_project: + placeholder: Enlace hacia un proyecto de GitHub o busque + button: Busca proyecto + repository: Repositorio + description: Descripcin + watchers: Seguidores + balance: Balance + forked_from: copiado de + support: Soporta este proyecto + show: + title: "Contribuye a %{project} " + fetch_pending: (Obtencin inicial pendiente) + edit_project: Cambiar ajustes del proyecto + decide_tip_amounts: Decide cantidad de propina + disabled_notifications: "Mantenedores de proyectos han decidido no notificarles a nuevos contribuidores sobre las propinas y probablemente no les guste esta manera de financiamiento." + fee: "%{percentage} de los fondos sern usados como propinas para nuevos commits." + balance: Balance + deposits: depositos + custom_tip_size: (cada nuevo commit recibe un porcentaje del balance disponible) + default_tip_size: "(cada nuevo commit recibe %{percentage} del balance disponible)" + min_tip_size: "La propina mnima es de %{min_tip}, pero si el balance disponible es menor de la propina mnima, una propina ms pequea ser enviada" + unconfirmed_amount: "(%{amount} no confirmado)" + tipping_policies: Poltica de propina + updated_by_user: "(Ultimo cambio por %{name} el %{date})" + updated_by_unknown: "(Ultimo cambio el %{date})" + tips_paid: Propinas pagadas + unclaimed_amount: "(%{amount} no han sido reclamado, y ser devuelto al proyecto despus de un mes sin reclamacion.)" + last_tips: Ultimas propinas + see_all: Ver todas + received: "%{amount} recibi" + will_receive: recibir una propina de + for_commit: por el commit + when_decided: cuando la cantidad sea decidida + next_tip: Siguiente Propina + contribute_and_earn: Contribuye y Gana + contribute_and_earn_description: "Dona Bitcoins a este proyecto o %{make_commits_link} y recibe propinas por ellos. Si tu commit es aceptado %{branch} por un mantenedor de proyecto y hay Bitcoins disponibles, recibirs una propina!" + contribute_and_earn_branch: "al %{branch} branch" + make_commits_link: haz commits + tell_us_bitcoin_address: Solo %{tell_us_link} su direccin de Bitcoin. + tell_us_link: dganos + sign_in: "Solo cheque su bandeja o %{sign_in_link}." + promote_project: Promueve %{project} + embedding: Integraciones + image_url: "Enlace de Imagen:" + shield_title: propina para siguiente commit + edit: + project_settings: "Ajustes del proyecto %{project} " + branch: Branch + default_branch: Branch predeterminado + tipping_policies: Poltica de propina + hold_tips: "No envi las propinas inmediatamente. Dele a los colaboradores la habilidad de modificar las propinas antes que sean enviadas" + save: Actualizar ajustes del proyecto + disable_notifications: No notifique a nuevos contribuidores + decide_tip_amounts: + commit: Commit + author: Autor + message: Mensaje + tip: Propina (relativo al balance del proyecto) + submit: Envia las propinas seleccionadas + blacklisted: + title: Lo sentimos mucho, pero esto proyecto no acepta propinas. + message: El autor de este proyecto ha deshabilitado propinas para este proyecto. + tips: + index: + tips: Consejos + project_tips: 'Consejos de %{project}' + user_tips: "Consejos de %{user}" + created_at: Creado en + commiter: Commiter + project: Proyecto + commit: Commit + amount: Cantidad + refunded: Reembolsado al depsito del proyecto + undecided: La cantidad de la propina an no se ha decidido + no_bitcoin_address: El usuario no especifico una direccin de deposito + below_threshold: "El saldo del usuario no ha superado el umbral de retiro " + waiting: Esperando por el retiro + error: (error al procesar la transaccin) + deposits: + index: + project_deposits: 'Depsitos de %{project}' + deposits: Depsitos + created_at: Creado en + project: Proyecto + amount: Cantidad + transaction: Transaccin + confirmed: Confirmado + confirmed_yes: 'Si' + confirmed_no: 'No' + users: + index: + title: Mayores Contribuidores + name: Nombre + commits_count: Commits propinadas + withdrawn: Retirado + show: + balance: Balance + threshold: "Podrs retirar su dinero cuando su balance llegue al umbral de %{threshold}." + see_all: Ver todos + received: "%{time} recibi %{amount} por el commit %{commit} en %{project} " + bitcoin_address_placeholder: Su direccin de Bitcoin + notify: Notifcame sobre nuevas propinas (no ms de un email por mes) + submit_user: Cambiar informacin de usuario + change_password: Cambie su contrasea + submit_password: Actualizar contrasea + use_from_gravatar: Use el de su cuenta de gravatar + withdrawals: + index: + title: Retiros recientes + created_at: Creado en + transaction: Transaccin + result: Resultado + error: Error + success: Exitoso + devise: + sessions: + new: + title: Iniciar Sesin + remember_me: Recurdame + submit: Iniciar Sesin + registrations: + new: + title: Registracin + submit: Registrar + passwords: + new: + title: Olvido su contrasea? + submit: Mndame instrucciones para resetear mi contrasea + edit: + title: Cambie su contrasea + submit: Actualizar contrasea + confirmations: + new: + title: Mndeme de nuevo instrucciones de confirmacin + submit: Mndeme de nuevo instrucciones de confirmacin + links: + sign_in: Iniciar Sesin + sign_up: Registrar + recover: Olvido su contrasea? + confirm: No recibi instrucciones de confirmacin? + sign_in_with: "Iniciar sesin con %{provider} " + errors: + primary_email: Su correo electrnico primario debe ser verificado. + onmiauth_info: No pudimos obtener tu informacin. + activerecord: + attributes: + user: + email: Correo Electrnico + bitcoin_address: Direccin de Bitcoin + password: Contrasea + password_confirmation: Contrasea de confirmacin + display_name: Nombre publico + omniauth_providers: + github: GitHub + bitbucket: BitBucket + general: + or: O + disclaimer: + line1: "Tip4Commit no est asociado con la mayora de los proyectos." + line2: "No hay ninguna garanta que las propinas sean reclamadas por los desarrolladores." + line3: "Al donar fondos, usted esta de acuerdo que los fondos podrn ser enviados a la fundacin de software gratuito (Free Software Foundation) o a otra parte a nuestra discrecin." From 26dad87c1994e34bd8f5cce4e21025138d5e7a1f Mon Sep 17 00:00:00 2001 From: Merco Date: Wed, 6 Dec 2017 23:45:58 -0800 Subject: [PATCH 264/415] Missed an o An `o` was missing. Fixed that. --- config/locales/es.yml | 158 +++++++++++++++++++++--------------------- 1 file changed, 79 insertions(+), 79 deletions(-) diff --git a/config/locales/es.yml b/config/locales/es.yml index 4c17bd66..bbc1a1c6 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -1,72 +1,72 @@ es: tip4commit: Tip4Commit meta: - title: Contribuye a cdigo abierto - description: Dona Bitcoins a proyectos de cdigo abierto o haz commits y recibe propinas por ellos. + title: Contribuye a código abierto + description: Dona Bitcoins a proyectos de código abierto o haz commits y recibe propinas por ellos. menu: home: Inicio projects: Proyectos soportados footer: - text: "El cdigo fuente est disponible en %{github_link} y tambin puedes %{support_link} su desarollo." + text: "El código fuente está disponible en %{github_link} y también puedes %{support_link} su desarollo." github_link: GitHub support_link: apoyar - follow_link: Sguenos en @tip4commit + follow_link: S¡guenos en @tip4commit links: sign_up: registrar - sign_in: inicia sesin - sign_in_imp: inicie sesin - sign_out: Cerrar Sesin + sign_in: inicia sesión + sign_in_imp: inicie sesión + sign_out: Cerrar Sesión create_issue: crea un problema errors: project_not_found: El proyecto no fue encontrado. - opt_in_notice: "Debido a varias quejas de mantenedores de proyectos, no agregamos proyectos automticamente. Proyectos existentes sin depsitos han sido removidos. Si usted quiere agregar su proyecto, por favor %{create_issue_link}. + opt_in_notice: "Debido a varias quejas de mantenedores de proyectos, no agregamos proyectos automáticamente. Proyectos existentes sin depósitos han sido removidos. Si usted quiere agregar su proyecto, por favor %{create_issue_link}. access_denied: Acceso rechazado - can_assign_more_tips: "No puede asignar ms de 100% de los fondos disponibles." - wrong_bitcoin_address: Ocurri un error al actualizar su direccin de bitcoin + can_assign_more_tips: "No puede asignar más de 100% de los fondos disponibles." + wrong_bitcoin_address: Ocurrió un error al actualizar su dirección de bitcoin user_not_found: No se pudo encontrar el usuario - access_denied: Usted no est autorizado para realizar esa accin! + access_denied: ­Usted no está autorizado para realizar esa acción! notices: project_updated: Las configuraciones de su proyecto fueron actualizadas. tips_decided: La cantidad de propina ha sido definida. - user_updated: La informacin ha sido actualizada. - user_unsubscribed: "Usted ya no recibir notificaciones de nosotros. Nos disculpamos por haberte molestado. Pero an puede dejar su direccin de bitcoin para recibir sus propinas." + user_updated: La información ha sido actualizada. + user_unsubscribed: "Usted ya no recibirá notificaciones de nosotros. Nos disculpamos por haberte molestado. Pero a£n puede dejar su dirección de bitcoin para recibir sus propinas." tip_amounts: undecided: "Indeciso" free: "Gratis: 0%" tiny: "Diminuto: 0.1%" - small: "Pequeo: 0.5%" + small: "Pequeño: 0.5%" normal: "Normal: 1%" big: "Grande: 2%" huge: "Enorme: 5%" js: errors: value: - invalid: Valor no vlido. + invalid: Valor no válido. email: - invalid: Correo electrnico no vlido. - blank: El correo electrnico es requerido y no puede dejarlo en blanco. + invalid: Correo electrónico no válido. + blank: El correo electrónico es requerido y no puede dejarlo en blanco. password: - blank: La contrasea es requerida y no puede dejarlo en blanco. - invalid: Su contrasea no es igual a la contrasea de confirmacin. + blank: La contraseña es requerida y no puede dejarlo en blanco. + invalid: Su contraseña no es igual a la contraseña de confirmación. password_confirmation: - blank: La contrasea de confirmacin es requerida y no puede dejarlo en blanco. - invalid: Su contrasea no es igual a la contrasea de confirmacin. + blank: La contraseña de confirmación es requerida y no puede dejarlo en blanco. + invalid: Su contraseña no es igual a la contraseña de confirmación. home: index: see_projects: Ver proyectos how_does_it_work: - title: Como funciona? - text: La gente dona bitcoin a proyectos. Cuando el commit de alguien es agregada al proyecto, nosotros automticamente le damos una propina al autor. - button: Aprende ms sobre Bitcoin + title: ¿Como funciona? + text: La gente dona bitcoin a proyectos. Cuando el commit de alguien es agregada al proyecto, nosotros automáticamente le damos una propina al autor. + button: Aprende más sobre Bitcoin donate: title: Haz donaciones - text: Encuentra un proyecto que te guste y dnale bitcoins. Su donacin ser acumulada con los fondos de otros donadores para poder darse como propinas para nuevos commits. + text: Encuentra un proyecto que te guste y dónale bitcoins. Su donación será acumulada con los fondos de otros donadores para poder darse como propinas para nuevos commits. button: Busca o agrega un proyecto contribute: title: Contribuye - text: Ve y arregla algo. Si tu commit es aceptado por el mantenedor del proyecto, recibirs una propina! - sign_in_text: "Solo cheque su bandeja por una invitacin o %{sign_in_link}." - sign_up_text: "Si usted an no ha recibido una invitacin, se puede %{sign_up_link} con un correo electrnico valido." + text: Ve y arregla algo. Si tu commit es aceptado por el mantenedor del proyecto, ­recibirás una propina! + sign_in_text: "Solo cheque su bandeja por una invitación o %{sign_in_link}." + sign_up_text: "Si usted a£n no ha recibido una invitación, se puede %{sign_up_link} con un correo electrónico valido." button: Proyectos soportados projects: index: @@ -74,42 +74,42 @@ es: placeholder: Enlace hacia un proyecto de GitHub o busque button: Busca proyecto repository: Repositorio - description: Descripcin + description: Descripción watchers: Seguidores balance: Balance forked_from: copiado de support: Soporta este proyecto show: title: "Contribuye a %{project} " - fetch_pending: (Obtencin inicial pendiente) + fetch_pending: (Obtención inicial pendiente) edit_project: Cambiar ajustes del proyecto decide_tip_amounts: Decide cantidad de propina disabled_notifications: "Mantenedores de proyectos han decidido no notificarles a nuevos contribuidores sobre las propinas y probablemente no les guste esta manera de financiamiento." - fee: "%{percentage} de los fondos sern usados como propinas para nuevos commits." + fee: "%{percentage} de los fondos serán usados como propinas para nuevos commits." balance: Balance deposits: depositos custom_tip_size: (cada nuevo commit recibe un porcentaje del balance disponible) default_tip_size: "(cada nuevo commit recibe %{percentage} del balance disponible)" - min_tip_size: "La propina mnima es de %{min_tip}, pero si el balance disponible es menor de la propina mnima, una propina ms pequea ser enviada" + min_tip_size: "La propina m¡nima es de %{min_tip}, pero si el balance disponible es menor de la propina m¡nima, una propina más pequeña será enviada" unconfirmed_amount: "(%{amount} no confirmado)" - tipping_policies: Poltica de propina + tipping_policies: Pol¡tica de propina updated_by_user: "(Ultimo cambio por %{name} el %{date})" updated_by_unknown: "(Ultimo cambio el %{date})" tips_paid: Propinas pagadas - unclaimed_amount: "(%{amount} no han sido reclamado, y ser devuelto al proyecto despus de un mes sin reclamacion.)" + unclaimed_amount: "(%{amount} no han sido reclamado, y será devuelto al proyecto después de un mes sin reclamacion.)" last_tips: Ultimas propinas see_all: Ver todas - received: "%{amount} recibi" - will_receive: recibir una propina de + received: "%{amount} recibió" + will_receive: recibirá una propina de for_commit: por el commit when_decided: cuando la cantidad sea decidida next_tip: Siguiente Propina contribute_and_earn: Contribuye y Gana - contribute_and_earn_description: "Dona Bitcoins a este proyecto o %{make_commits_link} y recibe propinas por ellos. Si tu commit es aceptado %{branch} por un mantenedor de proyecto y hay Bitcoins disponibles, recibirs una propina!" + contribute_and_earn_description: "Dona Bitcoins a este proyecto o %{make_commits_link} y recibe propinas por ellos. Si tu commit es aceptado %{branch} por un mantenedor de proyecto y hay Bitcoins disponibles, ­recibirás una propina!" contribute_and_earn_branch: "al %{branch} branch" make_commits_link: haz commits - tell_us_bitcoin_address: Solo %{tell_us_link} su direccin de Bitcoin. - tell_us_link: dganos + tell_us_bitcoin_address: Solo %{tell_us_link} su dirección de Bitcoin. + tell_us_link: d¡ganos sign_in: "Solo cheque su bandeja o %{sign_in_link}." promote_project: Promueve %{project} embedding: Integraciones @@ -119,8 +119,8 @@ es: project_settings: "Ajustes del proyecto %{project} " branch: Branch default_branch: Branch predeterminado - tipping_policies: Poltica de propina - hold_tips: "No envi las propinas inmediatamente. Dele a los colaboradores la habilidad de modificar las propinas antes que sean enviadas" + tipping_policies: Pol¡tica de propina + hold_tips: "No envié las propinas inmediatamente. Dele a los colaboradores la habilidad de modificar las propinas antes que sean enviadas" save: Actualizar ajustes del proyecto disable_notifications: No notifique a nuevos contribuidores decide_tip_amounts: @@ -142,20 +142,20 @@ es: project: Proyecto commit: Commit amount: Cantidad - refunded: Reembolsado al depsito del proyecto - undecided: La cantidad de la propina an no se ha decidido - no_bitcoin_address: El usuario no especifico una direccin de deposito + refunded: Reembolsado al depósito del proyecto + undecided: La cantidad de la propina a£n no se ha decidido + no_bitcoin_address: El usuario no especifico una dirección de deposito below_threshold: "El saldo del usuario no ha superado el umbral de retiro " waiting: Esperando por el retiro - error: (error al procesar la transaccin) + error: (error al procesar la transacción) deposits: index: - project_deposits: 'Depsitos de %{project}' - deposits: Depsitos + project_deposits: 'Depósitos de %{project}' + deposits: Depósitos created_at: Creado en project: Proyecto amount: Cantidad - transaction: Transaccin + transaction: Transacción confirmed: Confirmado confirmed_yes: 'Si' confirmed_no: 'No' @@ -167,60 +167,60 @@ es: withdrawn: Retirado show: balance: Balance - threshold: "Podrs retirar su dinero cuando su balance llegue al umbral de %{threshold}." + threshold: "Podrás retirar su dinero cuando su balance llegue al umbral de %{threshold}." see_all: Ver todos - received: "%{time} recibi %{amount} por el commit %{commit} en %{project} " - bitcoin_address_placeholder: Su direccin de Bitcoin - notify: Notifcame sobre nuevas propinas (no ms de un email por mes) - submit_user: Cambiar informacin de usuario - change_password: Cambie su contrasea - submit_password: Actualizar contrasea + received: "%{time} recibió %{amount} por el commit %{commit} en %{project} " + bitcoin_address_placeholder: Su dirección de Bitcoin + notify: Notif¡came sobre nuevas propinas (no más de un email por mes) + submit_user: Cambiar información de usuario + change_password: Cambie su contraseña + submit_password: Actualizar contraseña use_from_gravatar: Use el de su cuenta de gravatar withdrawals: index: title: Retiros recientes created_at: Creado en - transaction: Transaccin + transaction: Transacción result: Resultado error: Error success: Exitoso devise: sessions: new: - title: Iniciar Sesin - remember_me: Recurdame - submit: Iniciar Sesin + title: Iniciar Sesión + remember_me: Recuérdame + submit: Iniciar Sesión registrations: new: - title: Registracin + title: Registración submit: Registrar passwords: new: - title: Olvido su contrasea? - submit: Mndame instrucciones para resetear mi contrasea + title: ¿Olvido su contraseña? + submit: Mándame instrucciones para resetear mi contraseña edit: - title: Cambie su contrasea - submit: Actualizar contrasea + title: Cambie su contraseña + submit: Actualizar contraseña confirmations: new: - title: Mndeme de nuevo instrucciones de confirmacin - submit: Mndeme de nuevo instrucciones de confirmacin + title: Mándeme de nuevo instrucciones de confirmación + submit: Mándeme de nuevo instrucciones de confirmación links: - sign_in: Iniciar Sesin + sign_in: Iniciar Sesión sign_up: Registrar - recover: Olvido su contrasea? - confirm: No recibi instrucciones de confirmacin? - sign_in_with: "Iniciar sesin con %{provider} " + recover: ¿Olvido su contraseña? + confirm: ¿No recibió instrucciones de confirmación? + sign_in_with: "Iniciar sesión con %{provider} " errors: - primary_email: Su correo electrnico primario debe ser verificado. - onmiauth_info: No pudimos obtener tu informacin. + primary_email: Su correo electrónico primario debe ser verificado. + onmiauth_info: No pudimos obtener tu información. activerecord: attributes: user: - email: Correo Electrnico - bitcoin_address: Direccin de Bitcoin - password: Contrasea - password_confirmation: Contrasea de confirmacin + email: Correo Electrónico + bitcoin_address: Dirección de Bitcoin + password: Contraseña + password_confirmation: Contraseña de confirmación display_name: Nombre publico omniauth_providers: github: GitHub @@ -228,6 +228,6 @@ es: general: or: O disclaimer: - line1: "Tip4Commit no est asociado con la mayora de los proyectos." - line2: "No hay ninguna garanta que las propinas sean reclamadas por los desarrolladores." - line3: "Al donar fondos, usted esta de acuerdo que los fondos podrn ser enviados a la fundacin de software gratuito (Free Software Foundation) o a otra parte a nuestra discrecin." + line1: "Tip4Commit no está asociado con la mayor¡a de los proyectos." + line2: "No hay ninguna garant¡a que las propinas sean reclamadas por los desarrolladores." + line3: "Al donar fondos, usted esta de acuerdo que los fondos podrán ser enviados a la fundación de software gratuito (Free Software Foundation) o a otra parte a nuestra discreción." From a0c58153fef592658faa25985212c69227aa986a Mon Sep 17 00:00:00 2001 From: Merco Date: Wed, 6 Dec 2017 23:48:40 -0800 Subject: [PATCH 265/415] Fixed red dots Some red dots were showing up. Apparently, they're stray Unicode characters or something. Fixed that, too. --- config/locales/es.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/es.yml b/config/locales/es.yml index bbc1a1c6..9cfe20e6 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -24,7 +24,7 @@ es: can_assign_more_tips: "No puede asignar más de 100% de los fondos disponibles." wrong_bitcoin_address: Ocurrió un error al actualizar su dirección de bitcoin user_not_found: No se pudo encontrar el usuario - access_denied: ­Usted no está autorizado para realizar esa acción! + access_denied: Usted no está autorizado para realizar esa acción! notices: project_updated: Las configuraciones de su proyecto fueron actualizadas. tips_decided: La cantidad de propina ha sido definida. @@ -64,7 +64,7 @@ es: button: Busca o agrega un proyecto contribute: title: Contribuye - text: Ve y arregla algo. Si tu commit es aceptado por el mantenedor del proyecto, ­recibirás una propina! + text: Ve y arregla algo. Si tu commit es aceptado por el mantenedor del proyecto, recibirás una propina! sign_in_text: "Solo cheque su bandeja por una invitación o %{sign_in_link}." sign_up_text: "Si usted a£n no ha recibido una invitación, se puede %{sign_up_link} con un correo electrónico valido." button: Proyectos soportados From f86c5b09b16e219739f7370782bd91d711827b13 Mon Sep 17 00:00:00 2001 From: Merco Date: Thu, 7 Dec 2017 00:07:54 -0800 Subject: [PATCH 266/415] Fixed a parsing error Let's hope it works now. --- config/locales/es.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/es.yml b/config/locales/es.yml index 9cfe20e6..f719b8ac 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -19,7 +19,7 @@ es: create_issue: crea un problema errors: project_not_found: El proyecto no fue encontrado. - opt_in_notice: "Debido a varias quejas de mantenedores de proyectos, no agregamos proyectos automáticamente. Proyectos existentes sin depósitos han sido removidos. Si usted quiere agregar su proyecto, por favor %{create_issue_link}. + opt_in_notice: "Debido a varias quejas de mantenedores de proyectos, no agregamos proyectos automáticamente. Proyectos existentes sin depósitos han sido removidos. Si usted quiere agregar su proyecto, por favor %{create_issue_link}." access_denied: Acceso rechazado can_assign_more_tips: "No puede asignar más de 100% de los fondos disponibles." wrong_bitcoin_address: Ocurrió un error al actualizar su dirección de bitcoin @@ -105,7 +105,7 @@ es: when_decided: cuando la cantidad sea decidida next_tip: Siguiente Propina contribute_and_earn: Contribuye y Gana - contribute_and_earn_description: "Dona Bitcoins a este proyecto o %{make_commits_link} y recibe propinas por ellos. Si tu commit es aceptado %{branch} por un mantenedor de proyecto y hay Bitcoins disponibles, ­recibirás una propina!" + contribute_and_earn_description: "Dona Bitcoins a este proyecto o %{make_commits_link} y recibe propinas por ellos. Si tu commit es aceptado %{branch} por un mantenedor de proyecto y hay Bitcoins disponibles, recibirás una propina!" contribute_and_earn_branch: "al %{branch} branch" make_commits_link: haz commits tell_us_bitcoin_address: Solo %{tell_us_link} su dirección de Bitcoin. From 272efbc30f143b417dab9dfb62584f572b7a2b5c Mon Sep 17 00:00:00 2001 From: Merco Date: Thu, 7 Dec 2017 19:21:12 -0800 Subject: [PATCH 267/415] Added missing exclamation marks. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some exclamations marks were missing their upside down question marks. Fixed that. And some additional `ú`s. --- config/locales/es.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/es.yml b/config/locales/es.yml index f719b8ac..7e71afb7 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -29,7 +29,7 @@ es: project_updated: Las configuraciones de su proyecto fueron actualizadas. tips_decided: La cantidad de propina ha sido definida. user_updated: La información ha sido actualizada. - user_unsubscribed: "Usted ya no recibirá notificaciones de nosotros. Nos disculpamos por haberte molestado. Pero a£n puede dejar su dirección de bitcoin para recibir sus propinas." + user_unsubscribed: "Usted ya no recibirá notificaciones de nosotros. Nos disculpamos por haberte molestado. Pero aún puede dejar su dirección de bitcoin para recibir sus propinas." tip_amounts: undecided: "Indeciso" free: "Gratis: 0%" @@ -66,7 +66,7 @@ es: title: Contribuye text: Ve y arregla algo. Si tu commit es aceptado por el mantenedor del proyecto, recibirás una propina! sign_in_text: "Solo cheque su bandeja por una invitación o %{sign_in_link}." - sign_up_text: "Si usted a£n no ha recibido una invitación, se puede %{sign_up_link} con un correo electrónico valido." + sign_up_text: "Si usted aún no ha recibido una invitación, se puede %{sign_up_link} con un correo electrónico valido." button: Proyectos soportados projects: index: From f8eae053dbe21d4ea06324dadd40d5f727a83740 Mon Sep 17 00:00:00 2001 From: Merco Date: Thu, 7 Dec 2017 19:25:31 -0800 Subject: [PATCH 268/415] ignore me fixed mroe stuff --- config/locales/es.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/locales/es.yml b/config/locales/es.yml index 7e71afb7..dd9128b7 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -24,7 +24,7 @@ es: can_assign_more_tips: "No puede asignar más de 100% de los fondos disponibles." wrong_bitcoin_address: Ocurrió un error al actualizar su dirección de bitcoin user_not_found: No se pudo encontrar el usuario - access_denied: Usted no está autorizado para realizar esa acción! + access_denied: ¡Usted no está autorizado para realizar esa acción! notices: project_updated: Las configuraciones de su proyecto fueron actualizadas. tips_decided: La cantidad de propina ha sido definida. @@ -64,7 +64,7 @@ es: button: Busca o agrega un proyecto contribute: title: Contribuye - text: Ve y arregla algo. Si tu commit es aceptado por el mantenedor del proyecto, recibirás una propina! + text: Ve y arregla algo. Si tu commit es aceptado por el mantenedor del proyecto, ¡recibirás una propina! sign_in_text: "Solo cheque su bandeja por una invitación o %{sign_in_link}." sign_up_text: "Si usted aún no ha recibido una invitación, se puede %{sign_up_link} con un correo electrónico valido." button: Proyectos soportados @@ -90,7 +90,7 @@ es: deposits: depositos custom_tip_size: (cada nuevo commit recibe un porcentaje del balance disponible) default_tip_size: "(cada nuevo commit recibe %{percentage} del balance disponible)" - min_tip_size: "La propina m¡nima es de %{min_tip}, pero si el balance disponible es menor de la propina m¡nima, una propina más pequeña será enviada" + min_tip_size: "La propina m¡nima es de %{min_tip}, pero si el balance disponible es menor de la propina mínima, una propina más pequeña será enviada" unconfirmed_amount: "(%{amount} no confirmado)" tipping_policies: Pol¡tica de propina updated_by_user: "(Ultimo cambio por %{name} el %{date})" @@ -105,7 +105,7 @@ es: when_decided: cuando la cantidad sea decidida next_tip: Siguiente Propina contribute_and_earn: Contribuye y Gana - contribute_and_earn_description: "Dona Bitcoins a este proyecto o %{make_commits_link} y recibe propinas por ellos. Si tu commit es aceptado %{branch} por un mantenedor de proyecto y hay Bitcoins disponibles, recibirás una propina!" + contribute_and_earn_description: "Dona Bitcoins a este proyecto o %{make_commits_link} y recibe propinas por ellos. Si tu commit es aceptado %{branch} por un mantenedor de proyecto y hay Bitcoins disponibles, ¡recibirás una propina!" contribute_and_earn_branch: "al %{branch} branch" make_commits_link: haz commits tell_us_bitcoin_address: Solo %{tell_us_link} su dirección de Bitcoin. From 6bdda7db0bd39ee6c515fcc9113ef61ed5dccfa6 Mon Sep 17 00:00:00 2001 From: Merco Date: Thu, 7 Dec 2017 19:41:10 -0800 Subject: [PATCH 269/415] Added a Spanish README. I'll leave the implementation of this REAME file to you guys. --- README_ES.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 README_ES.md diff --git a/README_ES.md b/README_ES.md new file mode 100644 index 00000000..883cec0b --- /dev/null +++ b/README_ES.md @@ -0,0 +1,25 @@ +Tip4commit +========== + +[![propina para el siguiente commit](https://tip4commit.com/projects/307.svg)](https://tip4commit.com/projects/307) +[![Estado de Compilacion](https://travis-ci.org/tip4commit/tip4commit.svg?branch=master)](https://travis-ci.org/tip4commit/tip4commit) + +Dona Bitcoins a proyectos de código abierto o recibe propinas contribuciones de código. + +Nombre | Enlace +----|----| +Sitio Oficial| https://tip4commit.com/ +Discusiones| https://bitcointalk.org/index.php?topic=31580 +Preguntas Frecuentes | https://github.com/tip4commit/tip4commit/wiki/FAQ +Problemas| https://github.com/tip4commit/tip4commit/issues + +Desarrolladores +========== + +Si a usted le gustaría contribuir al desarrollo de tip4commit, puede encontrar las guías de contribución en el [README para desarolladores.](https://github.com/tip4commit/tip4commit/wiki/Developer-README) + + +Licencia +======= + +[Licencia MIT](https://github.com/tip4commit/tip4commit/blob/master/LICENSE) From 32b4506f9f93807c175833959ceef8bfc4bfee6d Mon Sep 17 00:00:00 2001 From: Rizky Eko Date: Sat, 9 Dec 2017 16:32:17 +0700 Subject: [PATCH 270/415] Add Indonesian translation for lacale --- config/locales/id.yml | 233 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 233 insertions(+) create mode 100644 config/locales/id.yml diff --git a/config/locales/id.yml b/config/locales/id.yml new file mode 100644 index 00000000..d1db7880 --- /dev/null +++ b/config/locales/id.yml @@ -0,0 +1,233 @@ +en: + tip4commit: Tip4Commit + meta: + title: Kontribusi ke Open Source + description: Donasi bitcoin untuk proyek Open Source atau commit perubahan dan dapatkan tips. + menu: + home: Home + projects: proyek + footer: + text: "Source code bisa dicek di %{github_link} dan proyek juga dapat cek di- %{support_link}." + github_link: GitHub + support_link: support + follow_link: Follow @tip4commit + links: + sign_up: Daftar + sign_in: Masuk + sign_in_imp: masuk + sign_out: Keluar + create_issue: Buat Issue + errors: + project_not_found: proyek tidak ditemukan. + opt_in_notice: "Karena keluhan dari pemilik proyek, kami tidak menambahkan proyek secara otomatis lagi. Proyek yang ada tanpa deposit telah dihapus. Jika Anda ingin menambahkan proyek Anda, silakan klik %{create_issue_link}." + access_denied: Akses ditolak + can_assign_more_tips: "proyek tidak dapat menetapkan lebih dari 100% dari dana yang tersedia." + wrong_bitcoin_address: Error ketika memperbarui alamat bitcoin + user_not_found: User tidak ditemukan + access_denied: Anda tidak berwenang melakukan tindakan ini! + notices: + project_updated: Settingan proyek telah diperbarui + tips_decided: Jumlah tips sudah ditetapkan + user_updated: Informasi proyek telah disimpan! + user_unsubscribed: "proyek telah berhenti berlangganan! Maaf atas ketidaknyamanannya. Meski begitu, Anda masih bisa meninggalkan alamat bitcoin Anda untuk mendapatkan tip Anda." + tip_amounts: + undecided: "Bimbang" + free: "Gratis: 0%" + tiny: "Sangat Kecil: 0.1%" + small: "Kecil: 0.5%" + normal: "Sedang: 1%" + big: "Besar: 2%" + huge: "Sangat Besar: 5%" + js: + errors: + value: + invalid: Nilai tidak valid + email: + invalid: Alamat email tidak valid + blank: Email harus diisi dan tidak boleh kosong + password: + blank: Password harus diisi dan tidak boleh kosong + invalid: Password tidak sama + password_confirmation: + blank: Password konfirmasi harus diisi dan tidak boleh kosong + invalid: Password tidak sama + home: + index: + see_projects: Lihat proyek + how_does_it_work: + title: Bagaimana cara kerjanya? + text: Orang menyumbangkan bitcoin untuk proyek. Ketika komit seseorang diterima dalam repositori proyek, kami secara otomatis memberi tip kepada kontributor. + button: Pelajari tentang Bitcoin + donate: + title: Donasi + text: Temukan proyek yang Anda sukai dan setorkan bitcoin ke dalamnya. Sumbangan Anda akan terakumulasi dengan dana donatur lain untuk diberikan sebagai tip untuk setiap perubahan baru. + button: Cari atau tambahkan proyek + contribute: + title: Membantu + text: Tambahkan atau perbaiki sesuatu! Jika perubahan proyek diterima oleh pemilik proyek, proyek akan mendapatkan tip! + sign_in_text: "Silahkan cek email untuk melihat undangan atau %{sign_in_link}." + sign_up_text: "Jika proyek tidak menerima undangan, proyek bisa %{sign_up_link} dengan alamat email yang valid" + button: Supported proyek + projects: + index: + find_project: + placeholder: Masukkan GitHub proyek URL atau keyword apapun untuk mencari proyek... + button: Temukan proyek + repository: Repository + description: Deskripsi + watchers: Pengintai + balance: Saldo + forked_from: Cabang dari + support: Support proyek + show: + title: "Membantu %{project}" + fetch_pending: (Gagal initial fetch) + edit_project: Rubah pengaturan proyek + decide_tip_amounts: Tentukan nilai tip + disabled_notifications: "Pemilik proyek telah memutuskan untuk tidak memberi tahu kontributor baru tentang tip dan mereka mungkin tidak menyukai cara pendanaan ini." + fee: "%{percentage} dana yang disetorkan akan digunakan untuk memberi tip pada komitmen baru." + balance: Saldo + deposits: setor + custom_tip_size: (setiap perubahan baru menerima persentase saldo yang tersedia) + default_tip_size: "(setiap perubahan baru menerima %{percentage} dari jumlah saldo yang tersedia)" + min_tip_size: "Jumlah tip minimum adalah %{min_tip}, Tapi bila tersedia saldo kurang dari itu maka akan dikirim sebagai tip yang lebih kecil" + unconfirmed_amount: "(%{amount} belum dikonfirmasi)" + tipping_policies: Aturan tip + updated_by_user: "(Perubahan terakhir oleh %{name} pada %{date})" + updated_by_unknown: "(Perubahan terakhir pada %{date})" + tips_paid: Tip yang sudah dibayarkan + unclaimed_amount: "(%{amount} yang belum di klaim, dan akan dikembalikan ke proyek setelah 1 bulan jika tidak diklaim.)" + last_tips: Tip tearkhir + see_all: Lihat semua + received: "Diterima %{amount}" + will_receive: akan menerima tip + for_commit: untuk perubahan + when_decided: kapan jumlahnya ditentukan + next_tip: tip berikutnya + contribute_and_earn: Bantu dan dapatkan tip + contribute_and_earn_description: "Donasi bitcoin ke proyek ini atau %{make_commits_link} dan dapatkan tipnya. Jika perubahan proyek diterima %{branch} oleh pemilik proyek dan saldo bitcoin tersedia, proyek akan mendapatkan tip!" + contribute_and_earn_branch: "Ke branch %{branch}" + make_commits_link: buat perubahan + tell_us_bitcoin_address: "Cantumkan %{tell_us_link} alamat bitcoin proyek." + tell_us_link: cantumkan + sign_in: "Silahkan cek email proyek atau %{sign_in_link}." + promote_project: Majukan %{project} + embedding: Penyematan + image_url: "Image URL:" + shield_title: tip untuk komit selanjutnya + edit: + project_settings: "%{project} settingan proyek" + branch: Branch + default_branch: Default branch + tipping_policies: Aturan tip + hold_tips: "Jangan segera mengirim tip. Berikan kolaborator untuk mengubah tip sebelum dikirim" + save: Simpan settingan proyek + disable_notifications: Jangan beritahu kontributor baru + decide_tip_amounts: + commit: Komit + author: Penulis + message: Pesan + tip: Tip (relatif terhadap saldo proyek) + submit: Kirim jumlah yang sudah ditentukan + blacklisted: + title: Maaf, proyek ini tidak menerima ini! + message: Penulis proyek ini telah melarang tip untuk proyek ini. + tips: + index: + tips: Tips + project_tips: '%{project} tips' + user_tips: "%{user} tips" + created_at: Dibuat pada + commiter: Penulis + project: Proyek + commit: Perubahan + amount: Jumlah + refunded: Dikembalikan ke proyek deposit + undecided: Jumlah tip belum ditentukan + no_bitcoin_address: Pengguna belum menentukan alamat penarikan + below_threshold: "Saldo pengguna berada di bawah ambang panarikan" + waiting: Menunggu penarikan + error: (kesalahan pengiriman transaksi) + deposits: + index: + project_deposits: '%{project} setor' + deposits: Setor + created_at: Dibuat pada + project: Proyek + amount: Jumlah + transaction: Transaksi + confirmed: Dikonfirmasi + confirmed_yes: 'Ya' + confirmed_no: 'Tidak' + users: + index: + title: Kontributor teratas + name: Nama + commits_count: Perubahan yang sudah di tip + withdrawn: Ditarik + show: + balance: Saldo + threshold: "Anda akan mendapatkan uang anda saat saldo anda mencapai ambang batas %{threshold}" + see_all: lihat semua + received: "%{time} diterima %{amount} untuk perubahan %{commit} di %{project}" + bitcoin_address_placeholder: Alamat bitcoin anda + notify: Beritahu saya tentang tip baru(tidak lebih dari satu email per bulan) + submit_user: Perbarui informasi pengguna + change_password: Rubah password anda + submit_password: Rubah password + use_from_gravatar: Gunakan dari profil gravatar anda + withdrawals: + index: + title: Penarikan Terakhir + created_at: Diabuat Pada + transaction: Transaksi + result: Hasil + error: Eror + success: Sukses + devise: + sessions: + new: + title: Masuk + remember_me: Ingat saya + submit: Masuk + registrations: + new: + title: Daftar + submit: Daftar + passwords: + new: + title: Lupa password? + submit: Kirim instruksi reset password + edit: + title: Rubah password anda + submit: Rubah password + confirmations: + new: + title: Kirim ulang konfirmasi + submit: Kirim ulang konfirmasi + links: + sign_in: Masuk + sign_up: Daftar + recover: Lupas password? + confirm: Tidak menerika konfirmasi? + sign_in_with: "Masuk dengan %{provider}" + errors: + primary_email: email utama harus terverifikasi. + onmiauth_info: tidak dapat mengambil informasi. + activerecord: + attributes: + user: + email: E-mail + bitcoin_address: Alamat bitcoin + password: Password + password_confirmation: Konfirmasi Password + display_name: Nama yang ditampilkan + omniauth_providers: + github: GitHub + bitbucket: BitBucket + general: + or: atau + disclaimer: + line1: "Tip4Commit tidak berafiliasi dengan sebagian besar proyek." + line2: "Tidak ada jaminan bahwa tip akan diklaim oleh pengembang." + line3: "Dengan menyumbangkan dana, Anda setuju bahwa mereka dapat dikirim ke Free Software Fondattion atau tempat lain dengan kebijakan Tip4Commit." From 6935f3ba3cc81372057b2cde143882e192fc9360 Mon Sep 17 00:00:00 2001 From: Rizky Eko Date: Sun, 10 Dec 2017 10:14:41 +0700 Subject: [PATCH 271/415] change en to id --- config/locales/id.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/id.yml b/config/locales/id.yml index d1db7880..2460966f 100644 --- a/config/locales/id.yml +++ b/config/locales/id.yml @@ -1,4 +1,4 @@ -en: +id: tip4commit: Tip4Commit meta: title: Kontribusi ke Open Source From b9738fd6c64e671c491fdb8942f68e07dd7bd331 Mon Sep 17 00:00:00 2001 From: ohbarye Date: Tue, 19 Dec 2017 02:00:06 +0900 Subject: [PATCH 272/415] Add ja locale --- config/locales/ja.yml | 233 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 233 insertions(+) create mode 100644 config/locales/ja.yml diff --git a/config/locales/ja.yml b/config/locales/ja.yml new file mode 100644 index 00000000..450db782 --- /dev/null +++ b/config/locales/ja.yml @@ -0,0 +1,233 @@ +ja: + tip4commit: Tip4Commit + meta: + title: オープンソースに貢献しよう + description: オープンソースプロジェクトにビットコインを寄付して貢献する、またはコードを書いてチップを得よう + menu: + home: ホーム + projects: プロジェクト + footer: + text: "本サイトのソースコードは%{github_link}で公開されており、%{support_link}から貢献することもできます。" + github_link: GitHub + support_link: こちら + follow_link: "@tip4commit をフォロー" + links: + sign_up: 登録 + sign_in: ログイン + sign_in_imp: ログイン + sign_out: ログアウト + create_issue: issueを作成してください + errors: + project_not_found: プロジェクトが見つかりませんでした。 + opt_in_notice: "プロジェクト管理者からの要望によりプロジェクトは自動的に追加されないようにし、また、預金のないプロジェクトは削除しました。もしご自身のプロジェクトを追加したい場合は%{}。" + access_denied: アクセスが拒否されました。 + can_assign_more_tips: "資金の100%を超えて割り当てることはできません。" + wrong_bitcoin_address: ビットコインアドレスの更新に失敗しました。 + user_not_found: ユーザーが見つかりませんでした。 + access_denied: この操作を行う権限がありません。 + notices: + project_updated: プロジェクトの設定を更新しました。 + tips_decided: チップの量を設定しました。 + user_updated: ユーザー情報を保存しました。 + user_unsubscribed: "購読を停止しました。ご迷惑をおかけして申し訳ありません。チップを得るためのビットコインアドレスは引き続き有効です。" + tip_amounts: + undecided: "未入力" + free: "無料: 0%" + tiny: "極小: 0.1%" + small: "小: 0.5%" + normal: "中: 1%" + big: "大: 2%" + huge: "特大: 5%" + js: + errors: + value: + invalid: 値が不正です。 + email: + invalid: 不正なメールアドレスです。 + blank: メールアドレスは必須です。 + password: + blank: パスワードは必須です。 + invalid: パスワードとパスワード確認が一致しません。 + password_confirmation: + blank: パスワード確認は必須です。 + invalid: パスワードとパスワード確認が一致しません。 + home: + index: + see_projects: プロジェクトを見る + how_does_it_work: + title: どんな仕組み? + text: オープンソースプロジェクトにビットコインで寄付することができます。また、コミットがプロジェクトのレポジトリに取り込まれた場合に自動的にチップをコントリビューターに支払います。 + button: ビットコインについて学ぶ + donate: + title: 寄付する + text: あなたの寄付したいプロジェクトを見つけて送金しましょう。あなたの寄付は、他の寄付者の寄付金とともに蓄積され、その資金は新たなコミットへのチップとして使用されます。 + button: プロジェクトを探す + contribute: + title: コントリビュートする + text: 何かコードを書いてみましょう!あなたのコミットがプロジェクト管理者によって取り込まれればチップを得ることができます! + sign_in_text: "招待メールを確認する、または%{sign_in_link}してください。" + sign_up_text: "もしまだ招待メールを受け取っていなければ%{sign_up_link}リンクから登録してください。" + button: プロジェクトを探す + projects: + index: + find_project: + placeholder: GitHubプロジェクトのURL、または検索ワードを入力してください。 + button: 検索 + repository: レポジトリ + description: 説明 + watchers: ウォッチャー + balance: 残高 + forked_from: フォーク元 + support: 支援する + show: + title: "%{project}に貢献する" + fetch_pending: (情報取得中) + edit_project: プロジェクトの設定変更 + decide_tip_amounts: チップの金額を決める + disabled_notifications: "プロジェクト管理者によって、新しいコントリビューターにチップについて通知しないことになっています。(おそらく、この資金調達方法が好ましくないため)" + fee: "預金の%{percentage}が新しいコミットへのチップに使用されます。" + balance: 残高 + deposits: 預金 + custom_tip_size: (新しいコミットごとに利用可能な残高の一部を受け取ります) + default_tip_size: "(新しいコミットごとに利用可能な残高の%{percentage}を受け取る)" + min_tip_size: "最小のチップのサイズは%{min_tip}ですが利用可能残高がこれより低い場合、その金額がチップとして支払われます。" + unconfirmed_amount: "(%{amount}が未確認です)" + tipping_policies: チップポリシー + updated_by_user: "(最終更新者 %{name} 最終更新日 %{date})" + updated_by_unknown: "(最終更新日 %{date})" + tips_paid: 支払ったチップ + unclaimed_amount: "(このうち%{amount}は未請求です。1ヶ月間請求がない場合はプロジェクトに返金されます)" + last_tips: 最新のチップ + see_all: 全て見る + received: "が%{amount}受け取りました。" + will_receive: "はチップを受け取る予定です。" + for_commit: 対象のコミット + when_decided: (金額決定時) + next_tip: 次のチップ + contribute_and_earn: 貢献して収入を得る + contribute_and_earn_description: "ビットコインをプロジェクトに寄付するか、%{make_commits_link}しましょう。あなたのコミットがプロジェクト管理者によって%{branch}に受け入れられ、かつ利用可能残高がある場合はチップを得られます!" + contribute_and_earn_branch: "%{branch}" + make_commits_link: コミット + tell_us_bitcoin_address: "ビットコインアドレスを%{tell_us_link}から入力してください。" + tell_us_link: こちら + sign_in: "招待メールを確認する、または%{sign_in_link}してください。" + promote_project: "%{project}を応援する" + embedding: 埋め込み + image_url: "Image URL:" + shield_title: tip for next commit + edit: + project_settings: "%{project}のプロジェクト設定" + branch: ブランチ + default_branch: デフォルトブランチ + tipping_policies: チップポリシー + hold_tips: "チップをすぐに送金しない。共同管理者に送信前にチップの金額を修正する機会を提供する。" + save: プロジェクト設定を保存する + disable_notifications: 新しいコントリビューターに通知しない + decide_tip_amounts: + commit: コミット + author: 作者 + message: メッセージ + tip: チップ(プロジェクトの残高との相対値) + submit: 選択したチップの金額を送る + blacklisted: + title: 申し訳ありませんが、このプロジェクトはチップを受け付けていません! + message: このプロジェクトの作者はチップを許容しない選択をしました。 + tips: + index: + tips: チップ + project_tips: '%{project} チップ一覧' + user_tips: "%{user} チップ一覧" + created_at: 作成日 + commiter: コミッター + project: プロジェクト + commit: コミット + amount: 金額 + refunded: プロジェクに返金済 + undecided: プロジェクトのチップ金額未決定 + no_bitcoin_address: ユーザーのビットコインアドレス未登録 + below_threshold: ユーザーの残高が出金最低金額以下 + waiting: 出金待ち + error: (送金失敗) + deposits: + index: + project_deposits: '%{project} 預金' + deposits: 預金 + created_at: 作成日 + project: プロジェクト + amount: 金額 + transaction: トランザクション + confirmed: 確認 + confirmed_yes: '済' + confirmed_no: '未' + users: + index: + title: トップコントリビューター + name: 名前 + commits_count: チップ総額 + withdrawn: 出金額 + show: + balance: 残高 + threshold: "残高が出金可能額に達するとチップを手にすることができます。" + see_all: すべて見る + received: "%{time} %{project} への貢献 %{commit} により %{amount} 受領" + bitcoin_address_placeholder: ビットコインアドレス + notify: 新しいチップについて通知する(月に一度のみ) + submit_user: ユーザー情報を更新する + change_password: パスワードを変更する + submit_password: パスワードを変更する + use_from_gravatar: Gravatarのプロフィールを使用します + withdrawals: + index: + title: 最新の出金 + created_at: 作成日 + transaction: 取引 + result: 結果 + error: 失敗 + success: 成功 + devise: + sessions: + new: + title: ログイン + remember_me: 次回から自動ログインする + submit: ログイン + registrations: + new: + title: 登録 + submit: 登録 + passwords: + new: + title: パスワードをお忘れですか? + submit: 送信する + edit: + title: パスワードを変更する + submit: 変更 + confirmations: + new: + title: 認証メールを再送する + submit: 送信する + links: + sign_in: ログイン + sign_up: 登録 + recover: パスワードをお忘れですか? + confirm: 認証メールを受け取れませんでしたか? + sign_in_with: "%{provider}でログイン" + errors: + primary_email: メールアドレスを認証する必要があります。 + onmiauth_info: 情報を取得することができませんでした。 + activerecord: + attributes: + user: + email: メールアドレス + bitcoin_address: ビットコインアドレス + password: パスワード + password_confirmation: パスワード確認 + display_name: 名前 + omniauth_providers: + github: GitHub + bitbucket: BitBucket + general: + or: または + disclaimer: + line1: "Tip4Commitはほとんどのプロジェクトからアフィリエイト収入を得ていません。" + line2: "開発者がチップを必ず請求する保証はありません。" + line3: "寄付することにより、その資金をフリーソフトウェア財団または他の場所にTip4Commitの裁量で送金することに同意したことになります。" From 801018ae98792e0ee07fc7fc7dfedca9ade14fc1 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 13 Jan 2018 12:26:19 +0100 Subject: [PATCH 273/415] added indonesian and japansese locales --- app/assets/images/flags/id.png | Bin 0 -> 430 bytes app/assets/images/flags/ja.png | Bin 0 -> 420 bytes config/application.rb | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 app/assets/images/flags/id.png create mode 100644 app/assets/images/flags/ja.png diff --git a/app/assets/images/flags/id.png b/app/assets/images/flags/id.png new file mode 100644 index 0000000000000000000000000000000000000000..c6bc0fafac79403c97c64ba0228d35f250d05b57 GIT binary patch literal 430 zcmV;f0a5;mP)Wr{r~&-|6d^ahvDC! z|G)qK`}^nrA0Ybu|2K$nd)6X=0AgWa1{?O`IRi-PU$8V7{r&w9sOb0ae<0Pr|Nr{M zEF}%J0U&@_82&N|Y=e#y>zg27mx!0Xgp5*S}vr z{r~fq0csvl>92pk!P<5VDfB!NI2#TFQ3lKnzfB%Al=06ZHfFW+c#KiRe{d<4_V)^&)A0s0pNIe5S)eu>r zF8~6F38(?TQZ#J<0R*xEXct5e0}KG|WIzExE=U%r7$AT^8h-rv@ecwRzz_$3Xaxu` Y0RLik?wUgPu>b%707*qoM6N<$f;0ZTz5oCK literal 0 HcmV?d00001 diff --git a/app/assets/images/flags/ja.png b/app/assets/images/flags/ja.png new file mode 100644 index 0000000000000000000000000000000000000000..325fbad3ffd3075a4a84d8d898ad26ef7d3e0d56 GIT binary patch literal 420 zcmV;V0bBlwP)9whYk?f=!Q|Ns8||JN@lTD;`{R1ZWk|EGa3dAO8ObDh3E3Cb;oH_5X#1 z|NHy@|M?558b}5Q|Cf`4hZv9q2p|@?lb|{i68>{>{ol0lx`{mi O0000 Date: Thu, 25 Jan 2018 11:33:08 +0700 Subject: [PATCH 274/415] added malaysia locales --- config/locales/my.yml | 233 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 233 insertions(+) create mode 100644 config/locales/my.yml diff --git a/config/locales/my.yml b/config/locales/my.yml new file mode 100644 index 00000000..fc2d0ac7 --- /dev/null +++ b/config/locales/my.yml @@ -0,0 +1,233 @@ +my: + tip4commit: Tip4Commit + meta: + title: Menyumbang kepada Open Source + description: Dermakan bitcoin untuk projek Open Source atau buat komit dan dapatkan tip untuk itu. + menu: + home: Laman Utama + projects: Projek yang disokong + footer: + text: "Source code boleh didapati di %{github_link} dan anda juga boleh %{support_link} pembangunannya." + github_link: GitHub + support_link: sokongan + follow_link: Ikuti @tip4commit + links: + sign_up: Daftar + sign_in: Masuk + sign_in_imp: masuk + sign_out: Keluar + create_issue: buat satu isu + errors: + project_not_found: Projek tidak dijumpai. + opt_in_notice: "Oleh karana aduan daripada penyelenggara projek, kami tidak menambah projek secara automatik. Projek sedia ada tanpa deposit telah dikeluarkan. Jika anda ingin menambah projek anda, sila %{create_issue_link}." + access_denied: Akses dinafikan + can_assign_more_tips: "Anda tidak dapat memperuntukkan lebih daripada 100% dana yang tersedia." + wrong_bitcoin_address: Ralat mengemas kini alamat bitcoin + user_not_found: Pengguna tidak dijumpai + access_denied: Anda tidak dibenarkan melaksanakan tindakan ini! + notices: + project_updated: Tetapan projek telah dikemas kini + tips_decided: Jumlah tip telah ditentukan + user_updated: Maklumat anda disimpan! + user_unsubscribed: "Anda berhenti berlangganan! Maaf kerana mengganggu anda. Walaupun, anda masih boleh meninggalkan alamat bitcoin anda untuk mendapatkan tip anda." + tip_amounts: + undecided: "Tidak pasti" + free: "Percuma: 0%" + tiny: "Sangat kecil: 0.1%" + small: "Kecil: 0.5%" + normal: "Biasa: 1%" + big: "Besar: 2%" + huge: "Amat besar: 5%" + js: + errors: + value: + invalid: Nilai tidak sah + email: + invalid: Alamat e-mel tidak sah + blank: E-mel diperlukan dan tidak boleh kosong + password: + blank: Kata laluan diperlukan dan tidak boleh kosong + invalid: Kata laluan dan pengesahannya tidak sama + password_confirmation: + blank: Pengesahan kata laluan diperlukan dan tidak boleh kosong + invalid: Kata laluan dan pengesahannya tidak sama + home: + index: + see_projects: Lihat projek + how_does_it_work: + title: Bagaimanakah ia berfungsi? + text: Orang ramai menyumbangkan bitcoin kepada projek. Apabila komit seseorang diterima masuk ke repositori projek, kami secara automatik tip pengarang. + button: Ketahui mengenai Bitcoin + donate: + title: Menderma + text: Cari projek yang anda suka dan simpan bitcoins ke dalamnya. Derma anda akan terkumpul dengan dana penderma lain untuk diberikan sebagai tip untuk komitmen baru. + button: Cari atau tambah projek + contribute: + title: Sumbang + text: Lihat dan perbaiki sesuatu! Sekiranya komit anda diterima oleh penyenggara projek, anda akan mendapat tip! + sign_in_text: "Sila periksa e-mel anda untuk jemputan atau %{sign_in_link}." + sign_up_text: "Jika anda belum menerima jemputan, anda boleh %{sign_up_link} dengan alamat e-mel yang sah atau melalui" + button: Projek yang disokong + projects: + index: + find_project: + placeholder: Masukkan URL projek GitHub atau sebarang kata kunci untuk mencari... + button: Cari projek + repository: Repositori + description: Penghuraian + watchers: Pemerhati + balance: Baki + forked_from: dicabut dari + support: Sokong projek + show: + title: "Menyumbang kepada %{project}" + fetch_pending: (Menunggu pengambilan awal) + edit_project: Tukar tetapan projek + decide_tip_amounts: Memutuskan jumlah tip + disabled_notifications: "Penyelenggara projek telah memutuskan untuk tidak memberitahu penyumbang baru tentang tip dan mereka mungkin tidak suka cara pembiayaan ini." + fee: "%{percentage} dana yang disimpan akan digunakan untuk memberi tip baru." + balance: Baki + deposits: Menyimpan + custom_tip_size: (setiap komit baru menerima peratusan baki yang ada) + default_tip_size: "(setiap komit baru menerima %{percentage} daripada baki yang ada)" + min_tip_size: "Saiz tip minimum ditetapkan kepada %{min_tip}, tetapi jika baki yang ada kurang dari itu maka ia akan dihantar sebagai tip yang lebih kecil" + unconfirmed_amount: "(%{amount} belum disahkan)" + tipping_policies: Dasar tip + updated_by_user: "(Dikemaskinikan terakhir oleh %{name} pada %{date})" + updated_by_unknown: "(Terkini diperbaharui %{date})" + tips_paid: Tip Dibayar + unclaimed_amount: "(%{amount} daripada ini tidak dituntut, dan akan dikembalikan kepada projek itu selepas tidak dituntut selama 1 bulan.)" + last_tips: Tip terakhir + see_all: lihat semua + received: "menerima %{amount}" + will_receive: akan menerima tip + for_commit: untuk komit + when_decided: apabila amaunnya diputuskan + next_tip: Tip seterusnya + contribute_and_earn: Sumbang dan Dapatkan + contribute_and_earn_description: "Dermakan bitcoins ke projek ini atau %{make_commits_link} dan dapatkan tip untuknya. Sekiranya komit anda diterima %{branch} oleh seorang penyenggara projek dan terdapat bitcoin pada baki, anda akan mendapat tip!" + contribute_and_earn_branch: "ke %{branch} branch" + make_commits_link: membuat komit + tell_us_bitcoin_address: "Sila %{tell_us_link} alamat bitcoin anda." + tell_us_link: beritahu kami + sign_in: "Sila semak e-mel anda atau %{sign_in_link}." + promote_project: Menggalakkan %{project} + embedding: Embedding + image_url: "URL imej:" + shield_title: tip untuk komit seterusnya + edit: + project_settings: "%{project} tetapan projek" + branch: Branch + default_branch: Lalai branch + tipping_policies: Dasar tip + hold_tips: "Jangan hantar tip dengan segera. Beri kolaborator keupayaan untuk mengubahsuai tip sebelum dihantar" + save: Simpan tetapan projek + disable_notifications: Jangan beritahu penyumbang baru + decide_tip_amounts: + commit: Komit + author: Pengarang + message: Mesej + tip: Tip (berbanding dengan baki projek) + submit: Hantar jumlah tip yang dipilih + blacklisted: + title: Maaf, projek ini tidak menerima tip! + message: Penulis projek ini telah memilih untuk tidak membenarkan tip untuk projek ini. + tips: + index: + tips: Tips + project_tips: '%{project} tips' + user_tips: "%{user} tips" + created_at: Dicipta Pada + commiter: Kommiter + project: Projek + commit: Komit + amount: Jumlah + refunded: Dibayar balik kepada deposit projek + undecided: Jumlah tip belum diputuskan + no_bitcoin_address: Pengguna tidak menyatakan alamat pengeluaran + below_threshold: "Baki pengguna adalah di bawah ambang pengeluaran" + waiting: Menunggu pengeluaran + error: (kesilapan menghantar transaksi) + deposits: + index: + project_deposits: '%{project} deposit' + deposits: Deposit + created_at: Dicipta Pada + project: Projek + amount: Jumlah + transaction: Transaksi + confirmed: Dikesahkan + confirmed_yes: 'Ya' + confirmed_no: 'Tidak' + users: + index: + title: Penyumbang Teratas + name: Nama + commits_count: Komit telah di tip + withdrawn: Ditarik balik + show: + balance: Baki + threshold: "Anda akan mendapat wang anda apabila baki anda mencapai ambang %{threshold}" + see_all: lihat semua + received: "%{time} menerima %{amount} untuk komit %{commit} dalam %{project}" + bitcoin_address_placeholder: Alamat bitcoin anda + notify: Beritahu saya tentang tip baru (tidak lebih dari satu e-mel sebulan) + submit_user: Kemas kini maklumat pengguna + change_password: Tukar kata laluan anda + submit_password: Tukar kata laluan saya + use_from_gravatar: Gunakan dari profil gravatar anda + withdrawals: + index: + title: Pengeluaran Terakhir + created_at: Dicipta Pada + transaction: Transaksi + result: Keputusan + error: Ralat + success: Kejayaan + devise: + sessions: + new: + title: Masuk + remember_me: Ingat saya + submit: Masuk + registrations: + new: + title: Daftar + submit: Daftar + passwords: + new: + title: Lupa kata laluan anda? + submit: Hantar saya menetapkan semula arahan kata laluan + edit: + title: Tukar kata laluan anda + submit: Tukar kata laluan saya + confirmations: + new: + title: Hantar semula arahan pengesahan + submit: Hantar semula arahan pengesahan + links: + sign_in: Masuk + sign_up: Daftar + recover: Lupa kata laluan anda? + confirm: Tidak menerima arahan pengesahan? + sign_in_with: "Daftar masuk dengan %{provider}" + errors: + primary_email: alamat e-mel utama anda perlu disahkan. + onmiauth_info: kami tidak dapat mengambil maklumat anda. + activerecord: + attributes: + user: + email: E-mel + bitcoin_address: Alamat Bitcoin + password: Kata laluan + password_confirmation: Pengesahan kata laluan + display_name: Nama paparan + omniauth_providers: + github: GitHub + bitbucket: BitBucket + general: + or: atau + disclaimer: + line1: "Tip4Commit tidak bergabung dengan kebanyakan projek." + line2: "Tidak ada jaminan bahawa tip akan dituntut oleh developer." + line3: "Dengan menderma dana anda bersetuju bahawa mereka boleh dihantar ke Free Software Foundation atau ke tempat lain atas kebijaksanaan Tip4Commit's." From 8810de0f616d8f9ded5c3ea95eec6af37133f8a1 Mon Sep 17 00:00:00 2001 From: Joao Date: Wed, 31 Jan 2018 20:25:27 +0000 Subject: [PATCH 275/415] Added portuguese language --- README_PT.md | 25 ++++ app/assets/images/flags/pt.png | Bin 0 -> 406 bytes config/application.rb | 2 +- config/locales/pt.yml | 233 +++++++++++++++++++++++++++++++++ 4 files changed, 259 insertions(+), 1 deletion(-) create mode 100644 README_PT.md create mode 100644 app/assets/images/flags/pt.png create mode 100644 config/locales/pt.yml diff --git a/README_PT.md b/README_PT.md new file mode 100644 index 00000000..a07a6089 --- /dev/null +++ b/README_PT.md @@ -0,0 +1,25 @@ +Tip4commit +========== + +[![gorjeta para o próximo commit](https://tip4commit.com/projects/307.svg)](https://tip4commit.com/projects/307) +[![Estado da build](https://travis-ci.org/tip4commit/tip4commit.svg?branch=master)](https://travis-ci.org/tip4commit/tip4commit) + +Doe bitcoins para projetos de codigo aberto ou receba gorjetas por colaborar no código. + +Nome | Ligação +----|----| +Site oficial| https://tip4commit.com/ +Discussões | https://bitcointalk.org/index.php?topic=31580 +FAQs | https://github.com/tip4commit/tip4commit/wiki/FAQ +Problemas | https://github.com/tip4commit/tip4commit/issues + +Colaboradores +========== + +Se quiser contribuir para o desenvolvimento de tip4commit, pode encontrar as regras de colaborações e de instalação em [README para colaboradores](https://github.com/tip4commit/tip4commit/wiki/Developer-README) + + +Licença +======= + +[Licença MIT](https://github.com/tip4commit/tip4commit/blob/master/LICENSE) diff --git a/app/assets/images/flags/pt.png b/app/assets/images/flags/pt.png new file mode 100644 index 0000000000000000000000000000000000000000..182c8c837cc47f7925ab34b3f1cc6ea97a91072f GIT binary patch literal 406 zcmV;H0crk;P)l7c&>Q$JUsS9ME6TeYNcv>uzT%%PW)qI@eK|AYir@jHOa_S`8++gxGMqFm~OcJR18`%_2yLPGO3DcQn2=Frqhkx4<3G|tFR z*68~5XH5NYarN8OQ;|jWJU02kQR--Ly!- zy{^}C4jlwiK}HD1j%`~^-AIbMH;i*31VWV3A1P!SK4;@iSO5S307*qoM6N<$f-69^ A-2eap literal 0 HcmV?d00001 diff --git a/config/application.rb b/config/application.rb index 80727a7b..48ab0f09 100644 --- a/config/application.rb +++ b/config/application.rb @@ -25,7 +25,7 @@ class Application < Rails::Application config.autoload_paths += %W[#{config.root}/lib] config.assets.initialize_on_precompile = true - config.available_locales = %w[en es fr nl ru pl hr de ro ko id ja] + config.available_locales = %w[en es fr nl ru pl hr de ro ko id ja pt] config.active_job.queue_adapter = :sidekiq end end diff --git a/config/locales/pt.yml b/config/locales/pt.yml new file mode 100644 index 00000000..560fa282 --- /dev/null +++ b/config/locales/pt.yml @@ -0,0 +1,233 @@ +en: + tip4commit: Tip4Commit + meta: + title: Colabora para Código Aberto + description: Doa bitcoins para projetos de código aberto ou faça commits e receba gorjetas por eles. + menu: + home: Inicio + projects: Projetos suportados + footer: + text: "Código fonte está disponível em %{github_link} e também pode %{support_link} o seu desenvolvimento." + github_link: GitHub + support_link: suporte + follow_link: Siga @tip4commit + links: + sign_up: Registar + sign_in: Entrar + sign_in_imp: entrar + sign_out: Sair + create_issue: criar um problema + errors: + project_not_found: Projeto não encontrado. + opt_in_notice: "Devido a queixas de gestores dos projetos, nós não adicionamos mais projetos automaticamente. Projetos existentes sem depósitos foram removidos. Se quiser adicionar o seu projeto, por favor %{create_issue_link}." + access_denied: Acesso negado + can_assign_more_tips: "Não pode assignar mais de 100% dos fundos disponíveis." + wrong_bitcoin_address: Erro atualizando endereço de bitcoin + user_not_found: Utilizador não encontrado + access_denied: Não está autorizado a realizar essa operação! + notices: + project_updated: As configurações do projeto foram atualizadas + tips_decided: As quantidades das gorjetas foram definidas + user_updated: A sua informação foi gravada! + user_unsubscribed: "Desinscreveu-se! Pedimos desculpa pelo aborrecimento. No entanto, pode sempre nos deixar o seu endereço de bitcoin address para receber as suas gorjetas." + tip_amounts: + undecided: "Indeciso" + free: "Gratis: 0%" + tiny: "Diminuto: 0.1%" + small: "Pequeno: 0.5%" + normal: "Normal: 1%" + big: "Grande: 2%" + huge: "Enorme: 5%" + js: + errors: + value: + invalid: Valor é invalido + email: + invalid: Endereço de Email inválido + blank: O Email é necessário e não pode ser vazio + password: + blank: A senha é necessária e não pode ser vazia + invalid: A senha e a sua confirmação não são iguais + password_confirmation: + blank: A confirmação da senha é necessária e não pode ser vazia + invalid: A senha e a sua confirmação não são iguais + home: + index: + see_projects: Ver projetos + how_does_it_work: + title: Como funciona? + text: Pessoas doam bitcoins para os projetos. Quando o commit é aceite no repositório do projeto, nós automaticamente damos uma gorjeta ao autor. + button: Aprenda sobre Bitcoin + donate: + title: Doe + text: Encontre um projeto que goste e deposite bitcoins nele. A sua doação será acumulada com os fundos de outros doadores para serem dadas em novos commits. + button: Encontre ou adicione um projeto + contribute: + title: Colabore + text: Vá e concerte algo! Quando o seu commit fore aceite pelo gestor do projeto, voce recebe a gorjeta! + sign_in_text: "Verifique o seu email por um convite ou %{sign_in_link}." + sign_up_text: "Se ainda não recebeu um convite, pode %{sign_up_link} com um endereço de email válido ou via" + button: Projetos suportados + projects: + index: + find_project: + placeholder: Introduza URL de projeto GitHub or qualquer palavra-chave para o encontrar... + button: Encontrar projeto + repository: Repositório + description: Descrição + watchers: Observadores + balance: Saldo + forked_from: Copiado de + support: Suportar projeto + show: + title: "Colabore para %{project}" + fetch_pending: (Busca inicial pendente) + edit_project: Alterar configurações do projeto + decide_tip_amounts: Definir quantidades de gorjetas + disabled_notifications: "Os gestores dos projetos decidiram não notificar os novos colaboradores sobre as gorjetas e provavelmente não gostam desta forma de financiamento." + fee: "%{percentage} de fundos depositados que serão usados para gratificar novos commits." + balance: Saldo + deposits: depositos + custom_tip_size: (cada novo commit recebe uma percentagem do saldo disponível) + default_tip_size: "(cada novo commit recebe %{percentage} do saldo disponível)" + min_tip_size: "A quantidade minima da gorjeta foi definida para %{min_tip}, mas se o saldo disponível for menos que isso então será enviada uma gorjeta menor" + unconfirmed_amount: "(%{amount} não confirmada)" + tipping_policies: Políticas de gorjetas + updated_by_user: "(Ultima atualização de %{name} em %{date})" + updated_by_unknown: "(Ultima atualização em %{date})" + tips_paid: Gorjetas pagas + unclaimed_amount: "(%{amount} disto não foi reclamado, e será devolvido ao projeto se não for reclamado por 1 mês.)" + last_tips: Ultimas gorjetas + see_all: ver todas + received: "recebido %{amount}" + will_receive: irá receber gorjeta + for_commit: por commit + when_decided: quando a quantidade for decidida + next_tip: Próxima gorjeta + contribute_and_earn: Colabore e ganhe + contribute_and_earn_description: "Doe bitcoins para esta projeto ou %{make_commits_link} e receba gorjetas por ele. Se o seu commit for aceite %{branch} por um gestor do projeto e houver bitcoins no seu saldo, receberá uma gorjeta!" + contribute_and_earn_branch: "para %{branch} branch" + make_commits_link: fazer commits + tell_us_bitcoin_address: "Apenas %{tell_us_link} o seu endereço de bitcoin." + tell_us_link: Diga-nos + sign_in: "Verifique o seu email ou %{sign_in_link}." + promote_project: Promova %{project} + embedding: Incorporação + image_url: "Imagem do URL:" + shield_title: Dê uma gorjeta para o proximo commit + edit: + project_settings: "%{project} configurações do projeto" + branch: Branch + default_branch: Branch por omissão + tipping_policies: Políticas de gorjetas + hold_tips: "Não enviar as gorjetas imediatamente. Dar aos colaboradores a possibilidade de modificar as gorjetas antes de serem enviadas" + save: Gravar as configurações do projeto + disable_notifications: Não notificar novos colaboradores + decide_tip_amounts: + commit: Commit + author: Autor + message: Mensagem + tip: Gorjeta (relativa ao saldo do projeto) + submit: Envie as quantidades selecionadas de gorjetas + blacklisted: + title: As nossas desculpas, este projeto nao aceita gorjetas! + message: O autor deste projeto decidiu desabilitar as gorjetas para este projeto. + tips: + index: + tips: Gorjetas + project_tips: '%{project} gorjetas' + user_tips: "%{user} gorjetas" + created_at: Criado em + commiter: Commiter + project: Projeto + commit: Commit + amount: Quantidade + refunded: Devolvido ao saldo do projeto + undecided: A quantidade da gorjeta ainda não foi decidida + no_bitcoin_address: O utilizador ainda nao especificou o endereço de levantamento + below_threshold: "O saldo do utilizador é menor que mínimo para levantar" + waiting: À espera de levantamento + error: (erro a enviar a transação) + deposits: + index: + project_deposits: '%{project} depósitos' + deposits: Depósitos + created_at: Criado em + project: Projeto + amount: Quantidade + transaction: Transação + confirmed: Confirmado + confirmed_yes: 'Sim' + confirmed_no: 'Não' + users: + index: + title: Top Colaboradores + name: Nome + commits_count: Commits gratificados + withdrawn: Levantados + show: + balance: Saldo + threshold: "Receberá o seu dinheiro quando o saldo chegar a %{threshold}" + see_all: ver todos + received: "%{time} recebido %{amount} por commit %{commit} em %{project}" + bitcoin_address_placeholder: Seu endereço bitcoin + notify: Notificar-me de novas gorjetas (não mais que um email por mês) + submit_user: Atualizar informação de utilizador + change_password: Mudar a sua senha + submit_password: Mudar a minha senha + use_from_gravatar: Utilizar do seu perfil gravatar + withdrawals: + index: + title: Últimos Levantamentos + created_at: Criado em + transaction: Transação + result: Resultado + error: Erro + success: Sucesso + devise: + sessions: + new: + title: Entrar + remember_me: Lembrar-me + submit: Entrar + registrations: + new: + title: Registar + submit: Registar + passwords: + new: + title: Esqueceu-se da sua senha? + submit: Enviar-me instruções para repor a senha + edit: + title: Mudar a sua senha + submit: Mudar a minha senha + confirmations: + new: + title: Reenviar instruções de confirmação + submit: Reenviar instruções de confirmação + links: + sign_in: Entrar + sign_up: Registar + recover: Esqueceu-se da sua senha? + confirm: Não recebeu instruções de confirmação? + sign_in_with: "Entrar com %{provider}" + errors: + primary_email: o seu endereço primário deve ser verificado. + onmiauth_info: não foi possível buscar a sua informação. + activerecord: + attributes: + user: + email: E-mail + bitcoin_address: Endereço bitcoin + password: senha + password_confirmation: Confirmação de senha + display_name: Nome de exibição + omniauth_providers: + github: GitHub + bitbucket: BitBucket + general: + or: ou + disclaimer: + line1: "Tip4Commit não está afiliado com a maior parte dos projetos." + line2: "Não há garantia que as gorjetas serão reclamados pelos colaboradores." + line3: "Ao doar os fundos concorda que poderão ser enviados para a Free Software Foundation ou para qualquer outro lado ao critério da Tip4Commit." From 47b0ac2390ba610bfd95bdfa884f137629337991 Mon Sep 17 00:00:00 2001 From: Joao Date: Wed, 31 Jan 2018 22:01:31 +0000 Subject: [PATCH 276/415] Minor fixes --- README_PT.md | 2 +- config/application.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README_PT.md b/README_PT.md index a07a6089..b285827e 100644 --- a/README_PT.md +++ b/README_PT.md @@ -4,7 +4,7 @@ Tip4commit [![gorjeta para o próximo commit](https://tip4commit.com/projects/307.svg)](https://tip4commit.com/projects/307) [![Estado da build](https://travis-ci.org/tip4commit/tip4commit.svg?branch=master)](https://travis-ci.org/tip4commit/tip4commit) -Doe bitcoins para projetos de codigo aberto ou receba gorjetas por colaborar no código. +Doe bitcoins para projetos de código aberto ou receba gorjetas por colaborar no código. Nome | Ligação ----|----| diff --git a/config/application.rb b/config/application.rb index 48ab0f09..0d627756 100644 --- a/config/application.rb +++ b/config/application.rb @@ -25,7 +25,7 @@ class Application < Rails::Application config.autoload_paths += %W[#{config.root}/lib] config.assets.initialize_on_precompile = true - config.available_locales = %w[en es fr nl ru pl hr de ro ko id ja pt] + config.available_locales = %w[en es fr pt nl ru pl hr de ro ko id ja] config.active_job.queue_adapter = :sidekiq end end From db8514b9f2a4f28361b656cccb7372533aedf354 Mon Sep 17 00:00:00 2001 From: Joao Date: Wed, 31 Jan 2018 22:14:48 +0000 Subject: [PATCH 277/415] removed from application.rb for testing --- config/application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index 0d627756..80727a7b 100644 --- a/config/application.rb +++ b/config/application.rb @@ -25,7 +25,7 @@ class Application < Rails::Application config.autoload_paths += %W[#{config.root}/lib] config.assets.initialize_on_precompile = true - config.available_locales = %w[en es fr pt nl ru pl hr de ro ko id ja] + config.available_locales = %w[en es fr nl ru pl hr de ro ko id ja] config.active_job.queue_adapter = :sidekiq end end From 06a0ea9d6e0159b6ec8d1d87e71d983cdc487df9 Mon Sep 17 00:00:00 2001 From: Joao Date: Wed, 31 Jan 2018 22:28:11 +0000 Subject: [PATCH 278/415] fix --- config/application.rb | 2 +- config/locales/pt.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/application.rb b/config/application.rb index 80727a7b..48ab0f09 100644 --- a/config/application.rb +++ b/config/application.rb @@ -25,7 +25,7 @@ class Application < Rails::Application config.autoload_paths += %W[#{config.root}/lib] config.assets.initialize_on_precompile = true - config.available_locales = %w[en es fr nl ru pl hr de ro ko id ja] + config.available_locales = %w[en es fr nl ru pl hr de ro ko id ja pt] config.active_job.queue_adapter = :sidekiq end end diff --git a/config/locales/pt.yml b/config/locales/pt.yml index 560fa282..0ea07ff8 100644 --- a/config/locales/pt.yml +++ b/config/locales/pt.yml @@ -1,4 +1,4 @@ -en: +pt: tip4commit: Tip4Commit meta: title: Colabora para Código Aberto From 63f3398a2a3a3a8078e63e0b1294c0e6676b9254 Mon Sep 17 00:00:00 2001 From: Humz Date: Sat, 10 Mar 2018 13:25:20 +0000 Subject: [PATCH 279/415] Updated License year to 2018 --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 01081a42..62c97553 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2017 tip4commit +Copyright (c) 2018 tip4commit Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in From e5516aec68c25876b2b7cf0406bf09e627598481 Mon Sep 17 00:00:00 2001 From: dengshen Date: Thu, 5 Apr 2018 18:43:19 +0800 Subject: [PATCH 280/415] add simplified chinese for the people's republic of China and traditional chinese for Hong Kong --- app/assets/images/flags/cn.png | Bin 0 -> 538 bytes app/assets/images/flags/hk.png | Bin 0 -> 589 bytes config/application.rb | 2 +- config/locales/cn.yml | 233 +++++++++++++++++++++++++++++++++ config/locales/hk.yml | 233 +++++++++++++++++++++++++++++++++ 5 files changed, 467 insertions(+), 1 deletion(-) create mode 100755 app/assets/images/flags/cn.png create mode 100755 app/assets/images/flags/hk.png create mode 100644 config/locales/cn.yml create mode 100644 config/locales/hk.yml diff --git a/app/assets/images/flags/cn.png b/app/assets/images/flags/cn.png new file mode 100755 index 0000000000000000000000000000000000000000..73e54843a8a515b7c65a31ada3a94f73804176c4 GIT binary patch literal 538 zcmV+#0_FXQP)Px#32;bRa{vGf6951U69E94oEQKA00(qQO+^RV0|O8{6=yBzbN~PV8FWQhbVF}# zZDnqB07G(RVRU6=Aa`kWXdp*PO;A^X4i^9b0f$LMK~yNuosvCn6hRP$zxtUOuXlwJ zWL$s%i3}1Xgt!1)00(dg4#1&+fC~^3k`ds@32U>v!|v20=<%AElB!GHPxY!_RoREP z=MM+B0Rd(}fecI_W-GwjU1}J{D2?{*#iO5Ro2v&*4X8aVpN?$4=1fv8NkVgMUaXgA z7p}-1t7P?BuuAMS*nVGd@&w8|DtnY2)%B1an!U28B6n^cSeM*;bKw5F15!tg$)6ts z)&-scnV1KPglz7aScD}JXxDM^{w_Wg);ZdW<+B~@PaU#ql3kc;mH{e3BuNBhFkLza z2@rQ)jjTVO;{Ctc3(1c?a4#%^v5_hs>!lQ%klD(y^C0`@V;-=rs+5`c_X!Iq$VNvwjL4W;rA8W>t79YCr%c4 z-(!7`MdI$5ds`*5MqCqAG5KBzoEY;KN=(}g({|IO95+$N({7$H#?{%7pC3PeIhYOn chmF$s7ogza=@FoGf&c&j07*qoM6N<$f@Z$mM*si- literal 0 HcmV?d00001 diff --git a/app/assets/images/flags/hk.png b/app/assets/images/flags/hk.png new file mode 100755 index 0000000000000000000000000000000000000000..cb23585b37c02364c35f97cebb9384536becaa10 GIT binary patch literal 589 zcmV-T0Px#32;bRa{vGf6951U69E94oEQKA00(qQO+^RV0|OBT5AkI)hX4Qo8FWQhbVF}# zZDnqB07G(RVRU6=Aa`kWXdp*PO;A^X4i^9b0lG;#;_~wnHO}8cj%zy$IAP}|Hm;eb(fH9PY_WsQAFO&Tr`;b6F zb=>yCzq!I{XYy+*a!|6dMVJa8RD?D+p@3zD5LU`o5lNKDL7E31IVPyPlmcag-S-|* z27OjuJjDbuucZl>un2P^AQLh%4-9A>o5k7_bkAQUrgkxPYo5mR44#2SV3EiZB1xhK zCFBk&?3{l{Lv`(I4@y->97*F5@i@+@cB2gxmiMQH(yMLF#y9F8t z4w3t(=`Xxt@%AOWYGN_Ir))q3PQ*Ad66&!=YpdkU5qcM{VXZdZb93PKhgA2(A}xnY zOKiA^P8Y8#P$4He^k2VZ`PoB$e)_xY#aW>){w2ufk4n)sYR%c!?dVzl08wBG+~6SZ~PZwO=9oowc-+0$p6W=;OX bhSKmCG?u%{branch} 分支" + make_commits_link: 提交代码 + tell_us_bitcoin_address: "请 %{tell_us_link} 您的比特币地址。" + tell_us_link: 告诉我们 + sign_in: "请告诉我们您的电子邮箱地址或 %{sign_in_link}." + promote_project: 推广 %{project} + embedding: 嵌入 + image_url: "图片地址:" + shield_title: 打赏下一个代码提交 + edit: + project_settings: "%{project} 项目设置" + branch: 分支 + default_branch: 默认分支 + tipping_policies: 打赏规则 + hold_tips: "不要立即发送打赏。让其他协作者可以在发送前修改打赏金额" + save: 保存项目设置 + disable_notifications: 不要通知新的贡献值 + decide_tip_amounts: + commit: 代码提交 + author: 作者 + message: 消息 + tip: 打赏 (和项目资金平衡相关) + submit: 发送已选定的打赏金额 + blacklisted: + title: 抱歉,这个项目不接受打赏! + message: 这个项目的作者选择禁止项目打赏。 + tips: + index: + tips: 打赏 + project_tips: '%{project} 打赏' + user_tips: "%{user} 打赏" + created_at: 创建于 + commiter: 代码提交者 + project: 项目 + commit: 代码提交 + amount: 数额 + refunded: 捐赠给了项目存款 + undecided: 该打赏金额还未确定 + no_bitcoin_address: 用户没有指定退款地址 + below_threshold: "用户的资金平衡低于退款门槛" + waiting: 等待退款 + error: (发送交易错误) + deposits: + index: + project_deposits: '%{project} 存款' + deposits: 存款 + created_at: 创建于 + project: 项目 + amount: 数额 + transaction: 交易 + confirmed: 已确认 + confirmed_yes: '是' + confirmed_no: '否' + users: + index: + title: 最高贡献者 + name: 名字 + commits_count: 已打赏的代码提交 + withdrawn: 已退款 + show: + balance: 资金平衡 + threshold: "您将收到您的钱,当您的资金平衡达到门槛 %{threshold} 的时候" + see_all: 查看所有 + received: "%{time} 收到了 %{amount} 因为代码提交 %{commit} 在 %{project}" + bitcoin_address_placeholder: 您的比特币地址 + notify: 通知我新的打赏 (每个月不多于一封邮件) + submit_user: 更新用户信息 + change_password: 更改您的密码 + submit_password: 更改密码 + use_from_gravatar: 使用您的gravatar账户 + withdrawals: + index: + title: 最后的退款 + created_at: 创建于 + transaction: 交易 + result: 结果 + error: 错误 + success: 成功 + devise: + sessions: + new: + title: 登录 + remember_me: 记住我 + submit: 登录 + registrations: + new: + title: 注册 + submit: 注册 + passwords: + new: + title: 忘记您的密码? + submit: 给我发送重设密码的指引 + edit: + title: 更改您的密码 + submit: 更改密码 + confirmations: + new: + title: 重新发送确认指引 + submit: 重新发送确认指引 + links: + sign_in: 登录 + sign_up: 注册 + recover: 忘记您的密码? + confirm: 没有收到确认指引? + sign_in_with: "用 %{provider}登录" + errors: + primary_email: 您需要确认主要邮箱地址 + onmiauth_info: 我们未成功获取您的信息 + activerecord: + attributes: + user: + email: 电子邮箱 + bitcoin_address: 比特币地址 + password: 密码 + password_confirmation: 确认密码 + display_name: 显示名称 + omniauth_providers: + github: GitHub + bitbucket: BitBucket + general: + or: 或者 + disclaimer: + line1: "Tip4Commit 不隶属于大多数项目。" + line2: "不保证开发人员将接受打赏。" + line3: "捐赠即代表您同意这些金额可以被发送给共享软件联盟或其他Tip4Commit裁定的地方。" diff --git a/config/locales/hk.yml b/config/locales/hk.yml new file mode 100644 index 00000000..1f5e0b1d --- /dev/null +++ b/config/locales/hk.yml @@ -0,0 +1,233 @@ +en: + tip4commit: Tip4Commit + meta: + title: 為開源做貢獻 + description: 給開源項目捐獻比特幣或者通過提交代碼獲得打賞。 + menu: + home: 主頁 + projects: 支持的項目 + footer: + text: "您可以在 %{github_link} 查看源代碼,或者 %{support_link} 這個項目的開發." + github_link: GitHub + support_link: 支持 + follow_link: 關註 @tip4commit + links: + sign_up: 註冊 + sign_in: 登錄 + sign_in_imp: 登錄 + sign_out: 註冊 + create_issue: 創建壹個問題 + errors: + project_not_found: 項目未找到。 + opt_in_notice: "由於項目維護者的投訴,我們不再自動添加項目。沒有存款的現存項目已經被移除。如果您想添加您的項目,請 %{create_issue_link}." + access_denied: 拒絕訪問 + can_assign_more_tips: "您不能分配超過 100% 的可用資金。" + wrong_bitcoin_address: 更新比特幣地址出錯 + user_not_found: 未找到用戶 + access_denied: 您不被允許執行此操作! + notices: + project_updated: 項目設置已經更新 + tips_decided: 打賞總額已經成功定義 + user_updated: 您的信息已保存! + user_unsubscribed: "您已成功註銷!抱歉給您帶來困擾。然而,您仍然可以給我們留下您的比特幣地址以獲得您的打賞。" + tip_amounts: + undecided: "未決定" + free: "免費: 0%" + tiny: "微小: 0.1%" + small: "偏小: 0.5%" + normal: "中等: 1%" + big: "偏大: 2%" + huge: "巨大: 5%" + js: + errors: + value: + invalid: 數值無效 + email: + invalid: 無效電子郵箱地址 + blank: 電子郵箱地址為必填且不能為空 + password: + blank: 密碼為必填且不能為空 + invalid: 密碼和確認密碼不相同 + password_confirmation: + blank: 確認密碼為必填且不能為空 + invalid: 密碼和確認密碼不相同 + home: + index: + see_projects: 查看項目 + how_does_it_work: + title: 它如何運行? + text: 人們給項目捐贈比特幣。當有人提交新的代碼並被接納到項目倉庫,我們將自動打賞提交的作者。 + button: 了解更多關於比特幣的知識 + donate: + title: 捐贈 + text: 找到壹個您喜歡的項目並存入比特幣。您的捐贈將和其他捐贈者的金額壹起累積起來用於打賞給新的代碼提交。 + button: 查找或添加項目 + contribute: + title: 貢獻 + text: 去修復壹些問題吧!如果您的提交被項目維護者接受,您將得到打賞! + sign_in_text: "請查收您的邀請郵件或者 %{sign_in_link}." + sign_up_text: "如果您還未收到邀請,您可以通過有效的郵箱地址 %{sign_up_link} 或者通過" + button: 支持的項目 + projects: + index: + find_project: + placeholder: 輸入GitHub項目地址或者任意關鍵詞來查找... + button: 查找項目 + repository: 倉庫 + description: 描述 + watchers: 觀察者 + balance: 資金平衡 + forked_from: 分岔自 + support: 支持項目 + show: + title: "貢獻給 %{project}" + fetch_pending: (未完成的初始拉取) + edit_project: 修改項目設置 + decide_tip_amounts: 決定打賞金額 + disabled_notifications: "項目維護者決定不再提醒新的貢獻者關於打賞的事情而且他們可能不喜歡這種方式的籌資。" + fee: "%{percentage} 的存款余額將被用於打賞新的代碼提交。" + balance: 資金平衡 + deposits: 存款 + custom_tip_size: (每個新提交將收到部分百分比的可用余額) + default_tip_size: "(每個新提交將收到 %{percentage} 的可用余額)" + min_tip_size: "最小打賞金額被設為 %{min_tip},但如果可用余額小於最小打賞它將被當作壹筆更小的打賞發送" + unconfirmed_amount: "(%{amount} 未確定)" + tipping_policies: 打賞規則 + updated_by_user: "(上壹次更新由 %{name} 於 %{date})" + updated_by_unknown: "(上壹次更新於 %{date})" + tips_paid: 已支付打賞 + unclaimed_amount: "(%{amount} 無人認領,如果壹個月後仍然無人認領該筆金額將被退回給這個項目)" + last_tips: 最新打賞 + see_all: 查看所有 + received: "收到 %{amount}" + will_receive: 將接收壹次打賞 + for_commit: 給代碼提交 + when_decided: 當它的金額被確定 + next_tip: 下壹次打賞 + contribute_and_earn: 貢獻而獲取收益 + contribute_and_earn_description: "捐贈比特幣給這個項目或者 %{make_commits_link} 來獲得打賞。如果您的代碼提交被接納 %{branch} 得到項目維護者認可而且項目有比特幣余額,您將獲得獎賞" + contribute_and_earn_branch: "給 %{branch} 分支" + make_commits_link: 提交代碼 + tell_us_bitcoin_address: "請 %{tell_us_link} 您的比特幣地址。" + tell_us_link: 告訴我們 + sign_in: "請告訴我們您的電子郵箱地址或 %{sign_in_link}." + promote_project: 推廣 %{project} + embedding: 嵌入 + image_url: "圖片地址:" + shield_title: 打賞下壹個代碼提交 + edit: + project_settings: "%{project} 項目設置" + branch: 分支 + default_branch: 默認分支 + tipping_policies: 打賞規則 + hold_tips: "不要立即發送打賞。讓其他協作者可以在發送前修改打賞金額" + save: 保存項目設置 + disable_notifications: 不要通知新的貢獻值 + decide_tip_amounts: + commit: 代碼提交 + author: 作者 + message: 消息 + tip: 打賞 (和項目資金平衡相關) + submit: 發送已選定的打賞金額 + blacklisted: + title: 抱歉,這個項目不接受打賞! + message: 這個項目的作者選擇禁止項目打賞。 + tips: + index: + tips: 打賞 + project_tips: '%{project} 打賞' + user_tips: "%{user} 打賞" + created_at: 創建於 + commiter: 代碼提交者 + project: 項目 + commit: 代碼提交 + amount: 數額 + refunded: 捐贈給了項目存款 + undecided: 該打賞金額還未確定 + no_bitcoin_address: 用戶沒有指定退款地址 + below_threshold: "用戶的資金平衡低於退款門檻" + waiting: 等待退款 + error: (發送交易錯誤) + deposits: + index: + project_deposits: '%{project} 存款' + deposits: 存款 + created_at: 創建於 + project: 項目 + amount: 數額 + transaction: 交易 + confirmed: 已確認 + confirmed_yes: '是' + confirmed_no: '否' + users: + index: + title: 最高貢獻者 + name: 名字 + commits_count: 已打賞的代碼提交 + withdrawn: 已退款 + show: + balance: 資金平衡 + threshold: "您將收到您的錢,當您的資金平衡達到門檻 %{threshold} 的時候" + see_all: 查看所有 + received: "%{time} 收到了 %{amount} 因為代碼提交 %{commit} 在 %{project}" + bitcoin_address_placeholder: 您的比特幣地址 + notify: 通知我新的打賞 (每個月不多於壹封郵件) + submit_user: 更新用戶信息 + change_password: 更改您的密碼 + submit_password: 更改密碼 + use_from_gravatar: 使用您的gravatar賬戶 + withdrawals: + index: + title: 最後的退款 + created_at: 創建於 + transaction: 交易 + result: 結果 + error: 錯誤 + success: 成功 + devise: + sessions: + new: + title: 登錄 + remember_me: 記住我 + submit: 登錄 + registrations: + new: + title: 註冊 + submit: 註冊 + passwords: + new: + title: 忘記您的密碼? + submit: 給我發送重設密碼的指引 + edit: + title: 更改您的密碼 + submit: 更改密碼 + confirmations: + new: + title: 重新發送確認指引 + submit: 重新發送確認指引 + links: + sign_in: 登錄 + sign_up: 註冊 + recover: 忘記您的密碼? + confirm: 沒有收到確認指引? + sign_in_with: "用 %{provider}登錄" + errors: + primary_email: 您需要確認主要郵箱地址 + onmiauth_info: 我們未成功獲取您的信息 + activerecord: + attributes: + user: + email: 電子郵箱 + bitcoin_address: 比特幣地址 + password: 密碼 + password_confirmation: 確認密碼 + display_name: 顯示名稱 + omniauth_providers: + github: GitHub + bitbucket: BitBucket + general: + or: 或者 + disclaimer: + line1: "Tip4Commit 不隸屬於大多數項目。" + line2: "不保證開發人員將接受打賞。" + line3: "捐贈即代表您同意這些金額可以被發送給共享軟件聯盟或其他Tip4Commit裁定的地方。" From 6cacbfabf9fc929c7c82539b58f8cf3fb93b2a61 Mon Sep 17 00:00:00 2001 From: bashgnu <38274202+bashgnu@users.noreply.github.com> Date: Tue, 17 Apr 2018 08:24:01 +0800 Subject: [PATCH 281/415] Added official twitter account to Readme. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e0401e91..478adcff 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ Official site | https://tip4commit.com/ Discussions | https://bitcointalk.org/index.php?topic=31580 FAQs | https://github.com/tip4commit/tip4commit/wiki/FAQ Issues | https://github.com/tip4commit/tip4commit/issues +Twitter | https://twitter.com/tip4commit Developers ========== From d0c3b0683e20a3527e26d02f012891629859a943 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 27 May 2018 19:27:05 +0200 Subject: [PATCH 282/415] updated rails-html-sanitizer --- Gemfile.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index a44127ee..be2ed0ea 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -118,7 +118,7 @@ GEM connection_pool (2.2.0) crack (0.4.3) safe_yaml (~> 1.0.0) - crass (1.0.3) + crass (1.0.4) cucumber (1.3.20) builder (>= 2.1.2) diff-lcs (>= 1.1.3) @@ -205,7 +205,7 @@ GEM actionpack (>= 3.1) less (~> 2.4.0) libv8 (3.16.14.19) - loofah (2.1.1) + loofah (2.2.2) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.0) @@ -225,7 +225,7 @@ GEM net-ssh (>= 2.6.5) net-ssh (4.1.0) netrc (0.11.0) - nokogiri (1.8.1) + nokogiri (1.8.2) mini_portile2 (~> 2.3.0) oauth2 (1.4.0) faraday (>= 0.8, < 0.13) @@ -263,8 +263,8 @@ GEM activesupport (>= 4.2.0.beta, < 5.0) nokogiri (~> 1.6) rails-deprecated_sanitizer (>= 1.0.1) - rails-html-sanitizer (1.0.3) - loofah (~> 2.0) + rails-html-sanitizer (1.0.4) + loofah (~> 2.2, >= 2.2.2) rails-i18n (4.0.3) i18n (~> 0.6) railties (~> 4.0) From dbf504019d5fe754f38bb1115986e14ff4bae3a3 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 27 May 2018 19:30:39 +0200 Subject: [PATCH 283/415] added malaysian flag --- app/assets/images/flags/my.png | Bin 0 -> 571 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 app/assets/images/flags/my.png diff --git a/app/assets/images/flags/my.png b/app/assets/images/flags/my.png new file mode 100644 index 0000000000000000000000000000000000000000..9034cbab2c02704b65fba6ecc4a7a1c1d053b6c5 GIT binary patch literal 571 zcmV-B0>u4^P)Z-xKO+5@Bcl`=5c~|G$6#Vc^TNX8-{JF#yj01a@w+002>mTdm0Dxpa1{C#)An)W@eTA0)PNwiNI_f1h_u_DTrb&+z}xv;{Wj zFGj0Cgf$G002ov JPDHLkV1gu%1+M@A literal 0 HcmV?d00001 From 41e6dce46407eceedd3b3ad7fc8bbf376b41cb31 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 27 May 2018 19:31:37 +0200 Subject: [PATCH 284/415] added malaysian to the list of locales --- config/application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index 48ab0f09..8411a688 100644 --- a/config/application.rb +++ b/config/application.rb @@ -25,7 +25,7 @@ class Application < Rails::Application config.autoload_paths += %W[#{config.root}/lib] config.assets.initialize_on_precompile = true - config.available_locales = %w[en es fr nl ru pl hr de ro ko id ja pt] + config.available_locales = %w[en es fr nl ru pl hr de ro ko id ja pt my] config.active_job.queue_adapter = :sidekiq end end From 71f3e5be7f1913f921c56a991f8b3a320c8ae4bc Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 28 May 2018 21:31:04 +0200 Subject: [PATCH 285/415] fixed chinese locales --- config/locales/cn.yml | 2 +- config/locales/hk.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/cn.yml b/config/locales/cn.yml index a9814213..b536d3e4 100644 --- a/config/locales/cn.yml +++ b/config/locales/cn.yml @@ -1,4 +1,4 @@ -en: +cn: tip4commit: Tip4Commit meta: title: 为开源做贡献 diff --git a/config/locales/hk.yml b/config/locales/hk.yml index 1f5e0b1d..b739fb49 100644 --- a/config/locales/hk.yml +++ b/config/locales/hk.yml @@ -1,4 +1,4 @@ -en: +hk: tip4commit: Tip4Commit meta: title: 為開源做貢獻 From 7690014fba15f16a60165e95374fb51631732f16 Mon Sep 17 00:00:00 2001 From: "Brian (bex) Exelbierd" Date: Sun, 10 Jun 2018 19:29:59 +0200 Subject: [PATCH 286/415] Fix spelling and replace non-word --- config/locales/en.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 6ba186f1..7411f4f0 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -60,7 +60,7 @@ en: button: Learn about Bitcoin donate: title: Donate - text: Find a project you like and deposit bitcoins into it. Your donation will be accumulated with the funds of other donators to give as tips for new commits. + text: Find a project you like and deposit bitcoins into it. Your donation will be accumulated with the funds of other donors to give as tips for new commits. button: Find or add a project contribute: title: Contribute @@ -138,7 +138,7 @@ en: project_tips: '%{project} tips' user_tips: "%{user} tips" created_at: Created At - commiter: Commiter + commiter: Committer project: Project commit: Commit amount: Amount From 835fa6da50f0c6d8750e8344584debd8b9beb5f7 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 24 Jun 2018 11:15:02 +0200 Subject: [PATCH 287/415] updated sprocket to fix CVE-2018-3760 --- Gemfile | 1 + Gemfile.lock | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 2ca86ae4..62ebbcb2 100644 --- a/Gemfile +++ b/Gemfile @@ -35,6 +35,7 @@ gem 'sass-rails', '~> 4.0.0' gem 'sawyer', '~> 0.8.0' gem 'sdoc', group: :doc, require: false gem 'sidekiq' +gem 'sprockets', '~> 2.12.5' gem 'therubyracer', '~> 0.12.2', platforms: :ruby gem 'turbolinks', '~> 2.5.0' gem 'twitter-bootstrap-rails', github: 'seyhunak/twitter-bootstrap-rails', branch: 'bootstrap3' diff --git a/Gemfile.lock b/Gemfile.lock index be2ed0ea..8db07a31 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -216,7 +216,7 @@ GEM minitest (5.10.3) money-tree (0.9.0) ffi - multi_json (1.12.2) + multi_json (1.13.1) multi_test (0.1.2) multi_xml (0.6.0) multipart-post (2.0.0) @@ -243,7 +243,7 @@ GEM omniauth (~> 1.2) orm_adapter (0.5.0) public_suffix (3.0.1) - rack (1.6.8) + rack (1.6.10) rack-test (0.6.3) rack (>= 1.0) rails (4.2.10) @@ -334,7 +334,7 @@ GEM json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.2) - sprockets (2.12.4) + sprockets (2.12.5) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) @@ -423,6 +423,7 @@ DEPENDENCIES shoulda-matchers (~> 3.1) sidekiq simplecov + sprockets (~> 2.12.5) sqlite3 (~> 1.3.11) therubyracer (~> 0.12.2) turbolinks (~> 2.5.0) From 2efc74fb4a5cd247423a273c0a2f810b78ffcf5e Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 2 Dec 2018 16:58:52 +0100 Subject: [PATCH 288/415] upgraded rails and ffi gems --- Gemfile | 6 ++-- Gemfile.lock | 92 ++++++++++++++++++++++++++-------------------------- 2 files changed, 49 insertions(+), 49 deletions(-) diff --git a/Gemfile b/Gemfile index 62ebbcb2..44975f43 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' ruby '2.4.2' -gem 'rails', '4.2.10' +gem 'rails', '4.2.11' gem 'acts_as_paranoid', github: 'ActsAsParanoid/acts_as_paranoid' gem 'airbrake', '~> 3.1.15' @@ -23,7 +23,7 @@ gem 'jquery-turbolinks' gem 'kaminari', '~> 0.15.0' gem 'kaminari-i18n' gem 'less-rails', '~> 2.4.2' -gem 'money-tree', '~> 0.9.0' +gem 'money-tree', '~> 0.10.0' gem 'mysql2', group: :production gem 'octokit', '~> 4.7.0' gem 'omniauth', '~> 1.7.1' @@ -66,6 +66,6 @@ group :test do gem 'rspec-activemodel-mocks' gem 'shoulda-matchers', '~> 3.1' gem 'simplecov' - gem 'webmock' gem 'vcr' + gem 'webmock' end diff --git a/Gemfile.lock b/Gemfile.lock index 8db07a31..70903189 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -43,36 +43,36 @@ GIT GEM remote: https://rubygems.org/ specs: - actionmailer (4.2.10) - actionpack (= 4.2.10) - actionview (= 4.2.10) - activejob (= 4.2.10) + actionmailer (4.2.11) + actionpack (= 4.2.11) + actionview (= 4.2.11) + activejob (= 4.2.11) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.10) - actionview (= 4.2.10) - activesupport (= 4.2.10) + actionpack (4.2.11) + actionview (= 4.2.11) + activesupport (= 4.2.11) rack (~> 1.6) rack-test (~> 0.6.2) rails-dom-testing (~> 1.0, >= 1.0.5) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.10) - activesupport (= 4.2.10) + actionview (4.2.11) + activesupport (= 4.2.11) builder (~> 3.1) erubis (~> 2.7.0) rails-dom-testing (~> 1.0, >= 1.0.5) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (4.2.10) - activesupport (= 4.2.10) + activejob (4.2.11) + activesupport (= 4.2.11) globalid (>= 0.3.0) - activemodel (4.2.10) - activesupport (= 4.2.10) + activemodel (4.2.11) + activesupport (= 4.2.11) builder (~> 3.1) - activerecord (4.2.10) - activemodel (= 4.2.10) - activesupport (= 4.2.10) + activerecord (4.2.11) + activemodel (= 4.2.11) + activesupport (= 4.2.11) arel (~> 6.0) - activesupport (4.2.10) + activesupport (4.2.11) i18n (~> 0.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) @@ -114,7 +114,7 @@ GEM execjs coffee-script-source (1.9.1.1) commonjs (0.2.7) - concurrent-ruby (1.0.5) + concurrent-ruby (1.1.3) connection_pool (2.2.0) crack (0.4.3) safe_yaml (~> 1.0.0) @@ -160,7 +160,7 @@ GEM railties (>= 3.0.0) faraday (0.12.2) multipart-post (>= 1.2, < 3) - ffi (1.9.18) + ffi (1.9.25) gherkin (2.12.2) multi_json (~> 1.3) globalid (0.4.1) @@ -178,7 +178,7 @@ GEM http-cookie (1.0.2) domain_name (~> 0.5) http_accept_language (2.0.2) - i18n (0.9.1) + i18n (0.9.5) concurrent-ruby (~> 1.0) i18n-js (2.1.2) i18n @@ -205,16 +205,16 @@ GEM actionpack (>= 3.1) less (~> 2.4.0) libv8 (3.16.14.19) - loofah (2.2.2) + loofah (2.2.3) crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.7.0) + mail (2.7.1) mini_mime (>= 0.1.1) mime-types (2.99.3) - mini_mime (1.0.0) + mini_mime (1.0.1) mini_portile2 (2.3.0) - minitest (5.10.3) - money-tree (0.9.0) + minitest (5.11.3) + money-tree (0.10.0) ffi multi_json (1.13.1) multi_test (0.1.2) @@ -225,7 +225,7 @@ GEM net-ssh (>= 2.6.5) net-ssh (4.1.0) netrc (0.11.0) - nokogiri (1.8.2) + nokogiri (1.8.5) mini_portile2 (~> 2.3.0) oauth2 (1.4.0) faraday (>= 0.8, < 0.13) @@ -243,24 +243,24 @@ GEM omniauth (~> 1.2) orm_adapter (0.5.0) public_suffix (3.0.1) - rack (1.6.10) + rack (1.6.11) rack-test (0.6.3) rack (>= 1.0) - rails (4.2.10) - actionmailer (= 4.2.10) - actionpack (= 4.2.10) - actionview (= 4.2.10) - activejob (= 4.2.10) - activemodel (= 4.2.10) - activerecord (= 4.2.10) - activesupport (= 4.2.10) + rails (4.2.11) + actionmailer (= 4.2.11) + actionpack (= 4.2.11) + actionview (= 4.2.11) + activejob (= 4.2.11) + activemodel (= 4.2.11) + activerecord (= 4.2.11) + activesupport (= 4.2.11) bundler (>= 1.3.0, < 2.0) - railties (= 4.2.10) + railties (= 4.2.11) sprockets-rails rails-deprecated_sanitizer (1.0.3) activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.8) - activesupport (>= 4.2.0.beta, < 5.0) + rails-dom-testing (1.0.9) + activesupport (>= 4.2.0, < 5.0) nokogiri (~> 1.6) rails-deprecated_sanitizer (>= 1.0.1) rails-html-sanitizer (1.0.4) @@ -268,12 +268,12 @@ GEM rails-i18n (4.0.3) i18n (~> 0.6) railties (~> 4.0) - railties (4.2.10) - actionpack (= 4.2.10) - activesupport (= 4.2.10) + railties (4.2.11) + actionpack (= 4.2.11) + activesupport (= 4.2.11) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (12.3.0) + rake (12.3.1) rbnacl (3.4.0) ffi rbnacl-libsodium (1.0.11) @@ -350,12 +350,12 @@ GEM therubyracer (0.12.3) libv8 (~> 3.16.14.15) ref - thor (0.20.0) + thor (0.20.3) thread_safe (0.3.6) tilt (1.4.1) turbolinks (2.5.3) coffee-rails - tzinfo (1.2.4) + tzinfo (1.2.5) thread_safe (~> 0.1) uglifier (2.4.0) execjs (>= 0.3.0) @@ -404,12 +404,12 @@ DEPENDENCIES kaminari (~> 0.15.0) kaminari-i18n less-rails (~> 2.4.2) - money-tree (~> 0.9.0) + money-tree (~> 0.10.0) mysql2 octokit (~> 4.7.0) omniauth (~> 1.7.1) omniauth-github! - rails (= 4.2.10) + rails (= 4.2.11) rails-i18n (~> 4.0.0) rbnacl (~> 3.4.0) rbnacl-libsodium (~> 1.0.0) From 8a7464f5f05846cb2a1b8a952a397a6f10256ad0 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 2 Dec 2018 17:16:01 +0100 Subject: [PATCH 289/415] fixed mailer spec --- spec/mailers/user_mailer_spec.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/spec/mailers/user_mailer_spec.rb b/spec/mailers/user_mailer_spec.rb index 34211ffd..efe05a40 100644 --- a/spec/mailers/user_mailer_spec.rb +++ b/spec/mailers/user_mailer_spec.rb @@ -2,7 +2,16 @@ describe UserMailer do describe 'new_tip' do - let(:user) { mock_model User, name: 'kd', email: 'kd.engineer@yahoo.co.in', display_name: 'kuldeep aggarwal', login_token: 'my login token', balance: 10 } + let(:user) do + mock_model( + User, + name: 'kd', + email: 'kd.engineer@yahoo.co.in', + display_name: 'kuldeep aggarwal', + login_token: 'my login token', + balance: 10 + ) + end let(:project) { mock_model Project, full_name: 'logger-extension' } let(:tip) { mock_model Tip, amount: 0.0001, project: project } let(:mail) { UserMailer.new_tip(user, tip) } @@ -27,7 +36,7 @@ expected_text = [ 'Please, log in and tell us your bitcoin address to get it.

', '

Your current balance is 0.00000010 Ƀ' - ].join("\n") + ].join("\r\n") expect(mail.body.encoded).to match expected_text end From 6500bd04e53b4d3a9501fd940ab853bc2dcef7c9 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 2 Dec 2018 17:30:21 +0100 Subject: [PATCH 290/415] upgraded ruby ro 2.4.5 --- .travis.yml | 2 +- Gemfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index ec654f5a..07bbb18b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ git: depth: 10 rvm: - - 2.4.2 + - 2.4.5 bundler_args: --without development --jobs=9 --retry=2 --quiet diff --git a/Gemfile b/Gemfile index 44975f43..284e1e70 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' -ruby '2.4.2' +ruby '2.4.5' gem 'rails', '4.2.11' From 505aedad802095ea65fe061de453c51988405dc4 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 2 Dec 2018 18:09:22 +0100 Subject: [PATCH 291/415] use ruby 2.4.5 in production --- config/deploy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/deploy.rb b/config/deploy.rb index 2b4b8bd9..c5dfdfb4 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -7,7 +7,7 @@ set :scm, :git set :rvm_type, :user -set :rvm_ruby_version, '2.4.2' +set :rvm_ruby_version, '2.4.5' set :rvm_custom_path, '~/.rvm' set :format, :pretty From cae90fe7d462418e2b576c8dc31da51dd1e9524e Mon Sep 17 00:00:00 2001 From: "Brian (bex) Exelbierd" Date: Tue, 24 Sep 2019 11:52:27 +0200 Subject: [PATCH 292/415] Add Year to date displays Fixes #370 --- app/views/deposits/index.html.haml | 2 +- app/views/projects/show.html.haml | 2 +- app/views/tips/index.html.haml | 2 +- app/views/users/show.html.haml | 2 +- app/views/withdrawals/index.html.haml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/deposits/index.html.haml b/app/views/deposits/index.html.haml index 94cdce69..47db0db6 100644 --- a/app/views/deposits/index.html.haml +++ b/app/views/deposits/index.html.haml @@ -17,7 +17,7 @@ %tbody - @deposits.each do |deposit| %tr - %td= l deposit.created_at, format: :short + %td= l deposit.created_at, format: :long - unless @project %td= link_to(deposit.project.full_name, pretty_project_path(deposit.project)) %td= btc_human deposit.amount diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 0ab43a02..a05e85da 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -78,7 +78,7 @@ %ul - @recent_tips.each do |tip| %li - = l tip.created_at, format: :short + = l tip.created_at, format: :long - if tip.user.nickname.blank? = tip.user.display_name - else diff --git a/app/views/tips/index.html.haml b/app/views/tips/index.html.haml index 308b7487..af1ff4d6 100644 --- a/app/views/tips/index.html.haml +++ b/app/views/tips/index.html.haml @@ -20,7 +20,7 @@ %tbody - @tips.each do |tip| %tr - %td= l tip.created_at, format: :short + %td= l tip.created_at, format: :long - unless @user %td - if tip.user.nickname.blank? diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index 1792e2a4..e4710db2 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -18,7 +18,7 @@ %ul - @recent_tips.each do |tip| %li - = raw t('.received', time: l(tip.created_at, format: :short), amount: btc_human(tip.amount), commit: (tip.commit.start_with?('http') ? link_to('details', tip.commit, target: :blank) : link_to(tip.commit[0..6], "https://github.com/#{tip.project.full_name}/commit/#{tip.commit}", target: :blank)), project: link_to(tip.project.full_name, pretty_project_path(tip.project))) + = raw t('.received', time: l(tip.created_at, format: :long), amount: btc_human(tip.amount), commit: (tip.commit.start_with?('http') ? link_to('details', tip.commit, target: :blank) : link_to(tip.commit[0..6], "https://github.com/#{tip.project.full_name}/commit/#{tip.commit}", target: :blank)), project: link_to(tip.project.full_name, pretty_project_path(tip.project))) %p %strong= User.human_attribute_name(:email) diff --git a/app/views/withdrawals/index.html.haml b/app/views/withdrawals/index.html.haml index 2ce24e30..75e85fca 100644 --- a/app/views/withdrawals/index.html.haml +++ b/app/views/withdrawals/index.html.haml @@ -9,6 +9,6 @@ %tbody - @sendmanies.each do |sendmany| %tr - %td= l(sendmany.created_at, format: :short) + %td= l(sendmany.created_at, format: :long) %td= link_to sendmany.txid, "#{block_explorer_tx_url(sendmany.txid)}", target: '_blank' %td= sendmany.is_error ? t('.error') : t('.success') From b3311ec9ddf36043e073dda56a6954d8225b3a8f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Nov 2019 21:03:08 +0000 Subject: [PATCH 293/415] Bump loofah from 2.2.3 to 2.3.1 Bumps [loofah](https://github.com/flavorjones/loofah) from 2.2.3 to 2.3.1. - [Release notes](https://github.com/flavorjones/loofah/releases) - [Changelog](https://github.com/flavorjones/loofah/blob/master/CHANGELOG.md) - [Commits](https://github.com/flavorjones/loofah/compare/v2.2.3...v2.3.1) Signed-off-by: dependabot[bot] --- Gemfile.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 70903189..9a2a87aa 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -118,7 +118,7 @@ GEM connection_pool (2.2.0) crack (0.4.3) safe_yaml (~> 1.0.0) - crass (1.0.4) + crass (1.0.5) cucumber (1.3.20) builder (>= 2.1.2) diff-lcs (>= 1.1.3) @@ -205,14 +205,14 @@ GEM actionpack (>= 3.1) less (~> 2.4.0) libv8 (3.16.14.19) - loofah (2.2.3) + loofah (2.3.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) mime-types (2.99.3) mini_mime (1.0.1) - mini_portile2 (2.3.0) + mini_portile2 (2.4.0) minitest (5.11.3) money-tree (0.10.0) ffi @@ -225,8 +225,8 @@ GEM net-ssh (>= 2.6.5) net-ssh (4.1.0) netrc (0.11.0) - nokogiri (1.8.5) - mini_portile2 (~> 2.3.0) + nokogiri (1.10.5) + mini_portile2 (~> 2.4.0) oauth2 (1.4.0) faraday (>= 0.8, < 0.13) jwt (~> 1.0) From 88e9f10e7b83272f9ae99f3db61d4f566e968b5b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Dec 2019 03:23:49 +0000 Subject: [PATCH 294/415] Bump rack from 1.6.11 to 1.6.12 Bumps [rack](https://github.com/rack/rack) from 1.6.11 to 1.6.12. - [Release notes](https://github.com/rack/rack/releases) - [Changelog](https://github.com/rack/rack/blob/master/CHANGELOG.md) - [Commits](https://github.com/rack/rack/compare/1.6.11...1.6.12) Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 9a2a87aa..a5452b16 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -243,7 +243,7 @@ GEM omniauth (~> 1.2) orm_adapter (0.5.0) public_suffix (3.0.1) - rack (1.6.11) + rack (1.6.12) rack-test (0.6.3) rack (>= 1.0) rails (4.2.11) From 23fb5c5995e157f1543da89c7731ee9052fff4a3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Feb 2020 23:04:39 +0000 Subject: [PATCH 295/415] Bump nokogiri from 1.10.5 to 1.10.8 Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.10.5 to 1.10.8. - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/master/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.10.5...v1.10.8) Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index a5452b16..49245974 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -225,7 +225,7 @@ GEM net-ssh (>= 2.6.5) net-ssh (4.1.0) netrc (0.11.0) - nokogiri (1.10.5) + nokogiri (1.10.8) mini_portile2 (~> 2.4.0) oauth2 (1.4.0) faraday (>= 0.8, < 0.13) From 1fcb6e1f417e8c2b0685c9c71f020142110784f4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 28 Feb 2020 22:06:56 +0000 Subject: [PATCH 296/415] Bump rake from 12.3.1 to 13.0.1 Bumps [rake](https://github.com/ruby/rake) from 12.3.1 to 13.0.1. - [Release notes](https://github.com/ruby/rake/releases) - [Changelog](https://github.com/ruby/rake/blob/master/History.rdoc) - [Commits](https://github.com/ruby/rake/compare/v12.3.1...v13.0.1) Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index a5452b16..5515dcf3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -273,7 +273,7 @@ GEM activesupport (= 4.2.11) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (12.3.1) + rake (13.0.1) rbnacl (3.4.0) ffi rbnacl-libsodium (1.0.11) From de3b6d790c44fb600f5528585efa50380422e1be Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 9 Mar 2020 20:20:31 +0100 Subject: [PATCH 297/415] use coindesk instead of bitcoinaverage for currency conversion --- app/helpers/application_helper.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1c7f04c9..398ddcee 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -151,11 +151,11 @@ def rate(currency, satoshies) end def get_rate(currency) - Rails.cache.fetch('###' + currency, expires_in: 24.hours) do - uri = URI('https://apiv2.bitcoinaverage.com/indices/global/ticker/BTC' + currency) + Rails.cache.fetch('###' + currency, expires_in: 1.hours) do + uri = URI('https://api.coindesk.com/v1/bpi/currentprice/' + currency + '.json') response = Net::HTTP.get_response(uri) hash = JSON.parse(response.body) - hash['averages']['day'].to_f + hash['bpi'][currency]['rate_float'].to_f end end From 60ce433b1e2aafb7d54eed721ddcec17b102071e Mon Sep 17 00:00:00 2001 From: Markus Amalthea Magnuson Date: Thu, 27 Aug 2020 11:40:38 +0200 Subject: [PATCH 298/415] Update blacklist.yml --- config/blacklist.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/blacklist.yml b/config/blacklist.yml index 78b26d62..ff1c6d2d 100644 --- a/config/blacklist.yml +++ b/config/blacklist.yml @@ -36,3 +36,4 @@ - https://github.com/KnightOS/* - https://github.com/KerbalStuff/* - https://github.com/digipost/* +- https://github.com/alimony/* From d0eca2385eb51d02472a0bfc4efe737a9edc72e4 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 7 Nov 2020 13:22:31 +0100 Subject: [PATCH 299/415] upgraded ruby and some gems --- .travis.yml | 2 +- Gemfile | 7 ++-- Gemfile.lock | 99 ++++++++++++++++++++++++------------------------ config/deploy.rb | 2 +- 4 files changed, 56 insertions(+), 54 deletions(-) diff --git a/.travis.yml b/.travis.yml index 07bbb18b..e3edf7f1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ git: depth: 10 rvm: - - 2.4.5 + - 2.4.9 bundler_args: --without development --jobs=9 --retry=2 --quiet diff --git a/Gemfile b/Gemfile index 284e1e70..8a6f3c6c 100644 --- a/Gemfile +++ b/Gemfile @@ -1,11 +1,12 @@ source 'https://rubygems.org' -ruby '2.4.5' +ruby '2.4.9' -gem 'rails', '4.2.11' +gem 'rails', '4.2.11.3' gem 'acts_as_paranoid', github: 'ActsAsParanoid/acts_as_paranoid' gem 'airbrake', '~> 3.1.15' +gem 'bcrypt', '~> 3.1.12' gem 'bootstrap_form', github: 'bootstrap-ruby/rails-bootstrap-forms' gem 'cancancan' gem 'coffee-rails', '~> 4.0.0' @@ -24,7 +25,7 @@ gem 'kaminari', '~> 0.15.0' gem 'kaminari-i18n' gem 'less-rails', '~> 2.4.2' gem 'money-tree', '~> 0.10.0' -gem 'mysql2', group: :production +gem 'mysql2', '~> 0.4.10', group: :production gem 'octokit', '~> 4.7.0' gem 'omniauth', '~> 1.7.1' gem 'omniauth-github', github: 'alexandrz/omniauth-github', branch: 'provide_emails' diff --git a/Gemfile.lock b/Gemfile.lock index 034eb8a2..1a6d0641 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -43,36 +43,36 @@ GIT GEM remote: https://rubygems.org/ specs: - actionmailer (4.2.11) - actionpack (= 4.2.11) - actionview (= 4.2.11) - activejob (= 4.2.11) + actionmailer (4.2.11.3) + actionpack (= 4.2.11.3) + actionview (= 4.2.11.3) + activejob (= 4.2.11.3) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.11) - actionview (= 4.2.11) - activesupport (= 4.2.11) + actionpack (4.2.11.3) + actionview (= 4.2.11.3) + activesupport (= 4.2.11.3) rack (~> 1.6) rack-test (~> 0.6.2) rails-dom-testing (~> 1.0, >= 1.0.5) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.11) - activesupport (= 4.2.11) + actionview (4.2.11.3) + activesupport (= 4.2.11.3) builder (~> 3.1) erubis (~> 2.7.0) rails-dom-testing (~> 1.0, >= 1.0.5) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (4.2.11) - activesupport (= 4.2.11) + activejob (4.2.11.3) + activesupport (= 4.2.11.3) globalid (>= 0.3.0) - activemodel (4.2.11) - activesupport (= 4.2.11) + activemodel (4.2.11.3) + activesupport (= 4.2.11.3) builder (~> 3.1) - activerecord (4.2.11) - activemodel (= 4.2.11) - activesupport (= 4.2.11) + activerecord (4.2.11.3) + activemodel (= 4.2.11.3) + activesupport (= 4.2.11.3) arel (~> 6.0) - activesupport (4.2.11) + activesupport (4.2.11.3) i18n (~> 0.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) @@ -83,9 +83,9 @@ GEM builder multi_json arel (6.0.4) - bcrypt (3.1.10) + bcrypt (3.1.16) bcrypt_pbkdf (1.0.0) - builder (3.2.3) + builder (3.2.4) cancancan (1.7.1) capistrano (3.4.1) i18n @@ -114,11 +114,11 @@ GEM execjs coffee-script-source (1.9.1.1) commonjs (0.2.7) - concurrent-ruby (1.1.3) + concurrent-ruby (1.1.7) connection_pool (2.2.0) crack (0.4.3) safe_yaml (~> 1.0.0) - crass (1.0.5) + crass (1.0.6) cucumber (1.3.20) builder (>= 2.1.2) diff-lcs (>= 1.1.3) @@ -163,7 +163,7 @@ GEM ffi (1.9.25) gherkin (2.12.2) multi_json (~> 1.3) - globalid (0.4.1) + globalid (0.4.2) activesupport (>= 4.2.0) haml (4.0.5) tilt @@ -205,27 +205,27 @@ GEM actionpack (>= 3.1) less (~> 2.4.0) libv8 (3.16.14.19) - loofah (2.3.1) + loofah (2.7.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) mime-types (2.99.3) - mini_mime (1.0.1) + mini_mime (1.0.2) mini_portile2 (2.4.0) - minitest (5.11.3) + minitest (5.14.2) money-tree (0.10.0) ffi - multi_json (1.13.1) + multi_json (1.15.0) multi_test (0.1.2) multi_xml (0.6.0) multipart-post (2.0.0) - mysql2 (0.3.14) + mysql2 (0.4.10) net-scp (1.2.1) net-ssh (>= 2.6.5) net-ssh (4.1.0) netrc (0.11.0) - nokogiri (1.10.8) + nokogiri (1.10.10) mini_portile2 (~> 2.4.0) oauth2 (1.4.0) faraday (>= 0.8, < 0.13) @@ -243,19 +243,19 @@ GEM omniauth (~> 1.2) orm_adapter (0.5.0) public_suffix (3.0.1) - rack (1.6.12) + rack (1.6.13) rack-test (0.6.3) rack (>= 1.0) - rails (4.2.11) - actionmailer (= 4.2.11) - actionpack (= 4.2.11) - actionview (= 4.2.11) - activejob (= 4.2.11) - activemodel (= 4.2.11) - activerecord (= 4.2.11) - activesupport (= 4.2.11) + rails (4.2.11.3) + actionmailer (= 4.2.11.3) + actionpack (= 4.2.11.3) + actionview (= 4.2.11.3) + activejob (= 4.2.11.3) + activemodel (= 4.2.11.3) + activerecord (= 4.2.11.3) + activesupport (= 4.2.11.3) bundler (>= 1.3.0, < 2.0) - railties (= 4.2.11) + railties (= 4.2.11.3) sprockets-rails rails-deprecated_sanitizer (1.0.3) activesupport (>= 4.2.0.alpha) @@ -263,14 +263,14 @@ GEM activesupport (>= 4.2.0, < 5.0) nokogiri (~> 1.6) rails-deprecated_sanitizer (>= 1.0.1) - rails-html-sanitizer (1.0.4) - loofah (~> 2.2, >= 2.2.2) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) rails-i18n (4.0.3) i18n (~> 0.6) railties (~> 4.0) - railties (4.2.11) - actionpack (= 4.2.11) - activesupport (= 4.2.11) + railties (4.2.11.3) + actionpack (= 4.2.11.3) + activesupport (= 4.2.11.3) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (13.0.1) @@ -350,12 +350,12 @@ GEM therubyracer (0.12.3) libv8 (~> 3.16.14.15) ref - thor (0.20.3) + thor (1.0.1) thread_safe (0.3.6) tilt (1.4.1) turbolinks (2.5.3) coffee-rails - tzinfo (1.2.5) + tzinfo (1.2.7) thread_safe (~> 0.1) uglifier (2.4.0) execjs (>= 0.3.0) @@ -379,6 +379,7 @@ PLATFORMS DEPENDENCIES acts_as_paranoid! airbrake (~> 3.1.15) + bcrypt (~> 3.1.12) bcrypt_pbkdf (~> 1.0.0) bootstrap_form! cancancan @@ -405,11 +406,11 @@ DEPENDENCIES kaminari-i18n less-rails (~> 2.4.2) money-tree (~> 0.10.0) - mysql2 + mysql2 (~> 0.4.10) octokit (~> 4.7.0) omniauth (~> 1.7.1) omniauth-github! - rails (= 4.2.11) + rails (= 4.2.11.3) rails-i18n (~> 4.0.0) rbnacl (~> 3.4.0) rbnacl-libsodium (~> 1.0.0) @@ -434,7 +435,7 @@ DEPENDENCIES webmock RUBY VERSION - ruby 2.4.2p198 + ruby 2.4.9p362 BUNDLED WITH - 1.16.0 + 1.17.3 diff --git a/config/deploy.rb b/config/deploy.rb index c5dfdfb4..0a85b48c 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -7,7 +7,7 @@ set :scm, :git set :rvm_type, :user -set :rvm_ruby_version, '2.4.5' +set :rvm_ruby_version, '2.4.9' set :rvm_custom_path, '~/.rvm' set :format, :pretty From e8c39aee742c2cd5228c53cccba5610b95f804b5 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 7 Nov 2020 13:24:33 +0100 Subject: [PATCH 300/415] added gemset file --- .ruby-gemset | 1 + 1 file changed, 1 insertion(+) create mode 100644 .ruby-gemset diff --git a/.ruby-gemset b/.ruby-gemset new file mode 100644 index 00000000..b293c2f3 --- /dev/null +++ b/.ruby-gemset @@ -0,0 +1 @@ +tip4commit From a4e09eb2860ba00d31dce49095ee47234b5c5c16 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 7 Nov 2020 12:33:17 +0000 Subject: [PATCH 301/415] Bump kaminari from 0.15.0 to 1.2.1 Bumps [kaminari](https://github.com/kaminari/kaminari) from 0.15.0 to 1.2.1. - [Release notes](https://github.com/kaminari/kaminari/releases) - [Changelog](https://github.com/kaminari/kaminari/blob/master/CHANGELOG.md) - [Commits](https://github.com/kaminari/kaminari/compare/v0.15.0...v1.2.1) Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index 8a6f3c6c..a81f8186 100644 --- a/Gemfile +++ b/Gemfile @@ -21,7 +21,7 @@ gem 'i18n-js' gem 'jbuilder', '~> 1.5.3' gem 'jquery-rails', '~> 3.1' gem 'jquery-turbolinks' -gem 'kaminari', '~> 0.15.0' +gem 'kaminari', '~> 1.2.1' gem 'kaminari-i18n' gem 'less-rails', '~> 2.4.2' gem 'money-tree', '~> 0.10.0' diff --git a/Gemfile.lock b/Gemfile.lock index 1a6d0641..92e2d1b4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -193,9 +193,18 @@ GEM turbolinks json (1.8.6) jwt (1.5.6) - kaminari (0.15.0) - actionpack (>= 3.0.0) - activesupport (>= 3.0.0) + kaminari (1.2.1) + activesupport (>= 4.1.0) + kaminari-actionview (= 1.2.1) + kaminari-activerecord (= 1.2.1) + kaminari-core (= 1.2.1) + kaminari-actionview (1.2.1) + actionview + kaminari-core (= 1.2.1) + kaminari-activerecord (1.2.1) + activerecord + kaminari-core (= 1.2.1) + kaminari-core (1.2.1) kaminari-i18n (0.2.0) kaminari rails @@ -402,7 +411,7 @@ DEPENDENCIES jbuilder (~> 1.5.3) jquery-rails (~> 3.1) jquery-turbolinks - kaminari (~> 0.15.0) + kaminari (~> 1.2.1) kaminari-i18n less-rails (~> 2.4.2) money-tree (~> 0.10.0) From 1770ecc036c0dd2326a31f547b1dabb40b607556 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 8 Nov 2020 12:11:53 +0100 Subject: [PATCH 302/415] updated omniauth to remove github deprecation warning --- Gemfile | 8 ++++---- Gemfile.lock | 50 ++++++++++++++++++++++---------------------------- 2 files changed, 26 insertions(+), 32 deletions(-) diff --git a/Gemfile b/Gemfile index a81f8186..258f2ad1 100644 --- a/Gemfile +++ b/Gemfile @@ -27,8 +27,8 @@ gem 'less-rails', '~> 2.4.2' gem 'money-tree', '~> 0.10.0' gem 'mysql2', '~> 0.4.10', group: :production gem 'octokit', '~> 4.7.0' -gem 'omniauth', '~> 1.7.1' -gem 'omniauth-github', github: 'alexandrz/omniauth-github', branch: 'provide_emails' +gem 'omniauth', '~> 1.9.1' +gem 'omniauth-github' gem 'rails-i18n', '~> 4.0.0' gem 'render_csv' gem 'rest-client' @@ -51,8 +51,8 @@ group :development do # add ed25519 support to net-ssh gem 'bcrypt_pbkdf', '~> 1.0.0' - gem 'rbnacl', '~> 3.4.0' - gem 'rbnacl-libsodium', '~> 1.0.0' + gem 'rbnacl' + gem 'rbnacl-libsodium' end group :development, :test do diff --git a/Gemfile.lock b/Gemfile.lock index 92e2d1b4..f1dfdcf5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,15 +6,6 @@ GIT activerecord (~> 4.0) activesupport (~> 4.0) -GIT - remote: git://github.com/alexandrz/omniauth-github.git - revision: 37a030aa37659831ef80af21b5c7270fe1384b3c - branch: provide_emails - specs: - omniauth-github (1.1.0) - omniauth (~> 1.0) - omniauth-oauth2 (~> 1.1) - GIT remote: git://github.com/bootstrap-ruby/rails-bootstrap-forms.git revision: bb5e1ca8b8fdb6405feb162338e45468dac83c30 @@ -158,9 +149,9 @@ GEM factory_girl_rails (4.3.0) factory_girl (~> 4.3.0) railties (>= 3.0.0) - faraday (0.12.2) + faraday (0.17.3) multipart-post (>= 1.2, < 3) - ffi (1.9.25) + ffi (1.13.1) gherkin (2.12.2) multi_json (~> 1.3) globalid (0.4.2) @@ -173,7 +164,7 @@ GEM haml (>= 3.1, < 5.0) railties (>= 4.0.1) hashdiff (0.3.7) - hashie (3.5.6) + hashie (4.1.0) hike (1.2.3) http-cookie (1.0.2) domain_name (~> 0.5) @@ -192,7 +183,7 @@ GEM railties (>= 3.1.0) turbolinks json (1.8.6) - jwt (1.5.6) + jwt (2.2.2) kaminari (1.2.1) activesupport (>= 4.1.0) kaminari-actionview (= 1.2.1) @@ -228,7 +219,7 @@ GEM multi_json (1.15.0) multi_test (0.1.2) multi_xml (0.6.0) - multipart-post (2.0.0) + multipart-post (2.1.1) mysql2 (0.4.10) net-scp (1.2.1) net-ssh (>= 2.6.5) @@ -236,20 +227,23 @@ GEM netrc (0.11.0) nokogiri (1.10.10) mini_portile2 (~> 2.4.0) - oauth2 (1.4.0) - faraday (>= 0.8, < 0.13) - jwt (~> 1.0) + oauth2 (1.4.4) + faraday (>= 0.8, < 2.0) + jwt (>= 1.0, < 3.0) multi_json (~> 1.3) multi_xml (~> 0.5) rack (>= 1.2, < 3) octokit (4.7.0) sawyer (~> 0.8.0, >= 0.5.3) - omniauth (1.7.1) - hashie (>= 3.4.6, < 3.6.0) + omniauth (1.9.1) + hashie (>= 3.4.6) rack (>= 1.6.2, < 3) - omniauth-oauth2 (1.4.0) - oauth2 (~> 1.0) - omniauth (~> 1.2) + omniauth-github (1.4.0) + omniauth (~> 1.5) + omniauth-oauth2 (>= 1.4.0, < 2.0) + omniauth-oauth2 (1.7.0) + oauth2 (~> 1.4) + omniauth (~> 1.9) orm_adapter (0.5.0) public_suffix (3.0.1) rack (1.6.13) @@ -283,9 +277,9 @@ GEM rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (13.0.1) - rbnacl (3.4.0) + rbnacl (7.1.1) ffi - rbnacl-libsodium (1.0.11) + rbnacl-libsodium (1.0.16) rbnacl (>= 3.0.1) rdoc (4.1.1) json (~> 1.4) @@ -417,12 +411,12 @@ DEPENDENCIES money-tree (~> 0.10.0) mysql2 (~> 0.4.10) octokit (~> 4.7.0) - omniauth (~> 1.7.1) - omniauth-github! + omniauth (~> 1.9.1) + omniauth-github rails (= 4.2.11.3) rails-i18n (~> 4.0.0) - rbnacl (~> 3.4.0) - rbnacl-libsodium (~> 1.0.0) + rbnacl + rbnacl-libsodium render_csv rest-client rspec-activemodel-mocks From 26235b8a65e1c686c8838d7b140b64876d02c10f Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 8 Nov 2020 12:26:28 +0100 Subject: [PATCH 303/415] rbnacl < 5 is needed. also removed libsodium --- Gemfile | 3 +-- Gemfile.lock | 7 ++----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Gemfile b/Gemfile index 258f2ad1..6734f12f 100644 --- a/Gemfile +++ b/Gemfile @@ -51,8 +51,7 @@ group :development do # add ed25519 support to net-ssh gem 'bcrypt_pbkdf', '~> 1.0.0' - gem 'rbnacl' - gem 'rbnacl-libsodium' + gem 'rbnacl', '< 5' end group :development, :test do diff --git a/Gemfile.lock b/Gemfile.lock index f1dfdcf5..fecf9a8a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -277,10 +277,8 @@ GEM rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (13.0.1) - rbnacl (7.1.1) + rbnacl (4.0.2) ffi - rbnacl-libsodium (1.0.16) - rbnacl (>= 3.0.1) rdoc (4.1.1) json (~> 1.4) redis (3.3.0) @@ -415,8 +413,7 @@ DEPENDENCIES omniauth-github rails (= 4.2.11.3) rails-i18n (~> 4.0.0) - rbnacl - rbnacl-libsodium + rbnacl (< 5) render_csv rest-client rspec-activemodel-mocks From 0bb26c649babf909fcaddad599705e29b5e98e95 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Fri, 13 Nov 2020 12:12:31 +0100 Subject: [PATCH 304/415] Fixed signing up with github --- app/controllers/users/omniauth_callbacks_controller.rb | 8 ++++---- app/models/user.rb | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb index ebefbc65..22f49a51 100644 --- a/app/controllers/users/omniauth_callbacks_controller.rb +++ b/app/controllers/users/omniauth_callbacks_controller.rb @@ -3,15 +3,15 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController def github @user = User.find_by(nickname: @omniauth_info.nickname) || - User.find_by(email: @omniauth_info.verified_emails) + User.find_by(email: @omniauth_info.email) if @user.present? - if @omniauth_info.primary_email.present? && @user.email != @omniauth_info.primary_email + if @omniauth_info.email.present? && @user.email != @omniauth_info.email # update email if it has been changed - @user.update email: @omniauth_info.primary_email + @user.update email: @omniauth_info.email end else # user not found - if @omniauth_info.primary_email.present? + if @omniauth_info.email.present? @user = User.create_with_omniauth!(@omniauth_info) else set_flash_message(:error, :failure, kind: 'GitHub', reason: I18n.t('devise.errors.primary_email')) diff --git a/app/models/user.rb b/app/models/user.rb index 220b1781..839b6d7e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -63,9 +63,10 @@ def self.update_cache def self.create_with_omniauth!(auth_info) generated_password = Devise.friendly_token.first(Devise.password_length.min) create do |user| - user.email = auth_info.primary_email + user.email = auth_info.email user.password = generated_password user.nickname = auth_info.nickname + user.display_name = auth_info.name user.skip_confirmation! end end From a6ad6f5437dfb020f3076cbcb6adb2275faae586 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 14 Nov 2020 11:20:49 +0100 Subject: [PATCH 305/415] allow to delete accounts --- app/assets/javascripts/i18n/translations.js | 2 +- app/controllers/users_controller.rb | 9 + app/views/users/show.html.haml | 9 + config/locales/en.yml | 5 + config/routes.rb | 2 +- ...delete_account_button_in_their_profile.yml | 211 +++++++++ ...ount_by_entering_correct_email_address.yml | 419 ++++++++++++++++++ features/delete_user.feature | 30 ++ features/step_definitions/users_steps.rb | 8 + 9 files changed, 693 insertions(+), 2 deletions(-) create mode 100644 features/cassettes/Users_should_be_able_to_delete_their_accounts/Users_should_be_able_to_see_delete_account_button_in_their_profile.yml create mode 100644 features/cassettes/Users_should_be_able_to_delete_their_accounts/Users_should_confirm_deleting_account_by_entering_correct_email_address.yml create mode 100644 features/delete_user.feature diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js index 3831e702..81559ce8 100644 --- a/app/assets/javascripts/i18n/translations.js +++ b/app/assets/javascripts/i18n/translations.js @@ -1,2 +1,2 @@ var I18n = I18n || {}; -I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Neispravna vrijednost"},"email":{"invalid":"Neispravna email adresa","blank":"Email je obavezan"},"password":{"blank":"Lozinka je obavezma","invalid":"Lozinka i potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je obavezna","invalid":"Lozinka i potvrda nisu isti"}}}},"nl":{"js":{"errors":{"value":{"invalid":"De waarde is ongeldig"},"email":{"invalid":"Ongeldig e-mail adres","blank":"E-mail is verplicht en kan niet leeg blijven"},"password":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"},"password_confirmation":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в адресе электронной почты","blank":"Адрес электронной почты не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}}}; \ No newline at end of file +I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"de":{"js":{"errors":{"value":{"invalid":"Der Wert ist ungültig."},"email":{"invalid":"Die E-Mail Adresse ist ungültig.","blank":"Sie müssen eine E-Mail Adresse angeben!"},"password":{"blank":"Sie müssen ein Passwort angeben!","invalid":"Die angegebenen Passwörter stimmen nicht überein!"},"password_confirmation":{"blank":"Sie müssen ihr Passwort bestätigen.","invalid":"Die angegebenen Passwörter stimmen nicht überein!"}}}},"pt":{"js":{"errors":{"value":{"invalid":"Valor é invalido"},"email":{"invalid":"Endereço de Email inválido","blank":"O Email é necessário e não pode ser vazio"},"password":{"blank":"A senha é necessária e não pode ser vazia","invalid":"A senha e a sua confirmação não são iguais"},"password_confirmation":{"blank":"A confirmação da senha é necessária e não pode ser vazia","invalid":"A senha e a sua confirmação não são iguais"}}}},"my":{"js":{"errors":{"value":{"invalid":"Nilai tidak sah"},"email":{"invalid":"Alamat e-mel tidak sah","blank":"E-mel diperlukan dan tidak boleh kosong"},"password":{"blank":"Kata laluan diperlukan dan tidak boleh kosong","invalid":"Kata laluan dan pengesahannya tidak sama"},"password_confirmation":{"blank":"Pengesahan kata laluan diperlukan dan tidak boleh kosong","invalid":"Kata laluan dan pengesahannya tidak sama"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в адресе электронной почты","blank":"Адрес электронной почты не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}},"ja":{"js":{"errors":{"value":{"invalid":"値が不正です。"},"email":{"invalid":"不正なメールアドレスです。","blank":"メールアドレスは必須です。"},"password":{"blank":"パスワードは必須です。","invalid":"パスワードとパスワード確認が一致しません。"},"password_confirmation":{"blank":"パスワード確認は必須です。","invalid":"パスワードとパスワード確認が一致しません。"}}}},"id":{"js":{"errors":{"value":{"invalid":"Nilai tidak valid"},"email":{"invalid":"Alamat email tidak valid","blank":"Email harus diisi dan tidak boleh kosong"},"password":{"blank":"Password harus diisi dan tidak boleh kosong","invalid":"Password tidak sama"},"password_confirmation":{"blank":"Password konfirmasi harus diisi dan tidak boleh kosong","invalid":"Password tidak sama"}}}},"nl":{"js":{"errors":{"value":{"invalid":"De waarde is ongeldig"},"email":{"invalid":"Ongeldig e-mail adres","blank":"E-mail is verplicht en kan niet leeg blijven"},"password":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"},"password_confirmation":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"}}}},"es":{"js":{"errors":{"value":{"invalid":"Valor no válido."},"email":{"invalid":"Correo electrónico no válido.","blank":"El correo electrónico es requerido y no puede dejarlo en blanco."},"password":{"blank":"La contraseña es requerida y no puede dejarlo en blanco.","invalid":"Su contraseña no es igual a la contraseña de confirmación."},"password_confirmation":{"blank":"La contraseña de confirmación es requerida y no puede dejarlo en blanco.","invalid":"Su contraseña no es igual a la contraseña de confirmación."}}}},"ro":{"js":{"errors":{"value":{"invalid":"Valoarea este invalidă"},"email":{"invalid":"Adresă de email invalidă","blank":"E-mail este necesară și nu poate fi gol"},"password":{"blank":"Parola este necesară și nu poate fi goală","invalid":"Parola și confirmarea acesteia nu sunt aceleași"},"password_confirmation":{"blank":"Confirmarea parolei este necesară și nu poate fi goală","invalid":"Parola și confirmarea acesteia nu sunt aceleași"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'adresse Email est requise et doit être renseignée"},"password":{"blank":"Le mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"ko":{"js":{"errors":{"value":{"invalid":"값이 올바르지 않습니다."},"email":{"invalid":"이메일 주소가 명확하지 않습니다.","blank":"이메일 주소는 반드시 입력되어야 합니다."},"password":{"blank":"비밀번호는 반드시 입력되어야 합니다.","invalid":"비밀번호 확인란이 비밀번호와 일치하지 않습니다."},"password_confirmation":{"blank":"비밀번호 확인란은 반드시 입력되어야 합니다.","invalid":"비밀번호 확인란이 비밀번호와 일치하지 않습니다."}}}},"hr":{"js":{"errors":{"value":{"invalid":"Neispravna vrijednost"},"email":{"invalid":"Neispravna email adresa","blank":"Email je obavezan"},"password":{"blank":"Lozinka je obavezna","invalid":"Lozinka i potvrda nisu iste"},"password_confirmation":{"blank":"Potvrda lozinke je obavezna","invalid":"Lozinka i potvrda nisu iste"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"cn":{"js":{"errors":{"value":{"invalid":"数值无效"},"email":{"invalid":"无效电子邮箱地址","blank":"电子邮箱地址为必填且不能为空"},"password":{"blank":"密码为必填且不能为空","invalid":"密码和确认密码不相同"},"password_confirmation":{"blank":"确认密码为必填且不能为空","invalid":"密码和确认密码不相同"}}}},"hk":{"js":{"errors":{"value":{"invalid":"數值無效"},"email":{"invalid":"無效電子郵箱地址","blank":"電子郵箱地址為必填且不能為空"},"password":{"blank":"密碼為必填且不能為空","invalid":"密碼和確認密碼不相同"},"password_confirmation":{"blank":"確認密碼為必填且不能為空","invalid":"密碼和確認密碼不相同"}}}}}; \ No newline at end of file diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 57d67b1a..db3258a6 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -34,6 +34,15 @@ def login end end + def destroy + if params[:user][:email] == @user.email + sign_out(current_user) + @user.destroy + redirect_to root_url, notice: I18n.t('notices.account_deleted') + else + redirect_to @user, alert: I18n.t('errors.invalid_email') + end + end private diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index e4710db2..aaebe840 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -45,3 +45,12 @@ = f.password_field :password, autofocus: true, autocomplete: "off" = f.password_field :password_confirmation, autocomplete: "off" = f.submit t('.submit_password') + +%br +%p + %strong= link_to t('.delete_account'), '#delete_user_form', data: {toggle: "collapse"} + += twitter_bootstrap_form_for @user, html: {class: (params[:delete_user] ? '' : 'collapse'), id: 'delete_user_form', method: 'DELETE'} do |f| + %p= t('.delete_account_notice') + = f.text_field :email, value: '', autocomplete: "off" + = f.submit t('.delete_account_confirm'), class: 'btn-danger' \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 7411f4f0..cb95b3d3 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -25,11 +25,13 @@ en: wrong_bitcoin_address: Error updating bitcoin address user_not_found: User not found access_denied: You are not authorized to perform this action! + invalid_email: Invalid email notices: project_updated: The project settings have been updated tips_decided: The tip amounts have been defined user_updated: Your information saved! user_unsubscribed: "You unsubscribed! Sorry for bothering you. Although, you can still leave us your bitcoin address to get your tips." + account_deleted: Your account was deleted tip_amounts: undecided: "Undecided" free: "Free: 0%" @@ -176,6 +178,9 @@ en: change_password: Change your password submit_password: Change my password use_from_gravatar: Use from your gravatar profile + delete_account: Delete Account + delete_account_notice: Enter your bitcoin address and click the button below to delete your account. This account will be gone forever, but you will still be able to sign up with the same github account. Please be certain. + delete_account_confirm: Delete this account! withdrawals: index: title: Last Withdrawals diff --git a/config/routes.rb b/config/routes.rb index 5ec9d7a1..11af549b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -22,7 +22,7 @@ resources :tips , :only => [:index] resources :deposits , :only => [:index] resources :withdrawals , :only => [:index] - resources :users , :only => [:index , :show , :update] + resources :users , :only => [:index , :show , :update, :destroy] resources :projects , :only => [:index , :show , :update , :edit ] do collection do get 'search' diff --git a/features/cassettes/Users_should_be_able_to_delete_their_accounts/Users_should_be_able_to_see_delete_account_button_in_their_profile.yml b/features/cassettes/Users_should_be_able_to_delete_their_accounts/Users_should_be_able_to_see_delete_account_button_in_their_profile.yml new file mode 100644 index 00000000..13169f9d --- /dev/null +++ b/features/cassettes/Users_should_be_able_to_delete_their_accounts/Users_should_be_able_to_see_delete_account_button_in_their_profile.yml @@ -0,0 +1,211 @@ +--- +http_interactions: +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Sun, 08 Nov 2020 12:35:20 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Sun, 08 Nov 2020 12:35:20 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Sun, 08 Nov 2020 12:35:22 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Sun, 08 Nov 2020 12:35:23 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Sun, 08 Nov 2020 12:35:23 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Sun, 08 Nov 2020 12:35:23 GMT +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Sun, 08 Nov 2020 12:35:23 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Sun, 08 Nov 2020 12:35:23 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Sun, 08 Nov 2020 12:35:24 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Sun, 08 Nov 2020 12:35:24 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Sun, 08 Nov 2020 12:35:24 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Sun, 08 Nov 2020 12:35:25 GMT +recorded_with: VCR 3.0.3 diff --git a/features/cassettes/Users_should_be_able_to_delete_their_accounts/Users_should_confirm_deleting_account_by_entering_correct_email_address.yml b/features/cassettes/Users_should_be_able_to_delete_their_accounts/Users_should_confirm_deleting_account_by_entering_correct_email_address.yml new file mode 100644 index 00000000..b1db9a68 --- /dev/null +++ b/features/cassettes/Users_should_be_able_to_delete_their_accounts/Users_should_confirm_deleting_account_by_entering_correct_email_address.yml @@ -0,0 +1,419 @@ +--- +http_interactions: +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Sat, 14 Nov 2020 09:31:42 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Sat, 14 Nov 2020 09:31:42 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Sat, 14 Nov 2020 09:31:42 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Sat, 14 Nov 2020 09:31:42 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Sat, 14 Nov 2020 09:31:42 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Sat, 14 Nov 2020 09:31:43 GMT +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Sat, 14 Nov 2020 09:31:43 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Sat, 14 Nov 2020 09:31:43 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Sat, 14 Nov 2020 09:31:43 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Sat, 14 Nov 2020 09:31:43 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Sat, 14 Nov 2020 09:31:43 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Sat, 14 Nov 2020 09:31:44 GMT +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Sat, 14 Nov 2020 09:31:44 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Sat, 14 Nov 2020 09:31:44 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Sat, 14 Nov 2020 09:31:44 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Sat, 14 Nov 2020 09:31:45 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Sat, 14 Nov 2020 09:31:45 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Sat, 14 Nov 2020 09:31:45 GMT +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Sat, 14 Nov 2020 09:31:45 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Sat, 14 Nov 2020 09:31:45 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Sat, 14 Nov 2020 09:31:45 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Sat, 14 Nov 2020 09:31:46 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Sat, 14 Nov 2020 09:31:46 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Sat, 14 Nov 2020 09:31:46 GMT +recorded_with: VCR 3.0.3 diff --git a/features/delete_user.feature b/features/delete_user.feature new file mode 100644 index 00000000..9517fe42 --- /dev/null +++ b/features/delete_user.feature @@ -0,0 +1,30 @@ +Feature: Users should be able to delete their accounts + Background: + Given a developer named "seldon" exists without a bitcoin address + And I'm signed in as "seldon" + + @vcr-ignore-params + Scenario: Users should be able to see delete account button in their profile + Given I visit the "seldon user" page + Then I should see "Delete Account" + When I click "Delete Account" + When I fill "E-mail" with: "seldon@example.com" + When I click "Delete this account!" + Then I should be on the "home" page + And I should see "Your account was deleted" + And a developer named "seldon" does not exist + And I should see "Sign in" in the "header" area + And I should not see "Sign out" in the "header" area + + @vcr-ignore-params + Scenario: Users should confirm deleting account by entering correct email address + Given I visit the "seldon user" page + Then I should see "Delete Account" + When I click "Delete Account" + When I fill "E-mail" with: "invalid@example.com" + When I click "Delete this account!" + Then I should be on the "seldon user" page + And I should see "Invalid email" + And a developer named "seldon" exists + And I should see "Sign out" in the "header" area + And I should not see "Sign in" in the "header" area \ No newline at end of file diff --git a/features/step_definitions/users_steps.rb b/features/step_definitions/users_steps.rb index 91ee12f3..1a700918 100644 --- a/features/step_definitions/users_steps.rb +++ b/features/step_definitions/users_steps.rb @@ -13,3 +13,11 @@ def create_user nickname , has_bitcoiin_address Given /^a developer named "(.*?)" exists (with|without?) a bitcoin address$/ do |nickname , with| (@users ||= {})[nickname] ||= (create_user nickname , (with.eql? 'with')) end + +Then /^a developer named "(.*?)" does not exist$/ do |nickname| + User.where(nickname: nickname).first.should be_nil +end + +Then /^a developer named "(.*?)" exists$/ do |nickname| + User.where(nickname: nickname).first.should_not be_nil +end From 9928b06bcd5ca2a89f45f477dea59f0beb77d738 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 14 Nov 2020 11:47:45 +0100 Subject: [PATCH 306/415] typo --- config/locales/en.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index cb95b3d3..969ae7ff 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -179,7 +179,7 @@ en: submit_password: Change my password use_from_gravatar: Use from your gravatar profile delete_account: Delete Account - delete_account_notice: Enter your bitcoin address and click the button below to delete your account. This account will be gone forever, but you will still be able to sign up with the same github account. Please be certain. + delete_account_notice: Enter your email address and click the button below to delete your account. This account will be gone forever, but you will still be able to sign up with the same github account. Please be certain. delete_account_confirm: Delete this account! withdrawals: index: From fbd3737dddfa54b24abd848bd5caeda42ca1bba0 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 14 Nov 2020 11:48:00 +0100 Subject: [PATCH 307/415] added missing traslations --- config/locales/ru.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 462f610f..d01c82a5 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -26,12 +26,14 @@ ru: user_not_found: Пользователь не найден access_denied: Вы не авторизованы для выполнения данного действия! opt_in_notice: "В связи с многочисленными жалобами мы более не добавляем проекты автоматически. Существующие проекты, не получившие пожертвований, были удалены. Если Вы хотите добавить свой проект, пожалуйста, %{create_issue_link}." + invalid_email: Неверный адрес элеткронной почты notices: project_updated: Настройки проекта обновлены tips_decided: Сумма вознаграждения определена user_updated: Ваш профиль обновлен! user_unsubscribed: "Вы отписались! Приносим извинения за предоставленные неудобства. Однако, вы все равно можете оставить нам свой Биткоин-адрес, чтобы получать вознаграждения" + account_deleted: Ваш аккаунт был удален tip_amounts: undecided: "Не определено" free: "Нет: 0%" @@ -177,6 +179,10 @@ ru: submit_user: Обновить информацию пользователя change_password: Смена пароля submit_password: Сменить пароль + use_from_gravatar: Использовать Gravatar + delete_account: Удаление аккаунта + delete_account_notice: Введите ваш адрес электронной почты и нажмите на кнопку ниже чтобы удалить свой аккаунт. Этот аккаунт будет удален навсегда, но вы сможете зарегистрироваться снова используя ваш github аккаунт. Пожалуйста, будьте уверенны в том что вы делаете. + delete_account_confirm: Удалить этот аккаунт! withdrawals: index: title: Последние выплаты From 1e8d80a91c022180c4ae43d7ca7da27a94ad4fcc Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 14 Nov 2020 21:54:57 +0100 Subject: [PATCH 308/415] Updated ruby, devise, and cucumber --- .travis.yml | 2 +- Gemfile | 8 +- Gemfile.lock | 75 +++++++++++-------- app/views/devise/registrations/edit.html.haml | 2 +- app/views/devise/registrations/new.html.haml | 2 +- app/views/devise/sessions/new.html.haml | 2 +- config/application.rb | 2 + config/cucumber.yml | 4 +- features/pretty_paths.feature | 8 +- features/sign_up_sign_in.feature | 10 +-- features/step_definitions/common.rb | 2 +- features/step_definitions/project_steps.rb | 2 - features/support/env.rb | 2 +- spec/spec_helper.rb | 2 +- 14 files changed, 68 insertions(+), 55 deletions(-) diff --git a/.travis.yml b/.travis.yml index e3edf7f1..4119a1d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ git: depth: 10 rvm: - - 2.4.9 + - 2.5.8 bundler_args: --without development --jobs=9 --retry=2 --quiet diff --git a/Gemfile b/Gemfile index 6734f12f..bea3b02d 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' -ruby '2.4.9' +ruby '2.5.8' gem 'rails', '4.2.11.3' @@ -11,7 +11,7 @@ gem 'bootstrap_form', github: 'bootstrap-ruby/rails-bootstrap-forms' gem 'cancancan' gem 'coffee-rails', '~> 4.0.0' gem 'demoji' -gem 'devise', '~> 3.5.2' +gem 'devise', '~> 4.7.3' gem 'devise-i18n' gem 'dusen', '~> 0.6.1' gem 'easy_gravatar' @@ -61,10 +61,10 @@ group :development, :test do end group :test do - gem 'cucumber-rails', require: false + gem 'cucumber-rails', '~> 1.0', require: false gem 'database_cleaner' gem 'rspec-activemodel-mocks' - gem 'shoulda-matchers', '~> 3.1' + gem 'shoulda-matchers', '~> 3.1' gem 'simplecov' gem 'vcr' gem 'webmock' diff --git a/Gemfile.lock b/Gemfile.lock index fecf9a8a..f0d9f9c0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -74,6 +74,7 @@ GEM builder multi_json arel (6.0.4) + backports (3.18.2) bcrypt (3.1.16) bcrypt_pbkdf (1.0.0) builder (3.2.4) @@ -91,12 +92,14 @@ GEM capistrano-rvm (0.1.2) capistrano (~> 3.0) sshkit (~> 1.2) - capybara (2.5.0) - mime-types (>= 1.16) - nokogiri (>= 1.3.3) - rack (>= 1.0.0) - rack-test (>= 0.5.4) - xpath (~> 2.0) + capybara (3.33.0) + addressable + mini_mime (>= 0.1.3) + nokogiri (~> 1.8) + rack (>= 1.6.0) + rack-test (>= 0.6.3) + regexp_parser (~> 1.5) + xpath (~> 3.2) coffee-rails (4.0.1) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.0) @@ -110,29 +113,38 @@ GEM crack (0.4.3) safe_yaml (~> 1.0.0) crass (1.0.6) - cucumber (1.3.20) + cucumber (3.2.0) builder (>= 2.1.2) - diff-lcs (>= 1.1.3) - gherkin (~> 2.12) + cucumber-core (~> 3.2.0) + cucumber-expressions (~> 6.0.1) + cucumber-wire (~> 0.0.1) + diff-lcs (~> 1.3) + gherkin (~> 5.1.0) multi_json (>= 1.7.5, < 2.0) multi_test (>= 0.1.2) - cucumber-rails (1.4.2) - capybara (>= 1.1.2, < 3) - cucumber (>= 1.3.8, < 2) - mime-types (>= 1.16, < 3) - nokogiri (~> 1.5) - rails (>= 3, < 5) - database_cleaner (1.2.0) + cucumber-core (3.2.1) + backports (>= 3.8.0) + cucumber-tag_expressions (~> 1.1.0) + gherkin (~> 5.0) + cucumber-expressions (6.0.1) + cucumber-rails (1.8.0) + capybara (>= 2.12, < 4) + cucumber (>= 3.0.2, < 4) + mime-types (>= 2.0, < 4) + nokogiri (~> 1.8) + railties (>= 4.2, < 7) + cucumber-tag_expressions (1.1.1) + cucumber-wire (0.0.1) + database_cleaner (1.8.5) demoji (0.0.5) - devise (3.5.2) + devise (4.7.3) bcrypt (~> 3.0) orm_adapter (~> 0.1) - railties (>= 3.2.6, < 5) + railties (>= 4.1.0) responders - thread_safe (~> 0.1) warden (~> 1.2.3) devise-i18n (0.11.0) - diff-lcs (1.3) + diff-lcs (1.4.4) docile (1.1.5) domain_name (0.5.25) unf (>= 0.0.5, < 1.0.0) @@ -152,8 +164,7 @@ GEM faraday (0.17.3) multipart-post (>= 1.2, < 3) ffi (1.13.1) - gherkin (2.12.2) - multi_json (~> 1.3) + gherkin (5.1.0) globalid (0.4.2) activesupport (>= 4.2.0) haml (4.0.5) @@ -283,10 +294,12 @@ GEM json (~> 1.4) redis (3.3.0) ref (2.0.0) + regexp_parser (1.8.2) render_csv (2.0.0) rails (>= 3.0) - responders (2.1.0) - railties (>= 4.2.0, < 5) + responders (2.4.1) + actionpack (>= 4.2.0, < 6.0) + railties (>= 4.2.0, < 6.0) rest-client (1.8.0) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 3.0) @@ -356,7 +369,7 @@ GEM tilt (1.4.1) turbolinks (2.5.3) coffee-rails - tzinfo (1.2.7) + tzinfo (1.2.8) thread_safe (~> 0.1) uglifier (2.4.0) execjs (>= 0.3.0) @@ -365,14 +378,14 @@ GEM unf_ext unf_ext (0.0.7.1) vcr (3.0.3) - warden (1.2.3) + warden (1.2.7) rack (>= 1.0) webmock (3.1.0) addressable (>= 2.3.6) crack (>= 0.3.2) hashdiff - xpath (2.0.0) - nokogiri (~> 1.3) + xpath (3.2.0) + nokogiri (~> 1.8) PLATFORMS ruby @@ -389,10 +402,10 @@ DEPENDENCIES capistrano-rails (~> 1.1.0) capistrano-rvm (~> 0.1.0) coffee-rails (~> 4.0.0) - cucumber-rails + cucumber-rails (~> 1.0) database_cleaner demoji - devise (~> 3.5.2) + devise (~> 4.7.3) devise-i18n dusen (~> 0.6.1) easy_gravatar @@ -435,7 +448,7 @@ DEPENDENCIES webmock RUBY VERSION - ruby 2.4.9p362 + ruby 2.5.8p224 BUNDLED WITH 1.17.3 diff --git a/app/views/devise/registrations/edit.html.haml b/app/views/devise/registrations/edit.html.haml index 3a293c04..84a01fc1 100644 --- a/app/views/devise/registrations/edit.html.haml +++ b/app/views/devise/registrations/edit.html.haml @@ -1,7 +1,7 @@ = twitter_bootstrap_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put, class: 'form-devise' }) do |f| %h2 Edit #{resource_name.to_s.humanize} - = devise_error_messages! + = render "devise/shared/error_messages", resource: resource = f.email_field :email, :autofocus => true - if devise_mapping.confirmable? && resource.pending_reconfirmation? %div diff --git a/app/views/devise/registrations/new.html.haml b/app/views/devise/registrations/new.html.haml index c6070f5c..721caa85 100644 --- a/app/views/devise/registrations/new.html.haml +++ b/app/views/devise/registrations/new.html.haml @@ -1,6 +1,6 @@ = twitter_bootstrap_form_for(resource, :as => resource_name, :url => registration_path(resource_name), html: { class: 'form-devise registration_form'}) do |f| %h2= t('.title') - = devise_error_messages! + = render "devise/shared/error_messages", resource: resource = f.email_field :email, :autofocus => true = f.password_field :password, :autocomplete => "off" = f.password_field :password_confirmation, :autocomplete => "off" diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml index 0f3ff00b..2d75b67f 100644 --- a/app/views/devise/sessions/new.html.haml +++ b/app/views/devise/sessions/new.html.haml @@ -1,5 +1,5 @@ = twitter_bootstrap_form_for(resource, :as => resource_name, :url => session_path(resource_name), html: {class: 'form-devise session_form' }) do |f| - = devise_error_messages! + = render "devise/shared/error_messages", resource: resource %h2= t('.title') = f.email_field :email, :autofocus => true = f.password_field :password, :autocomplete => "off" diff --git a/config/application.rb b/config/application.rb index 084a3a97..b91bb912 100644 --- a/config/application.rb +++ b/config/application.rb @@ -27,6 +27,8 @@ class Application < Rails::Application config.assets.initialize_on_precompile = true config.available_locales = %w[en es fr nl ru pl hr de ro ko id ja pt my cn hk] config.active_job.queue_adapter = :sidekiq + + config.active_record.raise_in_transactional_callbacks = true end end diff --git a/config/cucumber.yml b/config/cucumber.yml index 19b288df..02aae0a1 100644 --- a/config/cucumber.yml +++ b/config/cucumber.yml @@ -1,8 +1,8 @@ <% rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : "" rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}" -std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip" +std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags 'not @wip'" %> default: <%= std_opts %> features wip: --tags @wip:3 --wip features -rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip +rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags 'not @wip' diff --git a/features/pretty_paths.feature b/features/pretty_paths.feature index 760dcdc2..05dab5fc 100644 --- a/features/pretty_paths.feature +++ b/features/pretty_paths.feature @@ -133,8 +133,8 @@ Feature: The site routes pretty paths uniformly Given I'm signed in as "seldon" When I visit the "seldon user" page Then I should be on the "seldon user" page - And I should see "seldon Balance 0.00000000 Ƀ" - And I should see "E-mail seldon@example.com" + And I should see "seldon\nBalance\n0.00000000 Ƀ" + And I should see "E-mail\nseldon@example.com" And I should see "Bitcoin address" @vcr @@ -142,8 +142,8 @@ Feature: The site routes pretty paths uniformly Given I'm signed in as "seldon" When I browse to the explicit path "users/seldon" Then I should be on the "seldon user" page - And I should see "seldon Balance 0.00000000 Ƀ" - And I should see "E-mail seldon@example.com" + And I should see "seldon\nBalance\n0.00000000 Ƀ" + And I should see "E-mail\nseldon@example.com" And I should see "Bitcoin address" Scenario: Unknown user tips page user name redirects to users page diff --git a/features/sign_up_sign_in.feature b/features/sign_up_sign_in.feature index 5363b3c3..894bbaff 100644 --- a/features/sign_up_sign_in.feature +++ b/features/sign_up_sign_in.feature @@ -65,24 +65,24 @@ Feature: Visitors should be able to sign_up and sign_in Given I'm not signed in When I visit the "sign_in" page Then I should be on the "sign_in" page - And I should see "Sign in E-mail Password Remember me" + And I should see "Sign in\nE-mail\nPassword\nRemember me" When I fill "E-mail" with: "unknown-user@somehost.net" And I fill "Password" with: "unknown-users-password" And I click "Sign in" Then I should be on the "sign_in" page - And I should see "Invalid email or password" + And I should see "Invalid E-mail or password" When I fill "E-mail" with: "seldon@example.com" And I fill "Password" with: "incorrect-password" And I click "Sign in" Then I should be on the "sign_in" page - And I should see "Invalid email or password" + And I should see "Invalid E-mail or password" Scenario: Visitors should be able to sign up with an email address Given I'm not signed in When I visit the "home" page When I click "Sign up" within the "header" area Then I should be on the "sign_up" page - And I should see "Sign up E-mail Password Password confirmation" + And I should see "Sign up\nE-mail\nPassword\nPassword confirmation" When I fill "E-mail" with: "new-guy@example.com" And I fill "Password" with: "new-guys-password" @@ -134,7 +134,7 @@ Feature: Visitors should be able to sign_up and sign_in When I visit the "sign_in" page Then I should be on the "sign_in" page - And I should see "Sign in E-mail Password Remember me" + And I should see "Sign in\nE-mail\nPassword\nRemember me" When I fill "E-mail" with: "new-guy@example.com" And I fill "Password" with: "new-guys-password" And I click "Sign in" diff --git a/features/step_definitions/common.rb b/features/step_definitions/common.rb index 9f72ab4c..140b071a 100644 --- a/features/step_definitions/common.rb +++ b/features/step_definitions/common.rb @@ -140,7 +140,7 @@ def find_element node_name end Then(/^I should see "(.*?)"$/) do |arg1| - page.should have_content(arg1) + page.should have_content(arg1.gsub('\n', "\n")) end Then(/^I should not see "(.*?)"$/) do |arg1| diff --git a/features/step_definitions/project_steps.rb b/features/step_definitions/project_steps.rb index d20573ef..0693a5db 100644 --- a/features/step_definitions/project_steps.rb +++ b/features/step_definitions/project_steps.rb @@ -63,8 +63,6 @@ def find_project service , project_name @current_project = create_github_project project_name , false else raise "unknown provider \"#{provider}\"" end - - step "the project collaborators are:" , (Cucumber::Ast::Table.new []) end When /^regarding the "(.*?)" project named "(.*?)"$/ do |provider , project_name| diff --git a/features/support/env.rb b/features/support/env.rb index 7b03a8f5..cc01c149 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -32,7 +32,7 @@ # Remove/comment out the lines below if your app doesn't have a database. # For some databases (like MongoDB and CouchDB) you may need to use :truncation instead. begin - DatabaseCleaner.strategy = :transaction + DatabaseCleaner.strategy = :truncation rescue NameError raise 'You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it.' end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 746f82d0..033570ea 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -56,6 +56,6 @@ config.order = "random" include FactoryGirl::Syntax::Methods - config.include Devise::TestHelpers, type: :controller + config.include Devise::Test::ControllerHelpers, type: :controller config.extend ControllerMacros, type: :controller end From ca5795493ae3ba34f168a18eb3c2d378f56fc6f6 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 14 Nov 2020 22:23:39 +0100 Subject: [PATCH 309/415] Updated ruby version in the deploy config --- config/deploy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/deploy.rb b/config/deploy.rb index 0a85b48c..932e2754 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -7,7 +7,7 @@ set :scm, :git set :rvm_type, :user -set :rvm_ruby_version, '2.4.9' +set :rvm_ruby_version, '2.5.8' set :rvm_custom_path, '~/.rvm' set :format, :pretty From 52418d98410f0510c88a6820b792505aaec2ea48 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 15 Nov 2020 09:38:49 +0100 Subject: [PATCH 310/415] Security fixes: Updated haml, and json --- Gemfile | 4 +-- Gemfile.lock | 72 +++++++++++++++++++++++++++++----------------------- 2 files changed, 42 insertions(+), 34 deletions(-) diff --git a/Gemfile b/Gemfile index bea3b02d..5b0aed9c 100644 --- a/Gemfile +++ b/Gemfile @@ -15,7 +15,7 @@ gem 'devise', '~> 4.7.3' gem 'devise-i18n' gem 'dusen', '~> 0.6.1' gem 'easy_gravatar' -gem 'haml-rails', '~> 0.5.3' +gem 'haml-rails', '~> 1.0' gem 'http_accept_language' gem 'i18n-js' gem 'jbuilder', '~> 1.5.3' @@ -56,7 +56,7 @@ end group :development, :test do gem 'factory_girl_rails', '~> 4.3.0' - gem 'rspec-rails', '~> 3.5.0' + gem 'rspec-rails', '~> 4.0' gem 'sqlite3', '~> 1.3.11' end diff --git a/Gemfile.lock b/Gemfile.lock index f0d9f9c0..30498c23 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -145,7 +145,7 @@ GEM warden (~> 1.2.3) devise-i18n (0.11.0) diff-lcs (1.4.4) - docile (1.1.5) + docile (1.3.2) domain_name (0.5.25) unf (>= 0.0.5, < 1.0.0) dusen (0.6.1) @@ -167,16 +167,23 @@ GEM gherkin (5.1.0) globalid (0.4.2) activesupport (>= 4.2.0) - haml (4.0.5) + haml (5.2.0) + temple (>= 0.8.0) tilt - haml-rails (0.5.3) + haml-rails (1.0.0) actionpack (>= 4.0.1) activesupport (>= 4.0.1) - haml (>= 3.1, < 5.0) + haml (>= 4.0.6, < 6.0) + html2haml (>= 1.0.1) railties (>= 4.0.1) hashdiff (0.3.7) hashie (4.1.0) hike (1.2.3) + html2haml (2.2.0) + erubis (~> 2.7.0) + haml (>= 4.0, < 6) + nokogiri (>= 1.6.0) + ruby_parser (~> 3.5) http-cookie (1.0.2) domain_name (~> 0.5) http_accept_language (2.0.2) @@ -193,7 +200,7 @@ GEM jquery-turbolinks (2.0.1) railties (>= 3.1.0) turbolinks - json (1.8.6) + json (2.3.1) jwt (2.2.2) kaminari (1.2.1) activesupport (>= 4.1.0) @@ -290,8 +297,7 @@ GEM rake (13.0.1) rbnacl (4.0.2) ffi - rdoc (4.1.1) - json (~> 1.4) + rdoc (6.2.1) redis (3.3.0) ref (2.0.0) regexp_parser (1.8.2) @@ -308,23 +314,25 @@ GEM activemodel (>= 3.0) activesupport (>= 3.0) rspec-mocks (>= 2.99, < 4.0) - rspec-core (3.5.4) - rspec-support (~> 3.5.0) - rspec-expectations (3.5.0) + rspec-core (3.10.0) + rspec-support (~> 3.10.0) + rspec-expectations (3.10.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.5.0) - rspec-mocks (3.5.0) + rspec-support (~> 3.10.0) + rspec-mocks (3.10.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.5.0) - rspec-rails (3.5.2) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 3.5.0) - rspec-expectations (~> 3.5.0) - rspec-mocks (~> 3.5.0) - rspec-support (~> 3.5.0) - rspec-support (3.5.0) + rspec-support (~> 3.10.0) + rspec-rails (4.0.1) + actionpack (>= 4.2) + activesupport (>= 4.2) + railties (>= 4.2) + rspec-core (~> 3.9) + rspec-expectations (~> 3.9) + rspec-mocks (~> 3.9) + rspec-support (~> 3.9) + rspec-support (3.10.0) + ruby_parser (3.15.0) + sexp_processor (~> 4.9) safe_yaml (1.0.4) sass (3.2.13) sass-rails (4.0.1) @@ -334,20 +342,19 @@ GEM sawyer (0.8.1) addressable (>= 2.3.5, < 2.6) faraday (~> 0.8, < 1.0) - sdoc (0.4.0) - json (~> 1.8) - rdoc (~> 4.0, < 5.0) + sdoc (2.0.2) + rdoc (>= 5.0) + sexp_processor (4.15.1) shoulda-matchers (3.1.1) activesupport (>= 4.0.0) sidekiq (4.0.2) concurrent-ruby (~> 1.0) connection_pool (~> 2.2, >= 2.2.0) redis (~> 3.2, >= 3.2.1) - simplecov (0.15.1) - docile (~> 1.1.0) - json (>= 1.8, < 3) - simplecov-html (~> 0.10.0) - simplecov-html (0.10.2) + simplecov (0.19.1) + docile (~> 1.1) + simplecov-html (~> 0.11) + simplecov-html (0.12.3) sprockets (2.12.5) hike (~> 1.2) multi_json (~> 1.0) @@ -361,6 +368,7 @@ GEM sshkit (1.12.0) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) + temple (0.8.2) therubyracer (0.12.3) libv8 (~> 3.16.14.15) ref @@ -410,7 +418,7 @@ DEPENDENCIES dusen (~> 0.6.1) easy_gravatar factory_girl_rails (~> 4.3.0) - haml-rails (~> 0.5.3) + haml-rails (~> 1.0) http_accept_language i18n-js jbuilder (~> 1.5.3) @@ -430,7 +438,7 @@ DEPENDENCIES render_csv rest-client rspec-activemodel-mocks - rspec-rails (~> 3.5.0) + rspec-rails (~> 4.0) sass-rails (~> 4.0.0) sawyer (~> 0.8.0) sdoc From 141c82d67890a48ee424336a326c94d0600a2b01 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Fri, 20 Nov 2020 09:41:13 +0100 Subject: [PATCH 311/415] Allow users to set betch32 addresses Closes #363 --- Gemfile | 1 + Gemfile.lock | 2 + config/config.yml.sample | 5 +- features/bitcoin_address.feature | 72 +++ ...d_be_able_to_set_Bech32_P2WPKH_address.yml | 419 ++++++++++++++++++ ...ld_be_able_to_set_Bech32_P2WSH_address.yml | 419 ++++++++++++++++++ ...rs_should_be_able_to_set_P2PKH_address.yml | 419 ++++++++++++++++++ ...ers_should_be_able_to_set_P2SH_address.yml | 419 ++++++++++++++++++ ...t_be_able_to_set_invalid_P2PKH_address.yml | 419 ++++++++++++++++++ ...ot_be_able_to_set_invalid_P2SH_address.yml | 419 ++++++++++++++++++ ..._be_able_to_set_testnet_Bech32_address.yml | 419 ++++++++++++++++++ ...uld_not_be_able_to_set_testnet_address.yml | 419 ++++++++++++++++++ lib/bitcoin_address_validator.rb | 33 +- spec/models/user_spec.rb | 38 +- 14 files changed, 3496 insertions(+), 7 deletions(-) create mode 100644 features/bitcoin_address.feature create mode 100644 features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_be_able_to_set_Bech32_P2WPKH_address.yml create mode 100644 features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_be_able_to_set_Bech32_P2WSH_address.yml create mode 100644 features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_be_able_to_set_P2PKH_address.yml create mode 100644 features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_be_able_to_set_P2SH_address.yml create mode 100644 features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_not_be_able_to_set_invalid_P2PKH_address.yml create mode 100644 features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_not_be_able_to_set_invalid_P2SH_address.yml create mode 100644 features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_not_be_able_to_set_testnet_Bech32_address.yml create mode 100644 features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_not_be_able_to_set_testnet_address.yml diff --git a/Gemfile b/Gemfile index 5b0aed9c..434656b9 100644 --- a/Gemfile +++ b/Gemfile @@ -7,6 +7,7 @@ gem 'rails', '4.2.11.3' gem 'acts_as_paranoid', github: 'ActsAsParanoid/acts_as_paranoid' gem 'airbrake', '~> 3.1.15' gem 'bcrypt', '~> 3.1.12' +gem 'bech32', '~> 1.0.5' gem 'bootstrap_form', github: 'bootstrap-ruby/rails-bootstrap-forms' gem 'cancancan' gem 'coffee-rails', '~> 4.0.0' diff --git a/Gemfile.lock b/Gemfile.lock index 30498c23..5ff6de4c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -77,6 +77,7 @@ GEM backports (3.18.2) bcrypt (3.1.16) bcrypt_pbkdf (1.0.0) + bech32 (1.0.5) builder (3.2.4) cancancan (1.7.1) capistrano (3.4.1) @@ -403,6 +404,7 @@ DEPENDENCIES airbrake (~> 3.1.15) bcrypt (~> 3.1.12) bcrypt_pbkdf (~> 1.0.0) + bech32 (~> 1.0.5) bootstrap_form! cancancan capistrano (~> 3.4.0) diff --git a/config/config.yml.sample b/config/config.yml.sample index da55e009..9f70e7fc 100644 --- a/config/config.yml.sample +++ b/config/config.yml.sample @@ -40,6 +40,5 @@ min_tip: 50000 # optional deposit_address: 1M4bS4gPyA6Kb8w7aXsgth9oUZWcRk73tQ -address_versions: # 0/5 for bitcoin addresses, 111/196 for testnet, see chainparams.cpp - - 0 - - 5 +# Can be testnet or mainnet +network: mainnet diff --git a/features/bitcoin_address.feature b/features/bitcoin_address.feature new file mode 100644 index 00000000..5a8d47c7 --- /dev/null +++ b/features/bitcoin_address.feature @@ -0,0 +1,72 @@ +Feature: Users should be able to change their bitcoin address + Background: + Given a developer named "seldon" exists without a bitcoin address + And I'm signed in as "seldon" + + @vcr-ignore-params + Scenario: Users should be able to set P2PKH address + Given I visit the "seldon user" page + Then I should see "Bitcoin address" + When I fill "Bitcoin address" with: "1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2" + And I click "Update user info" + Then I should see "Your information saved!" + + @vcr-ignore-params + Scenario: Users should not be able to set invalid P2PKH address + Given I visit the "seldon user" page + Then I should see "Bitcoin address" + When I fill "Bitcoin address" with: "1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVA" + And I click "Update user info" + Then I should not see "Your information saved!" + And I should see "Bitcoin address is invalid" + + @vcr-ignore-params + Scenario: Users should be able to set P2SH address + Given I visit the "seldon user" page + Then I should see "Bitcoin address" + When I fill "Bitcoin address" with: "3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy" + And I click "Update user info" + Then I should see "Your information saved!" + + @vcr-ignore-params + Scenario: Users should not be able to set invalid P2SH address + Given I visit the "seldon user" page + Then I should see "Bitcoin address" + When I fill "Bitcoin address" with: "3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLA" + And I click "Update user info" + Then I should not see "Your information saved!" + And I should see "Bitcoin address is invalid" + + @vcr-ignore-params + Scenario: Users should not be able to set testnet address + Given I visit the "seldon user" page + Then I should see "Bitcoin address" + When I fill "Bitcoin address" with: "mtXWDB6k5yC5v7TcwKZHB89SUp85yCKshy" + And I click "Update user info" + Then I should not see "Your information saved!" + And I should see "Bitcoin address is invalid" + + @vcr-ignore-params + Scenario: Users should be able to set Bech32 P2WPKH address + Given I visit the "seldon user" page + Then I should see "Bitcoin address" + When I fill "Bitcoin address" with: "bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4" + And I click "Update user info" + Then I should see "Your information saved!" + + @vcr-ignore-params + Scenario: Users should be able to set Bech32 P2WSH address + Given I visit the "seldon user" page + Then I should see "Bitcoin address" + When I fill "Bitcoin address" with: "bc1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3qccfmv3" + And I click "Update user info" + Then I should see "Your information saved!" + + @vcr-ignore-params + Scenario: Users should not be able to set testnet Bech32 address + Given I visit the "seldon user" page + Then I should see "Bitcoin address" + When I fill "Bitcoin address" with: "tb1qw508d6qejxtdg4y5r3zarvary0c5xw7kxpjzsx" + And I click "Update user info" + Then I should not see "Your information saved!" + And I should see "Bitcoin address is invalid" \ No newline at end of file diff --git a/features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_be_able_to_set_Bech32_P2WPKH_address.yml b/features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_be_able_to_set_Bech32_P2WPKH_address.yml new file mode 100644 index 00000000..d80f96af --- /dev/null +++ b/features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_be_able_to_set_Bech32_P2WPKH_address.yml @@ -0,0 +1,419 @@ +--- +http_interactions: +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:05:51 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:05:51 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 08:05:51 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:05:51 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:05:51 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 08:05:51 GMT +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:05:52 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:05:51 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 08:05:52 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:05:53 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:05:53 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 08:05:53 GMT +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:05:54 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:05:54 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 08:05:54 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:05:55 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:05:55 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 08:05:56 GMT +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:05:57 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:05:57 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 08:05:57 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:06:01 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:06:01 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 08:06:01 GMT +recorded_with: VCR 3.0.3 diff --git a/features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_be_able_to_set_Bech32_P2WSH_address.yml b/features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_be_able_to_set_Bech32_P2WSH_address.yml new file mode 100644 index 00000000..5bc39b8c --- /dev/null +++ b/features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_be_able_to_set_Bech32_P2WSH_address.yml @@ -0,0 +1,419 @@ +--- +http_interactions: +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:06:02 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:06:02 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 08:06:02 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:06:02 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:06:02 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 08:06:02 GMT +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:06:03 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:06:03 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 08:06:03 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:06:03 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:06:03 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 08:06:03 GMT +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:06:03 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:06:03 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 08:06:03 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:06:04 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:06:04 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 08:06:04 GMT +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:06:04 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:06:04 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 08:06:04 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:06:05 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:06:05 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 08:06:05 GMT +recorded_with: VCR 3.0.3 diff --git a/features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_be_able_to_set_P2PKH_address.yml b/features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_be_able_to_set_P2PKH_address.yml new file mode 100644 index 00000000..3f40730d --- /dev/null +++ b/features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_be_able_to_set_P2PKH_address.yml @@ -0,0 +1,419 @@ +--- +http_interactions: +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 07:55:55 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 07:55:55 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 07:55:55 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 07:55:56 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 07:55:56 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 07:55:56 GMT +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 07:55:57 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 07:55:57 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 07:55:57 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 07:55:58 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 07:55:58 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 07:55:59 GMT +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 07:56:00 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 07:56:00 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 07:56:00 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 07:56:01 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 07:56:01 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 07:56:01 GMT +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 07:56:03 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 07:56:03 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 07:56:03 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 07:56:04 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 07:56:04 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 07:56:05 GMT +recorded_with: VCR 3.0.3 diff --git a/features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_be_able_to_set_P2SH_address.yml b/features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_be_able_to_set_P2SH_address.yml new file mode 100644 index 00000000..cb27e4cd --- /dev/null +++ b/features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_be_able_to_set_P2SH_address.yml @@ -0,0 +1,419 @@ +--- +http_interactions: +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:00:55 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:00:55 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 08:00:55 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:00:56 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:00:56 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 08:00:57 GMT +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:00:57 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:00:57 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 08:00:57 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:00:58 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:00:58 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 08:00:59 GMT +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:00:59 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:00:59 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 08:00:59 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:00:59 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:00:59 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 08:00:59 GMT +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:01:00 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:01:00 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 08:01:00 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:01:00 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:01:00 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 08:01:00 GMT +recorded_with: VCR 3.0.3 diff --git a/features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_not_be_able_to_set_invalid_P2PKH_address.yml b/features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_not_be_able_to_set_invalid_P2PKH_address.yml new file mode 100644 index 00000000..f64e7593 --- /dev/null +++ b/features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_not_be_able_to_set_invalid_P2PKH_address.yml @@ -0,0 +1,419 @@ +--- +http_interactions: +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 07:58:21 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 07:58:21 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 07:58:22 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 07:58:23 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 07:58:23 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 07:58:23 GMT +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 07:58:24 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 07:58:24 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 07:58:24 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 07:58:25 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 07:58:25 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 07:58:26 GMT +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 07:58:27 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 07:58:27 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 07:58:27 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 07:58:29 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 07:58:29 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 07:58:29 GMT +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 07:58:30 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 07:58:30 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 07:58:30 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 07:58:31 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 07:58:31 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 07:58:32 GMT +recorded_with: VCR 3.0.3 diff --git a/features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_not_be_able_to_set_invalid_P2SH_address.yml b/features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_not_be_able_to_set_invalid_P2SH_address.yml new file mode 100644 index 00000000..e7c955b9 --- /dev/null +++ b/features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_not_be_able_to_set_invalid_P2SH_address.yml @@ -0,0 +1,419 @@ +--- +http_interactions: +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:01:01 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:01:01 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 08:01:01 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:01:01 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:01:01 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 08:01:02 GMT +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:01:02 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:01:02 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 08:01:02 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:01:02 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:01:02 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 08:01:02 GMT +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:01:03 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:01:03 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 08:01:03 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:01:03 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:01:03 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 08:01:03 GMT +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:01:03 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:01:03 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 08:01:04 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:01:04 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:01:04 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 08:01:04 GMT +recorded_with: VCR 3.0.3 diff --git a/features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_not_be_able_to_set_testnet_Bech32_address.yml b/features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_not_be_able_to_set_testnet_Bech32_address.yml new file mode 100644 index 00000000..4c44eba2 --- /dev/null +++ b/features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_not_be_able_to_set_testnet_Bech32_address.yml @@ -0,0 +1,419 @@ +--- +http_interactions: +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:06:05 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:06:05 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 08:06:05 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:06:06 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:06:06 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 08:06:06 GMT +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:06:06 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:06:06 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 08:06:06 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:06:07 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:06:07 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 08:06:07 GMT +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:06:07 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:06:07 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 08:06:07 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:06:08 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:06:08 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 08:06:08 GMT +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:06:08 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:06:08 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 08:06:08 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:06:08 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:06:08 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 08:06:08 GMT +recorded_with: VCR 3.0.3 diff --git a/features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_not_be_able_to_set_testnet_address.yml b/features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_not_be_able_to_set_testnet_address.yml new file mode 100644 index 00000000..3a4ef0be --- /dev/null +++ b/features/cassettes/Users_should_be_able_to_change_their_bitcoin_address/Users_should_not_be_able_to_set_testnet_address.yml @@ -0,0 +1,419 @@ +--- +http_interactions: +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:05:36 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:05:36 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 08:05:37 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:05:38 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:05:38 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 08:05:38 GMT +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:05:39 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:05:39 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 08:05:39 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:05:40 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:05:40 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 08:05:40 GMT +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:05:41 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:05:41 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 08:05:42 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:05:47 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:05:47 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 08:05:47 GMT +- request: + method: get + uri: https://www.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - www.gravatar.com + response: + status: + code: 302 + message: Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:05:48 GMT + Content-Type: + - text/html; charset=utf-8 + Content-Length: + - '0' + Connection: + - keep-alive + P3p: + - CP="CAO PSA" + X-Frame-Options: + - SAMEORIGIN + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:05:48 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + Location: + - https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 20 Nov 2020 08:05:48 GMT +- request: + method: get + uri: https://en.gravatar.com/2a143fe61195731f2191768efee317a8.json + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - en.gravatar.com + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Fri, 20 Nov 2020 08:05:49 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Accept-Encoding + P3p: + - CP="CAO PSA" + Expires: + - Wed, 11 Jan 1984 05:00:00 GMT + Last-Modified: + - Fri, 20 Nov 2020 08:05:49 GMT + Cache-Control: + - no-cache, must-revalidate, max-age=0 + Pragma: + - no-cache + X-Frame-Options: + - SAMEORIGIN + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - "*" + Access-Control-Allow-Methods: + - GET, OPTIONS + body: + encoding: ASCII-8BIT + string: '"User not found"' + http_version: + recorded_at: Fri, 20 Nov 2020 08:05:50 GMT +recorded_with: VCR 3.0.3 diff --git a/lib/bitcoin_address_validator.rb b/lib/bitcoin_address_validator.rb index 46d75f5f..65caccb2 100644 --- a/lib/bitcoin_address_validator.rb +++ b/lib/bitcoin_address_validator.rb @@ -9,12 +9,41 @@ def validate_each(record, field, value) private + BECH32_HRP = { + mainnet: 'bc', + testnet: 'tb' + }.freeze + + def valid_bitcoin_address?(addr) + valid_segwit_address?(addr) || valid_legacy_address?(addr) + end + + def valid_segwit_address?(addr) + segwit_addr = parse_segwit_address(addr) + return true if segwit_addr && segwit_addr.hrp == BECH32_HRP[CONFIG['network'].to_sym] + + false + end + + def parse_segwit_address(addr) + Bech32::SegwitAddr.new(addr) + rescue RuntimeError => e + return nil if e.message == 'Invalid address.' + + raise + end + B58Chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' B58Base = B58Chars.length - def valid_bitcoin_address?(address) + EXPECTED_VERSIONS = { + mainnet: [0, 5], + testnet: [111, 196] + }.freeze + + def valid_legacy_address?(address) if (address =~ /^[a-zA-Z1-9]{33,35}$/) and version = version(address) - if (expected_versions = CONFIG["address_versions"]).present? + if (expected_versions = EXPECTED_VERSIONS[CONFIG['network'].to_sym]).present? expected_versions.include?(version.ord) else true diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index b8fd6051..1381b14e 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -37,19 +37,53 @@ end end - context 'when address is valid' do + context 'when address is valid p2pkh address' do it 'should be valid' do user.bitcoin_address = '1M4bS4gPyA6Kb8w7aXsgth9oUZWcRk73tQ' expect(user).to be_valid end end - context 'when address is not valid' do + context 'when address is valid p2sh address' do + it 'should be valid' do + user.bitcoin_address = '3EktnHQD7RiAE6uzMj2ZifT9YgRrkSgzQX' + expect(user).to be_valid + end + end + + context 'when address is valid bech32 P2WPKH address' do + it 'should be valid' do + user.bitcoin_address = 'BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4' + expect(user).to be_valid + end + end + + context 'when address is valid bech32 P2WSH address' do + it 'should be valid' do + user.bitcoin_address = 'bc1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3qccfmv3' + expect(user).to be_valid + end + end + + context 'when address is not valid p2pkh' do it 'should not be valid' do user.bitcoin_address = '1M4bS4gPyA6Kb8w7aXsgth9oUZXXXXXXXX' expect(user).not_to be_valid end end + context 'when address is testnet bech32' do + it 'should not be valid' do + user.bitcoin_address = 'tb1qw508d6qejxtdg4y5r3zarvary0c5xw7kxpjzsx' + expect(user).not_to be_valid + end + end + + context 'when address is not valid bech32' do + it 'should not be valid' do + user.bitcoin_address = 'tb1qw508d6qejxtdg4y5r3zarvary0c5xw7kxpjzsx' + expect(user).not_to be_valid + end + end end end From b828cab0873860261334aa22332ec700c3bc24f4 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Fri, 20 Nov 2020 14:02:20 +0100 Subject: [PATCH 312/415] Migrated from abandoned twitter-bootstrap-form to bootstrap-form --- Gemfile | 3 +-- Gemfile.lock | 18 ++---------------- app/views/devise/confirmations/new.html.haml | 2 +- app/views/devise/passwords/edit.html.haml | 2 +- app/views/devise/passwords/new.html.haml | 2 +- app/views/devise/registrations/edit.html.haml | 2 +- app/views/devise/registrations/new.html.haml | 2 +- app/views/devise/sessions/new.html.haml | 4 ++-- app/views/users/show.html.haml | 10 +++++----- 9 files changed, 15 insertions(+), 30 deletions(-) diff --git a/Gemfile b/Gemfile index 434656b9..b2410525 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,7 @@ gem 'acts_as_paranoid', github: 'ActsAsParanoid/acts_as_paranoid' gem 'airbrake', '~> 3.1.15' gem 'bcrypt', '~> 3.1.12' gem 'bech32', '~> 1.0.5' -gem 'bootstrap_form', github: 'bootstrap-ruby/rails-bootstrap-forms' +gem 'bootstrap_form', '~> 2.7.0' gem 'cancancan' gem 'coffee-rails', '~> 4.0.0' gem 'demoji' @@ -41,7 +41,6 @@ gem 'sprockets', '~> 2.12.5' gem 'therubyracer', '~> 0.12.2', platforms: :ruby gem 'turbolinks', '~> 2.5.0' gem 'twitter-bootstrap-rails', github: 'seyhunak/twitter-bootstrap-rails', branch: 'bootstrap3' -gem 'twitter_bootstrap_form_for', github: 'stouset/twitter_bootstrap_form_for' gem 'uglifier', '>= 1.3.0' group :development do diff --git a/Gemfile.lock b/Gemfile.lock index 5ff6de4c..1f60b733 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,12 +6,6 @@ GIT activerecord (~> 4.0) activesupport (~> 4.0) -GIT - remote: git://github.com/bootstrap-ruby/rails-bootstrap-forms.git - revision: bb5e1ca8b8fdb6405feb162338e45468dac83c30 - specs: - bootstrap_form (2.2.0) - GIT remote: git://github.com/seyhunak/twitter-bootstrap-rails.git revision: 4d0bd4271f7f01d79bbb2b72c04f30a5766db0ef @@ -23,14 +17,6 @@ GIT rails (>= 3.1) railties (>= 3.1) -GIT - remote: git://github.com/stouset/twitter_bootstrap_form_for.git - revision: 830dbfd439ebb1194e1ae025100fc0e790be37cf - specs: - twitter_bootstrap_form_for (2.0.0.beta) - actionpack (~> 4) - railties (~> 4) - GEM remote: https://rubygems.org/ specs: @@ -78,6 +64,7 @@ GEM bcrypt (3.1.16) bcrypt_pbkdf (1.0.0) bech32 (1.0.5) + bootstrap_form (2.7.0) builder (3.2.4) cancancan (1.7.1) capistrano (3.4.1) @@ -405,7 +392,7 @@ DEPENDENCIES bcrypt (~> 3.1.12) bcrypt_pbkdf (~> 1.0.0) bech32 (~> 1.0.5) - bootstrap_form! + bootstrap_form (~> 2.7.0) cancancan capistrano (~> 3.4.0) capistrano-bundler (~> 1.1.2) @@ -452,7 +439,6 @@ DEPENDENCIES therubyracer (~> 0.12.2) turbolinks (~> 2.5.0) twitter-bootstrap-rails! - twitter_bootstrap_form_for! uglifier (>= 1.3.0) vcr webmock diff --git a/app/views/devise/confirmations/new.html.haml b/app/views/devise/confirmations/new.html.haml index 98616ee4..9dde55ad 100644 --- a/app/views/devise/confirmations/new.html.haml +++ b/app/views/devise/confirmations/new.html.haml @@ -1,4 +1,4 @@ -= twitter_bootstrap_form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post, class: 'form-devise' }) do |f| += bootstrap_form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post, class: 'form-devise' }) do |f| %h2= t('.title') = devise_error_messages! = f.email_field :email, :autofocus => true diff --git a/app/views/devise/passwords/edit.html.haml b/app/views/devise/passwords/edit.html.haml index 64d97232..bdf65f15 100644 --- a/app/views/devise/passwords/edit.html.haml +++ b/app/views/devise/passwords/edit.html.haml @@ -1,4 +1,4 @@ -= twitter_bootstrap_form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put, class: 'form-devise' }) do |f| += bootstrap_form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put, class: 'form-devise' }) do |f| %h2= t('.title') = devise_error_messages! = f.hidden_field :reset_password_token diff --git a/app/views/devise/passwords/new.html.haml b/app/views/devise/passwords/new.html.haml index 0099a39b..2785390c 100644 --- a/app/views/devise/passwords/new.html.haml +++ b/app/views/devise/passwords/new.html.haml @@ -1,4 +1,4 @@ -= twitter_bootstrap_form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post, class: 'form-devise', role: 'form' }) do |f| += bootstrap_form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post, class: 'form-devise', role: 'form' }) do |f| %h2= t('.title') = devise_error_messages! = f.email_field :email, :autofocus => true diff --git a/app/views/devise/registrations/edit.html.haml b/app/views/devise/registrations/edit.html.haml index 84a01fc1..a39e9c5b 100644 --- a/app/views/devise/registrations/edit.html.haml +++ b/app/views/devise/registrations/edit.html.haml @@ -1,4 +1,4 @@ -= twitter_bootstrap_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put, class: 'form-devise' }) do |f| += bootstrap_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put, class: 'form-devise' }) do |f| %h2 Edit #{resource_name.to_s.humanize} = render "devise/shared/error_messages", resource: resource diff --git a/app/views/devise/registrations/new.html.haml b/app/views/devise/registrations/new.html.haml index 721caa85..09c797b0 100644 --- a/app/views/devise/registrations/new.html.haml +++ b/app/views/devise/registrations/new.html.haml @@ -1,4 +1,4 @@ -= twitter_bootstrap_form_for(resource, :as => resource_name, :url => registration_path(resource_name), html: { class: 'form-devise registration_form'}) do |f| += bootstrap_form_for(resource, :as => resource_name, :url => registration_path(resource_name), html: { class: 'form-devise registration_form'}) do |f| %h2= t('.title') = render "devise/shared/error_messages", resource: resource = f.email_field :email, :autofocus => true diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml index 2d75b67f..45f1cff3 100644 --- a/app/views/devise/sessions/new.html.haml +++ b/app/views/devise/sessions/new.html.haml @@ -1,11 +1,11 @@ -= twitter_bootstrap_form_for(resource, :as => resource_name, :url => session_path(resource_name), html: {class: 'form-devise session_form' }) do |f| += bootstrap_form_for(resource, :as => resource_name, :url => session_path(resource_name), html: {class: 'form-devise session_form' }) do |f| = render "devise/shared/error_messages", resource: resource %h2= t('.title') = f.email_field :email, :autofocus => true = f.password_field :password, :autocomplete => "off" - if devise_mapping.rememberable? %div - = f.check_box :remember_me, t('.remember_me') + = f.check_box :remember_me, label: t('.remember_me') = f.submit t('.submit') %p = render "devise/shared/links" diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index aaebe840..3f1e932f 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -23,7 +23,7 @@ %p %strong= User.human_attribute_name(:email) %p= @user.email -= twitter_bootstrap_form_for @user do |f| += bootstrap_form_for @user do |f| = f.text_field :bitcoin_address, placeholder: t('.bitcoin_address_placeholder') - if @user.gravatar_bitcoin.present? %span.from-gravatar{data:{for: 'user[bitcoin_address]', value: @user.gravatar_bitcoin }} @@ -33,14 +33,14 @@ %span.from-gravatar{data:{for: 'user[display_name]', value: @user.gravatar_display_name }} = "#{t('.use_from_gravatar')}: #{@user.gravatar_display_name}" - if f.object.bitcoin_address.blank? - = f.check_box :unsubscribed, t('.notify'), { checked: !f.object.unsubscribed? }, '0', '1' + = f.check_box :unsubscribed, { label: t('.notify'), checked: !f.object.unsubscribed? }, '0', '1' %br = f.submit t('.submit_user') %br %p %strong= link_to t('.change_password'), '#new_password_form', data: {toggle: "collapse"} -= twitter_bootstrap_form_for @user, html: {class: (params[:new_password] ? '' : 'collapse'), id: 'new_password_form'} do |f| += bootstrap_form_for @user, html: {class: (params[:new_password] ? '' : 'collapse'), id: 'new_password_form'} do |f| = hidden_field_tag :new_password, value: true = f.password_field :password, autofocus: true, autocomplete: "off" = f.password_field :password_confirmation, autocomplete: "off" @@ -50,7 +50,7 @@ %p %strong= link_to t('.delete_account'), '#delete_user_form', data: {toggle: "collapse"} -= twitter_bootstrap_form_for @user, html: {class: (params[:delete_user] ? '' : 'collapse'), id: 'delete_user_form', method: 'DELETE'} do |f| += bootstrap_form_for @user, html: {class: (params[:delete_user] ? '' : 'collapse'), id: 'delete_user_form', method: 'DELETE'} do |f| %p= t('.delete_account_notice') = f.text_field :email, value: '', autocomplete: "off" - = f.submit t('.delete_account_confirm'), class: 'btn-danger' \ No newline at end of file + = f.submit t('.delete_account_confirm'), class: 'btn btn-danger' \ No newline at end of file From 0ce499b18294be76200bff62406546be4670e336 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Fri, 20 Nov 2020 14:34:24 +0100 Subject: [PATCH 313/415] Use the latest version of twitter-bootstrap-rails --- Gemfile | 2 +- Gemfile.lock | 20 +++++++------------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/Gemfile b/Gemfile index b2410525..ba85e787 100644 --- a/Gemfile +++ b/Gemfile @@ -40,7 +40,7 @@ gem 'sidekiq' gem 'sprockets', '~> 2.12.5' gem 'therubyracer', '~> 0.12.2', platforms: :ruby gem 'turbolinks', '~> 2.5.0' -gem 'twitter-bootstrap-rails', github: 'seyhunak/twitter-bootstrap-rails', branch: 'bootstrap3' +gem 'twitter-bootstrap-rails' gem 'uglifier', '>= 1.3.0' group :development do diff --git a/Gemfile.lock b/Gemfile.lock index 1f60b733..b5d1a63e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,17 +6,6 @@ GIT activerecord (~> 4.0) activesupport (~> 4.0) -GIT - remote: git://github.com/seyhunak/twitter-bootstrap-rails.git - revision: 4d0bd4271f7f01d79bbb2b72c04f30a5766db0ef - branch: bootstrap3 - specs: - twitter-bootstrap-rails (2.2.7) - actionpack (>= 3.1) - execjs - rails (>= 3.1) - railties (>= 3.1) - GEM remote: https://rubygems.org/ specs: @@ -143,7 +132,7 @@ GEM edge_rider (0.3.2) activerecord erubis (2.7.0) - execjs (2.6.0) + execjs (2.7.0) factory_girl (4.3.0) activesupport (>= 3.0.0) factory_girl_rails (4.3.0) @@ -365,6 +354,11 @@ GEM tilt (1.4.1) turbolinks (2.5.3) coffee-rails + twitter-bootstrap-rails (3.2.0) + actionpack (~> 4.1) + execjs (~> 2.2) + rails (~> 4.1) + railties (~> 4.1) tzinfo (1.2.8) thread_safe (~> 0.1) uglifier (2.4.0) @@ -438,7 +432,7 @@ DEPENDENCIES sqlite3 (~> 1.3.11) therubyracer (~> 0.12.2) turbolinks (~> 2.5.0) - twitter-bootstrap-rails! + twitter-bootstrap-rails uglifier (>= 1.3.0) vcr webmock From 86fd993de5c851e61a3850e22d04aa33fa492165 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Fri, 20 Nov 2020 14:36:52 +0100 Subject: [PATCH 314/415] Use the latest version of acts_as_paranoid --- Gemfile | 2 +- Gemfile.lock | 13 ++++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/Gemfile b/Gemfile index ba85e787..a13d0e4e 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ ruby '2.5.8' gem 'rails', '4.2.11.3' -gem 'acts_as_paranoid', github: 'ActsAsParanoid/acts_as_paranoid' +gem 'acts_as_paranoid' gem 'airbrake', '~> 3.1.15' gem 'bcrypt', '~> 3.1.12' gem 'bech32', '~> 1.0.5' diff --git a/Gemfile.lock b/Gemfile.lock index b5d1a63e..8c4d098f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,11 +1,3 @@ -GIT - remote: git://github.com/ActsAsParanoid/acts_as_paranoid.git - revision: ddcd1915179c73f74985af6bc8935321ca2fe08d - specs: - acts_as_paranoid (0.5.0.beta1) - activerecord (~> 4.0) - activesupport (~> 4.0) - GEM remote: https://rubygems.org/ specs: @@ -43,6 +35,9 @@ GEM minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) + acts_as_paranoid (0.6.3) + activerecord (>= 4.2, < 7.0) + activesupport (>= 4.2, < 7.0) addressable (2.5.2) public_suffix (>= 2.0.2, < 4.0) airbrake (3.1.15) @@ -381,7 +376,7 @@ PLATFORMS ruby DEPENDENCIES - acts_as_paranoid! + acts_as_paranoid airbrake (~> 3.1.15) bcrypt (~> 3.1.12) bcrypt_pbkdf (~> 1.0.0) From 1eafd3a7616365ab6edbd403bcbc77e02c055119 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Fri, 20 Nov 2020 14:57:46 +0100 Subject: [PATCH 315/415] Updated jquery-rails and kaminari --- Gemfile | 6 +++--- Gemfile.lock | 13 +++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Gemfile b/Gemfile index a13d0e4e..edf16814 100644 --- a/Gemfile +++ b/Gemfile @@ -16,13 +16,13 @@ gem 'devise', '~> 4.7.3' gem 'devise-i18n' gem 'dusen', '~> 0.6.1' gem 'easy_gravatar' -gem 'haml-rails', '~> 1.0' +gem 'haml-rails' gem 'http_accept_language' gem 'i18n-js' gem 'jbuilder', '~> 1.5.3' -gem 'jquery-rails', '~> 3.1' +gem 'jquery-rails' gem 'jquery-turbolinks' -gem 'kaminari', '~> 1.2.1' +gem 'kaminari' gem 'kaminari-i18n' gem 'less-rails', '~> 2.4.2' gem 'money-tree', '~> 0.10.0' diff --git a/Gemfile.lock b/Gemfile.lock index 8c4d098f..46d1e9c9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -166,8 +166,9 @@ GEM jbuilder (1.5.3) activesupport (>= 3.0.0) multi_json (>= 1.2.0) - jquery-rails (3.1.4) - railties (>= 3.0, < 5.0) + jquery-rails (4.4.0) + rails-dom-testing (>= 1, < 3) + railties (>= 4.2.0) thor (>= 0.14, < 2.0) jquery-turbolinks (2.0.1) railties (>= 3.1.0) @@ -186,7 +187,7 @@ GEM activerecord kaminari-core (= 1.2.1) kaminari-core (1.2.1) - kaminari-i18n (0.2.0) + kaminari-i18n (0.5.0) kaminari rails less (2.4.0) @@ -396,13 +397,13 @@ DEPENDENCIES dusen (~> 0.6.1) easy_gravatar factory_girl_rails (~> 4.3.0) - haml-rails (~> 1.0) + haml-rails http_accept_language i18n-js jbuilder (~> 1.5.3) - jquery-rails (~> 3.1) + jquery-rails jquery-turbolinks - kaminari (~> 1.2.1) + kaminari kaminari-i18n less-rails (~> 2.4.2) money-tree (~> 0.10.0) From f1b40fdb45d807a614a0aa96e0119cd80091a9f5 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Fri, 20 Nov 2020 14:58:37 +0100 Subject: [PATCH 316/415] Use bundler 2 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 46d1e9c9..2ce7b2cd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -437,4 +437,4 @@ RUBY VERSION ruby 2.5.8p224 BUNDLED WITH - 1.17.3 + 2.1.4 From b9610f442da93c69a6d1df35fba82dc1053d2c82 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Fri, 20 Nov 2020 15:17:55 +0100 Subject: [PATCH 317/415] Fixed github glyph --- app/views/projects/show.html.haml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index a05e85da..ff1f2424 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -7,7 +7,10 @@ .alert.alert-danger= t('.disabled_notifications') %h1#project_header - = (@project.avatar_url.nil?)? (glyph :github) : (image_tag @project.avatar_url , class: 'project_avatar_img') + - if @project.avatar_url.nil? + %i.icon-github + - else + = image_tag(@project.avatar_url, class: 'project_avatar_img') = link_to @project.full_name , @project.github_url, target: '_blank' .pull-right - if @project.collaborators.empty? From 9ff44ba844bd7eaf3d845fef71cb27416dad53d0 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 21 Nov 2020 08:39:10 +0100 Subject: [PATCH 318/415] Migrated to Rails 5.2 --- Gemfile | 52 +-- Gemfile.lock | 405 ++++++++++-------- app/assets/config/manifest.js | 5 + app/assets/javascripts/application.js | 10 + app/assets/javascripts/bootstrap.js.coffee | 4 +- app/assets/stylesheets/application.css | 2 + .../stylesheets/bootstrap_and_overrides.css | 7 + .../bootstrap_and_overrides.css.less | 30 -- app/controllers/application_controller.rb | 2 +- app/controllers/projects_controller.rb | 4 +- app/controllers/tips_controller.rb | 4 +- app/controllers/users_controller.rb | 2 +- app/helpers/projects_helper.rb | 4 + app/models/application_record.rb | 3 + app/models/collaborator.rb | 2 +- app/models/deposit.rb | 2 +- app/models/project.rb | 2 +- app/models/sendmany.rb | 2 +- app/models/tip.rb | 2 +- app/models/tipping_policies_text.rb | 2 +- app/models/user.rb | 2 +- app/models/wallet.rb | 2 +- app/views/devise/confirmations/new.html.haml | 2 +- app/views/devise/passwords/edit.html.haml | 2 +- app/views/devise/passwords/new.html.haml | 2 +- app/views/devise/registrations/edit.html.haml | 2 +- app/views/devise/registrations/new.html.haml | 2 +- app/views/devise/sessions/new.html.haml | 2 +- .../projects/decide_tip_amounts.html.haml | 2 +- app/views/projects/index.html.haml | 8 +- app/views/users/show.html.haml | 4 +- config/application.rb | 3 +- config/environments/development.rb | 2 + config/environments/test.rb | 2 + config/locales/en.bootstrap.yml | 23 + db/schema.rb | 78 ++-- features/step_definitions/users_steps.rb | 7 +- features/support/factory_bot.rb | 1 + features/support/factory_girl.rb | 1 - spec/controllers/deposits_controller_spec.rb | 2 +- spec/controllers/projects_controller_spec.rb | 38 +- spec/controllers/tips_controller_spec.rb | 2 +- spec/controllers/users_controller_spec.rb | 8 +- .../withdrawals_controller_spec.rb | 2 +- spec/factories/deposit.rb | 10 +- spec/factories/project.rb | 12 +- spec/factories/sendmany.rb | 10 +- spec/factories/tip.rb | 10 +- spec/factories/user.rb | 10 +- spec/factories/wallets.rb | 10 +- spec/spec_helper.rb | 2 +- 51 files changed, 438 insertions(+), 371 deletions(-) create mode 100644 app/assets/config/manifest.js create mode 100644 app/assets/javascripts/application.js create mode 100644 app/assets/stylesheets/bootstrap_and_overrides.css delete mode 100644 app/assets/stylesheets/bootstrap_and_overrides.css.less create mode 100644 app/models/application_record.rb create mode 100644 config/locales/en.bootstrap.yml create mode 100644 features/support/factory_bot.rb delete mode 100644 features/support/factory_girl.rb diff --git a/Gemfile b/Gemfile index edf16814..054cfe5c 100644 --- a/Gemfile +++ b/Gemfile @@ -2,46 +2,45 @@ source 'https://rubygems.org' ruby '2.5.8' -gem 'rails', '4.2.11.3' +gem 'rails', '5.2.4.4' gem 'acts_as_paranoid' -gem 'airbrake', '~> 3.1.15' -gem 'bcrypt', '~> 3.1.12' -gem 'bech32', '~> 1.0.5' -gem 'bootstrap_form', '~> 2.7.0' +gem 'airbrake' +gem 'bcrypt' +gem 'bech32' +gem 'bootstrap_form' gem 'cancancan' -gem 'coffee-rails', '~> 4.0.0' +gem 'coffee-rails' gem 'demoji' -gem 'devise', '~> 4.7.3' +gem 'devise' gem 'devise-i18n' -gem 'dusen', '~> 0.6.1' +gem 'dusen' gem 'easy_gravatar' gem 'haml-rails' gem 'http_accept_language' gem 'i18n-js' -gem 'jbuilder', '~> 1.5.3' +gem 'jbuilder' gem 'jquery-rails' gem 'jquery-turbolinks' gem 'kaminari' gem 'kaminari-i18n' -gem 'less-rails', '~> 2.4.2' -gem 'money-tree', '~> 0.10.0' -gem 'mysql2', '~> 0.4.10', group: :production -gem 'octokit', '~> 4.7.0' -gem 'omniauth', '~> 1.9.1' +gem 'money-tree' +gem 'mysql2', group: :production +gem 'octokit' +gem 'omniauth' gem 'omniauth-github' -gem 'rails-i18n', '~> 4.0.0' +gem 'rails-i18n' gem 'render_csv' gem 'rest-client' -gem 'sass-rails', '~> 4.0.0' -gem 'sawyer', '~> 0.8.0' +gem 'sass-rails' +gem 'sawyer' gem 'sdoc', group: :doc, require: false gem 'sidekiq' -gem 'sprockets', '~> 2.12.5' -gem 'therubyracer', '~> 0.12.2', platforms: :ruby -gem 'turbolinks', '~> 2.5.0' +gem 'sprockets' +gem 'therubyracer', platforms: :ruby +gem 'turbolinks' gem 'twitter-bootstrap-rails' -gem 'uglifier', '>= 1.3.0' +gem 'uglifier' group :development do gem 'capistrano', '~> 3.4.0' @@ -55,17 +54,18 @@ group :development do end group :development, :test do - gem 'factory_girl_rails', '~> 4.3.0' - gem 'rspec-rails', '~> 4.0' - gem 'sqlite3', '~> 1.3.11' + gem 'factory_bot_rails' + gem 'rspec-rails' + gem 'sqlite3' end group :test do - gem 'cucumber-rails', '~> 1.0', require: false + gem 'cucumber-rails', '~> 1.0', require: false gem 'database_cleaner' gem 'rspec-activemodel-mocks' - gem 'shoulda-matchers', '~> 3.1' + gem 'shoulda-matchers' gem 'simplecov' gem 'vcr' gem 'webmock' + gem 'rails-controller-testing' end diff --git a/Gemfile.lock b/Gemfile.lock index 2ce7b2cd..c72ff6a5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,56 +1,66 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (4.2.11.3) - actionpack (= 4.2.11.3) - actionview (= 4.2.11.3) - activejob (= 4.2.11.3) + actioncable (5.2.4.4) + actionpack (= 5.2.4.4) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailer (5.2.4.4) + actionpack (= 5.2.4.4) + actionview (= 5.2.4.4) + activejob (= 5.2.4.4) mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.11.3) - actionview (= 4.2.11.3) - activesupport (= 4.2.11.3) - rack (~> 1.6) - rack-test (~> 0.6.2) - rails-dom-testing (~> 1.0, >= 1.0.5) + rails-dom-testing (~> 2.0) + actionpack (5.2.4.4) + actionview (= 5.2.4.4) + activesupport (= 5.2.4.4) + rack (~> 2.0, >= 2.0.8) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.11.3) - activesupport (= 4.2.11.3) + actionview (5.2.4.4) + activesupport (= 5.2.4.4) builder (~> 3.1) - erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (4.2.11.3) - activesupport (= 4.2.11.3) - globalid (>= 0.3.0) - activemodel (4.2.11.3) - activesupport (= 4.2.11.3) - builder (~> 3.1) - activerecord (4.2.11.3) - activemodel (= 4.2.11.3) - activesupport (= 4.2.11.3) - arel (~> 6.0) - activesupport (4.2.11.3) - i18n (~> 0.7) + activejob (5.2.4.4) + activesupport (= 5.2.4.4) + globalid (>= 0.3.6) + activemodel (5.2.4.4) + activesupport (= 5.2.4.4) + activerecord (5.2.4.4) + activemodel (= 5.2.4.4) + activesupport (= 5.2.4.4) + arel (>= 9.0) + activestorage (5.2.4.4) + actionpack (= 5.2.4.4) + activerecord (= 5.2.4.4) + marcel (~> 0.3.1) + activesupport (5.2.4.4) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - acts_as_paranoid (0.6.3) - activerecord (>= 4.2, < 7.0) - activesupport (>= 4.2, < 7.0) - addressable (2.5.2) - public_suffix (>= 2.0.2, < 4.0) - airbrake (3.1.15) - builder - multi_json - arel (6.0.4) + acts_as_paranoid (0.7.0) + activerecord (>= 5.2, < 7.0) + activesupport (>= 5.2, < 7.0) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + airbrake (11.0.1) + airbrake-ruby (~> 5.1) + airbrake-ruby (5.1.1) + rbtree3 (~> 0.5) + arel (9.0.0) backports (3.18.2) bcrypt (3.1.16) - bcrypt_pbkdf (1.0.0) + bcrypt_pbkdf (1.0.1) bech32 (1.0.5) - bootstrap_form (2.7.0) + bootstrap_form (4.5.0) + actionpack (>= 5.2) + activemodel (>= 5.2) builder (3.2.4) - cancancan (1.7.1) + cancancan (3.1.0) capistrano (3.4.1) i18n rake (>= 10.0.0) @@ -72,18 +82,17 @@ GEM rack-test (>= 0.6.3) regexp_parser (~> 1.5) xpath (~> 3.2) - coffee-rails (4.0.1) + coffee-rails (5.0.0) coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.0) + railties (>= 5.2.0) coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.9.1.1) + coffee-script-source (1.12.2) commonjs (0.2.7) concurrent-ruby (1.1.7) - connection_pool (2.2.0) - crack (0.4.3) - safe_yaml (~> 1.0.0) + connection_pool (2.2.3) + crack (0.4.4) crass (1.0.6) cucumber (3.2.0) builder (>= 2.1.2) @@ -108,33 +117,36 @@ GEM cucumber-tag_expressions (1.1.1) cucumber-wire (0.0.1) database_cleaner (1.8.5) - demoji (0.0.5) + demoji (0.0.7) devise (4.7.3) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) responders warden (~> 1.2.3) - devise-i18n (0.11.0) + devise-i18n (1.9.2) + devise (>= 4.7.1) diff-lcs (1.4.4) docile (1.3.2) - domain_name (0.5.25) + domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) dusen (0.6.1) activerecord (>= 3.0) edge_rider (>= 0.2.5) easy_gravatar (1.0.1) - edge_rider (0.3.2) - activerecord + edge_rider (1.1.0) + activerecord (>= 3.2) + erubi (1.10.0) erubis (2.7.0) execjs (2.7.0) - factory_girl (4.3.0) - activesupport (>= 3.0.0) - factory_girl_rails (4.3.0) - factory_girl (~> 4.3.0) - railties (>= 3.0.0) - faraday (0.17.3) + factory_bot (6.1.0) + activesupport (>= 5.0.0) + factory_bot_rails (6.1.0) + factory_bot (~> 6.1.0) + railties (>= 5.0.0) + faraday (1.1.0) multipart-post (>= 1.2, < 3) + ruby2_keywords ffi (1.13.1) gherkin (5.1.0) globalid (0.4.2) @@ -142,38 +154,36 @@ GEM haml (5.2.0) temple (>= 0.8.0) tilt - haml-rails (1.0.0) - actionpack (>= 4.0.1) - activesupport (>= 4.0.1) + haml-rails (2.0.1) + actionpack (>= 5.1) + activesupport (>= 5.1) haml (>= 4.0.6, < 6.0) html2haml (>= 1.0.1) - railties (>= 4.0.1) - hashdiff (0.3.7) + railties (>= 5.1) + hashdiff (1.0.1) hashie (4.1.0) - hike (1.2.3) html2haml (2.2.0) erubis (~> 2.7.0) haml (>= 4.0, < 6) nokogiri (>= 1.6.0) ruby_parser (~> 3.5) - http-cookie (1.0.2) + http-accept (1.7.0) + http-cookie (1.0.3) domain_name (~> 0.5) - http_accept_language (2.0.2) - i18n (0.9.5) + http_accept_language (2.1.1) + i18n (1.8.5) concurrent-ruby (~> 1.0) - i18n-js (2.1.2) - i18n - jbuilder (1.5.3) - activesupport (>= 3.0.0) - multi_json (>= 1.2.0) + i18n-js (3.8.0) + i18n (>= 0.6.6) + jbuilder (2.10.1) + activesupport (>= 5.0.0) jquery-rails (4.4.0) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - jquery-turbolinks (2.0.1) + jquery-turbolinks (2.1.0) railties (>= 3.1.0) turbolinks - json (2.3.1) jwt (2.2.2) kaminari (1.2.1) activesupport (>= 4.1.0) @@ -190,18 +200,25 @@ GEM kaminari-i18n (0.5.0) kaminari rails - less (2.4.0) + less (2.6.0) commonjs (~> 0.2.7) - less-rails (2.4.2) - actionpack (>= 3.1) - less (~> 2.4.0) + less-rails (4.0.0) + actionpack (>= 4) + less (~> 2.6.0) + sprockets (>= 2) libv8 (3.16.14.19) loofah (2.7.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) - mime-types (2.99.3) + marcel (0.3.3) + mimemagic (~> 0.3.2) + method_source (1.0.0) + mime-types (3.3.1) + mime-types-data (~> 3.2015) + mime-types-data (3.2020.1104) + mimemagic (0.3.5) mini_mime (1.0.2) mini_portile2 (2.4.0) minitest (5.14.2) @@ -211,11 +228,12 @@ GEM multi_test (0.1.2) multi_xml (0.6.0) multipart-post (2.1.1) - mysql2 (0.4.10) - net-scp (1.2.1) - net-ssh (>= 2.6.5) - net-ssh (4.1.0) + mysql2 (0.5.3) + net-scp (3.0.0) + net-ssh (>= 2.6.5, < 7.0.0) + net-ssh (6.1.0) netrc (0.11.0) + nio4r (2.5.4) nokogiri (1.10.10) mini_portile2 (~> 2.4.0) oauth2 (1.4.4) @@ -224,7 +242,8 @@ GEM multi_json (~> 1.3) multi_xml (~> 0.5) rack (>= 1.2, < 3) - octokit (4.7.0) + octokit (4.19.0) + faraday (>= 0.9) sawyer (~> 0.8.0, >= 0.5.3) omniauth (1.9.1) hashie (>= 3.4.6) @@ -236,54 +255,60 @@ GEM oauth2 (~> 1.4) omniauth (~> 1.9) orm_adapter (0.5.0) - public_suffix (3.0.1) - rack (1.6.13) - rack-test (0.6.3) - rack (>= 1.0) - rails (4.2.11.3) - actionmailer (= 4.2.11.3) - actionpack (= 4.2.11.3) - actionview (= 4.2.11.3) - activejob (= 4.2.11.3) - activemodel (= 4.2.11.3) - activerecord (= 4.2.11.3) - activesupport (= 4.2.11.3) - bundler (>= 1.3.0, < 2.0) - railties (= 4.2.11.3) - sprockets-rails - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.9) - activesupport (>= 4.2.0, < 5.0) - nokogiri (~> 1.6) - rails-deprecated_sanitizer (>= 1.0.1) + public_suffix (4.0.6) + rack (2.2.3) + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails (5.2.4.4) + actioncable (= 5.2.4.4) + actionmailer (= 5.2.4.4) + actionpack (= 5.2.4.4) + actionview (= 5.2.4.4) + activejob (= 5.2.4.4) + activemodel (= 5.2.4.4) + activerecord (= 5.2.4.4) + activestorage (= 5.2.4.4) + activesupport (= 5.2.4.4) + bundler (>= 1.3.0) + railties (= 5.2.4.4) + sprockets-rails (>= 2.0.0) + rails-controller-testing (1.0.5) + actionpack (>= 5.0.1.rc1) + actionview (>= 5.0.1.rc1) + activesupport (>= 5.0.1.rc1) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) rails-html-sanitizer (1.3.0) loofah (~> 2.3) - rails-i18n (4.0.3) - i18n (~> 0.6) - railties (~> 4.0) - railties (4.2.11.3) - actionpack (= 4.2.11.3) - activesupport (= 4.2.11.3) + rails-i18n (5.1.3) + i18n (>= 0.7, < 2) + railties (>= 5.0, < 6) + railties (5.2.4.4) + actionpack (= 5.2.4.4) + activesupport (= 5.2.4.4) + method_source rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) + thor (>= 0.19.0, < 2.0) rake (13.0.1) rbnacl (4.0.2) ffi + rbtree3 (0.6.0) rdoc (6.2.1) - redis (3.3.0) + redis (4.2.5) ref (2.0.0) regexp_parser (1.8.2) render_csv (2.0.0) rails (>= 3.0) - responders (2.4.1) - actionpack (>= 4.2.0, < 6.0) - railties (>= 4.2.0, < 6.0) - rest-client (1.8.0) + responders (3.0.1) + actionpack (>= 5.0) + railties (>= 5.0) + rest-client (2.1.0) + http-accept (>= 1.7.0, < 2.0) http-cookie (>= 1.0.2, < 2.0) - mime-types (>= 1.16, < 3.0) - netrc (~> 0.7) - rspec-activemodel-mocks (1.0.3) + mime-types (>= 1.16, < 4.0) + netrc (~> 0.8) + rspec-activemodel-mocks (1.1.0) activemodel (>= 3.0) activesupport (>= 3.0) rspec-mocks (>= 2.99, < 4.0) @@ -304,41 +329,44 @@ GEM rspec-mocks (~> 3.9) rspec-support (~> 3.9) rspec-support (3.10.0) + ruby2_keywords (0.0.2) ruby_parser (3.15.0) sexp_processor (~> 4.9) - safe_yaml (1.0.4) - sass (3.2.13) - sass-rails (4.0.1) - railties (>= 4.0.0, < 5.0) - sass (>= 3.1.10) - sprockets-rails (~> 2.0.0) - sawyer (0.8.1) - addressable (>= 2.3.5, < 2.6) - faraday (~> 0.8, < 1.0) + sass-rails (6.0.0) + sassc-rails (~> 2.1, >= 2.1.1) + sassc (2.4.0) + ffi (~> 1.9) + sassc-rails (2.1.2) + railties (>= 4.0.0) + sassc (>= 2.0) + sprockets (> 3.0) + sprockets-rails + tilt + sawyer (0.8.2) + addressable (>= 2.3.5) + faraday (> 0.8, < 2.0) sdoc (2.0.2) rdoc (>= 5.0) sexp_processor (4.15.1) - shoulda-matchers (3.1.1) - activesupport (>= 4.0.0) - sidekiq (4.0.2) - concurrent-ruby (~> 1.0) - connection_pool (~> 2.2, >= 2.2.0) - redis (~> 3.2, >= 3.2.1) + shoulda-matchers (4.4.1) + activesupport (>= 4.2.0) + sidekiq (6.1.2) + connection_pool (>= 2.2.2) + rack (~> 2.0) + redis (>= 4.2.0) simplecov (0.19.1) docile (~> 1.1) simplecov-html (~> 0.11) simplecov-html (0.12.3) - sprockets (2.12.5) - hike (~> 1.2) - multi_json (~> 1.0) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - sprockets-rails (2.0.1) - actionpack (>= 3.0) - activesupport (>= 3.0) - sprockets (~> 2.8) - sqlite3 (1.3.11) - sshkit (1.12.0) + sprockets (4.0.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.2) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + sqlite3 (1.4.2) + sshkit (1.21.0) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) temple (0.8.2) @@ -347,29 +375,32 @@ GEM ref thor (1.0.1) thread_safe (0.3.6) - tilt (1.4.1) - turbolinks (2.5.3) - coffee-rails - twitter-bootstrap-rails (3.2.0) - actionpack (~> 4.1) - execjs (~> 2.2) - rails (~> 4.1) - railties (~> 4.1) + tilt (2.0.10) + turbolinks (5.2.1) + turbolinks-source (~> 5.2) + turbolinks-source (5.2.0) + twitter-bootstrap-rails (3.2.2) + actionpack (>= 3.1) + execjs (>= 2.2.2, >= 2.2) + less-rails (>= 2.5.0) + railties (>= 3.1) tzinfo (1.2.8) thread_safe (~> 0.1) - uglifier (2.4.0) - execjs (>= 0.3.0) - json (>= 1.8.0) + uglifier (4.2.0) + execjs (>= 0.3.0, < 3) unf (0.1.4) unf_ext - unf_ext (0.0.7.1) - vcr (3.0.3) - warden (1.2.7) - rack (>= 1.0) - webmock (3.1.0) + unf_ext (0.0.7.7) + vcr (6.0.0) + warden (1.2.9) + rack (>= 2.0.9) + webmock (3.10.0) addressable (>= 2.3.6) crack (>= 0.3.2) - hashdiff + hashdiff (>= 0.4.0, < 2.0.0) + websocket-driver (0.7.3) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) @@ -378,58 +409,58 @@ PLATFORMS DEPENDENCIES acts_as_paranoid - airbrake (~> 3.1.15) - bcrypt (~> 3.1.12) + airbrake + bcrypt bcrypt_pbkdf (~> 1.0.0) - bech32 (~> 1.0.5) - bootstrap_form (~> 2.7.0) + bech32 + bootstrap_form cancancan capistrano (~> 3.4.0) capistrano-bundler (~> 1.1.2) capistrano-rails (~> 1.1.0) capistrano-rvm (~> 0.1.0) - coffee-rails (~> 4.0.0) + coffee-rails cucumber-rails (~> 1.0) database_cleaner demoji - devise (~> 4.7.3) + devise devise-i18n - dusen (~> 0.6.1) + dusen easy_gravatar - factory_girl_rails (~> 4.3.0) + factory_bot_rails haml-rails http_accept_language i18n-js - jbuilder (~> 1.5.3) + jbuilder jquery-rails jquery-turbolinks kaminari kaminari-i18n - less-rails (~> 2.4.2) - money-tree (~> 0.10.0) - mysql2 (~> 0.4.10) - octokit (~> 4.7.0) - omniauth (~> 1.9.1) + money-tree + mysql2 + octokit + omniauth omniauth-github - rails (= 4.2.11.3) - rails-i18n (~> 4.0.0) + rails (= 5.2.4.4) + rails-controller-testing + rails-i18n rbnacl (< 5) render_csv rest-client rspec-activemodel-mocks - rspec-rails (~> 4.0) - sass-rails (~> 4.0.0) - sawyer (~> 0.8.0) + rspec-rails + sass-rails + sawyer sdoc - shoulda-matchers (~> 3.1) + shoulda-matchers sidekiq simplecov - sprockets (~> 2.12.5) - sqlite3 (~> 1.3.11) - therubyracer (~> 0.12.2) - turbolinks (~> 2.5.0) + sprockets + sqlite3 + therubyracer + turbolinks twitter-bootstrap-rails - uglifier (>= 1.3.0) + uglifier vcr webmock diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js new file mode 100644 index 00000000..670e8d0e --- /dev/null +++ b/app/assets/config/manifest.js @@ -0,0 +1,5 @@ +// app/assets/config/manifest.js +// +//= link application.css +// +//= link application.js \ No newline at end of file diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js new file mode 100644 index 00000000..1732ea33 --- /dev/null +++ b/app/assets/javascripts/application.js @@ -0,0 +1,10 @@ +// This is a manifest file that'll be compiled into including all the files listed below. +// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically +// be included in the compiled file accessible from http://example.com/assets/application.js +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// the compiled file. +// +//= require jquery +//= require jquery_ujs +//= require twitter/bootstrap +//= require_tree . diff --git a/app/assets/javascripts/bootstrap.js.coffee b/app/assets/javascripts/bootstrap.js.coffee index f617be7e..94406798 100644 --- a/app/assets/javascripts/bootstrap.js.coffee +++ b/app/assets/javascripts/bootstrap.js.coffee @@ -1,3 +1,3 @@ -$(document).on "ready page:change", () -> +jQuery -> $("a[rel~=popover], .has-popover").popover() - $("a[rel~=tooltip], .has-tooltip").tooltip() \ No newline at end of file + $("a[rel~=tooltip], .has-tooltip").tooltip() diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 5c9d2b71..fb30baeb 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -30,3 +30,5 @@ } .rjust { text-align: right ; } + +.qrcode { text-align: center; } \ No newline at end of file diff --git a/app/assets/stylesheets/bootstrap_and_overrides.css b/app/assets/stylesheets/bootstrap_and_overrides.css new file mode 100644 index 00000000..131fcfd7 --- /dev/null +++ b/app/assets/stylesheets/bootstrap_and_overrides.css @@ -0,0 +1,7 @@ +/* + =require twitter-bootstrap-static/bootstrap + + Use Font Awesome icons (default) + To use Glyphicons sprites instead of Font Awesome, replace with "require twitter-bootstrap-static/sprites" + =require twitter-bootstrap-static/fontawesome + */ \ No newline at end of file diff --git a/app/assets/stylesheets/bootstrap_and_overrides.css.less b/app/assets/stylesheets/bootstrap_and_overrides.css.less deleted file mode 100644 index 9c3ec0d1..00000000 --- a/app/assets/stylesheets/bootstrap_and_overrides.css.less +++ /dev/null @@ -1,30 +0,0 @@ -@import "twitter/bootstrap/bootstrap"; - -// Set the correct sprite paths -@iconSpritePath: image-url("twitter/bootstrap/glyphicons-halflings.png"); -@iconWhiteSpritePath: image-url("twitter/bootstrap/glyphicons-halflings-white.png"); - -// Set the Font Awesome (Font Awesome is default. You can disable by commenting below lines) -@fontAwesomeEotPath: asset-url("fontawesome-webfont.eot"); -@fontAwesomeEotPath_iefix: asset-url("fontawesome-webfont.eot?#iefix"); -@fontAwesomeWoffPath: asset-url("fontawesome-webfont.woff"); -@fontAwesomeTtfPath: asset-url("fontawesome-webfont.ttf"); -@fontAwesomeSvgPath: asset-url("fontawesome-webfont.svg#fontawesomeregular"); - -// Font Awesome -@import "fontawesome/font-awesome"; - -// Glyphicons -//@import "twitter/bootstrap/sprites.less"; - -// Your custom LESS stylesheets goes here -// -// Since bootstrap was imported above you have access to its mixins which -// you may use and inherit here -// -// If you'd like to override bootstrap's own variables, you can do so here as well -// See http://twitter.github.com/bootstrap/customize.html#variables for their names and documentation -// -// Example: -// @linkColor: #ff0000; -.qrcode {text-align:center} \ No newline at end of file diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0c334652..c7b4c9b0 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -7,7 +7,7 @@ class ApplicationController < ActionController::Base redirect_to root_path, :alert => I18n.t('errors.access_denied') end - before_filter :load_locale + before_action :load_locale private diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index a398b242..f4918332 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -3,8 +3,8 @@ class ProjectsController < ApplicationController include ProjectsHelper - before_filter :load_project, only: [:show, :edit, :update, :decide_tip_amounts] - before_filter :redirect_to_pretty_url, only: [:show, :edit, :decide_tip_amounts] + before_action :load_project, only: [:show, :edit, :update, :decide_tip_amounts] + before_action :redirect_to_pretty_url, only: [:show, :edit, :decide_tip_amounts] def index @projects = Project.order(projects_order).page(params[:page]).per(30) diff --git a/app/controllers/tips_controller.rb b/app/controllers/tips_controller.rb index 333fcf22..4ef657ed 100644 --- a/app/controllers/tips_controller.rb +++ b/app/controllers/tips_controller.rb @@ -1,6 +1,6 @@ class TipsController < ApplicationController - before_filter { load_project params } - before_filter { load_user params } + before_action { load_project params } + before_action { load_user params } def index if @project.present? diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index db3258a6..adab2893 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,6 +1,6 @@ class UsersController < ApplicationController before_action :authenticate_user!, :load_user, :valid_user!, except: [:login, :index] - before_filter :redirect_to_pretty_url, only: [:show] + before_action :redirect_to_pretty_url, only: [:show] def show @user_tips = @user.tips diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index c7cec444..1bb9cba0 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -37,4 +37,8 @@ def pretty_project_url project def shield_url project project_url project, format: :svg end + + def permitted_params + params.permit(:order, :page) + end end diff --git a/app/models/application_record.rb b/app/models/application_record.rb new file mode 100644 index 00000000..863c094d --- /dev/null +++ b/app/models/application_record.rb @@ -0,0 +1,3 @@ +class ApplicationRecord < ActiveRecord::Base + self.abstract_class = true +end diff --git a/app/models/collaborator.rb b/app/models/collaborator.rb index 3c0e6f15..bb929bca 100644 --- a/app/models/collaborator.rb +++ b/app/models/collaborator.rb @@ -1,3 +1,3 @@ -class Collaborator < ActiveRecord::Base +class Collaborator < ApplicationRecord belongs_to :project end diff --git a/app/models/deposit.rb b/app/models/deposit.rb index 6dfba0c9..125b306b 100644 --- a/app/models/deposit.rb +++ b/app/models/deposit.rb @@ -1,4 +1,4 @@ -class Deposit < ActiveRecord::Base +class Deposit < ApplicationRecord belongs_to :project CONFIRMATIONS_NEEDED = 3 diff --git a/app/models/project.rb b/app/models/project.rb index b1d9f580..b0ba3a47 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1,4 +1,4 @@ -class Project < ActiveRecord::Base +class Project < ApplicationRecord acts_as_paranoid belongs_to :wallet diff --git a/app/models/sendmany.rb b/app/models/sendmany.rb index d42aa3d7..bda180b4 100644 --- a/app/models/sendmany.rb +++ b/app/models/sendmany.rb @@ -1,4 +1,4 @@ -class Sendmany < ActiveRecord::Base +class Sendmany < ApplicationRecord has_many :tips def total_amount diff --git a/app/models/tip.rb b/app/models/tip.rb index 4620d4e5..120859c6 100644 --- a/app/models/tip.rb +++ b/app/models/tip.rb @@ -1,4 +1,4 @@ -class Tip < ActiveRecord::Base +class Tip < ApplicationRecord belongs_to :user belongs_to :sendmany belongs_to :project, inverse_of: :tips diff --git a/app/models/tipping_policies_text.rb b/app/models/tipping_policies_text.rb index eaf490f2..5e6a3a55 100644 --- a/app/models/tipping_policies_text.rb +++ b/app/models/tipping_policies_text.rb @@ -1,4 +1,4 @@ -class TippingPoliciesText < ActiveRecord::Base +class TippingPoliciesText < ApplicationRecord belongs_to :project belongs_to :user end diff --git a/app/models/user.rb b/app/models/user.rb index 839b6d7e..6dbbe3c4 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,4 +1,4 @@ -class User < ActiveRecord::Base +class User < ApplicationRecord # Include default devise modules. Others available are: # :lockable, :timeoutable devise :database_authenticatable, :registerable, :recoverable, diff --git a/app/models/wallet.rb b/app/models/wallet.rb index 31eb4fb5..20d6de30 100644 --- a/app/models/wallet.rb +++ b/app/models/wallet.rb @@ -1,4 +1,4 @@ -class Wallet < ActiveRecord::Base +class Wallet < ApplicationRecord validates :name, :xpub, presence: true diff --git a/app/views/devise/confirmations/new.html.haml b/app/views/devise/confirmations/new.html.haml index 9dde55ad..4cbba835 100644 --- a/app/views/devise/confirmations/new.html.haml +++ b/app/views/devise/confirmations/new.html.haml @@ -2,6 +2,6 @@ %h2= t('.title') = devise_error_messages! = f.email_field :email, :autofocus => true - = f.submit t('.submit') + = f.submit t('.submit'), class: 'btn btn-primary' %p = render "devise/shared/links" diff --git a/app/views/devise/passwords/edit.html.haml b/app/views/devise/passwords/edit.html.haml index bdf65f15..024a7f6d 100644 --- a/app/views/devise/passwords/edit.html.haml +++ b/app/views/devise/passwords/edit.html.haml @@ -4,6 +4,6 @@ = f.hidden_field :reset_password_token = f.password_field :password, :autofocus => true, :autocomplete => "off" = f.password_field :password_confirmation, :autocomplete => "off" - = f.submit t('.submit') + = f.submit t('.submit'), class: 'btn btn-primary' %p = render "devise/shared/links" diff --git a/app/views/devise/passwords/new.html.haml b/app/views/devise/passwords/new.html.haml index 2785390c..ff2947a9 100644 --- a/app/views/devise/passwords/new.html.haml +++ b/app/views/devise/passwords/new.html.haml @@ -2,6 +2,6 @@ %h2= t('.title') = devise_error_messages! = f.email_field :email, :autofocus => true - = f.submit t('.submit') + = f.submit t('.submit'), class: 'btn btn-primary' %p = render "devise/shared/links" diff --git a/app/views/devise/registrations/edit.html.haml b/app/views/devise/registrations/edit.html.haml index a39e9c5b..cf5a8ac5 100644 --- a/app/views/devise/registrations/edit.html.haml +++ b/app/views/devise/registrations/edit.html.haml @@ -20,7 +20,7 @@ %i (we need your current password to confirm your changes) %br/ = f.password_field :current_password, :autocomplete => "off" - %div= f.submit "Update" + %div= f.submit "Update", class: 'btn btn-primary' %p %h3 Cancel my account %p diff --git a/app/views/devise/registrations/new.html.haml b/app/views/devise/registrations/new.html.haml index 09c797b0..1a00b84d 100644 --- a/app/views/devise/registrations/new.html.haml +++ b/app/views/devise/registrations/new.html.haml @@ -4,6 +4,6 @@ = f.email_field :email, :autofocus => true = f.password_field :password, :autocomplete => "off" = f.password_field :password_confirmation, :autocomplete => "off" - = f.submit t('.submit') + = f.submit t('.submit'), class: 'btn btn-primary' %p = render "devise/shared/links" diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml index 45f1cff3..fc647f00 100644 --- a/app/views/devise/sessions/new.html.haml +++ b/app/views/devise/sessions/new.html.haml @@ -6,6 +6,6 @@ - if devise_mapping.rememberable? %div = f.check_box :remember_me, label: t('.remember_me') - = f.submit t('.submit') + = f.submit t('.submit'), class: 'btn btn-primary' %p = render "devise/shared/links" diff --git a/app/views/projects/decide_tip_amounts.html.haml b/app/views/projects/decide_tip_amounts.html.haml index 423d65fe..f20dcebd 100644 --- a/app/views/projects/decide_tip_amounts.html.haml +++ b/app/views/projects/decide_tip_amounts.html.haml @@ -19,4 +19,4 @@ = tip_fields.radio_button :amount_percentage, amount[1], inline: true, label: t(amount[0], scope: 'tip_amounts') .text-center - = f.submit t('.submit') + = f.submit t('.submit'), class: 'btn btn-primary' diff --git a/app/views/projects/index.html.haml b/app/views/projects/index.html.haml index 659b7ba0..0638032d 100644 --- a/app/views/projects/index.html.haml +++ b/app/views/projects/index.html.haml @@ -15,10 +15,10 @@ %thead %tr %th - %th= link_to_unless_current t('.repository'), params.merge(:order => 'repository') - %th= link_to_unless_current t('.description'), params.merge(:order => 'description') - %th= link_to_unless_current t('.watchers'), params.merge(:order => 'watchers') - %th= link_to_unless params[:order].blank? || params[:order] == 'balance', t('.balance'), params.merge(:order => 'balance') + %th= link_to_unless_current t('.repository'), permitted_params.merge(:order => 'repository') + %th= link_to_unless_current t('.description'), permitted_params.merge(:order => 'description') + %th= link_to_unless_current t('.watchers'), permitted_params.merge(:order => 'watchers') + %th= link_to_unless params[:order].blank? || params[:order] == 'balance', t('.balance'), permitted_params.merge(:order => 'balance') %th %tbody - @projects.to_a.reject{|p| BLACKLIST.include?(p.github_url) }.each do |project| diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index 3f1e932f..44b97a64 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -35,7 +35,7 @@ - if f.object.bitcoin_address.blank? = f.check_box :unsubscribed, { label: t('.notify'), checked: !f.object.unsubscribed? }, '0', '1' %br - = f.submit t('.submit_user') + = f.submit t('.submit_user'), class: 'btn btn-primary' %br %p %strong= link_to t('.change_password'), '#new_password_form', data: {toggle: "collapse"} @@ -44,7 +44,7 @@ = hidden_field_tag :new_password, value: true = f.password_field :password, autofocus: true, autocomplete: "off" = f.password_field :password_confirmation, autocomplete: "off" - = f.submit t('.submit_password') + = f.submit t('.submit_password'), class: 'btn btn-primary' %br %p diff --git a/config/application.rb b/config/application.rb index b91bb912..d700c1f9 100644 --- a/config/application.rb +++ b/config/application.rb @@ -27,8 +27,7 @@ class Application < Rails::Application config.assets.initialize_on_precompile = true config.available_locales = %w[en es fr nl ru pl hr de ro ko id ja pt my cn hk] config.active_job.queue_adapter = :sidekiq - - config.active_record.raise_in_transactional_callbacks = true + config.active_record.sqlite3.represent_boolean_as_integer = true end end diff --git a/config/environments/development.rb b/config/environments/development.rb index 42389197..3e5e8255 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -28,4 +28,6 @@ # This option may cause significant delays in view rendering with a large # number of complex assets. config.assets.debug = true + + config.assets.check_precompiled_asset = false end diff --git a/config/environments/test.rb b/config/environments/test.rb index 70a0d8f5..a24b44ba 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -36,4 +36,6 @@ # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr + + config.assets.check_precompiled_asset = false end diff --git a/config/locales/en.bootstrap.yml b/config/locales/en.bootstrap.yml new file mode 100644 index 00000000..8d751190 --- /dev/null +++ b/config/locales/en.bootstrap.yml @@ -0,0 +1,23 @@ +# Sample localization file for English. Add more files in this directory for other locales. +# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. + +en: + breadcrumbs: + application: + root: "Index" + pages: + pages: "Pages" + helpers: + actions: "Actions" + links: + back: "Back" + cancel: "Cancel" + confirm: "Are you sure?" + destroy: "Delete" + new: "New" + edit: "Edit" + titles: + edit: "Edit %{model}" + save: "Save %{model}" + new: "New %{model}" + delete: "Delete %{model}" diff --git a/db/schema.rb b/db/schema.rb index 43f56a9d..3e91d974 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -14,25 +14,25 @@ ActiveRecord::Schema.define(version: 20170308163825) do create_table "collaborators", force: :cascade do |t| - t.integer "project_id" + t.integer "project_id", limit: 4 t.string "login", limit: 255 t.datetime "created_at" t.datetime "updated_at" end - add_index "collaborators", ["project_id"], name: "index_collaborators_on_project_id" + add_index "collaborators", ["project_id"], name: "index_collaborators_on_project_id", using: :btree create_table "deposits", force: :cascade do |t| - t.integer "project_id" + t.integer "project_id", limit: 4 t.string "txid", limit: 255 - t.integer "confirmations" + t.integer "confirmations", limit: 4 t.datetime "created_at" t.datetime "updated_at" t.integer "amount", limit: 8 - t.float "fee_size" + t.float "fee_size", limit: 24 end - add_index "deposits", ["project_id"], name: "index_deposits_on_project_id" + add_index "deposits", ["project_id"], name: "index_deposits_on_project_id", using: :btree create_table "projects", force: :cascade do |t| t.string "url", limit: 255 @@ -42,30 +42,30 @@ t.string "name", limit: 255 t.string "full_name", limit: 255 t.string "source_full_name", limit: 255 - t.text "description" - t.integer "watchers_count" + t.text "description", limit: 65535 + t.integer "watchers_count", limit: 4 t.string "language", limit: 255 t.string "last_commit", limit: 255 - t.integer "available_amount_cache" + t.integer "available_amount_cache", limit: 4 t.string "github_id", limit: 255 - t.string "host", limit: 255, default: "github" - t.boolean "hold_tips", default: false + t.string "host", limit: 255, default: "github" + t.boolean "hold_tips", default: false t.datetime "info_updated_at" t.string "branch", limit: 255 t.boolean "disable_notifications" t.string "avatar_url", limit: 255 t.datetime "deleted_at" - t.string "bitcoin_address2" - t.integer "wallet_id" - t.string "legacy_address" + t.string "bitcoin_address2", limit: 255 + t.integer "wallet_id", limit: 4 + t.string "legacy_address", limit: 255 end - add_index "projects", ["full_name"], name: "index_projects_on_full_name", unique: true - add_index "projects", ["github_id"], name: "index_projects_on_github_id", unique: true + add_index "projects", ["full_name"], name: "index_projects_on_full_name", unique: true, using: :btree + add_index "projects", ["github_id"], name: "index_projects_on_github_id", unique: true, using: :btree create_table "sendmanies", force: :cascade do |t| t.string "txid", limit: 255 - t.text "data" + t.text "data", limit: 65535 t.string "result", limit: 255 t.boolean "is_error" t.datetime "created_at" @@ -73,32 +73,32 @@ end create_table "tipping_policies_texts", force: :cascade do |t| - t.integer "project_id" - t.integer "user_id" - t.text "text" + t.integer "project_id", limit: 4 + t.integer "user_id", limit: 4 + t.text "text", limit: 65535 t.datetime "created_at" t.datetime "updated_at" end - add_index "tipping_policies_texts", ["project_id"], name: "index_tipping_policies_texts_on_project_id" - add_index "tipping_policies_texts", ["user_id"], name: "index_tipping_policies_texts_on_user_id" + add_index "tipping_policies_texts", ["project_id"], name: "index_tipping_policies_texts_on_project_id", using: :btree + add_index "tipping_policies_texts", ["user_id"], name: "index_tipping_policies_texts_on_user_id", using: :btree create_table "tips", force: :cascade do |t| - t.integer "user_id" + t.integer "user_id", limit: 4 t.integer "amount", limit: 8 - t.integer "sendmany_id" + t.integer "sendmany_id", limit: 4 t.datetime "created_at" t.datetime "updated_at" t.string "commit", limit: 255 - t.integer "project_id" + t.integer "project_id", limit: 4 t.datetime "refunded_at" - t.text "commit_message" + t.text "commit_message", limit: 65535 t.datetime "decided_at" end - add_index "tips", ["project_id"], name: "index_tips_on_project_id" - add_index "tips", ["sendmany_id"], name: "index_tips_on_sendmany_id" - add_index "tips", ["user_id"], name: "index_tips_on_user_id" + add_index "tips", ["project_id"], name: "index_tips_on_project_id", using: :btree + add_index "tips", ["sendmany_id"], name: "index_tips_on_sendmany_id", using: :btree + add_index "tips", ["user_id"], name: "index_tips_on_user_id", using: :btree create_table "users", force: :cascade do |t| t.string "email", limit: 255, default: "", null: false @@ -106,7 +106,7 @@ t.string "reset_password_token", limit: 255 t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.integer "sign_in_count", default: 0, null: false + t.integer "sign_in_count", limit: 4, default: 0, null: false t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" t.string "current_sign_in_ip", limit: 255 @@ -120,25 +120,25 @@ t.string "login_token", limit: 255 t.boolean "unsubscribed" t.datetime "notified_at" - t.integer "commits_count", default: 0 + t.integer "commits_count", limit: 4, default: 0 t.integer "withdrawn_amount", limit: 8, default: 0 t.datetime "confirmed_at" t.datetime "confirmation_sent_at" t.string "confirmation_token", limit: 255 t.string "unconfirmed_email", limit: 255 t.string "display_name", limit: 255 - t.integer "denom", default: 0 + t.integer "denom", limit: 4, default: 0 end - add_index "users", ["email"], name: "index_users_on_email", unique: true - add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true + add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree + add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree create_table "wallets", force: :cascade do |t| - t.string "name" - t.string "xpub" - t.integer "last_address_index", limit: 4, default: 1 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.string "name", limit: 255 + t.string "xpub", limit: 255 + t.integer "last_address_index", limit: 4, default: 1 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end end diff --git a/features/step_definitions/users_steps.rb b/features/step_definitions/users_steps.rb index 1a700918..7a32a93b 100644 --- a/features/step_definitions/users_steps.rb +++ b/features/step_definitions/users_steps.rb @@ -1,5 +1,5 @@ -def create_user nickname , has_bitcoiin_address +def create_user(nickname, has_bitcoiin_address) User.create do |user| user.name = nickname user.email = "#{nickname}@example.com" @@ -10,8 +10,9 @@ def create_user nickname , has_bitcoiin_address end end -Given /^a developer named "(.*?)" exists (with|without?) a bitcoin address$/ do |nickname , with| - (@users ||= {})[nickname] ||= (create_user nickname , (with.eql? 'with')) +Given /^a developer named "(.*?)" exists (with|without) a bitcoin address$/ do |nickname, with| + @users ||= {} + @users[nickname] ||= create_user(nickname, with.eql?('with')) end Then /^a developer named "(.*?)" does not exist$/ do |nickname| diff --git a/features/support/factory_bot.rb b/features/support/factory_bot.rb new file mode 100644 index 00000000..168f5ac1 --- /dev/null +++ b/features/support/factory_bot.rb @@ -0,0 +1 @@ +World(FactoryBot::Syntax::Methods) diff --git a/features/support/factory_girl.rb b/features/support/factory_girl.rb deleted file mode 100644 index 139fbe01..00000000 --- a/features/support/factory_girl.rb +++ /dev/null @@ -1 +0,0 @@ -World(FactoryGirl::Syntax::Methods) diff --git a/spec/controllers/deposits_controller_spec.rb b/spec/controllers/deposits_controller_spec.rb index 750b6980..57de087c 100644 --- a/spec/controllers/deposits_controller_spec.rb +++ b/spec/controllers/deposits_controller_spec.rb @@ -4,7 +4,7 @@ describe "GET 'index'" do it "returns http success" do get 'index' - expect(response).to be_success + expect(response).to be_successful end end diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index 24b24018..3c3b5f59 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -42,7 +42,7 @@ describe 'GET #search' do context 'with existing repo that has been blacklisted' do - let(:subject) { get :search, query: "https://github.com/mitsuhiko/flask" } + let(:subject) { get(:search, params: { query: 'https://github.com/mitsuhiko/flask' }) } it 'renders blacklisted template' do expect(subject).to render_template :blacklisted @@ -53,7 +53,7 @@ describe 'POST #search' do it 'returns 200 status code' do post :search - expect(response).to be_success + expect(response).to be_successful end end @@ -72,34 +72,42 @@ context 'existing_project' do it 'via project id returns 302 status code' do case verb - when :get ; get action , :id => a_project.id - when :patch ; patch action , :id => a_project.id + when :get + get(action, params: { id: a_project.id }) + when :patch + patch(action, params: { id: a_project.id }) end expect(response).to be_redirect end it 'via project name returns 200 status code' do case verb - when :get ; get action , :service => 'github' , :repo => a_project.full_name - when :patch ; patch action , :service => 'github' , :repo => a_project.full_name + when :get + get(action, params: { service: 'github', repo: a_project.full_name }) + when :patch + patch(action, params: { service: 'github', repo: a_project.full_name}) end - expect(response).to be_success + expect(response).to be_successful end end context 'nonexisting_project' do it 'via project id returns 302 status code' do case verb - when :get ; get action , :id => 999999 - when :patch ; patch action , :id => 999999 + when :get + get(action, params: { id: 999999 }) + when :patch + patch(action, params: { id: 999999 }) end expect(response).to be_redirect end it 'via project name returns 200 status code' do case verb - when :get ; get action , :service => 'github' , :repo => 'no-such/project' ; - when :patch ; patch action , :service => 'github' , :repo => 'no-such/project' ; + when :get + get(action, params: { service: 'github', repo: 'no-such/project' }) + when :patch + patch(action, params: { service: 'github', repo: 'no-such/project' }) end expect(response).to be_redirect end @@ -111,7 +119,7 @@ context 'with existing repo that has been blacklisted' do let(:blacklisted_repo) { create(:project, host: "github", full_name: "mitsuhiko/flask") } - let(:subject) { get :show, service: "github", repo: blacklisted_repo.full_name } + let(:subject) { get(:show, params: { service: "github", repo: blacklisted_repo.full_name }) } it 'renders blacklisted template' do expect(subject).to render_template :blacklisted @@ -124,7 +132,7 @@ # TODO: requires logged in user who is project collaborator # include_context 'accessing_project' , :get , :edit - get :edit , :service => 'github' , :repo => 'test/test' + get(:edit, params: { service: 'github' , repo: 'test/test' }) expect(response).to be_redirect end end @@ -134,7 +142,7 @@ # include_context 'accessing_project' , :get , :decide_tip_amounts it 'returns 302 status code' do - get :decide_tip_amounts , :service => 'github' , :repo => 'test/test' + get(:decide_tip_amounts, params: { service: 'github', repo: 'test/test' }) expect(response).to be_redirect end end @@ -144,7 +152,7 @@ # include_context 'accessing_project' , :patch , :decide_tip_amounts it 'returns 302 status code' do - patch :decide_tip_amounts , :service => 'github' , :repo => 'test/test' + patch(:decide_tip_amounts, params: { service: 'github' , repo: 'test/test' }) expect(response).to be_redirect end end diff --git a/spec/controllers/tips_controller_spec.rb b/spec/controllers/tips_controller_spec.rb index 2453dbe3..60385bcb 100644 --- a/spec/controllers/tips_controller_spec.rb +++ b/spec/controllers/tips_controller_spec.rb @@ -4,7 +4,7 @@ describe "GET 'index'" do it "returns http success" do get 'index' - expect(response).to be_success + expect(response).to be_successful end end diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index 3d45dd35..a33c9f14 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -19,10 +19,8 @@ end describe '#show' do -# let(:user) { mock_model User, id: 100000000 } -# let(:subject) { get :show, id: user.id } let(:user) { create(:user) } - let(:subject) { get :show , :nickname => user.nickname } + let(:subject) { get(:show, params: { nickname: user.nickname }) } context 'when logged in' do login_user @@ -56,7 +54,7 @@ context 'when viewing other\'s page' do let(:new_user) { create(:user) } - let(:subject) { get :show, id: new_user.id } + let(:subject) { get(:show, params: { id: new_user.id }) } it 'redirect to root_path' do expect(subject).to redirect_to root_path @@ -70,7 +68,7 @@ end context 'when user not found' do - let(:subject) { get :show , :nickname => 'unknown-user' } + let(:subject) { get(:show, params: { nickname: 'unknown-user' }) } it 'redirect to users_path' do expect(subject).to redirect_to users_path diff --git a/spec/controllers/withdrawals_controller_spec.rb b/spec/controllers/withdrawals_controller_spec.rb index 226ec708..1e1cab44 100644 --- a/spec/controllers/withdrawals_controller_spec.rb +++ b/spec/controllers/withdrawals_controller_spec.rb @@ -4,7 +4,7 @@ describe "GET 'index'" do it "returns http success" do get 'index' - expect(response).to be_success + expect(response).to be_successful end end diff --git a/spec/factories/deposit.rb b/spec/factories/deposit.rb index e76681b0..6b30af0f 100644 --- a/spec/factories/deposit.rb +++ b/spec/factories/deposit.rb @@ -1,8 +1,8 @@ -FactoryGirl.define do +FactoryBot.define do factory :deposit do - association :project - txid "txid" - confirmations 1 - amount 100 + association(:project) + txid { 'txid' } + confirmations { 1 } + amount { 100 } end end diff --git a/spec/factories/project.rb b/spec/factories/project.rb index 1c6657d5..4e77733d 100644 --- a/spec/factories/project.rb +++ b/spec/factories/project.rb @@ -1,15 +1,15 @@ -FactoryGirl.define do +FactoryBot.define do factory :project do - url "MyString" - full_name "test/test" - github_id "1234567890" + url { 'MyString' } + full_name { 'test/test' } + github_id { '1234567890' } trait :github do - host 'github' + host { 'github' } end trait :bitbucket do - host 'bitbucket' + host { 'bitbucket' } end end end diff --git a/spec/factories/sendmany.rb b/spec/factories/sendmany.rb index 6cf19257..4d782279 100644 --- a/spec/factories/sendmany.rb +++ b/spec/factories/sendmany.rb @@ -1,8 +1,8 @@ -FactoryGirl.define do +FactoryBot.define do factory :sendmany do - txid "txid" - data "MyText" - result "MyString" - is_error false + txid { 'txid' } + data { 'MyText' } + result { 'MyString' } + is_error { false } end end diff --git a/spec/factories/tip.rb b/spec/factories/tip.rb index 4107159e..e7877b9e 100644 --- a/spec/factories/tip.rb +++ b/spec/factories/tip.rb @@ -1,12 +1,12 @@ -FactoryGirl.define do +FactoryBot.define do factory :tip do - association :user - association :project - amount 1 + association(:user) + association(:project) + amount { 1 } commit { Digest::SHA1.hexdigest(SecureRandom.hex) } factory :undecided_tip do - amount nil + amount { nil } end end end diff --git a/spec/factories/user.rb b/spec/factories/user.rb index de2ee3db..0fb99524 100644 --- a/spec/factories/user.rb +++ b/spec/factories/user.rb @@ -1,9 +1,9 @@ -FactoryGirl.define do +FactoryBot.define do factory :user do sequence(:email) { |n| "test#{n}@gmail.com" } - password "password" - login_token "login_token" - name 'kd' - nickname 'kd' + password { 'password' } + login_token { 'login_token' } + name { 'kd' } + nickname { 'kd' } end end diff --git a/spec/factories/wallets.rb b/spec/factories/wallets.rb index 9729b730..f47103bd 100644 --- a/spec/factories/wallets.rb +++ b/spec/factories/wallets.rb @@ -1,7 +1,9 @@ -FactoryGirl.define do +FactoryBot.define do factory :wallet do - name 'test wallet' - xpub 'xpub661MyMwAqRbcFepxYZyGLKMTkTPDvbfLaoYDbw4d4iQT5SycGiJQREuraJ2N6Uh' \ - 'LGPcjXDhnARdtcUhgqN3a2dgQ3Dx8u1chtk8Rx16LrWg' + name { 'test wallet' } + xpub do + 'xpub661MyMwAqRbcFepxYZyGLKMTkTPDvbfLaoYDbw4d4iQT5SycGiJQREuraJ2N6Uh' \ + 'LGPcjXDhnARdtcUhgqN3a2dgQ3Dx8u1chtk8Rx16LrWg' + end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 033570ea..d3706ea5 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -55,7 +55,7 @@ # --seed 1234 config.order = "random" - include FactoryGirl::Syntax::Methods + include FactoryBot::Syntax::Methods config.include Devise::Test::ControllerHelpers, type: :controller config.extend ControllerMacros, type: :controller end From 6f9944560956fd6dd372e26deb420227d228ca22 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 21 Nov 2020 08:39:24 +0100 Subject: [PATCH 319/415] Added docker-compose for dev environment --- docker-compose.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 docker-compose.yaml diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 00000000..d03b2e74 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,11 @@ +version: '2' +services: + database: + image: mysql:5.5.62 + ports: + - '3306:3306' + environment: + MYSQL_ROOT_PASSWORD: password + MYSQL_DATABASE: tip4commit + MYSQL_USER: tip4commit + MYSQL_PASSWORD: password From 878ca1dfe17811b40c232f1bf6b466cd547bf131 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 21 Nov 2020 09:20:12 +0100 Subject: [PATCH 320/415] Specified migration version --- db/migrate/20131019133109_devise_create_users.rb | 2 +- db/migrate/20131019133235_add_columns_to_users.rb | 2 +- db/migrate/20131019144930_add_bitcoin_address_to_users.rb | 2 +- db/migrate/20131019164745_create_projects.rb | 2 +- db/migrate/20131019170122_create_deposits.rb | 2 +- db/migrate/20131019170659_create_sendmanies.rb | 2 +- db/migrate/20131019170925_create_tips.rb | 2 +- db/migrate/20131019175751_add_some_fields_to_projects.rb | 2 +- db/migrate/20131019205025_add_amount_to_deposit.rb | 2 +- db/migrate/20131019211518_add_last_commit_to_projects.rb | 2 +- db/migrate/20131020003746_add_commit_to_tip.rb | 2 +- db/migrate/20131020120722_add_login_token_to_users.rb | 2 +- db/migrate/20131020143021_add_unsubscribed_to_users.rb | 2 +- db/migrate/20131020145043_add_notified_at_to_users.rb | 2 +- db/migrate/20131030142320_add_project_to_tip.rb | 2 +- db/migrate/20131030142749_drop_deposit_from_tip.rb | 2 +- .../20131030191346_add_available_amount_cache_to_projects.rb | 2 +- db/migrate/20131212190037_add_cache_to_users.rb | 2 +- db/migrate/20140102095035_add_refunded_at_to_tips.rb | 2 +- db/migrate/20140207061855_add_github_id_to_projects.rb | 2 +- db/migrate/20140209022632_change_projects_description.rb | 2 +- db/migrate/20140209041123_create_indexes_for_projects.rb | 2 +- db/migrate/20140223061035_add_project_host.rb | 2 +- db/migrate/20140309192616_create_collaborators.rb | 2 +- db/migrate/20140323072851_add_hold_tips_to_project.rb | 2 +- db/migrate/20140323165816_add_commit_message_to_tip.rb | 2 +- db/migrate/20140323173320_create_tipping_policies_texts.rb | 2 +- db/migrate/20140402032836_change_commit_message_type.rb | 2 +- db/migrate/20140402034521_change_commit_message_limit.rb | 2 +- db/migrate/20140402082149_add_fee_size_to_deposits.rb | 2 +- db/migrate/20140620123610_add_decided_at_to_tips.rb | 2 +- .../20140620124628_update_decided_at_for_existing_tips.rb | 2 +- db/migrate/20140717085945_add_info_updated_at_to_projects.rb | 2 +- db/migrate/20140722092532_add_confirmation_fields_to_users.rb | 2 +- db/migrate/20140725054216_add_display_name_to_users.rb | 2 +- db/migrate/20140816062159_remove_paid_out_from_deposits.rb | 2 +- db/migrate/20140823035950_add_branch_to_projects.rb | 2 +- db/migrate/20140823060921_make_default_branch_blank.rb | 2 +- .../20140918051752_add_disable_notifications_to_projects.rb | 2 +- db/migrate/20141029083726_add_avatar_to_projects.rb | 2 +- db/migrate/20141112064004_add_deleted_at_to_projects.rb | 2 +- db/migrate/20150620054216_add_denom.rb | 2 +- db/migrate/20151219081507_add_bitcoin_address2_to_projects.rb | 2 +- db/migrate/20170308152313_create_wallets.rb | 2 +- db/migrate/20170308161814_add_wallet_id_to_projects.rb | 2 +- db/migrate/20170308163825_add_legacy_addresses_to_projects.rb | 2 +- 46 files changed, 46 insertions(+), 46 deletions(-) diff --git a/db/migrate/20131019133109_devise_create_users.rb b/db/migrate/20131019133109_devise_create_users.rb index ab71c3d1..60dff55e 100644 --- a/db/migrate/20131019133109_devise_create_users.rb +++ b/db/migrate/20131019133109_devise_create_users.rb @@ -1,4 +1,4 @@ -class DeviseCreateUsers < ActiveRecord::Migration +class DeviseCreateUsers < ActiveRecord::Migration[4.2] def change create_table(:users) do |t| ## Database authenticatable diff --git a/db/migrate/20131019133235_add_columns_to_users.rb b/db/migrate/20131019133235_add_columns_to_users.rb index 63f1b7f3..60257cc0 100644 --- a/db/migrate/20131019133235_add_columns_to_users.rb +++ b/db/migrate/20131019133235_add_columns_to_users.rb @@ -1,4 +1,4 @@ -class AddColumnsToUsers < ActiveRecord::Migration +class AddColumnsToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :nickname, :string add_column :users, :name, :string diff --git a/db/migrate/20131019144930_add_bitcoin_address_to_users.rb b/db/migrate/20131019144930_add_bitcoin_address_to_users.rb index 0977232b..c22933ab 100644 --- a/db/migrate/20131019144930_add_bitcoin_address_to_users.rb +++ b/db/migrate/20131019144930_add_bitcoin_address_to_users.rb @@ -1,4 +1,4 @@ -class AddBitcoinAddressToUsers < ActiveRecord::Migration +class AddBitcoinAddressToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :bitcoin_address, :string end diff --git a/db/migrate/20131019164745_create_projects.rb b/db/migrate/20131019164745_create_projects.rb index 165a4180..8b682c73 100644 --- a/db/migrate/20131019164745_create_projects.rb +++ b/db/migrate/20131019164745_create_projects.rb @@ -1,4 +1,4 @@ -class CreateProjects < ActiveRecord::Migration +class CreateProjects < ActiveRecord::Migration[4.2] def change create_table :projects do |t| t.string :url diff --git a/db/migrate/20131019170122_create_deposits.rb b/db/migrate/20131019170122_create_deposits.rb index 8c483564..45db3a76 100644 --- a/db/migrate/20131019170122_create_deposits.rb +++ b/db/migrate/20131019170122_create_deposits.rb @@ -1,4 +1,4 @@ -class CreateDeposits < ActiveRecord::Migration +class CreateDeposits < ActiveRecord::Migration[4.2] def change create_table :deposits do |t| t.references :project, index: true diff --git a/db/migrate/20131019170659_create_sendmanies.rb b/db/migrate/20131019170659_create_sendmanies.rb index b3f9ddb8..cd13b386 100644 --- a/db/migrate/20131019170659_create_sendmanies.rb +++ b/db/migrate/20131019170659_create_sendmanies.rb @@ -1,4 +1,4 @@ -class CreateSendmanies < ActiveRecord::Migration +class CreateSendmanies < ActiveRecord::Migration[4.2] def change create_table :sendmanies do |t| t.string :txid diff --git a/db/migrate/20131019170925_create_tips.rb b/db/migrate/20131019170925_create_tips.rb index 3dc35405..173ff7fa 100644 --- a/db/migrate/20131019170925_create_tips.rb +++ b/db/migrate/20131019170925_create_tips.rb @@ -1,4 +1,4 @@ -class CreateTips < ActiveRecord::Migration +class CreateTips < ActiveRecord::Migration[4.2] def change create_table :tips do |t| t.references :deposit, index: true diff --git a/db/migrate/20131019175751_add_some_fields_to_projects.rb b/db/migrate/20131019175751_add_some_fields_to_projects.rb index f643f300..359ed32c 100644 --- a/db/migrate/20131019175751_add_some_fields_to_projects.rb +++ b/db/migrate/20131019175751_add_some_fields_to_projects.rb @@ -1,4 +1,4 @@ -class AddSomeFieldsToProjects < ActiveRecord::Migration +class AddSomeFieldsToProjects < ActiveRecord::Migration[4.2] def change add_column :projects, :name, :string add_column :projects, :full_name, :string diff --git a/db/migrate/20131019205025_add_amount_to_deposit.rb b/db/migrate/20131019205025_add_amount_to_deposit.rb index b34c8bd1..d4be2067 100644 --- a/db/migrate/20131019205025_add_amount_to_deposit.rb +++ b/db/migrate/20131019205025_add_amount_to_deposit.rb @@ -1,4 +1,4 @@ -class AddAmountToDeposit < ActiveRecord::Migration +class AddAmountToDeposit < ActiveRecord::Migration[4.2] def change add_column :deposits, :amount, :integer, :limit => 8 end diff --git a/db/migrate/20131019211518_add_last_commit_to_projects.rb b/db/migrate/20131019211518_add_last_commit_to_projects.rb index 92078e8a..749be65d 100644 --- a/db/migrate/20131019211518_add_last_commit_to_projects.rb +++ b/db/migrate/20131019211518_add_last_commit_to_projects.rb @@ -1,4 +1,4 @@ -class AddLastCommitToProjects < ActiveRecord::Migration +class AddLastCommitToProjects < ActiveRecord::Migration[4.2] def change add_column :projects, :last_commit, :string end diff --git a/db/migrate/20131020003746_add_commit_to_tip.rb b/db/migrate/20131020003746_add_commit_to_tip.rb index 3cd6a56b..78823996 100644 --- a/db/migrate/20131020003746_add_commit_to_tip.rb +++ b/db/migrate/20131020003746_add_commit_to_tip.rb @@ -1,4 +1,4 @@ -class AddCommitToTip < ActiveRecord::Migration +class AddCommitToTip < ActiveRecord::Migration[4.2] def change add_column :tips, :commit, :string end diff --git a/db/migrate/20131020120722_add_login_token_to_users.rb b/db/migrate/20131020120722_add_login_token_to_users.rb index 82ba6d74..e3ee6076 100644 --- a/db/migrate/20131020120722_add_login_token_to_users.rb +++ b/db/migrate/20131020120722_add_login_token_to_users.rb @@ -1,4 +1,4 @@ -class AddLoginTokenToUsers < ActiveRecord::Migration +class AddLoginTokenToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :login_token, :string end diff --git a/db/migrate/20131020143021_add_unsubscribed_to_users.rb b/db/migrate/20131020143021_add_unsubscribed_to_users.rb index a6b587d1..fbc4b620 100644 --- a/db/migrate/20131020143021_add_unsubscribed_to_users.rb +++ b/db/migrate/20131020143021_add_unsubscribed_to_users.rb @@ -1,4 +1,4 @@ -class AddUnsubscribedToUsers < ActiveRecord::Migration +class AddUnsubscribedToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :unsubscribed, :boolean end diff --git a/db/migrate/20131020145043_add_notified_at_to_users.rb b/db/migrate/20131020145043_add_notified_at_to_users.rb index 8561e278..0a20a915 100644 --- a/db/migrate/20131020145043_add_notified_at_to_users.rb +++ b/db/migrate/20131020145043_add_notified_at_to_users.rb @@ -1,4 +1,4 @@ -class AddNotifiedAtToUsers < ActiveRecord::Migration +class AddNotifiedAtToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :notified_at, :datetime end diff --git a/db/migrate/20131030142320_add_project_to_tip.rb b/db/migrate/20131030142320_add_project_to_tip.rb index bf45132c..ff882711 100644 --- a/db/migrate/20131030142320_add_project_to_tip.rb +++ b/db/migrate/20131030142320_add_project_to_tip.rb @@ -1,4 +1,4 @@ -class AddProjectToTip < ActiveRecord::Migration +class AddProjectToTip < ActiveRecord::Migration[4.2] def change add_reference :tips, :project, index: true end diff --git a/db/migrate/20131030142749_drop_deposit_from_tip.rb b/db/migrate/20131030142749_drop_deposit_from_tip.rb index 1c1ddff8..3db72501 100644 --- a/db/migrate/20131030142749_drop_deposit_from_tip.rb +++ b/db/migrate/20131030142749_drop_deposit_from_tip.rb @@ -1,4 +1,4 @@ -class DropDepositFromTip < ActiveRecord::Migration +class DropDepositFromTip < ActiveRecord::Migration[4.2] def change remove_column :tips, :deposit_id end diff --git a/db/migrate/20131030191346_add_available_amount_cache_to_projects.rb b/db/migrate/20131030191346_add_available_amount_cache_to_projects.rb index 28260bf5..4ea2248c 100644 --- a/db/migrate/20131030191346_add_available_amount_cache_to_projects.rb +++ b/db/migrate/20131030191346_add_available_amount_cache_to_projects.rb @@ -1,4 +1,4 @@ -class AddAvailableAmountCacheToProjects < ActiveRecord::Migration +class AddAvailableAmountCacheToProjects < ActiveRecord::Migration[4.2] def change add_column :projects, :available_amount_cache, :integer end diff --git a/db/migrate/20131212190037_add_cache_to_users.rb b/db/migrate/20131212190037_add_cache_to_users.rb index 0be8ddf8..05b0f2e7 100644 --- a/db/migrate/20131212190037_add_cache_to_users.rb +++ b/db/migrate/20131212190037_add_cache_to_users.rb @@ -1,4 +1,4 @@ -class AddCacheToUsers < ActiveRecord::Migration +class AddCacheToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :commits_count, :integer, default: 0 add_column :users, :withdrawn_amount, :integer, limit: 8, default: 0 diff --git a/db/migrate/20140102095035_add_refunded_at_to_tips.rb b/db/migrate/20140102095035_add_refunded_at_to_tips.rb index 14d98acf..1d2a01e8 100644 --- a/db/migrate/20140102095035_add_refunded_at_to_tips.rb +++ b/db/migrate/20140102095035_add_refunded_at_to_tips.rb @@ -1,4 +1,4 @@ -class AddRefundedAtToTips < ActiveRecord::Migration +class AddRefundedAtToTips < ActiveRecord::Migration[4.2] def change add_column :tips, :refunded_at, :timestamp remove_column :tips, :is_refunded, :boolean diff --git a/db/migrate/20140207061855_add_github_id_to_projects.rb b/db/migrate/20140207061855_add_github_id_to_projects.rb index 9f2e8f24..8603e22f 100644 --- a/db/migrate/20140207061855_add_github_id_to_projects.rb +++ b/db/migrate/20140207061855_add_github_id_to_projects.rb @@ -1,4 +1,4 @@ -class AddGithubIdToProjects < ActiveRecord::Migration +class AddGithubIdToProjects < ActiveRecord::Migration[4.2] def change add_column :projects, :github_id, :string end diff --git a/db/migrate/20140209022632_change_projects_description.rb b/db/migrate/20140209022632_change_projects_description.rb index a02592e2..dd04c317 100644 --- a/db/migrate/20140209022632_change_projects_description.rb +++ b/db/migrate/20140209022632_change_projects_description.rb @@ -1,4 +1,4 @@ -class ChangeProjectsDescription < ActiveRecord::Migration +class ChangeProjectsDescription < ActiveRecord::Migration[4.2] def up change_column :projects, :description, :text, :limit => nil end diff --git a/db/migrate/20140209041123_create_indexes_for_projects.rb b/db/migrate/20140209041123_create_indexes_for_projects.rb index 30f06922..c17aa464 100644 --- a/db/migrate/20140209041123_create_indexes_for_projects.rb +++ b/db/migrate/20140209041123_create_indexes_for_projects.rb @@ -1,4 +1,4 @@ -class CreateIndexesForProjects < ActiveRecord::Migration +class CreateIndexesForProjects < ActiveRecord::Migration[4.2] def change add_index :projects, :full_name, :unique => true add_index :projects, :github_id, :unique => true diff --git a/db/migrate/20140223061035_add_project_host.rb b/db/migrate/20140223061035_add_project_host.rb index ee2a5825..93def914 100644 --- a/db/migrate/20140223061035_add_project_host.rb +++ b/db/migrate/20140223061035_add_project_host.rb @@ -1,4 +1,4 @@ -class AddProjectHost < ActiveRecord::Migration +class AddProjectHost < ActiveRecord::Migration[4.2] class Project < ActiveRecord::Base end diff --git a/db/migrate/20140309192616_create_collaborators.rb b/db/migrate/20140309192616_create_collaborators.rb index c0d734dc..2aa5ced4 100644 --- a/db/migrate/20140309192616_create_collaborators.rb +++ b/db/migrate/20140309192616_create_collaborators.rb @@ -1,4 +1,4 @@ -class CreateCollaborators < ActiveRecord::Migration +class CreateCollaborators < ActiveRecord::Migration[4.2] def change create_table :collaborators do |t| t.belongs_to :project, index: true diff --git a/db/migrate/20140323072851_add_hold_tips_to_project.rb b/db/migrate/20140323072851_add_hold_tips_to_project.rb index bb932ba1..97063382 100644 --- a/db/migrate/20140323072851_add_hold_tips_to_project.rb +++ b/db/migrate/20140323072851_add_hold_tips_to_project.rb @@ -1,4 +1,4 @@ -class AddHoldTipsToProject < ActiveRecord::Migration +class AddHoldTipsToProject < ActiveRecord::Migration[4.2] def change add_column :projects, :hold_tips, :boolean, default: false end diff --git a/db/migrate/20140323165816_add_commit_message_to_tip.rb b/db/migrate/20140323165816_add_commit_message_to_tip.rb index aad73bee..50bc133b 100644 --- a/db/migrate/20140323165816_add_commit_message_to_tip.rb +++ b/db/migrate/20140323165816_add_commit_message_to_tip.rb @@ -1,4 +1,4 @@ -class AddCommitMessageToTip < ActiveRecord::Migration +class AddCommitMessageToTip < ActiveRecord::Migration[4.2] def change add_column :tips, :commit_message, :string end diff --git a/db/migrate/20140323173320_create_tipping_policies_texts.rb b/db/migrate/20140323173320_create_tipping_policies_texts.rb index 898e3428..1d62f4d1 100644 --- a/db/migrate/20140323173320_create_tipping_policies_texts.rb +++ b/db/migrate/20140323173320_create_tipping_policies_texts.rb @@ -1,4 +1,4 @@ -class CreateTippingPoliciesTexts < ActiveRecord::Migration +class CreateTippingPoliciesTexts < ActiveRecord::Migration[4.2] def change create_table :tipping_policies_texts do |t| t.belongs_to :project, index: true diff --git a/db/migrate/20140402032836_change_commit_message_type.rb b/db/migrate/20140402032836_change_commit_message_type.rb index 48467d77..9fa48dd3 100644 --- a/db/migrate/20140402032836_change_commit_message_type.rb +++ b/db/migrate/20140402032836_change_commit_message_type.rb @@ -1,4 +1,4 @@ -class ChangeCommitMessageType < ActiveRecord::Migration +class ChangeCommitMessageType < ActiveRecord::Migration[4.2] def up change_column :tips, :commit_message, :text end diff --git a/db/migrate/20140402034521_change_commit_message_limit.rb b/db/migrate/20140402034521_change_commit_message_limit.rb index 34aca125..61eb8255 100644 --- a/db/migrate/20140402034521_change_commit_message_limit.rb +++ b/db/migrate/20140402034521_change_commit_message_limit.rb @@ -1,4 +1,4 @@ -class ChangeCommitMessageLimit < ActiveRecord::Migration +class ChangeCommitMessageLimit < ActiveRecord::Migration[4.2] def up change_column :tips, :commit_message, :text, limit: nil end diff --git a/db/migrate/20140402082149_add_fee_size_to_deposits.rb b/db/migrate/20140402082149_add_fee_size_to_deposits.rb index 5f3c96a1..e137e515 100644 --- a/db/migrate/20140402082149_add_fee_size_to_deposits.rb +++ b/db/migrate/20140402082149_add_fee_size_to_deposits.rb @@ -1,4 +1,4 @@ -class AddFeeSizeToDeposits < ActiveRecord::Migration +class AddFeeSizeToDeposits < ActiveRecord::Migration[4.2] class Deposit < ActiveRecord::Base end diff --git a/db/migrate/20140620123610_add_decided_at_to_tips.rb b/db/migrate/20140620123610_add_decided_at_to_tips.rb index c9ae29ed..4ae6c112 100644 --- a/db/migrate/20140620123610_add_decided_at_to_tips.rb +++ b/db/migrate/20140620123610_add_decided_at_to_tips.rb @@ -1,4 +1,4 @@ -class AddDecidedAtToTips < ActiveRecord::Migration +class AddDecidedAtToTips < ActiveRecord::Migration[4.2] def change add_column :tips, :decided_at, :timestamp end diff --git a/db/migrate/20140620124628_update_decided_at_for_existing_tips.rb b/db/migrate/20140620124628_update_decided_at_for_existing_tips.rb index 17ab997f..974d368a 100644 --- a/db/migrate/20140620124628_update_decided_at_for_existing_tips.rb +++ b/db/migrate/20140620124628_update_decided_at_for_existing_tips.rb @@ -1,4 +1,4 @@ -class UpdateDecidedAtForExistingTips < ActiveRecord::Migration +class UpdateDecidedAtForExistingTips < ActiveRecord::Migration[4.2] def up Tip.where.not(amount: nil).find_each do |tip| tip.update decided_at: tip.created_at diff --git a/db/migrate/20140717085945_add_info_updated_at_to_projects.rb b/db/migrate/20140717085945_add_info_updated_at_to_projects.rb index 7b5d77af..2da405bb 100644 --- a/db/migrate/20140717085945_add_info_updated_at_to_projects.rb +++ b/db/migrate/20140717085945_add_info_updated_at_to_projects.rb @@ -1,4 +1,4 @@ -class AddInfoUpdatedAtToProjects < ActiveRecord::Migration +class AddInfoUpdatedAtToProjects < ActiveRecord::Migration[4.2] def change add_column :projects, :info_updated_at, :timestamp end diff --git a/db/migrate/20140722092532_add_confirmation_fields_to_users.rb b/db/migrate/20140722092532_add_confirmation_fields_to_users.rb index dab00bd0..c21b8c36 100644 --- a/db/migrate/20140722092532_add_confirmation_fields_to_users.rb +++ b/db/migrate/20140722092532_add_confirmation_fields_to_users.rb @@ -1,4 +1,4 @@ -class AddConfirmationFieldsToUsers < ActiveRecord::Migration +class AddConfirmationFieldsToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :confirmed_at, :timestamp add_column :users, :confirmation_sent_at, :timestamp diff --git a/db/migrate/20140725054216_add_display_name_to_users.rb b/db/migrate/20140725054216_add_display_name_to_users.rb index 9e783036..6db1c1c1 100644 --- a/db/migrate/20140725054216_add_display_name_to_users.rb +++ b/db/migrate/20140725054216_add_display_name_to_users.rb @@ -1,4 +1,4 @@ -class AddDisplayNameToUsers < ActiveRecord::Migration +class AddDisplayNameToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :display_name, :string end diff --git a/db/migrate/20140816062159_remove_paid_out_from_deposits.rb b/db/migrate/20140816062159_remove_paid_out_from_deposits.rb index b7726e56..409b4c5e 100644 --- a/db/migrate/20140816062159_remove_paid_out_from_deposits.rb +++ b/db/migrate/20140816062159_remove_paid_out_from_deposits.rb @@ -1,4 +1,4 @@ -class RemovePaidOutFromDeposits < ActiveRecord::Migration +class RemovePaidOutFromDeposits < ActiveRecord::Migration[4.2] def change remove_column :deposits, :paid_out, :integer, :limit => 8 remove_column :deposits, :paid_out_at, :datetime diff --git a/db/migrate/20140823035950_add_branch_to_projects.rb b/db/migrate/20140823035950_add_branch_to_projects.rb index d514601c..fcc62eda 100644 --- a/db/migrate/20140823035950_add_branch_to_projects.rb +++ b/db/migrate/20140823035950_add_branch_to_projects.rb @@ -1,4 +1,4 @@ -class AddBranchToProjects < ActiveRecord::Migration +class AddBranchToProjects < ActiveRecord::Migration[4.2] def change add_column :projects, :branch, :string, default: 'master' end diff --git a/db/migrate/20140823060921_make_default_branch_blank.rb b/db/migrate/20140823060921_make_default_branch_blank.rb index b191d00b..e0bee36f 100644 --- a/db/migrate/20140823060921_make_default_branch_blank.rb +++ b/db/migrate/20140823060921_make_default_branch_blank.rb @@ -1,4 +1,4 @@ -class MakeDefaultBranchBlank < ActiveRecord::Migration +class MakeDefaultBranchBlank < ActiveRecord::Migration[4.2] def change change_column :projects, :branch, :string, default: nil end diff --git a/db/migrate/20140918051752_add_disable_notifications_to_projects.rb b/db/migrate/20140918051752_add_disable_notifications_to_projects.rb index 98c03469..9a8b0e34 100644 --- a/db/migrate/20140918051752_add_disable_notifications_to_projects.rb +++ b/db/migrate/20140918051752_add_disable_notifications_to_projects.rb @@ -1,4 +1,4 @@ -class AddDisableNotificationsToProjects < ActiveRecord::Migration +class AddDisableNotificationsToProjects < ActiveRecord::Migration[4.2] def change add_column :projects, :disable_notifications, :boolean end diff --git a/db/migrate/20141029083726_add_avatar_to_projects.rb b/db/migrate/20141029083726_add_avatar_to_projects.rb index c4d9f893..d4d07215 100644 --- a/db/migrate/20141029083726_add_avatar_to_projects.rb +++ b/db/migrate/20141029083726_add_avatar_to_projects.rb @@ -1,4 +1,4 @@ -class AddAvatarToProjects < ActiveRecord::Migration +class AddAvatarToProjects < ActiveRecord::Migration[4.2] def change add_column :projects, :avatar_url, :string end diff --git a/db/migrate/20141112064004_add_deleted_at_to_projects.rb b/db/migrate/20141112064004_add_deleted_at_to_projects.rb index 032050f9..d930003d 100644 --- a/db/migrate/20141112064004_add_deleted_at_to_projects.rb +++ b/db/migrate/20141112064004_add_deleted_at_to_projects.rb @@ -1,4 +1,4 @@ -class AddDeletedAtToProjects < ActiveRecord::Migration +class AddDeletedAtToProjects < ActiveRecord::Migration[4.2] def change add_column :projects, :deleted_at, :timestamp end diff --git a/db/migrate/20150620054216_add_denom.rb b/db/migrate/20150620054216_add_denom.rb index 91cde8be..6687c650 100755 --- a/db/migrate/20150620054216_add_denom.rb +++ b/db/migrate/20150620054216_add_denom.rb @@ -1,4 +1,4 @@ -class AddDenom < ActiveRecord::Migration +class AddDenom < ActiveRecord::Migration[4.2] def change add_column :users, :denom, :integer, default: 0 end diff --git a/db/migrate/20151219081507_add_bitcoin_address2_to_projects.rb b/db/migrate/20151219081507_add_bitcoin_address2_to_projects.rb index 8ade9884..e9d6bd19 100644 --- a/db/migrate/20151219081507_add_bitcoin_address2_to_projects.rb +++ b/db/migrate/20151219081507_add_bitcoin_address2_to_projects.rb @@ -1,4 +1,4 @@ -class AddBitcoinAddress2ToProjects < ActiveRecord::Migration +class AddBitcoinAddress2ToProjects < ActiveRecord::Migration[4.2] def change add_column :projects, :bitcoin_address2, :string, index: true reversible do |dir| diff --git a/db/migrate/20170308152313_create_wallets.rb b/db/migrate/20170308152313_create_wallets.rb index 9f349ec3..053ede27 100644 --- a/db/migrate/20170308152313_create_wallets.rb +++ b/db/migrate/20170308152313_create_wallets.rb @@ -1,4 +1,4 @@ -class CreateWallets < ActiveRecord::Migration +class CreateWallets < ActiveRecord::Migration[4.2] def change create_table :wallets do |t| t.string :name diff --git a/db/migrate/20170308161814_add_wallet_id_to_projects.rb b/db/migrate/20170308161814_add_wallet_id_to_projects.rb index 8e3f71dc..1de39ebc 100644 --- a/db/migrate/20170308161814_add_wallet_id_to_projects.rb +++ b/db/migrate/20170308161814_add_wallet_id_to_projects.rb @@ -1,4 +1,4 @@ -class AddWalletIdToProjects < ActiveRecord::Migration +class AddWalletIdToProjects < ActiveRecord::Migration[4.2] def change add_column :projects, :wallet_id, :integer end diff --git a/db/migrate/20170308163825_add_legacy_addresses_to_projects.rb b/db/migrate/20170308163825_add_legacy_addresses_to_projects.rb index 008f11b9..98ed4509 100644 --- a/db/migrate/20170308163825_add_legacy_addresses_to_projects.rb +++ b/db/migrate/20170308163825_add_legacy_addresses_to_projects.rb @@ -1,4 +1,4 @@ -class AddLegacyAddressesToProjects < ActiveRecord::Migration +class AddLegacyAddressesToProjects < ActiveRecord::Migration[4.2] def change add_column :projects, :legacy_address, :string end From 9858f80bc1e548f4e5c68353efef0cf4aa297dde Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 21 Nov 2020 10:17:55 +0100 Subject: [PATCH 321/415] Added images to the manifest --- app/assets/config/manifest.js | 4 +++- config/environments/development.rb | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index 670e8d0e..025c00ea 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -2,4 +2,6 @@ // //= link application.css // -//= link application.js \ No newline at end of file +//= link application.js +// +//= link_tree ../images diff --git a/config/environments/development.rb b/config/environments/development.rb index 3e5e8255..42389197 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -28,6 +28,4 @@ # This option may cause significant delays in view rendering with a large # number of complex assets. config.assets.debug = true - - config.assets.check_precompiled_asset = false end From 65bfdc177f796fe1a16b2882103225b86cd450be Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 21 Nov 2020 10:18:27 +0100 Subject: [PATCH 322/415] Update capistrano --- Capfile | 3 +++ Gemfile | 13 +++++++------ Gemfile.lock | 30 +++++++++++++++++------------- config/deploy.rb | 1 - 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/Capfile b/Capfile index 3a9dac77..3438e6b5 100644 --- a/Capfile +++ b/Capfile @@ -22,5 +22,8 @@ require 'capistrano/bundler' require 'capistrano/rails/assets' require 'capistrano/rails/migrations' +require "capistrano/scm/git" +install_plugin Capistrano::SCM::Git + # Loads custom tasks from `lib/capistrano/tasks' if you have any defined. Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r } diff --git a/Gemfile b/Gemfile index 054cfe5c..9043e5ad 100644 --- a/Gemfile +++ b/Gemfile @@ -43,14 +43,15 @@ gem 'twitter-bootstrap-rails' gem 'uglifier' group :development do - gem 'capistrano', '~> 3.4.0' - gem 'capistrano-bundler', '~> 1.1.2' - gem 'capistrano-rails', '~> 1.1.0' - gem 'capistrano-rvm', '~> 0.1.0' + gem 'capistrano' + gem 'capistrano-bundler' + gem 'capistrano-rails' + gem 'capistrano-rvm' # add ed25519 support to net-ssh - gem 'bcrypt_pbkdf', '~> 1.0.0' - gem 'rbnacl', '< 5' + gem 'bcrypt_pbkdf' + gem 'ed25519' + gem 'rbnacl' end group :development, :test do diff --git a/Gemfile.lock b/Gemfile.lock index c72ff6a5..0ef7dc70 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -51,6 +51,8 @@ GEM airbrake-ruby (~> 5.1) airbrake-ruby (5.1.1) rbtree3 (~> 0.5) + airbrussh (1.4.0) + sshkit (>= 1.6.1, != 1.7.0) arel (9.0.0) backports (3.18.2) bcrypt (3.1.16) @@ -61,16 +63,16 @@ GEM activemodel (>= 5.2) builder (3.2.4) cancancan (3.1.0) - capistrano (3.4.1) + capistrano (3.14.1) + airbrussh (>= 1.0.0) i18n rake (>= 10.0.0) - sshkit (~> 1.3) - capistrano-bundler (1.1.4) + sshkit (>= 1.9.0) + capistrano-bundler (2.0.1) capistrano (~> 3.1) - sshkit (~> 1.2) - capistrano-rails (1.1.8) + capistrano-rails (1.6.1) capistrano (~> 3.1) - capistrano-bundler (~> 1.1) + capistrano-bundler (>= 1.1, < 3) capistrano-rvm (0.1.2) capistrano (~> 3.0) sshkit (~> 1.2) @@ -134,6 +136,7 @@ GEM activerecord (>= 3.0) edge_rider (>= 0.2.5) easy_gravatar (1.0.1) + ed25519 (1.2.4) edge_rider (1.1.0) activerecord (>= 3.2) erubi (1.10.0) @@ -291,7 +294,7 @@ GEM rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) rake (13.0.1) - rbnacl (4.0.2) + rbnacl (7.1.1) ffi rbtree3 (0.6.0) rdoc (6.2.1) @@ -411,14 +414,14 @@ DEPENDENCIES acts_as_paranoid airbrake bcrypt - bcrypt_pbkdf (~> 1.0.0) + bcrypt_pbkdf bech32 bootstrap_form cancancan - capistrano (~> 3.4.0) - capistrano-bundler (~> 1.1.2) - capistrano-rails (~> 1.1.0) - capistrano-rvm (~> 0.1.0) + capistrano + capistrano-bundler + capistrano-rails + capistrano-rvm coffee-rails cucumber-rails (~> 1.0) database_cleaner @@ -427,6 +430,7 @@ DEPENDENCIES devise-i18n dusen easy_gravatar + ed25519 factory_bot_rails haml-rails http_accept_language @@ -444,7 +448,7 @@ DEPENDENCIES rails (= 5.2.4.4) rails-controller-testing rails-i18n - rbnacl (< 5) + rbnacl render_csv rest-client rspec-activemodel-mocks diff --git a/config/deploy.rb b/config/deploy.rb index 932e2754..bfc89d0d 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -4,7 +4,6 @@ # ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp } set :deploy_to, '/home/apps/t4c' -set :scm, :git set :rvm_type, :user set :rvm_ruby_version, '2.5.8' From 4fe8804b07ca41a7bc1bc9164e3629384db35b13 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 22 Nov 2020 10:35:22 +0100 Subject: [PATCH 323/415] Chore/rubocop (#400) added rubocop and fixed some warnings --- .gitignore | 4 +- .rubocop.yml | 11 + .rubocop_todo.yml | 183 +++++++++++++++ .travis.yml | 1 + Capfile | 4 +- Gemfile | 5 +- Gemfile.lock | 20 ++ Rakefile | 4 +- app/controllers/application_controller.rb | 64 +++-- app/controllers/deposits_controller.rb | 20 +- app/controllers/home_controller.rb | 2 + app/controllers/projects_controller.rb | 30 +-- app/controllers/tips_controller.rb | 10 +- .../users/omniauth_callbacks_controller.rb | 48 ++-- app/controllers/users_controller.rb | 8 +- app/controllers/withdrawals_controller.rb | 4 +- app/helpers/application_helper.rb | 12 +- app/helpers/deposits_helper.rb | 2 + app/helpers/home_helper.rb | 2 + app/helpers/projects_helper.rb | 23 +- app/helpers/sessions_helper.rb | 2 + app/helpers/users_helper.rb | 2 + app/mailers/user_mailer.rb | 10 +- app/models/ability.rb | 8 +- app/models/application_record.rb | 4 +- app/models/collaborator.rb | 2 + app/models/deposit.rb | 5 +- app/models/project.rb | 119 +++++----- app/models/sendmany.rb | 12 +- app/models/tip.rb | 71 +++--- app/models/tipping_policies_text.rb | 2 + app/models/user.rb | 24 +- app/models/wallet.rb | 3 +- app/services/bitbucket.rb | 38 +-- app/services/github.rb | 59 +++-- bin/airbrake | 16 -- bin/bundle | 3 - bin/bundler | 16 -- bin/cap | 16 -- bin/cdiff | 16 -- bin/colortab | 16 -- bin/decolor | 16 -- bin/erubis | 16 -- bin/haml | 16 -- bin/lessc | 16 -- bin/rackup | 16 -- bin/rails | 4 - bin/rake | 4 - bin/rdoc | 16 -- bin/ri | 16 -- bin/sass | 16 -- bin/sass-convert | 16 -- bin/scss | 16 -- bin/sdoc | 16 -- bin/sdoc-merge | 16 -- bin/slimrb | 16 -- bin/sprockets | 16 -- bin/term_display | 16 -- bin/term_mandel | 16 -- bin/thor | 16 -- bin/tilt | 16 -- bin/tt | 16 -- config.ru | 4 +- config/application.rb | 4 +- config/boot.rb | 6 +- config/deploy.rb | 2 + config/deploy/production.rb | 10 +- config/deploy/staging.rb | 10 +- config/environment.rb | 4 +- config/environments/development.rb | 4 +- config/environments/production.rb | 6 +- config/environments/test.rb | 8 +- config/initializers/backtrace_silencers.rb | 1 + config/initializers/blacklist.rb | 4 +- config/initializers/demoji.rb | 4 +- config/initializers/devise.rb | 8 +- config/initializers/errbit.rb | 8 +- .../initializers/filter_parameter_logging.rb | 2 + config/initializers/inflections.rb | 1 + config/initializers/mime_types.rb | 4 +- config/initializers/secret_token.rb | 2 + config/initializers/session_store.rb | 2 + config/initializers/wrap_parameters.rb | 2 + config/routes.rb | 39 +-- .../20131019133109_devise_create_users.rb | 13 +- .../20131019133235_add_columns_to_users.rb | 2 + ...1019144930_add_bitcoin_address_to_users.rb | 2 + db/migrate/20131019164745_create_projects.rb | 2 + db/migrate/20131019170122_create_deposits.rb | 6 +- .../20131019170659_create_sendmanies.rb | 2 + db/migrate/20131019170925_create_tips.rb | 4 +- ...31019175751_add_some_fields_to_projects.rb | 2 + .../20131019205025_add_amount_to_deposit.rb | 4 +- ...31019211518_add_last_commit_to_projects.rb | 2 + .../20131020003746_add_commit_to_tip.rb | 2 + ...20131020120722_add_login_token_to_users.rb | 2 + ...0131020143021_add_unsubscribed_to_users.rb | 2 + ...20131020145043_add_notified_at_to_users.rb | 2 + .../20131030142320_add_project_to_tip.rb | 2 + .../20131030142749_drop_deposit_from_tip.rb | 2 + ..._add_available_amount_cache_to_projects.rb | 2 + .../20131212190037_add_cache_to_users.rb | 2 + .../20140102095035_add_refunded_at_to_tips.rb | 2 + ...0140207061855_add_github_id_to_projects.rb | 2 + ...40209022632_change_projects_description.rb | 5 +- ...40209041123_create_indexes_for_projects.rb | 6 +- db/migrate/20140223061035_add_project_host.rb | 2 + .../20140309192616_create_collaborators.rb | 2 + ...20140323072851_add_hold_tips_to_project.rb | 2 + ...0140323165816_add_commit_message_to_tip.rb | 2 + ...323173320_create_tipping_policies_texts.rb | 2 + ...140402032836_change_commit_message_type.rb | 3 + ...40402034521_change_commit_message_limit.rb | 3 + ...20140402082149_add_fee_size_to_deposits.rb | 4 +- .../20140620123610_add_decided_at_to_tips.rb | 4 +- ...628_update_decided_at_for_existing_tips.rb | 2 + ...7085945_add_info_updated_at_to_projects.rb | 2 + ...092532_add_confirmation_fields_to_users.rb | 2 + ...0140725054216_add_display_name_to_users.rb | 2 + ...816062159_remove_paid_out_from_deposits.rb | 4 +- .../20140823035950_add_branch_to_projects.rb | 2 + ...0140823060921_make_default_branch_blank.rb | 2 + ...2_add_disable_notifications_to_projects.rb | 2 + .../20141029083726_add_avatar_to_projects.rb | 2 + ...141112064004_add_deleted_at_to_projects.rb | 2 + db/migrate/20150620054216_add_denom.rb | 2 + ...081507_add_bitcoin_address2_to_projects.rb | 6 +- db/migrate/20170308152313_create_wallets.rb | 2 + ...0170308161814_add_wallet_id_to_projects.rb | 2 + ...163825_add_legacy_addresses_to_projects.rb | 2 + db/schema.rb | 222 +++++++++--------- db/seeds.rb | 1 + features/step_definitions/common.rb | 116 ++++----- features/step_definitions/home_steps.rb | 5 +- features/step_definitions/project_steps.rb | 62 ++--- features/step_definitions/tips_steps.rb | 89 +++---- features/step_definitions/users_steps.rb | 7 +- features/support/big_decimal_inspect.rb | 2 + features/support/env.rb | 2 + features/support/factory_bot.rb | 2 + features/support/finders.rb | 8 +- features/support/ostruct_slice.rb | 2 + features/support/rspec_doubles.rb | 2 + features/support/to_ostruct.rb | 4 +- features/support/vcr_setup.rb | 2 + lib/bitcoin_address_validator.rb | 20 +- lib/bitcoin_rpc.rb | 20 +- lib/bitcoin_tipper.rb | 5 +- lib/blacklist.rb | 23 +- lib/tasks/cucumber.rake | 89 +++---- script/cucumber | 1 + spec/controllers/deposits_controller_spec.rb | 15 +- spec/controllers/home_controller_spec.rb | 44 ++-- spec/controllers/projects_controller_spec.rb | 217 +++++++++-------- spec/controllers/tips_controller_spec.rb | 15 +- spec/controllers/users_controller_spec.rb | 80 ++++--- .../withdrawals_controller_spec.rb | 15 +- spec/factories/deposit.rb | 2 + spec/factories/project.rb | 2 + spec/factories/sendmany.rb | 2 + spec/factories/tip.rb | 2 + spec/factories/user.rb | 2 + spec/factories/wallets.rb | 2 + spec/lib/blacklist_spec.rb | 28 ++- spec/mailers/user_mailer_spec.rb | 2 + spec/misc_spec.rb | 4 +- spec/models/collaborator_spec.rb | 2 + spec/models/deposit_spec.rb | 9 +- spec/models/project_spec.rb | 4 +- spec/models/send_many_spec.rb | 2 + spec/models/sendmany_spec.rb | 2 + spec/models/tip_spec.rb | 2 + spec/models/tipping_policies_text_spec.rb | 2 + spec/models/user_spec.rb | 2 + spec/models/wallet_spec.rb | 2 + spec/spec_helper.rb | 12 +- spec/support/controller_macros.rb | 2 + 177 files changed, 1396 insertions(+), 1239 deletions(-) create mode 100644 .rubocop.yml create mode 100644 .rubocop_todo.yml delete mode 100755 bin/airbrake delete mode 100755 bin/bundle delete mode 100755 bin/bundler delete mode 100755 bin/cap delete mode 100755 bin/cdiff delete mode 100755 bin/colortab delete mode 100755 bin/decolor delete mode 100755 bin/erubis delete mode 100755 bin/haml delete mode 100755 bin/lessc delete mode 100755 bin/rackup delete mode 100755 bin/rails delete mode 100755 bin/rake delete mode 100755 bin/rdoc delete mode 100755 bin/ri delete mode 100755 bin/sass delete mode 100755 bin/sass-convert delete mode 100755 bin/scss delete mode 100755 bin/sdoc delete mode 100755 bin/sdoc-merge delete mode 100755 bin/slimrb delete mode 100755 bin/sprockets delete mode 100755 bin/term_display delete mode 100755 bin/term_mandel delete mode 100755 bin/thor delete mode 100755 bin/tilt delete mode 100755 bin/tt diff --git a/.gitignore b/.gitignore index f345a12c..3f791f64 100644 --- a/.gitignore +++ b/.gitignore @@ -24,4 +24,6 @@ coverage -/db/seeds.rb \ No newline at end of file +/db/seeds.rb + +/.vscode/ diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 00000000..df9ea17d --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,11 @@ + +inherit_from: .rubocop_todo.yml + +AllCops: + TargetRubyVersion: 2.5 + NewCops: enable + Exclude: + - 'db/schema.rb' + +Style/Documentation: + Enabled: false diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 00000000..89ff7e02 --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,183 @@ +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2020-11-22 09:26:39 UTC using RuboCop version 1.3.1. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 3 +# Configuration parameters: AllowSafeAssignment. +Lint/AssignmentInCondition: + Exclude: + - 'app/controllers/application_controller.rb' + - 'app/controllers/projects_controller.rb' + - 'app/services/github.rb' + +# Offense count: 1 +# Configuration parameters: AllowComments, AllowEmptyLambdas. +Lint/EmptyBlock: + Exclude: + - 'lib/tasks/cucumber.rake' + +# Offense count: 1 +Lint/MissingSuper: + Exclude: + - 'lib/bitcoin_rpc.rb' + +# Offense count: 2 +# Configuration parameters: AllowComments. +Lint/SuppressedException: + Exclude: + - 'app/controllers/projects_controller.rb' + - 'app/controllers/users_controller.rb' + +# Offense count: 1 +Lint/UriEscapeUnescape: + Exclude: + - 'features/step_definitions/common.rb' + +# Offense count: 4 +Lint/UselessAssignment: + Exclude: + - 'app/models/project.rb' + - 'app/models/user.rb' + - 'features/step_definitions/common.rb' + +# Offense count: 20 +# Configuration parameters: IgnoredMethods. +Metrics/AbcSize: + Max: 67 + +# Offense count: 19 +# Configuration parameters: CountComments, CountAsOne, ExcludedMethods. +# ExcludedMethods: refine +Metrics/BlockLength: + Max: 224 + +# Offense count: 2 +# Configuration parameters: CountComments, CountAsOne. +Metrics/ClassLength: + Max: 183 + +# Offense count: 7 +# Configuration parameters: IgnoredMethods. +Metrics/CyclomaticComplexity: + Max: 29 + +# Offense count: 25 +# Configuration parameters: CountComments, CountAsOne, ExcludedMethods. +Metrics/MethodLength: + Max: 56 + +# Offense count: 1 +# Configuration parameters: CountComments, CountAsOne. +Metrics/ModuleLength: + Max: 162 + +# Offense count: 7 +# Configuration parameters: IgnoredMethods. +Metrics/PerceivedComplexity: + Max: 31 + +# Offense count: 1 +Naming/AccessorMethodName: + Exclude: + - 'lib/bitcoin_rpc.rb' + +# Offense count: 1 +Naming/ConstantName: + Exclude: + - 'lib/bitcoin_address_validator.rb' + +# Offense count: 1 +# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. +# AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to +Naming/MethodParameterName: + Exclude: + - 'lib/bitcoin_rpc.rb' + +# Offense count: 1 +# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros. +# NamePrefix: is_, has_, have_ +# ForbiddenPrefixes: is_, has_, have_ +# AllowedMethods: is_a? +# MethodDefinitionMacros: define_method, define_singleton_method +Naming/PredicateName: + Exclude: + - 'spec/**/*' + - 'app/models/project.rb' + +# Offense count: 3 +# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers. +# SupportedStyles: snake_case, normalcase, non_integer +Naming/VariableNumber: + Exclude: + - 'features/step_definitions/project_steps.rb' + +# Offense count: 23 +# Cop supports --auto-correct. +# Configuration parameters: AllowOnConstant. +Style/CaseEquality: + Exclude: + - 'app/helpers/application_helper.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: format, sprintf, percent +Style/FormatString: + Exclude: + - 'app/helpers/projects_helper.rb' + +# Offense count: 9 +# Configuration parameters: MinBodyLength. +Style/GuardClause: + Exclude: + - 'app/controllers/application_controller.rb' + - 'app/controllers/projects_controller.rb' + - 'app/controllers/users/omniauth_callbacks_controller.rb' + - 'app/controllers/users_controller.rb' + - 'app/models/project.rb' + - 'app/models/tip.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/IfUnlessModifier: + Exclude: + - 'app/models/project.rb' + +# Offense count: 1 +Style/MissingRespondToMissing: + Exclude: + - 'lib/bitcoin_rpc.rb' + +# Offense count: 3 +# Configuration parameters: AllowedMethods. +# AllowedMethods: respond_to_missing? +Style/OptionalBooleanParameter: + Exclude: + - 'features/step_definitions/project_steps.rb' + - 'lib/bitcoin_rpc.rb' + - 'lib/bitcoin_tipper.rb' + +# Offense count: 1 +# Configuration parameters: AllowModifier. +Style/SoleNestedConditional: + Exclude: + - 'app/models/tip.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, AllowSafeAssignment. +# SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex +Style/TernaryParentheses: + Exclude: + - 'features/step_definitions/home_steps.rb' + +# Offense count: 24 +# Cop supports --auto-correct. +# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. +# URISchemes: http, https +Layout/LineLength: + Max: 238 diff --git a/.travis.yml b/.travis.yml index 4119a1d6..7529506b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,7 @@ before_script: - cp config/database.yml.sample config/database.yml script: + - bundle exec rubocop - bundle exec rake db:migrate - bundle exec rake spec - bundle exec rake cucumber diff --git a/Capfile b/Capfile index 3438e6b5..1d4120ce 100644 --- a/Capfile +++ b/Capfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Load DSL and Setup Up Stages require 'capistrano/setup' @@ -22,7 +24,7 @@ require 'capistrano/bundler' require 'capistrano/rails/assets' require 'capistrano/rails/migrations' -require "capistrano/scm/git" +require 'capistrano/scm/git' install_plugin Capistrano::SCM::Git # Loads custom tasks from `lib/capistrano/tasks' if you have any defined. diff --git a/Gemfile b/Gemfile index 9043e5ad..ae6cf86f 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + source 'https://rubygems.org' ruby '2.5.8' @@ -57,16 +59,17 @@ end group :development, :test do gem 'factory_bot_rails' gem 'rspec-rails' + gem 'rubocop' gem 'sqlite3' end group :test do gem 'cucumber-rails', '~> 1.0', require: false gem 'database_cleaner' + gem 'rails-controller-testing' gem 'rspec-activemodel-mocks' gem 'shoulda-matchers' gem 'simplecov' gem 'vcr' gem 'webmock' - gem 'rails-controller-testing' end diff --git a/Gemfile.lock b/Gemfile.lock index 0ef7dc70..8446f023 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -54,6 +54,7 @@ GEM airbrussh (1.4.0) sshkit (>= 1.6.1, != 1.7.0) arel (9.0.0) + ast (2.4.1) backports (3.18.2) bcrypt (3.1.16) bcrypt_pbkdf (1.0.1) @@ -258,6 +259,9 @@ GEM oauth2 (~> 1.4) omniauth (~> 1.9) orm_adapter (0.5.0) + parallel (1.20.0) + parser (2.7.2.0) + ast (~> 2.4.1) public_suffix (4.0.6) rack (2.2.3) rack-test (1.1.0) @@ -293,6 +297,7 @@ GEM method_source rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) + rainbow (3.0.0) rake (13.0.1) rbnacl (7.1.1) ffi @@ -311,6 +316,7 @@ GEM http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) + rexml (3.2.4) rspec-activemodel-mocks (1.1.0) activemodel (>= 3.0) activesupport (>= 3.0) @@ -332,6 +338,18 @@ GEM rspec-mocks (~> 3.9) rspec-support (~> 3.9) rspec-support (3.10.0) + rubocop (1.3.1) + parallel (~> 1.10) + parser (>= 2.7.1.5) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8) + rexml + rubocop-ast (>= 1.1.1) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 1.4.0, < 2.0) + rubocop-ast (1.1.1) + parser (>= 2.7.1.5) + ruby-progressbar (1.10.1) ruby2_keywords (0.0.2) ruby_parser (3.15.0) sexp_processor (~> 4.9) @@ -394,6 +412,7 @@ GEM unf (0.1.4) unf_ext unf_ext (0.0.7.7) + unicode-display_width (1.7.0) vcr (6.0.0) warden (1.2.9) rack (>= 2.0.9) @@ -453,6 +472,7 @@ DEPENDENCIES rest-client rspec-activemodel-mocks rspec-rails + rubocop sass-rails sawyer sdoc diff --git a/Rakefile b/Rakefile index ccbbc5fa..9268d66d 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,8 @@ +# frozen_string_literal: true + # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. -require File.expand_path('../config/application', __FILE__) +require File.expand_path('config/application', __dir__) T4c::Application.load_tasks diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c7b4c9b0..be20945d 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,10 +1,12 @@ +# frozen_string_literal: true + class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception - rescue_from CanCan::AccessDenied do |exception| - redirect_to root_path, :alert => I18n.t('errors.access_denied') + rescue_from CanCan::AccessDenied do |_exception| + redirect_to root_path, alert: I18n.t('errors.access_denied') end before_action :load_locale @@ -14,35 +16,45 @@ class ApplicationController < ActionController::Base def load_locale if params[:locale] && ::Rails.application.config.available_locales.include?(params[:locale]) I18n.locale = session[:locale] = params[:locale].to_sym - redirect_to :back rescue true + begin + redirect_to :back + rescue StandardError + true + end elsif session[:locale] I18n.locale = session[:locale] - elsif l = http_accept_language.compatible_language_from(::Rails.application.config.available_locales).to_sym rescue nil + elsif l = language_from_http_accept_language I18n.locale = session[:locale] = l end end - def load_project params - return unless (is_via_project = self.is_a? ProjectsController) || - (is_via_tips = self.is_a? TipsController ) || - (is_via_deposits = self.is_a? DepositsController) + def language_from_http_accept_language + http_accept_language.compatible_language_from(::Rails.application.config.available_locales).to_sym + rescue StandardError + nil + end + + def load_project(params) + return unless (is_via_project = is_a? ProjectsController) || + (is_via_tips = is_a? TipsController) || + (is_via_deposits = is_a? DepositsController) - is_standard_path = params[:id] .present? && is_via_project + is_standard_path = params[:id].present? && is_via_project is_association_path = params[:project_id].present? - is_pretty_path = params[:service] .present? && params[:repo].present? + is_pretty_path = params[:service].present? && params[:repo].present? return unless is_standard_path || is_association_path || is_pretty_path - if (is_standard_path || is_association_path) && - (project_id = (is_via_project)? params[:id] : params[:project_id]) && - (@project = (Project.where :id => project_id).first) + if (is_standard_path || is_association_path) && + (project_id = is_via_project ? params[:id] : params[:project_id]) && + (@project = (Project.where id: project_id).first) if is_via_tips - redirect_to project_tips_pretty_path @project.host , @project.full_name + redirect_to project_tips_pretty_path @project.host, @project.full_name elsif is_via_deposits - redirect_to project_deposits_pretty_path @project.host , @project.full_name + redirect_to project_deposits_pretty_path @project.host, @project.full_name end elsif is_pretty_path - @project = Project.where(host: params[:service]). - where('lower(`full_name`) = ?' , params[:repo].downcase).first + @project = Project.where(host: params[:service]) + .where('lower(`full_name`) = ?', params[:repo].downcase).first end if @project.nil? @@ -51,21 +63,21 @@ def load_project params end end - def load_user params - return unless (is_via_user = self.is_a? UsersController) || - (is_via_tips = self.is_a? TipsController) + def load_user(params) + return unless (is_via_user = is_a? UsersController) || + (is_via_tips = is_a? TipsController) - return unless (is_standard_path = params[:id] .present? && is_via_user) || - (is_association_path = params[:user_id] .present?) || + return unless (is_standard_path = params[:id].present? && is_via_user) || + (is_association_path = params[:user_id].present?) || (is_pretty_path = params[:nickname].present?) - if (is_standard_path || is_association_path) && - (user_id = (is_via_user && params[:id]) || + if (is_standard_path || is_association_path) && + (user_id = (is_via_user && params[:id]) || (is_via_tips && params[:user_id])) && - (@user = User.where(:id => user_id).first) + (@user = User.where(id: user_id).first) redirect_to user_tips_pretty_path @user.nickname if is_via_tips elsif is_pretty_path - @user = User.where('lower(`nickname`) = ?' , params[:nickname].downcase).first + @user = User.where('lower(`nickname`) = ?', params[:nickname].downcase).first end if @user.nil? diff --git a/app/controllers/deposits_controller.rb b/app/controllers/deposits_controller.rb index 39c77758..a8c0db10 100644 --- a/app/controllers/deposits_controller.rb +++ b/app/controllers/deposits_controller.rb @@ -1,18 +1,20 @@ +# frozen_string_literal: true + class DepositsController < ApplicationController before_action { load_project params } def index - if @project.present? - @deposits = @project.deposits - else - @deposits = Deposit.includes(:project) - end - @deposits = @deposits.order(created_at: :desc). - page(params[:page]). - per(params[:per_page] || 30) + @deposits = if @project.present? + @project.deposits + else + Deposit.includes(:project) + end + @deposits = @deposits.order(created_at: :desc) + .page(params[:page]) + .per(params[:per_page] || 30) respond_to do |format| format.html - format.csv { render csv: @deposits, except: [:updated_at, :confirmations, :fee_size], add_methods: [:project_name, :fee, :confirmed?] } + format.csv { render csv: @deposits, except: %i[updated_at confirmations fee_size], add_methods: %i[project_name fee confirmed?] } end end end diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 1d8291f3..a175e5fc 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class HomeController < ApplicationController def index respond_to do |format| diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index f4918332..457236e2 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -1,10 +1,12 @@ +# frozen_string_literal: true + require 'net/http' class ProjectsController < ApplicationController include ProjectsHelper - before_action :load_project, only: [:show, :edit, :update, :decide_tip_amounts] - before_action :redirect_to_pretty_url, only: [:show, :edit, :decide_tip_amounts] + before_action :load_project, only: %i[show edit update decide_tip_amounts] + before_action :redirect_to_pretty_url, only: %i[show edit decide_tip_amounts] def index @projects = Project.order(projects_order).page(params[:page]).per(30) @@ -37,9 +39,7 @@ def edit def update authorize! :update, @project @project.attributes = project_params - if @project.tipping_policies_text.try(:text_changed?) - @project.tipping_policies_text.user = current_user - end + @project.tipping_policies_text.user = current_user if @project.tipping_policies_text.try(:text_changed?) if @project.save redirect_to project_path(@project), notice: I18n.t('notices.project_updated') else @@ -51,13 +51,14 @@ def decide_tip_amounts authorize! :decide_tip_amounts, @project if request.patch? @project.available_amount # preload anything required to get the amount, otherwise it's loaded during the assignation and there are undesirable consequences - percentages = params[:project][:tips_attributes].values.map{|tip| tip['amount_percentage'].to_f} + percentages = params[:project][:tips_attributes].values.map { |tip| tip['amount_percentage'].to_f } if percentages.sum > 100 redirect_to decide_tip_amounts_project_path(@project), alert: I18n.t('errors.can_assign_more_tips') return end - raise "wrong data" if percentages.min < 0 - @project.attributes = params.require(:project).permit(tips_attributes: [:id, :amount_percentage]) + raise 'wrong data' if percentages.min.negative? + + @project.attributes = params.require(:project).permit(tips_attributes: %i[id amount_percentage]) if @project.save message = I18n.t('notices.tips_decided') if @project.has_undecided_tips? @@ -69,10 +70,11 @@ def decide_tip_amounts end end - private - def load_project ; super params ; end ; + def load_project + super params + end def project_params params.require(:project).permit(:branch, :disable_notifications, :hold_tips, tipping_policies_text_attributes: [:text]) @@ -80,10 +82,10 @@ def project_params def projects_order { - 'balance' => {available_amount_cache: :desc, watchers_count: :desc, full_name: :asc}, - 'watchers' => {watchers_count: :desc, available_amount_cache: :desc, full_name: :asc}, - 'repository' => {full_name: :asc, available_amount_cache: :desc, watchers_count: :desc}, - 'description' => {description: :asc, available_amount_cache: :desc, watchers_count: :desc, full_name: :asc} + 'balance' => { available_amount_cache: :desc, watchers_count: :desc, full_name: :asc }, + 'watchers' => { watchers_count: :desc, available_amount_cache: :desc, full_name: :asc }, + 'repository' => { full_name: :asc, available_amount_cache: :desc, watchers_count: :desc }, + 'description' => { description: :asc, available_amount_cache: :desc, watchers_count: :desc, full_name: :asc } }.[](params[:order] || 'balance') end diff --git a/app/controllers/tips_controller.rb b/app/controllers/tips_controller.rb index 4ef657ed..27698d40 100644 --- a/app/controllers/tips_controller.rb +++ b/app/controllers/tips_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class TipsController < ApplicationController before_action { load_project params } before_action { load_user params } @@ -15,12 +17,12 @@ def index else @tips = Tip.with_address.includes(:project) end - @tips = @tips.order(created_at: :desc). - page(params[:page]). - per(params[:per_page] || 30) + @tips = @tips.order(created_at: :desc) + .page(params[:page]) + .per(params[:per_page] || 30) respond_to do |format| format.html - format.csv { render csv: @tips, except: [:updated_at, :commit, :commit_message, :refunded_at, :decided_at], add_methods: [:user_name, :project_name, :decided?, :claimed?, :paid?, :refunded?, :txid] } + format.csv { render csv: @tips, except: %i[updated_at commit commit_message refunded_at decided_at], add_methods: %i[user_name project_name decided? claimed? paid? refunded? txid] } end end end diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb index 22f49a51..fe2ccad5 100644 --- a/app/controllers/users/omniauth_callbacks_controller.rb +++ b/app/controllers/users/omniauth_callbacks_controller.rb @@ -1,37 +1,39 @@ -class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController - before_action :load_omniauth_info, only: :github +# frozen_string_literal: true - def github - @user = User.find_by(nickname: @omniauth_info.nickname) || - User.find_by(email: @omniauth_info.email) +module Users + class OmniauthCallbacksController < Devise::OmniauthCallbacksController + before_action :load_omniauth_info, only: :github - if @user.present? - if @omniauth_info.email.present? && @user.email != @omniauth_info.email - # update email if it has been changed - @user.update email: @omniauth_info.email - end - else # user not found - if @omniauth_info.email.present? + def github + @user = User.find_by(nickname: @omniauth_info.nickname) || + User.find_by(email: @omniauth_info.email) + + if @user.present? + if @omniauth_info.email.present? && @user.email != @omniauth_info.email + # update email if it has been changed + @user.update email: @omniauth_info.email + end + elsif @omniauth_info.email.present? # user not found @user = User.create_with_omniauth!(@omniauth_info) else set_flash_message(:error, :failure, kind: 'GitHub', reason: I18n.t('devise.errors.primary_email')) redirect_to new_user_session_path and return end - end - @user.update(@omniauth_info.slice(:name, :image).as_json) + @user.update(@omniauth_info.slice(:name, :image).as_json) - sign_in_and_redirect @user, event: :authentication - set_flash_message(:notice, :success, kind: 'GitHub') if is_navigational_format? - end + sign_in_and_redirect @user, event: :authentication + set_flash_message(:notice, :success, kind: 'GitHub') if is_navigational_format? + end - private + private - def load_omniauth_info - @omniauth_info = request.env['omniauth.auth']['info'] - unless @omniauth_info - set_flash_message(:error, :failure, kind: 'GitHub', reason: I18n.t('devise.errors.omniauth_info')) - redirect_to new_user_session_path and return + def load_omniauth_info + @omniauth_info = request.env['omniauth.auth']['info'] + unless @omniauth_info + set_flash_message(:error, :failure, kind: 'GitHub', reason: I18n.t('devise.errors.omniauth_info')) + redirect_to new_user_session_path and return + end end end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index adab2893..e871bf9e 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,5 +1,7 @@ +# frozen_string_literal: true + class UsersController < ApplicationController - before_action :authenticate_user!, :load_user, :valid_user!, except: [:login, :index] + before_action :authenticate_user!, :load_user, :valid_user!, except: %i[login index] before_action :redirect_to_pretty_url, only: [:show] def show @@ -50,7 +52,9 @@ def users_params params.require(:user).permit(:bitcoin_address, :password, :password_confirmation, :unsubscribed, :display_name, :denom) end - def load_user ; super params ; end ; + def load_user + super params + end def valid_user! if current_user != @user diff --git a/app/controllers/withdrawals_controller.rb b/app/controllers/withdrawals_controller.rb index 8c9168e5..8125c28a 100644 --- a/app/controllers/withdrawals_controller.rb +++ b/app/controllers/withdrawals_controller.rb @@ -1,5 +1,7 @@ +# frozen_string_literal: true + class WithdrawalsController < ApplicationController def index @sendmanies = Sendmany.order(created_at: :desc).page(params[:page]).per(30) end -end \ No newline at end of file +end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 398ddcee..3f3261ad 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,8 +1,14 @@ +# frozen_string_literal: true + module ApplicationHelper def btc_human(amount, options = {}) amount ||= 0 nobr = options.key?(:nobr) ? options[:nobr] : true - denom = options.key?(:denom) ? options[:denom] : (try(:current_user) ? current_user.denom : 0) + denom = if options.key?(:denom) + options[:denom] + else + (try(:current_user) ? current_user.denom : 0) + end if denom === 0 btc = to_btc(amount) elsif denom === 1 @@ -151,8 +157,8 @@ def rate(currency, satoshies) end def get_rate(currency) - Rails.cache.fetch('###' + currency, expires_in: 1.hours) do - uri = URI('https://api.coindesk.com/v1/bpi/currentprice/' + currency + '.json') + Rails.cache.fetch("####{currency}", expires_in: 1.hours) do + uri = URI("https://api.coindesk.com/v1/bpi/currentprice/#{currency}.json") response = Net::HTTP.get_response(uri) hash = JSON.parse(response.body) hash['bpi'][currency]['rate_float'].to_f diff --git a/app/helpers/deposits_helper.rb b/app/helpers/deposits_helper.rb index 3cf0cb4a..57be68dd 100644 --- a/app/helpers/deposits_helper.rb +++ b/app/helpers/deposits_helper.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + module DepositsHelper end diff --git a/app/helpers/home_helper.rb b/app/helpers/home_helper.rb index 23de56ac..03620959 100644 --- a/app/helpers/home_helper.rb +++ b/app/helpers/home_helper.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + module HomeHelper end diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 1bb9cba0..661ec155 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -1,40 +1,41 @@ -module ProjectsHelper +# frozen_string_literal: true - def shield_btc_amount amount +module ProjectsHelper + def shield_btc_amount(amount) btc_amount = amount / 1e8 "%.#{9 - btc_amount.to_i.to_s.length}f Ƀ" % btc_amount end - def shield_color project + def shield_color(project) last_tip = project.tips.order(:created_at).last if last_tip.nil? || (Time.now - last_tip.created_at > 30.days) 'red' - elsif (Time.now - last_tip.created_at > 7.days) + elsif Time.now - last_tip.created_at > 7.days 'yellow' - elsif (Time.now - last_tip.created_at > 1.day) + elsif Time.now - last_tip.created_at > 1.day 'yellowgreen' else 'green' end end - def pretty_project_path project + def pretty_project_path(project) "/#{project.host}/#{project.full_name}" end - def pretty_project_edit_path project + def pretty_project_edit_path(project) "#{pretty_project_path project}/edit" end - def pretty_project_decide_tip_amounts_path project + def pretty_project_decide_tip_amounts_path(project) "#{pretty_project_path project}/decide_tip_amounts" end - def pretty_project_url project - root_url.gsub(/\/$/,'') + pretty_project_path(project) + def pretty_project_url(project) + root_url.gsub(%r{/$}, '') + pretty_project_path(project) end - def shield_url project + def shield_url(project) project_url project, format: :svg end diff --git a/app/helpers/sessions_helper.rb b/app/helpers/sessions_helper.rb index 309f8b2e..97aeb4cf 100644 --- a/app/helpers/sessions_helper.rb +++ b/app/helpers/sessions_helper.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + module SessionsHelper end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 2310a240..4dc909ed 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + module UsersHelper end diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index 08719dec..74fc2f68 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -1,16 +1,18 @@ +# frozen_string_literal: true + class UserMailer < ActionMailer::Base add_template_helper(ApplicationHelper) - def new_tip user, tip + def new_tip(user, tip) @user = user @tip = tip - mail to: user.email, subject: "You received a tip for your commit" + mail to: user.email, subject: 'You received a tip for your commit' end - def check_bitcoin_address user + def check_bitcoin_address(user) @user = user - mail to: user.email, subject: "Check your Bitcoin address" + mail to: user.email, subject: 'Check your Bitcoin address' end end diff --git a/app/models/ability.rb b/app/models/ability.rb index 63f6fd78..f0a1d1e6 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -1,9 +1,11 @@ +# frozen_string_literal: true + class Ability include CanCan::Ability def initialize(user) - if user and user.nickname.present? - can [:update, :decide_tip_amounts], Project, collaborators: {login: user.nickname} - end + return unless user && user.nickname.present? + + can %i[update decide_tip_amounts], Project, collaborators: { login: user.nickname } end end diff --git a/app/models/application_record.rb b/app/models/application_record.rb index 863c094d..71fbba5b 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ApplicationRecord < ActiveRecord::Base - self.abstract_class = true + self.abstract_class = true end diff --git a/app/models/collaborator.rb b/app/models/collaborator.rb index bb929bca..6232e44e 100644 --- a/app/models/collaborator.rb +++ b/app/models/collaborator.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Collaborator < ApplicationRecord belongs_to :project end diff --git a/app/models/deposit.rb b/app/models/deposit.rb index 125b306b..32906daf 100644 --- a/app/models/deposit.rb +++ b/app/models/deposit.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Deposit < ApplicationRecord belongs_to :project @@ -19,11 +21,10 @@ def available_amount end before_create do - self.fee_size = CONFIG["our_fee"] + self.fee_size = CONFIG['our_fee'] end def project_name project.full_name end - end diff --git a/app/models/project.rb b/app/models/project.rb index b0ba3a47..e7380418 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Project < ApplicationRecord acts_as_paranoid @@ -11,11 +13,11 @@ class Project < ApplicationRecord accepts_nested_attributes_for :tipping_policies_text validates :full_name, :github_id, uniqueness: true, presence: true - validates :host, inclusion: [ "github", "bitbucket" ], presence: true + validates :host, inclusion: %w[github bitbucket], presence: true search_syntax do search_by :text do |scope, phrases| - columns = [:full_name, :host, :description, :language] + columns = %i[full_name host description language] scope.where_like(columns => phrases) end end @@ -24,17 +26,21 @@ class Project < ApplicationRecord # before_save :check_tips_to_pay_against_avaiable_amount - def update_repository_info repo + def update_repository_info(repo) self.github_id = repo.id self.name = repo.name self.full_name = repo.full_name - self.source_full_name = repo.source.full_name rescue '' + self.source_full_name = begin + repo.source.full_name + rescue StandardError + '' + end self.description = repo.description self.watchers_count = repo.watchers_count self.language = repo.language self.avatar_url = repo.organization.rels[:avatar].href if repo.organization.present? - self.save! + save! end def update_collaborators(repo_collaborators) @@ -44,24 +50,18 @@ def update_collaborators(repo_collaborators) existing_logins = existing_collaborators.map(&:login) existing_collaborators.each do |existing_collaborator| - unless repo_logins.include?(existing_collaborator.login) - existing_collaborator.mark_for_destruction - end + existing_collaborator.mark_for_destruction unless repo_logins.include?(existing_collaborator.login) end repo_collaborators.each do |repo_collaborator| - unless existing_logins.include?(repo_collaborator) - collaborators.build(login: repo_collaborator) - end + collaborators.build(login: repo_collaborator) unless existing_logins.include?(repo_collaborator) end save! end def repository_client - if host.present? - host.classify.constantize.new - end + host.classify.constantize.new if host.present? end def github_url @@ -90,15 +90,15 @@ def branches def new_commits begin - commits = Timeout::timeout(90) do + commits = Timeout.timeout(90) do raw_commits. # Filter merge request - select{|c| !(c.commit.message =~ /^(Merge\s|auto\smerge)/)}. + reject { |c| (c.commit.message =~ /^(Merge\s|auto\smerge)/) }. # Filter fake emails - select{|c| c.commit.author.email =~ Devise::email_regexp }. + select { |c| c.commit.author.email =~ Devise.email_regexp }. # Filter commited after t4c project creation - select{|c| c.commit.committer.date > self.deposits.first.created_at }. - to_a. + select { |c| c.commit.committer.date > deposits.first.created_at } + .to_a. # tip for older commits first reverse end @@ -121,23 +121,23 @@ def tip_commits end end - def tip_for commit - if (next_tip_amount > 0) && !Tip.exists?(commit: commit.sha) + def tip_for(commit) + if next_tip_amount.positive? && !Tip.exists?(commit: commit.sha) return unless (user = User.find_by_commit commit) user.update(nickname: commit.author.login) if commit.author.try(:login) - if hold_tips - amount = nil - else - amount = next_tip_amount - end + amount = if hold_tips + nil + else + next_tip_amount + end # create tip - tip = self.tips.create({ user: user, - amount: amount, - commit: commit.sha, - commit_message: commit.commit.message }) + tip = tips.create({ user: user, + amount: amount, + commit: commit.sha, + commit_message: commit.commit.message }) # tip.notify_user @@ -146,7 +146,7 @@ def tip_for commit end def donated - self.deposits.confirmed.map(&:available_amount).sum + deposits.confirmed.map(&:available_amount).sum end def available_amount @@ -154,20 +154,20 @@ def available_amount end def unconfirmed_amount - self.deposits.unconfirmed.where('created_at > ?', 7.days.ago).map(&:available_amount).sum + deposits.unconfirmed.where('created_at > ?', 7.days.ago).map(&:available_amount).sum end def tips_paid_amount - self.tips.decided.non_refunded.sum(:amount) + tips.decided.non_refunded.sum(:amount) end def tips_paid_unclaimed_amount - self.tips.decided.non_refunded.unclaimed.sum(:amount) + tips.decided.non_refunded.unclaimed.sum(:amount) end def next_tip_amount - next_tip_amount = (CONFIG["tip"]*available_amount).ceil - next_tip_amount = [next_tip_amount, CONFIG["min_tip"]].max if CONFIG["min_tip"] + next_tip_amount = (CONFIG['tip'] * available_amount).ceil + next_tip_amount = [next_tip_amount, CONFIG['min_tip']].max if CONFIG['min_tip'] next_tip_amount = [next_tip_amount, available_amount].min end @@ -176,29 +176,25 @@ def update_cache end def self.update_cache - find_each do |project| - project.update_cache - end + find_each(&:update_cache) end def update_info - begin - update_repository_info(repository_info) - update_collaborators(collaborators_info) - rescue Octokit::BadGateway, Octokit::NotFound, Octokit::InternalServerError, Octokit::Forbidden, - Errno::ETIMEDOUT, Net::ReadTimeout, Faraday::Error::ConnectionFailed => e - Rails.logger.info "Project ##{id}: #{e.class} happened" - rescue StandardError => e - Airbrake.notify(e) - end + update_repository_info(repository_info) + update_collaborators(collaborators_info) + rescue Octokit::BadGateway, Octokit::NotFound, Octokit::InternalServerError, Octokit::Forbidden, + Errno::ETIMEDOUT, Net::ReadTimeout, Faraday::Error::ConnectionFailed => e + Rails.logger.info "Project ##{id}: #{e.class} happened" + rescue StandardError => e + Airbrake.notify(e) end def amount_to_pay - self.tips.to_pay.sum(:amount) + tips.to_pay.sum(:amount) end def has_undecided_tips? - self.tips.undecided.any? + tips.undecided.any? end def commit_url(commit) @@ -206,25 +202,25 @@ def commit_url(commit) end def check_tips_to_pay_against_avaiable_amount - if available_amount < 0 + if available_amount.negative? raise "Not enough funds to pay the pending tips on #{inspect} (#{available_amount} < 0)" end end - def self.find_or_create_by_url project_url - project_name = project_url. - gsub(/https?\:\/\/github.com\//, ''). - gsub(/\#.+$/, ''). - gsub(' ', '') + def self.find_or_create_by_url(project_url) + project_name = project_url + .gsub(%r{https?://github.com/}, '') + .gsub(/\#.+$/, '') + .gsub(' ', '') Github.new.find_or_create_project project_name end - def self.find_by_url project_url - project_name = project_url. - gsub(/https?\:\/\/github.com\//, ''). - gsub(/\#.+$/, ''). - gsub(' ', '') + def self.find_by_url(project_url) + project_name = project_url + .gsub(%r{https?://github.com/}, '') + .gsub(/\#.+$/, '') + .gsub(' ', '') Github.new.find_project project_name end @@ -232,6 +228,7 @@ def self.find_by_url project_url def generate_bitcoin_address wallet = Wallet.order(created_at: :asc).last return unless wallet + self.wallet = wallet self.bitcoin_address = wallet.generate_address save diff --git a/app/models/sendmany.rb b/app/models/sendmany.rb index bda180b4..67a020e5 100644 --- a/app/models/sendmany.rb +++ b/app/models/sendmany.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Sendmany < ApplicationRecord has_many :tips @@ -10,13 +12,12 @@ def send_transaction update_attribute :is_error, true # it's a lock to prevent duplicates - - bitcoind = BitcoinRPC.new(CONFIG["bitcoind"]["rpc_connection_string"],false) + bitcoind = BitcoinRPC.new(CONFIG['bitcoind']['rpc_connection_string'], false) begin txid = bitcoind.sendmany( - CONFIG["bitcoind"]["account"], - JSON.parse(data).map { |address, amount| {address => amount/1e8} }.inject(&:merge) + CONFIG['bitcoind']['account'], + JSON.parse(data).map { |address, amount| { address => amount / 1e8 } }.inject(&:merge) ) if txid.present? update_attribute :is_error, false @@ -25,11 +26,10 @@ def send_transaction rescue StandardError => e update_attribute :result, e.inspect end - end def to_csv - JSON.parse(self.data).map do |address, value| + JSON.parse(data).map do |address, value| [address, value / 1e8].join(',') end.join("\n") end diff --git a/app/models/tip.rb b/app/models/tip.rb index 120859c6..f80c234b 100644 --- a/app/models/tip.rb +++ b/app/models/tip.rb @@ -1,76 +1,88 @@ +# frozen_string_literal: true + class Tip < ApplicationRecord belongs_to :user belongs_to :sendmany belongs_to :project, inverse_of: :tips AVAILABLE_AMOUNTS = [ - ['undecided', ""], + ['undecided', ''], ['free', 0], ['tiny', 0.1], ['small', 0.5], ['normal', 1], ['big', 2], ['huge', 5] - ] + ].freeze validates :amount, numericality: { greater_or_equal_than: 0, allow_nil: true } - scope :not_sent, -> { where(sendmany_id: nil) } + scope :not_sent, -> { where(sendmany_id: nil) } + def not_sent? sendmany_id.nil? end - scope :unpaid, -> { non_refunded.not_sent } + scope :unpaid, -> { non_refunded.not_sent } + def unpaid? non_refunded? and not_sent? end - scope :to_pay, -> { unpaid.decided.not_free.with_address } + scope :to_pay, -> { unpaid.decided.not_free.with_address } + def to_pay? unpaid? and decided? and !free? and with_address? end scope :free, -> { where('amount = 0') } scope :not_free, -> { where('amount > 0') } + def free? - amount == 0 + amount.zero? end - scope :paid, -> { where.not(sendmany_id: nil) } + scope :paid, -> { where.not(sendmany_id: nil) } + def paid? !!sendmany_id end - scope :refunded, -> { where.not(refunded_at: nil) } + scope :refunded, -> { where.not(refunded_at: nil) } + def refunded? !!refunded_at end - scope :non_refunded, -> { where(refunded_at: nil) } + scope :non_refunded, -> { where(refunded_at: nil) } + def non_refunded? !refunded? end - scope :unclaimed, -> { joins(:user). - unpaid. - where('users.bitcoin_address' => ['', nil]) } + scope :unclaimed, -> { joins(:user).unpaid.where('users.bitcoin_address' => ['', nil]) } + def claimed? paid? || user.bitcoin_address.present? end + def unclaimed? !claimed? end - scope :with_address, -> { joins(:user).where.not('users.bitcoin_address' => ['', nil]) } + scope :with_address, -> { joins(:user).where.not('users.bitcoin_address' => ['', nil]) } + def with_address? user.bitcoin_address.present? end scope :decided, -> { where.not(amount: nil) } scope :undecided, -> { where(amount: nil) } + def decided? !!amount end + def undecided? !decided? end @@ -80,18 +92,18 @@ def undecided? after_save :notify_user_if_just_decided def self.refund_unclaimed - unclaimed.non_refunded. - where.not(decided_at: nil). - where('tips.decided_at < ?', 1.month.ago). - find_each do |tip| + unclaimed.non_refunded + .where.not(decided_at: nil) + .where('tips.decided_at < ?', 1.month.ago) + .find_each do |tip| tip.touch :refunded_at end end def self.auto_decide_older_tips - undecided.non_refunded. - where('tips.created_at < ?', 1.month.ago). - find_each do |tip| + undecided.non_refunded + .where('tips.created_at < ?', 1.month.ago) + .find_each do |tip| tip.amount_percentage = 1 tip.save end @@ -106,16 +118,18 @@ def amount_percentage end def amount_percentage=(percentage) - if undecided? and percentage.present? and AVAILABLE_AMOUNTS.map(&:last).compact.map(&:to_s).include?(percentage.to_s) - self.amount = (project.available_amount * (percentage.to_f / 100)).ceil - end + return if decided? + return if percentage.blank? + return unless AVAILABLE_AMOUNTS.map(&:last).compact.map(&:to_s).include?(percentage.to_s) + + self.amount = (project.available_amount * (percentage.to_f / 100)).ceil end def notify_user - if amount && amount > 0 && user.bitcoin_address.blank? && - !user.unsubscribed && !project.disable_notifications && - user.balance > 21000000*1e8 - if user.notified_at.nil? or user.notified_at < 30.days.ago + if amount&.positive? && user.bitcoin_address.blank? && + !user.unsubscribed && !project.disable_notifications && + user.balance > 21_000_000 * 1e8 + if user.notified_at.nil? || (user.notified_at < 30.days.ago) begin UserMailer.new_tip(user, self).deliver user.touch :notified_at @@ -127,7 +141,7 @@ def notify_user end def notify_user_if_just_decided - notify_user if amount_was.nil? and amount + notify_user if amount_was.nil? && amount end def check_amount_against_project @@ -155,5 +169,4 @@ def user_name def txid try(:sendmany).try(:txid) end - end diff --git a/app/models/tipping_policies_text.rb b/app/models/tipping_policies_text.rb index 5e6a3a55..96188039 100644 --- a/app/models/tipping_policies_text.rb +++ b/app/models/tipping_policies_text.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class TippingPoliciesText < ApplicationRecord belongs_to :project belongs_to :user diff --git a/app/models/user.rb b/app/models/user.rb index 6dbbe3c4..30cdf25e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,10 +1,12 @@ +# frozen_string_literal: true + class User < ApplicationRecord # Include default devise modules. Others available are: # :lockable, :timeoutable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :confirmable - devise :omniauthable, :omniauth_providers => [:github] + devise :omniauthable, omniauth_providers: [:github] # Validations validates :bitcoin_address, bitcoin_address: true @@ -29,19 +31,15 @@ def denom end def gravatar_bitcoin - begin - gravatar.get_value :currency, :bitcoin - rescue URI::InvalidURIError, NoMethodError => e - nil - end + gravatar.get_value :currency, :bitcoin + rescue URI::InvalidURIError, NoMethodError => e + nil end def gravatar_display_name - begin - gravatar.get_value :displayName - rescue URI::InvalidURIError, NoMethodError => e - nil - end + gravatar.get_value :displayName + rescue URI::InvalidURIError, NoMethodError => e + nil end def display_name @@ -79,13 +77,13 @@ def self.find_by_commit(commit) end def ready_for_withdrawal? - self.bitcoin_address.present? && self.balance >= CONFIG["min_payout"] + bitcoin_address.present? && balance >= CONFIG['min_payout'] end private def gravatar - @gravatar ||= Gravatar::new(email) + @gravatar ||= Gravatar.new(email) end def set_login_token! diff --git a/app/models/wallet.rb b/app/models/wallet.rb index 20d6de30..920f70b3 100644 --- a/app/models/wallet.rb +++ b/app/models/wallet.rb @@ -1,5 +1,6 @@ -class Wallet < ApplicationRecord +# frozen_string_literal: true +class Wallet < ApplicationRecord validates :name, :xpub, presence: true def generate_address diff --git a/app/services/bitbucket.rb b/app/services/bitbucket.rb index 207e050a..6a7ed534 100644 --- a/app/services/bitbucket.rb +++ b/app/services/bitbucket.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'sawyer' class Bitbucket @@ -11,34 +13,39 @@ class Bitbucket attr_reader :agent def initialize - @agent = Sawyer::Agent.new("https://bitbucket.org") + @agent = Sawyer::Agent.new('https://bitbucket.org') end - def repository_info repository + def repository_info(repository) data = request :get, repository_path(repository.full_name) Repository.new( data.slug, data.name, repository.full_name, - (data.fork_of.owner + "/" + data.fork_of.slug rescue ''), + begin + "#{data.fork_of.owner}/#{data.fork_of.slug}" + rescue StandardError + '' + end, data.description, data.followers_count, - data.language) + data.language + ) end - def collaborators_info project + def collaborators_info(_project) # TODO [] end - def branches project + def branches(_project) # TODO ['master'] end - def commits repository - # todo use repository.branch + def commits(repository) + # TODO: use repository.branch data = request :get, changesets_path(repository.full_name) data.changesets.map do |cs| @@ -51,32 +58,33 @@ def commits repository end end - def repository_url project + def repository_url(project) "https://bitbucket.org/#{project.full_name}" end - def source_repository_url project + def source_repository_url(project) "https://bitbucket.org/#{project.source_full_name}" end - def commit_url project, commit + def commit_url(project, commit) "https://bitbucket.org/#{project.full_name}/commits/#{commit}" end protected - def repository_path full_name + + def repository_path(full_name) "#{base_path}#{full_name}" end - def changesets_path full_name + def changesets_path(full_name) "#{base_path}#{full_name}/changesets?limit=15" end def base_path - "/api/1.0/repositories/" + '/api/1.0/repositories/' end - def request method, path + def request(method, path) agent.call(method, path).data end end diff --git a/app/services/github.rb b/app/services/github.rb index 8d8954ba..073f4c22 100644 --- a/app/services/github.rb +++ b/app/services/github.rb @@ -1,22 +1,24 @@ +# frozen_string_literal: true + class Github def initialize options = { client_id: CONFIG['github']['key'], client_secret: CONFIG['github']['secret'] } if CONFIG['github']['auto_paginate'] - options.merge! :auto_paginate => true + options.merge! auto_paginate: true else - options.merge! :per_page => 100 + options.merge! per_page: 100 end @client = Octokit::Client.new(options) end attr_reader :client - def commits project - if project.branch.blank? - commits = client.commits project.full_name - else - commits = client.commits project.full_name, sha: project.branch - end + def commits(project) + commits = if project.branch.blank? + client.commits project.full_name + else + client.commits project.full_name, sha: project.branch + end last_response = client.last_response pages = (CONFIG['github']['project_pages'][project.full_name] || CONFIG['github']['pages'] || 1).to_i @@ -30,10 +32,11 @@ def commits project commits end - def repository_info project - if project.is_a?(String) + def repository_info(project) + case project + when String client.repo project - elsif project.is_a?(Project) + when Project if project.github_id.present? client.get "/repositories/#{project.github_id}" else @@ -44,33 +47,39 @@ def repository_info project end end - def find_or_create_project project_name + def find_or_create_project(project_name) if project = find_project(project_name) project - elsif project_name =~ /\w+\/\w+/ + elsif project_name =~ %r{\w+/\w+} begin repo = repository_info project_name - project = Project.find_or_create_by host: "github", full_name: repo.full_name + project = Project.find_or_create_by host: 'github', full_name: repo.full_name project.update_repository_info repo project rescue Octokit::NotFound nil end - else - nil end end - def find_project project_name - return Project.find_by(host: "github", full_name: project_name) + def find_project(project_name) + Project.find_by(host: 'github', full_name: project_name) end - def collaborators_info project - (client.get("/repos/#{project.full_name}/collaborators").map(&:login) rescue [project.full_name.split('/').first]) + - (client.get("/orgs/#{project.full_name.split('/').first}/members").map(&:login) rescue []) + def collaborators_info(project) + begin + client.get("/repos/#{project.full_name}/collaborators").map(&:login) + rescue StandardError + [project.full_name.split('/').first] + end + + begin + client.get("/orgs/#{project.full_name.split('/').first}/members").map(&:login) + rescue StandardError + [] + end end - def branches project + def branches(project) branches = client.get("/repos/#{project.full_name}/branches") last_response = client.last_response while last_response && last_response.rels[:next] @@ -80,15 +89,15 @@ def branches project branches.map(&:name) end - def repository_url project + def repository_url(project) "https://github.com/#{project.full_name}" end - def source_repository_url project + def source_repository_url(project) "https://github.com/#{project.source_full_name}" end - def commit_url project, commit + def commit_url(project, commit) "https://github.com/#{project.full_name}/commit/#{commit}" end end diff --git a/bin/airbrake b/bin/airbrake deleted file mode 100755 index b29b0771..00000000 --- a/bin/airbrake +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by Bundler. -# -# The application 'airbrake' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -require 'rubygems' -require 'bundler/setup' - -load Gem.bin_path('airbrake', 'airbrake') diff --git a/bin/bundle b/bin/bundle deleted file mode 100755 index 66e9889e..00000000 --- a/bin/bundle +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) -load Gem.bin_path('bundler', 'bundle') diff --git a/bin/bundler b/bin/bundler deleted file mode 100755 index 72c62ec0..00000000 --- a/bin/bundler +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by Bundler. -# -# The application 'bundler' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -require 'rubygems' -require 'bundler/setup' - -load Gem.bin_path('bundler', 'bundler') diff --git a/bin/cap b/bin/cap deleted file mode 100755 index 30352d4d..00000000 --- a/bin/cap +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by Bundler. -# -# The application 'cap' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -require 'rubygems' -require 'bundler/setup' - -load Gem.bin_path('capistrano', 'cap') diff --git a/bin/cdiff b/bin/cdiff deleted file mode 100755 index 066279d2..00000000 --- a/bin/cdiff +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by Bundler. -# -# The application 'cdiff' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -require 'rubygems' -require 'bundler/setup' - -load Gem.bin_path('term-ansicolor', 'cdiff') diff --git a/bin/colortab b/bin/colortab deleted file mode 100755 index 195df76f..00000000 --- a/bin/colortab +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by Bundler. -# -# The application 'colortab' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -require 'rubygems' -require 'bundler/setup' - -load Gem.bin_path('term-ansicolor', 'colortab') diff --git a/bin/decolor b/bin/decolor deleted file mode 100755 index 214e8d18..00000000 --- a/bin/decolor +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by Bundler. -# -# The application 'decolor' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -require 'rubygems' -require 'bundler/setup' - -load Gem.bin_path('term-ansicolor', 'decolor') diff --git a/bin/erubis b/bin/erubis deleted file mode 100755 index 2c7348b8..00000000 --- a/bin/erubis +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by Bundler. -# -# The application 'erubis' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -require 'rubygems' -require 'bundler/setup' - -load Gem.bin_path('erubis', 'erubis') diff --git a/bin/haml b/bin/haml deleted file mode 100755 index 3c6d074f..00000000 --- a/bin/haml +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by Bundler. -# -# The application 'haml' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -require 'rubygems' -require 'bundler/setup' - -load Gem.bin_path('haml', 'haml') diff --git a/bin/lessc b/bin/lessc deleted file mode 100755 index 833b943e..00000000 --- a/bin/lessc +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by Bundler. -# -# The application 'lessc' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -require 'rubygems' -require 'bundler/setup' - -load Gem.bin_path('less', 'lessc') diff --git a/bin/rackup b/bin/rackup deleted file mode 100755 index 8cc9953e..00000000 --- a/bin/rackup +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by Bundler. -# -# The application 'rackup' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -require 'rubygems' -require 'bundler/setup' - -load Gem.bin_path('rack', 'rackup') diff --git a/bin/rails b/bin/rails deleted file mode 100755 index 728cd85a..00000000 --- a/bin/rails +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env ruby -APP_PATH = File.expand_path('../../config/application', __FILE__) -require_relative '../config/boot' -require 'rails/commands' diff --git a/bin/rake b/bin/rake deleted file mode 100755 index 17240489..00000000 --- a/bin/rake +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env ruby -require_relative '../config/boot' -require 'rake' -Rake.application.run diff --git a/bin/rdoc b/bin/rdoc deleted file mode 100755 index f57260f3..00000000 --- a/bin/rdoc +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by Bundler. -# -# The application 'rdoc' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -require 'rubygems' -require 'bundler/setup' - -load Gem.bin_path('rdoc', 'rdoc') diff --git a/bin/ri b/bin/ri deleted file mode 100755 index 90f2517d..00000000 --- a/bin/ri +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by Bundler. -# -# The application 'ri' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -require 'rubygems' -require 'bundler/setup' - -load Gem.bin_path('rdoc', 'ri') diff --git a/bin/sass b/bin/sass deleted file mode 100755 index d65bb10a..00000000 --- a/bin/sass +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by Bundler. -# -# The application 'sass' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -require 'rubygems' -require 'bundler/setup' - -load Gem.bin_path('sass', 'sass') diff --git a/bin/sass-convert b/bin/sass-convert deleted file mode 100755 index ddde743f..00000000 --- a/bin/sass-convert +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by Bundler. -# -# The application 'sass-convert' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -require 'rubygems' -require 'bundler/setup' - -load Gem.bin_path('sass', 'sass-convert') diff --git a/bin/scss b/bin/scss deleted file mode 100755 index 9f5e435d..00000000 --- a/bin/scss +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by Bundler. -# -# The application 'scss' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -require 'rubygems' -require 'bundler/setup' - -load Gem.bin_path('sass', 'scss') diff --git a/bin/sdoc b/bin/sdoc deleted file mode 100755 index 9da297e6..00000000 --- a/bin/sdoc +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by Bundler. -# -# The application 'sdoc' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -require 'rubygems' -require 'bundler/setup' - -load Gem.bin_path('sdoc', 'sdoc') diff --git a/bin/sdoc-merge b/bin/sdoc-merge deleted file mode 100755 index e29a7d95..00000000 --- a/bin/sdoc-merge +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by Bundler. -# -# The application 'sdoc-merge' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -require 'rubygems' -require 'bundler/setup' - -load Gem.bin_path('sdoc', 'sdoc-merge') diff --git a/bin/slimrb b/bin/slimrb deleted file mode 100755 index d9152e29..00000000 --- a/bin/slimrb +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by Bundler. -# -# The application 'slimrb' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -require 'rubygems' -require 'bundler/setup' - -load Gem.bin_path('slim', 'slimrb') diff --git a/bin/sprockets b/bin/sprockets deleted file mode 100755 index 09a1ad18..00000000 --- a/bin/sprockets +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by Bundler. -# -# The application 'sprockets' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -require 'rubygems' -require 'bundler/setup' - -load Gem.bin_path('sprockets', 'sprockets') diff --git a/bin/term_display b/bin/term_display deleted file mode 100755 index d65c316b..00000000 --- a/bin/term_display +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by Bundler. -# -# The application 'term_display' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -require 'rubygems' -require 'bundler/setup' - -load Gem.bin_path('term-ansicolor', 'term_display') diff --git a/bin/term_mandel b/bin/term_mandel deleted file mode 100755 index c7dd35e6..00000000 --- a/bin/term_mandel +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by Bundler. -# -# The application 'term_mandel' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -require 'rubygems' -require 'bundler/setup' - -load Gem.bin_path('term-ansicolor', 'term_mandel') diff --git a/bin/thor b/bin/thor deleted file mode 100755 index 8421e001..00000000 --- a/bin/thor +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by Bundler. -# -# The application 'thor' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -require 'rubygems' -require 'bundler/setup' - -load Gem.bin_path('thor', 'thor') diff --git a/bin/tilt b/bin/tilt deleted file mode 100755 index 09fe73eb..00000000 --- a/bin/tilt +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by Bundler. -# -# The application 'tilt' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -require 'rubygems' -require 'bundler/setup' - -load Gem.bin_path('tilt', 'tilt') diff --git a/bin/tt b/bin/tt deleted file mode 100755 index 6e3920b8..00000000 --- a/bin/tt +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by Bundler. -# -# The application 'tt' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -require 'rubygems' -require 'bundler/setup' - -load Gem.bin_path('treetop', 'tt') diff --git a/config.ru b/config.ru index 5bc2a619..667e328d 100644 --- a/config.ru +++ b/config.ru @@ -1,4 +1,6 @@ +# frozen_string_literal: true + # This file is used by Rack-based servers to start the application. -require ::File.expand_path('../config/environment', __FILE__) +require ::File.expand_path('config/environment', __dir__) run Rails.application diff --git a/config/application.rb b/config/application.rb index d700c1f9..e2412382 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,4 +1,6 @@ -require File.expand_path('../boot', __FILE__) +# frozen_string_literal: true + +require File.expand_path('boot', __dir__) require 'rails/all' diff --git a/config/boot.rb b/config/boot.rb index 35967366..a7f5578c 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,4 +1,6 @@ +# frozen_string_literal: true + # Set up gems listed in the Gemfile. -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) -require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) +require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) diff --git a/config/deploy.rb b/config/deploy.rb index bfc89d0d..275e612a 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + set :application, 't4c' set :repo_url, 'git@github.com:tip4commit/tip4commit.git' diff --git a/config/deploy/production.rb b/config/deploy/production.rb index 06838c2e..13bcd143 100644 --- a/config/deploy/production.rb +++ b/config/deploy/production.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + set :stage, :production # Simple Role Syntax @@ -5,9 +7,9 @@ # Supports bulk-adding hosts to roles, the primary # server in each group is considered to be the first # unless any hosts have the primary property set. -role :app, %w{apps@50.116.2.58} -role :web, %w{apps@50.116.2.58} -role :db, %w{apps@50.116.2.58} +role :app, %w[apps@50.116.2.58] +role :web, %w[apps@50.116.2.58] +role :db, %w[apps@50.116.2.58] set :rails_env, 'production' set :migration_role, 'db' @@ -18,7 +20,7 @@ # definition into the server list. The second argument # something that quacks like a has can be used to set # extended properties on the server. -#server 'example.com', user: 'deploy', roles: %w{web app}, my_property: :my_value +# server 'example.com', user: 'deploy', roles: %w{web app}, my_property: :my_value # you can set custom ssh options # it's possible to pass any option but you need to keep in mind that net/ssh understand limited list of options diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb index 0966af3f..10193a00 100644 --- a/config/deploy/staging.rb +++ b/config/deploy/staging.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + set :stage, :staging # Simple Role Syntax @@ -5,9 +7,9 @@ # Supports bulk-adding hosts to roles, the primary # server in each group is considered to be the first # unless any hosts have the primary property set. -role :app, %w{deploy@example.com} -role :web, %w{deploy@example.com} -role :db, %w{deploy@example.com} +role :app, %w[deploy@example.com] +role :web, %w[deploy@example.com] +role :db, %w[deploy@example.com] # Extended Server Syntax # ====================== @@ -15,7 +17,7 @@ # definition into the server list. The second argument # something that quacks like a has can be used to set # extended properties on the server. -server 'example.com', user: 'deploy', roles: %w{web app}, my_property: :my_value +server 'example.com', user: 'deploy', roles: %w[web app], my_property: :my_value # you can set custom ssh options # it's possible to pass any option but you need to keep in mind that net/ssh understand limited list of options diff --git a/config/environment.rb b/config/environment.rb index 8fc35cc4..52ee9669 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,5 +1,7 @@ +# frozen_string_literal: true + # Load the Rails application. -require File.expand_path('../application', __FILE__) +require File.expand_path('application', __dir__) # Initialize the Rails application. T4c::Application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index 42389197..f73b9c9c 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + T4c::Application.configure do # Settings specified here will take precedence over those in config/application.rb. @@ -16,7 +18,7 @@ # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false - config.action_mailer.default_url_options = { :host => "localhost:3000" } + config.action_mailer.default_url_options = { host: 'localhost:3000' } # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log diff --git a/config/environments/production.rb b/config/environments/production.rb index 1d827f7b..d2103f50 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + T4c::Application.configure do # Settings specified here will take precedence over those in config/application.rb. @@ -68,8 +70,8 @@ config.action_mailer.perform_deliveries = true config.action_mailer.raise_delivery_errors = true - config.action_mailer.default_url_options = { :host => domain, :protocol => 'https' } - config.action_mailer.default_options = {from: 'no-reply@' + domain } + config.action_mailer.default_url_options = { host: domain, protocol: 'https' } + config.action_mailer.default_options = { from: "no-reply@#{domain}" } # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation can not be found). diff --git a/config/environments/test.rb b/config/environments/test.rb index a24b44ba..569bd0cf 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + T4c::Application.configure do # Settings specified here will take precedence over those in config/application.rb. @@ -13,8 +15,8 @@ config.eager_load = false # Configure static asset server for tests with Cache-Control for performance. - config.serve_static_files = true - config.static_cache_control = "public, max-age=3600" + config.serve_static_files = true + config.static_cache_control = 'public, max-age=3600' # Show full error reports and disable caching. config.consider_all_requests_local = true @@ -31,7 +33,7 @@ # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test config.action_mailer.raise_delivery_errors = false - config.action_mailer.default_url_options = { :host => 'tip4commit.com', :protocol => 'https' } + config.action_mailer.default_url_options = { host: 'tip4commit.com', protocol: 'https' } config.action_mailer.default_options = { from: 'no-reply@tip4commit.com' } # Print deprecation notices to the stderr. diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb index 59385cdf..d0f0d3b5 100644 --- a/config/initializers/backtrace_silencers.rb +++ b/config/initializers/backtrace_silencers.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. diff --git a/config/initializers/blacklist.rb b/config/initializers/blacklist.rb index c1b09c04..9bd4146b 100644 --- a/config/initializers/blacklist.rb +++ b/config/initializers/blacklist.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + # Load the blacklist. -BLACKLIST ||= Blacklist.new(YAML.load_file("config/blacklist.yml")) +BLACKLIST ||= Blacklist.new(YAML.load_file('config/blacklist.yml')) diff --git a/config/initializers/demoji.rb b/config/initializers/demoji.rb index f2258a95..b1ce2207 100644 --- a/config/initializers/demoji.rb +++ b/config/initializers/demoji.rb @@ -1 +1,3 @@ -ActiveRecord::Base.send :include, Demoji \ No newline at end of file +# frozen_string_literal: true + +ActiveRecord::Base.include Demoji diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 2501563d..82fa1b11 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Use this hook to configure devise mailer, warden hooks and so forth. # Many of these configuration options can be set straight in your model. Devise.setup do |config| @@ -10,7 +12,7 @@ # Configure the e-mail address which will be shown in Devise::Mailer, # note that it will be overwritten if you use your own mailer class # with default "from" parameter. - config.mailer_sender = 'no-reply@' + CONFIG['smtp_settings']['domain'] + config.mailer_sender = "no-reply@#{CONFIG['smtp_settings']['domain']}" # Configure the class responsible to send e-mails. # config.mailer = 'Devise::Mailer' @@ -41,12 +43,12 @@ # Configure which authentication keys should be case-insensitive. # These keys will be downcased upon creating or modifying a user and when used # to authenticate or find a user. Default is :email. - config.case_insensitive_keys = [ :email ] + config.case_insensitive_keys = [:email] # Configure which authentication keys should have whitespace stripped. # These keys will have whitespace before and after removed upon creating or # modifying a user and when used to authenticate or find a user. Default is :email. - config.strip_whitespace_keys = [ :email ] + config.strip_whitespace_keys = [:email] # Tell if authentication through request.params is enabled. True by default. # It can be set to an array that will enable params authentication only for the diff --git a/config/initializers/errbit.rb b/config/initializers/errbit.rb index d6e0dbdf..d1ef6af4 100644 --- a/config/initializers/errbit.rb +++ b/config/initializers/errbit.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + if CONFIG['airbrake'] Airbrake.configure do |config| config.api_key = CONFIG['airbrake']['api_key'] @@ -5,7 +7,7 @@ config.port = 80 config.secure = config.port == 443 - config.ignore << "ArgumentError" - config.ignore << "ActionController::UnknownFormat" + config.ignore << 'ArgumentError' + config.ignore << 'ActionController::UnknownFormat' end -end \ No newline at end of file +end diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 4a994e1e..7a4f47b4 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Configure sensitive parameters which will be filtered from the log file. diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index ac033bf9..aa7435fb 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Add new inflection rules using the following format. Inflections diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb index d39c83c4..4d8c55ae 100644 --- a/config/initializers/mime_types.rb +++ b/config/initializers/mime_types.rb @@ -1,6 +1,8 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register_alias "text/html", :iphone -Mime::Type.register "image/svg+xml", :svg \ No newline at end of file +Mime::Type.register 'image/svg+xml', :svg diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb index 0e3db2c8..5ac05735 100644 --- a/config/initializers/secret_token.rb +++ b/config/initializers/secret_token.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Your secret key is used for verifying the integrity of signed cookies. diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index 4fd9a3e7..8feed4ef 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. T4c::Application.config.session_store :cookie_store, key: '_t4c_session' diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb index 33725e95..246168a4 100644 --- a/config/initializers/wrap_parameters.rb +++ b/config/initializers/wrap_parameters.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # This file contains settings for ActionController::ParamsWrapper which diff --git a/config/routes.rb b/config/routes.rb index 11af549b..03fe0cd4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,29 +1,30 @@ -T4c::Application.routes.draw do +# frozen_string_literal: true +T4c::Application.routes.draw do root 'home#index' devise_for :users, - :controllers => { :omniauth_callbacks => 'users/omniauth_callbacks' } + controllers: { omniauth_callbacks: 'users/omniauth_callbacks' } - get '/users/login' => 'users#login' , :as => 'login_users' - get '/users/:user_id/tips' => 'tips#index' , :constraints => {:user_id => /\d+/} , :as => 'user_tips' - get '/users/:nickname/tips' => 'tips#index' , :constraints => {:nickname => /\w[\d\w\-]*/} , :as => 'user_tips_pretty' - get '/users/:id' => 'users#show' , :constraints => {:id => /\d+/} , :as => 'user' - get '/users/:nickname' => 'users#show' , :constraints => {:nickname => /\w[\d\w\-]*/} , :as => 'user_pretty' + get '/users/login' => 'users#login', :as => 'login_users' + get '/users/:user_id/tips' => 'tips#index', :constraints => { user_id: /\d+/ }, :as => 'user_tips' + get '/users/:nickname/tips' => 'tips#index', :constraints => { nickname: /\w[\d\w\-]*/ }, :as => 'user_tips_pretty' + get '/users/:id' => 'users#show', :constraints => { id: /\d+/ }, :as => 'user' + get '/users/:nickname' => 'users#show', :constraints => { nickname: /\w[\d\w\-]*/ }, :as => 'user_pretty' - get '/projects/:project_id/tips' => 'tips#index' , :constraints => {:project_id => /\d+/} , :as => 'project_tips' - get '/projects/:project_id/deposits' => 'deposits#index' , :constraints => {:project_id => /\d+/} , :as => 'project_deposits' - get '/:service/:repo/edit' => 'projects#edit' , :constraints => {:service => /github/ , :repo => /.+/} , :as => 'project_edit_pretty' - get '/:service/:repo/decide_tip_amounts' => 'projects#decide_tip_amounts' , :constraints => {:service => /github/ , :repo => /.+/} , :as => 'project_decide_tips_pretty' - get '/:service/:repo/tips' => 'tips#index' , :constraints => {:service => /github/ , :repo => /.+/} , :as => 'project_tips_pretty' - get '/:service/:repo/deposits' => 'deposits#index' , :constraints => {:service => /github/ , :repo => /.+/} , :as => 'project_deposits_pretty' - get '/:service/:repo' => 'projects#show' , :constraints => {:service => /github/ , :repo => /.+/} , :as => 'project_pretty' + get '/projects/:project_id/tips' => 'tips#index', :constraints => { project_id: /\d+/ }, :as => 'project_tips' + get '/projects/:project_id/deposits' => 'deposits#index', :constraints => { project_id: /\d+/ }, :as => 'project_deposits' + get '/:service/:repo/edit' => 'projects#edit', :constraints => { service: /github/, repo: /.+/ }, :as => 'project_edit_pretty' + get '/:service/:repo/decide_tip_amounts' => 'projects#decide_tip_amounts', :constraints => { service: /github/, repo: /.+/ }, :as => 'project_decide_tips_pretty' + get '/:service/:repo/tips' => 'tips#index', :constraints => { service: /github/, repo: /.+/ }, :as => 'project_tips_pretty' + get '/:service/:repo/deposits' => 'deposits#index', :constraints => { service: /github/, repo: /.+/ }, :as => 'project_deposits_pretty' + get '/:service/:repo' => 'projects#show', :constraints => { service: /github/, repo: /.+/ }, :as => 'project_pretty' - resources :tips , :only => [:index] - resources :deposits , :only => [:index] - resources :withdrawals , :only => [:index] - resources :users , :only => [:index , :show , :update, :destroy] - resources :projects , :only => [:index , :show , :update , :edit ] do + resources :tips, only: [:index] + resources :deposits, only: [:index] + resources :withdrawals, only: [:index] + resources :users, only: %i[index show update destroy] + resources :projects, only: %i[index show update edit] do collection do get 'search' end diff --git a/db/migrate/20131019133109_devise_create_users.rb b/db/migrate/20131019133109_devise_create_users.rb index 60dff55e..156e258d 100644 --- a/db/migrate/20131019133109_devise_create_users.rb +++ b/db/migrate/20131019133109_devise_create_users.rb @@ -1,9 +1,11 @@ +# frozen_string_literal: true + class DeviseCreateUsers < ActiveRecord::Migration[4.2] def change create_table(:users) do |t| ## Database authenticatable - t.string :email, :null => false, :default => "" - t.string :encrypted_password, :null => false, :default => "" + t.string :email, null: false, default: '' + t.string :encrypted_password, null: false, default: '' ## Recoverable t.string :reset_password_token @@ -13,7 +15,7 @@ def change t.datetime :remember_created_at ## Trackable - t.integer :sign_in_count, :default => 0, :null => false + t.integer :sign_in_count, default: 0, null: false t.datetime :current_sign_in_at t.datetime :last_sign_in_at t.string :current_sign_in_ip @@ -30,12 +32,11 @@ def change # t.string :unlock_token # Only if unlock strategy is :email or :both # t.datetime :locked_at - t.timestamps end - add_index :users, :email, :unique => true - add_index :users, :reset_password_token, :unique => true + add_index :users, :email, unique: true + add_index :users, :reset_password_token, unique: true # add_index :users, :confirmation_token, :unique => true # add_index :users, :unlock_token, :unique => true end diff --git a/db/migrate/20131019133235_add_columns_to_users.rb b/db/migrate/20131019133235_add_columns_to_users.rb index 60257cc0..8e06d45a 100644 --- a/db/migrate/20131019133235_add_columns_to_users.rb +++ b/db/migrate/20131019133235_add_columns_to_users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddColumnsToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :nickname, :string diff --git a/db/migrate/20131019144930_add_bitcoin_address_to_users.rb b/db/migrate/20131019144930_add_bitcoin_address_to_users.rb index c22933ab..5a676e80 100644 --- a/db/migrate/20131019144930_add_bitcoin_address_to_users.rb +++ b/db/migrate/20131019144930_add_bitcoin_address_to_users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddBitcoinAddressToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :bitcoin_address, :string diff --git a/db/migrate/20131019164745_create_projects.rb b/db/migrate/20131019164745_create_projects.rb index 8b682c73..3c06e4eb 100644 --- a/db/migrate/20131019164745_create_projects.rb +++ b/db/migrate/20131019164745_create_projects.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateProjects < ActiveRecord::Migration[4.2] def change create_table :projects do |t| diff --git a/db/migrate/20131019170122_create_deposits.rb b/db/migrate/20131019170122_create_deposits.rb index 45db3a76..3c366449 100644 --- a/db/migrate/20131019170122_create_deposits.rb +++ b/db/migrate/20131019170122_create_deposits.rb @@ -1,11 +1,13 @@ +# frozen_string_literal: true + class CreateDeposits < ActiveRecord::Migration[4.2] def change create_table :deposits do |t| t.references :project, index: true t.string :txid t.integer :confirmations - t.integer :duration, :default => 30.days.to_i - t.integer :paid_out, :limit => 8 + t.integer :duration, default: 30.days.to_i + t.integer :paid_out, limit: 8 t.datetime :paid_out_at t.timestamps diff --git a/db/migrate/20131019170659_create_sendmanies.rb b/db/migrate/20131019170659_create_sendmanies.rb index cd13b386..22e3799a 100644 --- a/db/migrate/20131019170659_create_sendmanies.rb +++ b/db/migrate/20131019170659_create_sendmanies.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateSendmanies < ActiveRecord::Migration[4.2] def change create_table :sendmanies do |t| diff --git a/db/migrate/20131019170925_create_tips.rb b/db/migrate/20131019170925_create_tips.rb index 173ff7fa..6521687e 100644 --- a/db/migrate/20131019170925_create_tips.rb +++ b/db/migrate/20131019170925_create_tips.rb @@ -1,9 +1,11 @@ +# frozen_string_literal: true + class CreateTips < ActiveRecord::Migration[4.2] def change create_table :tips do |t| t.references :deposit, index: true t.references :user, index: true - t.integer :amount, :limit => 8 + t.integer :amount, limit: 8 t.references :sendmany, index: true t.boolean :is_refunded diff --git a/db/migrate/20131019175751_add_some_fields_to_projects.rb b/db/migrate/20131019175751_add_some_fields_to_projects.rb index 359ed32c..7c28bdb9 100644 --- a/db/migrate/20131019175751_add_some_fields_to_projects.rb +++ b/db/migrate/20131019175751_add_some_fields_to_projects.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddSomeFieldsToProjects < ActiveRecord::Migration[4.2] def change add_column :projects, :name, :string diff --git a/db/migrate/20131019205025_add_amount_to_deposit.rb b/db/migrate/20131019205025_add_amount_to_deposit.rb index d4be2067..e0081ee1 100644 --- a/db/migrate/20131019205025_add_amount_to_deposit.rb +++ b/db/migrate/20131019205025_add_amount_to_deposit.rb @@ -1,5 +1,7 @@ +# frozen_string_literal: true + class AddAmountToDeposit < ActiveRecord::Migration[4.2] def change - add_column :deposits, :amount, :integer, :limit => 8 + add_column :deposits, :amount, :integer, limit: 8 end end diff --git a/db/migrate/20131019211518_add_last_commit_to_projects.rb b/db/migrate/20131019211518_add_last_commit_to_projects.rb index 749be65d..34fe6f34 100644 --- a/db/migrate/20131019211518_add_last_commit_to_projects.rb +++ b/db/migrate/20131019211518_add_last_commit_to_projects.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddLastCommitToProjects < ActiveRecord::Migration[4.2] def change add_column :projects, :last_commit, :string diff --git a/db/migrate/20131020003746_add_commit_to_tip.rb b/db/migrate/20131020003746_add_commit_to_tip.rb index 78823996..f8500ea2 100644 --- a/db/migrate/20131020003746_add_commit_to_tip.rb +++ b/db/migrate/20131020003746_add_commit_to_tip.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddCommitToTip < ActiveRecord::Migration[4.2] def change add_column :tips, :commit, :string diff --git a/db/migrate/20131020120722_add_login_token_to_users.rb b/db/migrate/20131020120722_add_login_token_to_users.rb index e3ee6076..dc34d74e 100644 --- a/db/migrate/20131020120722_add_login_token_to_users.rb +++ b/db/migrate/20131020120722_add_login_token_to_users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddLoginTokenToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :login_token, :string diff --git a/db/migrate/20131020143021_add_unsubscribed_to_users.rb b/db/migrate/20131020143021_add_unsubscribed_to_users.rb index fbc4b620..d0d9ab51 100644 --- a/db/migrate/20131020143021_add_unsubscribed_to_users.rb +++ b/db/migrate/20131020143021_add_unsubscribed_to_users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddUnsubscribedToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :unsubscribed, :boolean diff --git a/db/migrate/20131020145043_add_notified_at_to_users.rb b/db/migrate/20131020145043_add_notified_at_to_users.rb index 0a20a915..3ec386bc 100644 --- a/db/migrate/20131020145043_add_notified_at_to_users.rb +++ b/db/migrate/20131020145043_add_notified_at_to_users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddNotifiedAtToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :notified_at, :datetime diff --git a/db/migrate/20131030142320_add_project_to_tip.rb b/db/migrate/20131030142320_add_project_to_tip.rb index ff882711..7615024e 100644 --- a/db/migrate/20131030142320_add_project_to_tip.rb +++ b/db/migrate/20131030142320_add_project_to_tip.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddProjectToTip < ActiveRecord::Migration[4.2] def change add_reference :tips, :project, index: true diff --git a/db/migrate/20131030142749_drop_deposit_from_tip.rb b/db/migrate/20131030142749_drop_deposit_from_tip.rb index 3db72501..da281869 100644 --- a/db/migrate/20131030142749_drop_deposit_from_tip.rb +++ b/db/migrate/20131030142749_drop_deposit_from_tip.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class DropDepositFromTip < ActiveRecord::Migration[4.2] def change remove_column :tips, :deposit_id diff --git a/db/migrate/20131030191346_add_available_amount_cache_to_projects.rb b/db/migrate/20131030191346_add_available_amount_cache_to_projects.rb index 4ea2248c..3e7e54ba 100644 --- a/db/migrate/20131030191346_add_available_amount_cache_to_projects.rb +++ b/db/migrate/20131030191346_add_available_amount_cache_to_projects.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddAvailableAmountCacheToProjects < ActiveRecord::Migration[4.2] def change add_column :projects, :available_amount_cache, :integer diff --git a/db/migrate/20131212190037_add_cache_to_users.rb b/db/migrate/20131212190037_add_cache_to_users.rb index 05b0f2e7..5e47b789 100644 --- a/db/migrate/20131212190037_add_cache_to_users.rb +++ b/db/migrate/20131212190037_add_cache_to_users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddCacheToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :commits_count, :integer, default: 0 diff --git a/db/migrate/20140102095035_add_refunded_at_to_tips.rb b/db/migrate/20140102095035_add_refunded_at_to_tips.rb index 1d2a01e8..05d80cb5 100644 --- a/db/migrate/20140102095035_add_refunded_at_to_tips.rb +++ b/db/migrate/20140102095035_add_refunded_at_to_tips.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddRefundedAtToTips < ActiveRecord::Migration[4.2] def change add_column :tips, :refunded_at, :timestamp diff --git a/db/migrate/20140207061855_add_github_id_to_projects.rb b/db/migrate/20140207061855_add_github_id_to_projects.rb index 8603e22f..a24ab855 100644 --- a/db/migrate/20140207061855_add_github_id_to_projects.rb +++ b/db/migrate/20140207061855_add_github_id_to_projects.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddGithubIdToProjects < ActiveRecord::Migration[4.2] def change add_column :projects, :github_id, :string diff --git a/db/migrate/20140209022632_change_projects_description.rb b/db/migrate/20140209022632_change_projects_description.rb index dd04c317..5cc7d19d 100644 --- a/db/migrate/20140209022632_change_projects_description.rb +++ b/db/migrate/20140209022632_change_projects_description.rb @@ -1,7 +1,10 @@ +# frozen_string_literal: true + class ChangeProjectsDescription < ActiveRecord::Migration[4.2] def up - change_column :projects, :description, :text, :limit => nil + change_column :projects, :description, :text, limit: nil end + def down change_column :projects, :description, :string end diff --git a/db/migrate/20140209041123_create_indexes_for_projects.rb b/db/migrate/20140209041123_create_indexes_for_projects.rb index c17aa464..d51f16bf 100644 --- a/db/migrate/20140209041123_create_indexes_for_projects.rb +++ b/db/migrate/20140209041123_create_indexes_for_projects.rb @@ -1,6 +1,8 @@ +# frozen_string_literal: true + class CreateIndexesForProjects < ActiveRecord::Migration[4.2] def change - add_index :projects, :full_name, :unique => true - add_index :projects, :github_id, :unique => true + add_index :projects, :full_name, unique: true + add_index :projects, :github_id, unique: true end end diff --git a/db/migrate/20140223061035_add_project_host.rb b/db/migrate/20140223061035_add_project_host.rb index 93def914..60fb7f07 100644 --- a/db/migrate/20140223061035_add_project_host.rb +++ b/db/migrate/20140223061035_add_project_host.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddProjectHost < ActiveRecord::Migration[4.2] class Project < ActiveRecord::Base end diff --git a/db/migrate/20140309192616_create_collaborators.rb b/db/migrate/20140309192616_create_collaborators.rb index 2aa5ced4..fc2ebd6d 100644 --- a/db/migrate/20140309192616_create_collaborators.rb +++ b/db/migrate/20140309192616_create_collaborators.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateCollaborators < ActiveRecord::Migration[4.2] def change create_table :collaborators do |t| diff --git a/db/migrate/20140323072851_add_hold_tips_to_project.rb b/db/migrate/20140323072851_add_hold_tips_to_project.rb index 97063382..cce4571f 100644 --- a/db/migrate/20140323072851_add_hold_tips_to_project.rb +++ b/db/migrate/20140323072851_add_hold_tips_to_project.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddHoldTipsToProject < ActiveRecord::Migration[4.2] def change add_column :projects, :hold_tips, :boolean, default: false diff --git a/db/migrate/20140323165816_add_commit_message_to_tip.rb b/db/migrate/20140323165816_add_commit_message_to_tip.rb index 50bc133b..4e33cb1e 100644 --- a/db/migrate/20140323165816_add_commit_message_to_tip.rb +++ b/db/migrate/20140323165816_add_commit_message_to_tip.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddCommitMessageToTip < ActiveRecord::Migration[4.2] def change add_column :tips, :commit_message, :string diff --git a/db/migrate/20140323173320_create_tipping_policies_texts.rb b/db/migrate/20140323173320_create_tipping_policies_texts.rb index 1d62f4d1..d6494d3d 100644 --- a/db/migrate/20140323173320_create_tipping_policies_texts.rb +++ b/db/migrate/20140323173320_create_tipping_policies_texts.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateTippingPoliciesTexts < ActiveRecord::Migration[4.2] def change create_table :tipping_policies_texts do |t| diff --git a/db/migrate/20140402032836_change_commit_message_type.rb b/db/migrate/20140402032836_change_commit_message_type.rb index 9fa48dd3..c610d425 100644 --- a/db/migrate/20140402032836_change_commit_message_type.rb +++ b/db/migrate/20140402032836_change_commit_message_type.rb @@ -1,7 +1,10 @@ +# frozen_string_literal: true + class ChangeCommitMessageType < ActiveRecord::Migration[4.2] def up change_column :tips, :commit_message, :text end + def down change_column :tips, :commit_message, :string end diff --git a/db/migrate/20140402034521_change_commit_message_limit.rb b/db/migrate/20140402034521_change_commit_message_limit.rb index 61eb8255..6f28baca 100644 --- a/db/migrate/20140402034521_change_commit_message_limit.rb +++ b/db/migrate/20140402034521_change_commit_message_limit.rb @@ -1,7 +1,10 @@ +# frozen_string_literal: true + class ChangeCommitMessageLimit < ActiveRecord::Migration[4.2] def up change_column :tips, :commit_message, :text, limit: nil end + def down change_column :tips, :commit_message, :text end diff --git a/db/migrate/20140402082149_add_fee_size_to_deposits.rb b/db/migrate/20140402082149_add_fee_size_to_deposits.rb index e137e515..9a4ff742 100644 --- a/db/migrate/20140402082149_add_fee_size_to_deposits.rb +++ b/db/migrate/20140402082149_add_fee_size_to_deposits.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddFeeSizeToDeposits < ActiveRecord::Migration[4.2] class Deposit < ActiveRecord::Base end @@ -7,7 +9,7 @@ def change remove_column :deposits, :duration, :integer reversible do |dir| # Update all existing deposits - dir.up { Deposit.update_all(fee_size: CONFIG["our_fee"]) } + dir.up { Deposit.update_all(fee_size: CONFIG['our_fee']) } end end end diff --git a/db/migrate/20140620123610_add_decided_at_to_tips.rb b/db/migrate/20140620123610_add_decided_at_to_tips.rb index 4ae6c112..544a7b95 100644 --- a/db/migrate/20140620123610_add_decided_at_to_tips.rb +++ b/db/migrate/20140620123610_add_decided_at_to_tips.rb @@ -1,5 +1,7 @@ +# frozen_string_literal: true + class AddDecidedAtToTips < ActiveRecord::Migration[4.2] def change add_column :tips, :decided_at, :timestamp end -end \ No newline at end of file +end diff --git a/db/migrate/20140620124628_update_decided_at_for_existing_tips.rb b/db/migrate/20140620124628_update_decided_at_for_existing_tips.rb index 974d368a..1d197d3d 100644 --- a/db/migrate/20140620124628_update_decided_at_for_existing_tips.rb +++ b/db/migrate/20140620124628_update_decided_at_for_existing_tips.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class UpdateDecidedAtForExistingTips < ActiveRecord::Migration[4.2] def up Tip.where.not(amount: nil).find_each do |tip| diff --git a/db/migrate/20140717085945_add_info_updated_at_to_projects.rb b/db/migrate/20140717085945_add_info_updated_at_to_projects.rb index 2da405bb..a90e8bc7 100644 --- a/db/migrate/20140717085945_add_info_updated_at_to_projects.rb +++ b/db/migrate/20140717085945_add_info_updated_at_to_projects.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddInfoUpdatedAtToProjects < ActiveRecord::Migration[4.2] def change add_column :projects, :info_updated_at, :timestamp diff --git a/db/migrate/20140722092532_add_confirmation_fields_to_users.rb b/db/migrate/20140722092532_add_confirmation_fields_to_users.rb index c21b8c36..cb9fa533 100644 --- a/db/migrate/20140722092532_add_confirmation_fields_to_users.rb +++ b/db/migrate/20140722092532_add_confirmation_fields_to_users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddConfirmationFieldsToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :confirmed_at, :timestamp diff --git a/db/migrate/20140725054216_add_display_name_to_users.rb b/db/migrate/20140725054216_add_display_name_to_users.rb index 6db1c1c1..0ce6171c 100644 --- a/db/migrate/20140725054216_add_display_name_to_users.rb +++ b/db/migrate/20140725054216_add_display_name_to_users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddDisplayNameToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :display_name, :string diff --git a/db/migrate/20140816062159_remove_paid_out_from_deposits.rb b/db/migrate/20140816062159_remove_paid_out_from_deposits.rb index 409b4c5e..240add45 100644 --- a/db/migrate/20140816062159_remove_paid_out_from_deposits.rb +++ b/db/migrate/20140816062159_remove_paid_out_from_deposits.rb @@ -1,6 +1,8 @@ +# frozen_string_literal: true + class RemovePaidOutFromDeposits < ActiveRecord::Migration[4.2] def change - remove_column :deposits, :paid_out, :integer, :limit => 8 + remove_column :deposits, :paid_out, :integer, limit: 8 remove_column :deposits, :paid_out_at, :datetime end end diff --git a/db/migrate/20140823035950_add_branch_to_projects.rb b/db/migrate/20140823035950_add_branch_to_projects.rb index fcc62eda..e149a615 100644 --- a/db/migrate/20140823035950_add_branch_to_projects.rb +++ b/db/migrate/20140823035950_add_branch_to_projects.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddBranchToProjects < ActiveRecord::Migration[4.2] def change add_column :projects, :branch, :string, default: 'master' diff --git a/db/migrate/20140823060921_make_default_branch_blank.rb b/db/migrate/20140823060921_make_default_branch_blank.rb index e0bee36f..756b7412 100644 --- a/db/migrate/20140823060921_make_default_branch_blank.rb +++ b/db/migrate/20140823060921_make_default_branch_blank.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class MakeDefaultBranchBlank < ActiveRecord::Migration[4.2] def change change_column :projects, :branch, :string, default: nil diff --git a/db/migrate/20140918051752_add_disable_notifications_to_projects.rb b/db/migrate/20140918051752_add_disable_notifications_to_projects.rb index 9a8b0e34..3bbdff3c 100644 --- a/db/migrate/20140918051752_add_disable_notifications_to_projects.rb +++ b/db/migrate/20140918051752_add_disable_notifications_to_projects.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddDisableNotificationsToProjects < ActiveRecord::Migration[4.2] def change add_column :projects, :disable_notifications, :boolean diff --git a/db/migrate/20141029083726_add_avatar_to_projects.rb b/db/migrate/20141029083726_add_avatar_to_projects.rb index d4d07215..111444fc 100644 --- a/db/migrate/20141029083726_add_avatar_to_projects.rb +++ b/db/migrate/20141029083726_add_avatar_to_projects.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddAvatarToProjects < ActiveRecord::Migration[4.2] def change add_column :projects, :avatar_url, :string diff --git a/db/migrate/20141112064004_add_deleted_at_to_projects.rb b/db/migrate/20141112064004_add_deleted_at_to_projects.rb index d930003d..d48360c3 100644 --- a/db/migrate/20141112064004_add_deleted_at_to_projects.rb +++ b/db/migrate/20141112064004_add_deleted_at_to_projects.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddDeletedAtToProjects < ActiveRecord::Migration[4.2] def change add_column :projects, :deleted_at, :timestamp diff --git a/db/migrate/20150620054216_add_denom.rb b/db/migrate/20150620054216_add_denom.rb index 6687c650..818cc9c8 100755 --- a/db/migrate/20150620054216_add_denom.rb +++ b/db/migrate/20150620054216_add_denom.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddDenom < ActiveRecord::Migration[4.2] def change add_column :users, :denom, :integer, default: 0 diff --git a/db/migrate/20151219081507_add_bitcoin_address2_to_projects.rb b/db/migrate/20151219081507_add_bitcoin_address2_to_projects.rb index e9d6bd19..4ac4957d 100644 --- a/db/migrate/20151219081507_add_bitcoin_address2_to_projects.rb +++ b/db/migrate/20151219081507_add_bitcoin_address2_to_projects.rb @@ -1,11 +1,11 @@ +# frozen_string_literal: true + class AddBitcoinAddress2ToProjects < ActiveRecord::Migration[4.2] def change add_column :projects, :bitcoin_address2, :string, index: true reversible do |dir| dir.up do - Project.find_each do |project| - project.generate_address2 - end + Project.find_each(&:generate_address2) end end end diff --git a/db/migrate/20170308152313_create_wallets.rb b/db/migrate/20170308152313_create_wallets.rb index 053ede27..360e75e1 100644 --- a/db/migrate/20170308152313_create_wallets.rb +++ b/db/migrate/20170308152313_create_wallets.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateWallets < ActiveRecord::Migration[4.2] def change create_table :wallets do |t| diff --git a/db/migrate/20170308161814_add_wallet_id_to_projects.rb b/db/migrate/20170308161814_add_wallet_id_to_projects.rb index 1de39ebc..b7729d45 100644 --- a/db/migrate/20170308161814_add_wallet_id_to_projects.rb +++ b/db/migrate/20170308161814_add_wallet_id_to_projects.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddWalletIdToProjects < ActiveRecord::Migration[4.2] def change add_column :projects, :wallet_id, :integer diff --git a/db/migrate/20170308163825_add_legacy_addresses_to_projects.rb b/db/migrate/20170308163825_add_legacy_addresses_to_projects.rb index 98ed4509..42b2bb81 100644 --- a/db/migrate/20170308163825_add_legacy_addresses_to_projects.rb +++ b/db/migrate/20170308163825_add_legacy_addresses_to_projects.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddLegacyAddressesToProjects < ActiveRecord::Migration[4.2] def change add_column :projects, :legacy_address, :string diff --git a/db/schema.rb b/db/schema.rb index 3e91d974..02ad5898 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,4 +1,6 @@ # encoding: UTF-8 +# frozen_string_literal: true + # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -12,133 +14,131 @@ # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema.define(version: 20170308163825) do - - create_table "collaborators", force: :cascade do |t| - t.integer "project_id", limit: 4 - t.string "login", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" + create_table 'collaborators', force: :cascade do |t| + t.integer 'project_id', limit: 4 + t.string 'login', limit: 255 + t.datetime 'created_at' + t.datetime 'updated_at' end - add_index "collaborators", ["project_id"], name: "index_collaborators_on_project_id", using: :btree + add_index 'collaborators', ['project_id'], name: 'index_collaborators_on_project_id', using: :btree - create_table "deposits", force: :cascade do |t| - t.integer "project_id", limit: 4 - t.string "txid", limit: 255 - t.integer "confirmations", limit: 4 - t.datetime "created_at" - t.datetime "updated_at" - t.integer "amount", limit: 8 - t.float "fee_size", limit: 24 + create_table 'deposits', force: :cascade do |t| + t.integer 'project_id', limit: 4 + t.string 'txid', limit: 255 + t.integer 'confirmations', limit: 4 + t.datetime 'created_at' + t.datetime 'updated_at' + t.integer 'amount', limit: 8 + t.float 'fee_size', limit: 24 end - add_index "deposits", ["project_id"], name: "index_deposits_on_project_id", using: :btree - - create_table "projects", force: :cascade do |t| - t.string "url", limit: 255 - t.string "bitcoin_address", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" - t.string "name", limit: 255 - t.string "full_name", limit: 255 - t.string "source_full_name", limit: 255 - t.text "description", limit: 65535 - t.integer "watchers_count", limit: 4 - t.string "language", limit: 255 - t.string "last_commit", limit: 255 - t.integer "available_amount_cache", limit: 4 - t.string "github_id", limit: 255 - t.string "host", limit: 255, default: "github" - t.boolean "hold_tips", default: false - t.datetime "info_updated_at" - t.string "branch", limit: 255 - t.boolean "disable_notifications" - t.string "avatar_url", limit: 255 - t.datetime "deleted_at" - t.string "bitcoin_address2", limit: 255 - t.integer "wallet_id", limit: 4 - t.string "legacy_address", limit: 255 + add_index 'deposits', ['project_id'], name: 'index_deposits_on_project_id', using: :btree + + create_table 'projects', force: :cascade do |t| + t.string 'url', limit: 255 + t.string 'bitcoin_address', limit: 255 + t.datetime 'created_at' + t.datetime 'updated_at' + t.string 'name', limit: 255 + t.string 'full_name', limit: 255 + t.string 'source_full_name', limit: 255 + t.text 'description', limit: 65535 + t.integer 'watchers_count', limit: 4 + t.string 'language', limit: 255 + t.string 'last_commit', limit: 255 + t.integer 'available_amount_cache', limit: 4 + t.string 'github_id', limit: 255 + t.string 'host', limit: 255, default: 'github' + t.boolean 'hold_tips', default: false + t.datetime 'info_updated_at' + t.string 'branch', limit: 255 + t.boolean 'disable_notifications' + t.string 'avatar_url', limit: 255 + t.datetime 'deleted_at' + t.string 'bitcoin_address2', limit: 255 + t.integer 'wallet_id', limit: 4 + t.string 'legacy_address', limit: 255 end - add_index "projects", ["full_name"], name: "index_projects_on_full_name", unique: true, using: :btree - add_index "projects", ["github_id"], name: "index_projects_on_github_id", unique: true, using: :btree + add_index 'projects', ['full_name'], name: 'index_projects_on_full_name', unique: true, using: :btree + add_index 'projects', ['github_id'], name: 'index_projects_on_github_id', unique: true, using: :btree - create_table "sendmanies", force: :cascade do |t| - t.string "txid", limit: 255 - t.text "data", limit: 65535 - t.string "result", limit: 255 - t.boolean "is_error" - t.datetime "created_at" - t.datetime "updated_at" + create_table 'sendmanies', force: :cascade do |t| + t.string 'txid', limit: 255 + t.text 'data', limit: 65535 + t.string 'result', limit: 255 + t.boolean 'is_error' + t.datetime 'created_at' + t.datetime 'updated_at' end - create_table "tipping_policies_texts", force: :cascade do |t| - t.integer "project_id", limit: 4 - t.integer "user_id", limit: 4 - t.text "text", limit: 65535 - t.datetime "created_at" - t.datetime "updated_at" + create_table 'tipping_policies_texts', force: :cascade do |t| + t.integer 'project_id', limit: 4 + t.integer 'user_id', limit: 4 + t.text 'text', limit: 65535 + t.datetime 'created_at' + t.datetime 'updated_at' end - add_index "tipping_policies_texts", ["project_id"], name: "index_tipping_policies_texts_on_project_id", using: :btree - add_index "tipping_policies_texts", ["user_id"], name: "index_tipping_policies_texts_on_user_id", using: :btree - - create_table "tips", force: :cascade do |t| - t.integer "user_id", limit: 4 - t.integer "amount", limit: 8 - t.integer "sendmany_id", limit: 4 - t.datetime "created_at" - t.datetime "updated_at" - t.string "commit", limit: 255 - t.integer "project_id", limit: 4 - t.datetime "refunded_at" - t.text "commit_message", limit: 65535 - t.datetime "decided_at" + add_index 'tipping_policies_texts', ['project_id'], name: 'index_tipping_policies_texts_on_project_id', using: :btree + add_index 'tipping_policies_texts', ['user_id'], name: 'index_tipping_policies_texts_on_user_id', using: :btree + + create_table 'tips', force: :cascade do |t| + t.integer 'user_id', limit: 4 + t.integer 'amount', limit: 8 + t.integer 'sendmany_id', limit: 4 + t.datetime 'created_at' + t.datetime 'updated_at' + t.string 'commit', limit: 255 + t.integer 'project_id', limit: 4 + t.datetime 'refunded_at' + t.text 'commit_message', limit: 65535 + t.datetime 'decided_at' end - add_index "tips", ["project_id"], name: "index_tips_on_project_id", using: :btree - add_index "tips", ["sendmany_id"], name: "index_tips_on_sendmany_id", using: :btree - add_index "tips", ["user_id"], name: "index_tips_on_user_id", using: :btree - - create_table "users", force: :cascade do |t| - t.string "email", limit: 255, default: "", null: false - t.string "encrypted_password", limit: 255, default: "", null: false - t.string "reset_password_token", limit: 255 - t.datetime "reset_password_sent_at" - t.datetime "remember_created_at" - t.integer "sign_in_count", limit: 4, default: 0, null: false - t.datetime "current_sign_in_at" - t.datetime "last_sign_in_at" - t.string "current_sign_in_ip", limit: 255 - t.string "last_sign_in_ip", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" - t.string "nickname", limit: 255 - t.string "name", limit: 255 - t.string "image", limit: 255 - t.string "bitcoin_address", limit: 255 - t.string "login_token", limit: 255 - t.boolean "unsubscribed" - t.datetime "notified_at" - t.integer "commits_count", limit: 4, default: 0 - t.integer "withdrawn_amount", limit: 8, default: 0 - t.datetime "confirmed_at" - t.datetime "confirmation_sent_at" - t.string "confirmation_token", limit: 255 - t.string "unconfirmed_email", limit: 255 - t.string "display_name", limit: 255 - t.integer "denom", limit: 4, default: 0 + add_index 'tips', ['project_id'], name: 'index_tips_on_project_id', using: :btree + add_index 'tips', ['sendmany_id'], name: 'index_tips_on_sendmany_id', using: :btree + add_index 'tips', ['user_id'], name: 'index_tips_on_user_id', using: :btree + + create_table 'users', force: :cascade do |t| + t.string 'email', limit: 255, default: '', null: false + t.string 'encrypted_password', limit: 255, default: '', null: false + t.string 'reset_password_token', limit: 255 + t.datetime 'reset_password_sent_at' + t.datetime 'remember_created_at' + t.integer 'sign_in_count', limit: 4, default: 0, null: false + t.datetime 'current_sign_in_at' + t.datetime 'last_sign_in_at' + t.string 'current_sign_in_ip', limit: 255 + t.string 'last_sign_in_ip', limit: 255 + t.datetime 'created_at' + t.datetime 'updated_at' + t.string 'nickname', limit: 255 + t.string 'name', limit: 255 + t.string 'image', limit: 255 + t.string 'bitcoin_address', limit: 255 + t.string 'login_token', limit: 255 + t.boolean 'unsubscribed' + t.datetime 'notified_at' + t.integer 'commits_count', limit: 4, default: 0 + t.integer 'withdrawn_amount', limit: 8, default: 0 + t.datetime 'confirmed_at' + t.datetime 'confirmation_sent_at' + t.string 'confirmation_token', limit: 255 + t.string 'unconfirmed_email', limit: 255 + t.string 'display_name', limit: 255 + t.integer 'denom', limit: 4, default: 0 end - add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree - add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree + add_index 'users', ['email'], name: 'index_users_on_email', unique: true, using: :btree + add_index 'users', ['reset_password_token'], name: 'index_users_on_reset_password_token', unique: true, using: :btree - create_table "wallets", force: :cascade do |t| - t.string "name", limit: 255 - t.string "xpub", limit: 255 - t.integer "last_address_index", limit: 4, default: 1 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + create_table 'wallets', force: :cascade do |t| + t.string 'name', limit: 255 + t.string 'xpub', limit: 255 + t.integer 'last_address_index', limit: 4, default: 1 + t.datetime 'created_at', null: false + t.datetime 'updated_at', null: false end - end diff --git a/db/seeds.rb b/db/seeds.rb index 4edb1e85..c8774b73 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # diff --git a/features/step_definitions/common.rb b/features/step_definitions/common.rb index 140b071a..07d7f228 100644 --- a/features/step_definitions/common.rb +++ b/features/step_definitions/common.rb @@ -1,70 +1,72 @@ +# frozen_string_literal: true + Before do ActionMailer::Base.deliveries.clear # mock branches method to prevent api call - Project.any_instance.stub(:branches).and_return(%w(master)) + Project.any_instance.stub(:branches).and_return(%w[master]) - @default_tip = CONFIG["tip"] - @default_our_fee = CONFIG["our_fee"] - @default_min_tip = CONFIG["min_tip"] + @default_tip = CONFIG['tip'] + @default_our_fee = CONFIG['our_fee'] + @default_min_tip = CONFIG['min_tip'] end -After do |scenario| +After do |_scenario| OmniAuth.config.test_mode = false - CONFIG["tip"] = @default_tip - CONFIG["our_fee"] = @default_our_fee - CONFIG["min_tip"] = @default_min_tip + CONFIG['tip'] = @default_tip + CONFIG['our_fee'] = @default_our_fee + CONFIG['min_tip'] = @default_min_tip -# Cucumber.wants_to_quit = true if scenario.status.eql? :failed -# Cucumber.wants_to_quit = true if scenario.status.eql? :undefined -# Cucumber.wants_to_quit = true if scenario.status.eql? :pending + # Cucumber.wants_to_quit = true if scenario.status.eql? :failed + # Cucumber.wants_to_quit = true if scenario.status.eql? :undefined + # Cucumber.wants_to_quit = true if scenario.status.eql? :pending end -def mock_github_user nickname +def mock_github_user(nickname) email = "#{nickname.parameterize}@example.com" OmniAuth.config.test_mode = true OmniAuth.config.mock_auth[:github] = { - "info" => { - "nickname" => nickname , - "primary_email" => email , - "verified_emails" => [email] , - }, + 'info' => { + 'nickname' => nickname, + 'primary_email' => email, + 'verified_emails' => [email] + } }.to_ostruct step "a developer named \"#{nickname}\" exists without a bitcoin address" end -Given /^a GitHub user named "(.*?)" exists$/ do |nickname| +Given(/^a GitHub user named "(.*?)" exists$/) do |nickname| mock_github_user nickname end -Given /^I'm signed in as "(.*?)"$/ do |nickname| +Given(/^I'm signed in as "(.*?)"$/) do |nickname| mock_github_user nickname visit root_path - first(:link, "Sign in").click - click_on "Sign in with Github" - page.should have_content("Successfully authenticated") + first(:link, 'Sign in').click + click_on 'Sign in with Github' + page.should have_content('Successfully authenticated') end -Given /^I'm not signed in$/ do +Given(/^I'm not signed in$/) do visit root_path - if page.has_content?("Sign out") - click_on "Sign out" - page.should have_content("Signed out successfully") + if page.has_content?('Sign out') + click_on 'Sign out' + page.should have_content('Signed out successfully') else - page.should have_content("Sign in") + page.should have_content('Sign in') end OmniAuth.config.test_mode = false end -Given (/^I sign in as "(.*?)"$/) { |nickname| step "I'm signed in as \"#{nickname}\"" } +Given(/^I sign in as "(.*?)"$/) { |nickname| step "I'm signed in as \"#{nickname}\"" } -Given (/^I sign out$/) { step "I'm not signed in" } +Given(/^I sign out$/) { step "I'm not signed in" } -def parse_path_from_page_string page_string +def parse_path_from_page_string(page_string) path = nil # explicit cases @@ -75,36 +77,36 @@ def parse_path_from_page_string page_string model = tokens[1] action = tokens[2] || '' # '' => 'show' is_user = model.eql? 'user' - is_project = ['github-project' , 'bitbucket-project'].include? model + is_project = %w[github-project bitbucket-project].include? model if is_project - projects_paths = ['' , 'edit' , 'decide_tip_amounts' , 'tips' , 'deposits'] + projects_paths = ['', 'edit', 'decide_tip_amounts', 'tips', 'deposits'] is_valid_path = projects_paths.include? action service = model.split('-').first path = "/#{service}/#{name}/#{action}" if is_valid_path elsif is_user - user_paths = ['' , 'tips'] + user_paths = ['', 'tips'] is_valid_path = user_paths.include? action path = "/users/#{name}/#{action}" if is_valid_path # TODO: nyi # implicit cases else case page_string - when 'home' ; path = root_path ; - when 'sign_up' ; path = new_user_registration_path ; - when 'sign_in' ; path = new_user_session_path ; - when 'users' ; path = users_path ; - when 'projects' ; path = projects_path ; - when 'search' ; path = search_projects_path ; - when 'tips' ; path = tips_path ; - when 'deposits' ; path = deposits_path ; - when 'withdrawals' ; path = withdrawals_path ; - end + when 'home' then path = root_path + when 'sign_up' then path = new_user_registration_path + when 'sign_in' then path = new_user_session_path + when 'users' then path = users_path + when 'projects' then path = projects_path + when 'search' then path = search_projects_path + when 'tips' then path = tips_path + when 'deposits' then path = deposits_path + when 'withdrawals' then path = withdrawals_path + end end - path || (raise "unknown page") + path || (raise 'unknown page') end Given(/^I visit the "(.*?)" page$/) do |page_string| - visit parse_path_from_page_string page_string + visit parse_path_from_page_string(page_string) end Given(/^I browse to the explicit path "(.*?)"$/) do |url| @@ -112,18 +114,22 @@ def parse_path_from_page_string page_string end Then(/^I should be on the "(.*?)" page$/) do |page_string| - expected = parse_path_from_page_string page_string rescue expected = page_string - actual = URI.decode(page.current_path) + expected = begin + parse_path_from_page_string(page_string) + rescue StandardError + expected = page_string + end + actual = URI.decode(page.current_path) - expected.chop! if (expected.end_with? '/') && (expected.size > 1) - actual .chop! if (actual .end_with? '/') && (actual .size > 1) + expected = expected.chop if (expected.end_with? '/') && (expected.size > 1) + actual = actual.chop if (actual.end_with? '/') && (actual.size > 1) actual.should eq expected end -def find_element node_name +def find_element(node_name) case node_name - when "header" ; page.find '.masthead' + when 'header' then page.find '.masthead' end end @@ -131,8 +137,8 @@ def find_element node_name click_on(arg1) end -Given(/^I click "(.*?)" within the "(.*?)" area$/) do |link_text , node_name| - within (find_element node_name) { click_on link_text } +Given(/^I click "(.*?)" within the "(.*?)" area$/) do |link_text, node_name| + within(find_element(node_name)) { click_on link_text } end Given(/^I check "(.*?)"$/) do |arg1| @@ -164,10 +170,10 @@ def find_element node_name end When(/^I confirm the email address: "(.*?)"$/) do |email| - mail = ActionMailer::Base.deliveries.select {|ea| ea.to.first.eql? email}.first + mail = ActionMailer::Base.deliveries.select { |ea| ea.to.first.eql? email }.first mail_body = mail.body.raw_source token = mail_body.split('?confirmation_token=')[1].split('">Confirm my account').first visit "/users/confirmation?confirmation_token=#{token}" end -Then /^some magic stuff happens in the cloud$/ do ; true ; end ; +Then(/^some magic stuff happens in the cloud$/) { true } diff --git a/features/step_definitions/home_steps.rb b/features/step_definitions/home_steps.rb index ce685958..0ec0493e 100644 --- a/features/step_definitions/home_steps.rb +++ b/features/step_definitions/home_steps.rb @@ -1,5 +1,6 @@ +# frozen_string_literal: true -Then(/^I should (.*)\s*see "(.*?)" in the "(.*?)" area$/) do |should , text , node_name| +Then(/^I should (.*)\s*see "(.*?)" in the "(.*?)" area$/) do |should, text, node_name| element = find_element node_name - element.should ((should.eql? 'not ')? (have_no_content text) : (have_content text)) + element.should((should.eql? 'not ') ? (have_no_content text) : (have_content text)) end diff --git a/features/step_definitions/project_steps.rb b/features/step_definitions/project_steps.rb index 0693a5db..b4e23624 100644 --- a/features/step_definitions/project_steps.rb +++ b/features/step_definitions/project_steps.rb @@ -1,13 +1,14 @@ +# frozen_string_literal: true def github_projects - [@github_project_1 , @github_project_2 , @github_project_3].compact + [@github_project_1, @github_project_2, @github_project_3].compact end def bitbucket_projects - [@bitbucket_project_1 , @bitbucket_project_2 , @bitbucket_project_3].compact + [@bitbucket_project_1, @bitbucket_project_2, @bitbucket_project_3].compact end -def create_github_project project_name , is_mock_project = true +def create_github_project(project_name, is_mock_project = true) # NOTE: when is_mock_project is false the app will actually fetch via network # this is the old "find or create" GUI functionality # so obviously the actual repo must exist @@ -20,37 +21,42 @@ def create_github_project project_name , is_mock_project = true (@github_project_2.present? && (project_name.eql? @github_project_2.full_name)) raise "duplicate project_name '#{project_name}'" elsif @github_project_3.present? - raise "the maximum of three test projects already exist" + raise 'the maximum of three test projects already exist' end - if is_mock_project - new_project = Project.create! :full_name => project_name , # e.g. "me/my-project" - :github_id => Digest::SHA1.hexdigest(project_name) , - :bitcoin_address => 'mq4NtnmQoQoPfNWEPbhSvxvncgtGo6L8WY' - else - new_project = Project.find_or_create_by_url project_name # e.g. "me/my-project" - end - - unless github_projects.include? new_project - if @github_project_2.present? ; @github_project_3 = new_project ; - elsif @github_project_1.present? ; @github_project_2 = new_project ; - else @github_project_1 = new_project ; + new_project = if is_mock_project + Project.create!( + full_name: project_name, # e.g. "me/my-project" + github_id: Digest::SHA1.hexdigest(project_name), + bitcoin_address: 'mq4NtnmQoQoPfNWEPbhSvxvncgtGo6L8WY' + ) + else + Project.find_or_create_by_url(project_name) # e.g. "me/my-project" + end + + unless github_projects.include?(new_project) + if @github_project_2.present? + @github_project_3 = new_project + elsif @github_project_1.present? + @github_project_2 = new_project + else + @github_project_1 = new_project end end new_project end -def create_bitbicket_project project_name - raise "unknown provider" # nyi +def create_bitbicket_project(_project_name) + raise 'unknown provider' # nyi end -def find_project service , project_name - project = Project.where(:host => service , :full_name => project_name).first +def find_project(service, project_name) + project = Project.where(host: service, full_name: project_name).first project || (raise "Project '#{project_name.inspect}' not found") end -Given(/^a "(.*?)" project named "(.*?)" exists$/) do |provider , project_name| +Given(/^a "(.*?)" project named "(.*?)" exists$/) do |provider, project_name| # NOTE: project owner will be automatically added as a collaborator # e.g. "seldon" if project_name == "seldon/a-project" # @current_project is also assigned in step 'regarding the "..." project named "..."' @@ -60,14 +66,14 @@ def find_project service , project_name when 'bitbucket' @current_project = create_bitbicket_project project_name when 'real-github' - @current_project = create_github_project project_name , false + @current_project = create_github_project project_name, false else raise "unknown provider \"#{provider}\"" end end -When /^regarding the "(.*?)" project named "(.*?)"$/ do |provider , project_name| +When(/^regarding the "(.*?)" project named "(.*?)"$/) do |provider, project_name| # NOTE: @current_project is also assigned in step 'a "..." project named "..." exists' - @current_project = find_project provider , project_name + @current_project = find_project provider, project_name end Given(/^the project collaborators are:$/) do |table| @@ -85,13 +91,13 @@ def find_project service , project_name end end -When /^the project syncs with the remote repo$/ do +When(/^the project syncs with the remote repo$/) do # in the real world a project has no information regarding commits # nor collaborators until the worker thread initially fetches the repo # so we cache new_commits and collaborators and defer loading to this step # which is intended to simulate the BitcoinTipper::work method project_owner_name = (@current_project.full_name.split '/').first - @new_commits ||= {@current_project.id => Hash.new} + @new_commits ||= { @current_project.id => {} } @collaborators ||= [project_owner_name] @collaborators << project_owner_name unless @collaborators.include? project_owner_name @@ -99,8 +105,8 @@ def find_project service , project_name step 'the project collaborators are loaded' end -Then /^there should (.*)\s*be a project avatar image visible$/ do |should| - avatar_xpath = "//img[contains(@src, \"githubusercontent\")]" +Then(/^there should (.*)\s*be a project avatar image visible$/) do |should| + avatar_xpath = '//img[contains(@src, "githubusercontent")]' if should.eql? 'not ' page.should_not have_xpath avatar_xpath else diff --git a/features/step_definitions/tips_steps.rb b/features/step_definitions/tips_steps.rb index cedd7673..06211d4a 100644 --- a/features/step_definitions/tips_steps.rb +++ b/features/step_definitions/tips_steps.rb @@ -1,31 +1,32 @@ +# frozen_string_literal: true Given(/^our fee is "(.*?)"$/) do |arg1| - CONFIG["our_fee"] = arg1.to_f + CONFIG['our_fee'] = arg1.to_f end Given(/^the tip percentage per commit is "(.*?)"$/) do |arg1| - CONFIG["tip"] = arg1.to_f + CONFIG['tip'] = arg1.to_f end Given(/^the minimum tip amount is "(.*?)"$/) do |arg1| - CONFIG["min_tip"] = arg1.to_f * 1e8 + CONFIG['min_tip'] = arg1.to_f * 1e8 end Given(/^a deposit of "(.*?)" is made$/) do |deposit| Deposit.create!(project: @current_project, amount: deposit.to_d * 1e8, confirmations: 10) end -def add_new_commit commit_id , nickname , params = {} - raise "duplicate commit_id" if (find_new_commit commit_id).present? +def add_new_commit(commit_id, nickname, params = {}) + raise 'duplicate commit_id' if (find_new_commit commit_id).present? defaults = { sha: commit_id, commit: { - message: "Some changes", + message: 'Some changes', author: { - email: "#{nickname}@example.com", - }, - }, + email: "#{nickname}@example.com" + } + } } project_id = @current_project.id @@ -34,7 +35,7 @@ def add_new_commit commit_id , nickname , params = {} @new_commits[project_id][commit_id] = defaults.deep_merge params end -def find_new_commit commit_id +def find_new_commit(commit_id) (@new_commits || {}).each_value do |commits| return commits[commit_id] unless commits[commit_id].nil? end @@ -42,41 +43,41 @@ def find_new_commit commit_id nil end -Given(/^a new commit "([^"]*?)" is made by a developer named "(.*?)"$/) do |commit_id , nickname| - add_new_commit commit_id , nickname +Given(/^a new commit "([^"]*?)" is made by a developer named "(.*?)"$/) do |commit_id, nickname| + add_new_commit commit_id, nickname end -Given(/^(\d+) new commit.? (?:is|are) made by a developer named "(.*?)"$/) do |n_commits , nickname| +Given(/^(\d+) new commit.? (?:is|are) made by a developer named "(.*?)"$/) do |n_commits, nickname| n_commits.to_i.times do - add_new_commit Digest::SHA1.hexdigest(SecureRandom.hex) , nickname + add_new_commit Digest::SHA1.hexdigest(SecureRandom.hex), nickname end end Given(/^a new commit "([^"]*?)" is made$/) do |commit_id| - add_new_commit commit_id , "unknown-user" + add_new_commit commit_id, 'unknown-user' end Given(/^a new commit "(.*?)" is made with parent "([^"]*?)"$/) do |commit_id, parent_commit_id| - add_new_commit commit_id , "unknown-user" , parents: [{sha: parent_commit_id}] + add_new_commit commit_id, 'unknown-user', parents: [{ sha: parent_commit_id }] end -Given(/^a new commit "(.*?)" is made with parent "(.*?)" and "(.*?)"$/) do |commit_id, parentA_commit_id, parentB_commit_id| - params = { parents: [{sha: parentA_commit_id}, {sha: parentB_commit_id}], commit: {message: "Merge #{parentA_commit_id} and #{parentB_commit_id}"} } - add_new_commit commit_id , "unknown-user" , params +Given(/^a new commit "(.*?)" is made with parent "(.*?)" and "(.*?)"$/) do |commit_id, parent_a_commit_id, parent_b_commit_id| + params = { parents: [{ sha: parent_a_commit_id }, { sha: parent_b_commit_id }], commit: { message: "Merge #{parent_a_commit_id} and #{parent_b_commit_id}" } } + add_new_commit commit_id, 'unknown-user', params end -Given(/^the author of commit "(.*?)" is "(.*?)"$/) do |commit_id , nickname| +Given(/^the author of commit "(.*?)" is "(.*?)"$/) do |commit_id, nickname| commit = find_new_commit commit_id - raise "no such commit" if commit.nil? + raise 'no such commit' if commit.nil? - commit.deep_merge!(author: {login: nickname}, commit: {author: {email: "#{nickname}@example.com"}}) + commit.deep_merge!(author: { login: nickname }, commit: { author: { email: "#{nickname}@example.com" } }) end -Given(/^the message of commit "(.*?)" is "(.*?)"$/) do |commit_id , commit_msg| +Given(/^the message of commit "(.*?)" is "(.*?)"$/) do |commit_id, commit_msg| commit = find_new_commit commit_id - raise "no such commit" if commit.nil? + raise 'no such commit' if commit.nil? - commit.deep_merge!(commit: {message: commit_msg}) + commit.deep_merge!(commit: { message: commit_msg }) end Given(/^the most recent commit is "(.*?)"$/) do |commit_id| @@ -88,9 +89,9 @@ def find_new_commit commit_id end When(/^the new commits are loaded$/) do - raise "no commits have been assigned" if @new_commits.nil? + raise 'no commits have been assigned' if @new_commits.nil? - [@github_project_1 , @github_project_2 , @github_project_3].each do |project| + [@github_project_1, @github_project_2, @github_project_3].each do |project| next if project.nil? project.reload @@ -119,13 +120,13 @@ def find_new_commit commit_id end When(/^I choose the amount "(.*?)" on commit "(.*?)"$/) do |arg1, arg2| - within find(".decide-tip-amounts-table tbody tr", text: arg2) do + within find('.decide-tip-amounts-table tbody tr', text: arg2) do choose arg1 end end When(/^I choose the amount "(.*?)" on all commits$/) do |arg1| - all(".decide-tip-amounts-table tbody tr").each do |tr| + all('.decide-tip-amounts-table tbody tr').each do |tr| within tr do choose arg1 end @@ -133,11 +134,11 @@ def find_new_commit commit_id end When(/^I send a forged request to enable tip holding on the project$/) do - page.driver.browser.process_and_follow_redirects(:patch, project_path(@current_project), project: {hold_tips: "1"}) + page.driver.browser.process_and_follow_redirects(:patch, project_path(@current_project), project: { hold_tips: '1' }) end Then(/^I should see an access denied$/) do - page.should have_content("You are not authorized to perform this action!") + page.should have_content('You are not authorized to perform this action!') end Then(/^the project should not hold tips$/) do @@ -153,7 +154,7 @@ def find_new_commit commit_id @current_project.reload.should have_undecided_tips end -Given(/^the project has (\d+) undecided tip$/) do |arg1| +Given(/^the project has (\d+) undecided tip$/) do |_arg1| @current_project.tips.undecided.each(&:destroy) create(:undecided_tip, project: @current_project) @current_project.reload.should have_undecided_tips @@ -165,33 +166,33 @@ def find_new_commit commit_id params = { project: { tips_attributes: { - "0" => { + '0' => { id: tip.id, - amount_percentage: "5", - }, - }, - }, + amount_percentage: '5' + } + } + } } page.driver.browser.process_and_follow_redirects(:patch, decide_tip_amounts_project_path(@current_project), params) end -When(/^I send a forged request to change the percentage of commit "(.*?)" to "(.*?)"$/) do |commit , percentage| +When(/^I send a forged request to change the percentage of commit "(.*?)" to "(.*?)"$/) do |commit, percentage| tip = @current_project.tips.detect { |t| t.commit == commit } tip.should_not be_nil params = { project: { tips_attributes: { - "0" => { + '0' => { id: tip.id, - amount_percentage: percentage, - }, - }, - }, + amount_percentage: percentage + } + } + } } path = decide_tip_amounts_project_path @current_project - page.driver.browser.process_and_follow_redirects :patch , path , params + page.driver.browser.process_and_follow_redirects :patch, path, params end Then(/^the project should have (\d+) undecided tips$/) do |arg1| diff --git a/features/step_definitions/users_steps.rb b/features/step_definitions/users_steps.rb index 7a32a93b..7984b949 100644 --- a/features/step_definitions/users_steps.rb +++ b/features/step_definitions/users_steps.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true def create_user(nickname, has_bitcoiin_address) User.create do |user| @@ -10,15 +11,15 @@ def create_user(nickname, has_bitcoiin_address) end end -Given /^a developer named "(.*?)" exists (with|without) a bitcoin address$/ do |nickname, with| +Given(/^a developer named "(.*?)" exists (with|without) a bitcoin address$/) do |nickname, with| @users ||= {} @users[nickname] ||= create_user(nickname, with.eql?('with')) end -Then /^a developer named "(.*?)" does not exist$/ do |nickname| +Then(/^a developer named "(.*?)" does not exist$/) do |nickname| User.where(nickname: nickname).first.should be_nil end -Then /^a developer named "(.*?)" exists$/ do |nickname| +Then(/^a developer named "(.*?)" exists$/) do |nickname| User.where(nickname: nickname).first.should_not be_nil end diff --git a/features/support/big_decimal_inspect.rb b/features/support/big_decimal_inspect.rb index 97c4d459..b358a69e 100644 --- a/features/support/big_decimal_inspect.rb +++ b/features/support/big_decimal_inspect.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class BigDecimal def inspect "" diff --git a/features/support/env.rb b/features/support/env.rb index cc01c149..812c293d 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. # It is recommended to regenerate this file in the future when you upgrade to a # newer version of cucumber-rails. Consider adding your own code to a new file diff --git a/features/support/factory_bot.rb b/features/support/factory_bot.rb index 168f5ac1..814501a5 100644 --- a/features/support/factory_bot.rb +++ b/features/support/factory_bot.rb @@ -1 +1,3 @@ +# frozen_string_literal: true + World(FactoryBot::Syntax::Methods) diff --git a/features/support/finders.rb b/features/support/finders.rb index 4d4b59c2..b6c32c62 100644 --- a/features/support/finders.rb +++ b/features/support/finders.rb @@ -1,5 +1,7 @@ -def find_project service , project_name -# TODO: subclass GithubProject , BitbucketProject , etc. (:host becomes :type) - project = Project.where(:host => service , :full_name => project_name).first +# frozen_string_literal: true + +def find_project(service, project_name) + # TODO: subclass GithubProject , BitbucketProject , etc. (:host becomes :type) + project = Project.where(host: service, full_name: project_name).first project or raise "Project '#{project_name.inspect}' not found" end diff --git a/features/support/ostruct_slice.rb b/features/support/ostruct_slice.rb index 70b0fd7e..95e6ac4d 100644 --- a/features/support/ostruct_slice.rb +++ b/features/support/ostruct_slice.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'ostruct' class OpenStruct diff --git a/features/support/rspec_doubles.rb b/features/support/rspec_doubles.rb index 6476fc19..3f8ef86d 100644 --- a/features/support/rspec_doubles.rb +++ b/features/support/rspec_doubles.rb @@ -1 +1,3 @@ +# frozen_string_literal: true + require 'cucumber/rspec/doubles' diff --git a/features/support/to_ostruct.rb b/features/support/to_ostruct.rb index bbb9cbc8..120bcdd3 100644 --- a/features/support/to_ostruct.rb +++ b/features/support/to_ostruct.rb @@ -1,9 +1,11 @@ +# frozen_string_literal: true + require 'ostruct' class Hash def to_ostruct o = OpenStruct.new(self) - each do |k,v| + each do |k, v| o.send(:"#{k}=", v.to_ostruct) if v.respond_to? :to_ostruct end o diff --git a/features/support/vcr_setup.rb b/features/support/vcr_setup.rb index 1513e025..eb0c3854 100644 --- a/features/support/vcr_setup.rb +++ b/features/support/vcr_setup.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'vcr' VCR.configure do |c| diff --git a/lib/bitcoin_address_validator.rb b/lib/bitcoin_address_validator.rb index 65caccb2..5b0bbd25 100644 --- a/lib/bitcoin_address_validator.rb +++ b/lib/bitcoin_address_validator.rb @@ -1,10 +1,10 @@ +# frozen_string_literal: true + require 'digest' class BitcoinAddressValidator < ActiveModel::EachValidator def validate_each(record, field, value) - unless value.blank? || valid_bitcoin_address?(value) - record.errors[field] << "Bitcoin address is invalid" - end + record.errors[field] << 'Bitcoin address is invalid' unless value.blank? || valid_bitcoin_address?(value) end private @@ -42,7 +42,7 @@ def parse_segwit_address(addr) }.freeze def valid_legacy_address?(address) - if (address =~ /^[a-zA-Z1-9]{33,35}$/) and version = version(address) + if (address =~ /^[a-zA-Z1-9]{33,35}$/) && (version = version(address)) if (expected_versions = EXPECTED_VERSIONS[CONFIG['network'].to_sym]).present? expected_versions.include?(version.ord) else @@ -55,7 +55,7 @@ def valid_legacy_address?(address) def version(address) decoded = b58_decode(address, 25) - + version = decoded[0, 1] checksum = decoded[-4, decoded.length] vh160 = decoded[0, decoded.length - 4] @@ -68,14 +68,14 @@ def version(address) def b58_decode(value, length) long_value = 0 index = 0 - result = "" + result = '' value.reverse.each_char do |c| - long_value += B58Chars.index(c) * (B58Base ** index) + long_value += B58Chars.index(c) * (B58Base**index) index += 1 end - while long_value >= 256 do + while long_value >= 256 div, mod = long_value.divmod 256 result = mod.chr + result long_value = div @@ -83,9 +83,7 @@ def b58_decode(value, length) result = long_value.chr + result - if result.length < length - result = 0.chr * (length - result.length) + result - end + result = 0.chr * (length - result.length) + result if result.length < length result end diff --git a/lib/bitcoin_rpc.rb b/lib/bitcoin_rpc.rb index 8d427643..c245984a 100644 --- a/lib/bitcoin_rpc.rb +++ b/lib/bitcoin_rpc.rb @@ -1,10 +1,11 @@ +# frozen_string_literal: true + require 'net/http' require 'uri' require 'json' class BitcoinRPC - - def initialize(service_url, batch_mode=false) + def initialize(service_url, batch_mode = false) @service_url = service_url @uri = URI.parse(service_url) set_batch_mode(batch_mode) @@ -15,27 +16,28 @@ def set_batch_mode(m) end def method_missing(name, *args) - if (@batch_mode) - { 'method' => name, 'params' => args, 'id' => 'jsonrpc', 'jsonrpc' => '2.0' } + if @batch_mode + { 'method' => name, 'params' => args, 'id' => 'jsonrpc', 'jsonrpc' => '2.0' } else - post_body = { 'method' => name, 'params' => args, 'id' => 'jsonrpc'}.to_json - resp = JSON.parse( http_post_request(post_body) ) + post_body = { 'method' => name, 'params' => args, 'id' => 'jsonrpc' }.to_json + resp = JSON.parse(http_post_request(post_body)) raise JSONRPCError, resp['error'] if resp['error'] + resp['result'] end end def commit(reqs) post_body = reqs.to_json - resp = JSON.parse( http_post_request(post_body) ) + resp = JSON.parse(http_post_request(post_body)) raise JSONRPCError, resp if resp.length != reqs.length + resp end def http_post_request(post_body) - RestClient.post( @service_url, post_body, :content_type => :json, :accept => :json ).body + RestClient.post(@service_url, post_body, content_type: :json, accept: :json).body end class JSONRPCError < RuntimeError; end - end diff --git a/lib/bitcoin_tipper.rb b/lib/bitcoin_tipper.rb index 80230581..a6883584 100644 --- a/lib/bitcoin_tipper.rb +++ b/lib/bitcoin_tipper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class BitcoinTipper class << self def work_forever @@ -46,7 +48,7 @@ def refund_unclaimed_tips def create_tips Rails.logger.info 'Traversing projects...' Project.find_each do |project| - if project.available_amount > 0 + if project.available_amount.positive? Rails.logger.info " Project #{project.id} #{project.full_name}" project.tip_commits end @@ -84,6 +86,7 @@ def calculate_outputs outputs = {} User.find_each do |user| next unless user.ready_for_withdrawal? + user.tips.decided.unpaid.each do |tip| tip.update_attribute :sendmany_id, sendmany.id outputs[user.bitcoin_address] ||= 0 diff --git a/lib/blacklist.rb b/lib/blacklist.rb index c1ef8f2c..d30d5a75 100644 --- a/lib/blacklist.rb +++ b/lib/blacklist.rb @@ -1,8 +1,10 @@ -require "set" +# frozen_string_literal: true + +require 'set' class Blacklist def initialize(urls) - urls = urls.map {|u| normalize_url(u) } + urls = urls.map { |u| normalize_url(u) } @urls = Set.new(urls) end @@ -10,28 +12,27 @@ def initialize(urls) def include?(url) url = normalize_url(url) - if @urls.include?(url) - return true - end + return true if @urls.include?(url) # Check for the author path. # https://github.com/author/* - url[url.rindex("/")..-1] = "/*" + url[url.rindex('/')..-1] = '/*' @urls.include?(url) end private + def normalize_url(url) - url = url.clone + url = url.dup - if !url.start_with?("http://", "https://", "//") - if !url.start_with?("github.com", "bitbucket.org") + unless url.start_with?('http://', 'https://', '//') + unless url.start_with?('github.com', 'bitbucket.org') # Assume it is a shortened "author/project" path and # default to Github. - url.prepend("github.com/") + url.prepend('github.com/') end - url.prepend("https://") + url.prepend('https://') end uri = URI.parse(url) diff --git a/lib/tasks/cucumber.rake b/lib/tasks/cucumber.rake index 9f53ce49..dcf14d1a 100644 --- a/lib/tasks/cucumber.rake +++ b/lib/tasks/cucumber.rake @@ -1,65 +1,66 @@ +# frozen_string_literal: true + # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. # It is recommended to regenerate this file in the future when you upgrade to a # newer version of cucumber-rails. Consider adding your own code to a new file # instead of editing this one. Cucumber will automatically load all features/**/*.rb # files. +unless ARGV.any? { |a| a =~ /^gems/ } # Don't load anything when running the gems:* tasks -unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks - -vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first -$LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil? + vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first + $LOAD_PATH.unshift("#{File.dirname(vendored_cucumber_bin)}/../lib") unless vendored_cucumber_bin.nil? -begin - require 'cucumber/rake/task' + begin + require 'cucumber/rake/task' - namespace :cucumber do - Cucumber::Rake::Task.new({:ok => 'test:prepare'}, 'Run features that should pass') do |t| - t.binary = vendored_cucumber_bin # If nil, the gem's binary is used. - t.fork = true # You may get faster startup if you set this to false - t.profile = 'default' - end + namespace :cucumber do + Cucumber::Rake::Task.new({ ok: 'test:prepare' }, 'Run features that should pass') do |t| + t.binary = vendored_cucumber_bin # If nil, the gem's binary is used. + t.fork = true # You may get faster startup if you set this to false + t.profile = 'default' + end - Cucumber::Rake::Task.new({:wip => 'test:prepare'}, 'Run features that are being worked on') do |t| - t.binary = vendored_cucumber_bin - t.fork = true # You may get faster startup if you set this to false - t.profile = 'wip' - end + Cucumber::Rake::Task.new({ wip: 'test:prepare' }, 'Run features that are being worked on') do |t| + t.binary = vendored_cucumber_bin + t.fork = true # You may get faster startup if you set this to false + t.profile = 'wip' + end - Cucumber::Rake::Task.new({:rerun => 'test:prepare'}, 'Record failing features and run only them if any exist') do |t| - t.binary = vendored_cucumber_bin - t.fork = true # You may get faster startup if you set this to false - t.profile = 'rerun' - end + Cucumber::Rake::Task.new({ rerun: 'test:prepare' }, 'Record failing features and run only them if any exist') do |t| + t.binary = vendored_cucumber_bin + t.fork = true # You may get faster startup if you set this to false + t.profile = 'rerun' + end - desc 'Run all features' - task :all => [:ok, :wip] + desc 'Run all features' + task all: %i[ok wip] - task :statsetup do - require 'rails/code_statistics' - ::STATS_DIRECTORIES << %w(Cucumber\ features features) if File.exist?('features') - ::CodeStatistics::TEST_TYPES << "Cucumber features" if File.exist?('features') + task :statsetup do + require 'rails/code_statistics' + ::STATS_DIRECTORIES << %w[Cucumber\ features features] if File.exist?('features') + ::CodeStatistics::TEST_TYPES << 'Cucumber features' if File.exist?('features') + end end - end - desc 'Alias for cucumber:ok' - task :cucumber => 'cucumber:ok' + desc 'Alias for cucumber:ok' + task cucumber: 'cucumber:ok' - task :default => :cucumber + task default: :cucumber - task :features => :cucumber do - STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***" - end + task features: :cucumber do + warn "*** The 'features' task is deprecated. See rake -T cucumber ***" + end - # In case we don't have the generic Rails test:prepare hook, append a no-op task that we can depend upon. - task 'test:prepare' do - end + # In case we don't have the generic Rails test:prepare hook, append a no-op task that we can depend upon. + task 'test:prepare' do + end - task :stats => 'cucumber:statsetup' -rescue LoadError - desc 'cucumber rake task not available (cucumber not installed)' - task :cucumber do - abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin' + task stats: 'cucumber:statsetup' + rescue LoadError + desc 'cucumber rake task not available (cucumber not installed)' + task :cucumber do + abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin' + end end -end end diff --git a/script/cucumber b/script/cucumber index 7fa5c920..eb5e962e 100755 --- a/script/cucumber +++ b/script/cucumber @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true vendored_cucumber_bin = Dir["#{File.dirname(__FILE__)}/../vendor/{gems,plugins}/cucumber*/bin/cucumber"].first if vendored_cucumber_bin diff --git a/spec/controllers/deposits_controller_spec.rb b/spec/controllers/deposits_controller_spec.rb index 57de087c..287e58bf 100644 --- a/spec/controllers/deposits_controller_spec.rb +++ b/spec/controllers/deposits_controller_spec.rb @@ -1,18 +1,21 @@ +# frozen_string_literal: true + require 'spec_helper' describe DepositsController, type: :controller do describe "GET 'index'" do - it "returns http success" do + it 'returns http success' do get 'index' expect(response).to be_successful end end - describe "routing" do - it "routes GET / to Deposits#index" do - expect({ :get => "/deposits" }).to route_to( - :controller => "deposits" , - :action => "index" ) + describe 'routing' do + it 'routes GET / to Deposits#index' do + expect({ get: '/deposits' }).to route_to( + controller: 'deposits', + action: 'index' + ) end end end diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb index 992e139b..8a6b1e79 100644 --- a/spec/controllers/home_controller_spec.rb +++ b/spec/controllers/home_controller_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe HomeController, type: :controller do @@ -13,31 +15,35 @@ end end - describe "routing" do - it "routes GET / to Home#index" do - expect({ :get => "/" }).to route_to( - :controller => "home" , - :action => "index" ) + describe 'routing' do + it 'routes GET / to Home#index' do + expect({ get: '/' }).to route_to( + controller: 'home', + action: 'index' + ) end - it "routes GET /home to Home#index" do - expect({ :get => "/" }).to route_to( - :controller => "home" , - :action => "index" ) + it 'routes GET /home to Home#index' do + expect({ get: '/' }).to route_to( + controller: 'home', + action: 'index' + ) end - it "routes GET /users/999999/no-such-path to Home#index" do - expect({ :get => "/users/999999/no-such-path" }).to route_to( - :controller => "home" , - :action => "index" , - :path => "users/999999/no-such-path") + it 'routes GET /users/999999/no-such-path to Home#index' do + expect({ get: '/users/999999/no-such-path' }).to route_to( + controller: 'home', + action: 'index', + path: 'users/999999/no-such-path' + ) end - it "routes GET /any/non-existent/path to Home#index" do - expect({ :get => "/any/non-existent/path" }).to route_to( - :controller => "home" , - :action => "index" , - :path => "any/non-existent/path") + it 'routes GET /any/non-existent/path to Home#index' do + expect({ get: '/any/non-existent/path' }).to route_to( + controller: 'home', + action: 'index', + path: 'any/non-existent/path' + ) end end end diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index 3c3b5f59..d7d189f3 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe ProjectsController, type: :controller do @@ -57,17 +59,16 @@ end end -=begin TODO: NFG - No route matches {:controller=>"projects", :action=>"update"} - describe 'PUT #update' do - it 'returns 200 status code' do - put :update - response.should be_success - end - end -=end + # TODO: NFG - No route matches {:controller=>"projects", :action=>"update"} + # describe 'PUT #update' do + # it 'returns 200 status code' do + # put :update + # response.should be_success + # end + # end - shared_context 'accessing_project' do |verb , action| - let(:a_project) { create :project , :host => 'github' , :full_name => "test/test" } + shared_context 'accessing_project' do |verb, action| + let(:a_project) { create :project, host: 'github', full_name: 'test/test' } context 'existing_project' do it 'via project id returns 302 status code' do @@ -85,7 +86,7 @@ when :get get(action, params: { service: 'github', repo: a_project.full_name }) when :patch - patch(action, params: { service: 'github', repo: a_project.full_name}) + patch(action, params: { service: 'github', repo: a_project.full_name }) end expect(response).to be_successful end @@ -95,9 +96,9 @@ it 'via project id returns 302 status code' do case verb when :get - get(action, params: { id: 999999 }) + get(action, params: { id: 999_999 }) when :patch - patch(action, params: { id: 999999 }) + patch(action, params: { id: 999_999 }) end expect(response).to be_redirect end @@ -115,11 +116,11 @@ end describe 'GET #show' do - include_context 'accessing_project' , :get , :show + include_context 'accessing_project', :get, :show context 'with existing repo that has been blacklisted' do - let(:blacklisted_repo) { create(:project, host: "github", full_name: "mitsuhiko/flask") } - let(:subject) { get(:show, params: { service: "github", repo: blacklisted_repo.full_name }) } + let(:blacklisted_repo) { create(:project, host: 'github', full_name: 'mitsuhiko/flask') } + let(:subject) { get(:show, params: { service: 'github', repo: blacklisted_repo.full_name }) } it 'renders blacklisted template' do expect(subject).to render_template :blacklisted @@ -129,17 +130,17 @@ describe 'GET #edit' do it 'returns 302 status code' do -# TODO: requires logged in user who is project collaborator -# include_context 'accessing_project' , :get , :edit + # TODO: requires logged in user who is project collaborator + # include_context 'accessing_project' , :get , :edit - get(:edit, params: { service: 'github' , repo: 'test/test' }) + get(:edit, params: { service: 'github', repo: 'test/test' }) expect(response).to be_redirect end end describe 'GET #decide_tip_amounts' do -# TODO: requires logged in user who is project collaborator and some tips -# include_context 'accessing_project' , :get , :decide_tip_amounts + # TODO: requires logged in user who is project collaborator and some tips + # include_context 'accessing_project' , :get , :decide_tip_amounts it 'returns 302 status code' do get(:decide_tip_amounts, params: { service: 'github', repo: 'test/test' }) @@ -148,119 +149,133 @@ end describe 'PATCH #decide_tip_amounts' do -# TODO: requires logged in user who is project collaborator and some tips -# include_context 'accessing_project' , :patch , :decide_tip_amounts + # TODO: requires logged in user who is project collaborator and some tips + # include_context 'accessing_project' , :patch , :decide_tip_amounts it 'returns 302 status code' do - patch(:decide_tip_amounts, params: { service: 'github' , repo: 'test/test' }) + patch(:decide_tip_amounts, params: { service: 'github', repo: 'test/test' }) expect(response).to be_redirect end end - describe "routing" do - it "routes GET /projects to Project#index" do - expect({ :get => "/projects" }).to route_to( - :controller => "projects" , - :action => "index" ) + describe 'routing' do + it 'routes GET /projects to Project#index' do + expect({ get: '/projects' }).to route_to( + controller: 'projects', + action: 'index' + ) end - it "routes GET /projects/search?query= to Project#search" do - expect({ :get => "/projects/search?query=seldon&order=balance" }).to route_to( - :controller => "projects" , - :action => "search" , - :query => "seldon" , - :order => "balance" ) + it 'routes GET /projects/search?query= to Project#search' do + expect({ get: '/projects/search?query=seldon&order=balance' }).to route_to( + controller: 'projects', + action: 'search', + query: 'seldon', + order: 'balance' + ) end - it "routes GET /projects/1 to Project#show" do - expect({ :get => "/projects/1" }).to route_to( - :controller => "projects" , - :action => "show" , - :id => "1" ) + it 'routes GET /projects/1 to Project#show' do + expect({ get: '/projects/1' }).to route_to( + controller: 'projects', + action: 'show', + id: '1' + ) end - it "routes GET /projects/1/edit to Project#edit" do - expect({ :get => "/projects/1/edit" }).to route_to( - :controller => "projects" , - :action => "edit" , - :id => "1" ) + it 'routes GET /projects/1/edit to Project#edit' do + expect({ get: '/projects/1/edit' }).to route_to( + controller: 'projects', + action: 'edit', + id: '1' + ) end - it "routes PUT /projects/1 to Project#update" do - expect({ :put => "/projects/1" }).to route_to( - :controller => "projects" , - :action => "update" , - :id => "1" ) + it 'routes PUT /projects/1 to Project#update' do + expect({ put: '/projects/1' }).to route_to( + controller: 'projects', + action: 'update', + id: '1' + ) end - it "routes GET /projects/1/decide_tip_amounts to Project#decide_tip_amounts" do - expect({ :get => "/projects/1/decide_tip_amounts" }).to route_to( - :controller => "projects" , - :action => "decide_tip_amounts" , - :id => "1" ) + it 'routes GET /projects/1/decide_tip_amounts to Project#decide_tip_amounts' do + expect({ get: '/projects/1/decide_tip_amounts' }).to route_to( + controller: 'projects', + action: 'decide_tip_amounts', + id: '1' + ) end - it "routes PATCH /projects/1/decide_tip_amounts to Project#decide_tip_amounts" do - expect({ :patch => "/projects/1/decide_tip_amounts" }).to route_to( - :controller => "projects" , - :action => "decide_tip_amounts" , - :id => "1" ) + it 'routes PATCH /projects/1/decide_tip_amounts to Project#decide_tip_amounts' do + expect({ patch: '/projects/1/decide_tip_amounts' }).to route_to( + controller: 'projects', + action: 'decide_tip_amounts', + id: '1' + ) end - it "routes GET /projects/1/tips to Tips#index" do - expect({ :get => "/projects/1/tips" }).to route_to( - :controller => "tips" , - :action => "index" , - :project_id => "1" ) + it 'routes GET /projects/1/tips to Tips#index' do + expect({ get: '/projects/1/tips' }).to route_to( + controller: 'tips', + action: 'index', + project_id: '1' + ) end - it "routes GET /projects/1/deposits to Deposits#index" do - expect({ :get => "/projects/1/deposits" }).to route_to( - :controller => "deposits" , - :action => "index" , - :project_id => "1" ) + it 'routes GET /projects/1/deposits to Deposits#index' do + expect({ get: '/projects/1/deposits' }).to route_to( + controller: 'deposits', + action: 'index', + project_id: '1' + ) end end - describe "Project pretty url routing" do - it "routes GET /:provider/:repo to Project#show" do - expect({ :get => "/github/test/test" }).to route_to( - :controller => "projects" , - :action => "show" , - :service => "github" , - :repo => "test/test") + describe 'Project pretty url routing' do + it 'routes GET /:provider/:repo to Project#show' do + expect({ get: '/github/test/test' }).to route_to( + controller: 'projects', + action: 'show', + service: 'github', + repo: 'test/test' + ) end - it "routes GET /:provider/:repo/edit to Project#edit" do - expect({ :get => "/github/test/test/edit" }).to route_to( - :controller => "projects" , - :action => "edit" , - :service => "github" , - :repo => "test/test") + it 'routes GET /:provider/:repo/edit to Project#edit' do + expect({ get: '/github/test/test/edit' }).to route_to( + controller: 'projects', + action: 'edit', + service: 'github', + repo: 'test/test' + ) end - it "routes GET /:provider/:repo/decide_tip_amounts to Project#decide_tip_amounts" do - expect({ :get => "/github/test/test/decide_tip_amounts" }).to route_to( - :controller => "projects" , - :action => "decide_tip_amounts" , - :service => "github" , - :repo => "test/test" ) + it 'routes GET /:provider/:repo/decide_tip_amounts to Project#decide_tip_amounts' do + expect({ get: '/github/test/test/decide_tip_amounts' }).to route_to( + controller: 'projects', + action: 'decide_tip_amounts', + service: 'github', + repo: 'test/test' + ) end - it "routes GET /:provider/:repo/tips to Project#tips" do - expect({ :get => "/github/test/test/tips" }).to route_to( - :controller => "tips" , - :action => "index" , - :service => "github" , - :repo => "test/test") + it 'routes GET /:provider/:repo/tips to Project#tips' do + expect({ get: '/github/test/test/tips' }).to route_to( + controller: 'tips', + action: 'index', + service: 'github', + repo: 'test/test' + ) end - it "routes GET /:provider/:repo/deposits to Project#deposits" do - expect({ :get => "/github/test/test/deposits" }).to route_to( - :controller => "deposits" , - :action => "index" , - :service => "github" , - :repo => "test/test") + it 'routes GET /:provider/:repo/deposits to Project#deposits' do + expect({ get: '/github/test/test/deposits' }).to route_to( + controller: 'deposits', + action: 'index', + service: 'github', + repo: 'test/test' + ) end end end diff --git a/spec/controllers/tips_controller_spec.rb b/spec/controllers/tips_controller_spec.rb index 60385bcb..d060ccf2 100644 --- a/spec/controllers/tips_controller_spec.rb +++ b/spec/controllers/tips_controller_spec.rb @@ -1,18 +1,21 @@ +# frozen_string_literal: true + require 'spec_helper' describe TipsController, type: :controller do describe "GET 'index'" do - it "returns http success" do + it 'returns http success' do get 'index' expect(response).to be_successful end end - describe "routing" do - it "routes GET / to Tips#index" do - expect({ :get => "/tips" }).to route_to( - :controller => "tips" , - :action => "index" ) + describe 'routing' do + it 'routes GET / to Tips#index' do + expect({ get: '/tips' }).to route_to( + controller: 'tips', + action: 'index' + ) end end end diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index a33c9f14..70b6cb2d 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe UsersController, type: :controller do @@ -93,61 +95,67 @@ end end - describe "routing" do - it "routes GET /users to User#index" do - expect({ :get => "/users" }).to route_to( - :controller => "users" , - :action => "index" ) + describe 'routing' do + it 'routes GET /users to User#index' do + expect({ get: '/users' }).to route_to( + controller: 'users', + action: 'index' + ) end - it "routes GET /users/nick-name321 to User#show" do - expect({ :get => "/users/nick-name321" }).to route_to( - :controller => "users" , - :action => "show" , - :nickname => "nick-name321" ) + it 'routes GET /users/nick-name321 to User#show' do + expect({ get: '/users/nick-name321' }).to route_to( + controller: 'users', + action: 'show', + nickname: 'nick-name321' + ) end - it "routes GET /users/login to User#login" do - expect({ :get => "/users/login" }).to route_to( - :controller => "users" , - :action => "login" ) + it 'routes GET /users/login to User#login' do + expect({ get: '/users/login' }).to route_to( + controller: 'users', + action: 'login' + ) end - it "routes GET /users/1/tips to Tips#index" do - expect({ :get => "/users/1/tips" }).to route_to( - :controller => "tips" , - :action => "index" , - :user_id => "1" ) + it 'routes GET /users/1/tips to Tips#index' do + expect({ get: '/users/1/tips' }).to route_to( + controller: 'tips', + action: 'index', + user_id: '1' + ) end end - describe "pretty url routing" do + describe 'pretty url routing' do let(:user) { create(:user) } - it "regex rejects reserved user paths" do + it 'regex rejects reserved user paths' do # accepted pertty url usernames - should_accept = [' ' , 'logi' , 'ogin' , 's4c2' , '42x' , 'nick name' , 'kd'] + should_accept = [' ', 'logi', 'ogin', 's4c2', '42x', 'nick name', 'kd'] # reserved routes (rejected pertty url usernames) - should_reject = ['' , '1' , '42'] + should_reject = ['', '1', '42'] - accepted = should_accept.select {|ea| ea =~ /\D+/} - rejected = should_reject.select {|ea| (ea =~ /\D+/).nil? } + accepted = should_accept.select { |ea| ea =~ /\D+/ } + rejected = should_reject.select { |ea| (ea =~ /\D+/).nil? } (expect(accepted.size).to eq(should_accept.size)) && - (expect(rejected.size).to eq(should_reject.size)) + (expect(rejected.size).to eq(should_reject.size)) end - it "routes GET /users/:nickname to User#show" do - expect({ :get => "/users/#{user.nickname}" }).to route_to( - :controller => "users" , - :action => "show" , - :nickname => "kd" ) + it 'routes GET /users/:nickname to User#show' do + expect({ get: "/users/#{user.nickname}" }).to route_to( + controller: 'users', + action: 'show', + nickname: 'kd' + ) end - it "routes GET /users/:nickname/tips to Tips#index" do - expect({ :get => "/users/#{user.nickname}/tips" }).to route_to( - :controller => "tips" , - :action => "index" , - :nickname => "kd" ) + it 'routes GET /users/:nickname/tips to Tips#index' do + expect({ get: "/users/#{user.nickname}/tips" }).to route_to( + controller: 'tips', + action: 'index', + nickname: 'kd' + ) end end end diff --git a/spec/controllers/withdrawals_controller_spec.rb b/spec/controllers/withdrawals_controller_spec.rb index 1e1cab44..d1db2351 100644 --- a/spec/controllers/withdrawals_controller_spec.rb +++ b/spec/controllers/withdrawals_controller_spec.rb @@ -1,18 +1,21 @@ +# frozen_string_literal: true + require 'spec_helper' describe WithdrawalsController, type: :controller do describe "GET 'index'" do - it "returns http success" do + it 'returns http success' do get 'index' expect(response).to be_successful end end - describe "routing" do - it "routes GET / to Withdrawals#index" do - expect({ :get => "/withdrawals" }).to route_to( - :controller => "withdrawals" , - :action => "index" ) + describe 'routing' do + it 'routes GET / to Withdrawals#index' do + expect({ get: '/withdrawals' }).to route_to( + controller: 'withdrawals', + action: 'index' + ) end end end diff --git a/spec/factories/deposit.rb b/spec/factories/deposit.rb index 6b30af0f..9c1bb01a 100644 --- a/spec/factories/deposit.rb +++ b/spec/factories/deposit.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + FactoryBot.define do factory :deposit do association(:project) diff --git a/spec/factories/project.rb b/spec/factories/project.rb index 4e77733d..a65af666 100644 --- a/spec/factories/project.rb +++ b/spec/factories/project.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + FactoryBot.define do factory :project do url { 'MyString' } diff --git a/spec/factories/sendmany.rb b/spec/factories/sendmany.rb index 4d782279..53a1823a 100644 --- a/spec/factories/sendmany.rb +++ b/spec/factories/sendmany.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + FactoryBot.define do factory :sendmany do txid { 'txid' } diff --git a/spec/factories/tip.rb b/spec/factories/tip.rb index e7877b9e..4148ec5d 100644 --- a/spec/factories/tip.rb +++ b/spec/factories/tip.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + FactoryBot.define do factory :tip do association(:user) diff --git a/spec/factories/user.rb b/spec/factories/user.rb index 0fb99524..3c639b89 100644 --- a/spec/factories/user.rb +++ b/spec/factories/user.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + FactoryBot.define do factory :user do sequence(:email) { |n| "test#{n}@gmail.com" } diff --git a/spec/factories/wallets.rb b/spec/factories/wallets.rb index f47103bd..9c2f74d9 100644 --- a/spec/factories/wallets.rb +++ b/spec/factories/wallets.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + FactoryBot.define do factory :wallet do name { 'test wallet' } diff --git a/spec/lib/blacklist_spec.rb b/spec/lib/blacklist_spec.rb index 08ab8d61..78c7e693 100644 --- a/spec/lib/blacklist_spec.rb +++ b/spec/lib/blacklist_spec.rb @@ -1,29 +1,31 @@ +# frozen_string_literal: true + require 'spec_helper' describe Blacklist do it 'handles blacklisted URLs' do urls = [ - "https://github.com/author/notips", - "https://bitbucket.org/author/notips", - "https://github.com/notips/*", - "https://bitbucket.org/notips/*", + 'https://github.com/author/notips', + 'https://bitbucket.org/author/notips', + 'https://github.com/notips/*', + 'https://bitbucket.org/notips/*' ] list = Blacklist.new(urls) # Blacklisted projects. - expect(list.include?("https://github.com/author/notips")).to eq(true) - expect(list.include?("http://github.com/author/notips?tips=true")).to eq(true) - expect(list.include?("https://bitbucket.org/author/notips")).to eq(true) - expect(list.include?("github.com/author/notips")).to eq(true) - expect(list.include?("author/notips")).to eq(true) + expect(list.include?('https://github.com/author/notips')).to eq(true) + expect(list.include?('http://github.com/author/notips?tips=true')).to eq(true) + expect(list.include?('https://bitbucket.org/author/notips')).to eq(true) + expect(list.include?('github.com/author/notips')).to eq(true) + expect(list.include?('author/notips')).to eq(true) # Non-blacklisted projects. - expect(list.include?("https://github.com/author/tipme")).to eq(false) - expect(list.include?("https://bitbucket.org/author/tipme")).to eq(false) + expect(list.include?('https://github.com/author/tipme')).to eq(false) + expect(list.include?('https://bitbucket.org/author/tipme')).to eq(false) # Blacklisted authors. - expect(list.include?("https://github.com/notips/tipme")).to eq(true) - expect(list.include?("https://bitbucket.org/notips/tipme")).to eq(true) + expect(list.include?('https://github.com/notips/tipme')).to eq(true) + expect(list.include?('https://bitbucket.org/notips/tipme')).to eq(true) end end diff --git a/spec/mailers/user_mailer_spec.rb b/spec/mailers/user_mailer_spec.rb index efe05a40..db1338d0 100644 --- a/spec/mailers/user_mailer_spec.rb +++ b/spec/mailers/user_mailer_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe UserMailer do diff --git a/spec/misc_spec.rb b/spec/misc_spec.rb index 70fa333b..e8ff2b0e 100644 --- a/spec/misc_spec.rb +++ b/spec/misc_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Misc tets' do @@ -6,7 +8,7 @@ it 'has a flag image for each locale' do locales.each do |locale| path = File.join(Rails.root, 'app', 'assets', 'images', 'flags', "#{locale}.png") - expect(File.exists?(path)).to be_truthy, "#{locale} flag is missing" + expect(File.exist?(path)).to be_truthy, "#{locale} flag is missing" end end end diff --git a/spec/models/collaborator_spec.rb b/spec/models/collaborator_spec.rb index 43f31cee..2fe276c8 100644 --- a/spec/models/collaborator_spec.rb +++ b/spec/models/collaborator_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe Collaborator, type: :model do diff --git a/spec/models/deposit_spec.rb b/spec/models/deposit_spec.rb index cd5781e7..6456520e 100644 --- a/spec/models/deposit_spec.rb +++ b/spec/models/deposit_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe Deposit, type: :model do @@ -29,11 +31,10 @@ private def with_custom_fee - old_fee = CONFIG["our_fee"] - CONFIG["our_fee"] = 0.01 + old_fee = CONFIG['our_fee'] + CONFIG['our_fee'] = 0.01 yield ensure - CONFIG["our_fee"] = old_fee + CONFIG['our_fee'] = old_fee end - end diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 91fa9a10..d72bcd79 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe Project, type: :model do @@ -16,7 +18,7 @@ it { should validate_presence_of(:host) } it { should validate_uniqueness_of(:full_name) } it { should validate_uniqueness_of(:github_id) } - it { should validate_inclusion_of(:host).in_array %w(github bitbucket) } + it { should validate_inclusion_of(:host).in_array %w[github bitbucket] } end describe 'bitcoin_address' do diff --git a/spec/models/send_many_spec.rb b/spec/models/send_many_spec.rb index 7fdcf6c7..4f1c3435 100644 --- a/spec/models/send_many_spec.rb +++ b/spec/models/send_many_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe Sendmany, type: :model do diff --git a/spec/models/sendmany_spec.rb b/spec/models/sendmany_spec.rb index 7fdcf6c7..4f1c3435 100644 --- a/spec/models/sendmany_spec.rb +++ b/spec/models/sendmany_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe Sendmany, type: :model do diff --git a/spec/models/tip_spec.rb b/spec/models/tip_spec.rb index e307006c..3bd46d4c 100644 --- a/spec/models/tip_spec.rb +++ b/spec/models/tip_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe Tip, type: :model do diff --git a/spec/models/tipping_policies_text_spec.rb b/spec/models/tipping_policies_text_spec.rb index c9f98398..869a51c2 100644 --- a/spec/models/tipping_policies_text_spec.rb +++ b/spec/models/tipping_policies_text_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe TippingPoliciesText, type: :model do diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 1381b14e..677edf84 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe User, type: :model do diff --git a/spec/models/wallet_spec.rb b/spec/models/wallet_spec.rb index c48d5118..c7ebeab9 100644 --- a/spec/models/wallet_spec.rb +++ b/spec/models/wallet_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe Wallet, type: :model do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d3706ea5..9231f65f 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,11 +1,13 @@ -require "minitest/spec" +# frozen_string_literal: true + +require 'minitest/spec' require 'simplecov' SimpleCov.start 'rails' # This file is copied to spec/ when you run 'rails generate rspec:install' -ENV["RAILS_ENV"] ||= 'test' -require File.expand_path("../../config/environment", __FILE__) +ENV['RAILS_ENV'] ||= 'test' +require File.expand_path('../config/environment', __dir__) require 'rspec/rails' # # Requires supporting ruby files with custom matchers and macros, etc, in @@ -15,7 +17,7 @@ # run twice. It is recommended that you do not name files matching this glob to # end with _spec.rb. You can configure this pattern with with the --pattern # option on the command line or in ~/.rspec, .rspec or `.rspec-local`. -Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f } +Dir[Rails.root.join('spec/support/**/*.rb')].sort.each { |f| require f } # Checks for pending migrations before tests are run. # If you are not using ActiveRecord, you can remove this line. @@ -53,7 +55,7 @@ # order dependency and want to debug it, you can fix the order by providing # the seed, which is printed after each run. # --seed 1234 - config.order = "random" + config.order = 'random' include FactoryBot::Syntax::Methods config.include Devise::Test::ControllerHelpers, type: :controller diff --git a/spec/support/controller_macros.rb b/spec/support/controller_macros.rb index d1cf5212..a29d39aa 100644 --- a/spec/support/controller_macros.rb +++ b/spec/support/controller_macros.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ControllerMacros def login_user before do From 03287b253abce3ea7eba28fb135d35920d346771 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 22 Nov 2020 12:49:24 +0100 Subject: [PATCH 324/415] fixed undefined constant error --- app/models/project.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/project.rb b/app/models/project.rb index e7380418..a984c67d 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -103,7 +103,7 @@ def new_commits reverse end rescue Octokit::BadGateway, Octokit::NotFound, Octokit::InternalServerError, Octokit::Forbidden, - Errno::ETIMEDOUT, Net::ReadTimeout, Faraday::Error::ConnectionFailed => e + Errno::ETIMEDOUT, Net::ReadTimeout, Faraday::ConnectionFailed => e Rails.logger.info "Project ##{id}: #{e.class} happened" rescue StandardError => e Airbrake.notify(e) From 9b6a0d86a5d301a66748766bb2dbae6dbf2870bf Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 22 Nov 2020 12:59:23 +0100 Subject: [PATCH 325/415] binstubs --- .rubocop.yml | 1 + bin/bundle | 114 +++++++++++++++++++++++++++++++++++ bin/cap | 29 +++++++++ bin/capify | 29 +++++++++ bin/cucumber | 29 +++++++++ bin/cucumber-tag-expressions | 29 +++++++++ bin/erubis | 29 +++++++++ bin/gherkin | 29 +++++++++ bin/gherkin-ruby | 29 +++++++++ bin/haml | 29 +++++++++ bin/html2haml | 29 +++++++++ bin/htmldiff | 29 +++++++++ bin/ldiff | 29 +++++++++ bin/lessc | 29 +++++++++ bin/nokogiri | 29 +++++++++ bin/rackup | 29 +++++++++ bin/rails | 29 +++++++++ bin/rake | 29 +++++++++ bin/rdoc | 29 +++++++++ bin/restclient | 29 +++++++++ bin/ri | 29 +++++++++ bin/rspec | 29 +++++++++ bin/rubocop | 29 +++++++++ bin/ruby-parse | 29 +++++++++ bin/ruby-rewrite | 29 +++++++++ bin/ruby_parse | 29 +++++++++ bin/ruby_parse_extract_error | 29 +++++++++ bin/sdoc | 29 +++++++++ bin/sdoc-merge | 29 +++++++++ bin/sidekiq | 29 +++++++++ bin/sidekiqmon | 29 +++++++++ bin/sprockets | 29 +++++++++ bin/thor | 29 +++++++++ bin/tilt | 29 +++++++++ 34 files changed, 1043 insertions(+) create mode 100755 bin/bundle create mode 100755 bin/cap create mode 100755 bin/capify create mode 100755 bin/cucumber create mode 100755 bin/cucumber-tag-expressions create mode 100755 bin/erubis create mode 100755 bin/gherkin create mode 100755 bin/gherkin-ruby create mode 100755 bin/haml create mode 100755 bin/html2haml create mode 100755 bin/htmldiff create mode 100755 bin/ldiff create mode 100755 bin/lessc create mode 100755 bin/nokogiri create mode 100755 bin/rackup create mode 100755 bin/rails create mode 100755 bin/rake create mode 100755 bin/rdoc create mode 100755 bin/restclient create mode 100755 bin/ri create mode 100755 bin/rspec create mode 100755 bin/rubocop create mode 100755 bin/ruby-parse create mode 100755 bin/ruby-rewrite create mode 100755 bin/ruby_parse create mode 100755 bin/ruby_parse_extract_error create mode 100755 bin/sdoc create mode 100755 bin/sdoc-merge create mode 100755 bin/sidekiq create mode 100755 bin/sidekiqmon create mode 100755 bin/sprockets create mode 100755 bin/thor create mode 100755 bin/tilt diff --git a/.rubocop.yml b/.rubocop.yml index df9ea17d..0229b48a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -6,6 +6,7 @@ AllCops: NewCops: enable Exclude: - 'db/schema.rb' + - 'bin/*' Style/Documentation: Enabled: false diff --git a/bin/bundle b/bin/bundle new file mode 100755 index 00000000..a71368e3 --- /dev/null +++ b/bin/bundle @@ -0,0 +1,114 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'bundle' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "rubygems" + +m = Module.new do + module_function + + def invoked_as_script? + File.expand_path($0) == File.expand_path(__FILE__) + end + + def env_var_version + ENV["BUNDLER_VERSION"] + end + + def cli_arg_version + return unless invoked_as_script? # don't want to hijack other binstubs + return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update` + bundler_version = nil + update_index = nil + ARGV.each_with_index do |a, i| + if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN + bundler_version = a + end + next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ + bundler_version = $1 + update_index = i + end + bundler_version + end + + def gemfile + gemfile = ENV["BUNDLE_GEMFILE"] + return gemfile if gemfile && !gemfile.empty? + + File.expand_path("../../Gemfile", __FILE__) + end + + def lockfile + lockfile = + case File.basename(gemfile) + when "gems.rb" then gemfile.sub(/\.rb$/, gemfile) + else "#{gemfile}.lock" + end + File.expand_path(lockfile) + end + + def lockfile_version + return unless File.file?(lockfile) + lockfile_contents = File.read(lockfile) + return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ + Regexp.last_match(1) + end + + def bundler_version + @bundler_version ||= + env_var_version || cli_arg_version || + lockfile_version + end + + def bundler_requirement + return "#{Gem::Requirement.default}.a" unless bundler_version + + bundler_gem_version = Gem::Version.new(bundler_version) + + requirement = bundler_gem_version.approximate_recommendation + + return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0") + + requirement += ".a" if bundler_gem_version.prerelease? + + requirement + end + + def load_bundler! + ENV["BUNDLE_GEMFILE"] ||= gemfile + + activate_bundler + end + + def activate_bundler + gem_error = activation_error_handling do + gem "bundler", bundler_requirement + end + return if gem_error.nil? + require_error = activation_error_handling do + require "bundler/version" + end + return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION)) + warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`" + exit 42 + end + + def activation_error_handling + yield + nil + rescue StandardError, LoadError => e + e + end +end + +m.load_bundler! + +if m.invoked_as_script? + load Gem.bin_path("bundler", "bundle") +end diff --git a/bin/cap b/bin/cap new file mode 100755 index 00000000..db774dc5 --- /dev/null +++ b/bin/cap @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'cap' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("capistrano", "cap") diff --git a/bin/capify b/bin/capify new file mode 100755 index 00000000..68921002 --- /dev/null +++ b/bin/capify @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'capify' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("capistrano", "capify") diff --git a/bin/cucumber b/bin/cucumber new file mode 100755 index 00000000..47845689 --- /dev/null +++ b/bin/cucumber @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'cucumber' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("cucumber", "cucumber") diff --git a/bin/cucumber-tag-expressions b/bin/cucumber-tag-expressions new file mode 100755 index 00000000..4ade386a --- /dev/null +++ b/bin/cucumber-tag-expressions @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'cucumber-tag-expressions' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("cucumber-tag_expressions", "cucumber-tag-expressions") diff --git a/bin/erubis b/bin/erubis new file mode 100755 index 00000000..efd41a1c --- /dev/null +++ b/bin/erubis @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'erubis' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("erubis", "erubis") diff --git a/bin/gherkin b/bin/gherkin new file mode 100755 index 00000000..e8115aaa --- /dev/null +++ b/bin/gherkin @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'gherkin' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("gherkin", "gherkin") diff --git a/bin/gherkin-ruby b/bin/gherkin-ruby new file mode 100755 index 00000000..c3bc973f --- /dev/null +++ b/bin/gherkin-ruby @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'gherkin-ruby' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("gherkin", "gherkin-ruby") diff --git a/bin/haml b/bin/haml new file mode 100755 index 00000000..2cc42c7e --- /dev/null +++ b/bin/haml @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'haml' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("haml", "haml") diff --git a/bin/html2haml b/bin/html2haml new file mode 100755 index 00000000..02fc2699 --- /dev/null +++ b/bin/html2haml @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'html2haml' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("html2haml", "html2haml") diff --git a/bin/htmldiff b/bin/htmldiff new file mode 100755 index 00000000..091820c9 --- /dev/null +++ b/bin/htmldiff @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'htmldiff' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("diff-lcs", "htmldiff") diff --git a/bin/ldiff b/bin/ldiff new file mode 100755 index 00000000..073e19f2 --- /dev/null +++ b/bin/ldiff @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'ldiff' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("diff-lcs", "ldiff") diff --git a/bin/lessc b/bin/lessc new file mode 100755 index 00000000..62ad40c6 --- /dev/null +++ b/bin/lessc @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'lessc' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("less", "lessc") diff --git a/bin/nokogiri b/bin/nokogiri new file mode 100755 index 00000000..b22a1a0a --- /dev/null +++ b/bin/nokogiri @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'nokogiri' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("nokogiri", "nokogiri") diff --git a/bin/rackup b/bin/rackup new file mode 100755 index 00000000..3ac4a5a7 --- /dev/null +++ b/bin/rackup @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'rackup' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rack", "rackup") diff --git a/bin/rails b/bin/rails new file mode 100755 index 00000000..7fd59cc7 --- /dev/null +++ b/bin/rails @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'rails' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("railties", "rails") diff --git a/bin/rake b/bin/rake new file mode 100755 index 00000000..9275675e --- /dev/null +++ b/bin/rake @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'rake' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rake", "rake") diff --git a/bin/rdoc b/bin/rdoc new file mode 100755 index 00000000..a952e798 --- /dev/null +++ b/bin/rdoc @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'rdoc' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rdoc", "rdoc") diff --git a/bin/restclient b/bin/restclient new file mode 100755 index 00000000..6cff4172 --- /dev/null +++ b/bin/restclient @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'restclient' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rest-client", "restclient") diff --git a/bin/ri b/bin/ri new file mode 100755 index 00000000..2c93cf92 --- /dev/null +++ b/bin/ri @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'ri' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rdoc", "ri") diff --git a/bin/rspec b/bin/rspec new file mode 100755 index 00000000..a6c78521 --- /dev/null +++ b/bin/rspec @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'rspec' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rspec-core", "rspec") diff --git a/bin/rubocop b/bin/rubocop new file mode 100755 index 00000000..d0c48829 --- /dev/null +++ b/bin/rubocop @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'rubocop' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rubocop", "rubocop") diff --git a/bin/ruby-parse b/bin/ruby-parse new file mode 100755 index 00000000..74d87beb --- /dev/null +++ b/bin/ruby-parse @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'ruby-parse' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("parser", "ruby-parse") diff --git a/bin/ruby-rewrite b/bin/ruby-rewrite new file mode 100755 index 00000000..972bc456 --- /dev/null +++ b/bin/ruby-rewrite @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'ruby-rewrite' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("parser", "ruby-rewrite") diff --git a/bin/ruby_parse b/bin/ruby_parse new file mode 100755 index 00000000..56d914e9 --- /dev/null +++ b/bin/ruby_parse @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'ruby_parse' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("ruby_parser", "ruby_parse") diff --git a/bin/ruby_parse_extract_error b/bin/ruby_parse_extract_error new file mode 100755 index 00000000..da559731 --- /dev/null +++ b/bin/ruby_parse_extract_error @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'ruby_parse_extract_error' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("ruby_parser", "ruby_parse_extract_error") diff --git a/bin/sdoc b/bin/sdoc new file mode 100755 index 00000000..b84b0e42 --- /dev/null +++ b/bin/sdoc @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'sdoc' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("sdoc", "sdoc") diff --git a/bin/sdoc-merge b/bin/sdoc-merge new file mode 100755 index 00000000..10832b99 --- /dev/null +++ b/bin/sdoc-merge @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'sdoc-merge' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("sdoc", "sdoc-merge") diff --git a/bin/sidekiq b/bin/sidekiq new file mode 100755 index 00000000..9e754999 --- /dev/null +++ b/bin/sidekiq @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'sidekiq' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("sidekiq", "sidekiq") diff --git a/bin/sidekiqmon b/bin/sidekiqmon new file mode 100755 index 00000000..fedda51c --- /dev/null +++ b/bin/sidekiqmon @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'sidekiqmon' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("sidekiq", "sidekiqmon") diff --git a/bin/sprockets b/bin/sprockets new file mode 100755 index 00000000..9f75aa74 --- /dev/null +++ b/bin/sprockets @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'sprockets' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("sprockets", "sprockets") diff --git a/bin/thor b/bin/thor new file mode 100755 index 00000000..71bfaeae --- /dev/null +++ b/bin/thor @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'thor' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("thor", "thor") diff --git a/bin/tilt b/bin/tilt new file mode 100755 index 00000000..34f7bcaa --- /dev/null +++ b/bin/tilt @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'tilt' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("tilt", "tilt") From bdd19d7ca46175ecee4f4290a1341a966a8e06fe Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 22 Nov 2020 13:02:31 +0100 Subject: [PATCH 326/415] fixed search pagination --- app/helpers/projects_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 661ec155..c8e38e03 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -40,6 +40,6 @@ def shield_url(project) end def permitted_params - params.permit(:order, :page) + params.permit(:order, :page, :query, :utf8) end end From a9a83d9f062baef8952526a1fcb5ae6701536aca Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 22 Nov 2020 13:08:56 +0100 Subject: [PATCH 327/415] fixed binstub --- bin/bundle | 115 +---------------------------------- bin/cap | 29 --------- bin/capify | 29 --------- bin/cucumber | 29 --------- bin/cucumber-tag-expressions | 29 --------- bin/erubis | 29 --------- bin/gherkin | 29 --------- bin/gherkin-ruby | 29 --------- bin/haml | 29 --------- bin/html2haml | 29 --------- bin/htmldiff | 29 --------- bin/ldiff | 29 --------- bin/lessc | 29 --------- bin/nokogiri | 29 --------- bin/rackup | 29 --------- bin/rails | 31 +--------- bin/rake | 31 +--------- bin/rdoc | 29 --------- bin/restclient | 29 --------- bin/ri | 29 --------- bin/rspec | 29 --------- bin/rubocop | 29 --------- bin/ruby-parse | 29 --------- bin/ruby-rewrite | 29 --------- bin/ruby_parse | 29 --------- bin/ruby_parse_extract_error | 29 --------- bin/sdoc | 29 --------- bin/sdoc-merge | 29 --------- bin/setup | 36 +++++++++++ bin/sidekiq | 29 --------- bin/sidekiqmon | 29 --------- bin/sprockets | 29 --------- bin/thor | 29 --------- bin/tilt | 29 --------- bin/update | 31 ++++++++++ bin/yarn | 11 ++++ 36 files changed, 86 insertions(+), 1039 deletions(-) delete mode 100755 bin/cap delete mode 100755 bin/capify delete mode 100755 bin/cucumber delete mode 100755 bin/cucumber-tag-expressions delete mode 100755 bin/erubis delete mode 100755 bin/gherkin delete mode 100755 bin/gherkin-ruby delete mode 100755 bin/haml delete mode 100755 bin/html2haml delete mode 100755 bin/htmldiff delete mode 100755 bin/ldiff delete mode 100755 bin/lessc delete mode 100755 bin/nokogiri delete mode 100755 bin/rackup delete mode 100755 bin/rdoc delete mode 100755 bin/restclient delete mode 100755 bin/ri delete mode 100755 bin/rspec delete mode 100755 bin/rubocop delete mode 100755 bin/ruby-parse delete mode 100755 bin/ruby-rewrite delete mode 100755 bin/ruby_parse delete mode 100755 bin/ruby_parse_extract_error delete mode 100755 bin/sdoc delete mode 100755 bin/sdoc-merge create mode 100755 bin/setup delete mode 100755 bin/sidekiq delete mode 100755 bin/sidekiqmon delete mode 100755 bin/sprockets delete mode 100755 bin/thor delete mode 100755 bin/tilt create mode 100755 bin/update create mode 100755 bin/yarn diff --git a/bin/bundle b/bin/bundle index a71368e3..f19acf5b 100755 --- a/bin/bundle +++ b/bin/bundle @@ -1,114 +1,3 @@ #!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'bundle' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "rubygems" - -m = Module.new do - module_function - - def invoked_as_script? - File.expand_path($0) == File.expand_path(__FILE__) - end - - def env_var_version - ENV["BUNDLER_VERSION"] - end - - def cli_arg_version - return unless invoked_as_script? # don't want to hijack other binstubs - return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update` - bundler_version = nil - update_index = nil - ARGV.each_with_index do |a, i| - if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN - bundler_version = a - end - next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ - bundler_version = $1 - update_index = i - end - bundler_version - end - - def gemfile - gemfile = ENV["BUNDLE_GEMFILE"] - return gemfile if gemfile && !gemfile.empty? - - File.expand_path("../../Gemfile", __FILE__) - end - - def lockfile - lockfile = - case File.basename(gemfile) - when "gems.rb" then gemfile.sub(/\.rb$/, gemfile) - else "#{gemfile}.lock" - end - File.expand_path(lockfile) - end - - def lockfile_version - return unless File.file?(lockfile) - lockfile_contents = File.read(lockfile) - return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ - Regexp.last_match(1) - end - - def bundler_version - @bundler_version ||= - env_var_version || cli_arg_version || - lockfile_version - end - - def bundler_requirement - return "#{Gem::Requirement.default}.a" unless bundler_version - - bundler_gem_version = Gem::Version.new(bundler_version) - - requirement = bundler_gem_version.approximate_recommendation - - return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0") - - requirement += ".a" if bundler_gem_version.prerelease? - - requirement - end - - def load_bundler! - ENV["BUNDLE_GEMFILE"] ||= gemfile - - activate_bundler - end - - def activate_bundler - gem_error = activation_error_handling do - gem "bundler", bundler_requirement - end - return if gem_error.nil? - require_error = activation_error_handling do - require "bundler/version" - end - return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION)) - warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`" - exit 42 - end - - def activation_error_handling - yield - nil - rescue StandardError, LoadError => e - e - end -end - -m.load_bundler! - -if m.invoked_as_script? - load Gem.bin_path("bundler", "bundle") -end +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) +load Gem.bin_path('bundler', 'bundle') diff --git a/bin/cap b/bin/cap deleted file mode 100755 index db774dc5..00000000 --- a/bin/cap +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'cap' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("capistrano", "cap") diff --git a/bin/capify b/bin/capify deleted file mode 100755 index 68921002..00000000 --- a/bin/capify +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'capify' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("capistrano", "capify") diff --git a/bin/cucumber b/bin/cucumber deleted file mode 100755 index 47845689..00000000 --- a/bin/cucumber +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'cucumber' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("cucumber", "cucumber") diff --git a/bin/cucumber-tag-expressions b/bin/cucumber-tag-expressions deleted file mode 100755 index 4ade386a..00000000 --- a/bin/cucumber-tag-expressions +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'cucumber-tag-expressions' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("cucumber-tag_expressions", "cucumber-tag-expressions") diff --git a/bin/erubis b/bin/erubis deleted file mode 100755 index efd41a1c..00000000 --- a/bin/erubis +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'erubis' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("erubis", "erubis") diff --git a/bin/gherkin b/bin/gherkin deleted file mode 100755 index e8115aaa..00000000 --- a/bin/gherkin +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'gherkin' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("gherkin", "gherkin") diff --git a/bin/gherkin-ruby b/bin/gherkin-ruby deleted file mode 100755 index c3bc973f..00000000 --- a/bin/gherkin-ruby +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'gherkin-ruby' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("gherkin", "gherkin-ruby") diff --git a/bin/haml b/bin/haml deleted file mode 100755 index 2cc42c7e..00000000 --- a/bin/haml +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'haml' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("haml", "haml") diff --git a/bin/html2haml b/bin/html2haml deleted file mode 100755 index 02fc2699..00000000 --- a/bin/html2haml +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'html2haml' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("html2haml", "html2haml") diff --git a/bin/htmldiff b/bin/htmldiff deleted file mode 100755 index 091820c9..00000000 --- a/bin/htmldiff +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'htmldiff' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("diff-lcs", "htmldiff") diff --git a/bin/ldiff b/bin/ldiff deleted file mode 100755 index 073e19f2..00000000 --- a/bin/ldiff +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'ldiff' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("diff-lcs", "ldiff") diff --git a/bin/lessc b/bin/lessc deleted file mode 100755 index 62ad40c6..00000000 --- a/bin/lessc +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'lessc' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("less", "lessc") diff --git a/bin/nokogiri b/bin/nokogiri deleted file mode 100755 index b22a1a0a..00000000 --- a/bin/nokogiri +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'nokogiri' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("nokogiri", "nokogiri") diff --git a/bin/rackup b/bin/rackup deleted file mode 100755 index 3ac4a5a7..00000000 --- a/bin/rackup +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'rackup' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("rack", "rackup") diff --git a/bin/rails b/bin/rails index 7fd59cc7..07396602 100755 --- a/bin/rails +++ b/bin/rails @@ -1,29 +1,4 @@ #!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'rails' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("railties", "rails") +APP_PATH = File.expand_path('../config/application', __dir__) +require_relative '../config/boot' +require 'rails/commands' diff --git a/bin/rake b/bin/rake index 9275675e..17240489 100755 --- a/bin/rake +++ b/bin/rake @@ -1,29 +1,4 @@ #!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'rake' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("rake", "rake") +require_relative '../config/boot' +require 'rake' +Rake.application.run diff --git a/bin/rdoc b/bin/rdoc deleted file mode 100755 index a952e798..00000000 --- a/bin/rdoc +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'rdoc' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("rdoc", "rdoc") diff --git a/bin/restclient b/bin/restclient deleted file mode 100755 index 6cff4172..00000000 --- a/bin/restclient +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'restclient' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("rest-client", "restclient") diff --git a/bin/ri b/bin/ri deleted file mode 100755 index 2c93cf92..00000000 --- a/bin/ri +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'ri' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("rdoc", "ri") diff --git a/bin/rspec b/bin/rspec deleted file mode 100755 index a6c78521..00000000 --- a/bin/rspec +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'rspec' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("rspec-core", "rspec") diff --git a/bin/rubocop b/bin/rubocop deleted file mode 100755 index d0c48829..00000000 --- a/bin/rubocop +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'rubocop' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("rubocop", "rubocop") diff --git a/bin/ruby-parse b/bin/ruby-parse deleted file mode 100755 index 74d87beb..00000000 --- a/bin/ruby-parse +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'ruby-parse' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("parser", "ruby-parse") diff --git a/bin/ruby-rewrite b/bin/ruby-rewrite deleted file mode 100755 index 972bc456..00000000 --- a/bin/ruby-rewrite +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'ruby-rewrite' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("parser", "ruby-rewrite") diff --git a/bin/ruby_parse b/bin/ruby_parse deleted file mode 100755 index 56d914e9..00000000 --- a/bin/ruby_parse +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'ruby_parse' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("ruby_parser", "ruby_parse") diff --git a/bin/ruby_parse_extract_error b/bin/ruby_parse_extract_error deleted file mode 100755 index da559731..00000000 --- a/bin/ruby_parse_extract_error +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'ruby_parse_extract_error' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("ruby_parser", "ruby_parse_extract_error") diff --git a/bin/sdoc b/bin/sdoc deleted file mode 100755 index b84b0e42..00000000 --- a/bin/sdoc +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'sdoc' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("sdoc", "sdoc") diff --git a/bin/sdoc-merge b/bin/sdoc-merge deleted file mode 100755 index 10832b99..00000000 --- a/bin/sdoc-merge +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'sdoc-merge' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("sdoc", "sdoc-merge") diff --git a/bin/setup b/bin/setup new file mode 100755 index 00000000..94fd4d79 --- /dev/null +++ b/bin/setup @@ -0,0 +1,36 @@ +#!/usr/bin/env ruby +require 'fileutils' +include FileUtils + +# path to your application root. +APP_ROOT = File.expand_path('..', __dir__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do + # This script is a starting point to setup your application. + # Add necessary setup steps to this file. + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') + + # Install JavaScript dependencies if using Yarn + # system('bin/yarn') + + # puts "\n== Copying sample files ==" + # unless File.exist?('config/database.yml') + # cp 'config/database.yml.sample', 'config/database.yml' + # end + + puts "\n== Preparing database ==" + system! 'bin/rails db:setup' + + puts "\n== Removing old logs and tempfiles ==" + system! 'bin/rails log:clear tmp:clear' + + puts "\n== Restarting application server ==" + system! 'bin/rails restart' +end diff --git a/bin/sidekiq b/bin/sidekiq deleted file mode 100755 index 9e754999..00000000 --- a/bin/sidekiq +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'sidekiq' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("sidekiq", "sidekiq") diff --git a/bin/sidekiqmon b/bin/sidekiqmon deleted file mode 100755 index fedda51c..00000000 --- a/bin/sidekiqmon +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'sidekiqmon' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("sidekiq", "sidekiqmon") diff --git a/bin/sprockets b/bin/sprockets deleted file mode 100755 index 9f75aa74..00000000 --- a/bin/sprockets +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'sprockets' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("sprockets", "sprockets") diff --git a/bin/thor b/bin/thor deleted file mode 100755 index 71bfaeae..00000000 --- a/bin/thor +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'thor' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("thor", "thor") diff --git a/bin/tilt b/bin/tilt deleted file mode 100755 index 34f7bcaa..00000000 --- a/bin/tilt +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'tilt' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("tilt", "tilt") diff --git a/bin/update b/bin/update new file mode 100755 index 00000000..58bfaed5 --- /dev/null +++ b/bin/update @@ -0,0 +1,31 @@ +#!/usr/bin/env ruby +require 'fileutils' +include FileUtils + +# path to your application root. +APP_ROOT = File.expand_path('..', __dir__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do + # This script is a way to update your development environment automatically. + # Add necessary update steps to this file. + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') + + # Install JavaScript dependencies if using Yarn + # system('bin/yarn') + + puts "\n== Updating database ==" + system! 'bin/rails db:migrate' + + puts "\n== Removing old logs and tempfiles ==" + system! 'bin/rails log:clear tmp:clear' + + puts "\n== Restarting application server ==" + system! 'bin/rails restart' +end diff --git a/bin/yarn b/bin/yarn new file mode 100755 index 00000000..460dd565 --- /dev/null +++ b/bin/yarn @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby +APP_ROOT = File.expand_path('..', __dir__) +Dir.chdir(APP_ROOT) do + begin + exec "yarnpkg", *ARGV + rescue Errno::ENOENT + $stderr.puts "Yarn executable was not detected in the system." + $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" + exit 1 + end +end From 10169800e334e9519b6d8a80a4ad42ef7db1a72e Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 22 Nov 2020 13:22:16 +0100 Subject: [PATCH 328/415] fixed bitcointalk link --- README.md | 2 +- README_ES.md | 2 +- README_PT.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 478adcff..3bfda6b4 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Donate bitcoins to open source projects or receive tips for code contributions. Name | Link ----|----| Official site | https://tip4commit.com/ -Discussions | https://bitcointalk.org/index.php?topic=31580 +Discussions | https://bitcointalk.org/index.php?topic=315802.0 FAQs | https://github.com/tip4commit/tip4commit/wiki/FAQ Issues | https://github.com/tip4commit/tip4commit/issues Twitter | https://twitter.com/tip4commit diff --git a/README_ES.md b/README_ES.md index 883cec0b..8fc65267 100644 --- a/README_ES.md +++ b/README_ES.md @@ -9,7 +9,7 @@ Dona Bitcoins a proyectos de código abierto o recibe propinas contribuciones de Nombre | Enlace ----|----| Sitio Oficial| https://tip4commit.com/ -Discusiones| https://bitcointalk.org/index.php?topic=31580 +Discusiones| https://bitcointalk.org/index.php?topic=315802.0 Preguntas Frecuentes | https://github.com/tip4commit/tip4commit/wiki/FAQ Problemas| https://github.com/tip4commit/tip4commit/issues diff --git a/README_PT.md b/README_PT.md index b285827e..b931775c 100644 --- a/README_PT.md +++ b/README_PT.md @@ -9,7 +9,7 @@ Doe bitcoins para projetos de código aberto ou receba gorjetas por colaborar no Nome | Ligação ----|----| Site oficial| https://tip4commit.com/ -Discussões | https://bitcointalk.org/index.php?topic=31580 +Discussões | https://bitcointalk.org/index.php?topic=315802.0 FAQs | https://github.com/tip4commit/tip4commit/wiki/FAQ Problemas | https://github.com/tip4commit/tip4commit/issues From 0ee39490bdbd513fd57be3f5fb15a3062e0854ba Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 22 Nov 2020 13:25:52 +0100 Subject: [PATCH 329/415] fixed uninitialized constant Faraday::Error::ConnectionFailed --- app/models/project.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/project.rb b/app/models/project.rb index a984c67d..154138d7 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -183,7 +183,7 @@ def update_info update_repository_info(repository_info) update_collaborators(collaborators_info) rescue Octokit::BadGateway, Octokit::NotFound, Octokit::InternalServerError, Octokit::Forbidden, - Errno::ETIMEDOUT, Net::ReadTimeout, Faraday::Error::ConnectionFailed => e + Errno::ETIMEDOUT, Net::ReadTimeout, Faraday::ConnectionFailed => e Rails.logger.info "Project ##{id}: #{e.class} happened" rescue StandardError => e Airbrake.notify(e) From b3e17b5b6ca65b567469d78f7e901abb5b0fb666 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Fri, 27 Nov 2020 10:28:30 +0100 Subject: [PATCH 330/415] mitigate CVE-2015-9284 --- Gemfile | 1 + Gemfile.lock | 4 +++ app/views/devise/shared/_links.haml | 2 +- .../requests/cve_2005_9284_regression_spec.rb | 30 +++++++++++++++++++ 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 spec/requests/cve_2005_9284_regression_spec.rb diff --git a/Gemfile b/Gemfile index ae6cf86f..f2c465e3 100644 --- a/Gemfile +++ b/Gemfile @@ -31,6 +31,7 @@ gem 'mysql2', group: :production gem 'octokit' gem 'omniauth' gem 'omniauth-github' +gem 'omniauth-rails_csrf_protection', '~> 0.1' gem 'rails-i18n' gem 'render_csv' gem 'rest-client' diff --git a/Gemfile.lock b/Gemfile.lock index 8446f023..34ed5444 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -258,6 +258,9 @@ GEM omniauth-oauth2 (1.7.0) oauth2 (~> 1.4) omniauth (~> 1.9) + omniauth-rails_csrf_protection (0.1.2) + actionpack (>= 4.2) + omniauth (>= 1.3.1) orm_adapter (0.5.0) parallel (1.20.0) parser (2.7.2.0) @@ -464,6 +467,7 @@ DEPENDENCIES octokit omniauth omniauth-github + omniauth-rails_csrf_protection (~> 0.1) rails (= 5.2.4.4) rails-controller-testing rails-i18n diff --git a/app/views/devise/shared/_links.haml b/app/views/devise/shared/_links.haml index 122a6754..bac403da 100644 --- a/app/views/devise/shared/_links.haml +++ b/app/views/devise/shared/_links.haml @@ -15,5 +15,5 @@ %br/ - if devise_mapping.omniauthable? - resource_class.omniauth_providers.each do |provider| - = link_to t('devise.links.sign_in_with', provider: provider.to_s.titleize), omniauth_authorize_path(resource_name, provider) + = link_to t('devise.links.sign_in_with', provider: provider.to_s.titleize), omniauth_authorize_path(resource_name, provider), method: :post %br/ diff --git a/spec/requests/cve_2005_9284_regression_spec.rb b/spec/requests/cve_2005_9284_regression_spec.rb new file mode 100644 index 00000000..6d6b82ea --- /dev/null +++ b/spec/requests/cve_2005_9284_regression_spec.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +require 'spec_helper' + +# Make sure that https://nvd.nist.gov/vuln/detail/CVE-2015-9284 is mitigated +describe 'CVE-2015-9284', type: :request do + describe 'GET /auth/:provider' do + it do + get '/users/auth/github' + expect(response).not_to have_http_status(:redirect) + end + end + + describe 'POST /auth/:provider without CSRF token' do + before do + @allow_forgery_protection = ActionController::Base.allow_forgery_protection + ActionController::Base.allow_forgery_protection = true + end + + it do + expect do + post '/users/auth/github' + end.to raise_error(ActionController::InvalidAuthenticityToken) + end + + after do + ActionController::Base.allow_forgery_protection = @allow_forgery_protection + end + end +end From d1354ba206b3a842935b7e4ed2dee474890af254 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Fri, 27 Nov 2020 14:19:51 +0100 Subject: [PATCH 331/415] fixed rubocop warnings --- .rubocop_todo.yml | 16 ++++--------- app/controllers/application_controller.rb | 29 ++++++++++------------- app/controllers/projects_controller.rb | 17 +++++++------ app/services/github.rb | 25 +++++++++---------- 4 files changed, 38 insertions(+), 49 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 89ff7e02..88bc7f47 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,19 +1,11 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2020-11-22 09:26:39 UTC using RuboCop version 1.3.1. +# on 2020-11-27 13:19:11 UTC using RuboCop version 1.3.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 3 -# Configuration parameters: AllowSafeAssignment. -Lint/AssignmentInCondition: - Exclude: - - 'app/controllers/application_controller.rb' - - 'app/controllers/projects_controller.rb' - - 'app/services/github.rb' - # Offense count: 1 # Configuration parameters: AllowComments, AllowEmptyLambdas. Lint/EmptyBlock: @@ -44,7 +36,7 @@ Lint/UselessAssignment: - 'app/models/user.rb' - 'features/step_definitions/common.rb' -# Offense count: 20 +# Offense count: 18 # Configuration parameters: IgnoredMethods. Metrics/AbcSize: Max: 67 @@ -65,7 +57,7 @@ Metrics/ClassLength: Metrics/CyclomaticComplexity: Max: 29 -# Offense count: 25 +# Offense count: 23 # Configuration parameters: CountComments, CountAsOne, ExcludedMethods. Metrics/MethodLength: Max: 56 @@ -130,7 +122,7 @@ Style/FormatString: Exclude: - 'app/helpers/projects_helper.rb' -# Offense count: 9 +# Offense count: 8 # Configuration parameters: MinBodyLength. Style/GuardClause: Exclude: diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index be20945d..b27a2bdd 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -14,24 +14,21 @@ class ApplicationController < ActionController::Base private def load_locale - if params[:locale] && ::Rails.application.config.available_locales.include?(params[:locale]) - I18n.locale = session[:locale] = params[:locale].to_sym - begin - redirect_to :back - rescue StandardError - true - end - elsif session[:locale] - I18n.locale = session[:locale] - elsif l = language_from_http_accept_language - I18n.locale = session[:locale] = l - end + locale = locale_from_params || session[:locale] || locale_from_http_accept_language + I18n.locale = session[:locale] = locale + + redirect_back(fallback_location: root_path) if params[:locale].present? + end + + def locale_from_params + return unless params[:locale] + return unless ::Rails.application.config.available_locales.include?(params[:locale]) + + params[:locale].to_sym end - def language_from_http_accept_language - http_accept_language.compatible_language_from(::Rails.application.config.available_locales).to_sym - rescue StandardError - nil + def locale_from_http_accept_language + http_accept_language.compatible_language_from(::Rails.application.config.available_locales)&.to_sym end def load_project(params) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 457236e2..6762a954 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -13,16 +13,15 @@ def index end def search - if params[:query].present? - if BLACKLIST.include?(params[:query]) - render :blacklisted and return - elsif project = Project.find_by_url(params[:query]) - redirect_to pretty_project_path(project) and return - end - end + query = params[:query] || '' + + return render(:blacklisted) if BLACKLIST.include?(query) + + project = Project.find_by_url(query) + return redirect_to(pretty_project_path(project)) if project - @projects = Project.search(params[:query].to_s).order(projects_order).page(params[:page]).per(30) - render :index + @projects = Project.search(query).order(projects_order).page(params[:page]).per(30) + render(:index) end def show diff --git a/app/services/github.rb b/app/services/github.rb index 073f4c22..302a02b5 100644 --- a/app/services/github.rb +++ b/app/services/github.rb @@ -48,24 +48,25 @@ def repository_info(project) end def find_or_create_project(project_name) - if project = find_project(project_name) - project - elsif project_name =~ %r{\w+/\w+} - begin - repo = repository_info project_name - project = Project.find_or_create_by host: 'github', full_name: repo.full_name - project.update_repository_info repo - project - rescue Octokit::NotFound - nil - end - end + find_project(project_name) || create_project(project_name) end def find_project(project_name) Project.find_by(host: 'github', full_name: project_name) end + def create_project(project_name) + project_name =~ %r{\w+/\w+} + return unless project_name + + repo = repository_info(project_name) + project = Project.find_or_create_by(host: 'github', full_name: repo.full_name) + project.update_repository_info(repo) + project + rescue Octokit::NotFound + nil + end + def collaborators_info(project) begin client.get("/repos/#{project.full_name}/collaborators").map(&:login) From 4d54b574f726ce4300e33e05b5c55c885c2d38e8 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Fri, 27 Nov 2020 17:38:44 +0100 Subject: [PATCH 332/415] rubocop fixes --- .rubocop_todo.yml | 46 ++------------------------ app/controllers/projects_controller.rb | 21 +++++------- app/controllers/users_controller.rb | 13 +++----- app/models/project.rb | 2 +- app/models/user.rb | 4 +-- app/views/projects/show.html.haml | 4 +-- features/step_definitions/common.rb | 10 ++---- lib/bitcoin_address_validator.rb | 6 ++-- lib/bitcoin_rpc.rb | 6 +--- lib/tasks/cucumber.rake | 3 +- 10 files changed, 30 insertions(+), 85 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 88bc7f47..1e374245 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,41 +1,16 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2020-11-27 13:19:11 UTC using RuboCop version 1.3.1. +# on 2020-11-27 16:36:50 UTC using RuboCop version 1.3.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 1 -# Configuration parameters: AllowComments, AllowEmptyLambdas. -Lint/EmptyBlock: - Exclude: - - 'lib/tasks/cucumber.rake' - # Offense count: 1 Lint/MissingSuper: Exclude: - 'lib/bitcoin_rpc.rb' -# Offense count: 2 -# Configuration parameters: AllowComments. -Lint/SuppressedException: - Exclude: - - 'app/controllers/projects_controller.rb' - - 'app/controllers/users_controller.rb' - -# Offense count: 1 -Lint/UriEscapeUnescape: - Exclude: - - 'features/step_definitions/common.rb' - -# Offense count: 4 -Lint/UselessAssignment: - Exclude: - - 'app/models/project.rb' - - 'app/models/user.rb' - - 'features/step_definitions/common.rb' - # Offense count: 18 # Configuration parameters: IgnoredMethods. Metrics/AbcSize: @@ -57,7 +32,7 @@ Metrics/ClassLength: Metrics/CyclomaticComplexity: Max: 29 -# Offense count: 23 +# Offense count: 22 # Configuration parameters: CountComments, CountAsOne, ExcludedMethods. Metrics/MethodLength: Max: 56 @@ -72,23 +47,6 @@ Metrics/ModuleLength: Metrics/PerceivedComplexity: Max: 31 -# Offense count: 1 -Naming/AccessorMethodName: - Exclude: - - 'lib/bitcoin_rpc.rb' - -# Offense count: 1 -Naming/ConstantName: - Exclude: - - 'lib/bitcoin_address_validator.rb' - -# Offense count: 1 -# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. -# AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to -Naming/MethodParameterName: - Exclude: - - 'lib/bitcoin_rpc.rb' - # Offense count: 1 # Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros. # NamePrefix: is_, has_, have_ diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 6762a954..725c223e 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -91,19 +91,16 @@ def projects_order def redirect_to_pretty_url return unless request.get? && params[:id].present? - begin - respond_to do |format| - case action_name - when 'show' - path = pretty_project_path @project - when 'edit' - path = pretty_project_edit_path @project - when 'decide_tip_amounts' - path = pretty_project_decide_tip_amounts_path @project - end - format.html { redirect_to path } + respond_to do |format| + case action_name + when 'show' + path = pretty_project_path(@project) + when 'edit' + path = pretty_project_edit_path(@project) + when 'decide_tip_amounts' + path = pretty_project_decide_tip_amounts_path(@project) end - rescue ActionController::UnknownFormat + format.html { redirect_to path } end end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index e871bf9e..07c4e987 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -66,15 +66,12 @@ def valid_user! def redirect_to_pretty_url return unless request.get? && params[:id].present? && @user.nickname.present? - begin - respond_to do |format| - case action_name - when 'show' - path = user_pretty_path @user.nickname - end - format.html { redirect_to path } + respond_to do |format| + case action_name + when 'show' + path = user_pretty_path @user.nickname end - rescue ActionController::UnknownFormat + format.html { redirect_to path } end end end diff --git a/app/models/project.rb b/app/models/project.rb index 154138d7..7dc30182 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -168,7 +168,7 @@ def tips_paid_unclaimed_amount def next_tip_amount next_tip_amount = (CONFIG['tip'] * available_amount).ceil next_tip_amount = [next_tip_amount, CONFIG['min_tip']].max if CONFIG['min_tip'] - next_tip_amount = [next_tip_amount, available_amount].min + [next_tip_amount, available_amount].min end def update_cache diff --git a/app/models/user.rb b/app/models/user.rb index 30cdf25e..04953db2 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -32,13 +32,13 @@ def denom def gravatar_bitcoin gravatar.get_value :currency, :bitcoin - rescue URI::InvalidURIError, NoMethodError => e + rescue URI::InvalidURIError, NoMethodError nil end def gravatar_display_name gravatar.get_value :displayName - rescue URI::InvalidURIError, NoMethodError => e + rescue URI::InvalidURIError, NoMethodError nil end diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index ff1f2424..ccbab702 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -15,9 +15,9 @@ .pull-right - if @project.collaborators.empty? = t('.fetch_pending') - - if can? :update, @project + - if can?(:update, @project) = link_to t('.edit_project'), pretty_project_edit_path(@project), class: "btn btn-primary" - - if can? :decide_tip_amounts, @project and @project.has_undecided_tips? + - if can?(:decide_tip_amounts, @project) && @project.has_undecided_tips? = link_to t('.decide_tip_amounts'), pretty_project_decide_tip_amounts_path(@project), class: "btn btn-warning" .row diff --git a/features/step_definitions/common.rb b/features/step_definitions/common.rb index 07d7f228..03a29c01 100644 --- a/features/step_definitions/common.rb +++ b/features/step_definitions/common.rb @@ -102,7 +102,7 @@ def parse_path_from_page_string(page_string) end end - path || (raise 'unknown page') + path || page_string end Given(/^I visit the "(.*?)" page$/) do |page_string| @@ -114,12 +114,8 @@ def parse_path_from_page_string(page_string) end Then(/^I should be on the "(.*?)" page$/) do |page_string| - expected = begin - parse_path_from_page_string(page_string) - rescue StandardError - expected = page_string - end - actual = URI.decode(page.current_path) + expected = parse_path_from_page_string(page_string) + actual = CGI.unescape(page.current_path) expected = expected.chop if (expected.end_with? '/') && (expected.size > 1) actual = actual.chop if (actual.end_with? '/') && (actual.size > 1) diff --git a/lib/bitcoin_address_validator.rb b/lib/bitcoin_address_validator.rb index 5b0bbd25..577a0f59 100644 --- a/lib/bitcoin_address_validator.rb +++ b/lib/bitcoin_address_validator.rb @@ -33,8 +33,8 @@ def parse_segwit_address(addr) raise end - B58Chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' - B58Base = B58Chars.length + B58_CHARS = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' + B58_BASE = B58_CHARS.length EXPECTED_VERSIONS = { mainnet: [0, 5], @@ -71,7 +71,7 @@ def b58_decode(value, length) result = '' value.reverse.each_char do |c| - long_value += B58Chars.index(c) * (B58Base**index) + long_value += B58_CHARS.index(c) * (B58_BASE**index) index += 1 end diff --git a/lib/bitcoin_rpc.rb b/lib/bitcoin_rpc.rb index c245984a..e7591205 100644 --- a/lib/bitcoin_rpc.rb +++ b/lib/bitcoin_rpc.rb @@ -8,11 +8,7 @@ class BitcoinRPC def initialize(service_url, batch_mode = false) @service_url = service_url @uri = URI.parse(service_url) - set_batch_mode(batch_mode) - end - - def set_batch_mode(m) - @batch_mode = m + @batch_mode = batch_mode end def method_missing(name, *args) diff --git a/lib/tasks/cucumber.rake b/lib/tasks/cucumber.rake index dcf14d1a..4d81c9d1 100644 --- a/lib/tasks/cucumber.rake +++ b/lib/tasks/cucumber.rake @@ -51,8 +51,9 @@ unless ARGV.any? { |a| a =~ /^gems/ } # Don't load anything when running the gem warn "*** The 'features' task is deprecated. See rake -T cucumber ***" end - # In case we don't have the generic Rails test:prepare hook, append a no-op task that we can depend upon. task 'test:prepare' do + # In case we don't have the generic Rails test:prepare hook, + # append a no-op task that we can depend upon. end task stats: 'cucumber:statsetup' From b21e5266412ff6fbddeffd518525f6f576140de6 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Fri, 27 Nov 2020 20:12:55 +0100 Subject: [PATCH 333/415] removed tip notification mailer + fixed rubocop warnings --- .rubocop_todo.yml | 62 +++---------------- app/helpers/projects_helper.rb | 2 +- app/mailers/user_mailer.rb | 18 ------ app/models/project.rb | 4 +- app/models/sendmany.rb | 2 +- app/models/tip.rb | 20 ------ .../check_bitcoin_address.html.haml | 14 ----- app/views/user_mailer/new_tip.html.haml | 20 ------ features/step_definitions/home_steps.rb | 8 ++- features/step_definitions/project_steps.rb | 28 ++++----- features/step_definitions/tips_steps.rb | 2 +- lib/bitcoin_rpc.rb | 2 +- lib/bitcoin_tipper.rb | 2 +- spec/mailers/user_mailer_spec.rb | 49 --------------- 14 files changed, 35 insertions(+), 198 deletions(-) delete mode 100644 app/mailers/user_mailer.rb delete mode 100644 app/views/user_mailer/check_bitcoin_address.html.haml delete mode 100644 app/views/user_mailer/new_tip.html.haml delete mode 100644 spec/mailers/user_mailer_spec.rb diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 1e374245..5f2ca7d7 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2020-11-27 16:36:50 UTC using RuboCop version 1.3.1. +# on 2020-11-27 19:10:13 UTC using RuboCop version 1.3.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -11,12 +11,12 @@ Lint/MissingSuper: Exclude: - 'lib/bitcoin_rpc.rb' -# Offense count: 18 +# Offense count: 17 # Configuration parameters: IgnoredMethods. Metrics/AbcSize: Max: 67 -# Offense count: 19 +# Offense count: 17 # Configuration parameters: CountComments, CountAsOne, ExcludedMethods. # ExcludedMethods: refine Metrics/BlockLength: @@ -25,14 +25,14 @@ Metrics/BlockLength: # Offense count: 2 # Configuration parameters: CountComments, CountAsOne. Metrics/ClassLength: - Max: 183 + Max: 181 -# Offense count: 7 +# Offense count: 6 # Configuration parameters: IgnoredMethods. Metrics/CyclomaticComplexity: Max: 29 -# Offense count: 22 +# Offense count: 21 # Configuration parameters: CountComments, CountAsOne, ExcludedMethods. Metrics/MethodLength: Max: 56 @@ -42,7 +42,7 @@ Metrics/MethodLength: Metrics/ModuleLength: Max: 162 -# Offense count: 7 +# Offense count: 6 # Configuration parameters: IgnoredMethods. Metrics/PerceivedComplexity: Max: 31 @@ -58,13 +58,6 @@ Naming/PredicateName: - 'spec/**/*' - 'app/models/project.rb' -# Offense count: 3 -# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers. -# SupportedStyles: snake_case, normalcase, non_integer -Naming/VariableNumber: - Exclude: - - 'features/step_definitions/project_steps.rb' - # Offense count: 23 # Cop supports --auto-correct. # Configuration parameters: AllowOnConstant. @@ -72,15 +65,7 @@ Style/CaseEquality: Exclude: - 'app/helpers/application_helper.rb' -# Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle. -# SupportedStyles: format, sprintf, percent -Style/FormatString: - Exclude: - - 'app/helpers/projects_helper.rb' - -# Offense count: 8 +# Offense count: 7 # Configuration parameters: MinBodyLength. Style/GuardClause: Exclude: @@ -91,41 +76,12 @@ Style/GuardClause: - 'app/models/project.rb' - 'app/models/tip.rb' -# Offense count: 1 -# Cop supports --auto-correct. -Style/IfUnlessModifier: - Exclude: - - 'app/models/project.rb' - # Offense count: 1 Style/MissingRespondToMissing: Exclude: - 'lib/bitcoin_rpc.rb' -# Offense count: 3 -# Configuration parameters: AllowedMethods. -# AllowedMethods: respond_to_missing? -Style/OptionalBooleanParameter: - Exclude: - - 'features/step_definitions/project_steps.rb' - - 'lib/bitcoin_rpc.rb' - - 'lib/bitcoin_tipper.rb' - -# Offense count: 1 -# Configuration parameters: AllowModifier. -Style/SoleNestedConditional: - Exclude: - - 'app/models/tip.rb' - -# Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, AllowSafeAssignment. -# SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex -Style/TernaryParentheses: - Exclude: - - 'features/step_definitions/home_steps.rb' - -# Offense count: 24 +# Offense count: 25 # Cop supports --auto-correct. # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. # URISchemes: http, https diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index c8e38e03..349739be 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -3,7 +3,7 @@ module ProjectsHelper def shield_btc_amount(amount) btc_amount = amount / 1e8 - "%.#{9 - btc_amount.to_i.to_s.length}f Ƀ" % btc_amount + format("%.#{9 - btc_amount.to_i.to_s.length}f Ƀ", btc_amount) end def shield_color(project) diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb deleted file mode 100644 index 74fc2f68..00000000 --- a/app/mailers/user_mailer.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class UserMailer < ActionMailer::Base - add_template_helper(ApplicationHelper) - - def new_tip(user, tip) - @user = user - @tip = tip - - mail to: user.email, subject: 'You received a tip for your commit' - end - - def check_bitcoin_address(user) - @user = user - - mail to: user.email, subject: 'Check your Bitcoin address' - end -end diff --git a/app/models/project.rb b/app/models/project.rb index 7dc30182..5a75e007 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -202,9 +202,7 @@ def commit_url(commit) end def check_tips_to_pay_against_avaiable_amount - if available_amount.negative? - raise "Not enough funds to pay the pending tips on #{inspect} (#{available_amount} < 0)" - end + raise "Not enough funds to pay the pending tips on #{inspect} (#{available_amount} < 0)" if available_amount.negative? end def self.find_or_create_by_url(project_url) diff --git a/app/models/sendmany.rb b/app/models/sendmany.rb index 67a020e5..76eab0ca 100644 --- a/app/models/sendmany.rb +++ b/app/models/sendmany.rb @@ -12,7 +12,7 @@ def send_transaction update_attribute :is_error, true # it's a lock to prevent duplicates - bitcoind = BitcoinRPC.new(CONFIG['bitcoind']['rpc_connection_string'], false) + bitcoind = BitcoinRPC.new(CONFIG['bitcoind']['rpc_connection_string'], batch_mode: false) begin txid = bitcoind.sendmany( diff --git a/app/models/tip.rb b/app/models/tip.rb index f80c234b..e243c244 100644 --- a/app/models/tip.rb +++ b/app/models/tip.rb @@ -89,7 +89,6 @@ def undecided? before_save :check_amount_against_project before_save :touch_decided_at_if_decided - after_save :notify_user_if_just_decided def self.refund_unclaimed unclaimed.non_refunded @@ -125,25 +124,6 @@ def amount_percentage=(percentage) self.amount = (project.available_amount * (percentage.to_f / 100)).ceil end - def notify_user - if amount&.positive? && user.bitcoin_address.blank? && - !user.unsubscribed && !project.disable_notifications && - user.balance > 21_000_000 * 1e8 - if user.notified_at.nil? || (user.notified_at < 30.days.ago) - begin - UserMailer.new_tip(user, self).deliver - user.touch :notified_at - rescue Net::SMTPServerBusy => e - Rails.logger.info "Error: #{e.class}: #{e.message}" - end - end - end - end - - def notify_user_if_just_decided - notify_user if amount_was.nil? && amount - end - def check_amount_against_project if amount && amount_changed? available_amount = project.available_amount diff --git a/app/views/user_mailer/check_bitcoin_address.html.haml b/app/views/user_mailer/check_bitcoin_address.html.haml deleted file mode 100644 index 4a7ae264..00000000 --- a/app/views/user_mailer/check_bitcoin_address.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -%h4 Hello, #{@user.display_name}! - -%p Recently, we discovered a security breach in our system and it's possible that someone changed your Bitcoin address. Please check it: - -%p - %strong= @user.bitcoin_address - -%p - If this address is not yours, please - = link_to 'update it', login_users_url(token: @user.login_token) - -%p Thank you for contributing to Open Source and sorry for troubles! - -%p= link_to "tip4commit.com", "http://tip4commit.com/" \ No newline at end of file diff --git a/app/views/user_mailer/new_tip.html.haml b/app/views/user_mailer/new_tip.html.haml deleted file mode 100644 index b86b4a8a..00000000 --- a/app/views/user_mailer/new_tip.html.haml +++ /dev/null @@ -1,20 +0,0 @@ -%h4 Hello, #{@user.display_name}! - -%p You were tipped #{btc_human @tip.amount} for your commit on Project #{@tip.project.full_name}. Please, log in and tell us your bitcoin address to get it. - -%p Your current balance is #{btc_human @user.balance}. If you don't enter a bitcoin address your tips will be returned to the project in 30 days. - -%p If you don't need bitcoins you can redirect your funds to #{link_to 'Free Software Foundation', 'https://www.fsf.org/about/ways-to-donate'}. - -%p= link_to 'Sign In', login_users_url(token: @user.login_token) - -%p Thanks for contributing to Open Source! - -%p= link_to "tip4commit.com", "https://tip4commit.com/" - -%p - %small - = link_to "Don't notify me anymore, I don't need tips.", login_users_url(token: @user.login_token, unsubscribe: true) - - -.alert.alert-warning We are not affiliated with most of the projects, their owners might not endorse use of tip4commit. diff --git a/features/step_definitions/home_steps.rb b/features/step_definitions/home_steps.rb index 0ec0493e..e802c127 100644 --- a/features/step_definitions/home_steps.rb +++ b/features/step_definitions/home_steps.rb @@ -1,6 +1,10 @@ # frozen_string_literal: true -Then(/^I should (.*)\s*see "(.*?)" in the "(.*?)" area$/) do |should, text, node_name| +Then(/^I should ((not)?)\s*see "(.*?)" in the "(.*?)" area$/) do |should, text, node_name| element = find_element node_name - element.should((should.eql? 'not ') ? (have_no_content text) : (have_content text)) + if should == 'not' + element.should have_no_content text + else + element.should have_content text + end end diff --git a/features/step_definitions/project_steps.rb b/features/step_definitions/project_steps.rb index b4e23624..51a07648 100644 --- a/features/step_definitions/project_steps.rb +++ b/features/step_definitions/project_steps.rb @@ -1,14 +1,14 @@ # frozen_string_literal: true def github_projects - [@github_project_1, @github_project_2, @github_project_3].compact + [@github_project1, @github_project2, @github_project3].compact end def bitbucket_projects - [@bitbucket_project_1, @bitbucket_project_2, @bitbucket_project_3].compact + [@bitbucket_project1, @bitbucket_project2, @bitbucket_project3].compact end -def create_github_project(project_name, is_mock_project = true) +def create_github_project(project_name, is_mock_project: true) # NOTE: when is_mock_project is false the app will actually fetch via network # this is the old "find or create" GUI functionality # so obviously the actual repo must exist @@ -17,10 +17,10 @@ def create_github_project(project_name, is_mock_project = true) # source_full_name , description , watchers_count , language # up to three of each host are cached with a reference to the most recent - if (@github_project_1.present? && (project_name.eql? @github_project_1.full_name)) || - (@github_project_2.present? && (project_name.eql? @github_project_2.full_name)) + if (@github_project1.present? && (project_name.eql? @github_project1.full_name)) || + (@github_project2.present? && (project_name.eql? @github_project2.full_name)) raise "duplicate project_name '#{project_name}'" - elsif @github_project_3.present? + elsif @github_project3.present? raise 'the maximum of three test projects already exist' end @@ -35,12 +35,12 @@ def create_github_project(project_name, is_mock_project = true) end unless github_projects.include?(new_project) - if @github_project_2.present? - @github_project_3 = new_project - elsif @github_project_1.present? - @github_project_2 = new_project + if @github_project2.present? + @github_project3 = new_project + elsif @github_project1.present? + @github_project2 = new_project else - @github_project_1 = new_project + @github_project1 = new_project end end @@ -62,11 +62,11 @@ def find_project(service, project_name) # @current_project is also assigned in step 'regarding the "..." project named "..."' case provider.downcase when 'github' - @current_project = create_github_project project_name + @current_project = create_github_project(project_name) when 'bitbucket' - @current_project = create_bitbicket_project project_name + @current_project = create_bitbicket_project(project_name) when 'real-github' - @current_project = create_github_project project_name, false + @current_project = create_github_project(project_name, is_mock_project: false) else raise "unknown provider \"#{provider}\"" end end diff --git a/features/step_definitions/tips_steps.rb b/features/step_definitions/tips_steps.rb index 06211d4a..fd2b307d 100644 --- a/features/step_definitions/tips_steps.rb +++ b/features/step_definitions/tips_steps.rb @@ -91,7 +91,7 @@ def find_new_commit(commit_id) When(/^the new commits are loaded$/) do raise 'no commits have been assigned' if @new_commits.nil? - [@github_project_1, @github_project_2, @github_project_3].each do |project| + [@github_project1, @github_project2, @github_project3].each do |project| next if project.nil? project.reload diff --git a/lib/bitcoin_rpc.rb b/lib/bitcoin_rpc.rb index e7591205..e58eb3af 100644 --- a/lib/bitcoin_rpc.rb +++ b/lib/bitcoin_rpc.rb @@ -5,7 +5,7 @@ require 'json' class BitcoinRPC - def initialize(service_url, batch_mode = false) + def initialize(service_url, batch_mode: false) @service_url = service_url @uri = URI.parse(service_url) @batch_mode = batch_mode diff --git a/lib/bitcoin_tipper.rb b/lib/bitcoin_tipper.rb index a6883584..10506a6c 100644 --- a/lib/bitcoin_tipper.rb +++ b/lib/bitcoin_tipper.rb @@ -8,7 +8,7 @@ def work_forever end end - def work(withdraw = true) + def work(withdraw: true) create_tips update_projects_info check_and_withdrawal_funds if withdraw diff --git a/spec/mailers/user_mailer_spec.rb b/spec/mailers/user_mailer_spec.rb deleted file mode 100644 index db1338d0..00000000 --- a/spec/mailers/user_mailer_spec.rb +++ /dev/null @@ -1,49 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -describe UserMailer do - describe 'new_tip' do - let(:user) do - mock_model( - User, - name: 'kd', - email: 'kd.engineer@yahoo.co.in', - display_name: 'kuldeep aggarwal', - login_token: 'my login token', - balance: 10 - ) - end - let(:project) { mock_model Project, full_name: 'logger-extension' } - let(:tip) { mock_model Tip, amount: 0.0001, project: project } - let(:mail) { UserMailer.new_tip(user, tip) } - - it 'renders the subject' do - expect(mail.subject).to eq 'You received a tip for your commit' - end - - it 'renders the receiver email' do - expect(mail.to).to eq [user.email] - end - - it 'renders the sender email' do - expect(mail.from).to eq ['no-reply@tip4commit.com'] - end - - it 'assigns user\'s display_name' do - expect(mail.body.encoded).to match(user.display_name) - end - - it 'assigns users\' balance' do - expected_text = [ - 'Please, log in and tell us your bitcoin address to get it.

', - '

Your current balance is 0.00000010 Ƀ' - ].join("\r\n") - expect(mail.body.encoded).to match expected_text - end - - it 'useses secure protocol for links' do - expect(mail.body.encoded).to match('https') - end - end -end From 38098665f5011b6e6ec4060a9e434b625b9e130d Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 28 Nov 2020 08:56:18 +0100 Subject: [PATCH 334/415] fixed rubocop warnings --- .rubocop_todo.yml | 32 +++---------- app/controllers/application_controller.rb | 16 +++---- app/controllers/projects_controller.rb | 36 +++++++------- .../users/omniauth_callbacks_controller.rb | 8 ++-- app/controllers/users_controller.rb | 8 ++-- app/helpers/application_helper.rb | 47 ++++++++++--------- app/models/project.rb | 34 +++++++------- app/models/tip.rb | 15 +++--- 8 files changed, 91 insertions(+), 105 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 5f2ca7d7..fc4d08eb 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2020-11-27 19:10:13 UTC using RuboCop version 1.3.1. +# on 2020-11-28 07:55:00 UTC using RuboCop version 1.3.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -14,7 +14,7 @@ Lint/MissingSuper: # Offense count: 17 # Configuration parameters: IgnoredMethods. Metrics/AbcSize: - Max: 67 + Max: 51 # Offense count: 17 # Configuration parameters: CountComments, CountAsOne, ExcludedMethods. @@ -25,7 +25,7 @@ Metrics/BlockLength: # Offense count: 2 # Configuration parameters: CountComments, CountAsOne. Metrics/ClassLength: - Max: 181 + Max: 184 # Offense count: 6 # Configuration parameters: IgnoredMethods. @@ -35,17 +35,17 @@ Metrics/CyclomaticComplexity: # Offense count: 21 # Configuration parameters: CountComments, CountAsOne, ExcludedMethods. Metrics/MethodLength: - Max: 56 + Max: 57 # Offense count: 1 # Configuration parameters: CountComments, CountAsOne. Metrics/ModuleLength: - Max: 162 + Max: 163 # Offense count: 6 # Configuration parameters: IgnoredMethods. Metrics/PerceivedComplexity: - Max: 31 + Max: 20 # Offense count: 1 # Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros. @@ -58,24 +58,6 @@ Naming/PredicateName: - 'spec/**/*' - 'app/models/project.rb' -# Offense count: 23 -# Cop supports --auto-correct. -# Configuration parameters: AllowOnConstant. -Style/CaseEquality: - Exclude: - - 'app/helpers/application_helper.rb' - -# Offense count: 7 -# Configuration parameters: MinBodyLength. -Style/GuardClause: - Exclude: - - 'app/controllers/application_controller.rb' - - 'app/controllers/projects_controller.rb' - - 'app/controllers/users/omniauth_callbacks_controller.rb' - - 'app/controllers/users_controller.rb' - - 'app/models/project.rb' - - 'app/models/tip.rb' - # Offense count: 1 Style/MissingRespondToMissing: Exclude: @@ -86,4 +68,4 @@ Style/MissingRespondToMissing: # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. # URISchemes: http, https Layout/LineLength: - Max: 238 + Max: 234 diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b27a2bdd..3beb1947 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -54,10 +54,10 @@ def load_project(params) .where('lower(`full_name`) = ?', params[:repo].downcase).first end - if @project.nil? - flash[:error] = I18n.t('errors.project_not_found') - redirect_to projects_path - end + return if @project.present? + + flash[:error] = I18n.t('errors.project_not_found') + redirect_to projects_path end def load_user(params) @@ -77,9 +77,9 @@ def load_user(params) @user = User.where('lower(`nickname`) = ?', params[:nickname].downcase).first end - if @user.nil? - flash[:error] = I18n.t('errors.user_not_found') - redirect_to users_path - end + return if @user.present? + + flash[:error] = I18n.t('errors.user_not_found') + redirect_to users_path end end diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 725c223e..f18bc9f3 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -48,24 +48,24 @@ def update def decide_tip_amounts authorize! :decide_tip_amounts, @project - if request.patch? - @project.available_amount # preload anything required to get the amount, otherwise it's loaded during the assignation and there are undesirable consequences - percentages = params[:project][:tips_attributes].values.map { |tip| tip['amount_percentage'].to_f } - if percentages.sum > 100 - redirect_to decide_tip_amounts_project_path(@project), alert: I18n.t('errors.can_assign_more_tips') - return - end - raise 'wrong data' if percentages.min.negative? - - @project.attributes = params.require(:project).permit(tips_attributes: %i[id amount_percentage]) - if @project.save - message = I18n.t('notices.tips_decided') - if @project.has_undecided_tips? - redirect_to decide_tip_amounts_project_path(@project), notice: message - else - redirect_to @project, notice: message - end - end + return unless request.patch? + + @project.available_amount # preload anything required to get the amount, otherwise it's loaded during the assignation and there are undesirable consequences + percentages = params[:project][:tips_attributes].values.map { |tip| tip['amount_percentage'].to_f } + if percentages.sum > 100 + redirect_to decide_tip_amounts_project_path(@project), alert: I18n.t('errors.can_assign_more_tips') + return + end + raise 'wrong data' if percentages.min.negative? + + @project.attributes = params.require(:project).permit(tips_attributes: %i[id amount_percentage]) + return unless @project.save + + message = I18n.t('notices.tips_decided') + if @project.has_undecided_tips? + redirect_to decide_tip_amounts_project_path(@project), notice: message + else + redirect_to @project, notice: message end end diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb index fe2ccad5..ca40bf05 100644 --- a/app/controllers/users/omniauth_callbacks_controller.rb +++ b/app/controllers/users/omniauth_callbacks_controller.rb @@ -30,10 +30,10 @@ def github def load_omniauth_info @omniauth_info = request.env['omniauth.auth']['info'] - unless @omniauth_info - set_flash_message(:error, :failure, kind: 'GitHub', reason: I18n.t('devise.errors.omniauth_info')) - redirect_to new_user_session_path and return - end + return if @omniauth_info + + set_flash_message(:error, :failure, kind: 'GitHub', reason: I18n.t('devise.errors.omniauth_info')) + redirect_to new_user_session_path end end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 07c4e987..386b627f 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -57,10 +57,10 @@ def load_user end def valid_user! - if current_user != @user - flash[:error] = I18n.t('errors.access_denied') - redirect_to root_path and return - end + return if current_user == @user + + flash[:error] = I18n.t('errors.access_denied') + redirect_to root_path end def redirect_to_pretty_url diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3f3261ad..67b38124 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -9,51 +9,52 @@ def btc_human(amount, options = {}) else (try(:current_user) ? current_user.denom : 0) end - if denom === 0 + case denom + when 0 btc = to_btc(amount) - elsif denom === 1 + when 1 btc = to_mbtc(amount) - elsif denom === 2 + when 2 btc = to_ubtc(amount) - elsif denom === 3 + when 3 btc = to_satoshi(amount) - elsif denom === 4 + when 4 btc = to_usd(amount) - elsif denom === 5 + when 5 btc = to_eur(amount) - elsif denom === 6 + when 6 btc = to_aud(amount) - elsif denom === 7 + when 7 btc = to_brl(amount) - elsif denom === 8 + when 8 btc = to_cad(amount) - elsif denom === 9 + when 9 btc = to_cny(amount) - elsif denom === 10 + when 10 btc = to_gbp(amount) - elsif denom === 11 + when 11 btc = to_idr(amount) - elsif denom === 12 + when 12 btc = to_ils(amount) - elsif denom === 13 + when 13 btc = to_jpy(amount) - elsif denom === 14 + when 14 btc = to_mxn(amount) - elsif denom === 15 + when 15 btc = to_nok(amount) - elsif denom === 16 + when 16 btc = to_nzd(amount) - elsif denom === 17 + when 17 btc = to_pln(amount) - elsif denom === 18 + when 18 btc = to_ron(amount) - elsif denom === 19 + when 19 btc = to_rub(amount) - elsif denom === 20 + when 20 btc = to_sek(amount) - elsif denom === 21 + when 21 btc = to_sgd(amount) - elsif denom === 22 + when 22 btc = to_zar(amount) end btc = "#{btc}" if nobr diff --git a/app/models/project.rb b/app/models/project.rb index 5a75e007..5547cb00 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -122,27 +122,29 @@ def tip_commits end def tip_for(commit) - if next_tip_amount.positive? && !Tip.exists?(commit: commit.sha) - return unless (user = User.find_by_commit commit) + return unless next_tip_amount.positive? + return if Tip.exists?(commit: commit.sha) - user.update(nickname: commit.author.login) if commit.author.try(:login) + user = User.find_by_commit(commit) + return if user.nil? - amount = if hold_tips - nil - else - next_tip_amount - end + user.update(nickname: commit.author.login) if commit.author.try(:login) - # create tip - tip = tips.create({ user: user, - amount: amount, - commit: commit.sha, - commit_message: commit.commit.message }) + amount = if hold_tips + nil + else + next_tip_amount + end - # tip.notify_user + # create a tip + tip = tips.create( + user: user, + amount: amount, + commit: commit.sha, + commit_message: commit.commit.message + ) - Rails.logger.info " Tip created #{tip.inspect}" - end + Rails.logger.info " Tip created #{tip.inspect}" end def donated diff --git a/app/models/tip.rb b/app/models/tip.rb index e243c244..89cdabf8 100644 --- a/app/models/tip.rb +++ b/app/models/tip.rb @@ -125,13 +125,14 @@ def amount_percentage=(percentage) end def check_amount_against_project - if amount && amount_changed? - available_amount = project.available_amount - available_amount -= amount_was if amount_was - if amount > available_amount - raise "Not enough funds on project to save #{inspect} (available: #{available_amount}). Project #{project.inspect} available_amount: #{project.available_amount} #{project.tips.count} tips: #{project.tips.map(&:amount).join(', ')}" - end - end + return unless amount && amount_changed? + + available_amount = project.available_amount + available_amount -= amount_was if amount_was + + return if amount <= available_amount + + raise "Not enough funds on project to save #{inspect} (available: #{available_amount}). Project #{project.inspect} available_amount: #{project.available_amount} #{project.tips.count} tips: #{project.tips.map(&:amount).join(', ')}" end def touch_decided_at_if_decided From 0c912186d0844816c44a8beb92f965628a55f471 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 29 Nov 2020 16:25:49 +0100 Subject: [PATCH 335/415] refactored project loading --- .rubocop_todo.yml | 14 +++++------ app/controllers/application_controller.rb | 30 ++++------------------- app/controllers/deposits_controller.rb | 17 ++++++++++++- app/controllers/projects_controller.rb | 8 +++++- app/controllers/tips_controller.rb | 17 ++++++++++++- app/models/project.rb | 4 +++ 6 files changed, 55 insertions(+), 35 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index fc4d08eb..bbfdad60 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2020-11-28 07:55:00 UTC using RuboCop version 1.3.1. +# on 2020-11-29 15:24:20 UTC using RuboCop version 1.3.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -11,7 +11,7 @@ Lint/MissingSuper: Exclude: - 'lib/bitcoin_rpc.rb' -# Offense count: 17 +# Offense count: 18 # Configuration parameters: IgnoredMethods. Metrics/AbcSize: Max: 51 @@ -25,14 +25,14 @@ Metrics/BlockLength: # Offense count: 2 # Configuration parameters: CountComments, CountAsOne. Metrics/ClassLength: - Max: 184 + Max: 187 -# Offense count: 6 +# Offense count: 5 # Configuration parameters: IgnoredMethods. Metrics/CyclomaticComplexity: Max: 29 -# Offense count: 21 +# Offense count: 20 # Configuration parameters: CountComments, CountAsOne, ExcludedMethods. Metrics/MethodLength: Max: 57 @@ -42,10 +42,10 @@ Metrics/MethodLength: Metrics/ModuleLength: Max: 163 -# Offense count: 6 +# Offense count: 5 # Configuration parameters: IgnoredMethods. Metrics/PerceivedComplexity: - Max: 20 + Max: 18 # Offense count: 1 # Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros. diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 3beb1947..b9a789fd 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -31,33 +31,13 @@ def locale_from_http_accept_language http_accept_language.compatible_language_from(::Rails.application.config.available_locales)&.to_sym end - def load_project(params) - return unless (is_via_project = is_a? ProjectsController) || - (is_via_tips = is_a? TipsController) || - (is_via_deposits = is_a? DepositsController) - - is_standard_path = params[:id].present? && is_via_project - is_association_path = params[:project_id].present? - is_pretty_path = params[:service].present? && params[:repo].present? - return unless is_standard_path || is_association_path || is_pretty_path - - if (is_standard_path || is_association_path) && - (project_id = is_via_project ? params[:id] : params[:project_id]) && - (@project = (Project.where id: project_id).first) - if is_via_tips - redirect_to project_tips_pretty_path @project.host, @project.full_name - elsif is_via_deposits - redirect_to project_deposits_pretty_path @project.host, @project.full_name - end - elsif is_pretty_path - @project = Project.where(host: params[:service]) - .where('lower(`full_name`) = ?', params[:repo].downcase).first - end - - return if @project.present? + def pretty_project_path? + params[:service].present? && params[:repo].present? + end + def project_not_found flash[:error] = I18n.t('errors.project_not_found') - redirect_to projects_path + redirect_to(projects_path) end def load_user(params) diff --git a/app/controllers/deposits_controller.rb b/app/controllers/deposits_controller.rb index a8c0db10..c692e4b4 100644 --- a/app/controllers/deposits_controller.rb +++ b/app/controllers/deposits_controller.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class DepositsController < ApplicationController - before_action { load_project params } + before_action { load_project } def index @deposits = if @project.present? @@ -17,4 +17,19 @@ def index format.csv { render csv: @deposits, except: %i[updated_at confirmations fee_size], add_methods: %i[project_name fee confirmed?] } end end + + private + + def load_project + return unless pretty_project_path? || params[:project_id].present? + + if pretty_project_path? + @project = Project.first_by_service_and_repo(params[:service], params[:repo]) + elsif params[:project_id].present? + @project = Project.where(id: params[:project_id]).first + redirect_to project_deposits_pretty_path(@project.host, @project.full_name) if @project + end + + project_not_found unless @project + end end diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index f18bc9f3..e7030607 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -72,7 +72,13 @@ def decide_tip_amounts private def load_project - super params + @project = if pretty_project_path? + Project.first_by_service_and_repo(params[:service], params[:repo]) + else + Project.where(id: params[:id]).first + end + + project_not_found unless @project end def project_params diff --git a/app/controllers/tips_controller.rb b/app/controllers/tips_controller.rb index 27698d40..e50cacf4 100644 --- a/app/controllers/tips_controller.rb +++ b/app/controllers/tips_controller.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class TipsController < ApplicationController - before_action { load_project params } + before_action { load_project } before_action { load_user params } def index @@ -25,4 +25,19 @@ def index format.csv { render csv: @tips, except: %i[updated_at commit commit_message refunded_at decided_at], add_methods: %i[user_name project_name decided? claimed? paid? refunded? txid] } end end + + private + + def load_project + return unless pretty_project_path? || params[:project_id].present? + + if pretty_project_path? + @project = Project.first_by_service_and_repo(params[:service], params[:repo]) + elsif params[:project_id].present? + @project = Project.where(id: params[:project_id]).first + redirect_to project_tips_pretty_path(@project.host, @project.full_name) if @project + end + + project_not_found unless @project + end end diff --git a/app/models/project.rb b/app/models/project.rb index 5547cb00..10df1669 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -238,5 +238,9 @@ class << self def export_labels Hash[pluck(:bitcoin_address, :full_name)].to_json end + + def first_by_service_and_repo(service, repo) + where(host: service).where('lower(`full_name`) = ?', repo.downcase).first + end end end From 05a7c85213f4209a6691749d738e579c6213d43b Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Fri, 4 Dec 2020 12:37:42 +0100 Subject: [PATCH 336/415] reduced perceived complexity --- .rubocop_todo.yml | 10 ++--- app/controllers/application_controller.rb | 22 +--------- app/controllers/tips_controller.rb | 15 ++++++- app/controllers/users_controller.rb | 5 ++- app/models/user.rb | 49 +++++++++++++---------- 5 files changed, 52 insertions(+), 49 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index bbfdad60..dc1014ad 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2020-11-29 15:24:20 UTC using RuboCop version 1.3.1. +# on 2020-12-04 11:36:42 UTC using RuboCop version 1.3.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -27,12 +27,12 @@ Metrics/BlockLength: Metrics/ClassLength: Max: 187 -# Offense count: 5 +# Offense count: 4 # Configuration parameters: IgnoredMethods. Metrics/CyclomaticComplexity: Max: 29 -# Offense count: 20 +# Offense count: 19 # Configuration parameters: CountComments, CountAsOne, ExcludedMethods. Metrics/MethodLength: Max: 57 @@ -42,10 +42,10 @@ Metrics/MethodLength: Metrics/ModuleLength: Max: 163 -# Offense count: 5 +# Offense count: 4 # Configuration parameters: IgnoredMethods. Metrics/PerceivedComplexity: - Max: 18 + Max: 13 # Offense count: 1 # Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros. diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b9a789fd..66e514ca 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -40,26 +40,8 @@ def project_not_found redirect_to(projects_path) end - def load_user(params) - return unless (is_via_user = is_a? UsersController) || - (is_via_tips = is_a? TipsController) - - return unless (is_standard_path = params[:id].present? && is_via_user) || - (is_association_path = params[:user_id].present?) || - (is_pretty_path = params[:nickname].present?) - - if (is_standard_path || is_association_path) && - (user_id = (is_via_user && params[:id]) || - (is_via_tips && params[:user_id])) && - (@user = User.where(id: user_id).first) - redirect_to user_tips_pretty_path @user.nickname if is_via_tips - elsif is_pretty_path - @user = User.where('lower(`nickname`) = ?', params[:nickname].downcase).first - end - - return if @user.present? - + def user_not_found flash[:error] = I18n.t('errors.user_not_found') - redirect_to users_path + redirect_to(users_path) end end diff --git a/app/controllers/tips_controller.rb b/app/controllers/tips_controller.rb index e50cacf4..dad3b6fd 100644 --- a/app/controllers/tips_controller.rb +++ b/app/controllers/tips_controller.rb @@ -2,7 +2,7 @@ class TipsController < ApplicationController before_action { load_project } - before_action { load_user params } + before_action { load_user } def index if @project.present? @@ -40,4 +40,17 @@ def load_project project_not_found unless @project end + + def load_user + return unless params[:user_id].present? || params[:nickname].present? + + if params[:nickname].present? + @user = User.first_by_nickname(params[:nickname]) + elsif params[:user_id].present? + @user = User.where(id: params[:user_id]).first + redirect_to user_tips_pretty_path(@user.nickname) if @user + end + + user_not_found unless @user + end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 386b627f..60fca9b2 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -53,7 +53,10 @@ def users_params end def load_user - super params + @user = User.where(id: params[:id]).first if params[:id].present? + @user ||= User.first_by_nickname(params[:nickname]) if params[:nickname].present? + + user_not_found unless @user end def valid_user! diff --git a/app/models/user.rb b/app/models/user.rb index 04953db2..bf06cfe3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -50,34 +50,39 @@ def subscribed? !unsubscribed? end - # Class Methods - def self.update_cache - includes(:tips).find_each do |user| - user.update commits_count: user.tips.count - user.update withdrawn_amount: user.tips.paid.sum(:amount) - end + def ready_for_withdrawal? + bitcoin_address.present? && balance >= CONFIG['min_payout'] end - def self.create_with_omniauth!(auth_info) - generated_password = Devise.friendly_token.first(Devise.password_length.min) - create do |user| - user.email = auth_info.email - user.password = generated_password - user.nickname = auth_info.nickname - user.display_name = auth_info.name - user.skip_confirmation! + class << self + def update_cache + includes(:tips).find_each do |user| + user.update commits_count: user.tips.count + user.update withdrawn_amount: user.tips.paid.sum(:amount) + end end - end - def self.find_by_commit(commit) - email = commit.commit.author.email - nickname = commit.author.try(:login) + def create_with_omniauth!(auth_info) + generated_password = Devise.friendly_token.first(Devise.password_length.min) + create do |user| + user.email = auth_info.email + user.password = generated_password + user.nickname = auth_info.nickname + user.display_name = auth_info.name + user.skip_confirmation! + end + end - find_by(email: email) || (nickname.blank? ? nil : find_by(nickname: nickname)) - end + def find_by_commit(commit) + email = commit.commit.author.email + nickname = commit.author.try(:login) - def ready_for_withdrawal? - bitcoin_address.present? && balance >= CONFIG['min_payout'] + find_by(email: email) || (nickname.blank? ? nil : find_by(nickname: nickname)) + end + + def first_by_nickname(nickname) + where('lower(`nickname`) = ?', nickname.downcase).first + end end private From a48ca3a05be95fc0de3bfc2bd6fe574239b6df4f Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Fri, 4 Dec 2020 14:26:24 +0100 Subject: [PATCH 337/415] upgraded ruby to 2.6.6 --- .rubocop.yml | 2 +- .travis.yml | 2 +- Gemfile | 2 +- Gemfile.lock | 2 +- config/deploy.rb | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 0229b48a..94569d64 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -2,7 +2,7 @@ inherit_from: .rubocop_todo.yml AllCops: - TargetRubyVersion: 2.5 + TargetRubyVersion: 2.6 NewCops: enable Exclude: - 'db/schema.rb' diff --git a/.travis.yml b/.travis.yml index 7529506b..8e4b01eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ git: depth: 10 rvm: - - 2.5.8 + - 2.6.6 bundler_args: --without development --jobs=9 --retry=2 --quiet diff --git a/Gemfile b/Gemfile index f2c465e3..a64bf791 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' -ruby '2.5.8' +ruby '2.6.6' gem 'rails', '5.2.4.4' diff --git a/Gemfile.lock b/Gemfile.lock index 34ed5444..9ae8b838 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -493,7 +493,7 @@ DEPENDENCIES webmock RUBY VERSION - ruby 2.5.8p224 + ruby 2.6.6p146 BUNDLED WITH 2.1.4 diff --git a/config/deploy.rb b/config/deploy.rb index 275e612a..73aa10e3 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -8,7 +8,7 @@ set :deploy_to, '/home/apps/t4c' set :rvm_type, :user -set :rvm_ruby_version, '2.5.8' +set :rvm_ruby_version, '2.6.6' set :rvm_custom_path, '~/.rvm' set :format, :pretty From 1ae05903153a66b6391793496e0d8a825677cc54 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Fri, 4 Dec 2020 16:55:54 +0100 Subject: [PATCH 338/415] updated gems --- Gemfile.lock | 24 +++++++++++++----------- features/step_definitions/common.rb | 2 +- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 9ae8b838..733e3dd0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -49,7 +49,7 @@ GEM public_suffix (>= 2.0.2, < 5.0) airbrake (11.0.1) airbrake-ruby (~> 5.1) - airbrake-ruby (5.1.1) + airbrake-ruby (5.2.0) rbtree3 (~> 0.5) airbrussh (1.4.0) sshkit (>= 1.6.1, != 1.7.0) @@ -77,7 +77,7 @@ GEM capistrano-rvm (0.1.2) capistrano (~> 3.0) sshkit (~> 1.2) - capybara (3.33.0) + capybara (3.34.0) addressable mini_mime (>= 0.1.3) nokogiri (~> 1.8) @@ -155,7 +155,7 @@ GEM gherkin (5.1.0) globalid (0.4.2) activesupport (>= 4.2.0) - haml (5.2.0) + haml (5.2.1) temple (>= 0.8.0) tilt haml-rails (2.0.1) @@ -211,7 +211,7 @@ GEM less (~> 2.6.0) sprockets (>= 2) libv8 (3.16.14.19) - loofah (2.7.0) + loofah (2.8.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -262,7 +262,7 @@ GEM actionpack (>= 4.2) omniauth (>= 1.3.1) orm_adapter (0.5.0) - parallel (1.20.0) + parallel (1.20.1) parser (2.7.2.0) ast (~> 2.4.1) public_suffix (4.0.6) @@ -341,16 +341,16 @@ GEM rspec-mocks (~> 3.9) rspec-support (~> 3.9) rspec-support (3.10.0) - rubocop (1.3.1) + rubocop (1.5.2) parallel (~> 1.10) parser (>= 2.7.1.5) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8) + regexp_parser (>= 1.8, < 3.0) rexml - rubocop-ast (>= 1.1.1) + rubocop-ast (>= 1.2.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (1.1.1) + rubocop-ast (1.3.0) parser (>= 2.7.1.5) ruby-progressbar (1.10.1) ruby2_keywords (0.0.2) @@ -378,10 +378,12 @@ GEM connection_pool (>= 2.2.2) rack (~> 2.0) redis (>= 4.2.0) - simplecov (0.19.1) + simplecov (0.20.0) docile (~> 1.1) simplecov-html (~> 0.11) + simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) + simplecov_json_formatter (0.1.2) sprockets (4.0.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -390,7 +392,7 @@ GEM activesupport (>= 4.0) sprockets (>= 3.0.0) sqlite3 (1.4.2) - sshkit (1.21.0) + sshkit (1.21.1) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) temple (0.8.2) diff --git a/features/step_definitions/common.rb b/features/step_definitions/common.rb index 03a29c01..2a7f96a3 100644 --- a/features/step_definitions/common.rb +++ b/features/step_definitions/common.rb @@ -72,7 +72,7 @@ def parse_path_from_page_string(page_string) # explicit cases # e.g. "a-user/a-project github-project edit" # e.g. "a-user user edit" - tokens = page_string.split ' ' + tokens = page_string.split name = tokens[0] model = tokens[1] action = tokens[2] || '' # '' => 'show' From f0f3b9d373f98dc2aea3844239cd8bab45065d7d Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Fri, 4 Dec 2020 17:03:14 +0100 Subject: [PATCH 339/415] fixed turbolinks page loading --- app/assets/javascripts/application.js.coffee | 4 ++-- app/assets/javascripts/projects.js.coffee | 2 +- app/assets/javascripts/users.js.coffee | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee index 1f23d93f..73027893 100644 --- a/app/assets/javascripts/application.js.coffee +++ b/app/assets/javascripts/application.js.coffee @@ -7,7 +7,7 @@ #= require i18n/translations #= require_tree . -$(document).on "ready page:change", -> +$(document).on "ready turbolinks:load", -> # Remove all global properties set by addthis, otherwise it won't reinitialize for i of window @@ -18,4 +18,4 @@ $(document).on "ready page:change", -> $.getScript "//s7.addthis.com/js/250/addthis_widget.js#pubid=ra-526425ac0ea0780b" $('.noclick').click () -> - return false \ No newline at end of file + return false diff --git a/app/assets/javascripts/projects.js.coffee b/app/assets/javascripts/projects.js.coffee index 86bd3f15..4cb54f5c 100644 --- a/app/assets/javascripts/projects.js.coffee +++ b/app/assets/javascripts/projects.js.coffee @@ -6,4 +6,4 @@ init = () -> $('.qrcode').each () -> $(this).qrcode($(this).attr('data-qrcode')); -$(document).on 'ready page:load', init \ No newline at end of file +$(document).on 'ready turbolinks:load', init diff --git a/app/assets/javascripts/users.js.coffee b/app/assets/javascripts/users.js.coffee index 056e5d7a..77d18a71 100644 --- a/app/assets/javascripts/users.js.coffee +++ b/app/assets/javascripts/users.js.coffee @@ -39,7 +39,7 @@ load_bootstrap_validator = -> notEmpty: message: I18n.t('js.errors.password_confirmation.blank') -$(document).on "ready page:load", load_bootstrap_validator +$(document).on "ready turbolinks:load", load_bootstrap_validator $ -> $('.from-gravatar').click (e) -> From 97f5ff831c006947ad7030156beff9c37fc16b04 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 5 Dec 2020 10:39:07 +0100 Subject: [PATCH 340/415] rubocop rspec and rails + fixes --- .rubocop.yml | 9 + .rubocop_todo.yml | 167 ++++++++++++++++-- Gemfile | 2 + Gemfile.lock | 9 + app/controllers/users_controller.rb | 2 +- app/helpers/application_helper.rb | 6 +- app/helpers/projects_helper.rb | 6 +- app/models/tip.rb | 2 +- db/migrate/20140223061035_add_project_host.rb | 2 +- ...20140402082149_add_fee_size_to_deposits.rb | 2 +- lib/tasks/cucumber.rake | 6 +- spec/controllers/projects_controller_spec.rb | 1 + spec/controllers/users_controller_spec.rb | 1 + spec/lib/blacklist_spec.rb | 2 +- spec/models/collaborator_spec.rb | 2 +- spec/models/deposit_spec.rb | 2 +- spec/models/project_spec.rb | 24 +-- spec/models/send_many_spec.rb | 2 +- spec/models/sendmany_spec.rb | 2 +- spec/models/tip_spec.rb | 6 +- spec/models/tipping_policies_text_spec.rb | 4 +- spec/models/user_spec.rb | 18 +- spec/models/wallet_spec.rb | 8 +- .../requests/cve_2005_9284_regression_spec.rb | 8 +- 24 files changed, 230 insertions(+), 63 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 94569d64..8d1b38d9 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,10 @@ inherit_from: .rubocop_todo.yml +require: + - rubocop-rails + - rubocop-rspec + AllCops: TargetRubyVersion: 2.6 NewCops: enable @@ -10,3 +14,8 @@ AllCops: Style/Documentation: Enabled: false + +Rails/DynamicFindBy: + Whitelist: + - find_by_url + - find_by_commit diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index dc1014ad..593fc296 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,24 +1,19 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2020-12-04 11:36:42 UTC using RuboCop version 1.3.1. +# on 2020-12-05 09:33:58 UTC using RuboCop version 1.5.2. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 1 -Lint/MissingSuper: - Exclude: - - 'lib/bitcoin_rpc.rb' - # Offense count: 18 -# Configuration parameters: IgnoredMethods. +# Configuration parameters: IgnoredMethods, CountRepeatedAttributes. Metrics/AbcSize: Max: 51 # Offense count: 17 -# Configuration parameters: CountComments, CountAsOne, ExcludedMethods. -# ExcludedMethods: refine +# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. +# IgnoredMethods: refine Metrics/BlockLength: Max: 224 @@ -33,7 +28,7 @@ Metrics/CyclomaticComplexity: Max: 29 # Offense count: 19 -# Configuration parameters: CountComments, CountAsOne, ExcludedMethods. +# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. Metrics/MethodLength: Max: 57 @@ -55,9 +50,159 @@ Metrics/PerceivedComplexity: # MethodDefinitionMacros: define_method, define_singleton_method Naming/PredicateName: Exclude: - - 'spec/**/*' - 'app/models/project.rb' +# Offense count: 3 +# Configuration parameters: Prefixes. +# Prefixes: when, with, without +RSpec/ContextWording: + Exclude: + - 'spec/controllers/projects_controller_spec.rb' + +# Offense count: 1 +# Configuration parameters: IgnoredMetadata. +RSpec/DescribeClass: + Exclude: + - 'spec/misc_spec.rb' + +# Offense count: 13 +# Configuration parameters: Max. +RSpec/ExampleLength: + Exclude: + - 'spec/controllers/projects_controller_spec.rb' + - 'spec/controllers/users_controller_spec.rb' + - 'spec/lib/blacklist_spec.rb' + - 'spec/models/deposit_spec.rb' + +# Offense count: 25 +# Cop supports --auto-correct. +RSpec/ExpectActual: + Exclude: + - 'spec/controllers/deposits_controller_spec.rb' + - 'spec/controllers/home_controller_spec.rb' + - 'spec/controllers/projects_controller_spec.rb' + - 'spec/controllers/tips_controller_spec.rb' + - 'spec/controllers/users_controller_spec.rb' + - 'spec/controllers/withdrawals_controller_spec.rb' + +# Offense count: 1 +# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly. +# Include: **/*_spec*rb*, **/spec/**/* +RSpec/FilePath: + Exclude: + - 'spec/models/send_many_spec.rb' + +# Offense count: 2 +# Configuration parameters: AssignmentOnly. +RSpec/InstanceVariable: + Exclude: + - 'spec/controllers/users_controller_spec.rb' + - 'spec/requests/cve_2005_9284_regression_spec.rb' + +# Offense count: 3 +# Configuration parameters: . +# SupportedStyles: have_received, receive +RSpec/MessageSpies: + EnforcedStyle: receive + +# Offense count: 3 +RSpec/MultipleExpectations: + Max: 9 + +# Offense count: 26 +# Configuration parameters: IgnoreSharedExamples. +RSpec/NamedSubject: + Exclude: + - 'spec/controllers/home_controller_spec.rb' + - 'spec/controllers/projects_controller_spec.rb' + - 'spec/controllers/users_controller_spec.rb' + - 'spec/models/wallet_spec.rb' + +# Offense count: 4 +RSpec/NestedGroups: + Max: 5 + +# Offense count: 2 +RSpec/RepeatedExample: + Exclude: + - 'spec/controllers/home_controller_spec.rb' + +# Offense count: 2 +RSpec/RepeatedExampleGroupBody: + Exclude: + - 'spec/models/user_spec.rb' + +# Offense count: 3 +RSpec/StubbedMock: + Exclude: + - 'spec/controllers/projects_controller_spec.rb' + +# Offense count: 9 +# Configuration parameters: Database, Include. +# SupportedDatabases: mysql, postgresql +# Include: db/migrate/*.rb +Rails/BulkChangeTable: + Exclude: + - 'db/migrate/20131019133109_devise_create_users.rb' + - 'db/migrate/20131019133235_add_columns_to_users.rb' + - 'db/migrate/20131019175751_add_some_fields_to_projects.rb' + - 'db/migrate/20131212190037_add_cache_to_users.rb' + - 'db/migrate/20140102095035_add_refunded_at_to_tips.rb' + - 'db/migrate/20140209041123_create_indexes_for_projects.rb' + - 'db/migrate/20140402082149_add_fee_size_to_deposits.rb' + - 'db/migrate/20140722092532_add_confirmation_fields_to_users.rb' + - 'db/migrate/20140816062159_remove_paid_out_from_deposits.rb' + +# Offense count: 2 +# Configuration parameters: EnforcedStyle. +# SupportedStyles: slashes, arguments +Rails/FilePath: + Exclude: + - 'lib/tasks/cucumber.rake' + - 'spec/misc_spec.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: Include. +# Include: app/models/**/*.rb +Rails/FindBy: + Exclude: + - 'app/models/project.rb' + - 'app/models/user.rb' + +# Offense count: 6 +# Configuration parameters: Include. +# Include: app/models/**/*.rb +Rails/HasManyOrHasOneDependent: + Exclude: + - 'app/models/project.rb' + - 'app/models/sendmany.rb' + - 'app/models/user.rb' + +# Offense count: 2 +Rails/OutputSafety: + Exclude: + - 'app/helpers/application_helper.rb' + +# Offense count: 1 +# Configuration parameters: Include. +# Include: db/migrate/*.rb +Rails/ReversibleMigration: + Exclude: + - 'db/migrate/20131030142749_drop_deposit_from_tip.rb' + +# Offense count: 11 +# Configuration parameters: ForbiddenMethods, AllowedMethods. +# ForbiddenMethods: decrement!, decrement_counter, increment!, increment_counter, insert, insert!, insert_all, insert_all!, toggle!, touch, touch_all, update_all, update_attribute, update_column, update_columns, update_counters, upsert, upsert_all +Rails/SkipsModelValidations: + Exclude: + - 'app/models/project.rb' + - 'app/models/sendmany.rb' + - 'app/models/tip.rb' + - 'db/migrate/20140223061035_add_project_host.rb' + - 'db/migrate/20140402082149_add_fee_size_to_deposits.rb' + - 'lib/bitcoin_tipper.rb' + # Offense count: 1 Style/MissingRespondToMissing: Exclude: diff --git a/Gemfile b/Gemfile index a64bf791..b7caddd2 100644 --- a/Gemfile +++ b/Gemfile @@ -61,6 +61,8 @@ group :development, :test do gem 'factory_bot_rails' gem 'rspec-rails' gem 'rubocop' + gem 'rubocop-rails' + gem 'rubocop-rspec' gem 'sqlite3' end diff --git a/Gemfile.lock b/Gemfile.lock index 733e3dd0..edbb4deb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -352,6 +352,13 @@ GEM unicode-display_width (>= 1.4.0, < 2.0) rubocop-ast (1.3.0) parser (>= 2.7.1.5) + rubocop-rails (2.8.1) + activesupport (>= 4.2.0) + rack (>= 1.1) + rubocop (>= 0.87.0) + rubocop-rspec (2.0.1) + rubocop (~> 1.0) + rubocop-ast (>= 1.1.0) ruby-progressbar (1.10.1) ruby2_keywords (0.0.2) ruby_parser (3.15.0) @@ -479,6 +486,8 @@ DEPENDENCIES rspec-activemodel-mocks rspec-rails rubocop + rubocop-rails + rubocop-rspec sass-rails sawyer sdoc diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 60fca9b2..e3783c81 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -14,7 +14,7 @@ def index end def update - if @user.update_attributes(users_params) + if @user.update(users_params) redirect_to @user, notice: I18n.t('notices.user_updated') else show diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 67b38124..5380ae7d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -158,7 +158,7 @@ def rate(currency, satoshies) end def get_rate(currency) - Rails.cache.fetch("####{currency}", expires_in: 1.hours) do + Rails.cache.fetch("####{currency}", expires_in: 1.hour) do uri = URI("https://api.coindesk.com/v1/bpi/currentprice/#{currency}.json") response = Net::HTTP.get_response(uri) hash = JSON.parse(response.body) @@ -173,13 +173,13 @@ def render_flash_messages when 'notice' then :success when 'alert', 'error' then :danger end - html << content_tag(:div, class: "alert alert-#{alert_type}") { message } + html << tag.div(class: "alert alert-#{alert_type}") { message } end html.join("\n").html_safe end def commit_tag(sha1) - content_tag(:span, truncate(sha1, length: 10, omission: ''), class: 'commit-sha') + tag.span(truncate(sha1, length: 10, omission: ''), class: 'commit-sha') end def list_friendly_text(a_list, conjunction) diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 349739be..ac49e100 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -8,11 +8,11 @@ def shield_btc_amount(amount) def shield_color(project) last_tip = project.tips.order(:created_at).last - if last_tip.nil? || (Time.now - last_tip.created_at > 30.days) + if last_tip.nil? || (Time.zone.now - last_tip.created_at > 30.days) 'red' - elsif Time.now - last_tip.created_at > 7.days + elsif Time.zone.now - last_tip.created_at > 7.days 'yellow' - elsif Time.now - last_tip.created_at > 1.day + elsif Time.zone.now - last_tip.created_at > 1.day 'yellowgreen' else 'green' diff --git a/app/models/tip.rb b/app/models/tip.rb index 89cdabf8..1def86ca 100644 --- a/app/models/tip.rb +++ b/app/models/tip.rb @@ -136,7 +136,7 @@ def check_amount_against_project end def touch_decided_at_if_decided - self.decided_at = Time.now if amount_changed? && decided? + self.decided_at = Time.zone.now if amount_changed? && decided? end def project_name diff --git a/db/migrate/20140223061035_add_project_host.rb b/db/migrate/20140223061035_add_project_host.rb index 60fb7f07..d5e4c9d8 100644 --- a/db/migrate/20140223061035_add_project_host.rb +++ b/db/migrate/20140223061035_add_project_host.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class AddProjectHost < ActiveRecord::Migration[4.2] - class Project < ActiveRecord::Base + class Project < ApplicationRecord end def change diff --git a/db/migrate/20140402082149_add_fee_size_to_deposits.rb b/db/migrate/20140402082149_add_fee_size_to_deposits.rb index 9a4ff742..c335fd50 100644 --- a/db/migrate/20140402082149_add_fee_size_to_deposits.rb +++ b/db/migrate/20140402082149_add_fee_size_to_deposits.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class AddFeeSizeToDeposits < ActiveRecord::Migration[4.2] - class Deposit < ActiveRecord::Base + class Deposit < ApplicationRecord end def change diff --git a/lib/tasks/cucumber.rake b/lib/tasks/cucumber.rake index 4d81c9d1..28b9e8ad 100644 --- a/lib/tasks/cucumber.rake +++ b/lib/tasks/cucumber.rake @@ -36,7 +36,7 @@ unless ARGV.any? { |a| a =~ /^gems/ } # Don't load anything when running the gem desc 'Run all features' task all: %i[ok wip] - task :statsetup do + task statsetup: :environment do require 'rails/code_statistics' ::STATS_DIRECTORIES << %w[Cucumber\ features features] if File.exist?('features') ::CodeStatistics::TEST_TYPES << 'Cucumber features' if File.exist?('features') @@ -51,7 +51,7 @@ unless ARGV.any? { |a| a =~ /^gems/ } # Don't load anything when running the gem warn "*** The 'features' task is deprecated. See rake -T cucumber ***" end - task 'test:prepare' do + task 'test:prepare' => :environment do # In case we don't have the generic Rails test:prepare hook, # append a no-op task that we can depend upon. end @@ -59,7 +59,7 @@ unless ARGV.any? { |a| a =~ /^gems/ } # Don't load anything when running the gem task stats: 'cucumber:statsetup' rescue LoadError desc 'cucumber rake task not available (cucumber not installed)' - task :cucumber do + task cucumber: :environment do abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin' end end diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index d7d189f3..11f8347f 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -5,6 +5,7 @@ describe ProjectsController, type: :controller do describe 'GET #index' do let(:subject) { get :index } + before do allow(Project).to receive(:order).with(available_amount_cache: :desc, watchers_count: :desc, full_name: :asc).and_return(Project) allow(Project).to receive(:page).with(nil).and_return(Project) diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index 70b6cb2d..c9c52616 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -30,6 +30,7 @@ context 'when user found' do context 'when viewing own page' do before { allow(user).to receive(:id).and_return(@current_user.id) } + it 'renders show template' do expect(subject).to render_template :show end diff --git a/spec/lib/blacklist_spec.rb b/spec/lib/blacklist_spec.rb index 78c7e693..607499f0 100644 --- a/spec/lib/blacklist_spec.rb +++ b/spec/lib/blacklist_spec.rb @@ -11,7 +11,7 @@ 'https://bitbucket.org/notips/*' ] - list = Blacklist.new(urls) + list = described_class.new(urls) # Blacklisted projects. expect(list.include?('https://github.com/author/notips')).to eq(true) diff --git a/spec/models/collaborator_spec.rb b/spec/models/collaborator_spec.rb index 2fe276c8..994d31e9 100644 --- a/spec/models/collaborator_spec.rb +++ b/spec/models/collaborator_spec.rb @@ -4,6 +4,6 @@ describe Collaborator, type: :model do describe 'Associations' do - it { should belong_to :project } + it { is_expected.to belong_to :project } end end diff --git a/spec/models/deposit_spec.rb b/spec/models/deposit_spec.rb index 6456520e..1f50fc5f 100644 --- a/spec/models/deposit_spec.rb +++ b/spec/models/deposit_spec.rb @@ -6,7 +6,7 @@ let(:deposit) { create(:deposit) } describe 'Associations' do - it { should belong_to :project } + it { is_expected.to belong_to :project } end describe '#fee' do diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index d72bcd79..535acec6 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -7,18 +7,18 @@ let(:project_of_bitbucket) { create(:project, :bitbucket) } describe 'Associations' do - it { should have_many(:deposits) } - it { should have_many(:tips) } - it { should belong_to(:wallet) } + it { is_expected.to have_many(:deposits) } + it { is_expected.to have_many(:tips) } + it { is_expected.to belong_to(:wallet) } end describe 'Validations' do - it { should validate_presence_of(:full_name) } - it { should validate_presence_of(:github_id) } - it { should validate_presence_of(:host) } - it { should validate_uniqueness_of(:full_name) } - it { should validate_uniqueness_of(:github_id) } - it { should validate_inclusion_of(:host).in_array %w[github bitbucket] } + it { is_expected.to validate_presence_of(:full_name) } + it { is_expected.to validate_presence_of(:github_id) } + it { is_expected.to validate_presence_of(:host) } + it { is_expected.to validate_uniqueness_of(:full_name) } + it { is_expected.to validate_uniqueness_of(:github_id) } + it { is_expected.to validate_inclusion_of(:host).in_array %w[github bitbucket] } end describe 'bitcoin_address' do @@ -29,15 +29,15 @@ wallet end - it 'should generate a bitcoin address' do + it 'generates a bitcoin address' do expect(project.bitcoin_address).not_to be_blank end - it 'should connect project to the last wallet' do + it 'connects project to the last wallet' do expect(project.wallet).to eq wallet end - it 'should increment wallet\'s last_address_index' do + it "increments wallet's last_address_index" do expect { project }.to change { wallet.reload.last_address_index }.by 1 end end diff --git a/spec/models/send_many_spec.rb b/spec/models/send_many_spec.rb index 4f1c3435..428efb30 100644 --- a/spec/models/send_many_spec.rb +++ b/spec/models/send_many_spec.rb @@ -4,6 +4,6 @@ describe Sendmany, type: :model do describe 'Associations' do - it { should have_many :tips } + it { is_expected.to have_many :tips } end end diff --git a/spec/models/sendmany_spec.rb b/spec/models/sendmany_spec.rb index 4f1c3435..428efb30 100644 --- a/spec/models/sendmany_spec.rb +++ b/spec/models/sendmany_spec.rb @@ -4,6 +4,6 @@ describe Sendmany, type: :model do describe 'Associations' do - it { should have_many :tips } + it { is_expected.to have_many :tips } end end diff --git a/spec/models/tip_spec.rb b/spec/models/tip_spec.rb index 3bd46d4c..2aa1fd80 100644 --- a/spec/models/tip_spec.rb +++ b/spec/models/tip_spec.rb @@ -4,8 +4,8 @@ describe Tip, type: :model do describe 'Associations' do - it { should belong_to :user } - it { should belong_to :sendmany } - it { should belong_to :project } + it { is_expected.to belong_to :user } + it { is_expected.to belong_to :sendmany } + it { is_expected.to belong_to :project } end end diff --git a/spec/models/tipping_policies_text_spec.rb b/spec/models/tipping_policies_text_spec.rb index 869a51c2..86376f5f 100644 --- a/spec/models/tipping_policies_text_spec.rb +++ b/spec/models/tipping_policies_text_spec.rb @@ -4,7 +4,7 @@ describe TippingPoliciesText, type: :model do describe 'Associations' do - it { should belong_to :project } - it { should belong_to :user } + it { is_expected.to belong_to :project } + it { is_expected.to belong_to :user } end end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 677edf84..aac6997b 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -6,7 +6,7 @@ let(:user) { create(:user) } describe 'Associations' do - it { should have_many :tips } + it { is_expected.to have_many :tips } end describe 'full_name' do @@ -33,56 +33,56 @@ describe 'bitcoin_address' do context 'when address is blank' do - it 'should be valid' do + it 'is valid' do user.bitcoin_address = '' expect(user).to be_valid end end context 'when address is valid p2pkh address' do - it 'should be valid' do + it 'is valid' do user.bitcoin_address = '1M4bS4gPyA6Kb8w7aXsgth9oUZWcRk73tQ' expect(user).to be_valid end end context 'when address is valid p2sh address' do - it 'should be valid' do + it 'is valid' do user.bitcoin_address = '3EktnHQD7RiAE6uzMj2ZifT9YgRrkSgzQX' expect(user).to be_valid end end context 'when address is valid bech32 P2WPKH address' do - it 'should be valid' do + it 'is valid' do user.bitcoin_address = 'BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4' expect(user).to be_valid end end context 'when address is valid bech32 P2WSH address' do - it 'should be valid' do + it 'is valid' do user.bitcoin_address = 'bc1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3qccfmv3' expect(user).to be_valid end end context 'when address is not valid p2pkh' do - it 'should not be valid' do + it 'is not valid' do user.bitcoin_address = '1M4bS4gPyA6Kb8w7aXsgth9oUZXXXXXXXX' expect(user).not_to be_valid end end context 'when address is testnet bech32' do - it 'should not be valid' do + it 'is not valid' do user.bitcoin_address = 'tb1qw508d6qejxtdg4y5r3zarvary0c5xw7kxpjzsx' expect(user).not_to be_valid end end context 'when address is not valid bech32' do - it 'should not be valid' do + it 'is not valid' do user.bitcoin_address = 'tb1qw508d6qejxtdg4y5r3zarvary0c5xw7kxpjzsx' expect(user).not_to be_valid end diff --git a/spec/models/wallet_spec.rb b/spec/models/wallet_spec.rb index c7ebeab9..78fd10c9 100644 --- a/spec/models/wallet_spec.rb +++ b/spec/models/wallet_spec.rb @@ -6,18 +6,18 @@ let(:wallet) { create(:wallet) } describe 'Validations' do - it { should validate_presence_of(:name) } - it { should validate_presence_of(:xpub) } + it { is_expected.to validate_presence_of(:name) } + it { is_expected.to validate_presence_of(:xpub) } end describe '#generate_address' do subject { wallet.generate_address } - it 'should return a new address' do + it 'returns a new address' do expect(subject).to eq '125q4q36PT2gGoeNWXm34RepMcgghLghiZ' end - it 'should increment last_address_index' do + it 'increments last_address_index' do expect { subject }.to change { wallet.reload.last_address_index }.by 1 end end diff --git a/spec/requests/cve_2005_9284_regression_spec.rb b/spec/requests/cve_2005_9284_regression_spec.rb index 6d6b82ea..b311506a 100644 --- a/spec/requests/cve_2005_9284_regression_spec.rb +++ b/spec/requests/cve_2005_9284_regression_spec.rb @@ -17,14 +17,14 @@ ActionController::Base.allow_forgery_protection = true end + after do + ActionController::Base.allow_forgery_protection = @allow_forgery_protection + end + it do expect do post '/users/auth/github' end.to raise_error(ActionController::InvalidAuthenticityToken) end - - after do - ActionController::Base.allow_forgery_protection = @allow_forgery_protection - end end end From 4bee31037c5c2a8b7a967946c8a545033403eb37 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 5 Dec 2020 10:43:29 +0100 Subject: [PATCH 341/415] do not load script twice --- app/assets/javascripts/application.js.coffee | 2 +- app/assets/javascripts/projects.js.coffee | 2 +- app/assets/javascripts/users.js.coffee | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee index 73027893..6901e003 100644 --- a/app/assets/javascripts/application.js.coffee +++ b/app/assets/javascripts/application.js.coffee @@ -7,7 +7,7 @@ #= require i18n/translations #= require_tree . -$(document).on "ready turbolinks:load", -> +$(document).on "turbolinks:load", -> # Remove all global properties set by addthis, otherwise it won't reinitialize for i of window diff --git a/app/assets/javascripts/projects.js.coffee b/app/assets/javascripts/projects.js.coffee index 4cb54f5c..c34a24f2 100644 --- a/app/assets/javascripts/projects.js.coffee +++ b/app/assets/javascripts/projects.js.coffee @@ -6,4 +6,4 @@ init = () -> $('.qrcode').each () -> $(this).qrcode($(this).attr('data-qrcode')); -$(document).on 'ready turbolinks:load', init +$(document).on 'turbolinks:load', init diff --git a/app/assets/javascripts/users.js.coffee b/app/assets/javascripts/users.js.coffee index 77d18a71..a52f5b93 100644 --- a/app/assets/javascripts/users.js.coffee +++ b/app/assets/javascripts/users.js.coffee @@ -39,7 +39,7 @@ load_bootstrap_validator = -> notEmpty: message: I18n.t('js.errors.password_confirmation.blank') -$(document).on "ready turbolinks:load", load_bootstrap_validator +$(document).on "turbolinks:load", load_bootstrap_validator $ -> $('.from-gravatar').click (e) -> From 8414c2e612aea968ae35878e3836716dc14a7ce5 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sat, 5 Dec 2020 10:51:08 +0100 Subject: [PATCH 342/415] fixed badges --- app/controllers/projects_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index e7030607..e5d81e91 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -107,6 +107,7 @@ def redirect_to_pretty_url path = pretty_project_decide_tip_amounts_path(@project) end format.html { redirect_to path } + format.svg end end end From 176706fe1f02a8672b3fdfc3991dc6a947add3e7 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 6 Dec 2020 11:58:34 +0100 Subject: [PATCH 343/415] rubocop fixes --- .rubocop.yml | 2 + .rubocop_todo.yml | 42 +------------------ app/controllers/deposits_controller.rb | 2 +- app/controllers/projects_controller.rb | 2 +- app/controllers/tips_controller.rb | 4 +- app/controllers/users_controller.rb | 2 +- app/models/project.rb | 4 +- app/models/user.rb | 4 +- .../20131019133109_devise_create_users.rb | 10 ++--- .../20131019133235_add_columns_to_users.rb | 8 ++-- ...31019175751_add_some_fields_to_projects.rb | 14 ++++--- .../20131030142749_drop_deposit_from_tip.rb | 6 ++- .../20131212190037_add_cache_to_users.rb | 6 ++- .../20140102095035_add_refunded_at_to_tips.rb | 15 +++++-- ...40209041123_create_indexes_for_projects.rb | 6 ++- ...20140402082149_add_fee_size_to_deposits.rb | 8 +++- ...092532_add_confirmation_fields_to_users.rb | 10 +++-- ...816062159_remove_paid_out_from_deposits.rb | 15 +++++-- lib/tasks/cucumber.rake | 2 +- spec/misc_spec.rb | 2 +- 20 files changed, 81 insertions(+), 83 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 8d1b38d9..994cd4c0 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -19,3 +19,5 @@ Rails/DynamicFindBy: Whitelist: - find_by_url - find_by_commit + - find_by_service_and_repo + - find_by_nickname diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 593fc296..2975e513 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2020-12-05 09:33:58 UTC using RuboCop version 1.5.2. +# on 2020-12-06 10:56:23 UTC using RuboCop version 1.5.2. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -137,39 +137,6 @@ RSpec/StubbedMock: Exclude: - 'spec/controllers/projects_controller_spec.rb' -# Offense count: 9 -# Configuration parameters: Database, Include. -# SupportedDatabases: mysql, postgresql -# Include: db/migrate/*.rb -Rails/BulkChangeTable: - Exclude: - - 'db/migrate/20131019133109_devise_create_users.rb' - - 'db/migrate/20131019133235_add_columns_to_users.rb' - - 'db/migrate/20131019175751_add_some_fields_to_projects.rb' - - 'db/migrate/20131212190037_add_cache_to_users.rb' - - 'db/migrate/20140102095035_add_refunded_at_to_tips.rb' - - 'db/migrate/20140209041123_create_indexes_for_projects.rb' - - 'db/migrate/20140402082149_add_fee_size_to_deposits.rb' - - 'db/migrate/20140722092532_add_confirmation_fields_to_users.rb' - - 'db/migrate/20140816062159_remove_paid_out_from_deposits.rb' - -# Offense count: 2 -# Configuration parameters: EnforcedStyle. -# SupportedStyles: slashes, arguments -Rails/FilePath: - Exclude: - - 'lib/tasks/cucumber.rake' - - 'spec/misc_spec.rb' - -# Offense count: 2 -# Cop supports --auto-correct. -# Configuration parameters: Include. -# Include: app/models/**/*.rb -Rails/FindBy: - Exclude: - - 'app/models/project.rb' - - 'app/models/user.rb' - # Offense count: 6 # Configuration parameters: Include. # Include: app/models/**/*.rb @@ -184,13 +151,6 @@ Rails/OutputSafety: Exclude: - 'app/helpers/application_helper.rb' -# Offense count: 1 -# Configuration parameters: Include. -# Include: db/migrate/*.rb -Rails/ReversibleMigration: - Exclude: - - 'db/migrate/20131030142749_drop_deposit_from_tip.rb' - # Offense count: 11 # Configuration parameters: ForbiddenMethods, AllowedMethods. # ForbiddenMethods: decrement!, decrement_counter, increment!, increment_counter, insert, insert!, insert_all, insert_all!, toggle!, touch, touch_all, update_all, update_attribute, update_column, update_columns, update_counters, upsert, upsert_all diff --git a/app/controllers/deposits_controller.rb b/app/controllers/deposits_controller.rb index c692e4b4..c4981233 100644 --- a/app/controllers/deposits_controller.rb +++ b/app/controllers/deposits_controller.rb @@ -24,7 +24,7 @@ def load_project return unless pretty_project_path? || params[:project_id].present? if pretty_project_path? - @project = Project.first_by_service_and_repo(params[:service], params[:repo]) + @project = Project.find_by_service_and_repo(params[:service], params[:repo]) elsif params[:project_id].present? @project = Project.where(id: params[:project_id]).first redirect_to project_deposits_pretty_path(@project.host, @project.full_name) if @project diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index e5d81e91..d6a6bde0 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -73,7 +73,7 @@ def decide_tip_amounts def load_project @project = if pretty_project_path? - Project.first_by_service_and_repo(params[:service], params[:repo]) + Project.find_by_service_and_repo(params[:service], params[:repo]) else Project.where(id: params[:id]).first end diff --git a/app/controllers/tips_controller.rb b/app/controllers/tips_controller.rb index dad3b6fd..140b7161 100644 --- a/app/controllers/tips_controller.rb +++ b/app/controllers/tips_controller.rb @@ -32,7 +32,7 @@ def load_project return unless pretty_project_path? || params[:project_id].present? if pretty_project_path? - @project = Project.first_by_service_and_repo(params[:service], params[:repo]) + @project = Project.find_by_service_and_repo(params[:service], params[:repo]) elsif params[:project_id].present? @project = Project.where(id: params[:project_id]).first redirect_to project_tips_pretty_path(@project.host, @project.full_name) if @project @@ -45,7 +45,7 @@ def load_user return unless params[:user_id].present? || params[:nickname].present? if params[:nickname].present? - @user = User.first_by_nickname(params[:nickname]) + @user = User.find_by_nickname(params[:nickname]) elsif params[:user_id].present? @user = User.where(id: params[:user_id]).first redirect_to user_tips_pretty_path(@user.nickname) if @user diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index e3783c81..df127c1d 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -54,7 +54,7 @@ def users_params def load_user @user = User.where(id: params[:id]).first if params[:id].present? - @user ||= User.first_by_nickname(params[:nickname]) if params[:nickname].present? + @user ||= User.find_by_nickname(params[:nickname]) if params[:nickname].present? user_not_found unless @user end diff --git a/app/models/project.rb b/app/models/project.rb index 10df1669..a9b7fdcb 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -239,8 +239,8 @@ def export_labels Hash[pluck(:bitcoin_address, :full_name)].to_json end - def first_by_service_and_repo(service, repo) - where(host: service).where('lower(`full_name`) = ?', repo.downcase).first + def find_by_service_and_repo(service, repo) + where(host: service).find_by('lower(`full_name`) = ?', repo.downcase) end end end diff --git a/app/models/user.rb b/app/models/user.rb index bf06cfe3..f4ed033c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -80,8 +80,8 @@ def find_by_commit(commit) find_by(email: email) || (nickname.blank? ? nil : find_by(nickname: nickname)) end - def first_by_nickname(nickname) - where('lower(`nickname`) = ?', nickname.downcase).first + def find_by_nickname(nickname) + find_by('lower(`nickname`) = ?', nickname.downcase) end end diff --git a/db/migrate/20131019133109_devise_create_users.rb b/db/migrate/20131019133109_devise_create_users.rb index 156e258d..c87e3306 100644 --- a/db/migrate/20131019133109_devise_create_users.rb +++ b/db/migrate/20131019133109_devise_create_users.rb @@ -33,11 +33,11 @@ def change # t.datetime :locked_at t.timestamps - end - add_index :users, :email, unique: true - add_index :users, :reset_password_token, unique: true - # add_index :users, :confirmation_token, :unique => true - # add_index :users, :unlock_token, :unique => true + t.index :email, unique: true + t.index :reset_password_token, unique: true + # t.index :confirmation_token, unique: true + # t.index :unlock_token, unique: true + end end end diff --git a/db/migrate/20131019133235_add_columns_to_users.rb b/db/migrate/20131019133235_add_columns_to_users.rb index 8e06d45a..781b1f54 100644 --- a/db/migrate/20131019133235_add_columns_to_users.rb +++ b/db/migrate/20131019133235_add_columns_to_users.rb @@ -2,8 +2,10 @@ class AddColumnsToUsers < ActiveRecord::Migration[4.2] def change - add_column :users, :nickname, :string - add_column :users, :name, :string - add_column :users, :image, :string + change_table :users, bulk: true do |t| + t.column :nickname, :string + t.column :name, :string + t.column :image, :string + end end end diff --git a/db/migrate/20131019175751_add_some_fields_to_projects.rb b/db/migrate/20131019175751_add_some_fields_to_projects.rb index 7c28bdb9..959dbf6f 100644 --- a/db/migrate/20131019175751_add_some_fields_to_projects.rb +++ b/db/migrate/20131019175751_add_some_fields_to_projects.rb @@ -2,11 +2,13 @@ class AddSomeFieldsToProjects < ActiveRecord::Migration[4.2] def change - add_column :projects, :name, :string - add_column :projects, :full_name, :string - add_column :projects, :source_full_name, :string - add_column :projects, :description, :string - add_column :projects, :watchers_count, :integer - add_column :projects, :language, :string + change_table :projects, bulk: true do |t| + t.column :name, :string + t.column :full_name, :string + t.column :source_full_name, :string + t.column :description, :string + t.column :watchers_count, :integer + t.column :language, :string + end end end diff --git a/db/migrate/20131030142749_drop_deposit_from_tip.rb b/db/migrate/20131030142749_drop_deposit_from_tip.rb index da281869..90044a69 100644 --- a/db/migrate/20131030142749_drop_deposit_from_tip.rb +++ b/db/migrate/20131030142749_drop_deposit_from_tip.rb @@ -1,7 +1,11 @@ # frozen_string_literal: true class DropDepositFromTip < ActiveRecord::Migration[4.2] - def change + def up remove_column :tips, :deposit_id end + + def down + add_reference :tips, :deposit, index: true + end end diff --git a/db/migrate/20131212190037_add_cache_to_users.rb b/db/migrate/20131212190037_add_cache_to_users.rb index 5e47b789..1ecedd08 100644 --- a/db/migrate/20131212190037_add_cache_to_users.rb +++ b/db/migrate/20131212190037_add_cache_to_users.rb @@ -2,7 +2,9 @@ class AddCacheToUsers < ActiveRecord::Migration[4.2] def change - add_column :users, :commits_count, :integer, default: 0 - add_column :users, :withdrawn_amount, :integer, limit: 8, default: 0 + change_table :users, bulk: true do |t| + t.column :commits_count, :integer, default: 0 + t.column :withdrawn_amount, :integer, limit: 8, default: 0 + end end end diff --git a/db/migrate/20140102095035_add_refunded_at_to_tips.rb b/db/migrate/20140102095035_add_refunded_at_to_tips.rb index 05d80cb5..5653751d 100644 --- a/db/migrate/20140102095035_add_refunded_at_to_tips.rb +++ b/db/migrate/20140102095035_add_refunded_at_to_tips.rb @@ -1,8 +1,17 @@ # frozen_string_literal: true class AddRefundedAtToTips < ActiveRecord::Migration[4.2] - def change - add_column :tips, :refunded_at, :timestamp - remove_column :tips, :is_refunded, :boolean + def up + change_table :tips, bulk: true do |t| + t.column :refunded_at, :timestamp + t.remove :is_refunded + end + end + + def down + change_table :tips, bulk: true do |t| + t.remove :refunded_at + t.column :is_refunded, :boolean + end end end diff --git a/db/migrate/20140209041123_create_indexes_for_projects.rb b/db/migrate/20140209041123_create_indexes_for_projects.rb index d51f16bf..8a3345c8 100644 --- a/db/migrate/20140209041123_create_indexes_for_projects.rb +++ b/db/migrate/20140209041123_create_indexes_for_projects.rb @@ -2,7 +2,9 @@ class CreateIndexesForProjects < ActiveRecord::Migration[4.2] def change - add_index :projects, :full_name, unique: true - add_index :projects, :github_id, unique: true + change_table :projects, bulk: true do |t| + t.index :full_name, unique: true + t.index :github_id, unique: true + end end end diff --git a/db/migrate/20140402082149_add_fee_size_to_deposits.rb b/db/migrate/20140402082149_add_fee_size_to_deposits.rb index c335fd50..8811847b 100644 --- a/db/migrate/20140402082149_add_fee_size_to_deposits.rb +++ b/db/migrate/20140402082149_add_fee_size_to_deposits.rb @@ -5,9 +5,13 @@ class Deposit < ApplicationRecord end def change - add_column :deposits, :fee_size, :float - remove_column :deposits, :duration, :integer reversible do |dir| + change_table :deposits, bulk: true do |t| + t.column :fee_size, :float + dir.up { t.remove :duration, :integer } + dir.down { t.column :duration } + end + # Update all existing deposits dir.up { Deposit.update_all(fee_size: CONFIG['our_fee']) } end diff --git a/db/migrate/20140722092532_add_confirmation_fields_to_users.rb b/db/migrate/20140722092532_add_confirmation_fields_to_users.rb index cb9fa533..5084b78f 100644 --- a/db/migrate/20140722092532_add_confirmation_fields_to_users.rb +++ b/db/migrate/20140722092532_add_confirmation_fields_to_users.rb @@ -2,9 +2,11 @@ class AddConfirmationFieldsToUsers < ActiveRecord::Migration[4.2] def change - add_column :users, :confirmed_at, :timestamp - add_column :users, :confirmation_sent_at, :timestamp - add_column :users, :confirmation_token, :string - add_column :users, :unconfirmed_email, :string + change_table :users, bulk: true do |t| + t.column :confirmation_token, :string + t.column :confirmation_sent_at, :timestamp + t.column :confirmed_at, :timestamp + t.column :unconfirmed_email, :string + end end end diff --git a/db/migrate/20140816062159_remove_paid_out_from_deposits.rb b/db/migrate/20140816062159_remove_paid_out_from_deposits.rb index 240add45..e8cbff1e 100644 --- a/db/migrate/20140816062159_remove_paid_out_from_deposits.rb +++ b/db/migrate/20140816062159_remove_paid_out_from_deposits.rb @@ -1,8 +1,17 @@ # frozen_string_literal: true class RemovePaidOutFromDeposits < ActiveRecord::Migration[4.2] - def change - remove_column :deposits, :paid_out, :integer, limit: 8 - remove_column :deposits, :paid_out_at, :datetime + def up + change_table :deposits, bulk: true do |t| + t.remove :paid_out + t.remove :paid_out_at + end + end + + def down + change_table :deposits, bulk: true do |t| + t.add :paid_out, :integer, limit: 8 + t.add :paid_out_at, :datetime + end end end diff --git a/lib/tasks/cucumber.rake b/lib/tasks/cucumber.rake index 28b9e8ad..e279deb6 100644 --- a/lib/tasks/cucumber.rake +++ b/lib/tasks/cucumber.rake @@ -8,7 +8,7 @@ unless ARGV.any? { |a| a =~ /^gems/ } # Don't load anything when running the gems:* tasks - vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first + vendored_cucumber_bin = Dir[Rails.root.join('/vendor/{gems,plugins}/cucumber*/bin/cucumber')].first $LOAD_PATH.unshift("#{File.dirname(vendored_cucumber_bin)}/../lib") unless vendored_cucumber_bin.nil? begin diff --git a/spec/misc_spec.rb b/spec/misc_spec.rb index e8ff2b0e..bd3988b5 100644 --- a/spec/misc_spec.rb +++ b/spec/misc_spec.rb @@ -7,7 +7,7 @@ it 'has a flag image for each locale' do locales.each do |locale| - path = File.join(Rails.root, 'app', 'assets', 'images', 'flags', "#{locale}.png") + path = Rails.root.join("app/assets/images/flags/#{locale}.png") expect(File.exist?(path)).to be_truthy, "#{locale} flag is missing" end end From c3322dfdba67803004553add16742bb2f6cd4b8d Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 6 Dec 2020 12:04:30 +0100 Subject: [PATCH 344/415] updated schema --- db/schema.rb | 225 +++++++++++++++++++++++++-------------------------- 1 file changed, 109 insertions(+), 116 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 02ad5898..dd94d3c1 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,6 +1,3 @@ -# encoding: UTF-8 -# frozen_string_literal: true - # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -13,132 +10,128 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170308163825) do - create_table 'collaborators', force: :cascade do |t| - t.integer 'project_id', limit: 4 - t.string 'login', limit: 255 - t.datetime 'created_at' - t.datetime 'updated_at' - end - - add_index 'collaborators', ['project_id'], name: 'index_collaborators_on_project_id', using: :btree +ActiveRecord::Schema.define(version: 2017_03_08_163825) do - create_table 'deposits', force: :cascade do |t| - t.integer 'project_id', limit: 4 - t.string 'txid', limit: 255 - t.integer 'confirmations', limit: 4 - t.datetime 'created_at' - t.datetime 'updated_at' - t.integer 'amount', limit: 8 - t.float 'fee_size', limit: 24 + create_table "collaborators", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + t.integer "project_id" + t.string "login" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["project_id"], name: "index_collaborators_on_project_id" end - add_index 'deposits', ['project_id'], name: 'index_deposits_on_project_id', using: :btree - - create_table 'projects', force: :cascade do |t| - t.string 'url', limit: 255 - t.string 'bitcoin_address', limit: 255 - t.datetime 'created_at' - t.datetime 'updated_at' - t.string 'name', limit: 255 - t.string 'full_name', limit: 255 - t.string 'source_full_name', limit: 255 - t.text 'description', limit: 65535 - t.integer 'watchers_count', limit: 4 - t.string 'language', limit: 255 - t.string 'last_commit', limit: 255 - t.integer 'available_amount_cache', limit: 4 - t.string 'github_id', limit: 255 - t.string 'host', limit: 255, default: 'github' - t.boolean 'hold_tips', default: false - t.datetime 'info_updated_at' - t.string 'branch', limit: 255 - t.boolean 'disable_notifications' - t.string 'avatar_url', limit: 255 - t.datetime 'deleted_at' - t.string 'bitcoin_address2', limit: 255 - t.integer 'wallet_id', limit: 4 - t.string 'legacy_address', limit: 255 + create_table "deposits", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + t.integer "project_id" + t.string "txid" + t.integer "confirmations" + t.datetime "created_at" + t.datetime "updated_at" + t.bigint "amount" + t.float "fee_size" + t.index ["project_id"], name: "index_deposits_on_project_id" end - add_index 'projects', ['full_name'], name: 'index_projects_on_full_name', unique: true, using: :btree - add_index 'projects', ['github_id'], name: 'index_projects_on_github_id', unique: true, using: :btree - - create_table 'sendmanies', force: :cascade do |t| - t.string 'txid', limit: 255 - t.text 'data', limit: 65535 - t.string 'result', limit: 255 - t.boolean 'is_error' - t.datetime 'created_at' - t.datetime 'updated_at' + create_table "projects", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + t.string "url" + t.string "bitcoin_address" + t.datetime "created_at" + t.datetime "updated_at" + t.string "name" + t.string "full_name" + t.string "source_full_name" + t.text "description" + t.integer "watchers_count" + t.string "language" + t.string "last_commit" + t.integer "available_amount_cache" + t.string "github_id" + t.string "host", default: "github" + t.boolean "hold_tips", default: false + t.datetime "info_updated_at" + t.string "branch" + t.boolean "disable_notifications" + t.string "avatar_url" + t.datetime "deleted_at" + t.string "bitcoin_address2" + t.integer "wallet_id" + t.string "legacy_address" + t.index ["full_name"], name: "index_projects_on_full_name", unique: true + t.index ["github_id"], name: "index_projects_on_github_id", unique: true end - create_table 'tipping_policies_texts', force: :cascade do |t| - t.integer 'project_id', limit: 4 - t.integer 'user_id', limit: 4 - t.text 'text', limit: 65535 - t.datetime 'created_at' - t.datetime 'updated_at' + create_table "sendmanies", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + t.string "txid" + t.text "data" + t.string "result" + t.boolean "is_error" + t.datetime "created_at" + t.datetime "updated_at" end - add_index 'tipping_policies_texts', ['project_id'], name: 'index_tipping_policies_texts_on_project_id', using: :btree - add_index 'tipping_policies_texts', ['user_id'], name: 'index_tipping_policies_texts_on_user_id', using: :btree - - create_table 'tips', force: :cascade do |t| - t.integer 'user_id', limit: 4 - t.integer 'amount', limit: 8 - t.integer 'sendmany_id', limit: 4 - t.datetime 'created_at' - t.datetime 'updated_at' - t.string 'commit', limit: 255 - t.integer 'project_id', limit: 4 - t.datetime 'refunded_at' - t.text 'commit_message', limit: 65535 - t.datetime 'decided_at' + create_table "tipping_policies_texts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + t.integer "project_id" + t.integer "user_id" + t.text "text" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["project_id"], name: "index_tipping_policies_texts_on_project_id" + t.index ["user_id"], name: "index_tipping_policies_texts_on_user_id" end - add_index 'tips', ['project_id'], name: 'index_tips_on_project_id', using: :btree - add_index 'tips', ['sendmany_id'], name: 'index_tips_on_sendmany_id', using: :btree - add_index 'tips', ['user_id'], name: 'index_tips_on_user_id', using: :btree - - create_table 'users', force: :cascade do |t| - t.string 'email', limit: 255, default: '', null: false - t.string 'encrypted_password', limit: 255, default: '', null: false - t.string 'reset_password_token', limit: 255 - t.datetime 'reset_password_sent_at' - t.datetime 'remember_created_at' - t.integer 'sign_in_count', limit: 4, default: 0, null: false - t.datetime 'current_sign_in_at' - t.datetime 'last_sign_in_at' - t.string 'current_sign_in_ip', limit: 255 - t.string 'last_sign_in_ip', limit: 255 - t.datetime 'created_at' - t.datetime 'updated_at' - t.string 'nickname', limit: 255 - t.string 'name', limit: 255 - t.string 'image', limit: 255 - t.string 'bitcoin_address', limit: 255 - t.string 'login_token', limit: 255 - t.boolean 'unsubscribed' - t.datetime 'notified_at' - t.integer 'commits_count', limit: 4, default: 0 - t.integer 'withdrawn_amount', limit: 8, default: 0 - t.datetime 'confirmed_at' - t.datetime 'confirmation_sent_at' - t.string 'confirmation_token', limit: 255 - t.string 'unconfirmed_email', limit: 255 - t.string 'display_name', limit: 255 - t.integer 'denom', limit: 4, default: 0 + create_table "tips", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + t.integer "user_id" + t.bigint "amount" + t.integer "sendmany_id" + t.datetime "created_at" + t.datetime "updated_at" + t.string "commit" + t.integer "project_id" + t.datetime "refunded_at" + t.text "commit_message" + t.datetime "decided_at" + t.index ["project_id"], name: "index_tips_on_project_id" + t.index ["sendmany_id"], name: "index_tips_on_sendmany_id" + t.index ["user_id"], name: "index_tips_on_user_id" end - add_index 'users', ['email'], name: 'index_users_on_email', unique: true, using: :btree - add_index 'users', ['reset_password_token'], name: 'index_users_on_reset_password_token', unique: true, using: :btree + create_table "users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + t.string "email", default: "", null: false + t.string "encrypted_password", default: "", null: false + t.string "reset_password_token" + t.datetime "reset_password_sent_at" + t.datetime "remember_created_at" + t.integer "sign_in_count", default: 0, null: false + t.datetime "current_sign_in_at" + t.datetime "last_sign_in_at" + t.string "current_sign_in_ip" + t.string "last_sign_in_ip" + t.datetime "created_at" + t.datetime "updated_at" + t.string "nickname" + t.string "name" + t.string "image" + t.string "bitcoin_address" + t.string "login_token" + t.boolean "unsubscribed" + t.datetime "notified_at" + t.integer "commits_count", default: 0 + t.bigint "withdrawn_amount", default: 0 + t.datetime "confirmed_at" + t.datetime "confirmation_sent_at" + t.string "confirmation_token" + t.string "unconfirmed_email" + t.string "display_name" + t.integer "denom", default: 0 + t.index ["email"], name: "index_users_on_email", unique: true + t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true + end - create_table 'wallets', force: :cascade do |t| - t.string 'name', limit: 255 - t.string 'xpub', limit: 255 - t.integer 'last_address_index', limit: 4, default: 1 - t.datetime 'created_at', null: false - t.datetime 'updated_at', null: false + create_table "wallets", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + t.string "name" + t.string "xpub" + t.integer "last_address_index", default: 1 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end + end From 4d6900d0afefbe8cd3a0389fda9714a41caa008b Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 6 Dec 2020 12:41:59 +0100 Subject: [PATCH 345/415] reduced complexity --- .rubocop_todo.yml | 22 ++-- app/helpers/application_helper.rb | 165 ------------------------------ app/helpers/rates_helper.rb | 134 ++++++++++++++++++++++++ app/views/users/show.html.haml | 4 +- 4 files changed, 145 insertions(+), 180 deletions(-) create mode 100644 app/helpers/rates_helper.rb diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 2975e513..4d936c8e 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,15 +1,15 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2020-12-06 10:56:23 UTC using RuboCop version 1.5.2. +# on 2020-12-06 11:41:05 UTC using RuboCop version 1.5.2. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 18 +# Offense count: 17 # Configuration parameters: IgnoredMethods, CountRepeatedAttributes. Metrics/AbcSize: - Max: 51 + Max: 34 # Offense count: 17 # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. @@ -22,22 +22,17 @@ Metrics/BlockLength: Metrics/ClassLength: Max: 187 -# Offense count: 4 +# Offense count: 3 # Configuration parameters: IgnoredMethods. Metrics/CyclomaticComplexity: - Max: 29 + Max: 16 -# Offense count: 19 +# Offense count: 18 # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. Metrics/MethodLength: - Max: 57 - -# Offense count: 1 -# Configuration parameters: CountComments, CountAsOne. -Metrics/ModuleLength: - Max: 163 + Max: 29 -# Offense count: 4 +# Offense count: 3 # Configuration parameters: IgnoredMethods. Metrics/PerceivedComplexity: Max: 13 @@ -150,6 +145,7 @@ Rails/HasManyOrHasOneDependent: Rails/OutputSafety: Exclude: - 'app/helpers/application_helper.rb' + - 'app/helpers/rates_helper.rb' # Offense count: 11 # Configuration parameters: ForbiddenMethods, AllowedMethods. diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5380ae7d..835a0fdd 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,171 +1,6 @@ # frozen_string_literal: true module ApplicationHelper - def btc_human(amount, options = {}) - amount ||= 0 - nobr = options.key?(:nobr) ? options[:nobr] : true - denom = if options.key?(:denom) - options[:denom] - else - (try(:current_user) ? current_user.denom : 0) - end - case denom - when 0 - btc = to_btc(amount) - when 1 - btc = to_mbtc(amount) - when 2 - btc = to_ubtc(amount) - when 3 - btc = to_satoshi(amount) - when 4 - btc = to_usd(amount) - when 5 - btc = to_eur(amount) - when 6 - btc = to_aud(amount) - when 7 - btc = to_brl(amount) - when 8 - btc = to_cad(amount) - when 9 - btc = to_cny(amount) - when 10 - btc = to_gbp(amount) - when 11 - btc = to_idr(amount) - when 12 - btc = to_ils(amount) - when 13 - btc = to_jpy(amount) - when 14 - btc = to_mxn(amount) - when 15 - btc = to_nok(amount) - when 16 - btc = to_nzd(amount) - when 17 - btc = to_pln(amount) - when 18 - btc = to_ron(amount) - when 19 - btc = to_rub(amount) - when 20 - btc = to_sek(amount) - when 21 - btc = to_sgd(amount) - when 22 - btc = to_zar(amount) - end - btc = "#{btc}" if nobr - btc.html_safe - end - - def to_btc(satoshies) - format('%.8f Ƀ', (1.0 * satoshies.to_i / 1e8)) - end - - def to_mbtc(satoshies) - format('%.5f mɃ', (1.0 * satoshies.to_i / 1e5)) - end - - def to_ubtc(satoshies) - format('%.2f μɃ', (1.0 * satoshies.to_i / 1e2)) - end - - def to_satoshi(satoshies) - format('%.0f Satoshi', satoshies) - end - - def to_usd(satoshies) - format('$%.2f', rate('USD', satoshies)) - end - - def to_aud(satoshies) - format('$%.2f', rate('AUD', satoshies)) - end - - def to_eur(satoshies) - format('%.2f€', rate('EUR', satoshies)) - end - - def to_brl(satoshies) - format('R$%.2f', rate('BRL', satoshies)) - end - - def to_cad(satoshies) - format('$%.2f', rate('CAD', satoshies)) - end - - def to_cny(satoshies) - format('%.2f¥', rate('CNY', satoshies)) - end - - def to_gbp(satoshies) - format('%.2f£', rate('GBP', satoshies)) - end - - def to_idr(satoshies) - format('%.2f Rp', rate('IDR', satoshies)) - end - - def to_ils(satoshies) - format('%.2f₪', rate('ILS', satoshies)) - end - - def to_jpy(satoshies) - format('%.2f¥', rate('JPY', satoshies)) - end - - def to_mxn(satoshies) - format('%.2f MXN', rate('MXN', satoshies)) - end - - def to_nok(satoshies) - format('%.2f kr', rate('NOK', satoshies)) - end - - def to_nzd(satoshies) - format('$%.2f', rate('NZD', satoshies)) - end - - def to_pln(satoshies) - format('%.2f zł', rate('PLN', satoshies)) - end - - def to_ron(satoshies) - format('%.2f lei', rate('RON', satoshies)) - end - - def to_rub(satoshies) - format('%.2f₽', rate('RUB', satoshies)) - end - - def to_sek(satoshies) - format('%.2f kr', rate('SEK', satoshies)) - end - - def to_sgd(satoshies) - format('%.2f S$', rate('SGD', satoshies)) - end - - def to_zar(satoshies) - format('%.2f R', rate('ZAR', satoshies)) - end - - def rate(currency, satoshies) - satoshies * 0.00000001 * get_rate(currency) - end - - def get_rate(currency) - Rails.cache.fetch("####{currency}", expires_in: 1.hour) do - uri = URI("https://api.coindesk.com/v1/bpi/currentprice/#{currency}.json") - response = Net::HTTP.get_response(uri) - hash = JSON.parse(response.body) - hash['bpi'][currency]['rate_float'].to_f - end - end - def render_flash_messages html = [] flash.each do |type, message| diff --git a/app/helpers/rates_helper.rb b/app/helpers/rates_helper.rb new file mode 100644 index 00000000..537af960 --- /dev/null +++ b/app/helpers/rates_helper.rb @@ -0,0 +1,134 @@ +# frozen_string_literal: true + +module RatesHelper + DENOMINATIONS = %w[ + BTC mBTC μBTC Satoshi USD EUR AUD BRL CAD CNY GBP IDR ILS JPY MXN NOK NZD PLN RON RUB SEK SGD ZAR + ].freeze + + def denom_options_for_select + # [["BTC", "0"], ["mBTC", "1"], ... + DENOMINATIONS.each_with_index.map { |label, index| [label, index.to_s] } + end + + def btc_human(amount, options = {}) + nobr = options.key?(:nobr) ? options[:nobr] : true + denom = options.key?(:denom) ? options[:denom] : current_user&.denom || 0 + + btc = to_denom(denom, amount) + btc = "#{btc}" if nobr + btc.html_safe + end + + private + + def to_denom(denom, amount) + amount ||= 0 + convert_method_name = "to_#{DENOMINATIONS[denom].gsub('μ', 'u').downcase}" + send(convert_method_name, amount) + end + + def to_btc(satoshies) + format('%.8f Ƀ', (1.0 * satoshies.to_i / 1e8)) + end + + def to_mbtc(satoshies) + format('%.5f mɃ', (1.0 * satoshies.to_i / 1e5)) + end + + def to_ubtc(satoshies) + format('%.2f μɃ', (1.0 * satoshies.to_i / 1e2)) + end + + def to_satoshi(satoshies) + format('%.0f Satoshi', satoshies) + end + + def to_usd(satoshies) + format('$%.2f', rate('USD', satoshies)) + end + + def to_aud(satoshies) + format('$%.2f', rate('AUD', satoshies)) + end + + def to_eur(satoshies) + format('%.2f€', rate('EUR', satoshies)) + end + + def to_brl(satoshies) + format('R$%.2f', rate('BRL', satoshies)) + end + + def to_cad(satoshies) + format('$%.2f', rate('CAD', satoshies)) + end + + def to_cny(satoshies) + format('%.2f¥', rate('CNY', satoshies)) + end + + def to_gbp(satoshies) + format('%.2f£', rate('GBP', satoshies)) + end + + def to_idr(satoshies) + format('%.2f Rp', rate('IDR', satoshies)) + end + + def to_ils(satoshies) + format('%.2f₪', rate('ILS', satoshies)) + end + + def to_jpy(satoshies) + format('%.2f¥', rate('JPY', satoshies)) + end + + def to_mxn(satoshies) + format('%.2f MXN', rate('MXN', satoshies)) + end + + def to_nok(satoshies) + format('%.2f kr', rate('NOK', satoshies)) + end + + def to_nzd(satoshies) + format('$%.2f', rate('NZD', satoshies)) + end + + def to_pln(satoshies) + format('%.2f zł', rate('PLN', satoshies)) + end + + def to_ron(satoshies) + format('%.2f lei', rate('RON', satoshies)) + end + + def to_rub(satoshies) + format('%.2f₽', rate('RUB', satoshies)) + end + + def to_sek(satoshies) + format('%.2f kr', rate('SEK', satoshies)) + end + + def to_sgd(satoshies) + format('%.2f S$', rate('SGD', satoshies)) + end + + def to_zar(satoshies) + format('%.2f R', rate('ZAR', satoshies)) + end + + def rate(currency, satoshies) + satoshies * 0.00000001 * get_rate(currency) + end + + def get_rate(currency) + Rails.cache.fetch("####{currency}", expires_in: 1.hour) do + uri = URI("https://api.coindesk.com/v1/bpi/currentprice/#{currency}.json") + response = Net::HTTP.get_response(uri) + hash = JSON.parse(response.body) + hash['bpi'][currency]['rate_float'].to_f + end + end +end diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index 44b97a64..2ae12731 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -5,7 +5,7 @@ = btc_human @user.balance = form_for(@user) do |f| = f.select :denom, - options_for_select([["BTC", "0"], ["mBTC", "1"], ["μBTC", "2"], ["Satoshi", "3"], ["USD", "4"], ["EUR", "5"], ["AUD", "6"], ["BRL", "7"], ["CAD", "8"], ["CNY", "9"], ["GBP", "10"], ["IDR", "11"], ["ILS", "12"], ["JPY", "13"], ["MXN", "14"], ["NOK", "15"], ["NZD", "16"], ["PLN", "17"], ["RON", "18"], ["RUB", "19"], ["SEK", "20"], ["SGD", "21"], ["ZAR", "22"]], selected: @user.denom) + options_for_select(denom_options_for_select, selected: @user.denom) = f.submit "save" %p %small= raw t('.threshold', threshold: btc_human(CONFIG["min_payout"])) @@ -53,4 +53,4 @@ = bootstrap_form_for @user, html: {class: (params[:delete_user] ? '' : 'collapse'), id: 'delete_user_form', method: 'DELETE'} do |f| %p= t('.delete_account_notice') = f.text_field :email, value: '', autocomplete: "off" - = f.submit t('.delete_account_confirm'), class: 'btn btn-danger' \ No newline at end of file + = f.submit t('.delete_account_confirm'), class: 'btn btn-danger' From ff7ff2ec81f381c8305a3654f19b603a167f2c40 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 6 Dec 2020 18:33:49 +0100 Subject: [PATCH 346/415] refactored omniauth controller --- .rubocop_todo.yml | 10 ++--- .../users/omniauth_callbacks_controller.rb | 40 ++++++++++--------- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 4d936c8e..02fa5094 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,12 +1,12 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2020-12-06 11:41:05 UTC using RuboCop version 1.5.2. +# on 2020-12-06 17:32:53 UTC using RuboCop version 1.5.2. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 17 +# Offense count: 16 # Configuration parameters: IgnoredMethods, CountRepeatedAttributes. Metrics/AbcSize: Max: 34 @@ -22,17 +22,17 @@ Metrics/BlockLength: Metrics/ClassLength: Max: 187 -# Offense count: 3 +# Offense count: 2 # Configuration parameters: IgnoredMethods. Metrics/CyclomaticComplexity: Max: 16 -# Offense count: 18 +# Offense count: 17 # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. Metrics/MethodLength: Max: 29 -# Offense count: 3 +# Offense count: 2 # Configuration parameters: IgnoredMethods. Metrics/PerceivedComplexity: Max: 13 diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb index ca40bf05..c5f0984c 100644 --- a/app/controllers/users/omniauth_callbacks_controller.rb +++ b/app/controllers/users/omniauth_callbacks_controller.rb @@ -2,32 +2,36 @@ module Users class OmniauthCallbacksController < Devise::OmniauthCallbacksController - before_action :load_omniauth_info, only: :github + before_action :load_omniauth_info, + :load_user_from_omniauth_info, + :update_user_from_omniauth_info, only: :github def github - @user = User.find_by(nickname: @omniauth_info.nickname) || - User.find_by(email: @omniauth_info.email) - - if @user.present? - if @omniauth_info.email.present? && @user.email != @omniauth_info.email - # update email if it has been changed - @user.update email: @omniauth_info.email - end - elsif @omniauth_info.email.present? # user not found - @user = User.create_with_omniauth!(@omniauth_info) - else - set_flash_message(:error, :failure, kind: 'GitHub', reason: I18n.t('devise.errors.primary_email')) - redirect_to new_user_session_path and return - end - - @user.update(@omniauth_info.slice(:name, :image).as_json) - sign_in_and_redirect @user, event: :authentication set_flash_message(:notice, :success, kind: 'GitHub') if is_navigational_format? end private + def update_user_from_omniauth_info + update_hash = @omniauth_info.slice(:name, :image).as_json + update_hash[:email] = @omniauth_info.email if @omniauth_info.email.present? + + @user.update(update_hash) + end + + def load_user_from_omniauth_info + @user = User.find_by(nickname: @omniauth_info.nickname) || + User.find_by(email: @omniauth_info.email) + return if @user + + @user = User.create_with_omniauth!(@omniauth_info) if @omniauth_info.email.present? + return if @user + + set_flash_message(:error, :failure, kind: 'GitHub', reason: I18n.t('devise.errors.primary_email')) + redirect_to new_user_session_path + end + def load_omniauth_info @omniauth_info = request.env['omniauth.auth']['info'] return if @omniauth_info From 1701f4cdfb27989a8a07d7f44f2bbea6f6050261 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 6 Dec 2020 19:09:45 +0100 Subject: [PATCH 347/415] rubocop fixes --- .rubocop_todo.yml | 40 +----- spec/controllers/deposits_controller_spec.rb | 9 -- spec/controllers/home_controller_spec.rb | 32 ----- spec/controllers/projects_controller_spec.rb | 125 +----------------- spec/controllers/tips_controller_spec.rb | 9 -- spec/controllers/users_controller_spec.rb | 64 --------- .../withdrawals_controller_spec.rb | 9 -- spec/{misc_spec.rb => features/assets.rb} | 2 +- spec/models/send_many_spec.rb | 9 -- spec/routing/deposits_routing_spec.rb | 12 ++ spec/routing/home_routing_spec.rb | 28 ++++ spec/routing/projects_routing_spec.rb | 124 +++++++++++++++++ spec/routing/tips_routing_spec.rb | 12 ++ spec/routing/users_routing_spec.rb | 67 ++++++++++ spec/routing/withdrawals_routing_spec.rb | 12 ++ 15 files changed, 264 insertions(+), 290 deletions(-) rename spec/{misc_spec.rb => features/assets.rb} (90%) delete mode 100644 spec/models/send_many_spec.rb create mode 100644 spec/routing/deposits_routing_spec.rb create mode 100644 spec/routing/home_routing_spec.rb create mode 100644 spec/routing/projects_routing_spec.rb create mode 100644 spec/routing/tips_routing_spec.rb create mode 100644 spec/routing/users_routing_spec.rb create mode 100644 spec/routing/withdrawals_routing_spec.rb diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 02fa5094..708ba3d1 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2020-12-06 17:32:53 UTC using RuboCop version 1.5.2. +# on 2020-12-06 18:08:51 UTC using RuboCop version 1.5.2. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -11,11 +11,11 @@ Metrics/AbcSize: Max: 34 -# Offense count: 17 +# Offense count: 15 # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. # IgnoredMethods: refine Metrics/BlockLength: - Max: 224 + Max: 117 # Offense count: 2 # Configuration parameters: CountComments, CountAsOne. @@ -47,45 +47,22 @@ Naming/PredicateName: Exclude: - 'app/models/project.rb' -# Offense count: 3 +# Offense count: 1 # Configuration parameters: Prefixes. # Prefixes: when, with, without RSpec/ContextWording: Exclude: - 'spec/controllers/projects_controller_spec.rb' -# Offense count: 1 -# Configuration parameters: IgnoredMetadata. -RSpec/DescribeClass: - Exclude: - - 'spec/misc_spec.rb' - # Offense count: 13 # Configuration parameters: Max. RSpec/ExampleLength: Exclude: - 'spec/controllers/projects_controller_spec.rb' - - 'spec/controllers/users_controller_spec.rb' - 'spec/lib/blacklist_spec.rb' - 'spec/models/deposit_spec.rb' - -# Offense count: 25 -# Cop supports --auto-correct. -RSpec/ExpectActual: - Exclude: - - 'spec/controllers/deposits_controller_spec.rb' - - 'spec/controllers/home_controller_spec.rb' - - 'spec/controllers/projects_controller_spec.rb' - - 'spec/controllers/tips_controller_spec.rb' - - 'spec/controllers/users_controller_spec.rb' - - 'spec/controllers/withdrawals_controller_spec.rb' - -# Offense count: 1 -# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly. -# Include: **/*_spec*rb*, **/spec/**/* -RSpec/FilePath: - Exclude: - - 'spec/models/send_many_spec.rb' + - 'spec/routing/projects_routing_spec.rb' + - 'spec/routing/users_routing_spec.rb' # Offense count: 2 # Configuration parameters: AssignmentOnly. @@ -117,11 +94,6 @@ RSpec/NamedSubject: RSpec/NestedGroups: Max: 5 -# Offense count: 2 -RSpec/RepeatedExample: - Exclude: - - 'spec/controllers/home_controller_spec.rb' - # Offense count: 2 RSpec/RepeatedExampleGroupBody: Exclude: diff --git a/spec/controllers/deposits_controller_spec.rb b/spec/controllers/deposits_controller_spec.rb index 287e58bf..40f18930 100644 --- a/spec/controllers/deposits_controller_spec.rb +++ b/spec/controllers/deposits_controller_spec.rb @@ -9,13 +9,4 @@ expect(response).to be_successful end end - - describe 'routing' do - it 'routes GET / to Deposits#index' do - expect({ get: '/deposits' }).to route_to( - controller: 'deposits', - action: 'index' - ) - end - end end diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb index 8a6b1e79..09c20eed 100644 --- a/spec/controllers/home_controller_spec.rb +++ b/spec/controllers/home_controller_spec.rb @@ -14,36 +14,4 @@ expect(subject.status).to eq 200 end end - - describe 'routing' do - it 'routes GET / to Home#index' do - expect({ get: '/' }).to route_to( - controller: 'home', - action: 'index' - ) - end - - it 'routes GET /home to Home#index' do - expect({ get: '/' }).to route_to( - controller: 'home', - action: 'index' - ) - end - - it 'routes GET /users/999999/no-such-path to Home#index' do - expect({ get: '/users/999999/no-such-path' }).to route_to( - controller: 'home', - action: 'index', - path: 'users/999999/no-such-path' - ) - end - - it 'routes GET /any/non-existent/path to Home#index' do - expect({ get: '/any/non-existent/path' }).to route_to( - controller: 'home', - action: 'index', - path: 'any/non-existent/path' - ) - end - end end diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index 11f8347f..c166f257 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -71,7 +71,7 @@ shared_context 'accessing_project' do |verb, action| let(:a_project) { create :project, host: 'github', full_name: 'test/test' } - context 'existing_project' do + context 'with existsing project' do it 'via project id returns 302 status code' do case verb when :get @@ -93,7 +93,7 @@ end end - context 'nonexisting_project' do + context 'with non-existing project' do it 'via project id returns 302 status code' do case verb when :get @@ -158,125 +158,4 @@ expect(response).to be_redirect end end - - describe 'routing' do - it 'routes GET /projects to Project#index' do - expect({ get: '/projects' }).to route_to( - controller: 'projects', - action: 'index' - ) - end - - it 'routes GET /projects/search?query= to Project#search' do - expect({ get: '/projects/search?query=seldon&order=balance' }).to route_to( - controller: 'projects', - action: 'search', - query: 'seldon', - order: 'balance' - ) - end - - it 'routes GET /projects/1 to Project#show' do - expect({ get: '/projects/1' }).to route_to( - controller: 'projects', - action: 'show', - id: '1' - ) - end - - it 'routes GET /projects/1/edit to Project#edit' do - expect({ get: '/projects/1/edit' }).to route_to( - controller: 'projects', - action: 'edit', - id: '1' - ) - end - - it 'routes PUT /projects/1 to Project#update' do - expect({ put: '/projects/1' }).to route_to( - controller: 'projects', - action: 'update', - id: '1' - ) - end - - it 'routes GET /projects/1/decide_tip_amounts to Project#decide_tip_amounts' do - expect({ get: '/projects/1/decide_tip_amounts' }).to route_to( - controller: 'projects', - action: 'decide_tip_amounts', - id: '1' - ) - end - - it 'routes PATCH /projects/1/decide_tip_amounts to Project#decide_tip_amounts' do - expect({ patch: '/projects/1/decide_tip_amounts' }).to route_to( - controller: 'projects', - action: 'decide_tip_amounts', - id: '1' - ) - end - - it 'routes GET /projects/1/tips to Tips#index' do - expect({ get: '/projects/1/tips' }).to route_to( - controller: 'tips', - action: 'index', - project_id: '1' - ) - end - - it 'routes GET /projects/1/deposits to Deposits#index' do - expect({ get: '/projects/1/deposits' }).to route_to( - controller: 'deposits', - action: 'index', - project_id: '1' - ) - end - end - - describe 'Project pretty url routing' do - it 'routes GET /:provider/:repo to Project#show' do - expect({ get: '/github/test/test' }).to route_to( - controller: 'projects', - action: 'show', - service: 'github', - repo: 'test/test' - ) - end - - it 'routes GET /:provider/:repo/edit to Project#edit' do - expect({ get: '/github/test/test/edit' }).to route_to( - controller: 'projects', - action: 'edit', - service: 'github', - repo: 'test/test' - ) - end - - it 'routes GET /:provider/:repo/decide_tip_amounts to Project#decide_tip_amounts' do - expect({ get: '/github/test/test/decide_tip_amounts' }).to route_to( - controller: 'projects', - action: 'decide_tip_amounts', - service: 'github', - repo: 'test/test' - ) - end - - it 'routes GET /:provider/:repo/tips to Project#tips' do - expect({ get: '/github/test/test/tips' }).to route_to( - controller: 'tips', - action: 'index', - service: 'github', - repo: 'test/test' - ) - end - - it 'routes GET /:provider/:repo/deposits to Project#deposits' do - expect({ get: '/github/test/test/deposits' }).to route_to( - controller: 'deposits', - action: 'index', - service: 'github', - repo: 'test/test' - ) - end - end end diff --git a/spec/controllers/tips_controller_spec.rb b/spec/controllers/tips_controller_spec.rb index d060ccf2..c64e8395 100644 --- a/spec/controllers/tips_controller_spec.rb +++ b/spec/controllers/tips_controller_spec.rb @@ -9,13 +9,4 @@ expect(response).to be_successful end end - - describe 'routing' do - it 'routes GET / to Tips#index' do - expect({ get: '/tips' }).to route_to( - controller: 'tips', - action: 'index' - ) - end - end end diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index c9c52616..3cc59d1f 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -95,68 +95,4 @@ end end end - - describe 'routing' do - it 'routes GET /users to User#index' do - expect({ get: '/users' }).to route_to( - controller: 'users', - action: 'index' - ) - end - - it 'routes GET /users/nick-name321 to User#show' do - expect({ get: '/users/nick-name321' }).to route_to( - controller: 'users', - action: 'show', - nickname: 'nick-name321' - ) - end - - it 'routes GET /users/login to User#login' do - expect({ get: '/users/login' }).to route_to( - controller: 'users', - action: 'login' - ) - end - - it 'routes GET /users/1/tips to Tips#index' do - expect({ get: '/users/1/tips' }).to route_to( - controller: 'tips', - action: 'index', - user_id: '1' - ) - end - end - - describe 'pretty url routing' do - let(:user) { create(:user) } - - it 'regex rejects reserved user paths' do - # accepted pertty url usernames - should_accept = [' ', 'logi', 'ogin', 's4c2', '42x', 'nick name', 'kd'] - # reserved routes (rejected pertty url usernames) - should_reject = ['', '1', '42'] - - accepted = should_accept.select { |ea| ea =~ /\D+/ } - rejected = should_reject.select { |ea| (ea =~ /\D+/).nil? } - (expect(accepted.size).to eq(should_accept.size)) && - (expect(rejected.size).to eq(should_reject.size)) - end - - it 'routes GET /users/:nickname to User#show' do - expect({ get: "/users/#{user.nickname}" }).to route_to( - controller: 'users', - action: 'show', - nickname: 'kd' - ) - end - - it 'routes GET /users/:nickname/tips to Tips#index' do - expect({ get: "/users/#{user.nickname}/tips" }).to route_to( - controller: 'tips', - action: 'index', - nickname: 'kd' - ) - end - end end diff --git a/spec/controllers/withdrawals_controller_spec.rb b/spec/controllers/withdrawals_controller_spec.rb index d1db2351..6bbbea1f 100644 --- a/spec/controllers/withdrawals_controller_spec.rb +++ b/spec/controllers/withdrawals_controller_spec.rb @@ -9,13 +9,4 @@ expect(response).to be_successful end end - - describe 'routing' do - it 'routes GET / to Withdrawals#index' do - expect({ get: '/withdrawals' }).to route_to( - controller: 'withdrawals', - action: 'index' - ) - end - end end diff --git a/spec/misc_spec.rb b/spec/features/assets.rb similarity index 90% rename from spec/misc_spec.rb rename to spec/features/assets.rb index bd3988b5..1814fabb 100644 --- a/spec/misc_spec.rb +++ b/spec/features/assets.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe 'Misc tets' do +describe 'Assets', type: :feature do let(:locales) { Rails.application.config.available_locales } it 'has a flag image for each locale' do diff --git a/spec/models/send_many_spec.rb b/spec/models/send_many_spec.rb deleted file mode 100644 index 428efb30..00000000 --- a/spec/models/send_many_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -describe Sendmany, type: :model do - describe 'Associations' do - it { is_expected.to have_many :tips } - end -end diff --git a/spec/routing/deposits_routing_spec.rb b/spec/routing/deposits_routing_spec.rb new file mode 100644 index 00000000..8289c3aa --- /dev/null +++ b/spec/routing/deposits_routing_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'routes for Deposits', type: :routing do + it 'routes GET / to Deposits#index' do + expect({ get: '/deposits' }).to route_to( + controller: 'deposits', + action: 'index' + ) + end +end diff --git a/spec/routing/home_routing_spec.rb b/spec/routing/home_routing_spec.rb new file mode 100644 index 00000000..b8c3e81d --- /dev/null +++ b/spec/routing/home_routing_spec.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'routes for Home', type: :routing do + it 'routes GET / to Home#index' do + expect({ get: '/' }).to route_to( + controller: 'home', + action: 'index' + ) + end + + it 'routes GET /users/999999/no-such-path to Home#index' do + expect({ get: '/users/999999/no-such-path' }).to route_to( + controller: 'home', + action: 'index', + path: 'users/999999/no-such-path' + ) + end + + it 'routes GET /any/non-existent/path to Home#index' do + expect({ get: '/any/non-existent/path' }).to route_to( + controller: 'home', + action: 'index', + path: 'any/non-existent/path' + ) + end +end diff --git a/spec/routing/projects_routing_spec.rb b/spec/routing/projects_routing_spec.rb new file mode 100644 index 00000000..41d1040f --- /dev/null +++ b/spec/routing/projects_routing_spec.rb @@ -0,0 +1,124 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'routes for Projects', type: :routing do + it 'routes GET /projects to Project#index' do + expect({ get: '/projects' }).to route_to( + controller: 'projects', + action: 'index' + ) + end + + it 'routes GET /projects/search?query= to Project#search' do + expect({ get: '/projects/search?query=seldon&order=balance' }).to route_to( + controller: 'projects', + action: 'search', + query: 'seldon', + order: 'balance' + ) + end + + it 'routes GET /projects/1 to Project#show' do + expect({ get: '/projects/1' }).to route_to( + controller: 'projects', + action: 'show', + id: '1' + ) + end + + it 'routes GET /projects/1/edit to Project#edit' do + expect({ get: '/projects/1/edit' }).to route_to( + controller: 'projects', + action: 'edit', + id: '1' + ) + end + + it 'routes PUT /projects/1 to Project#update' do + expect({ put: '/projects/1' }).to route_to( + controller: 'projects', + action: 'update', + id: '1' + ) + end + + it 'routes GET /projects/1/decide_tip_amounts to Project#decide_tip_amounts' do + expect({ get: '/projects/1/decide_tip_amounts' }).to route_to( + controller: 'projects', + action: 'decide_tip_amounts', + id: '1' + ) + end + + it 'routes PATCH /projects/1/decide_tip_amounts to Project#decide_tip_amounts' do + expect({ patch: '/projects/1/decide_tip_amounts' }).to route_to( + controller: 'projects', + action: 'decide_tip_amounts', + id: '1' + ) + end + + it 'routes GET /projects/1/tips to Tips#index' do + expect({ get: '/projects/1/tips' }).to route_to( + controller: 'tips', + action: 'index', + project_id: '1' + ) + end + + it 'routes GET /projects/1/deposits to Deposits#index' do + expect({ get: '/projects/1/deposits' }).to route_to( + controller: 'deposits', + action: 'index', + project_id: '1' + ) + end + + describe 'Project pretty url routing' do + it 'routes GET /:provider/:repo to Project#show' do + expect({ get: '/github/test/test' }).to route_to( + controller: 'projects', + action: 'show', + service: 'github', + repo: 'test/test' + ) + end + + it 'routes GET /:provider/:repo/edit to Project#edit' do + expect({ get: '/github/test/test/edit' }).to route_to( + controller: 'projects', + action: 'edit', + service: 'github', + repo: 'test/test' + ) + end + + it 'routes GET /:provider/:repo/decide_tip_amounts to Project#decide_tip_amounts' do + expect({ get: '/github/test/test/decide_tip_amounts' }).to route_to( + controller: 'projects', + action: 'decide_tip_amounts', + service: 'github', + repo: 'test/test' + ) + end + + it 'routes GET /:provider/:repo/tips to Project#tips' do + expect({ get: '/github/test/test/tips' }).to route_to( + controller: 'tips', + action: 'index', + service: 'github', + repo: 'test/test' + ) + end + + it 'routes GET /:provider/:repo/deposits to Project#deposits' do + expect({ get: '/github/test/test/deposits' }).to route_to( + controller: 'deposits', + action: 'index', + service: 'github', + repo: 'test/test' + ) + end + end +end diff --git a/spec/routing/tips_routing_spec.rb b/spec/routing/tips_routing_spec.rb new file mode 100644 index 00000000..23216754 --- /dev/null +++ b/spec/routing/tips_routing_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'routes for Tips', type: :routing do + it 'routes GET / to Tips#index' do + expect({ get: '/tips' }).to route_to( + controller: 'tips', + action: 'index' + ) + end +end diff --git a/spec/routing/users_routing_spec.rb b/spec/routing/users_routing_spec.rb new file mode 100644 index 00000000..2f8e6993 --- /dev/null +++ b/spec/routing/users_routing_spec.rb @@ -0,0 +1,67 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'routes for Users', type: :routing do + it 'routes GET /users to User#index' do + expect({ get: '/users' }).to route_to( + controller: 'users', + action: 'index' + ) + end + + it 'routes GET /users/nick-name321 to User#show' do + expect({ get: '/users/nick-name321' }).to route_to( + controller: 'users', + action: 'show', + nickname: 'nick-name321' + ) + end + + it 'routes GET /users/login to User#login' do + expect({ get: '/users/login' }).to route_to( + controller: 'users', + action: 'login' + ) + end + + it 'routes GET /users/1/tips to Tips#index' do + expect({ get: '/users/1/tips' }).to route_to( + controller: 'tips', + action: 'index', + user_id: '1' + ) + end + + describe 'pretty url routing' do + let(:user) { create(:user) } + + it 'regex rejects reserved user paths' do + # accepted pertty url usernames + should_accept = [' ', 'logi', 'ogin', 's4c2', '42x', 'nick name', 'kd'] + # reserved routes (rejected pertty url usernames) + should_reject = ['', '1', '42'] + + accepted = should_accept.select { |ea| ea =~ /\D+/ } + rejected = should_reject.select { |ea| (ea =~ /\D+/).nil? } + (expect(accepted.size).to eq(should_accept.size)) && + (expect(rejected.size).to eq(should_reject.size)) + end + + it 'routes GET /users/:nickname to User#show' do + expect({ get: "/users/#{user.nickname}" }).to route_to( + controller: 'users', + action: 'show', + nickname: 'kd' + ) + end + + it 'routes GET /users/:nickname/tips to Tips#index' do + expect({ get: "/users/#{user.nickname}/tips" }).to route_to( + controller: 'tips', + action: 'index', + nickname: 'kd' + ) + end + end +end diff --git a/spec/routing/withdrawals_routing_spec.rb b/spec/routing/withdrawals_routing_spec.rb new file mode 100644 index 00000000..e64eac7f --- /dev/null +++ b/spec/routing/withdrawals_routing_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'routes for Withdrawals', type: :routing do + it 'routes GET / to Withdrawals#index' do + expect({ get: '/withdrawals' }).to route_to( + controller: 'withdrawals', + action: 'index' + ) + end +end From 5f462e488f3a230f05428a904f1c0d5ddd548dea Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Fri, 11 Dec 2020 09:33:36 +0100 Subject: [PATCH 348/415] added spec for users#destroy route --- spec/routing/users_routing_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/routing/users_routing_spec.rb b/spec/routing/users_routing_spec.rb index 2f8e6993..3118aacd 100644 --- a/spec/routing/users_routing_spec.rb +++ b/spec/routing/users_routing_spec.rb @@ -33,6 +33,14 @@ ) end + it 'routes DELETE /users/1 to Tips#destroy' do + expect({ delete: '/users/1' }).to route_to( + controller: 'users', + action: 'destroy', + id: '1' + ) + end + describe 'pretty url routing' do let(:user) { create(:user) } From 11552d2357bce8e8e7dc003ca8033bc06969a1f0 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Fri, 11 Dec 2020 10:22:16 +0100 Subject: [PATCH 349/415] reduced complexity --- .rubocop_todo.yml | 6 +++--- app/controllers/projects_controller.rb | 20 ++++++++++++++++---- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 708ba3d1..ec0ccd09 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,12 +1,12 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2020-12-06 18:08:51 UTC using RuboCop version 1.5.2. +# on 2020-12-11 09:21:43 UTC using RuboCop version 1.5.2. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 16 +# Offense count: 15 # Configuration parameters: IgnoredMethods, CountRepeatedAttributes. Metrics/AbcSize: Max: 34 @@ -27,7 +27,7 @@ Metrics/ClassLength: Metrics/CyclomaticComplexity: Max: 16 -# Offense count: 17 +# Offense count: 16 # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. Metrics/MethodLength: Max: 29 diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index d6a6bde0..e789d7e7 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -49,8 +49,17 @@ def update def decide_tip_amounts authorize! :decide_tip_amounts, @project return unless request.patch? + return unless validate_project_tips @project.available_amount # preload anything required to get the amount, otherwise it's loaded during the assignation and there are undesirable consequences + return unless @project.update(permitted_project_tips_params) + + tips_decided + end + + private + + def validate_project_tips percentages = params[:project][:tips_attributes].values.map { |tip| tip['amount_percentage'].to_f } if percentages.sum > 100 redirect_to decide_tip_amounts_project_path(@project), alert: I18n.t('errors.can_assign_more_tips') @@ -58,9 +67,14 @@ def decide_tip_amounts end raise 'wrong data' if percentages.min.negative? - @project.attributes = params.require(:project).permit(tips_attributes: %i[id amount_percentage]) - return unless @project.save + true + end + + def permitted_project_tips_params + params.require(:project).permit(tips_attributes: %i[id amount_percentage]) + end + def tips_decided message = I18n.t('notices.tips_decided') if @project.has_undecided_tips? redirect_to decide_tip_amounts_project_path(@project), notice: message @@ -69,8 +83,6 @@ def decide_tip_amounts end end - private - def load_project @project = if pretty_project_path? Project.find_by_service_and_repo(params[:service], params[:repo]) From 84d005f510e743b96d4adb5961ef4483d59f8fbd Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Fri, 11 Dec 2020 10:24:13 +0100 Subject: [PATCH 350/415] updated rubocop --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index edbb4deb..60c53382 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -341,7 +341,7 @@ GEM rspec-mocks (~> 3.9) rspec-support (~> 3.9) rspec-support (3.10.0) - rubocop (1.5.2) + rubocop (1.6.1) parallel (~> 1.10) parser (>= 2.7.1.5) rainbow (>= 2.2.2, < 4.0) @@ -352,10 +352,10 @@ GEM unicode-display_width (>= 1.4.0, < 2.0) rubocop-ast (1.3.0) parser (>= 2.7.1.5) - rubocop-rails (2.8.1) + rubocop-rails (2.9.0) activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 0.87.0) + rubocop (>= 0.90.0, < 2.0) rubocop-rspec (2.0.1) rubocop (~> 1.0) rubocop-ast (>= 1.1.0) From df7d2c971056818bc73c1cc71402a6fa7dbf016d Mon Sep 17 00:00:00 2001 From: kaue Date: Sat, 6 Feb 2021 07:26:55 -0300 Subject: [PATCH 351/415] update license copyright year (#403) --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 62c97553..ba6c1a51 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2018 tip4commit +Copyright (c) 2021 tip4commit Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in From 65eaa7bf5788ea94186587de541ad1e4c5685eaf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 19 Mar 2023 15:09:07 +0100 Subject: [PATCH 352/415] Bump rack from 2.2.3 to 2.2.6.2 (#432) Bumps [rack](https://github.com/rack/rack) from 2.2.3 to 2.2.6.2. - [Release notes](https://github.com/rack/rack/releases) - [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md) - [Commits](https://github.com/rack/rack/compare/2.2.3...v2.2.6.2) --- updated-dependencies: - dependency-name: rack dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 60c53382..fc792e43 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -266,7 +266,7 @@ GEM parser (2.7.2.0) ast (~> 2.4.1) public_suffix (4.0.6) - rack (2.2.3) + rack (2.2.6.2) rack-test (1.1.0) rack (>= 1.0, < 3) rails (5.2.4.4) From 2bb7c4068f23ca9b307beabc19eec27f3ce5cfa6 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 19 Mar 2023 15:17:15 +0100 Subject: [PATCH 353/415] Replaced travis ci with github actions --- .github/workflows/build.yml | 47 +++++++++++++++++++++++++++++++++++++ .travis.yml | 21 ----------------- README.md | 2 +- 3 files changed, 48 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..4b4bec84 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,47 @@ +name: Build + +on: + push: + branches: + - master + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + ruby-version: [2.6.6] + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Ruby ${{ matrix.ruby-version }} + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true + + - name: Install dependencies + run: | + bundle config path vendor/bundle + bundle install --jobs=9 --retry=2 --without development --quiet + + - name: Setup database + run: | + cp config/config.yml.sample config/config.yml + cp config/database.yml.sample config/database.yml + bundle exec rake db:migrate + + - name: Rubocop + run: | + bundle exec rubocop + + - name: Run RSpec + run: | + bundle exec rake spec + + - name: Run Cucumber + run: | + bundle exec rake cucumber diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8e4b01eb..00000000 --- a/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -language: ruby - -sudo: false - -git: - depth: 10 - -rvm: - - 2.6.6 - -bundler_args: --without development --jobs=9 --retry=2 --quiet - -before_script: - - cp config/config.yml.sample config/config.yml - - cp config/database.yml.sample config/database.yml - -script: - - bundle exec rubocop - - bundle exec rake db:migrate - - bundle exec rake spec - - bundle exec rake cucumber diff --git a/README.md b/README.md index 3bfda6b4..a3d8ae80 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Tip4commit ========== [![tip for next commit](https://tip4commit.com/projects/307.svg)](https://tip4commit.com/projects/307) -[![Build Status](https://travis-ci.org/tip4commit/tip4commit.svg?branch=master)](https://travis-ci.org/tip4commit/tip4commit) +[![Build Status](https://github.com/tip4commit/tip4commit/workflows/Build/badge.svg)](https://github.com/tip4commit/tip4commit/actions) Donate bitcoins to open source projects or receive tips for code contributions. From a7443dbed9af1b4d994476f9298c3ca6f126dc8e Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 19 Mar 2023 15:45:14 +0100 Subject: [PATCH 354/415] Update ruby and rails to recover the build --- .github/workflows/build.yml | 2 +- .tool-versions | 1 + Gemfile | 5 +- Gemfile.lock | 158 +++++++++++++++++++----------------- 4 files changed, 89 insertions(+), 77 deletions(-) create mode 100644 .tool-versions diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4b4bec84..4630c430 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby-version: [2.6.6] + ruby-version: [2.7.7] steps: - name: Checkout code diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 00000000..33a8789f --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +ruby 2.7.7 diff --git a/Gemfile b/Gemfile index b7caddd2..c1483974 100644 --- a/Gemfile +++ b/Gemfile @@ -2,9 +2,9 @@ source 'https://rubygems.org' -ruby '2.6.6' +ruby '2.7.7' -gem 'rails', '5.2.4.4' +gem 'rails', '5.2.4.6' gem 'acts_as_paranoid' gem 'airbrake' @@ -40,7 +40,6 @@ gem 'sawyer' gem 'sdoc', group: :doc, require: false gem 'sidekiq' gem 'sprockets' -gem 'therubyracer', platforms: :ruby gem 'turbolinks' gem 'twitter-bootstrap-rails' gem 'uglifier' diff --git a/Gemfile.lock b/Gemfile.lock index fc792e43..7e150978 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,43 +1,43 @@ GEM remote: https://rubygems.org/ specs: - actioncable (5.2.4.4) - actionpack (= 5.2.4.4) + actioncable (5.2.4.6) + actionpack (= 5.2.4.6) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.4.4) - actionpack (= 5.2.4.4) - actionview (= 5.2.4.4) - activejob (= 5.2.4.4) + actionmailer (5.2.4.6) + actionpack (= 5.2.4.6) + actionview (= 5.2.4.6) + activejob (= 5.2.4.6) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.4.4) - actionview (= 5.2.4.4) - activesupport (= 5.2.4.4) + actionpack (5.2.4.6) + actionview (= 5.2.4.6) + activesupport (= 5.2.4.6) rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.4.4) - activesupport (= 5.2.4.4) + actionview (5.2.4.6) + activesupport (= 5.2.4.6) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.2.4.4) - activesupport (= 5.2.4.4) + activejob (5.2.4.6) + activesupport (= 5.2.4.6) globalid (>= 0.3.6) - activemodel (5.2.4.4) - activesupport (= 5.2.4.4) - activerecord (5.2.4.4) - activemodel (= 5.2.4.4) - activesupport (= 5.2.4.4) + activemodel (5.2.4.6) + activesupport (= 5.2.4.6) + activerecord (5.2.4.6) + activemodel (= 5.2.4.6) + activesupport (= 5.2.4.6) arel (>= 9.0) - activestorage (5.2.4.4) - actionpack (= 5.2.4.4) - activerecord (= 5.2.4.4) + activestorage (5.2.4.6) + actionpack (= 5.2.4.6) + activerecord (= 5.2.4.6) marcel (~> 0.3.1) - activesupport (5.2.4.4) + activesupport (5.2.4.6) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -93,7 +93,7 @@ GEM execjs coffee-script-source (1.12.2) commonjs (0.2.7) - concurrent-ruby (1.1.7) + concurrent-ruby (1.2.2) connection_pool (2.2.3) crack (0.4.4) crass (1.0.6) @@ -120,6 +120,7 @@ GEM cucumber-tag_expressions (1.1.1) cucumber-wire (0.0.1) database_cleaner (1.8.5) + date (3.3.3) demoji (0.0.7) devise (4.7.3) bcrypt (~> 3.0) @@ -140,7 +141,7 @@ GEM ed25519 (1.2.4) edge_rider (1.1.0) activerecord (>= 3.2) - erubi (1.10.0) + erubi (1.12.0) erubis (2.7.0) execjs (2.7.0) factory_bot (6.1.0) @@ -153,8 +154,8 @@ GEM ruby2_keywords ffi (1.13.1) gherkin (5.1.0) - globalid (0.4.2) - activesupport (>= 4.2.0) + globalid (1.1.0) + activesupport (>= 5.0) haml (5.2.1) temple (>= 0.8.0) tilt @@ -175,7 +176,7 @@ GEM http-cookie (1.0.3) domain_name (~> 0.5) http_accept_language (2.1.1) - i18n (1.8.5) + i18n (1.12.0) concurrent-ruby (~> 1.0) i18n-js (3.8.0) i18n (>= 0.6.6) @@ -210,36 +211,50 @@ GEM actionpack (>= 4) less (~> 2.6.0) sprockets (>= 2) - libv8 (3.16.14.19) - loofah (2.8.0) + loofah (2.19.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.7.1) + mail (2.8.1) mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp marcel (0.3.3) mimemagic (~> 0.3.2) method_source (1.0.0) mime-types (3.3.1) mime-types-data (~> 3.2015) mime-types-data (3.2020.1104) - mimemagic (0.3.5) - mini_mime (1.0.2) - mini_portile2 (2.4.0) - minitest (5.14.2) + mimemagic (0.3.10) + nokogiri (~> 1) + rake + mini_mime (1.1.2) + mini_portile2 (2.8.1) + minitest (5.18.0) money-tree (0.10.0) ffi multi_json (1.15.0) multi_test (0.1.2) multi_xml (0.6.0) multipart-post (2.1.1) - mysql2 (0.5.3) + mysql2 (0.5.5) + net-imap (0.3.4) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.1) + timeout net-scp (3.0.0) net-ssh (>= 2.6.5, < 7.0.0) + net-smtp (0.3.3) + net-protocol net-ssh (6.1.0) netrc (0.11.0) - nio4r (2.5.4) - nokogiri (1.10.10) - mini_portile2 (~> 2.4.0) + nio4r (2.5.8) + nokogiri (1.14.2) + mini_portile2 (~> 2.8.0) + racc (~> 1.4) oauth2 (1.4.4) faraday (>= 0.8, < 2.0) jwt (>= 1.0, < 3.0) @@ -266,21 +281,22 @@ GEM parser (2.7.2.0) ast (~> 2.4.1) public_suffix (4.0.6) - rack (2.2.6.2) - rack-test (1.1.0) - rack (>= 1.0, < 3) - rails (5.2.4.4) - actioncable (= 5.2.4.4) - actionmailer (= 5.2.4.4) - actionpack (= 5.2.4.4) - actionview (= 5.2.4.4) - activejob (= 5.2.4.4) - activemodel (= 5.2.4.4) - activerecord (= 5.2.4.4) - activestorage (= 5.2.4.4) - activesupport (= 5.2.4.4) + racc (1.6.2) + rack (2.2.6.4) + rack-test (2.1.0) + rack (>= 1.3) + rails (5.2.4.6) + actioncable (= 5.2.4.6) + actionmailer (= 5.2.4.6) + actionpack (= 5.2.4.6) + actionview (= 5.2.4.6) + activejob (= 5.2.4.6) + activemodel (= 5.2.4.6) + activerecord (= 5.2.4.6) + activestorage (= 5.2.4.6) + activesupport (= 5.2.4.6) bundler (>= 1.3.0) - railties (= 5.2.4.4) + railties (= 5.2.4.6) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) @@ -289,25 +305,24 @@ GEM rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.3.0) - loofah (~> 2.3) + rails-html-sanitizer (1.5.0) + loofah (~> 2.19, >= 2.19.1) rails-i18n (5.1.3) i18n (>= 0.7, < 2) railties (>= 5.0, < 6) - railties (5.2.4.4) - actionpack (= 5.2.4.4) - activesupport (= 5.2.4.4) + railties (5.2.4.6) + actionpack (= 5.2.4.6) + activesupport (= 5.2.4.6) method_source rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) rainbow (3.0.0) - rake (13.0.1) + rake (13.0.6) rbnacl (7.1.1) ffi rbtree3 (0.6.0) rdoc (6.2.1) redis (4.2.5) - ref (2.0.0) regexp_parser (1.8.2) render_csv (2.0.0) rails (>= 3.0) @@ -391,24 +406,22 @@ GEM simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) simplecov_json_formatter (0.1.2) - sprockets (4.0.2) + sprockets (4.2.0) concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.2.2) - actionpack (>= 4.0) - activesupport (>= 4.0) + rack (>= 2.2.4, < 4) + sprockets-rails (3.4.2) + actionpack (>= 5.2) + activesupport (>= 5.2) sprockets (>= 3.0.0) sqlite3 (1.4.2) sshkit (1.21.1) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) temple (0.8.2) - therubyracer (0.12.3) - libv8 (~> 3.16.14.15) - ref - thor (1.0.1) + thor (1.2.1) thread_safe (0.3.6) tilt (2.0.10) + timeout (0.3.2) turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) @@ -417,7 +430,7 @@ GEM execjs (>= 2.2.2, >= 2.2) less-rails (>= 2.5.0) railties (>= 3.1) - tzinfo (1.2.8) + tzinfo (1.2.11) thread_safe (~> 0.1) uglifier (4.2.0) execjs (>= 0.3.0, < 3) @@ -432,7 +445,7 @@ GEM addressable (>= 2.3.6) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - websocket-driver (0.7.3) + websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) @@ -477,7 +490,7 @@ DEPENDENCIES omniauth omniauth-github omniauth-rails_csrf_protection (~> 0.1) - rails (= 5.2.4.4) + rails (= 5.2.4.6) rails-controller-testing rails-i18n rbnacl @@ -496,7 +509,6 @@ DEPENDENCIES simplecov sprockets sqlite3 - therubyracer turbolinks twitter-bootstrap-rails uglifier @@ -504,7 +516,7 @@ DEPENDENCIES webmock RUBY VERSION - ruby 2.6.6p146 + ruby 2.7.7p221 BUNDLED WITH 2.1.4 From 39c4d62676fda86f4e63aaa8d25f55bc30fb8931 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 19 Mar 2023 15:54:18 +0100 Subject: [PATCH 355/415] updated rubocop.yml --- .rubocop.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index 994cd4c0..bb57d5e0 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -6,7 +6,7 @@ require: - rubocop-rspec AllCops: - TargetRubyVersion: 2.6 + TargetRubyVersion: 2.7 NewCops: enable Exclude: - 'db/schema.rb' From 6178881046ae24f6aebbe8a2f1e579cbf44e241d Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 19 Mar 2023 15:59:53 +0100 Subject: [PATCH 356/415] udpated rubocop --- Gemfile.lock | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 7e150978..0fd082be 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -54,7 +54,7 @@ GEM airbrussh (1.4.0) sshkit (>= 1.6.1, != 1.7.0) arel (9.0.0) - ast (2.4.1) + ast (2.4.2) backports (3.18.2) bcrypt (3.1.16) bcrypt_pbkdf (1.0.1) @@ -189,6 +189,7 @@ GEM jquery-turbolinks (2.1.0) railties (>= 3.1.0) turbolinks + json (2.6.3) jwt (2.2.2) kaminari (1.2.1) activesupport (>= 4.1.0) @@ -277,8 +278,8 @@ GEM actionpack (>= 4.2) omniauth (>= 1.3.1) orm_adapter (0.5.0) - parallel (1.20.1) - parser (2.7.2.0) + parallel (1.22.1) + parser (3.2.1.1) ast (~> 2.4.1) public_suffix (4.0.6) racc (1.6.2) @@ -316,7 +317,7 @@ GEM method_source rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) - rainbow (3.0.0) + rainbow (3.1.1) rake (13.0.6) rbnacl (7.1.1) ffi @@ -334,7 +335,7 @@ GEM http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) - rexml (3.2.4) + rexml (3.2.5) rspec-activemodel-mocks (1.1.0) activemodel (>= 3.0) activesupport (>= 3.0) @@ -356,17 +357,18 @@ GEM rspec-mocks (~> 3.9) rspec-support (~> 3.9) rspec-support (3.10.0) - rubocop (1.6.1) + rubocop (1.48.1) + json (~> 2.3) parallel (~> 1.10) - parser (>= 2.7.1.5) + parser (>= 3.2.0.0) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) - rexml - rubocop-ast (>= 1.2.0, < 2.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.26.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (1.3.0) - parser (>= 2.7.1.5) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.27.0) + parser (>= 3.2.1.0) rubocop-rails (2.9.0) activesupport (>= 4.2.0) rack (>= 1.1) @@ -374,7 +376,7 @@ GEM rubocop-rspec (2.0.1) rubocop (~> 1.0) rubocop-ast (>= 1.1.0) - ruby-progressbar (1.10.1) + ruby-progressbar (1.13.0) ruby2_keywords (0.0.2) ruby_parser (3.15.0) sexp_processor (~> 4.9) @@ -437,7 +439,7 @@ GEM unf (0.1.4) unf_ext unf_ext (0.0.7.7) - unicode-display_width (1.7.0) + unicode-display_width (2.4.2) vcr (6.0.0) warden (1.2.9) rack (>= 2.0.9) From fb952ea156e874b1af2cac3407f0b8fafc1a7bfa Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 19 Mar 2023 16:12:29 +0100 Subject: [PATCH 357/415] updated rubocop todo file --- .rubocop_todo.yml | 101 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 92 insertions(+), 9 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index ec0ccd09..97cc3a0e 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,19 +1,46 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2020-12-11 09:21:43 UTC using RuboCop version 1.5.2. +# on 2023-03-19 15:11:29 UTC using RuboCop version 1.48.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: aligned, indented +Layout/LineEndStringConcatenationIndentation: + Exclude: + - 'spec/factories/wallets.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Lint/AmbiguousOperatorPrecedence: + Exclude: + - 'lib/bitcoin_address_validator.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Lint/ElseLayout: + Exclude: + - 'features/step_definitions/common.rb' + +# Offense count: 2 +# This cop supports unsafe autocorrection (--autocorrect-all). +Lint/OrAssignmentToConstant: + Exclude: + - 'config/application.rb' + - 'config/initializers/blacklist.rb' + # Offense count: 15 -# Configuration parameters: IgnoredMethods, CountRepeatedAttributes. +# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. Metrics/AbcSize: Max: 34 # Offense count: 15 -# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. -# IgnoredMethods: refine +# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. +# AllowedMethods: refine Metrics/BlockLength: Max: 117 @@ -23,17 +50,17 @@ Metrics/ClassLength: Max: 187 # Offense count: 2 -# Configuration parameters: IgnoredMethods. +# Configuration parameters: AllowedMethods, AllowedPatterns. Metrics/CyclomaticComplexity: Max: 16 # Offense count: 16 -# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. +# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. Metrics/MethodLength: Max: 29 # Offense count: 2 -# Configuration parameters: IgnoredMethods. +# Configuration parameters: AllowedMethods, AllowedPatterns. Metrics/PerceivedComplexity: Max: 13 @@ -131,14 +158,70 @@ Rails/SkipsModelValidations: - 'db/migrate/20140402082149_add_fee_size_to_deposits.rb' - 'lib/bitcoin_tipper.rb' +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowOnlyRestArgument. +Style/ArgumentsForwarding: + Exclude: + - 'features/support/ostruct_slice.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowSplatArgument. +Style/HashConversion: + Exclude: + - 'app/models/project.rb' + # Offense count: 1 Style/MissingRespondToMissing: Exclude: - 'lib/bitcoin_rpc.rb' +# Offense count: 1 +Style/OpenStructUse: + Exclude: + - 'features/support/to_ostruct.rb' + +# Offense count: 5 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantConstantBase: + Exclude: + - 'config.ru' + - 'config/environments/production.rb' + - 'lib/tasks/cucumber.rake' + - 'spec/spec_helper.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantRegexpEscape: + Exclude: + - 'config/routes.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/SelectByRegexp: + Exclude: + - 'spec/routing/users_routing_spec.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments. +# AllowedMethods: define_method +Style/SymbolProc: + Exclude: + - 'app/controllers/home_controller.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, MinSize, WordRegex. +# SupportedStyles: percent, brackets +Style/WordArray: + Exclude: + - 'lib/tasks/cucumber.rake' + # Offense count: 25 -# Cop supports --auto-correct. -# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. # URISchemes: http, https Layout/LineLength: Max: 234 From 05e6ec04edcbf733aacdf29f77cf90e87c780bad Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 19 Mar 2023 16:22:25 +0100 Subject: [PATCH 358/415] show rubocop version in ci --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4630c430..4db79244 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,6 +36,7 @@ jobs: - name: Rubocop run: | + bundle exec rubocop --version bundle exec rubocop - name: Run RSpec From b58484dfc6a8427e3d0d1c48193aab02b043faf6 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 19 Mar 2023 16:31:16 +0100 Subject: [PATCH 359/415] updated rubocop dependencies --- .rubocop_todo.yml | 105 +++++++++++++++++++++++++++++++++++++--------- Gemfile.lock | 12 +++--- 2 files changed, 93 insertions(+), 24 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 97cc3a0e..cff5c871 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-03-19 15:11:29 UTC using RuboCop version 1.48.1. +# on 2023-03-19 15:30:48 UTC using RuboCop version 1.48.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -38,11 +38,11 @@ Lint/OrAssignmentToConstant: Metrics/AbcSize: Max: 34 -# Offense count: 15 -# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. +# Offense count: 1 +# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode. # AllowedMethods: refine Metrics/BlockLength: - Max: 117 + Max: 29 # Offense count: 2 # Configuration parameters: CountComments, CountAsOne. @@ -74,22 +74,38 @@ Naming/PredicateName: Exclude: - 'app/models/project.rb' +# Offense count: 9 +# This cop supports unsafe autocorrection (--autocorrect-all). +RSpec/BeEq: + Exclude: + - 'spec/lib/blacklist_spec.rb' + # Offense count: 1 -# Configuration parameters: Prefixes. +# Configuration parameters: Prefixes, AllowedPatterns. # Prefixes: when, with, without RSpec/ContextWording: Exclude: - 'spec/controllers/projects_controller_spec.rb' # Offense count: 13 -# Configuration parameters: Max. +# Configuration parameters: CountAsOne. RSpec/ExampleLength: + Max: 16 + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: require_parentheses, omit_parentheses +RSpec/FactoryBot/ConsistentParenthesesStyle: Exclude: - 'spec/controllers/projects_controller_spec.rb' - - 'spec/lib/blacklist_spec.rb' - - 'spec/models/deposit_spec.rb' - - 'spec/routing/projects_routing_spec.rb' - - 'spec/routing/users_routing_spec.rb' + +# Offense count: 1 +# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly. +# Include: **/*_spec*rb*, **/spec/**/* +RSpec/FilePath: + Exclude: + - 'spec/features/assets.rb' # Offense count: 2 # Configuration parameters: AssignmentOnly. @@ -109,7 +125,8 @@ RSpec/MultipleExpectations: Max: 9 # Offense count: 26 -# Configuration parameters: IgnoreSharedExamples. +# Configuration parameters: EnforcedStyle, IgnoreSharedExamples. +# SupportedStyles: always, named_only RSpec/NamedSubject: Exclude: - 'spec/controllers/home_controller_spec.rb' @@ -118,9 +135,16 @@ RSpec/NamedSubject: - 'spec/models/wallet_spec.rb' # Offense count: 4 +# Configuration parameters: AllowedGroups. RSpec/NestedGroups: Max: 5 +# Offense count: 22 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: Inferences. +RSpec/Rails/InferredSpecType: + Enabled: false + # Offense count: 2 RSpec/RepeatedExampleGroupBody: Exclude: @@ -131,6 +155,50 @@ RSpec/StubbedMock: Exclude: - 'spec/controllers/projects_controller_spec.rb' +# Offense count: 8 +RSpec/SubjectDeclaration: + Exclude: + - 'spec/controllers/home_controller_spec.rb' + - 'spec/controllers/projects_controller_spec.rb' + - 'spec/controllers/users_controller_spec.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: ExpectedOrder, Include. +# ExpectedOrder: index, show, new, edit, create, update, destroy +# Include: app/controllers/**/*.rb +Rails/ActionOrder: + Exclude: + - 'app/controllers/users_controller.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +Rails/ActiveSupportOnLoad: + Exclude: + - 'config/initializers/demoji.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: Include. +# Include: db/migrate/*.rb +Rails/AddColumnIndex: + Exclude: + - 'db/migrate/20151219081507_add_bitcoin_address2_to_projects.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: Severity. +Rails/DeprecatedActiveModelErrorsMethods: + Exclude: + - 'lib/bitcoin_address_validator.rb' + +# Offense count: 1 +# Configuration parameters: EnforcedStyle. +# SupportedStyles: slashes, arguments +Rails/FilePath: + Exclude: + - 'spec/spec_helper.rb' + # Offense count: 6 # Configuration parameters: Include. # Include: app/models/**/*.rb @@ -146,6 +214,13 @@ Rails/OutputSafety: - 'app/helpers/application_helper.rb' - 'app/helpers/rates_helper.rb' +# Offense count: 1 +# Configuration parameters: Include. +# Include: db/**/*.rb +Rails/ReversibleMigration: + Exclude: + - 'db/migrate/20140823060921_make_default_branch_blank.rb' + # Offense count: 11 # Configuration parameters: ForbiddenMethods, AllowedMethods. # ForbiddenMethods: decrement!, decrement_counter, increment!, increment_counter, insert, insert!, insert_all, insert_all!, toggle!, touch, touch_all, update_all, update_attribute, update_column, update_columns, update_counters, upsert, upsert_all @@ -203,14 +278,6 @@ Style/SelectByRegexp: Exclude: - 'spec/routing/users_routing_spec.rb' -# Offense count: 1 -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments. -# AllowedMethods: define_method -Style/SymbolProc: - Exclude: - - 'app/controllers/home_controller.rb' - # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, MinSize, WordRegex. diff --git a/Gemfile.lock b/Gemfile.lock index 0fd082be..ea66a503 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -369,13 +369,15 @@ GEM unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.27.0) parser (>= 3.2.1.0) - rubocop-rails (2.9.0) + rubocop-capybara (2.17.1) + rubocop (~> 1.41) + rubocop-rails (2.18.0) activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 0.90.0, < 2.0) - rubocop-rspec (2.0.1) - rubocop (~> 1.0) - rubocop-ast (>= 1.1.0) + rubocop (>= 1.33.0, < 2.0) + rubocop-rspec (2.19.0) + rubocop (~> 1.33) + rubocop-capybara (~> 2.17) ruby-progressbar (1.13.0) ruby2_keywords (0.0.2) ruby_parser (3.15.0) From 229103d62ff850fdc738d1a8e5a1c81c6191287d Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 19 Mar 2023 20:19:39 +0100 Subject: [PATCH 360/415] rubocop: ignore vendored files --- .rubocop.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.rubocop.yml b/.rubocop.yml index bb57d5e0..9352092f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -11,6 +11,7 @@ AllCops: Exclude: - 'db/schema.rb' - 'bin/*' + - 'vendor/**/*' Style/Documentation: Enabled: false From 739db6533dd4027364f34ce7b454c3205cc2f383 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 19 Mar 2023 20:26:11 +0100 Subject: [PATCH 361/415] fixed migrations in ci --- .github/workflows/build.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4db79244..5ac2490e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,15 +28,14 @@ jobs: bundle config path vendor/bundle bundle install --jobs=9 --retry=2 --without development --quiet - - name: Setup database + - name: Setup test database run: | cp config/config.yml.sample config/config.yml cp config/database.yml.sample config/database.yml - bundle exec rake db:migrate + bin/rails db:migrate RAILS_ENV=test - name: Rubocop run: | - bundle exec rubocop --version bundle exec rubocop - name: Run RSpec From d8a9cf7b8c681547e59c1580a32dbebd68ca4be2 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 19 Mar 2023 20:33:15 +0100 Subject: [PATCH 362/415] removed sidekiq as it is not used --- Gemfile | 1 - Gemfile.lock | 7 ------- config/application.rb | 1 - 3 files changed, 9 deletions(-) diff --git a/Gemfile b/Gemfile index c1483974..fa503a1f 100644 --- a/Gemfile +++ b/Gemfile @@ -38,7 +38,6 @@ gem 'rest-client' gem 'sass-rails' gem 'sawyer' gem 'sdoc', group: :doc, require: false -gem 'sidekiq' gem 'sprockets' gem 'turbolinks' gem 'twitter-bootstrap-rails' diff --git a/Gemfile.lock b/Gemfile.lock index ea66a503..36cd4140 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -94,7 +94,6 @@ GEM coffee-script-source (1.12.2) commonjs (0.2.7) concurrent-ruby (1.2.2) - connection_pool (2.2.3) crack (0.4.4) crass (1.0.6) cucumber (3.2.0) @@ -323,7 +322,6 @@ GEM ffi rbtree3 (0.6.0) rdoc (6.2.1) - redis (4.2.5) regexp_parser (1.8.2) render_csv (2.0.0) rails (>= 3.0) @@ -400,10 +398,6 @@ GEM sexp_processor (4.15.1) shoulda-matchers (4.4.1) activesupport (>= 4.2.0) - sidekiq (6.1.2) - connection_pool (>= 2.2.2) - rack (~> 2.0) - redis (>= 4.2.0) simplecov (0.20.0) docile (~> 1.1) simplecov-html (~> 0.11) @@ -509,7 +503,6 @@ DEPENDENCIES sawyer sdoc shoulda-matchers - sidekiq simplecov sprockets sqlite3 diff --git a/config/application.rb b/config/application.rb index e2412382..f4b595d1 100644 --- a/config/application.rb +++ b/config/application.rb @@ -28,7 +28,6 @@ class Application < Rails::Application config.autoload_paths += %W[#{config.root}/lib] config.assets.initialize_on_precompile = true config.available_locales = %w[en es fr nl ru pl hr de ro ko id ja pt my cn hk] - config.active_job.queue_adapter = :sidekiq config.active_record.sqlite3.represent_boolean_as_integer = true end end From 587e332793dd55fa65ad56c4df4d09e3d7a1884b Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 19 Mar 2023 20:38:50 +0100 Subject: [PATCH 363/415] updated rails --- Gemfile | 2 +- Gemfile.lock | 82 +++++++++++++++++++++++++--------------------------- 2 files changed, 40 insertions(+), 44 deletions(-) diff --git a/Gemfile b/Gemfile index fa503a1f..76ea9445 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source 'https://rubygems.org' ruby '2.7.7' -gem 'rails', '5.2.4.6' +gem 'rails', '5.2.8.1' gem 'acts_as_paranoid' gem 'airbrake' diff --git a/Gemfile.lock b/Gemfile.lock index 36cd4140..1a540441 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,43 +1,43 @@ GEM remote: https://rubygems.org/ specs: - actioncable (5.2.4.6) - actionpack (= 5.2.4.6) + actioncable (5.2.8.1) + actionpack (= 5.2.8.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.4.6) - actionpack (= 5.2.4.6) - actionview (= 5.2.4.6) - activejob (= 5.2.4.6) + actionmailer (5.2.8.1) + actionpack (= 5.2.8.1) + actionview (= 5.2.8.1) + activejob (= 5.2.8.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.4.6) - actionview (= 5.2.4.6) - activesupport (= 5.2.4.6) + actionpack (5.2.8.1) + actionview (= 5.2.8.1) + activesupport (= 5.2.8.1) rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.4.6) - activesupport (= 5.2.4.6) + actionview (5.2.8.1) + activesupport (= 5.2.8.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.2.4.6) - activesupport (= 5.2.4.6) + activejob (5.2.8.1) + activesupport (= 5.2.8.1) globalid (>= 0.3.6) - activemodel (5.2.4.6) - activesupport (= 5.2.4.6) - activerecord (5.2.4.6) - activemodel (= 5.2.4.6) - activesupport (= 5.2.4.6) + activemodel (5.2.8.1) + activesupport (= 5.2.8.1) + activerecord (5.2.8.1) + activemodel (= 5.2.8.1) + activesupport (= 5.2.8.1) arel (>= 9.0) - activestorage (5.2.4.6) - actionpack (= 5.2.4.6) - activerecord (= 5.2.4.6) - marcel (~> 0.3.1) - activesupport (5.2.4.6) + activestorage (5.2.8.1) + actionpack (= 5.2.8.1) + activerecord (= 5.2.8.1) + marcel (~> 1.0.0) + activesupport (5.2.8.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -219,15 +219,11 @@ GEM net-imap net-pop net-smtp - marcel (0.3.3) - mimemagic (~> 0.3.2) + marcel (1.0.2) method_source (1.0.0) mime-types (3.3.1) mime-types-data (~> 3.2015) mime-types-data (3.2020.1104) - mimemagic (0.3.10) - nokogiri (~> 1) - rake mini_mime (1.1.2) mini_portile2 (2.8.1) minitest (5.18.0) @@ -285,18 +281,18 @@ GEM rack (2.2.6.4) rack-test (2.1.0) rack (>= 1.3) - rails (5.2.4.6) - actioncable (= 5.2.4.6) - actionmailer (= 5.2.4.6) - actionpack (= 5.2.4.6) - actionview (= 5.2.4.6) - activejob (= 5.2.4.6) - activemodel (= 5.2.4.6) - activerecord (= 5.2.4.6) - activestorage (= 5.2.4.6) - activesupport (= 5.2.4.6) + rails (5.2.8.1) + actioncable (= 5.2.8.1) + actionmailer (= 5.2.8.1) + actionpack (= 5.2.8.1) + actionview (= 5.2.8.1) + activejob (= 5.2.8.1) + activemodel (= 5.2.8.1) + activerecord (= 5.2.8.1) + activestorage (= 5.2.8.1) + activesupport (= 5.2.8.1) bundler (>= 1.3.0) - railties (= 5.2.4.6) + railties (= 5.2.8.1) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) @@ -310,9 +306,9 @@ GEM rails-i18n (5.1.3) i18n (>= 0.7, < 2) railties (>= 5.0, < 6) - railties (5.2.4.6) - actionpack (= 5.2.4.6) - activesupport (= 5.2.4.6) + railties (5.2.8.1) + actionpack (= 5.2.8.1) + activesupport (= 5.2.8.1) method_source rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) @@ -488,7 +484,7 @@ DEPENDENCIES omniauth omniauth-github omniauth-rails_csrf_protection (~> 0.1) - rails (= 5.2.4.6) + rails (= 5.2.8.1) rails-controller-testing rails-i18n rbnacl From 6204753626569f7273901ac8082546f727b42810 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 19 Mar 2023 20:46:15 +0100 Subject: [PATCH 364/415] test with several ruby versions --- .github/workflows/build.yml | 5 +++-- Gemfile | 2 -- Gemfile.lock | 3 --- LICENSE | 2 +- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5ac2490e..54df9b37 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby-version: [2.7.7] + ruby-version: [2.7.7 3.0.5 3.1.3] steps: - name: Checkout code @@ -25,8 +25,9 @@ jobs: - name: Install dependencies run: | + bundle config set without 'development' bundle config path vendor/bundle - bundle install --jobs=9 --retry=2 --without development --quiet + bundle install --jobs=9 --retry=2 --quiet - name: Setup test database run: | diff --git a/Gemfile b/Gemfile index 76ea9445..5f2006d5 100644 --- a/Gemfile +++ b/Gemfile @@ -2,8 +2,6 @@ source 'https://rubygems.org' -ruby '2.7.7' - gem 'rails', '5.2.8.1' gem 'acts_as_paranoid' diff --git a/Gemfile.lock b/Gemfile.lock index 1a540441..2d0e65e9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -508,8 +508,5 @@ DEPENDENCIES vcr webmock -RUBY VERSION - ruby 2.7.7p221 - BUNDLED WITH 2.1.4 diff --git a/LICENSE b/LICENSE index ba6c1a51..b3246315 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2021 tip4commit +Copyright (c) 2023 tip4commit Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in From 14f988aae266581d6d47241bce6f4140ee34575d Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 19 Mar 2023 20:47:30 +0100 Subject: [PATCH 365/415] fixed ci --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 54df9b37..f457853f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby-version: [2.7.7 3.0.5 3.1.3] + ruby-version: [2.7.7, 3.0.5, 3.1.3] steps: - name: Checkout code From 4437d696aa43dd849fd196ca53abe70bae304816 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 19 Mar 2023 20:48:56 +0100 Subject: [PATCH 366/415] removed ruby 3.1.3 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f457853f..b8b47f73 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby-version: [2.7.7, 3.0.5, 3.1.3] + ruby-version: [2.7.7, 3.0.5] steps: - name: Checkout code From 2edf8b34530d84dfcb35dd9e88bc173d1ccc9e1a Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 19 Mar 2023 20:52:00 +0100 Subject: [PATCH 367/415] ci: set fail-fast to false --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b8b47f73..13a8963c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,6 +12,7 @@ jobs: strategy: matrix: ruby-version: [2.7.7, 3.0.5] + fail-fast: false steps: - name: Checkout code From e273279ad1c4072d65cd19284429182dc44b24e8 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 19 Mar 2023 20:54:45 +0100 Subject: [PATCH 368/415] fixed ci --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 13a8963c..ead73237 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: ruby-version: [2.7.7, 3.0.5] - fail-fast: false + fail-fast: false steps: - name: Checkout code From c341fa7505f093dd8e4ea21386155cfaac719c39 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Sun, 19 Mar 2023 21:00:20 +0100 Subject: [PATCH 369/415] Do not test with ruby 3.0.5 for now --- .github/workflows/build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ead73237..71fb4d13 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,9 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby-version: [2.7.7, 3.0.5] + ruby-version: + - 2.7.7 + # - 3.0.5 # TODO: Upgrade to Rails 6 fail-fast: false steps: From 3e70602d9b3256e089f8148a6b420019d1a83acc Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 20 Mar 2023 22:08:35 +0100 Subject: [PATCH 370/415] updated money-tree --- Gemfile.lock | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2d0e65e9..bf000d24 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -151,7 +151,7 @@ GEM faraday (1.1.0) multipart-post (>= 1.2, < 3) ruby2_keywords - ffi (1.13.1) + ffi (1.15.5) gherkin (5.1.0) globalid (1.1.0) activesupport (>= 5.0) @@ -227,8 +227,7 @@ GEM mini_mime (1.1.2) mini_portile2 (2.8.1) minitest (5.18.0) - money-tree (0.10.0) - ffi + money-tree (0.11.1) multi_json (1.15.0) multi_test (0.1.2) multi_xml (0.6.0) From cb11e69af7ff42d29d19a625f6e09790334578ad Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 20 Mar 2023 22:08:54 +0100 Subject: [PATCH 371/415] updated deploy script --- config/deploy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/deploy.rb b/config/deploy.rb index 73aa10e3..3d155417 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -8,7 +8,7 @@ set :deploy_to, '/home/apps/t4c' set :rvm_type, :user -set :rvm_ruby_version, '2.6.6' +set :rvm_ruby_version, '2.7.7' set :rvm_custom_path, '~/.rvm' set :format, :pretty From 784ee59e6d78699f8ac602b0a78e094ad2ee3da7 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 20 Mar 2023 22:39:34 +0100 Subject: [PATCH 372/415] Upgraded ruby to 3.0 and Rails to 6.0 --- .github/workflows/build.yml | 5 +- .rubocop.yml | 2 +- .rubocop_todo.yml | 8 ++- .tool-versions | 2 +- Gemfile | 4 +- Gemfile.lock | 118 ++++++++++++++++++++++-------------- app/models/wallet.rb | 2 +- config/deploy.rb | 2 +- db/schema.rb | 28 ++++----- 9 files changed, 103 insertions(+), 68 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 71fb4d13..67015d8a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,8 +12,9 @@ jobs: strategy: matrix: ruby-version: - - 2.7.7 - # - 3.0.5 # TODO: Upgrade to Rails 6 + - 3.0.5 + - 3.1.3 + - 3.2.1 fail-fast: false steps: diff --git a/.rubocop.yml b/.rubocop.yml index 9352092f..5eee973d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -6,7 +6,7 @@ require: - rubocop-rspec AllCops: - TargetRubyVersion: 2.7 + TargetRubyVersion: 3.0 NewCops: enable Exclude: - 'db/schema.rb' diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index cff5c871..5dc42ead 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-03-19 15:30:48 UTC using RuboCop version 1.48.1. +# on 2023-03-20 21:35:18 UTC using RuboCop version 1.48.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -33,6 +33,12 @@ Lint/OrAssignmentToConstant: - 'config/application.rb' - 'config/initializers/blacklist.rb' +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +Lint/RedundantDirGlobSort: + Exclude: + - 'spec/spec_helper.rb' + # Offense count: 15 # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. Metrics/AbcSize: diff --git a/.tool-versions b/.tool-versions index 33a8789f..5de817ed 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1 @@ -ruby 2.7.7 +ruby 3.0.5 diff --git a/Gemfile b/Gemfile index 5f2006d5..11d8047f 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' -gem 'rails', '5.2.8.1' +gem 'rails', '6.0.6.1' gem 'acts_as_paranoid' gem 'airbrake' @@ -55,6 +55,8 @@ end group :development, :test do gem 'factory_bot_rails' + gem 'pry' + gem 'pry-byebug' gem 'rspec-rails' gem 'rubocop' gem 'rubocop-rails' diff --git a/Gemfile.lock b/Gemfile.lock index bf000d24..88816826 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,47 +1,61 @@ GEM remote: https://rubygems.org/ specs: - actioncable (5.2.8.1) - actionpack (= 5.2.8.1) + actioncable (6.0.6.1) + actionpack (= 6.0.6.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.8.1) - actionpack (= 5.2.8.1) - actionview (= 5.2.8.1) - activejob (= 5.2.8.1) + actionmailbox (6.0.6.1) + actionpack (= 6.0.6.1) + activejob (= 6.0.6.1) + activerecord (= 6.0.6.1) + activestorage (= 6.0.6.1) + activesupport (= 6.0.6.1) + mail (>= 2.7.1) + actionmailer (6.0.6.1) + actionpack (= 6.0.6.1) + actionview (= 6.0.6.1) + activejob (= 6.0.6.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.8.1) - actionview (= 5.2.8.1) - activesupport (= 5.2.8.1) + actionpack (6.0.6.1) + actionview (= 6.0.6.1) + activesupport (= 6.0.6.1) rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.8.1) - activesupport (= 5.2.8.1) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.0.6.1) + actionpack (= 6.0.6.1) + activerecord (= 6.0.6.1) + activestorage (= 6.0.6.1) + activesupport (= 6.0.6.1) + nokogiri (>= 1.8.5) + actionview (6.0.6.1) + activesupport (= 6.0.6.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.2.8.1) - activesupport (= 5.2.8.1) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (6.0.6.1) + activesupport (= 6.0.6.1) globalid (>= 0.3.6) - activemodel (5.2.8.1) - activesupport (= 5.2.8.1) - activerecord (5.2.8.1) - activemodel (= 5.2.8.1) - activesupport (= 5.2.8.1) - arel (>= 9.0) - activestorage (5.2.8.1) - actionpack (= 5.2.8.1) - activerecord (= 5.2.8.1) - marcel (~> 1.0.0) - activesupport (5.2.8.1) + activemodel (6.0.6.1) + activesupport (= 6.0.6.1) + activerecord (6.0.6.1) + activemodel (= 6.0.6.1) + activesupport (= 6.0.6.1) + activestorage (6.0.6.1) + actionpack (= 6.0.6.1) + activejob (= 6.0.6.1) + activerecord (= 6.0.6.1) + marcel (~> 1.0) + activesupport (6.0.6.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) + zeitwerk (~> 2.2, >= 2.2.2) acts_as_paranoid (0.7.0) activerecord (>= 5.2, < 7.0) activesupport (>= 5.2, < 7.0) @@ -53,7 +67,6 @@ GEM rbtree3 (~> 0.5) airbrussh (1.4.0) sshkit (>= 1.6.1, != 1.7.0) - arel (9.0.0) ast (2.4.2) backports (3.18.2) bcrypt (3.1.16) @@ -63,6 +76,7 @@ GEM actionpack (>= 5.2) activemodel (>= 5.2) builder (3.2.4) + byebug (11.1.3) cancancan (3.1.0) capistrano (3.14.1) airbrussh (>= 1.0.0) @@ -85,6 +99,7 @@ GEM rack-test (>= 0.6.3) regexp_parser (~> 1.5) xpath (~> 3.2) + coderay (1.1.3) coffee-rails (5.0.0) coffee-script (>= 2.2.0) railties (>= 5.2.0) @@ -275,23 +290,31 @@ GEM parallel (1.22.1) parser (3.2.1.1) ast (~> 2.4.1) + pry (0.14.2) + coderay (~> 1.1) + method_source (~> 1.0) + pry-byebug (3.10.1) + byebug (~> 11.0) + pry (>= 0.13, < 0.15) public_suffix (4.0.6) racc (1.6.2) rack (2.2.6.4) rack-test (2.1.0) rack (>= 1.3) - rails (5.2.8.1) - actioncable (= 5.2.8.1) - actionmailer (= 5.2.8.1) - actionpack (= 5.2.8.1) - actionview (= 5.2.8.1) - activejob (= 5.2.8.1) - activemodel (= 5.2.8.1) - activerecord (= 5.2.8.1) - activestorage (= 5.2.8.1) - activesupport (= 5.2.8.1) + rails (6.0.6.1) + actioncable (= 6.0.6.1) + actionmailbox (= 6.0.6.1) + actionmailer (= 6.0.6.1) + actionpack (= 6.0.6.1) + actiontext (= 6.0.6.1) + actionview (= 6.0.6.1) + activejob (= 6.0.6.1) + activemodel (= 6.0.6.1) + activerecord (= 6.0.6.1) + activestorage (= 6.0.6.1) + activesupport (= 6.0.6.1) bundler (>= 1.3.0) - railties (= 5.2.8.1) + railties (= 6.0.6.1) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) @@ -302,15 +325,15 @@ GEM nokogiri (>= 1.6) rails-html-sanitizer (1.5.0) loofah (~> 2.19, >= 2.19.1) - rails-i18n (5.1.3) + rails-i18n (7.0.6) i18n (>= 0.7, < 2) - railties (>= 5.0, < 6) - railties (5.2.8.1) - actionpack (= 5.2.8.1) - activesupport (= 5.2.8.1) + railties (>= 6.0.0, < 8) + railties (6.0.6.1) + actionpack (= 6.0.6.1) + activesupport (= 6.0.6.1) method_source rake (>= 0.8.7) - thor (>= 0.19.0, < 2.0) + thor (>= 0.20.3, < 2.0) rainbow (3.1.1) rake (13.0.6) rbnacl (7.1.1) @@ -443,6 +466,7 @@ GEM websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) + zeitwerk (2.6.7) PLATFORMS ruby @@ -483,7 +507,9 @@ DEPENDENCIES omniauth omniauth-github omniauth-rails_csrf_protection (~> 0.1) - rails (= 5.2.8.1) + pry + pry-byebug + rails (= 6.0.6.1) rails-controller-testing rails-i18n rbnacl @@ -508,4 +534,4 @@ DEPENDENCIES webmock BUNDLED WITH - 2.1.4 + 2.4.8 diff --git a/app/models/wallet.rb b/app/models/wallet.rb index 920f70b3..9b300cfa 100644 --- a/app/models/wallet.rb +++ b/app/models/wallet.rb @@ -4,7 +4,7 @@ class Wallet < ApplicationRecord validates :name, :xpub, presence: true def generate_address - address = hd_wallet.node_for_path("0/#{last_address_index}.pub").to_address + address = address_by_index(last_address_index) self.last_address_index += 1 save address diff --git a/config/deploy.rb b/config/deploy.rb index 3d155417..a54b741f 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -8,7 +8,7 @@ set :deploy_to, '/home/apps/t4c' set :rvm_type, :user -set :rvm_ruby_version, '2.7.7' +set :rvm_ruby_version, '3.0.5' set :rvm_custom_path, '~/.rvm' set :format, :pretty diff --git a/db/schema.rb b/db/schema.rb index dd94d3c1..3ea27b18 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -12,7 +12,7 @@ ActiveRecord::Schema.define(version: 2017_03_08_163825) do - create_table "collaborators", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + create_table "collaborators", force: :cascade do |t| t.integer "project_id" t.string "login" t.datetime "created_at" @@ -20,18 +20,18 @@ t.index ["project_id"], name: "index_collaborators_on_project_id" end - create_table "deposits", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + create_table "deposits", force: :cascade do |t| t.integer "project_id" t.string "txid" t.integer "confirmations" t.datetime "created_at" t.datetime "updated_at" - t.bigint "amount" + t.integer "amount", limit: 8 t.float "fee_size" t.index ["project_id"], name: "index_deposits_on_project_id" end - create_table "projects", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + create_table "projects", force: :cascade do |t| t.string "url" t.string "bitcoin_address" t.datetime "created_at" @@ -59,7 +59,7 @@ t.index ["github_id"], name: "index_projects_on_github_id", unique: true end - create_table "sendmanies", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + create_table "sendmanies", force: :cascade do |t| t.string "txid" t.text "data" t.string "result" @@ -68,7 +68,7 @@ t.datetime "updated_at" end - create_table "tipping_policies_texts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + create_table "tipping_policies_texts", force: :cascade do |t| t.integer "project_id" t.integer "user_id" t.text "text" @@ -78,9 +78,9 @@ t.index ["user_id"], name: "index_tipping_policies_texts_on_user_id" end - create_table "tips", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + create_table "tips", force: :cascade do |t| t.integer "user_id" - t.bigint "amount" + t.integer "amount", limit: 8 t.integer "sendmany_id" t.datetime "created_at" t.datetime "updated_at" @@ -94,7 +94,7 @@ t.index ["user_id"], name: "index_tips_on_user_id" end - create_table "users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + create_table "users", force: :cascade do |t| t.string "email", default: "", null: false t.string "encrypted_password", default: "", null: false t.string "reset_password_token" @@ -115,10 +115,10 @@ t.boolean "unsubscribed" t.datetime "notified_at" t.integer "commits_count", default: 0 - t.bigint "withdrawn_amount", default: 0 - t.datetime "confirmed_at" - t.datetime "confirmation_sent_at" + t.integer "withdrawn_amount", limit: 8, default: 0 t.string "confirmation_token" + t.datetime "confirmation_sent_at" + t.datetime "confirmed_at" t.string "unconfirmed_email" t.string "display_name" t.integer "denom", default: 0 @@ -126,10 +126,10 @@ t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true end - create_table "wallets", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + create_table "wallets", force: :cascade do |t| t.string "name" t.string "xpub" - t.integer "last_address_index", default: 1 + t.integer "last_address_index", limit: 4, default: 1 t.datetime "created_at", null: false t.datetime "updated_at", null: false end From 82a00a80a33e5ee095b62161d25f98f7c36990fd Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 20 Mar 2023 22:45:55 +0100 Subject: [PATCH 373/415] deprecated config --- config/application.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index f4b595d1..fafdcf59 100644 --- a/config/application.rb +++ b/config/application.rb @@ -28,7 +28,6 @@ class Application < Rails::Application config.autoload_paths += %W[#{config.root}/lib] config.assets.initialize_on_precompile = true config.available_locales = %w[en es fr nl ru pl hr de ro ko id ja pt my cn hk] - config.active_record.sqlite3.represent_boolean_as_integer = true end end From 9ac87b26edb7180f4f9d1cf025052c067257bfd9 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 20 Mar 2023 22:46:23 +0100 Subject: [PATCH 374/415] Do not test with Ruby > 3.0 for now --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 67015d8a..9d9cc828 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,8 +13,8 @@ jobs: matrix: ruby-version: - 3.0.5 - - 3.1.3 - - 3.2.1 + # - 3.1.3 + # - 3.2.1 fail-fast: false steps: From 24cbe258015228914cb52241f9ebd3e2c407a101 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 20 Mar 2023 22:53:46 +0100 Subject: [PATCH 375/415] Upgraded rails to 6.1 --- Gemfile | 2 +- Gemfile.lock | 127 ++++++++++++++++++++++++++------------------------- 2 files changed, 66 insertions(+), 63 deletions(-) diff --git a/Gemfile b/Gemfile index 11d8047f..426ac566 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' -gem 'rails', '6.0.6.1' +gem 'rails', '6.1.7.3' gem 'acts_as_paranoid' gem 'airbrake' diff --git a/Gemfile.lock b/Gemfile.lock index 88816826..9a613850 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,61 +1,65 @@ GEM remote: https://rubygems.org/ specs: - actioncable (6.0.6.1) - actionpack (= 6.0.6.1) + actioncable (6.1.7.3) + actionpack (= 6.1.7.3) + activesupport (= 6.1.7.3) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.0.6.1) - actionpack (= 6.0.6.1) - activejob (= 6.0.6.1) - activerecord (= 6.0.6.1) - activestorage (= 6.0.6.1) - activesupport (= 6.0.6.1) + actionmailbox (6.1.7.3) + actionpack (= 6.1.7.3) + activejob (= 6.1.7.3) + activerecord (= 6.1.7.3) + activestorage (= 6.1.7.3) + activesupport (= 6.1.7.3) mail (>= 2.7.1) - actionmailer (6.0.6.1) - actionpack (= 6.0.6.1) - actionview (= 6.0.6.1) - activejob (= 6.0.6.1) + actionmailer (6.1.7.3) + actionpack (= 6.1.7.3) + actionview (= 6.1.7.3) + activejob (= 6.1.7.3) + activesupport (= 6.1.7.3) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.0.6.1) - actionview (= 6.0.6.1) - activesupport (= 6.0.6.1) - rack (~> 2.0, >= 2.0.8) + actionpack (6.1.7.3) + actionview (= 6.1.7.3) + activesupport (= 6.1.7.3) + rack (~> 2.0, >= 2.0.9) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.0.6.1) - actionpack (= 6.0.6.1) - activerecord (= 6.0.6.1) - activestorage (= 6.0.6.1) - activesupport (= 6.0.6.1) + actiontext (6.1.7.3) + actionpack (= 6.1.7.3) + activerecord (= 6.1.7.3) + activestorage (= 6.1.7.3) + activesupport (= 6.1.7.3) nokogiri (>= 1.8.5) - actionview (6.0.6.1) - activesupport (= 6.0.6.1) + actionview (6.1.7.3) + activesupport (= 6.1.7.3) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.0.6.1) - activesupport (= 6.0.6.1) + activejob (6.1.7.3) + activesupport (= 6.1.7.3) globalid (>= 0.3.6) - activemodel (6.0.6.1) - activesupport (= 6.0.6.1) - activerecord (6.0.6.1) - activemodel (= 6.0.6.1) - activesupport (= 6.0.6.1) - activestorage (6.0.6.1) - actionpack (= 6.0.6.1) - activejob (= 6.0.6.1) - activerecord (= 6.0.6.1) + activemodel (6.1.7.3) + activesupport (= 6.1.7.3) + activerecord (6.1.7.3) + activemodel (= 6.1.7.3) + activesupport (= 6.1.7.3) + activestorage (6.1.7.3) + actionpack (= 6.1.7.3) + activejob (= 6.1.7.3) + activerecord (= 6.1.7.3) + activesupport (= 6.1.7.3) marcel (~> 1.0) - activesupport (6.0.6.1) + mini_mime (>= 1.1.0) + activesupport (6.1.7.3) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - zeitwerk (~> 2.2, >= 2.2.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) acts_as_paranoid (0.7.0) activerecord (>= 5.2, < 7.0) activesupport (>= 5.2, < 7.0) @@ -301,20 +305,20 @@ GEM rack (2.2.6.4) rack-test (2.1.0) rack (>= 1.3) - rails (6.0.6.1) - actioncable (= 6.0.6.1) - actionmailbox (= 6.0.6.1) - actionmailer (= 6.0.6.1) - actionpack (= 6.0.6.1) - actiontext (= 6.0.6.1) - actionview (= 6.0.6.1) - activejob (= 6.0.6.1) - activemodel (= 6.0.6.1) - activerecord (= 6.0.6.1) - activestorage (= 6.0.6.1) - activesupport (= 6.0.6.1) - bundler (>= 1.3.0) - railties (= 6.0.6.1) + rails (6.1.7.3) + actioncable (= 6.1.7.3) + actionmailbox (= 6.1.7.3) + actionmailer (= 6.1.7.3) + actionpack (= 6.1.7.3) + actiontext (= 6.1.7.3) + actionview (= 6.1.7.3) + activejob (= 6.1.7.3) + activemodel (= 6.1.7.3) + activerecord (= 6.1.7.3) + activestorage (= 6.1.7.3) + activesupport (= 6.1.7.3) + bundler (>= 1.15.0) + railties (= 6.1.7.3) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) @@ -328,12 +332,12 @@ GEM rails-i18n (7.0.6) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) - railties (6.0.6.1) - actionpack (= 6.0.6.1) - activesupport (= 6.0.6.1) + railties (6.1.7.3) + actionpack (= 6.1.7.3) + activesupport (= 6.1.7.3) method_source - rake (>= 0.8.7) - thor (>= 0.20.3, < 2.0) + rake (>= 12.2) + thor (~> 1.0) rainbow (3.1.1) rake (13.0.6) rbnacl (7.1.1) @@ -435,7 +439,6 @@ GEM net-ssh (>= 2.8.0) temple (0.8.2) thor (1.2.1) - thread_safe (0.3.6) tilt (2.0.10) timeout (0.3.2) turbolinks (5.2.1) @@ -446,8 +449,8 @@ GEM execjs (>= 2.2.2, >= 2.2) less-rails (>= 2.5.0) railties (>= 3.1) - tzinfo (1.2.11) - thread_safe (~> 0.1) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) uglifier (4.2.0) execjs (>= 0.3.0, < 3) unf (0.1.4) @@ -509,7 +512,7 @@ DEPENDENCIES omniauth-rails_csrf_protection (~> 0.1) pry pry-byebug - rails (= 6.0.6.1) + rails (= 6.1.7.3) rails-controller-testing rails-i18n rbnacl From 1981519e0355261a1e8e34307ede2cbdbcb8297b Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Mon, 20 Mar 2023 22:57:23 +0100 Subject: [PATCH 376/415] fixed deprecation warning --- lib/bitcoin_address_validator.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/bitcoin_address_validator.rb b/lib/bitcoin_address_validator.rb index 577a0f59..c2c69a42 100644 --- a/lib/bitcoin_address_validator.rb +++ b/lib/bitcoin_address_validator.rb @@ -4,7 +4,9 @@ class BitcoinAddressValidator < ActiveModel::EachValidator def validate_each(record, field, value) - record.errors[field] << 'Bitcoin address is invalid' unless value.blank? || valid_bitcoin_address?(value) + return if value.blank? || valid_bitcoin_address?(value) + + record.errors.add(field, :invalid, message: 'Bitcoin address is invalid') end private From 2fba1a92f428c077784477af48d3c3987293d09b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Mar 2023 23:10:56 +0100 Subject: [PATCH 377/415] Bump rdoc from 6.2.1 to 6.5.0 (#438) Bumps [rdoc](https://github.com/ruby/rdoc) from 6.2.1 to 6.5.0. - [Release notes](https://github.com/ruby/rdoc/releases) - [Changelog](https://github.com/ruby/rdoc/blob/master/History.rdoc) - [Commits](https://github.com/ruby/rdoc/compare/v6.2.1...v6.5.0) --- updated-dependencies: - dependency-name: rdoc dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 9a613850..5b43f400 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -300,6 +300,8 @@ GEM pry-byebug (3.10.1) byebug (~> 11.0) pry (>= 0.13, < 0.15) + psych (5.1.0) + stringio public_suffix (4.0.6) racc (1.6.2) rack (2.2.6.4) @@ -343,7 +345,8 @@ GEM rbnacl (7.1.1) ffi rbtree3 (0.6.0) - rdoc (6.2.1) + rdoc (6.5.0) + psych (>= 4.0.0) regexp_parser (1.8.2) render_csv (2.0.0) rails (>= 3.0) @@ -437,6 +440,7 @@ GEM sshkit (1.21.1) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) + stringio (3.0.5) temple (0.8.2) thor (1.2.1) tilt (2.0.10) From 4af9229329637b0d03bd92132c352f90e1ea1f84 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Mar 2023 08:54:59 +0100 Subject: [PATCH 378/415] Bump addressable from 2.7.0 to 2.8.1 (#428) Bumps [addressable](https://github.com/sporkmonger/addressable) from 2.7.0 to 2.8.1. - [Release notes](https://github.com/sporkmonger/addressable/releases) - [Changelog](https://github.com/sporkmonger/addressable/blob/main/CHANGELOG.md) - [Commits](https://github.com/sporkmonger/addressable/compare/addressable-2.7.0...addressable-2.8.1) --- updated-dependencies: - dependency-name: addressable dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 5b43f400..58ff014c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -63,8 +63,8 @@ GEM acts_as_paranoid (0.7.0) activerecord (>= 5.2, < 7.0) activesupport (>= 5.2, < 7.0) - addressable (2.7.0) - public_suffix (>= 2.0.2, < 5.0) + addressable (2.8.1) + public_suffix (>= 2.0.2, < 6.0) airbrake (11.0.1) airbrake-ruby (~> 5.1) airbrake-ruby (5.2.0) @@ -302,7 +302,7 @@ GEM pry (>= 0.13, < 0.15) psych (5.1.0) stringio - public_suffix (4.0.6) + public_suffix (5.0.1) racc (1.6.2) rack (2.2.6.4) rack-test (2.1.0) From 47b16d3023bd26403ea24c8b862ba8ba1b637c13 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Tue, 21 Mar 2023 14:09:11 +0100 Subject: [PATCH 379/415] added puma and updated bin folder --- Gemfile | 1 + Gemfile.lock | 9 +++++---- bin/rails | 4 ++-- bin/rake | 4 ++-- bin/setup | 16 ++++++++-------- bin/yarn | 12 +++++++++--- db/schema.rb | 10 +++++----- 7 files changed, 32 insertions(+), 24 deletions(-) diff --git a/Gemfile b/Gemfile index 426ac566..c7b7bcf5 100644 --- a/Gemfile +++ b/Gemfile @@ -30,6 +30,7 @@ gem 'octokit' gem 'omniauth' gem 'omniauth-github' gem 'omniauth-rails_csrf_protection', '~> 0.1' +gem 'puma' gem 'rails-i18n' gem 'render_csv' gem 'rest-client' diff --git a/Gemfile.lock b/Gemfile.lock index 58ff014c..834ab7a3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -244,7 +244,6 @@ GEM mime-types-data (~> 3.2015) mime-types-data (3.2020.1104) mini_mime (1.1.2) - mini_portile2 (2.8.1) minitest (5.18.0) money-tree (0.11.1) multi_json (1.15.0) @@ -266,8 +265,7 @@ GEM net-ssh (6.1.0) netrc (0.11.0) nio4r (2.5.8) - nokogiri (1.14.2) - mini_portile2 (~> 2.8.0) + nokogiri (1.14.2-arm64-darwin) racc (~> 1.4) oauth2 (1.4.4) faraday (>= 0.8, < 2.0) @@ -303,6 +301,8 @@ GEM psych (5.1.0) stringio public_suffix (5.0.1) + puma (6.1.1) + nio4r (~> 2.0) racc (1.6.2) rack (2.2.6.4) rack-test (2.1.0) @@ -476,7 +476,7 @@ GEM zeitwerk (2.6.7) PLATFORMS - ruby + arm64-darwin-22 DEPENDENCIES acts_as_paranoid @@ -516,6 +516,7 @@ DEPENDENCIES omniauth-rails_csrf_protection (~> 0.1) pry pry-byebug + puma rails (= 6.1.7.3) rails-controller-testing rails-i18n diff --git a/bin/rails b/bin/rails index 07396602..6fb4e405 100755 --- a/bin/rails +++ b/bin/rails @@ -1,4 +1,4 @@ #!/usr/bin/env ruby APP_PATH = File.expand_path('../config/application', __dir__) -require_relative '../config/boot' -require 'rails/commands' +require_relative "../config/boot" +require "rails/commands" diff --git a/bin/rake b/bin/rake index 17240489..4fbf10b9 100755 --- a/bin/rake +++ b/bin/rake @@ -1,4 +1,4 @@ #!/usr/bin/env ruby -require_relative '../config/boot' -require 'rake' +require_relative "../config/boot" +require "rake" Rake.application.run diff --git a/bin/setup b/bin/setup index 94fd4d79..90700ac4 100755 --- a/bin/setup +++ b/bin/setup @@ -1,6 +1,5 @@ #!/usr/bin/env ruby -require 'fileutils' -include FileUtils +require "fileutils" # path to your application root. APP_ROOT = File.expand_path('..', __dir__) @@ -9,24 +8,25 @@ def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") end -chdir APP_ROOT do - # This script is a starting point to setup your application. +FileUtils.chdir APP_ROOT do + # This script is a way to set up or update your development environment automatically. + # This script is idempotent, so that you can run it at any time and get an expectable outcome. # Add necessary setup steps to this file. puts '== Installing dependencies ==' system! 'gem install bundler --conservative' system('bundle check') || system!('bundle install') - # Install JavaScript dependencies if using Yarn - # system('bin/yarn') + # Install JavaScript dependencies + system! 'bin/yarn' # puts "\n== Copying sample files ==" # unless File.exist?('config/database.yml') - # cp 'config/database.yml.sample', 'config/database.yml' + # FileUtils.cp 'config/database.yml.sample', 'config/database.yml' # end puts "\n== Preparing database ==" - system! 'bin/rails db:setup' + system! 'bin/rails db:prepare' puts "\n== Removing old logs and tempfiles ==" system! 'bin/rails log:clear tmp:clear' diff --git a/bin/yarn b/bin/yarn index 460dd565..9fab2c35 100755 --- a/bin/yarn +++ b/bin/yarn @@ -1,9 +1,15 @@ #!/usr/bin/env ruby APP_ROOT = File.expand_path('..', __dir__) Dir.chdir(APP_ROOT) do - begin - exec "yarnpkg", *ARGV - rescue Errno::ENOENT + yarn = ENV["PATH"].split(File::PATH_SEPARATOR). + select { |dir| File.expand_path(dir) != __dir__ }. + product(["yarn", "yarn.cmd", "yarn.ps1"]). + map { |dir, file| File.expand_path(file, dir) }. + find { |file| File.executable?(file) } + + if yarn + exec yarn, *ARGV + else $stderr.puts "Yarn executable was not detected in the system." $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" exit 1 diff --git a/db/schema.rb b/db/schema.rb index 3ea27b18..4227cedf 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -2,11 +2,11 @@ # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). +# This file is the source Rails uses to define your schema when running `bin/rails +# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to +# be faster and is potentially less error prone than running all of your +# migrations from scratch. Old migrations may fail to apply correctly if those +# migrations use external dependencies or application code. # # It's strongly recommended that you check this file into your version control system. From e2319986de48f0834523c61cbfb98098b8bd4f5f Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Tue, 21 Mar 2023 14:11:16 +0100 Subject: [PATCH 380/415] deprecation warning --- app/views/devise/confirmations/new.html.haml | 2 +- app/views/devise/passwords/edit.html.haml | 2 +- app/views/devise/passwords/new.html.haml | 2 +- app/views/devise/unlocks/new.html.haml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/devise/confirmations/new.html.haml b/app/views/devise/confirmations/new.html.haml index 4cbba835..0dbbffa5 100644 --- a/app/views/devise/confirmations/new.html.haml +++ b/app/views/devise/confirmations/new.html.haml @@ -1,6 +1,6 @@ = bootstrap_form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post, class: 'form-devise' }) do |f| %h2= t('.title') - = devise_error_messages! + = render "devise/shared/error_messages", resource: resource = f.email_field :email, :autofocus => true = f.submit t('.submit'), class: 'btn btn-primary' %p diff --git a/app/views/devise/passwords/edit.html.haml b/app/views/devise/passwords/edit.html.haml index 024a7f6d..55309a98 100644 --- a/app/views/devise/passwords/edit.html.haml +++ b/app/views/devise/passwords/edit.html.haml @@ -1,6 +1,6 @@ = bootstrap_form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put, class: 'form-devise' }) do |f| %h2= t('.title') - = devise_error_messages! + = render "devise/shared/error_messages", resource: resource = f.hidden_field :reset_password_token = f.password_field :password, :autofocus => true, :autocomplete => "off" = f.password_field :password_confirmation, :autocomplete => "off" diff --git a/app/views/devise/passwords/new.html.haml b/app/views/devise/passwords/new.html.haml index ff2947a9..5eff00b0 100644 --- a/app/views/devise/passwords/new.html.haml +++ b/app/views/devise/passwords/new.html.haml @@ -1,6 +1,6 @@ = bootstrap_form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post, class: 'form-devise', role: 'form' }) do |f| %h2= t('.title') - = devise_error_messages! + = render "devise/shared/error_messages", resource: resource = f.email_field :email, :autofocus => true = f.submit t('.submit'), class: 'btn btn-primary' %p diff --git a/app/views/devise/unlocks/new.html.haml b/app/views/devise/unlocks/new.html.haml index d3c87d07..932e66f4 100644 --- a/app/views/devise/unlocks/new.html.haml +++ b/app/views/devise/unlocks/new.html.haml @@ -1,6 +1,6 @@ %h2 Resend unlock instructions = form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| - = devise_error_messages! + = render "devise/shared/error_messages", resource: resource %div = f.label :email %br/ From 5a93ef75a7039527be2f83007c8c39dc0fcc5fc3 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Tue, 21 Mar 2023 14:13:42 +0100 Subject: [PATCH 381/415] platform --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 834ab7a3..48bdd60c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -476,7 +476,7 @@ GEM zeitwerk (2.6.7) PLATFORMS - arm64-darwin-22 + ruby DEPENDENCIES acts_as_paranoid From 649181ccd6a1666ddecfa5967665e64a042f792a Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Tue, 21 Mar 2023 14:15:16 +0100 Subject: [PATCH 382/415] fixed platforms --- Gemfile.lock | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 48bdd60c..b8b39046 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -476,7 +476,8 @@ GEM zeitwerk (2.6.7) PLATFORMS - ruby + arm64-darwin-22 + x86_64-linux DEPENDENCIES acts_as_paranoid From d7adcc4afc10a8052e2c4def393ad9e874181e93 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Tue, 21 Mar 2023 14:24:16 +0100 Subject: [PATCH 383/415] rubocop: autocorrection --- .rubocop_todo.yml | 93 +------------------ app/controllers/users_controller.rb | 8 +- app/models/project.rb | 2 +- config.ru | 2 +- config/environments/production.rb | 2 +- config/routes.rb | 4 +- ...081507_add_bitcoin_address2_to_projects.rb | 3 +- features/step_definitions/common.rb | 23 ++--- features/support/ostruct_slice.rb | 4 +- lib/bitcoin_address_validator.rb | 2 +- lib/tasks/cucumber.rake | 4 +- spec/controllers/projects_controller_spec.rb | 2 +- spec/factories/wallets.rb | 2 +- spec/spec_helper.rb | 2 +- 14 files changed, 33 insertions(+), 120 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 5dc42ead..a0d17a26 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,31 +1,11 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-03-20 21:35:18 UTC using RuboCop version 1.48.1. +# on 2023-03-21 13:21:19 UTC using RuboCop version 1.48.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, IndentationWidth. -# SupportedStyles: aligned, indented -Layout/LineEndStringConcatenationIndentation: - Exclude: - - 'spec/factories/wallets.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -Lint/AmbiguousOperatorPrecedence: - Exclude: - - 'lib/bitcoin_address_validator.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -Lint/ElseLayout: - Exclude: - - 'features/step_definitions/common.rb' - # Offense count: 2 # This cop supports unsafe autocorrection (--autocorrect-all). Lint/OrAssignmentToConstant: @@ -63,7 +43,7 @@ Metrics/CyclomaticComplexity: # Offense count: 16 # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. Metrics/MethodLength: - Max: 29 + Max: 30 # Offense count: 2 # Configuration parameters: AllowedMethods, AllowedPatterns. @@ -98,14 +78,6 @@ RSpec/ContextWording: RSpec/ExampleLength: Max: 16 -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: require_parentheses, omit_parentheses -RSpec/FactoryBot/ConsistentParenthesesStyle: - Exclude: - - 'spec/controllers/projects_controller_spec.rb' - # Offense count: 1 # Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly. # Include: **/*_spec*rb*, **/spec/**/* @@ -168,36 +140,12 @@ RSpec/SubjectDeclaration: - 'spec/controllers/projects_controller_spec.rb' - 'spec/controllers/users_controller_spec.rb' -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: ExpectedOrder, Include. -# ExpectedOrder: index, show, new, edit, create, update, destroy -# Include: app/controllers/**/*.rb -Rails/ActionOrder: - Exclude: - - 'app/controllers/users_controller.rb' - # Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). Rails/ActiveSupportOnLoad: Exclude: - 'config/initializers/demoji.rb' -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: Include. -# Include: db/migrate/*.rb -Rails/AddColumnIndex: - Exclude: - - 'db/migrate/20151219081507_add_bitcoin_address2_to_projects.rb' - -# Offense count: 1 -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: Severity. -Rails/DeprecatedActiveModelErrorsMethods: - Exclude: - - 'lib/bitcoin_address_validator.rb' - # Offense count: 1 # Configuration parameters: EnforcedStyle. # SupportedStyles: slashes, arguments @@ -239,20 +187,6 @@ Rails/SkipsModelValidations: - 'db/migrate/20140402082149_add_fee_size_to_deposits.rb' - 'lib/bitcoin_tipper.rb' -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowOnlyRestArgument. -Style/ArgumentsForwarding: - Exclude: - - 'features/support/ostruct_slice.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowSplatArgument. -Style/HashConversion: - Exclude: - - 'app/models/project.rb' - # Offense count: 1 Style/MissingRespondToMissing: Exclude: @@ -263,35 +197,12 @@ Style/OpenStructUse: Exclude: - 'features/support/to_ostruct.rb' -# Offense count: 5 -# This cop supports safe autocorrection (--autocorrect). -Style/RedundantConstantBase: - Exclude: - - 'config.ru' - - 'config/environments/production.rb' - - 'lib/tasks/cucumber.rake' - - 'spec/spec_helper.rb' - -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -Style/RedundantRegexpEscape: - Exclude: - - 'config/routes.rb' - # Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). Style/SelectByRegexp: Exclude: - 'spec/routing/users_routing_spec.rb' -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, MinSize, WordRegex. -# SupportedStyles: percent, brackets -Style/WordArray: - Exclude: - - 'lib/tasks/cucumber.rake' - # Offense count: 25 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index df127c1d..75ca81d6 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -4,15 +4,15 @@ class UsersController < ApplicationController before_action :authenticate_user!, :load_user, :valid_user!, except: %i[login index] before_action :redirect_to_pretty_url, only: [:show] + def index + @users = User.order(withdrawn_amount: :desc, commits_count: :desc).where('commits_count > 0 AND withdrawn_amount > 0').page(params[:page]).per(30) + end + def show @user_tips = @user.tips @recent_tips = @user_tips.includes(:project).order(created_at: :desc).first(5) end - def index - @users = User.order(withdrawn_amount: :desc, commits_count: :desc).where('commits_count > 0 AND withdrawn_amount > 0').page(params[:page]).per(30) - end - def update if @user.update(users_params) redirect_to @user, notice: I18n.t('notices.user_updated') diff --git a/app/models/project.rb b/app/models/project.rb index a9b7fdcb..8b2effb0 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -236,7 +236,7 @@ def generate_bitcoin_address class << self def export_labels - Hash[pluck(:bitcoin_address, :full_name)].to_json + pluck(:bitcoin_address, :full_name).to_h.to_json end def find_by_service_and_repo(service, repo) diff --git a/config.ru b/config.ru index 667e328d..afd13e21 100644 --- a/config.ru +++ b/config.ru @@ -2,5 +2,5 @@ # This file is used by Rack-based servers to start the application. -require ::File.expand_path('config/environment', __dir__) +require File.expand_path('config/environment', __dir__) run Rails.application diff --git a/config/environments/production.rb b/config/environments/production.rb index d2103f50..034d4342 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -84,5 +84,5 @@ # config.autoflush_log = false # Use default logging formatter so that PID and timestamp are not suppressed. - config.log_formatter = ::Logger::Formatter.new + config.log_formatter = Logger::Formatter.new end diff --git a/config/routes.rb b/config/routes.rb index 03fe0cd4..c1f67992 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -8,9 +8,9 @@ get '/users/login' => 'users#login', :as => 'login_users' get '/users/:user_id/tips' => 'tips#index', :constraints => { user_id: /\d+/ }, :as => 'user_tips' - get '/users/:nickname/tips' => 'tips#index', :constraints => { nickname: /\w[\d\w\-]*/ }, :as => 'user_tips_pretty' + get '/users/:nickname/tips' => 'tips#index', :constraints => { nickname: /\w[\d\w-]*/ }, :as => 'user_tips_pretty' get '/users/:id' => 'users#show', :constraints => { id: /\d+/ }, :as => 'user' - get '/users/:nickname' => 'users#show', :constraints => { nickname: /\w[\d\w\-]*/ }, :as => 'user_pretty' + get '/users/:nickname' => 'users#show', :constraints => { nickname: /\w[\d\w-]*/ }, :as => 'user_pretty' get '/projects/:project_id/tips' => 'tips#index', :constraints => { project_id: /\d+/ }, :as => 'project_tips' get '/projects/:project_id/deposits' => 'deposits#index', :constraints => { project_id: /\d+/ }, :as => 'project_deposits' diff --git a/db/migrate/20151219081507_add_bitcoin_address2_to_projects.rb b/db/migrate/20151219081507_add_bitcoin_address2_to_projects.rb index 4ac4957d..1f4122d4 100644 --- a/db/migrate/20151219081507_add_bitcoin_address2_to_projects.rb +++ b/db/migrate/20151219081507_add_bitcoin_address2_to_projects.rb @@ -2,7 +2,8 @@ class AddBitcoinAddress2ToProjects < ActiveRecord::Migration[4.2] def change - add_column :projects, :bitcoin_address2, :string, index: true + add_column :projects, :bitcoin_address2, :string + add_index :projects, :bitcoin_address2 reversible do |dir| dir.up do Project.find_each(&:generate_address2) diff --git a/features/step_definitions/common.rb b/features/step_definitions/common.rb index 2a7f96a3..dc5307e3 100644 --- a/features/step_definitions/common.rb +++ b/features/step_definitions/common.rb @@ -89,17 +89,18 @@ def parse_path_from_page_string(page_string) path = "/users/#{name}/#{action}" if is_valid_path # TODO: nyi # implicit cases - else case page_string - when 'home' then path = root_path - when 'sign_up' then path = new_user_registration_path - when 'sign_in' then path = new_user_session_path - when 'users' then path = users_path - when 'projects' then path = projects_path - when 'search' then path = search_projects_path - when 'tips' then path = tips_path - when 'deposits' then path = deposits_path - when 'withdrawals' then path = withdrawals_path - end + else + case page_string + when 'home' then path = root_path + when 'sign_up' then path = new_user_registration_path + when 'sign_in' then path = new_user_session_path + when 'users' then path = users_path + when 'projects' then path = projects_path + when 'search' then path = search_projects_path + when 'tips' then path = tips_path + when 'deposits' then path = deposits_path + when 'withdrawals' then path = withdrawals_path + end end path || page_string diff --git a/features/support/ostruct_slice.rb b/features/support/ostruct_slice.rb index 95e6ac4d..3267fe82 100644 --- a/features/support/ostruct_slice.rb +++ b/features/support/ostruct_slice.rb @@ -3,7 +3,7 @@ require 'ostruct' class OpenStruct - def slice(*args, &block) - marshal_dump.slice(*args, &block) + def slice(...) + marshal_dump.slice(...) end end diff --git a/lib/bitcoin_address_validator.rb b/lib/bitcoin_address_validator.rb index c2c69a42..069f390b 100644 --- a/lib/bitcoin_address_validator.rb +++ b/lib/bitcoin_address_validator.rb @@ -85,7 +85,7 @@ def b58_decode(value, length) result = long_value.chr + result - result = 0.chr * (length - result.length) + result if result.length < length + result = (0.chr * (length - result.length)) + result if result.length < length result end diff --git a/lib/tasks/cucumber.rake b/lib/tasks/cucumber.rake index e279deb6..18999e06 100644 --- a/lib/tasks/cucumber.rake +++ b/lib/tasks/cucumber.rake @@ -38,8 +38,8 @@ unless ARGV.any? { |a| a =~ /^gems/ } # Don't load anything when running the gem task statsetup: :environment do require 'rails/code_statistics' - ::STATS_DIRECTORIES << %w[Cucumber\ features features] if File.exist?('features') - ::CodeStatistics::TEST_TYPES << 'Cucumber features' if File.exist?('features') + STATS_DIRECTORIES << ['Cucumber features', 'features'] if File.exist?('features') + CodeStatistics::TEST_TYPES << 'Cucumber features' if File.exist?('features') end end desc 'Alias for cucumber:ok' diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index c166f257..743fc801 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -69,7 +69,7 @@ # end shared_context 'accessing_project' do |verb, action| - let(:a_project) { create :project, host: 'github', full_name: 'test/test' } + let(:a_project) { create(:project, host: 'github', full_name: 'test/test') } context 'with existsing project' do it 'via project id returns 302 status code' do diff --git a/spec/factories/wallets.rb b/spec/factories/wallets.rb index 9c2f74d9..61c3a212 100644 --- a/spec/factories/wallets.rb +++ b/spec/factories/wallets.rb @@ -5,7 +5,7 @@ name { 'test wallet' } xpub do 'xpub661MyMwAqRbcFepxYZyGLKMTkTPDvbfLaoYDbw4d4iQT5SycGiJQREuraJ2N6Uh' \ - 'LGPcjXDhnARdtcUhgqN3a2dgQ3Dx8u1chtk8Rx16LrWg' + 'LGPcjXDhnARdtcUhgqN3a2dgQ3Dx8u1chtk8Rx16LrWg' end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9231f65f..27a1ad36 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -40,7 +40,7 @@ # config.mock_with :rr # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures - config.fixture_path = "#{::Rails.root}/spec/fixtures" + config.fixture_path = "#{Rails.root}/spec/fixtures" # If you're not using ActiveRecord, or you'd prefer not to run each of your # examples within a transaction, remove the following line or assign false # instead of true. From 9c082e3d43e584edb94a40246e4ead7659a657ff Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Tue, 10 Oct 2023 23:15:30 +0200 Subject: [PATCH 384/415] Use mempool as explorer --- app/helpers/application_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 835a0fdd..e4474169 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -29,6 +29,6 @@ def list_friendly_text(a_list, conjunction) end def block_explorer_tx_url(txid) - "https://tradeblock.com/bitcoin/tx/#{txid}" + "https://mempool.space/tx/#{txid}" end end From b8df76c64a0a5d7e5ae616196bc147334046cccd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Oct 2023 23:21:03 +0200 Subject: [PATCH 385/415] Bump nokogiri from 1.14.2 to 1.15.4 (#441) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.14.2 to 1.15.4. - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.14.2...v1.15.4) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index b8b39046..3e8f2f55 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -265,7 +265,9 @@ GEM net-ssh (6.1.0) netrc (0.11.0) nio4r (2.5.8) - nokogiri (1.14.2-arm64-darwin) + nokogiri (1.15.4-arm64-darwin) + racc (~> 1.4) + nokogiri (1.15.4-x86_64-linux) racc (~> 1.4) oauth2 (1.4.4) faraday (>= 0.8, < 2.0) @@ -303,7 +305,7 @@ GEM public_suffix (5.0.1) puma (6.1.1) nio4r (~> 2.0) - racc (1.6.2) + racc (1.7.1) rack (2.2.6.4) rack-test (2.1.0) rack (>= 1.3) From 7290414360867aa8ea898058cddfb5202cb3903b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 11 Oct 2023 10:20:18 +0200 Subject: [PATCH 386/415] Bump puma from 6.1.1 to 6.3.1 (#442) Bumps [puma](https://github.com/puma/puma) from 6.1.1 to 6.3.1. - [Release notes](https://github.com/puma/puma/releases) - [Changelog](https://github.com/puma/puma/blob/master/History.md) - [Commits](https://github.com/puma/puma/compare/v6.1.1...v6.3.1) --- updated-dependencies: - dependency-name: puma dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 3e8f2f55..df5bef1b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -264,7 +264,7 @@ GEM net-protocol net-ssh (6.1.0) netrc (0.11.0) - nio4r (2.5.8) + nio4r (2.5.9) nokogiri (1.15.4-arm64-darwin) racc (~> 1.4) nokogiri (1.15.4-x86_64-linux) @@ -303,7 +303,7 @@ GEM psych (5.1.0) stringio public_suffix (5.0.1) - puma (6.1.1) + puma (6.3.1) nio4r (~> 2.0) racc (1.7.1) rack (2.2.6.4) From ba36e02cd62eba01d70479ac6241dd2faa682546 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 27 Mar 2024 11:58:45 +0100 Subject: [PATCH 387/415] Bump rdoc from 6.5.0 to 6.6.3.1 (#448) Bumps [rdoc](https://github.com/ruby/rdoc) from 6.5.0 to 6.6.3.1. - [Release notes](https://github.com/ruby/rdoc/releases) - [Changelog](https://github.com/ruby/rdoc/blob/master/History.rdoc) - [Commits](https://github.com/ruby/rdoc/compare/v6.5.0...v6.6.3.1) --- updated-dependencies: - dependency-name: rdoc dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index df5bef1b..2bde5313 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -300,7 +300,7 @@ GEM pry-byebug (3.10.1) byebug (~> 11.0) pry (>= 0.13, < 0.15) - psych (5.1.0) + psych (5.1.2) stringio public_suffix (5.0.1) puma (6.3.1) @@ -347,7 +347,7 @@ GEM rbnacl (7.1.1) ffi rbtree3 (0.6.0) - rdoc (6.5.0) + rdoc (6.6.3.1) psych (>= 4.0.0) regexp_parser (1.8.2) render_csv (2.0.0) @@ -442,7 +442,7 @@ GEM sshkit (1.21.1) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) - stringio (3.0.5) + stringio (3.1.0) temple (0.8.2) thor (1.2.1) tilt (2.0.10) From ecd5387f3402f317b214a4054a8ecf7ec015ddd6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 27 Mar 2024 12:03:10 +0100 Subject: [PATCH 388/415] Bump rack from 2.2.6.4 to 2.2.9 (#449) Bumps [rack](https://github.com/rack/rack) from 2.2.6.4 to 2.2.9. - [Release notes](https://github.com/rack/rack/releases) - [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md) - [Commits](https://github.com/rack/rack/compare/v2.2.6.4...v2.2.9) --- updated-dependencies: - dependency-name: rack dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2bde5313..8f9b7276 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -306,7 +306,7 @@ GEM puma (6.3.1) nio4r (~> 2.0) racc (1.7.1) - rack (2.2.6.4) + rack (2.2.9) rack-test (2.1.0) rack (>= 1.3) rails (6.1.7.3) From 2fe729a23dc9bee0ed441430c796a00d7f961f6c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 27 Mar 2024 12:08:37 +0100 Subject: [PATCH 389/415] Bump rails from 6.1.7.3 to 6.1.7.7 (#445) Bumps [rails](https://github.com/rails/rails) from 6.1.7.3 to 6.1.7.7. - [Release notes](https://github.com/rails/rails/releases) - [Commits](https://github.com/rails/rails/compare/v6.1.7.3...v6.1.7.7) --- updated-dependencies: - dependency-name: rails dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile | 2 +- Gemfile.lock | 162 ++++++++++++++++++++++++++------------------------- 2 files changed, 83 insertions(+), 81 deletions(-) diff --git a/Gemfile b/Gemfile index c7b7bcf5..8a19e874 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' -gem 'rails', '6.1.7.3' +gem 'rails', '6.1.7.7' gem 'acts_as_paranoid' gem 'airbrake' diff --git a/Gemfile.lock b/Gemfile.lock index 8f9b7276..1ceb5720 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,60 +1,60 @@ GEM remote: https://rubygems.org/ specs: - actioncable (6.1.7.3) - actionpack (= 6.1.7.3) - activesupport (= 6.1.7.3) + actioncable (6.1.7.7) + actionpack (= 6.1.7.7) + activesupport (= 6.1.7.7) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.7.3) - actionpack (= 6.1.7.3) - activejob (= 6.1.7.3) - activerecord (= 6.1.7.3) - activestorage (= 6.1.7.3) - activesupport (= 6.1.7.3) + actionmailbox (6.1.7.7) + actionpack (= 6.1.7.7) + activejob (= 6.1.7.7) + activerecord (= 6.1.7.7) + activestorage (= 6.1.7.7) + activesupport (= 6.1.7.7) mail (>= 2.7.1) - actionmailer (6.1.7.3) - actionpack (= 6.1.7.3) - actionview (= 6.1.7.3) - activejob (= 6.1.7.3) - activesupport (= 6.1.7.3) + actionmailer (6.1.7.7) + actionpack (= 6.1.7.7) + actionview (= 6.1.7.7) + activejob (= 6.1.7.7) + activesupport (= 6.1.7.7) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.1.7.3) - actionview (= 6.1.7.3) - activesupport (= 6.1.7.3) + actionpack (6.1.7.7) + actionview (= 6.1.7.7) + activesupport (= 6.1.7.7) rack (~> 2.0, >= 2.0.9) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.7.3) - actionpack (= 6.1.7.3) - activerecord (= 6.1.7.3) - activestorage (= 6.1.7.3) - activesupport (= 6.1.7.3) + actiontext (6.1.7.7) + actionpack (= 6.1.7.7) + activerecord (= 6.1.7.7) + activestorage (= 6.1.7.7) + activesupport (= 6.1.7.7) nokogiri (>= 1.8.5) - actionview (6.1.7.3) - activesupport (= 6.1.7.3) + actionview (6.1.7.7) + activesupport (= 6.1.7.7) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.1.7.3) - activesupport (= 6.1.7.3) + activejob (6.1.7.7) + activesupport (= 6.1.7.7) globalid (>= 0.3.6) - activemodel (6.1.7.3) - activesupport (= 6.1.7.3) - activerecord (6.1.7.3) - activemodel (= 6.1.7.3) - activesupport (= 6.1.7.3) - activestorage (6.1.7.3) - actionpack (= 6.1.7.3) - activejob (= 6.1.7.3) - activerecord (= 6.1.7.3) - activesupport (= 6.1.7.3) + activemodel (6.1.7.7) + activesupport (= 6.1.7.7) + activerecord (6.1.7.7) + activemodel (= 6.1.7.7) + activesupport (= 6.1.7.7) + activestorage (6.1.7.7) + actionpack (= 6.1.7.7) + activejob (= 6.1.7.7) + activerecord (= 6.1.7.7) + activesupport (= 6.1.7.7) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (6.1.7.3) + activesupport (6.1.7.7) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -112,7 +112,7 @@ GEM execjs coffee-script-source (1.12.2) commonjs (0.2.7) - concurrent-ruby (1.2.2) + concurrent-ruby (1.2.3) crack (0.4.4) crass (1.0.6) cucumber (3.2.0) @@ -138,7 +138,7 @@ GEM cucumber-tag_expressions (1.1.1) cucumber-wire (0.0.1) database_cleaner (1.8.5) - date (3.3.3) + date (3.3.4) demoji (0.0.7) devise (4.7.3) bcrypt (~> 3.0) @@ -172,8 +172,8 @@ GEM ruby2_keywords ffi (1.15.5) gherkin (5.1.0) - globalid (1.1.0) - activesupport (>= 5.0) + globalid (1.2.1) + activesupport (>= 6.1) haml (5.2.1) temple (>= 0.8.0) tilt @@ -194,7 +194,7 @@ GEM http-cookie (1.0.3) domain_name (~> 0.5) http_accept_language (2.1.1) - i18n (1.12.0) + i18n (1.14.4) concurrent-ruby (~> 1.0) i18n-js (3.8.0) i18n (>= 0.6.6) @@ -230,44 +230,44 @@ GEM actionpack (>= 4) less (~> 2.6.0) sprockets (>= 2) - loofah (2.19.1) + loofah (2.22.0) crass (~> 1.0.2) - nokogiri (>= 1.5.9) + nokogiri (>= 1.12.0) mail (2.8.1) mini_mime (>= 0.1.1) net-imap net-pop net-smtp - marcel (1.0.2) + marcel (1.0.4) method_source (1.0.0) mime-types (3.3.1) mime-types-data (~> 3.2015) mime-types-data (3.2020.1104) - mini_mime (1.1.2) - minitest (5.18.0) + mini_mime (1.1.5) + minitest (5.22.3) money-tree (0.11.1) multi_json (1.15.0) multi_test (0.1.2) multi_xml (0.6.0) multipart-post (2.1.1) mysql2 (0.5.5) - net-imap (0.3.4) + net-imap (0.4.10) date net-protocol net-pop (0.1.2) net-protocol - net-protocol (0.2.1) + net-protocol (0.2.2) timeout net-scp (3.0.0) net-ssh (>= 2.6.5, < 7.0.0) - net-smtp (0.3.3) + net-smtp (0.5.0) net-protocol net-ssh (6.1.0) netrc (0.11.0) - nio4r (2.5.9) - nokogiri (1.15.4-arm64-darwin) + nio4r (2.7.1) + nokogiri (1.16.3-arm64-darwin) racc (~> 1.4) - nokogiri (1.15.4-x86_64-linux) + nokogiri (1.16.3-x86_64-linux) racc (~> 1.4) oauth2 (1.4.4) faraday (>= 0.8, < 2.0) @@ -305,45 +305,47 @@ GEM public_suffix (5.0.1) puma (6.3.1) nio4r (~> 2.0) - racc (1.7.1) + racc (1.7.3) rack (2.2.9) rack-test (2.1.0) rack (>= 1.3) - rails (6.1.7.3) - actioncable (= 6.1.7.3) - actionmailbox (= 6.1.7.3) - actionmailer (= 6.1.7.3) - actionpack (= 6.1.7.3) - actiontext (= 6.1.7.3) - actionview (= 6.1.7.3) - activejob (= 6.1.7.3) - activemodel (= 6.1.7.3) - activerecord (= 6.1.7.3) - activestorage (= 6.1.7.3) - activesupport (= 6.1.7.3) + rails (6.1.7.7) + actioncable (= 6.1.7.7) + actionmailbox (= 6.1.7.7) + actionmailer (= 6.1.7.7) + actionpack (= 6.1.7.7) + actiontext (= 6.1.7.7) + actionview (= 6.1.7.7) + activejob (= 6.1.7.7) + activemodel (= 6.1.7.7) + activerecord (= 6.1.7.7) + activestorage (= 6.1.7.7) + activesupport (= 6.1.7.7) bundler (>= 1.15.0) - railties (= 6.1.7.3) + railties (= 6.1.7.7) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) activesupport (>= 5.0.1.rc1) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.5.0) - loofah (~> 2.19, >= 2.19.1) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) rails-i18n (7.0.6) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) - railties (6.1.7.3) - actionpack (= 6.1.7.3) - activesupport (= 6.1.7.3) + railties (6.1.7.7) + actionpack (= 6.1.7.7) + activesupport (= 6.1.7.7) method_source rake (>= 12.2) thor (~> 1.0) rainbow (3.1.1) - rake (13.0.6) + rake (13.1.0) rbnacl (7.1.1) ffi rbtree3 (0.6.0) @@ -444,9 +446,9 @@ GEM net-ssh (>= 2.8.0) stringio (3.1.0) temple (0.8.2) - thor (1.2.1) + thor (1.3.1) tilt (2.0.10) - timeout (0.3.2) + timeout (0.4.1) turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) @@ -470,12 +472,12 @@ GEM addressable (>= 2.3.6) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - websocket-driver (0.7.5) + websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.7) + zeitwerk (2.6.13) PLATFORMS arm64-darwin-22 @@ -520,7 +522,7 @@ DEPENDENCIES pry pry-byebug puma - rails (= 6.1.7.3) + rails (= 6.1.7.7) rails-controller-testing rails-i18n rbnacl From 624859a1422a698e25eabcc623680eaee15ea576 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 27 Mar 2024 12:15:38 +0100 Subject: [PATCH 390/415] Bump puma from 6.3.1 to 6.4.2 (#443) Bumps [puma](https://github.com/puma/puma) from 6.3.1 to 6.4.2. - [Release notes](https://github.com/puma/puma/releases) - [Changelog](https://github.com/puma/puma/blob/master/History.md) - [Commits](https://github.com/puma/puma/compare/v6.3.1...v6.4.2) --- updated-dependencies: - dependency-name: puma dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 1ceb5720..9ed34f6f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -303,7 +303,7 @@ GEM psych (5.1.2) stringio public_suffix (5.0.1) - puma (6.3.1) + puma (6.4.2) nio4r (~> 2.0) racc (1.7.3) rack (2.2.9) From 6bb40a70c3312bbfa74536dafbb3abac371b2af7 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Tue, 10 Oct 2023 23:49:35 +0200 Subject: [PATCH 391/415] updated deploy config --- config/deploy/production.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/deploy/production.rb b/config/deploy/production.rb index 13bcd143..714353d5 100644 --- a/config/deploy/production.rb +++ b/config/deploy/production.rb @@ -7,9 +7,9 @@ # Supports bulk-adding hosts to roles, the primary # server in each group is considered to be the first # unless any hosts have the primary property set. -role :app, %w[apps@50.116.2.58] -role :web, %w[apps@50.116.2.58] -role :db, %w[apps@50.116.2.58] +role :app, %w[apps@tip4commit] +role :web, %w[apps@tip4commit] +role :db, %w[apps@tip4commit] set :rails_env, 'production' set :migration_role, 'db' From 2b0aeb1517a58f2ed49240f5397c8dad8b72f363 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Tue, 10 Oct 2023 23:50:43 +0200 Subject: [PATCH 392/415] Do not try to send tips with bitcoin rpc --- lib/bitcoin_tipper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bitcoin_tipper.rb b/lib/bitcoin_tipper.rb index 10506a6c..93010c30 100644 --- a/lib/bitcoin_tipper.rb +++ b/lib/bitcoin_tipper.rb @@ -31,8 +31,8 @@ def check_and_withdrawal_funds # self.create_sendmany # end - Rails.logger.info 'Traversing sendmanies...' - Sendmany.where(txid: nil).each(&:send_transaction) + # Rails.logger.info 'Traversing sendmanies...' + # Sendmany.where(txid: nil).each(&:send_transaction) end def auto_decide_older_tips From 35c175030d42e2c85f53671000686f4cb23cb11b Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Tue, 10 Oct 2023 23:51:05 +0200 Subject: [PATCH 393/415] Fixed sendmany creation --- lib/bitcoin_tipper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bitcoin_tipper.rb b/lib/bitcoin_tipper.rb index 93010c30..1cdde599 100644 --- a/lib/bitcoin_tipper.rb +++ b/lib/bitcoin_tipper.rb @@ -76,13 +76,13 @@ def create_sendmany Rails.logger.info 'Creating sendmany' ActiveRecord::Base.transaction do sendmany = Sendmany.create - outs = calculate_outputs + outs = calculate_outputs(sendmany) sendmany.update_attribute :data, outs.to_json Rails.logger.info " #{sendmany.inspect}" end end - def calculate_outputs + def calculate_outputs(sendmany) outputs = {} User.find_each do |user| next unless user.ready_for_withdrawal? From 51f278659f63eb6e2b5cb26d0e10369a1c922e0f Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Tue, 5 Nov 2024 10:48:19 +0100 Subject: [PATCH 394/415] Updated rails --- Gemfile | 2 +- Gemfile.lock | 112 +++++++++++++++++++++++++-------------------------- 2 files changed, 57 insertions(+), 57 deletions(-) diff --git a/Gemfile b/Gemfile index 8a19e874..238fb2f7 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' -gem 'rails', '6.1.7.7' +gem 'rails', '6.1.7.10' gem 'acts_as_paranoid' gem 'airbrake' diff --git a/Gemfile.lock b/Gemfile.lock index 9ed34f6f..09b8e3fa 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,60 +1,60 @@ GEM remote: https://rubygems.org/ specs: - actioncable (6.1.7.7) - actionpack (= 6.1.7.7) - activesupport (= 6.1.7.7) + actioncable (6.1.7.10) + actionpack (= 6.1.7.10) + activesupport (= 6.1.7.10) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.7.7) - actionpack (= 6.1.7.7) - activejob (= 6.1.7.7) - activerecord (= 6.1.7.7) - activestorage (= 6.1.7.7) - activesupport (= 6.1.7.7) + actionmailbox (6.1.7.10) + actionpack (= 6.1.7.10) + activejob (= 6.1.7.10) + activerecord (= 6.1.7.10) + activestorage (= 6.1.7.10) + activesupport (= 6.1.7.10) mail (>= 2.7.1) - actionmailer (6.1.7.7) - actionpack (= 6.1.7.7) - actionview (= 6.1.7.7) - activejob (= 6.1.7.7) - activesupport (= 6.1.7.7) + actionmailer (6.1.7.10) + actionpack (= 6.1.7.10) + actionview (= 6.1.7.10) + activejob (= 6.1.7.10) + activesupport (= 6.1.7.10) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.1.7.7) - actionview (= 6.1.7.7) - activesupport (= 6.1.7.7) + actionpack (6.1.7.10) + actionview (= 6.1.7.10) + activesupport (= 6.1.7.10) rack (~> 2.0, >= 2.0.9) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.7.7) - actionpack (= 6.1.7.7) - activerecord (= 6.1.7.7) - activestorage (= 6.1.7.7) - activesupport (= 6.1.7.7) + actiontext (6.1.7.10) + actionpack (= 6.1.7.10) + activerecord (= 6.1.7.10) + activestorage (= 6.1.7.10) + activesupport (= 6.1.7.10) nokogiri (>= 1.8.5) - actionview (6.1.7.7) - activesupport (= 6.1.7.7) + actionview (6.1.7.10) + activesupport (= 6.1.7.10) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.1.7.7) - activesupport (= 6.1.7.7) + activejob (6.1.7.10) + activesupport (= 6.1.7.10) globalid (>= 0.3.6) - activemodel (6.1.7.7) - activesupport (= 6.1.7.7) - activerecord (6.1.7.7) - activemodel (= 6.1.7.7) - activesupport (= 6.1.7.7) - activestorage (6.1.7.7) - actionpack (= 6.1.7.7) - activejob (= 6.1.7.7) - activerecord (= 6.1.7.7) - activesupport (= 6.1.7.7) + activemodel (6.1.7.10) + activesupport (= 6.1.7.10) + activerecord (6.1.7.10) + activemodel (= 6.1.7.10) + activesupport (= 6.1.7.10) + activestorage (6.1.7.10) + actionpack (= 6.1.7.10) + activejob (= 6.1.7.10) + activerecord (= 6.1.7.10) + activesupport (= 6.1.7.10) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (6.1.7.7) + activesupport (6.1.7.10) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -138,7 +138,7 @@ GEM cucumber-tag_expressions (1.1.1) cucumber-wire (0.0.1) database_cleaner (1.8.5) - date (3.3.4) + date (3.4.0) demoji (0.0.7) devise (4.7.3) bcrypt (~> 3.0) @@ -251,7 +251,7 @@ GEM multi_xml (0.6.0) multipart-post (2.1.1) mysql2 (0.5.5) - net-imap (0.4.10) + net-imap (0.4.17) date net-protocol net-pop (0.1.2) @@ -309,20 +309,20 @@ GEM rack (2.2.9) rack-test (2.1.0) rack (>= 1.3) - rails (6.1.7.7) - actioncable (= 6.1.7.7) - actionmailbox (= 6.1.7.7) - actionmailer (= 6.1.7.7) - actionpack (= 6.1.7.7) - actiontext (= 6.1.7.7) - actionview (= 6.1.7.7) - activejob (= 6.1.7.7) - activemodel (= 6.1.7.7) - activerecord (= 6.1.7.7) - activestorage (= 6.1.7.7) - activesupport (= 6.1.7.7) + rails (6.1.7.10) + actioncable (= 6.1.7.10) + actionmailbox (= 6.1.7.10) + actionmailer (= 6.1.7.10) + actionpack (= 6.1.7.10) + actiontext (= 6.1.7.10) + actionview (= 6.1.7.10) + activejob (= 6.1.7.10) + activemodel (= 6.1.7.10) + activerecord (= 6.1.7.10) + activestorage (= 6.1.7.10) + activesupport (= 6.1.7.10) bundler (>= 1.15.0) - railties (= 6.1.7.7) + railties (= 6.1.7.10) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) @@ -338,9 +338,9 @@ GEM rails-i18n (7.0.6) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) - railties (6.1.7.7) - actionpack (= 6.1.7.7) - activesupport (= 6.1.7.7) + railties (6.1.7.10) + actionpack (= 6.1.7.10) + activesupport (= 6.1.7.10) method_source rake (>= 12.2) thor (~> 1.0) @@ -522,7 +522,7 @@ DEPENDENCIES pry pry-byebug puma - rails (= 6.1.7.7) + rails (= 6.1.7.10) rails-controller-testing rails-i18n rbnacl From 8fa6cfc5ff2f481f8be926416eab73d4c9e27ba3 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Tue, 5 Nov 2024 11:14:29 +0100 Subject: [PATCH 395/415] Updated ruby to 3.2.6 --- .github/workflows/build.yml | 4 +--- .tool-versions | 2 +- Gemfile | 3 ++- Gemfile.lock | 47 +++++++++++++++++-------------------- config/deploy.rb | 2 +- 5 files changed, 26 insertions(+), 32 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9d9cc828..db179f52 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,9 +12,7 @@ jobs: strategy: matrix: ruby-version: - - 3.0.5 - # - 3.1.3 - # - 3.2.1 + - 3.2.6 fail-fast: false steps: diff --git a/.tool-versions b/.tool-versions index 5de817ed..a1e3a5ab 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1 @@ -ruby 3.0.5 +ruby 3.2.6 diff --git a/Gemfile b/Gemfile index 238fb2f7..b421ef4a 100644 --- a/Gemfile +++ b/Gemfile @@ -62,12 +62,13 @@ group :development, :test do gem 'rubocop' gem 'rubocop-rails' gem 'rubocop-rspec' - gem 'sqlite3' + gem 'sqlite3', '~> 1.4' end group :test do gem 'cucumber-rails', '~> 1.0', require: false gem 'database_cleaner' + gem 'matrix' gem 'rails-controller-testing' gem 'rspec-activemodel-mocks' gem 'shoulda-matchers' diff --git a/Gemfile.lock b/Gemfile.lock index 09b8e3fa..364eab33 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -65,10 +65,10 @@ GEM activesupport (>= 5.2, < 7.0) addressable (2.8.1) public_suffix (>= 2.0.2, < 6.0) - airbrake (11.0.1) - airbrake-ruby (~> 5.1) - airbrake-ruby (5.2.0) - rbtree3 (~> 0.5) + airbrake (13.0.4) + airbrake-ruby (~> 6.0) + airbrake-ruby (6.2.2) + rbtree3 (~> 0.6) airbrussh (1.4.0) sshkit (>= 1.6.1, != 1.7.0) ast (2.4.2) @@ -149,7 +149,7 @@ GEM devise-i18n (1.9.2) devise (>= 4.7.1) diff-lcs (1.4.4) - docile (1.3.2) + docile (1.4.1) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) dusen (0.6.1) @@ -160,7 +160,6 @@ GEM edge_rider (1.1.0) activerecord (>= 3.2) erubi (1.12.0) - erubis (2.7.0) execjs (2.7.0) factory_bot (6.1.0) activesupport (>= 5.0.0) @@ -170,26 +169,21 @@ GEM faraday (1.1.0) multipart-post (>= 1.2, < 3) ruby2_keywords - ffi (1.15.5) + ffi (1.17.0-arm64-darwin) + ffi (1.17.0-x86_64-linux-gnu) gherkin (5.1.0) globalid (1.2.1) activesupport (>= 6.1) haml (5.2.1) temple (>= 0.8.0) tilt - haml-rails (2.0.1) + haml-rails (2.1.0) actionpack (>= 5.1) activesupport (>= 5.1) - haml (>= 4.0.6, < 6.0) - html2haml (>= 1.0.1) + haml (>= 4.0.6) railties (>= 5.1) hashdiff (1.0.1) hashie (4.1.0) - html2haml (2.2.0) - erubis (~> 2.7.0) - haml (>= 4.0, < 6) - nokogiri (>= 1.6.0) - ruby_parser (~> 3.5) http-accept (1.7.0) http-cookie (1.0.3) domain_name (~> 0.5) @@ -239,6 +233,7 @@ GEM net-pop net-smtp marcel (1.0.4) + matrix (0.4.2) method_source (1.0.0) mime-types (3.3.1) mime-types-data (~> 3.2015) @@ -346,9 +341,9 @@ GEM thor (~> 1.0) rainbow (3.1.1) rake (13.1.0) - rbnacl (7.1.1) - ffi - rbtree3 (0.6.0) + rbnacl (7.1.2) + ffi (~> 1) + rbtree3 (0.7.1) rdoc (6.6.3.1) psych (>= 4.0.0) regexp_parser (1.8.2) @@ -407,8 +402,6 @@ GEM rubocop-capybara (~> 2.17) ruby-progressbar (1.13.0) ruby2_keywords (0.0.2) - ruby_parser (3.15.0) - sexp_processor (~> 4.9) sass-rails (6.0.0) sassc-rails (~> 2.1, >= 2.1.1) sassc (2.4.0) @@ -424,15 +417,14 @@ GEM faraday (> 0.8, < 2.0) sdoc (2.0.2) rdoc (>= 5.0) - sexp_processor (4.15.1) shoulda-matchers (4.4.1) activesupport (>= 4.2.0) - simplecov (0.20.0) + simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) - simplecov-html (0.12.3) - simplecov_json_formatter (0.1.2) + simplecov-html (0.13.1) + simplecov_json_formatter (0.1.4) sprockets (4.2.0) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) @@ -440,7 +432,8 @@ GEM actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - sqlite3 (1.4.2) + sqlite3 (1.7.3-arm64-darwin) + sqlite3 (1.7.3-x86_64-linux) sshkit (1.21.1) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) @@ -481,6 +474,7 @@ GEM PLATFORMS arm64-darwin-22 + arm64-darwin-24 x86_64-linux DEPENDENCIES @@ -513,6 +507,7 @@ DEPENDENCIES jquery-turbolinks kaminari kaminari-i18n + matrix money-tree mysql2 octokit @@ -539,7 +534,7 @@ DEPENDENCIES shoulda-matchers simplecov sprockets - sqlite3 + sqlite3 (~> 1.4) turbolinks twitter-bootstrap-rails uglifier diff --git a/config/deploy.rb b/config/deploy.rb index a54b741f..8b639376 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -8,7 +8,7 @@ set :deploy_to, '/home/apps/t4c' set :rvm_type, :user -set :rvm_ruby_version, '3.0.5' +set :rvm_ruby_version, '3.2.6' set :rvm_custom_path, '~/.rvm' set :format, :pretty From 398a1c17235f6756728197f23bf437b8b2e9edab Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Tue, 5 Nov 2024 11:16:43 +0100 Subject: [PATCH 396/415] Updated cucumber --- Gemfile | 1 - Gemfile.lock | 56 +++++++++++++++++++++++++++------------------------- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/Gemfile b/Gemfile index b421ef4a..63b9a325 100644 --- a/Gemfile +++ b/Gemfile @@ -68,7 +68,6 @@ end group :test do gem 'cucumber-rails', '~> 1.0', require: false gem 'database_cleaner' - gem 'matrix' gem 'rails-controller-testing' gem 'rspec-activemodel-mocks' gem 'shoulda-matchers' diff --git a/Gemfile.lock b/Gemfile.lock index 364eab33..d785027e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -63,8 +63,8 @@ GEM acts_as_paranoid (0.7.0) activerecord (>= 5.2, < 7.0) activesupport (>= 5.2, < 7.0) - addressable (2.8.1) - public_suffix (>= 2.0.2, < 6.0) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) airbrake (13.0.4) airbrake-ruby (~> 6.0) airbrake-ruby (6.2.2) @@ -72,14 +72,14 @@ GEM airbrussh (1.4.0) sshkit (>= 1.6.1, != 1.7.0) ast (2.4.2) - backports (3.18.2) + backports (3.25.0) bcrypt (3.1.16) bcrypt_pbkdf (1.0.1) bech32 (1.0.5) bootstrap_form (4.5.0) actionpack (>= 5.2) activemodel (>= 5.2) - builder (3.2.4) + builder (3.3.0) byebug (11.1.3) cancancan (3.1.0) capistrano (3.14.1) @@ -95,13 +95,14 @@ GEM capistrano-rvm (0.1.2) capistrano (~> 3.0) sshkit (~> 1.2) - capybara (3.34.0) + capybara (3.40.0) addressable + matrix mini_mime (>= 0.1.3) - nokogiri (~> 1.8) + nokogiri (~> 1.11) rack (>= 1.6.0) rack-test (>= 0.6.3) - regexp_parser (~> 1.5) + regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) coderay (1.1.3) coffee-rails (5.0.0) @@ -112,7 +113,7 @@ GEM execjs coffee-script-source (1.12.2) commonjs (0.2.7) - concurrent-ruby (1.2.3) + concurrent-ruby (1.3.4) crack (0.4.4) crass (1.0.6) cucumber (3.2.0) @@ -148,7 +149,7 @@ GEM warden (~> 1.2.3) devise-i18n (1.9.2) devise (>= 4.7.1) - diff-lcs (1.4.4) + diff-lcs (1.5.1) docile (1.4.1) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) @@ -159,7 +160,7 @@ GEM ed25519 (1.2.4) edge_rider (1.1.0) activerecord (>= 3.2) - erubi (1.12.0) + erubi (1.13.0) execjs (2.7.0) factory_bot (6.1.0) activesupport (>= 5.0.0) @@ -188,7 +189,7 @@ GEM http-cookie (1.0.3) domain_name (~> 0.5) http_accept_language (2.1.1) - i18n (1.14.4) + i18n (1.14.6) concurrent-ruby (~> 1.0) i18n-js (3.8.0) i18n (>= 0.6.6) @@ -224,7 +225,8 @@ GEM actionpack (>= 4) less (~> 2.6.0) sprockets (>= 2) - loofah (2.22.0) + logger (1.6.1) + loofah (2.23.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.8.1) @@ -234,15 +236,16 @@ GEM net-smtp marcel (1.0.4) matrix (0.4.2) - method_source (1.0.0) - mime-types (3.3.1) + method_source (1.1.0) + mime-types (3.6.0) + logger mime-types-data (~> 3.2015) - mime-types-data (3.2020.1104) + mime-types-data (3.2024.1001) mini_mime (1.1.5) - minitest (5.22.3) + minitest (5.25.1) money-tree (0.11.1) multi_json (1.15.0) - multi_test (0.1.2) + multi_test (1.1.0) multi_xml (0.6.0) multipart-post (2.1.1) mysql2 (0.5.5) @@ -260,9 +263,9 @@ GEM net-ssh (6.1.0) netrc (0.11.0) nio4r (2.7.1) - nokogiri (1.16.3-arm64-darwin) + nokogiri (1.16.7-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.3-x86_64-linux) + nokogiri (1.16.7-x86_64-linux) racc (~> 1.4) oauth2 (1.4.4) faraday (>= 0.8, < 2.0) @@ -297,11 +300,11 @@ GEM pry (>= 0.13, < 0.15) psych (5.1.2) stringio - public_suffix (5.0.1) + public_suffix (6.0.1) puma (6.4.2) nio4r (~> 2.0) - racc (1.7.3) - rack (2.2.9) + racc (1.8.1) + rack (2.2.10) rack-test (2.1.0) rack (>= 1.3) rails (6.1.7.10) @@ -340,13 +343,13 @@ GEM rake (>= 12.2) thor (~> 1.0) rainbow (3.1.1) - rake (13.1.0) + rake (13.2.1) rbnacl (7.1.2) ffi (~> 1) rbtree3 (0.7.1) rdoc (6.6.3.1) psych (>= 4.0.0) - regexp_parser (1.8.2) + regexp_parser (2.9.2) render_csv (2.0.0) rails (>= 3.0) responders (3.0.1) @@ -439,7 +442,7 @@ GEM net-ssh (>= 2.8.0) stringio (3.1.0) temple (0.8.2) - thor (1.3.1) + thor (1.3.2) tilt (2.0.10) timeout (0.4.1) turbolinks (5.2.1) @@ -470,7 +473,7 @@ GEM websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.13) + zeitwerk (2.7.1) PLATFORMS arm64-darwin-22 @@ -507,7 +510,6 @@ DEPENDENCIES jquery-turbolinks kaminari kaminari-i18n - matrix money-tree mysql2 octokit From 2f3a6022e5240cfdef68ba83102e23bbb78d4118 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Tue, 5 Nov 2024 11:25:21 +0100 Subject: [PATCH 397/415] enable OpenSSL legacy provider for compatibility in GitHub Actions --- .github/workflows/build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index db179f52..a0c7e8d5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,6 +25,12 @@ jobs: ruby-version: ${{ matrix.ruby-version }} bundler-cache: true + - name: Configure OpenSSL + run: | + sudo sed -i '/\[provider_sect\]/a legacy = legacy_sect' /etc/ssl/openssl.cnf + sudo sed -i '/\[default_sect\]/a activate = 1' /etc/ssl/openssl.cnf + echo -e '\n[legacy_sect]\nactivate = 1' | sudo tee -a /etc/ssl/openssl.cnf + - name: Install dependencies run: | bundle config set without 'development' From 2af9e390e99cc4aba14d657d4bd2c7334e52e752 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Tue, 5 Nov 2024 11:27:15 +0100 Subject: [PATCH 398/415] Check openssl version in ci --- .github/workflows/build.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a0c7e8d5..c8d2d26e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,11 +25,8 @@ jobs: ruby-version: ${{ matrix.ruby-version }} bundler-cache: true - - name: Configure OpenSSL - run: | - sudo sed -i '/\[provider_sect\]/a legacy = legacy_sect' /etc/ssl/openssl.cnf - sudo sed -i '/\[default_sect\]/a activate = 1' /etc/ssl/openssl.cnf - echo -e '\n[legacy_sect]\nactivate = 1' | sudo tee -a /etc/ssl/openssl.cnf + - name: Check OpenSSL Version + run: openssl version - name: Install dependencies run: | From d52a3de5e320f37c3343f675fd0dfc6df3ec23fa Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Tue, 5 Nov 2024 11:34:05 +0100 Subject: [PATCH 399/415] Updated money-tree --- Gemfile.lock | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index d785027e..fa8f1ed8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -75,7 +75,8 @@ GEM backports (3.25.0) bcrypt (3.1.16) bcrypt_pbkdf (1.0.1) - bech32 (1.0.5) + bech32 (1.4.2) + thor (>= 1.1.0) bootstrap_form (4.5.0) actionpack (>= 5.2) activemodel (>= 5.2) @@ -243,7 +244,9 @@ GEM mime-types-data (3.2024.1001) mini_mime (1.1.5) minitest (5.25.1) - money-tree (0.11.1) + money-tree (0.11.2) + bech32 (~> 1.3) + openssl (~> 3.1) multi_json (1.15.0) multi_test (1.1.0) multi_xml (0.6.0) @@ -288,6 +291,7 @@ GEM omniauth-rails_csrf_protection (0.1.2) actionpack (>= 4.2) omniauth (>= 1.3.1) + openssl (3.2.0) orm_adapter (0.5.0) parallel (1.22.1) parser (3.2.1.1) From 31ca89c3d00bd62d6cec9f01a68ffddbdb05db5f Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Tue, 5 Nov 2024 11:44:28 +0100 Subject: [PATCH 400/415] Updated rubocop target ruby version --- .rubocop.yml | 2 +- app/models/project.rb | 4 ++-- app/models/user.rb | 4 ++-- features/step_definitions/users_steps.rb | 4 ++-- lib/blacklist.rb | 2 -- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 5eee973d..c0f62e3f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -6,7 +6,7 @@ require: - rubocop-rspec AllCops: - TargetRubyVersion: 3.0 + TargetRubyVersion: 3.2 NewCops: enable Exclude: - 'db/schema.rb' diff --git a/app/models/project.rb b/app/models/project.rb index 8b2effb0..70d72905 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -138,8 +138,8 @@ def tip_for(commit) # create a tip tip = tips.create( - user: user, - amount: amount, + user:, + amount:, commit: commit.sha, commit_message: commit.commit.message ) diff --git a/app/models/user.rb b/app/models/user.rb index f4ed033c..563b468b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -77,7 +77,7 @@ def find_by_commit(commit) email = commit.commit.author.email nickname = commit.author.try(:login) - find_by(email: email) || (nickname.blank? ? nil : find_by(nickname: nickname)) + find_by(email:) || (nickname.blank? ? nil : find_by(nickname:)) end def find_by_nickname(nickname) @@ -94,7 +94,7 @@ def gravatar def set_login_token! loop do self.login_token = SecureRandom.urlsafe_base64 - break login_token unless User.exists?(login_token: login_token) + break login_token unless User.exists?(login_token:) end end end diff --git a/features/step_definitions/users_steps.rb b/features/step_definitions/users_steps.rb index 7984b949..9dffcff0 100644 --- a/features/step_definitions/users_steps.rb +++ b/features/step_definitions/users_steps.rb @@ -17,9 +17,9 @@ def create_user(nickname, has_bitcoiin_address) end Then(/^a developer named "(.*?)" does not exist$/) do |nickname| - User.where(nickname: nickname).first.should be_nil + User.where(nickname:).first.should be_nil end Then(/^a developer named "(.*?)" exists$/) do |nickname| - User.where(nickname: nickname).first.should_not be_nil + User.where(nickname:).first.should_not be_nil end diff --git a/lib/blacklist.rb b/lib/blacklist.rb index d30d5a75..2fa2733b 100644 --- a/lib/blacklist.rb +++ b/lib/blacklist.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require 'set' - class Blacklist def initialize(urls) urls = urls.map { |u| normalize_url(u) } From 536142dd0932e7d3b88cc87780b98dcb97cfe909 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Tue, 5 Nov 2024 11:44:44 +0100 Subject: [PATCH 401/415] Update build workflow to remove OpenSSL version check --- .github/workflows/build.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c8d2d26e..db179f52 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,9 +25,6 @@ jobs: ruby-version: ${{ matrix.ruby-version }} bundler-cache: true - - name: Check OpenSSL Version - run: openssl version - - name: Install dependencies run: | bundle config set without 'development' From a8404d846b98c025dbc958dac8778e754c09455a Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Tue, 5 Nov 2024 11:57:51 +0100 Subject: [PATCH 402/415] Try to install openssl 1.1 --- .github/workflows/build.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index db179f52..ac234187 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,6 +19,14 @@ jobs: - name: Checkout code uses: actions/checkout@v2 + - name: Install OpenSSL 1.1 + run: | + sudo apt-get update + sudo apt-get install -y libssl1.1 libssl-dev + + - name: Set RUBY_CONFIGURE_OPTS + run: echo "RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/lib/ssl" >> $GITHUB_ENV + - name: Set up Ruby ${{ matrix.ruby-version }} uses: ruby/setup-ruby@v1 with: From a684d274d1aaa50dd91127136c534cb4ca7fe4d4 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Tue, 5 Nov 2024 11:59:41 +0100 Subject: [PATCH 403/415] Revert "Try to install openssl 1.1" This reverts commit a8404d846b98c025dbc958dac8778e754c09455a. --- .github/workflows/build.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ac234187..db179f52 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,14 +19,6 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - - name: Install OpenSSL 1.1 - run: | - sudo apt-get update - sudo apt-get install -y libssl1.1 libssl-dev - - - name: Set RUBY_CONFIGURE_OPTS - run: echo "RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/lib/ssl" >> $GITHUB_ENV - - name: Set up Ruby ${{ matrix.ruby-version }} uses: ruby/setup-ruby@v1 with: From b18db00ca3a4c2e66e6d10b6fc9c4a3edb90dbdf Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Tue, 5 Nov 2024 12:05:46 +0100 Subject: [PATCH 404/415] Try to load OpenSSL ripemd160 --- .github/workflows/build.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index db179f52..f7c61b08 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,6 +25,13 @@ jobs: ruby-version: ${{ matrix.ruby-version }} bundler-cache: true + - name: Load OpenSSL ripemd160 + run: | + sed -i '/^\default = default_sect/a legacy = legacy_sect' /etc/ssl/openssl.cnf + sed -i '/^\[default_sect\]/a activate = 1' /etc/ssl/openssl.cnf + echo "[legacy_sect]" >> /etc/ssl/openssl.cnf + echo "activate = 1" >> /etc/ssl/openssl.cnf + - name: Install dependencies run: | bundle config set without 'development' From 64288cd27e5df470919c38d25ff971ccf301e8e4 Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Tue, 5 Nov 2024 12:08:07 +0100 Subject: [PATCH 405/415] Updated fix --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f7c61b08..ae218b40 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,10 +27,10 @@ jobs: - name: Load OpenSSL ripemd160 run: | - sed -i '/^\default = default_sect/a legacy = legacy_sect' /etc/ssl/openssl.cnf - sed -i '/^\[default_sect\]/a activate = 1' /etc/ssl/openssl.cnf - echo "[legacy_sect]" >> /etc/ssl/openssl.cnf - echo "activate = 1" >> /etc/ssl/openssl.cnf + sudo sed -i '/^\default = default_sect/a legacy = legacy_sect' /etc/ssl/openssl.cnf + sudo sed -i '/^\[default_sect\]/a activate = 1' /etc/ssl/openssl.cnf + echo "[legacy_sect]" | sudo tee -a /etc/ssl/openssl.cnf + echo "activate = 1" | sudo tee -a /etc/ssl/openssl.cnf - name: Install dependencies run: | From 9839e31a3438085de4b3af9d5ff70fda726119aa Mon Sep 17 00:00:00 2001 From: Aleksandr Zykov Date: Tue, 5 Nov 2024 12:09:53 +0100 Subject: [PATCH 406/415] Try to use ubuntu-24.04 --- .github/workflows/build.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ae218b40..ef41bee5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 strategy: matrix: ruby-version: @@ -25,13 +25,6 @@ jobs: ruby-version: ${{ matrix.ruby-version }} bundler-cache: true - - name: Load OpenSSL ripemd160 - run: | - sudo sed -i '/^\default = default_sect/a legacy = legacy_sect' /etc/ssl/openssl.cnf - sudo sed -i '/^\[default_sect\]/a activate = 1' /etc/ssl/openssl.cnf - echo "[legacy_sect]" | sudo tee -a /etc/ssl/openssl.cnf - echo "activate = 1" | sudo tee -a /etc/ssl/openssl.cnf - - name: Install dependencies run: | bundle config set without 'development' From ef9494e64f25161d1a8bf24736786e9f677f43a3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Nov 2024 12:44:30 +0100 Subject: [PATCH 407/415] Bump rexml from 3.2.5 to 3.3.9 (#454) Bumps [rexml](https://github.com/ruby/rexml) from 3.2.5 to 3.3.9. - [Release notes](https://github.com/ruby/rexml/releases) - [Changelog](https://github.com/ruby/rexml/blob/master/NEWS.md) - [Commits](https://github.com/ruby/rexml/compare/v3.2.5...v3.3.9) --- updated-dependencies: - dependency-name: rexml dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index fa8f1ed8..909031d3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -364,7 +364,7 @@ GEM http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) - rexml (3.2.5) + rexml (3.3.9) rspec-activemodel-mocks (1.1.0) activemodel (>= 3.0) activesupport (>= 3.0) From 438c21951af3a9a79606667479ea83f1f7e29152 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Nov 2024 12:51:36 +0100 Subject: [PATCH 408/415] Bump puma from 6.4.2 to 6.4.3 (#455) Bumps [puma](https://github.com/puma/puma) from 6.4.2 to 6.4.3. - [Release notes](https://github.com/puma/puma/releases) - [Changelog](https://github.com/puma/puma/blob/master/History.md) - [Commits](https://github.com/puma/puma/compare/v6.4.2...v6.4.3) --- updated-dependencies: - dependency-name: puma dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 909031d3..ea628fb1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -265,7 +265,7 @@ GEM net-protocol net-ssh (6.1.0) netrc (0.11.0) - nio4r (2.7.1) + nio4r (2.7.4) nokogiri (1.16.7-arm64-darwin) racc (~> 1.4) nokogiri (1.16.7-x86_64-linux) @@ -305,7 +305,7 @@ GEM psych (5.1.2) stringio public_suffix (6.0.1) - puma (6.4.2) + puma (6.4.3) nio4r (~> 2.0) racc (1.8.1) rack (2.2.10) From b54a23471ff61af306e6a765daa2f4d835016c78 Mon Sep 17 00:00:00 2001 From: Humz Date: Tue, 5 Nov 2024 12:00:29 +0000 Subject: [PATCH 409/415] Update de.yml (#409) Localisation improved as in German syntax rules, nouns are in capitals --- config/locales/de.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/de.yml b/config/locales/de.yml index b2ea2e77..c8f0cef6 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -2,7 +2,7 @@ de: tip4commit: Tip4Commit meta: title: Tragen Sie zu Open-Source-Projekten bei - description: Spenden Sie bitcoins an Projekte die Sie interessieren oder fügen Sie commits hinzu um Trinkgelder zu erhalten + description: Spenden Sie Bitcoins an Projekte die Sie interessieren oder fügen Sie Commits hinzu um Trinkgelder zu erhalten menu: home: Home projects: Unterstützte Projekte From 32dea6b2d397582305fd156372b18d85d49b4e12 Mon Sep 17 00:00:00 2001 From: bashgnu <38274202+bashgnu@users.noreply.github.com> Date: Tue, 5 Nov 2024 20:00:46 +0800 Subject: [PATCH 410/415] Update en.yml (#407) --- config/locales/en.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 969ae7ff..171a69a1 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -233,6 +233,6 @@ en: general: or: or disclaimer: - line1: "Tip4Commit is not affiliated with most of the projects." + line1: "Tip4Commit is not affiliated with most of these projects." line2: "There is no guarantee that tips will be claimed by developers." line3: "By donating the funds you agree that they can be sent to the Free Software Foundation or elsewhere at Tip4Commit's discretion." From 10db9fa223dbfc3a0d1ccbb5031a80b59757f3c6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Dec 2024 21:04:16 +0100 Subject: [PATCH 411/415] Bump rails-html-sanitizer from 1.6.0 to 1.6.1 (#457) Bumps [rails-html-sanitizer](https://github.com/rails/rails-html-sanitizer) from 1.6.0 to 1.6.1. - [Release notes](https://github.com/rails/rails-html-sanitizer/releases) - [Changelog](https://github.com/rails/rails-html-sanitizer/blob/main/CHANGELOG.md) - [Commits](https://github.com/rails/rails-html-sanitizer/compare/v1.6.0...v1.6.1) --- updated-dependencies: - dependency-name: rails-html-sanitizer dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index ea628fb1..28262ed0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -266,9 +266,9 @@ GEM net-ssh (6.1.0) netrc (0.11.0) nio4r (2.7.4) - nokogiri (1.16.7-arm64-darwin) + nokogiri (1.16.8-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.7-x86_64-linux) + nokogiri (1.16.8-x86_64-linux) racc (~> 1.4) oauth2 (1.4.4) faraday (>= 0.8, < 2.0) @@ -334,9 +334,9 @@ GEM activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.6.0) + rails-html-sanitizer (1.6.1) loofah (~> 2.21) - nokogiri (~> 1.14) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) rails-i18n (7.0.6) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) From 517c1999364193cec96606949ba1e1ef2655dee4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 9 May 2025 08:30:51 +0200 Subject: [PATCH 412/415] Bump rack from 2.2.10 to 2.2.14 (#466) Bumps [rack](https://github.com/rack/rack) from 2.2.10 to 2.2.14. - [Release notes](https://github.com/rack/rack/releases) - [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md) - [Commits](https://github.com/rack/rack/compare/v2.2.10...v2.2.14) --- updated-dependencies: - dependency-name: rack dependency-version: 2.2.14 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 28262ed0..1366861a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -308,7 +308,7 @@ GEM puma (6.4.3) nio4r (~> 2.0) racc (1.8.1) - rack (2.2.10) + rack (2.2.14) rack-test (2.1.0) rack (>= 1.3) rails (6.1.7.10) From e006d7407d8750c802b716c3565dba166e0a6fa3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 9 May 2025 08:34:20 +0200 Subject: [PATCH 413/415] Bump net-imap from 0.4.17 to 0.4.20 (#465) Bumps [net-imap](https://github.com/ruby/net-imap) from 0.4.17 to 0.4.20. - [Release notes](https://github.com/ruby/net-imap/releases) - [Commits](https://github.com/ruby/net-imap/compare/v0.4.17...v0.4.20) --- updated-dependencies: - dependency-name: net-imap dependency-version: 0.4.20 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 1366861a..8e0017cf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -140,7 +140,7 @@ GEM cucumber-tag_expressions (1.1.1) cucumber-wire (0.0.1) database_cleaner (1.8.5) - date (3.4.0) + date (3.4.1) demoji (0.0.7) devise (4.7.3) bcrypt (~> 3.0) @@ -252,7 +252,7 @@ GEM multi_xml (0.6.0) multipart-post (2.1.1) mysql2 (0.5.5) - net-imap (0.4.17) + net-imap (0.4.20) date net-protocol net-pop (0.1.2) @@ -448,7 +448,7 @@ GEM temple (0.8.2) thor (1.3.2) tilt (2.0.10) - timeout (0.4.1) + timeout (0.4.3) turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) From d2edf2cb65f09f9062c1afe631c29e69cb7acd81 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 9 May 2025 14:09:15 +0200 Subject: [PATCH 414/415] Bump nokogiri from 1.16.8 to 1.18.8 (#464) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.16.8 to 1.18.8. - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.16.8...v1.18.8) --- updated-dependencies: - dependency-name: nokogiri dependency-version: 1.18.8 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 8e0017cf..fb5ef679 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -266,9 +266,9 @@ GEM net-ssh (6.1.0) netrc (0.11.0) nio4r (2.7.4) - nokogiri (1.16.8-arm64-darwin) + nokogiri (1.18.8-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.8-x86_64-linux) + nokogiri (1.18.8-x86_64-linux-gnu) racc (~> 1.4) oauth2 (1.4.4) faraday (>= 0.8, < 2.0) From ab2b1b3b78eb11021bf3cf48368b7e5cce8db183 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Aug 2025 10:44:42 +0200 Subject: [PATCH 415/415] Bump nokogiri from 1.18.8 to 1.18.9 (#470) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.18.8 to 1.18.9. - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.18.8...v1.18.9) --- updated-dependencies: - dependency-name: nokogiri dependency-version: 1.18.9 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index fb5ef679..518d1539 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -266,9 +266,9 @@ GEM net-ssh (6.1.0) netrc (0.11.0) nio4r (2.7.4) - nokogiri (1.18.8-arm64-darwin) + nokogiri (1.18.9-arm64-darwin) racc (~> 1.4) - nokogiri (1.18.8-x86_64-linux-gnu) + nokogiri (1.18.9-x86_64-linux-gnu) racc (~> 1.4) oauth2 (1.4.4) faraday (>= 0.8, < 2.0)