autowow 0.4.1 → 0.5.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
2
  SHA1:
3
- metadata.gz: 2c4b769e2313541711b90200df6e69a0a4a168db
4
- data.tar.gz: ed347c23e07874f847081e950e9ae321415b103d
3
+ metadata.gz: ae93b0384ebbb7f11bf21a37f2c1dfa135db2739
4
+ data.tar.gz: c69d91c112e80830b4d9b89eefe09c8550c52335
5
5
  SHA512:
6
- metadata.gz: 8f2a421efd1cabb89553394b6f81c6fdf244fa861854a3c14ef08b542bbb77423f82f659987635528bfac2fd65cddedac414c63832c9937cb5a73f5c42dfdbc5
7
- data.tar.gz: c14bf2b603be841dc3786cfdded78481414c37e0b7f87748e2c6ba4e33f2a833f8627ecfb0be8a28fdd4ada595c7cc66a72c8119f6e6e30f18c50ee77495e9a6
6
+ metadata.gz: 318c5a58a1732310ad4231db39f4d36cb862f74117f682ff406d3695b2070b53973b8eaba91739dac3f66a29d761892acc8aaadbbfb54ea3d46ce786e1751112
7
+ data.tar.gz: e141c4aabf826c4c734670c717ba2023e6c167d505add6679d7d307de5ef4629305c3610a1d12ae5134c8b0158abde33436824fe04f046cbba371b80491fd3fe
@@ -0,0 +1,117 @@
1
+ AllCops:
2
+ DisabledByDefault: true
3
+ DisplayCopNames: true
4
+ Exclude:
5
+ - doc/**/*
6
+ - vendor/**/*
7
+ - spec/fixtures/**/*
8
+ TargetRubyVersion: 2.3
9
+ Layout/CaseIndentation:
10
+ Enabled: true
11
+ IndentOneStep: false
12
+ Layout/EmptyLineBetweenDefs:
13
+ Enabled: true
14
+ AllowAdjacentOneLineDefs: true
15
+ Layout/EmptyLines:
16
+ Enabled: true
17
+ Layout/EmptyLinesAroundBeginBody:
18
+ Enabled: true
19
+ Layout/EmptyLinesAroundBlockBody:
20
+ Enabled: true
21
+ EnforcedStyle: no_empty_lines
22
+ Layout/EmptyLinesAroundClassBody:
23
+ Enabled: true
24
+ Layout/EmptyLinesAroundMethodBody:
25
+ Enabled: true
26
+ Layout/EmptyLinesAroundModuleBody:
27
+ Enabled: true
28
+ Layout/ExtraSpacing:
29
+ Exclude:
30
+ - Gemfile
31
+ Layout/FirstParameterIndentation:
32
+ Enabled: true
33
+ Layout/IndentationConsistency:
34
+ Enabled: true
35
+ Layout/IndentationWidth:
36
+ Enabled: true
37
+ Exclude:
38
+ - spec/**/*
39
+ Layout/MultilineMethodCallIndentation:
40
+ EnforcedStyle: indented_relative_to_receiver
41
+ IndentationWidth: 2
42
+ Layout/MultilineOperationIndentation:
43
+ EnforcedStyle: indented
44
+ Layout/SpaceAfterColon:
45
+ Enabled: true
46
+ Layout/SpaceAfterComma:
47
+ Enabled: true
48
+ Layout/SpaceAroundEqualsInParameterDefault:
49
+ Enabled: true
50
+ Layout/SpaceAroundKeyword:
51
+ Enabled: true
52
+ Layout/SpaceAroundOperators:
53
+ Enabled: true
54
+ Layout/SpaceBeforeBlockBraces:
55
+ Enabled: true
56
+ Layout/SpaceBeforeFirstArg:
57
+ Enabled: true
58
+ Layout/SpaceInsideBlockBraces:
59
+ Enabled: true
60
+ Layout/SpaceInsideHashLiteralBraces:
61
+ Enabled: true
62
+ Layout/SpaceInsideParens:
63
+ Enabled: true
64
+ Layout/Tab:
65
+ Enabled: true
66
+ Layout/TrailingBlankLines:
67
+ Enabled: true
68
+ Layout/TrailingWhitespace:
69
+ Enabled: true
70
+ Lint/EndAlignment:
71
+ Enabled: true
72
+ EnforcedStyleAlignWith: variable
73
+ Lint/RequireParentheses:
74
+ Enabled: true
75
+ Metrics/AbcSize:
76
+ Max: 62
77
+ Metrics/ClassLength:
78
+ CountComments: false
79
+ Max: 1000
80
+ Metrics/LineLength:
81
+ Exclude:
82
+ - spec/**/*
83
+ Max: 318
84
+ Metrics/MethodLength:
85
+ Max: 70
86
+ Metrics/ModuleLength:
87
+ CountComments: false
88
+ Max: 1000
89
+ Rails:
90
+ Enabled: true
91
+ Style/AndOr:
92
+ EnforcedStyle: conditionals
93
+ Style/BlockDelimiters:
94
+ EnforcedStyle: braces_for_chaining
95
+ Style/BracesAroundHashParameters:
96
+ Enabled: true
97
+ EnforcedStyle: context_dependent
98
+ Style/ConditionalAssignment:
99
+ EnforcedStyle: assign_to_condition
100
+ Style/HashSyntax:
101
+ Enabled: true
102
+ Style/MethodDefParentheses:
103
+ Enabled: true
104
+ Style/RedundantReturn:
105
+ AllowMultipleReturnValues: true
106
+ Enabled: true
107
+ Style/RegexpLiteral:
108
+ EnforcedStyle: percent_r
109
+ Style/Semicolon:
110
+ AllowAsExpressionSeparator: true
111
+ Enabled: true
112
+ Style/StringLiterals:
113
+ Enabled: true
114
+ EnforcedStyle: single_quotes
115
+ Style/TrivialAccessors:
116
+ Enabled: true
117
+ ExactNameMatch: true
data/README.md CHANGED
@@ -27,6 +27,7 @@ Commands in general
27
27
  * store and restore uncommitted changes
