safe_pusher 0.2.1 → 0.2.2

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: 8dd851e29beb0acaa544597d36c9ba03c6ef4620
4
- data.tar.gz: b87276b61f21dfe2ec419ac90f7eaff97e7eb89d
3
+ metadata.gz: 6f14a1f7069630411c76a8ec0c1a33f75f3b0d95
4
+ data.tar.gz: c5b212741108b33951374c339fa888aa1215c94f
5
5
  SHA512:
6
- metadata.gz: ce3fff993eaffda06bcc60c6a3a71f4ff798496157b9b350201af19a9fea34296fa419f6b257c1313709cd831885b1993c34b073be00a093174fb0859b20b326
7
- data.tar.gz: 2c8c6c017755eebe779459c981eceddaed229ea7c3338f03a91d79684b138e20d85942e05a35066e193f1d9ccebb895c854c50b44d81a1bcf0b84c435572d227
6
+ metadata.gz: dc2fa8785c5401f0b47db636e874a4cc9a3b0ed3355633ab3c7aa89df5ddd2228e7bd76177bf85a0fdcab5a79003c956ac3099d4b255bdcd0eafde3284e6ea83
7
+ data.tar.gz: '02567809eba97e24af3b0ee8fac29bc9b407696ac07896cf763d3527582e191629d1a0580e0371377166bf7bda0502d9fb9c6f3f57463bf65faf0c832db06226'
data/.travis.yml CHANGED
@@ -1,8 +1,18 @@
1
1
  ---
2
+ env:
3
+ global:
4
+ - CC_TEST_REPORTER_ID=5e03a69363f26aba0c9c779a841db044295bf61762f9b7d719e2c064497f24e0
2
5
  sudo: false
3
6
  language: ruby
4
7
  cache: bundler
5
8
  rvm:
6
9
  - 2.3.7
7
10
  before_install: gem install bundler -v 1.16.3
11
+
12
+ before_script:
13
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
14
+ - chmod +x ./cc-test-reporter
15
+ - ./cc-test-reporter before-build
8
16
  script: bundle exec rspec spec
