safe_pusher 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.hound.yml +2 -0
- data/.rubocop.yml +142 -7
- data/CHANGELOG.md +4 -0
- data/lib/safe_pusher.rb +1 -1
- data/lib/safe_pusher/cli.rb +57 -22
- data/lib/safe_pusher/github_runner.rb +11 -11
- data/lib/safe_pusher/rspec_runner.rb +1 -1
- data/lib/safe_pusher/version.rb +1 -1
- data/safe_pusher.gemspec +1 -0
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6393bd85a974e1d867941ac975e031b5d0385fe5
|
4
|
+
data.tar.gz: 2e4c02a81577f79227015105d139f6063df8a61c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed8d28521ddc648fb3fc160916c9fa2f271e26ffc446469991ac51cc4769b74b4bc709c917578c5b57b67bf9ac38fce0d5013f3f05b176c64a86ec9cf47f8085
|
7
|
+
data.tar.gz: 725bf26b3f3ed256d04cbe6424abcf651727ad2e55d65ddf4583512e71742bcad2ca9c62f64fcb2dd7920d12117f5f0ced052179776c0dc6c7116c662e1bfcb6
|
data/.hound.yml
ADDED
data/.rubocop.yml
CHANGED
@@ -1,6 +1,141 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
require: rubocop-rspec
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
TargetRubyVersion: 2.3
|
5
|
+
DisplayCopNames: true
|
6
|
+
|
7
|
+
# Do not sort gems in Gemfile, since we are grouping them by functionality.
|
8
|
+
Bundler/OrderedGems:
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
# Add a comment before each gem in Gemfile.
|
12
|
+
Bundler/GemComment:
|
13
|
+
Enabled: true
|
14
|
+
|
15
|
+
# Trailing commas are required on multiline method arguments.
|
16
|
+
Style/TrailingCommaInArguments:
|
17
|
+
EnforcedStyleForMultiline: comma
|
18
|
+
|
19
|
+
# Trailing commas are required in multiline arrays.
|
20
|
+
Style/TrailingCommaInArrayLiteral:
|
21
|
+
EnforcedStyleForMultiline: comma
|
22
|
+
|
23
|
+
# Trailing commas are required in multiline hashes.
|
24
|
+
Style/TrailingCommaInHashLiteral:
|
25
|
+
EnforcedStyleForMultiline: comma
|
26
|
+
|
27
|
+
# Allow indenting multiline chained operations.
|
28
|
+
Layout/MultilineMethodCallIndentation:
|
29
|
+
EnforcedStyle: indented
|
30
|
+
|
31
|
+
# Allow empty lines around blocks in specs.
|
32
|
+
Layout/EmptyLinesAroundBlockBody:
|
33
|
+
Exclude:
|
34
|
+
- spec/**/*
|
35
|
+
|
36
|
+
# Allow not adding parentheses around blocks in DSLs.
|
37
|
+
# E.g.:
|
38
|
+
# expect { … }.to change { … }
|
39
|
+
Lint/AmbiguousBlockAssociation:
|
40
|
+
Exclude:
|
41
|
+
- spec/**/*
|
42
|
+
|
43
|
+
# Limit method length (default is 10).
|
44
|
+
Metrics/MethodLength:
|
45
|
+
Max: 15
|
46
|
+
|
47
|
+
# Limit class length (default is 100).
|
48
|
+
Metrics/ClassLength:
|
49
|
+
Max: 200
|
50
|
+
|
51
|
+
# Do not require `# frozen_string_literal: true` at the top of every file.
|
52
|
+
FrozenStringLiteralComment:
|
53
|
+
Enabled: false
|
54
|
+
|
55
|
+
# Allow ASCII comments (e.g "…").
|
56
|
+
Style/AsciiComments:
|
57
|
+
Enabled: false
|
58
|
+
|
59
|
+
# Do not comment the class we create, since the name should be self explanatory.
|
60
|
+
Documentation:
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
# Do not verify the length of the blocks in DSLs.
|
64
|
+
Metrics/BlockLength:
|
65
|
+
Exclude:
|
66
|
+
- "**/*/spec/**/*"
|
67
|
+
- lib/tasks/**/*
|
68
|
+
- app/admin/**/*
|
69
|
+
- config/routes.rb
|
70
|
+
ExcludedMethods:
|
71
|
+
- included
|
72
|
+
|
73
|
+
# Allow any number of keyword arguments in methods.
|
74
|
+
Metrics/ParameterLists:
|
75
|
+
CountKeywordArgs: false
|
76
|
+
|
77
|
+
# Prefer `a_variable_1` to `a_variable1`.
|
78
|
+
Naming/VariableNumber:
|
79
|
+
EnforcedStyle: snake_case
|
80
|
+
|
81
|
+
# Prefer `== 0`, `< 0`, `> 0` to `zero?`, `negative?` or `positive?`,
|
82
|
+
# since they don't exist before Ruby 2.3 or Rails 5 and can be ambiguous.
|
83
|
+
Style/NumericPredicate:
|
84
|
+
EnforcedStyle: comparison
|
85
|
+
|
86
|
+
# This cop by default assumes that `Rails.root.join('foo', 'bar')` works
|
87
|
+
# better under Windows than `Rails.root.join('foo/bar')`.
|
88
|
+
Rails/FilePath:
|
89
|
+
EnforcedStyle: slashes
|
90
|
+
|
91
|
+
# Do not checks for the use of output safety calls like `html_safe` and `raw`,
|
92
|
+
# we know what we are doing.
|
93
|
+
Rails/OutputSafety:
|
94
|
+
Enabled: false
|
95
|
+
|
96
|
+
# Allow `update_attribute`, we know when to use it.
|
97
|
+
Rails/SkipsModelValidations:
|
98
|
+
Enabled: false
|
99
|
+
|
100
|
+
# Allow creating tables without timestamps, whe know what we are doing.
|
101
|
+
Rails/CreateTableWithTimestamps:
|
102
|
+
Enabled: false
|
103
|
+
|
104
|
+
# Allow using `allow_any_instance_of` for stubbing.
|
105
|
+
RSpec/AnyInstance:
|
106
|
+
Enabled: false
|
107
|
+
|
108
|
+
# Allow `let!` to setup test data in specs.
|
109
|
+
RSpec/LetSetup:
|
110
|
+
Enabled: false
|
111
|
+
|
112
|
+
# Allow a nesting of up to 5 of describe/context blocks (default is 3).
|
113
|
+
RSpec/NestedGroups:
|
114
|
+
Max: 10
|
115
|
+
|
116
|
+
# Allow any number of expectations in an example, for performance.
|
117
|
+
RSpec/MultipleExpectations:
|
118
|
+
Enabled: false
|
119
|
+
|
120
|
+
# Allow using normal test doubles, since they are useful for mocking.
|
121
|
+
RSpec/VerifiedDoubles:
|
122
|
+
Enabled: false
|
123
|
+
|
124
|
+
# Limit example length (default is 5)
|
125
|
+
RSpec/ExampleLength:
|
126
|
+
Max: 10
|
127
|
+
|
128
|
+
# Prefer `change { User.count }` to `change(User, :count)`.
|
129
|
+
RSpec/ExpectChange:
|
130
|
+
EnforcedStyle: block
|
131
|
+
|
132
|
+
# Allow template token "%{foo}" since they are used in translation keys.
|
133
|
+
Style/FormatStringToken:
|
134
|
+
EnforcedStyle: template
|
135
|
+
|
136
|
+
# Prefer `->` to `lambda`.
|
137
|
+
Style/Lambda:
|
138
|
+
EnforcedStyle: literal
|
4
139
|
|
5
140
|
# Deactivate rule that makes `lambda` mandatory in defavor of `->`
|
6
141
|
# when having blocks.
|
@@ -17,11 +152,11 @@ Layout/EmptyLinesAroundBlockBody:
|
|
17
152
|
RSpec/VerifiedDoubles:
|
18
153
|
Enabled: false
|
19
154
|
|
20
|
-
# Allow 5 nesting groups for context
|
21
|
-
RSpec/NestedGroups:
|
22
|
-
Max: 5
|
23
|
-
|
24
155
|
# Enable long blocs for Gemspec files
|
25
156
|
Metrics/BlockLength:
|
26
157
|
Exclude:
|
27
158
|
- safe_pusher.gemspec
|
159
|
+
|
160
|
+
Metrics/BlockLength:
|
161
|
+
Exclude:
|
162
|
+
- spec/**/*
|
data/CHANGELOG.md
CHANGED
data/lib/safe_pusher.rb
CHANGED
data/lib/safe_pusher/cli.rb
CHANGED
@@ -1,56 +1,91 @@
|
|
1
1
|
module SafePusher
|
2
2
|
class CLI < Thor
|
3
|
-
desc '
|
4
|
-
def
|
3
|
+
desc 'test (t)', 'launch the test suite'
|
4
|
+
def test
|
5
|
+
puts '##########################'.yellow
|
6
|
+
puts '## Testing new files... ##'.yellow
|
7
|
+
puts '##########################'.yellow
|
8
|
+
|
9
|
+
results = SafePusher::RspecRunner.new.call
|
10
|
+
|
11
|
+
exit results unless results == 0
|
12
|
+
end
|
13
|
+
map 't' => :test
|
14
|
+
|
15
|
+
desc 'lint (l)', 'launch the linters'
|
16
|
+
def lint
|
5
17
|
puts '#######################'.yellow
|
6
|
-
puts '## Running
|
18
|
+
puts '## Running linter... ##'.yellow
|
7
19
|
puts '#######################'.yellow
|
8
20
|
|
9
21
|
results = SafePusher::ProntoRunner.new.call
|
10
22
|
|
11
23
|
exit results unless results == 0
|
12
24
|
end
|
25
|
+
map 'l' => :lint
|
13
26
|
|
14
|
-
desc '
|
15
|
-
def
|
27
|
+
desc 'push (p)', 'push your code on github'
|
28
|
+
def push
|
16
29
|
puts '##########################'.yellow
|
17
|
-
puts '##
|
30
|
+
puts '## Pushing to Github... ##'.yellow
|
18
31
|
puts '##########################'.yellow
|
19
32
|
|
20
|
-
results = SafePusher::
|
33
|
+
results = SafePusher::GithubRunner.new.push
|
34
|
+
|
35
|
+
exit results unless results == 0
|
36
|
+
end
|
37
|
+
map 'p' => :push
|
38
|
+
|
39
|
+
desc 'open (o)', 'open a pull request on github'
|
40
|
+
def open
|
41
|
+
puts '#########################################'.yellow
|
42
|
+
puts '## Opening a pull request on Github... ##'.yellow
|
43
|
+
puts '#########################################'.yellow
|
44
|
+
|
45
|
+
results = SafePusher::GithubRunner.new.open
|
21
46
|
|
22
47
|
exit results unless results == 0
|
23
48
|
end
|
49
|
+
map 'o' => :open
|
24
50
|
|
25
|
-
desc '
|
26
|
-
' and open a
|
27
|
-
def
|
51
|
+
desc 'push_and_open (po)', 'push your code on github,'\
|
52
|
+
' and open a Pull Request on Github if none is openned'
|
53
|
+
def push_and_open
|
28
54
|
puts '##########################'.yellow
|
29
55
|
puts '## Pushing to Github... ##'.yellow
|
30
56
|
puts '##########################'.yellow
|
31
57
|
|
32
|
-
results = SafePusher::GithubRunner.new.
|
58
|
+
results = SafePusher::GithubRunner.new.push_and_open
|
33
59
|
|
34
60
|
exit results unless results == 0
|
35
61
|
end
|
62
|
+
map 'po' => :push_and_open
|
36
63
|
|
37
|
-
desc '
|
38
|
-
|
64
|
+
desc 'test_and_lint (tl)',
|
65
|
+
'launch the test suite, then the linters if it is successful'
|
66
|
+
def test_and_lint
|
39
67
|
invoke :test
|
40
|
-
invoke :
|
68
|
+
invoke :lint
|
41
69
|
end
|
70
|
+
map 'tl' => :test_and_lint
|
42
71
|
|
43
|
-
desc '
|
44
|
-
|
45
|
-
|
46
|
-
|
72
|
+
desc 'lint_push_and_open (lpo)',
|
73
|
+
'lanch the linters, then push on github and open a'\
|
74
|
+
' Pull Request on Github if none is openned'
|
75
|
+
def lint_push_and_open
|
76
|
+
invoke :lint
|
77
|
+
invoke :push_and_open
|
47
78
|
end
|
79
|
+
map 'lpo' => :lint_push_and_open
|
48
80
|
|
49
|
-
desc '
|
50
|
-
|
81
|
+
desc 'test_lint_push_and_open (tlpo)',
|
82
|
+
'lanch the linters, launch test suite, then push on github and open'\
|
83
|
+
'a Pull Request if none is openned'
|
84
|
+
def test_lint_push_and_open
|
51
85
|
invoke :test
|
52
|
-
invoke :
|
53
|
-
invoke :
|
86
|
+
invoke :lint
|
87
|
+
invoke :push_and_open
|
54
88
|
end
|
89
|
+
map 'tlpo' => :test_lint_push_and_open
|
55
90
|
end
|
56
91
|
end
|
@@ -3,8 +3,8 @@ require 'English'
|
|
3
3
|
|
4
4
|
module SafePusher
|
5
5
|
class GithubRunner
|
6
|
-
def
|
7
|
-
|
6
|
+
def push_and_open
|
7
|
+
push
|
8
8
|
|
9
9
|
exit_status = $CHILD_STATUS.exitstatus
|
10
10
|
|
@@ -15,28 +15,28 @@ module SafePusher
|
|
15
15
|
|
16
16
|
exit_status = $CHILD_STATUS.exitstatus
|
17
17
|
|
18
|
-
|
18
|
+
open if exit_status == 0
|
19
19
|
end
|
20
20
|
|
21
21
|
exit_status
|
22
22
|
end
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
def push_on_github
|
24
|
+
def push
|
27
25
|
system('git push origin')
|
28
26
|
end
|
29
27
|
|
30
|
-
def
|
31
|
-
system("git push --set-upstream origin #{branch}")
|
32
|
-
end
|
33
|
-
|
34
|
-
def open_pull_request_url
|
28
|
+
def open
|
35
29
|
system(
|
36
30
|
"open '#{SafePusher.configuration.repo_url}/pull/new/#{branch}'",
|
37
31
|
)
|
38
32
|
end
|
39
33
|
|
34
|
+
private
|
35
|
+
|
36
|
+
def push_and_set_upstream
|
37
|
+
system("git push --set-upstream origin #{branch}")
|
38
|
+
end
|
39
|
+
|
40
40
|
def branch
|
41
41
|
`git rev-parse --symbolic-full-name --abbrev-ref HEAD`.delete("\n")
|
42
42
|
end
|
data/lib/safe_pusher/version.rb
CHANGED
data/safe_pusher.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: safe_pusher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Pollet
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0.60'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: simplecov
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 0.16.1
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 0.16.1
|
125
139
|
description:
|
126
140
|
email:
|
127
141
|
- william.pollet@kisskissbankbank.com
|
@@ -131,6 +145,7 @@ extensions: []
|
|
131
145
|
extra_rdoc_files: []
|
132
146
|
files:
|
133
147
|
- ".gitignore"
|
148
|
+
- ".hound.yml"
|
134
149
|
- ".rspec"
|
135
150
|
- ".rubocop.yml"
|
136
151
|
- ".travis.yml"
|
@@ -172,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
187
|
version: '0'
|
173
188
|
requirements: []
|
174
189
|
rubyforge_project:
|
175
|
-
rubygems_version: 2.
|
190
|
+
rubygems_version: 2.6.11
|
176
191
|
signing_key:
|
177
192
|
specification_version: 4
|
178
193
|
summary: a small CLI that lints your code and run your tests before you push
|