safe_pusher 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6f14a1f7069630411c76a8ec0c1a33f75f3b0d95
4
- data.tar.gz: c5b212741108b33951374c339fa888aa1215c94f
2
+ SHA256:
3
+ metadata.gz: a876c76ac889ebc32081c281e6031204b65692de1bf0efda932028d14aff0afd
4
+ data.tar.gz: 694782b608d3fd8595f0d6c2da75ef83c3afc6cce5257a7c0491fed149b9980a
5
5
  SHA512:
6
- metadata.gz: dc2fa8785c5401f0b47db636e874a4cc9a3b0ed3355633ab3c7aa89df5ddd2228e7bd76177bf85a0fdcab5a79003c956ac3099d4b255bdcd0eafde3284e6ea83
7
- data.tar.gz: '02567809eba97e24af3b0ee8fac29bc9b407696ac07896cf763d3527582e191629d1a0580e0371377166bf7bda0502d9fb9c6f3f57463bf65faf0c832db06226'
6
+ metadata.gz: bd8ef453a0adf63245ca38e5ae6cb71511adea87aa8bbc6f97dbb8da690dbe416b236683cd4cb59a7cf4b290c274d388e64edbc3f868d150fb6032cb32cd4585
7
+ data.tar.gz: 1354cbb01df47f12cbfad8b08fa841377902ce3620641a6dd7071598b068ac4b447a04ab29f88eacc43986687944f3072b63968213fff4cf28e574225ee4d3f3
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+ A clear and concise description of what the bug is.
12
+
13
+ **To Reproduce**
14
+ Steps to reproduce the behavior:
15
+ 1. Go to '...'
16
+ 2. Click on '....'
17
+ 3. Scroll down to '....'
18
+ 4. See error
19
+
20
+ **Expected behavior**
21
+ A clear and concise description of what you expected to happen.
22
+
23
+ **Screenshots**
24
+ If applicable, add screenshots to help explain your problem.
25
+
26
+ **Desktop (please complete the following information):**
27
+ - OS: [e.g. iOS]
28
+ - Browser [e.g. chrome, safari]
29
+ - Version [e.g. 22]
30
+
31
+ **Smartphone (please complete the following information):**
32
+ - Device: [e.g. iPhone6]
33
+ - OS: [e.g. iOS8.1]
34
+ - Browser [e.g. stock browser, safari]
35
+ - Version [e.g. 22]
36
+
37
+ **Additional context**
38
+ Add any other context about the problem here.
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Additional context**
20
+ Add any other context or screenshots about the feature request here.
data/.rubocop.yml CHANGED
@@ -63,10 +63,11 @@ Documentation:
63
63
  # Do not verify the length of the blocks in DSLs.
64
64
  Metrics/BlockLength:
65
65
  Exclude:
66
- - "**/*/spec/**/*"
66
+ - spec/**/*
67
67
  - lib/tasks/**/*
68
68
  - app/admin/**/*
69
69
  - config/routes.rb
70
+ - safe_pusher.gemspec
70
71
  ExcludedMethods:
71
72
  - included
72
73
 
@@ -136,27 +137,3 @@ Style/FormatStringToken:
136
137
  # Prefer `->` to `lambda`.
137
138
  Style/Lambda:
138
139
  EnforcedStyle: literal
