-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KBP-138 #time 20m - fixed conflict and fix rubocop error
- Loading branch information
Showing
14 changed files
with
176 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# frozen_string_literal: true | ||
|
||
module Cybele | ||
module Helpers | ||
module Pronto | ||
def configure_pronto | ||
# Create pronto files | ||
template 'pronto/example.pronto.yml.erb', | ||
'example.pronto.yml', | ||
force: true | ||
template 'pronto/example.pronto.yml.erb', | ||
'.pronto.yml', | ||
force: true | ||
template 'pronto/.rubocop.yml.erb', | ||
'.rubocop.yml', | ||
force: true | ||
template 'pronto/rubo.erb', | ||
'bin/rubo', | ||
force: true | ||
run 'chmod +x bin/rubo' | ||
|
||
# Ignore secret information file | ||
append_file('.gitignore', '.pronto.yml') | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# frozen_string_literal: true | ||
|
||
module ProntoTestHelpers | ||
def pronto_test | ||
file_exist_test | ||
file_content_test | ||
gitignore_test | ||
end | ||
|
||
private | ||
|
||
def file_exist_test | ||
gemfile_file = content('Gemfile') | ||
expect(gemfile_file).to match("gem 'pronto'") | ||
expect(gemfile_file).to match("gem 'pronto-flay'") | ||
expect(gemfile_file).to match("gem 'pronto-rubocop'") | ||
end | ||
|
||
def file_content_test # rubocop:disable Metrics/AbcSize | ||
expect(File).to exist(file_project_path('example.pronto.yml')) | ||
expect(File).to exist(file_project_path('.pronto.yml')) | ||
expect(File).to exist(file_project_path('.rubocop.yml')) | ||
expect(File).to exist(file_project_path('bin/rubo')) | ||
end | ||
|
||
def gitignore_test | ||
gemfile_file = content('.gitignore') | ||
expect(gemfile_file).to match('.pronto.yml') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
AllCops: | ||
Includes: | ||
- 'Rakefile' | ||
- 'config.ru' | ||
- 'Gemfile' | ||
Excludes: | ||
- Guardfile | ||
- bin/** | ||
- db/**/** | ||
- spec/**/**/**/** | ||
- test/**/**/**/** | ||
- tmp/**/**/**/** | ||
|
||
Documentation: | ||
Enabled: false | ||
|
||
Metrics/LineLength: | ||
Max: 100 | ||
Exclude: | ||
- 'Gemfile' | ||
|
||
Metrics/MethodLength: | ||
CountComments: false | ||
Max: 15 | ||
|
||
Metrics/BlockLength: | ||
CountComments: false | ||
Max: 40 | ||
Exclude: | ||
- 'Rakefile' | ||
- '**/*.rake' | ||
- 'spec/**/*.rb' | ||
|
||
Style/FrozenStringLiteralComment: | ||
EnforcedStyle: when_needed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
all: | ||
exclude: | ||
- 'spec/**/*' | ||
bitbucket: | ||
slug: 'lab2023corp/<%= app_name%>' | ||
username: 'username' | ||
password: 'password' | ||
max_warnings: 50 | ||
verbose: true | ||
|
||
## for local changes before the commit | ||
# before git add . | ||
# pronto run --unstaged | ||
# after git add . | ||
# pronto run --staged | ||
|
||
## for branch commits analyze different between develop | ||
# pronto run | ||
# pronto run -c origin/develop | ||
|
||
## for pull request | ||
# pronto run -f bitbucket_pr | ||
# pronto run -f bitbucket_pr -c origin/develop | ||
|
||
## for commit | ||
# pronto run -f bitbucket | ||
# pronto run -f bitbucket -c origin/develop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env ruby | ||
# frozen_string_literal: true | ||
|
||
require 'English' | ||
require 'rubocop' | ||
|
||
DISABLE_DIRECTORY = %w[db].freeze | ||
ADDED_OR_MODIFIED = /A|AM|^M/ | ||
|
||
changed_files = `git status --porcelain`.split(/\n/).select do |file_name_with_status| | ||
file_name_with_status =~ ADDED_OR_MODIFIED | ||
end | ||
changed_files = changed_files.map do |file_name_with_status| | ||
file_name_with_status.split(' ')[1] | ||
end | ||
changed_files = changed_files.select do |file_name| | ||
directory = file_name.split('/')[0] | ||
!DISABLE_DIRECTORY.include?(directory) && File.extname(file_name) == '.rb' | ||
end | ||
changed_files = changed_files.join(' ') | ||
|
||
system("rubocop #{changed_files}") unless changed_files.empty? | ||
|
||
exit $CHILD_STATUS.to_s[-1].to_i |