28
28
  * output executed commands that cause any change
29
29
  * execute in current directory
30
+ * retain original output color
30
31
 
31
32
  ### VCS
32
33
 
@@ -93,6 +94,11 @@ Prerequisites: on master
93
94
 
94
95
  * Removes unused gems
95
96
 
97
+ #### Rubocop parallel autocorrect
98
+
99
+ * Runs `rubocop` in parallel mode, autocorrects offenses on single thread
100
+ * *Experimental feature, in practice it is not faster than running `rubocop -a`!*
101
+
96
102
  ### Ruby
97
103
 
98
104
  #### Ruby versions
@@ -100,6 +106,12 @@ Prerequisites: on master
100
106
  * Shows Ruby versions in use
101
107
  * Searches for repositories on paths: `.`, `./*/`
102
108
 
109
+ ### Misc
110
+
111
+ #### Execute
112
+
113
+ * Executes given command
114
+
103
115
  ## Feedback
104
116
 
105
117
  Any feedback is much appreciated.
@@ -26,8 +26,10 @@ Gem::Specification.new do |spec|
26
26
  spec.add_dependency "colorize" # Colorize output made by own logger
27
27
  spec.add_dependency "time_difference", "= 0.5.0" # Calculate project age. Fixed version because we refine it :(
28
28
  spec.add_dependency "launchy" # Open project in browser
29
- spec.add_dependency "tty-command" # Execute system commands nicely
29
+ spec.add_dependency "tty-command", ">= 0.7.0" # Execute system commands nicely
30
30
  spec.add_dependency "reflection_utils", ">= 0.3.0" # Invoke module methods without including the module
31
+ spec.add_dependency "rubocop" # Style check
32
+ spec.add_dependency "rubocop-rspec" # Style check
31
33
 
32
34
  spec.add_development_dependency "bundler", "~> 1.15"
33
35
  spec.add_development_dependency "rake", "~> 10.0"
@@ -13,6 +13,7 @@ require_relative 'commands/gem'
13
13
 
14
14
  module Autowow