17
+ after_script:
18
+ - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  This project adheres to [Semantic Versioning](http://semver.org)
4
4
 
5
+ ## [0.2.2] - 2019-01-05
6
+ Improvements:
7
+ - Removing thor
8
+ - Using custom CLI to handle multiple commands
9
+
5
10
  ## [0.2.1] - 2018-12-31
6
11
  Improvement:
7
12
  - Deprecating rainbow to install pronto and pronto Rubocop
data/README.md CHANGED
@@ -1,15 +1,18 @@
1
- # SafePusher
2
-
3
1
  [![Build Status](https://travis-ci.com/williampollet/safe_pusher.svg?branch=master)](https://travis-ci.com/williampollet/safe_pusher)
2
+ [![Maintainability](https://api.codeclimate.com/v1/badges/1aa6c275f9ce4d4c6ec3/maintainability)](https://codeclimate.com/github/williampollet/safe_pusher/maintainability)
3
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/1aa6c275f9ce4d4c6ec3/test_coverage)](https://codeclimate.com/github/williampollet/safe_pusher/test_coverage)
4
4
 
5
- Run your favorite linters and specs on the files you touched, before pushing your branch
5
+ # SafePusher
6
+
7
+ Run your favorite linters and specs on the files you touched, before pushing your branch.
6
8
 
7
9
  ## Installation
8
10
 
9
- Add this line to your application's Gemfile:
11
+ Add these lines to your application's Gemfile:
10
12
 
11
13
  ```ruby
12
- gem 'safe_pusher'
14
+ # Lint and launch specs before pushing.
15
+ gem 'safe_pusher', require: false
13
16
  ```
14
17
 
15
18
  And then execute:
@@ -20,17 +23,15 @@ Or install it yourself as:
20
23
 
21
24
  $ gem install safe_pusher
22
25
 
23
-
24
26
  To use the gem fully, you should install [pronto](https://github.com/prontolabs/pronto) and [rspec](https://github.com/rspec/rspec) first.
25
27
 
26
28
  ## Configuration
27
29
 
28
- Generate the `binstubs` for `pronto` and `rspec`:
30
+ Generate the `binstubs` for `pronto`, `rspec` and `safepush`:
29
31
 
30
- $ bundler binstubs pronto
31
- $ bundler binstubs rspec-core
32
+ $ bundler binstubs pronto rspec-core safe_pusher
32
33
 
33
- create the `safe_pusher.yml` file at the root of your application
34
+ Create the `safe_pusher.yml` file at the root of your application:
34
35
 
35
36
  ```yaml
36
37
  files_to_skip:
@@ -46,13 +47,21 @@ To see the commands available, type:
46
47
 
47
48
  $ safepush
48
49
 
49
- To run pronto checks before to push on github run:
50
+ To run pronto checks before you push to GitHub run:
51
+
52
+ $ safepush lint_push_and_open
53
+
54
+ or
55
+
56
+ $ safepush lpo
57
+
58
+ To run specs and pronto before you push to GitHub run:
50
59
 
51
- $ safepush ppush
60
+ $ safepush test_lint_push_and_open
52
61
 
53
- To run specs and pronto before to push on github run:
62
+ or
54
63
 
55
- $ safepush ppushtest
64
+ $ safepush tlpo
56
65
 
57
66
  ## Contributing
58
67
 
data/exe/safepush CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'safe_pusher'
3
3
 
4
- SafePusher::CLI.start
4
+ SafePusher::CLI.new(arguments: ARGV).start
@@ -1,18 +1,47 @@
1
1
  module SafePusher
2
- class CLI < Thor
3
- desc 'test (t)', 'launch the test suite'
2
+ class CLI
3
+ attr_reader :arguments
4
+
5
+ def initialize(arguments:)
6
+ @arguments = arguments
7
+ end
8
+
9
+ def start
10
+ unless arguments_valid?
11
+ help
12
+
13
+ return
14
+ end
15
+
16
+ arguments.each do |command|
17
+ execute_command(command)
18
+ end
19
+ end
20
+
21
+ private
22
+
23
+ def execute_command(command)
24
+ case command
25
+ when 'test', 't'
26
+ test
27
+ when 'lint', 'l'
28
+ lint
29
+ when 'open', 'o'
30
+ open
31
+ when 'push', 'p'
32
+ push
33
+ end
34
+ end
35
+
4
36
  def test
5
37
  puts '##########################'.yellow
6
38
  puts '## Testing new files... ##'.yellow
7
39
  puts '##########################'.yellow
8
-
9
40
  results = SafePusher::RspecRunner.new.call
10
41
 
11
42
  exit results unless results == 0
12
43
  end
13
- map 't' => :test
14
44
 
15
- desc 'lint (l)', 'launch the linters'
16
45
  def lint
17
46
  puts '#######################'.yellow
18
47
  puts '## Running linter... ##'.yellow
@@ -22,9 +51,7 @@ module SafePusher
22
51
 
23
52
  exit results unless results == 0
24
53
  end
25
- map 'l' => :lint
26
54
 
27
- desc 'push (p)', 'push your code on github'
28
55
  def push
29
56
  puts '##########################'.yellow
30
57
  puts '## Pushing to Github... ##'.yellow
@@ -34,9 +61,7 @@ module SafePusher
34
61
 
35
62
  exit results unless results == 0
36
63
  end
37
- map 'p' => :push
38
64
 
39
- desc 'open (o)', 'open a pull request on github'
40
65
  def open
41
66
  puts '#########################################'.yellow
42
67
  puts '## Opening a pull request on Github... ##'.yellow
@@ -46,46 +71,21 @@ module SafePusher
46
71
 
47
72
  exit results unless results == 0
48
73
  end
49
- map 'o' => :open
50
-
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
54
- puts '##########################'.yellow
55
- puts '## Pushing to Github... ##'.yellow
56
- puts '##########################'.yellow
57
74
 
58
- results = SafePusher::GithubRunner.new.push_and_open
59
-
60
- exit results unless results == 0
75
+ def arguments_valid?
76
+ arguments.join(' ') =~ /^(?!\s*$)(?:test|lint|push|open|t|l|p|o| )+$/
61
77
  end
62
- map 'po' => :push_and_open
63
78
 
64
- desc 'test_and_lint (tl)',
65
- 'launch the test suite, then the linters if it is successful'
66
- def test_and_lint
67
- invoke :test
68
- invoke :lint
69
- end
70
- map 'tl' => :test_and_lint
71
-
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
78
- end
79
- map 'lpo' => :lint_push_and_open
80
-
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
85
- invoke :test
86
- invoke :lint
87
- invoke :push_and_open
79
+ def help
80
+ puts "Usage:\n"\
81
+ " help (h) # show this usage message\n"\
82
+ " ##########################################################\n"\
83
+ " # you can use any combination of theese commands \n"\
84
+ " ##########################################################\n"\
85
+ " test (t) # run the test suite\n"\
86
+ " lint (l) # run the linters\n"\
87
+ " push (p) # push on distant repository\n"\
88
+ ' open (o) # open a pull request on the distant repository'
88
89
  end
89
- map 'tlpo' => :test_lint_push_and_open
90
90
  end
91
91
  end
@@ -3,8 +3,8 @@ require 'English'
3
3
 
4
4
  module SafePusher
5
5
  class GithubRunner
6
- def push_and_open
7
- push
6
+ def push
7
+ system('git push origin')
8
8
 
9
9
  exit_status = $CHILD_STATUS.exitstatus
10
10
 
@@ -14,17 +14,11 @@ module SafePusher
14
14
  push_and_set_upstream
15
15
 
16
16
  exit_status = $CHILD_STATUS.exitstatus
17
-
18
- open if exit_status == 0
19
17
  end
20
18
 
21
19
  exit_status
22
20
  end
23
21
 
24
- def push
25
- system('git push origin')
26
- end
27
-
28
22
  def open
29
23
  system(
30
24
  "open '#{SafePusher.configuration.repo_url}/pull/new/#{branch}'",
@@ -1,3 +1,3 @@
1
1
  module SafePusher
2
- VERSION = '0.2.1'.freeze
2
+ VERSION = '0.2.2'.freeze
3
3
  end
data/safe_pusher.gemspec CHANGED
@@ -37,9 +37,8 @@ Gem::Specification.new do |spec|
37
37
  spec.require_paths = ['lib']
38
38
 
39
39
  spec.add_dependency 'colorize', '~> 0.8.1'
40
- spec.add_dependency 'thor', '~> 0.19.4'
41
40
 
42
- spec.add_development_dependency 'bundler', '~> 1.16'
41
+ spec.add_development_dependency 'bundler', '>= 1.16'
43
42
  spec.add_development_dependency 'fashion_police', '~> 1.2'
44
43
  spec.add_development_dependency 'pronto', '~> 0.9.5'
45
44
  spec.add_development_dependency 'pronto-rubocop', '~> 0.9.1'
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.2.1
4
+ version: 0.2.2
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-31 00:00:00.000000000 Z
11
+ date: 2019-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -24,32 +24,18 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.8.1
27
- - !ruby/object:Gem::Dependency
28
- name: thor
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: 0.19.4
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: 0.19.4
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: bundler
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
- - - "~>"
31
+ - - ">="
46
32
  - !ruby/object:Gem::Version
47
33
  version: '1.16'
48
34
  type: :development
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
- - - "~>"
38
+ - - ">="
53
39
  - !ruby/object:Gem::Version
54
40
  version: '1.16'
55
41
  - !ruby/object:Gem::Dependency