139
-
140
- # Deactivate rule that makes `lambda` mandatory in defavor of `->`
141
- # when having blocks.
142
- Style/Lambda:
143
- Enabled: false
144
-
145
- # Do not verify empty lines around blocks in specs
146
- Layout/EmptyLinesAroundBlockBody:
147
- Exclude:
148
- - spec/**/*
149
-
150
- # Allow using normal test doubles, since they are useful for mocking.
151
- # See https://github.com/KissKissBankBank/fashion_police/pull/34
152
- RSpec/VerifiedDoubles:
153
- Enabled: false
154
-
155
- # Enable long blocs for Gemspec files
156
- Metrics/BlockLength:
157
- Exclude:
158
- - safe_pusher.gemspec
159
-
160
- Metrics/BlockLength:
161
- Exclude:
162
- - spec/**/*
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  This project adheres to [Semantic Versioning](http://semver.org)
4
4
 
5
+ ## [0.3.0] - 2019-09-30
6
+ Improvement:
7
+ - Reduce RSpec runner verbosity
8
+ - Allow configuring the base branch
9
+
10
+ Fix:
11
+ - Add `--version` to the CLI
12
+
5
13
  ## [0.2.2] - 2019-01-05
6
14
  Improvements:
7
15
  - Removing thor
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
3
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in safe_pusher.gemspec
6
6
  gemspec
data/README.md CHANGED
@@ -37,6 +37,7 @@ Create the `safe_pusher.yml` file at the root of your application:
37
37
  files_to_skip:
38
38
  - file/to/skip_1
39
39
  - file/to/skip/2
40
+ base_branch: developement
40
41
  app_base_directory: app
41
42
  repo_url: https://github.com/williampollet/safe_pusher
42
43
  ```
@@ -49,24 +50,50 @@ To see the commands available, type:
49
50
 
50
51
  To run pronto checks before you push to GitHub run:
51
52
 
52
- $ safepush lint_push_and_open
53
+ $ safepush lint push open
53
54
 
54
55
  or
55
56
 
56
- $ safepush lpo
57
+ $ safepush l p o
57
58
 
58
59
  To run specs and pronto before you push to GitHub run:
59
60
 
60
- $ safepush test_lint_push_and_open
61
+ $ safepush test lint push open
61
62
 
62
63
  or
63
64
 
64
- $ safepush tlpo
65
+ $ safepush t l p o
65
66
 
66
67
  ## Contributing
67
68
 
68
69
  Bug reports and pull requests are welcome on GitHub at https://github.com/williampollet/safe_pusher. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
69
70
 
71
+ ## Development
72
+
73
+ Setup development:
74
+
75
+ ```sh
76
+ $ bin/setup
77
+ ```
78
+
79
+ Open a console:
80
+
81
+ ```sh
82
+ $ bin/console
83
+ ```
84
+
85
+ Test the CLI:
86
+
87
+ ```sh
88
+ $ ruby -Ilib exe/safepush
89
+ ```
90
+
91
+ Launch specs and lint:
92
+
93
+ ```sh
94
+ $ rake
95
+ ```
96
+
70
97
  ## License
71
98
 
72
99
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
3
 
4
4
  # Rspec
5
5
  RSpec::Core::RakeTask.new(:spec)
@@ -8,4 +8,4 @@ RSpec::Core::RakeTask.new(:spec)
8
8
  require 'rubocop/rake_task'
9
9
  RuboCop::RakeTask.new
10
10
 
11
- task :default => %i[spec, rubocop]
11
+ task default: %i[spec rubocop]
data/bin/console CHANGED
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "safe_pusher"
3
+ require 'bundler/setup'
4
+ require 'safe_pusher'
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
8
8
 
9
9
  # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
10
+ # require 'pry'
11
11
  # Pry.start
12
12
 
13
- require "irb"
13
+ require 'irb'
14
14
  IRB.start(__FILE__)
@@ -7,6 +7,8 @@ module SafePusher
7
7
  end
8
8
 
9
9
  def start
10
+ return version if arguments.first == '--version'
11
+
10
12
  unless arguments_valid?
11
13
  help
12
14
 
@@ -79,6 +81,7 @@ module SafePusher
79
81
  def help
80
82
  puts "Usage:\n"\
81
83
  " help (h) # show this usage message\n"\
84
+ " --version # print SafePusher version\n"\
82
85
  " ##########################################################\n"\
83
86
  " # you can use any combination of theese commands \n"\
84
87
  " ##########################################################\n"\
@@ -87,5 +90,9 @@ module SafePusher
87
90
  " push (p) # push on distant repository\n"\
88
91
  ' open (o) # open a pull request on the distant repository'
89
92
  end
93
+
94
+ def version
95
+ puts SafePusher::VERSION
96
+ end
90
97
  end
91
98
  end
@@ -5,7 +5,8 @@ module SafePusher
5
5
  # The configuration singleton
6
6
  attr_accessor :files_to_skip,
7
7
  :app_base_directory,
8
- :repo_url
8
+ :repo_url,
9
+ :base_branch
9
10
 
10
11
  def initialize
11
12
  application_config =
@@ -15,6 +16,7 @@ module SafePusher
15
16
  {}
16
17
  end
17
18
 
19
+ @base_branch = application_config['base_branch'] || 'master'
18
20
  @files_to_skip = application_config['files_to_skip'] || []
19
21
  @app_base_directory = application_config['app_base_directory']
20
22
  @repo_url = application_config['repo_url']
@@ -8,8 +8,8 @@ module SafePusher
8
8
  exit_status = $CHILD_STATUS.exitstatus
9
9
 
10
10
  if exit_status != 0
11
- warn 'Pronto found somme errors... '\
12
- 'Fix them before pushing to master!'.red
11
+ warn 'Pronto found somme errors ' \
12
+ 'Fix them before pushing to GitHub!'.red
13
13
  else
14
14
  puts 'No errors found by pronto, go for next step!'.green
15
15
  end
@@ -20,7 +20,11 @@ module SafePusher
20
20
  private
21
21
 
22
22
  def run_pronto
23
- system('bin/pronto run --exit-code')
23
+ system("bin/pronto run --exit-code -c #{base_branch}")
24
+ end
25
+
26
+ def base_branch
27
+ SafePusher.configuration.base_branch
24
28
  end
25
29
  end
26
30
  end
@@ -26,7 +26,7 @@ module SafePusher
26
26
  def modified_files
27
27
  diff = 'git diff --diff-filter=A --diff-filter=M --name-only'
28
28
 
29
- `#{diff} $(git merge-base #{branch} master) #{branch}`
29
+ `#{diff} $(git merge-base #{branch} #{base_branch}) #{branch}`
30
30
  .split("\n")
31
31
  .uniq
32
32
  end
@@ -43,8 +43,6 @@ module SafePusher
43
43
  end
44
44
 
45
45
  def search_or_create_spec(file)
46
- puts "#{file} has been modified, searching for specs..."
47
-
48
46
  spec_path = file.gsub(
49
47
  "#{SafePusher.configuration.app_base_directory}/",
50
48
  'spec/',
@@ -52,8 +50,8 @@ module SafePusher
52
50
 
53
51
  return create_new_spec(spec_path, file) unless File.exist?(spec_path)
54
52
 
55
- puts "Spec found for #{file}, putting #{spec_path}"\
56
- ' in the list of specs to run'
53
+ puts spec_path
54
+
57
55
  specs_to_execute << spec_path
58
56
  end
59
57
 
@@ -111,5 +109,9 @@ module SafePusher
111
109
  def app_base_directory
112
110
  %r{#{SafePusher.configuration.app_base_directory}\/.*\.rb$}
113
111
  end
112
+
113
+ def base_branch
114
+ SafePusher.configuration.base_branch
115
+ end
114
116
  end
115
117
  end
@@ -1,3 +1,3 @@
1
1
  module SafePusher
2
- VERSION = '0.2.2'.freeze
2
+ VERSION = '0.3.0'.freeze
3
3
  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.2.2
4
+ version: 0.3.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: 2019-01-05 00:00:00.000000000 Z
11
+ date: 2019-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -172,6 +172,8 @@ executables:
172
172
  extensions: []
173
173
  extra_rdoc_files: []
174
174
  files:
175
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
176
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
175
177
  - ".gitignore"
176
178
  - ".hound.yml"
177
179
  - ".rspec"
@@ -214,8 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
216
  - !ruby/object:Gem::Version
215
217
  version: '0'
216
218
  requirements: []
217
- rubyforge_project:
218
- rubygems_version: 2.6.11
219
+ rubygems_version: 3.0.4
219
220
  signing_key:
220
221
  specification_version: 4
221
222
  summary: a small CLI that lints your code and run your tests before you push