15
15
  class CLI < Thor
16
+ include EasyLogging
16
17
 
17
18
  map %w[bm] => :branch_merged
18
19
  map %w[grls] => :gem_release
@@ -22,6 +23,7 @@ module Autowow
22
23
  map %w[gc] => :gem_clean
23
24
  map %w[rv] => :ruby_versions
24
25
  map %w[gr] => :greet
26
+ map %w[rpa] => :rubocop_parallel_autocorrect
25
27
 
26
28
  desc "branch_merged", "clean working branch and return to master"
27
29
  def branch_merged
@@ -77,5 +79,16 @@ module Autowow
77
79
  def greet
78
80
  Autowow::Features::Vcs.greet
79
81
  end
82
+
83
+ desc "rubocop_parallel_autocorrect", "runs rubocop in parallel mode, autocorrects offenses on single thread"
84
+ def rubocop_parallel_autocorrect
85
+ logger.warn('Experimental feature, in practice it is not faster than running `rubocop -a`!')
86
+ Autowow::Features::Gem.rubocop_parallel_autocorrect
87
+ end
88
+
89
+ desc "exec", "runs command"
90
+ def exec(*cmd)
91
+ Autowow::Executor.pretty_with_output.run(cmd)
92
+ end
80
93
  end
81
94
  end
@@ -9,6 +9,18 @@ module Autowow
9
9
  ['gem', 'clean']
10
10
  end
11
11
 
12
+ def rubocop_parallel
13
+ ['rubocop', '--parallel']
14
+ end
15
+
16
+ def rubocop_autocorrect(files)
17
+ if files.kind_of?(Array)
18
+ ['rubocop', '--auto-correct'] + files
19
+ else
20
+ ['rubocop', '--auto-correct'] + files.split(' ')
21
+ end
22
+ end
23
+
12
24
  include ReflectionUtils::CreateModuleFunctions
13
25
  end
14
26
  end
@@ -1,78 +1,84 @@
1
1
  module Autowow
2
2
  module Commands
3
3
  module Vcs
4
+ def cmd
5
+ ['git']
6
+ end
7
+
8
+ def default_options
9
+ ['--no-pager']
10
+ end
11
+
4
12
  def changes_not_on_remote(branch)
5
- ['git', 'log', branch, '--not', '--remotes']
13
+ cmd + default_options + ['log', branch, '--not', '--remotes']
6
14
  end
7
15
 
8
16
  def branch_list
9
- ["git for-each-ref --format='%(refname)' refs/heads/"]
10
- # TODO: report error with following command
11
- # ['git', 'for-each-ref', "--format='%(refname)'", 'refs/heads/']
17
+ cmd + default_options + ['for-each-ref', "--format=%(refname)", 'refs/heads/']
12
18
  end
13
19
 
14
20
  def push(branch = nil, remote = nil)
15
- ['git', 'push'] + [branch, remote].compact
21
+ cmd + default_options + ['push'] + [branch, remote].compact
16
22
  end
17
23
 
18
24
  def rebase(branch)
19
- ['git', 'rebase', branch]
25
+ cmd + default_options + ['rebase', branch]
20
26
  end
21
27
 
22
28
  def git_status
23
- ['git', 'status']
29
+ cmd + default_options + ['status']
24
30
  end
25
31
 
26
32
  def stash
27
- ['git', 'stash']
33
+ cmd + default_options + ['stash']
28
34
  end
29
35
 
30
36
  def stash_pop
31
- ['git', 'stash', 'pop']
37
+ cmd + default_options + ['stash', 'pop']
32
38
  end
33
39
 
34
40
  def current_branch
35
- ['git', 'symbolic-ref', '--short', 'HEAD']
41
+ cmd + default_options + ['symbolic-ref', '--short', 'HEAD']
36
42
  end
37
43
 
38
44
  def checkout(existing_branch)
39
- ['git', 'checkout', existing_branch]
45
+ cmd + default_options + ['checkout', existing_branch]
40
46
  end
41
47
 
42
48
  def pull
43
- ['git', 'pull']
49
+ cmd + default_options + ['pull']
44
50
  end
