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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aaccf2d4580afb11b6d7f7fa4cb9e8ab9f4ef7d9
4
- data.tar.gz: 11d63824b879d801afc5e93d5202890465fc56ce
3
+ metadata.gz: 6393bd85a974e1d867941ac975e031b5d0385fe5
4
+ data.tar.gz: 2e4c02a81577f79227015105d139f6063df8a61c
5
5
  SHA512:
6
- metadata.gz: f53e3e4d17458c4fbedb3baa9027c7be47837aa57f0b8f5fcb3a7bc7433f76d22abccb25cea9570caa4b4a442569bd624285cd3ac7b9ea1316459e8dc6be89bc
7
- data.tar.gz: 4daec10f29b4a88d9f85c84b5e4075c3f2eb4d10f7d535d7836640a30991169b379a3ecac7a358b996f7d178e52e20d2b5a1198968f74da21e340e3236e92ec0
6
+ metadata.gz: ed8d28521ddc648fb3fc160916c9fa2f271e26ffc446469991ac51cc4769b74b4bc709c917578c5b57b67bf9ac38fce0d5013f3f05b176c64a86ec9cf47f8085
7
+ data.tar.gz: 725bf26b3f3ed256d04cbe6424abcf651727ad2e55d65ddf4583512e71742bcad2ca9c62f64fcb2dd7920d12117f5f0ced052179776c0dc6c7116c662e1bfcb6
data/.hound.yml ADDED
@@ -0,0 +1,2 @@
1
+ rubocop:
2
+ config_file: .rubocop.yml
data/.rubocop.yml CHANGED
@@ -1,6 +1,141 @@
1
- inherit_gem:
2
- fashion_police:
3
- - .rubocop.yml
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
@@ -2,6 +2,10 @@
2
2
 
3
3
  This project adheres to [Semantic Versioning](http://semver.org)
4
4
 
5
+ ## [0.2.0] - 2018-12-31
6
+ Feature:
7
+ - Improve commands
8
+
5
9
  ## [0.1.3] - 2018-12-20
6
10
  Bugfix:
7
11
  - Do not take into account deleted files for rspec testing
data/lib/safe_pusher.rb CHANGED
@@ -13,7 +13,7 @@ module SafePusher
13
13
  attr_writer :configuration
14
14
 
15
15
  def configuration
16
- @configuration = Configuration.new
16
+ @configuration ||= Configuration.new
17
17
  end
18
18
 
19
19
  def configure
@@ -1,56 +1,91 @@
1
1
  module SafePusher
2
2
  class CLI < Thor
3
- desc 'prontorun', 'launch pronto with a return message'
4
- def prontorun
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 pronto... ##'.yellow
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 'test', 'launch the test suite with a return message'
15
- def test
27
+ desc 'push (p)', 'push your code on github'
28
+ def push
16
29
  puts '##########################'.yellow
17
- puts '## Testing new files... ##'.yellow
30
+ puts '## Pushing to Github... ##'.yellow
18
31
  puts '##########################'.yellow
19
32
 
20
- results = SafePusher::RspecRunner.new.call
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 'pushandpr', 'push your code on github,'\
26
- ' and open a PR if it is the first time'
27
- def pushandpr
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.call
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 'ptest', 'launch the test suite, then pronto if it is successful'
38
- def ptest
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 :prontorun
68
+ invoke :lint
41
69
  end
70
+ map 'tl' => :test_and_lint
42
71
 
43
- desc 'ppush', 'run your favorite linter, then push on github'
44
- def ppush
45
- invoke :prontorun
46
- invoke :pushandpr
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 'ppushtest', 'run your favorite linters and tests, then push on github'
50
- def ppushtest
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 :prontorun
53
- invoke :pushandpr
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 call
7
- push_on_github
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
- open_pull_request_url if exit_status == 0
18
+ open if exit_status == 0
19
19
  end
20
20
 
21
21
  exit_status
22
22
  end
23
23
 
24
- private
25
-
26
- def push_on_github
24
+ def push
27
25
  system('git push origin')
28
26
  end
29
27
 
30
- def push_and_set_upstream
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
@@ -99,7 +99,7 @@ module SafePusher
99
99
  return 0
100
100
  else
101
101
  File.open(spec_path, 'w') {}
102
- warn 'spec to write!'.red
102
+ warn 'A spec needs to be written!'.red
103
103
  return 1
104
104
  end
105
105
  end
@@ -1,3 +1,3 @@
1
1
  module SafePusher
2
- VERSION = '0.1.3'.freeze
2
+ VERSION = '0.2.0'.freeze
3
3
  end
data/safe_pusher.gemspec CHANGED
@@ -45,4 +45,5 @@ Gem::Specification.new do |spec|
45
45
  spec.add_development_dependency 'rake', '~> 10.0'
46
46
  spec.add_development_dependency 'rspec', '~> 3.0'
47
47
  spec.add_development_dependency 'rubocop', '~> 0.60'
48
+ spec.add_development_dependency 'simplecov', '~> 0.16.1'
48
49
  end
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.1.3
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-21 00:00:00.000000000 Z
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.5.2.3
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