45
51
 
46
52
  def branch_force_delete(branch)
47
- ['git', 'branch', '-D', branch]
53
+ cmd + default_options + ['branch', '-D', branch]
48
54
  end
49
55
 
50
56
  def create(branch)
51
- ['git', 'checkout', '-b', branch]
57
+ cmd + default_options + ['checkout', '-b', branch]
52
58
  end
53
59
 
54
60
  def set_upstream(remote, branch)
55
- ['git', 'push', '--set-upstream', remote, branch]
61
+ cmd + default_options + ['push', '--set-upstream', remote, branch]
56
62
  end
57
63
 
58
64
  def remotes
59
- ['git', 'remote', '-v']
65
+ cmd + default_options + ['remote', '-v']
60
66
  end
61
67
 
62
68
  def fetch(remote)
63
- ['git', 'fetch', remote]
69
+ cmd + default_options + ['fetch', remote]
64
70
  end
65
71
 
66
72
  def merge(compare)
67
- ['git', 'merge', compare]
73
+ cmd + default_options + ['merge', compare]
68
74
  end
69
75
 
70
76
  def branch
71
- ['git', 'branch']
77
+ cmd + default_options + ['branch']
72
78
  end
73
79
 
74
80
  def add_remote(name, url)
75
- ['git', 'remote', 'add', name, url]
81
+ cmd + default_options + ['remote', 'add', name, url]
76
82
  end
77
83
 
78
84
  include ReflectionUtils::CreateModuleFunctions
@@ -33,17 +33,17 @@ module Autowow
33
33
  end
34
34
 
35
35
  def pretty
36
- @pretty ||= RunWrapper.new(TTY::Command.new(printer: Pretty))
36
+ @pretty ||= RunWrapper.new(TTY::Command.new(pty: true, printer: Pretty))
37
37
  end
38
38
 
39
39
  def pretty_with_output
40
- @pretty_with_output ||= RunWrapper.new(TTY::Command.new(printer: PrettyWithOutput))
40
+ @pretty_with_output ||= RunWrapper.new(TTY::Command.new(pty: true, printer: PrettyWithOutput))
41
41
  end
42
42
 
43
43
  def quiet
44
- @quiet ||= RunWrapper.new(TTY::Command.new(printer: :null))
44
+ @quiet ||= RunWrapper.new(TTY::Command.new(pty: true, printer: :null))
45
45
  end
46
46
 
47
47
  include ReflectionUtils::CreateModuleFunctions
48
48
  end
49
- end
49
+ end
@@ -28,6 +28,14 @@ module Autowow
28
28
  pretty_with_output.run(clean)
29
29
  end
30
30
 
31
+ def rubocop_parallel_autocorrect
32
+ result = pretty_with_output.run!(rubocop_parallel)
33
+ if result.failed?
34
+ filtered = result.out.each_line.select { |line| line.match(%r{(.*):([0-9]*):([0-9]*):}) }.map{ |line| line.split(':')[0] }.uniq
35
+ pretty_with_output.run(rubocop_autocorrect(filtered)) if filtered.any?
36
+ end
37
+ end
38
+
31
39
  include ReflectionUtils::CreateModuleFunctions
32
40
  end
33
41
  end
@@ -1,3 +1,3 @@
1
1
  module Autowow
2
- VERSION = "0.4.1"
2
+ VERSION = "0.5.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autowow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - thisismydesign
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-22 00:00:00.000000000 Z
11
+ date: 2017-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: easy_logging
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: 0.7.0
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: 0.7.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: reflection_utils
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +108,34 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: 0.3.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop-rspec
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
111
139
  - !ruby/object:Gem::Dependency
112
140
  name: bundler
113
141
  requirement: !ruby/object:Gem::Requirement
@@ -217,6 +245,7 @@ extra_rdoc_files: []
217
245
  files:
218
246
  - ".gitignore"
219
247
  - ".rspec"
248
+ - ".rubocop.yml"
220
249
  - ".travis.yml"
221
250
  - Gemfile
222
251
  - Guardfile