autowow 0.14.1 → 0.14.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -0
- data/.rspec +0 -0
- data/.rubocop.yml +0 -0
- data/.travis.yml +0 -0
- data/Gemfile +0 -0
- data/Guardfile +0 -0
- data/LICENSE.txt +0 -0
- data/README.md +188 -188
- data/Rakefile +0 -0
- data/autowow.gemspec +0 -0
- data/bin/autowow +0 -0
- data/bin/aw +0 -0
- data/bin/console +0 -0
- data/bin/setup +0 -0
- data/lib/autowow.rb +0 -0
- data/lib/autowow/cli.rb +0 -0
- data/lib/autowow/commands/gem.rb +0 -0
- data/lib/autowow/commands/heroku.rb +0 -0
- data/lib/autowow/commands/os.rb +0 -0
- data/lib/autowow/commands/rbenv.rb +0 -0
- data/lib/autowow/commands/vcs.rb +0 -0
- data/lib/autowow/decorators/string_decorator.rb +0 -0
- data/lib/autowow/executor.rb +0 -0
- data/lib/autowow/features/fs.rb +0 -0
- data/lib/autowow/features/gem.rb +143 -143
- data/lib/autowow/features/heroku.rb +0 -0
- data/lib/autowow/features/os.rb +0 -0
- data/lib/autowow/features/rbenv.rb +0 -0
- data/lib/autowow/features/vcs.rb +282 -282
- data/lib/autowow/log_formatter.rb +0 -0
- data/lib/autowow/time_difference.rb +0 -0
- data/lib/autowow/version.rb +3 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1772e8f14876452fcd7f01fd22a7bc774df0b4d1888bbc900c24e6760e57631c
|
4
|
+
data.tar.gz: 43a04aafdc84035ac82c261b558c5d869c897db60f7852583063f0a6e418aa0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff463b9060794391491c326930794cd728a48b8212c060252f60dd290d2e90b0d88787872dc255810a76701bc6ffe944ed533f6186a0cd8cb23f38a2fef326cf
|
7
|
+
data.tar.gz: 6e666d0e67a8e5d3071725042dc0115c91c6f6ac6b18dacd8a3b786e3e8ea75c491cf3f785742eb83c47798fa934e083da541d9bd365e62d85fde2bf4a8533bf
|
data/.gitignore
CHANGED
File without changes
|
data/.rspec
CHANGED
File without changes
|
data/.rubocop.yml
CHANGED
File without changes
|
data/.travis.yml
CHANGED
File without changes
|
data/Gemfile
CHANGED
File without changes
|
data/Guardfile
CHANGED
File without changes
|
data/LICENSE.txt
CHANGED
File without changes
|
data/README.md
CHANGED
@@ -1,188 +1,188 @@
|
|
1
|
-
# Autowow
|
2
|
-
|
3
|
-
#### Set of commands to [auto]mate [w]ay [o]f [w]orking
|
4
|
-
|
5
|
-
<!--- Version informartion -->
|
6
|
-
*You are viewing the README of version [v0.14.
|
7
|
-
<!--- Version informartion end -->
|
8
|
-
|
9
|
-
| Branch | Status |
|
10
|
-
| ------ | ------ |
|
11
|
-
| Release | [![Build Status](https://travis-ci.org/thisismydesign/autowow.svg?branch=release)](https://travis-ci.org/thisismydesign/autowow) [![Coverage Status](https://coveralls.io/repos/github/thisismydesign/autowow/badge.svg?branch=release)](https://coveralls.io/github/thisismydesign/autowow?branch=release) [![Gem Version](https://badge.fury.io/rb/autowow.svg)](https://badge.fury.io/rb/autowow) [![Total Downloads](http://ruby-gem-downloads-badge.herokuapp.com/autowow?type=total)](https://rubygems.org/gems/autowow) |
|
12
|
-
| Development | [![Build Status](https://travis-ci.org/thisismydesign/autowow.svg?branch=master)](https://travis-ci.org/thisismydesign/autowow) [![Coverage Status](https://coveralls.io/repos/github/thisismydesign/autowow/badge.svg?branch=master)](https://coveralls.io/github/thisismydesign/autowow?branch=master) [![Bountysource](https://api.bountysource.com/badge/issue?issue_id=52798961)](https://www.bountysource.com/issues/52798961-all-changes-have-been-pushed-doesn-t-take-uncommitted-changes-into-account?utm_source=52798961&utm_medium=shield&utm_campaign=ISSUE_BADGE) |
|
13
|
-
|
14
|
-
## Disclaimer
|
15
|
-
|
16
|
-
Commands are purposefully opinionated. Use it on your own responsibility.
|
17
|
-
|
18
|
-
## Usage
|
19
|
-
|
20
|
-
Install from source as `rake install`.
|
21
|
-
|
22
|
-
Run `autowow` or `aw` to see available commands.
|
23
|
-
|
24
|
-
## Commands
|
25
|
-
|
26
|
-
Commands in general
|
27
|
-
* start by outputting the status before execution
|
28
|
-
* end by outputting the status after execution
|
29
|
-
* are safe
|
30
|
-
* only touch files via other commands (e.g. `git`)
|
31
|
-
* do not cause conflicted state
|
32
|
-
* hard check for prerequisites
|
33
|
-
* store and restore uncommitted changes
|
34
|
-
* output executed commands that cause any change
|
35
|
-
* execute in current directory
|
36
|
-
* retain original output color
|
37
|
-
|
38
|
-
### VCS
|
39
|
-
|
40
|
-
Commands related to version control systems.
|
41
|
-
Currently only Git and the GitHub API are supported.
|
42
|
-
|
43
|
-
#### Branch merged
|
44
|
-
|
45
|
-
`aw bm` / `autowow branch_merged`
|
46
|
-
|
47
|
-
* Switches to master and pulls your merged changes
|
48
|
-
* Removes local working branch
|
49
|
-
|
50
|
-
Prerequisites: not on master
|
51
|
-
|
52
|
-
#### Update projects
|
53
|
-
|
54
|
-
`aw up` / `autowow update_projects`
|
55
|
-
|
56
|
-
* Updates local repositories
|
57
|
-
* Updates remote forks
|
58
|
-
* Searches for repositories on paths: `.`, `./*/`
|
59
|
-
|
60
|
-
Prerequisites: no uncommitted changes on master
|
61
|
-
|
62
|
-
#### Clear branches
|
63
|
-
|
64
|
-
`aw cb` / `autowow clear_branches`
|
65
|
-
|
66
|
-
* Removes branches without not pushed changes
|
67
|
-
* Keeps current and master branches
|
68
|
-
|
69
|
-
#### Add upstream
|
70
|
-
|
71
|
-
`aw au` / `autowow add_upstream`
|
72
|
-
|
73
|
-
* Adds parent repository as remote 'upstream'
|
74
|
-
|
75
|
-
Prerequisites: doesn't have remote called 'upstream'
|
76
|
-
|
77
|
-
#### Hi
|
78
|
-
|
79
|
-
`aw hi` / `autowow hi`
|
80
|
-
|
81
|
-
Day starter routine
|
82
|
-
|
83
|
-
* Updates projects (runs 'Update projects')
|
84
|
-
* Shows latest and deprecated repos
|
85
|
-
* Shows deprecated Ruby versions
|
86
|
-
|
87
|
-
Prerequisites: in a directory that contains git repos, not in the repo itself
|
88
|
-
|
89
|
-
#### Hi!
|
90
|
-
|
91
|
-
`aw hi!` / `autowow hi!`
|
92
|
-
|
93
|
-
Day starter routine for a new start
|
94
|
-
|
95
|
-
* Runs 'Add upstream' and 'Clear branches' for all projects
|
96
|
-
* Runs 'Hi'
|
97
|
-
|
98
|
-
#### Open
|
99
|
-
|
100
|
-
`aw open` / `autowow open`
|
101
|
-
|
102
|
-
* Opens project in browser
|
103
|
-
|
104
|
-
#### Force pull
|
105
|
-
|
106
|
-
`aw fp` / `autowow force_pull`
|
107
|
-
|
108
|
-
* Runs `git fetch --all`
|
109
|
-
* Runs `git reset --hard origin/<current_branch_name>`
|
110
|
-
|
111
|
-
### Gem
|
112
|
-
|
113
|
-
#### Gem release
|
114
|
-
|
115
|
-
`aw grls` / `autowow gem_release`
|
116
|
-
|
117
|
-
* Pulls chnages on `master`
|
118
|
-
* If [version parameter](https://github.com/svenfuchs/gem-release#options-1) is provided
|
119
|
-
* Bumps version in version.rb
|
120
|
-
* Bumps version information in README if present
|
121
|
-
* Commits and pushed changes to `master`
|
122
|
-
* Rebases `release` branch to master
|
123
|
-
* Releases gem via `rake release`
|
124
|
-
* Changes version information to development in README if present
|
125
|
-
|
126
|
-
Prerequisites: on master
|
127
|
-
|
128
|
-
#### Gem clean
|
129
|
-
|
130
|
-
`aw gc` / `autowow gem_clean`
|
131
|
-
|
132
|
-
* Removes unused gems
|
133
|
-
|
134
|
-
#### Rubocop parallel autocorrect
|
135
|
-
|
136
|
-
`aw rpa` / `autowow rubocop_parallel_autocorrect`
|
137
|
-
|
138
|
-
* Runs `rubocop` in parallel mode, autocorrects offenses on single thread
|
139
|
-
|
140
|
-
#### Bundle exec
|
141
|
-
|
142
|
-
`aw be <cmd>` / `autowow bundle_exec <cmd>`
|
143
|
-
|
144
|
-
* Runs `cmd` with `bundle exec` prefixed
|
145
|
-
|
146
|
-
### Ruby
|
147
|
-
|
148
|
-
#### Ruby versions
|
149
|
-
|
150
|
-
`aw rv` / `autowow ruby_versions`
|
151
|
-
|
152
|
-
* Shows Ruby versions in use
|
153
|
-
* Searches for repositories on paths: `.`, `./*/`
|
154
|
-
|
155
|
-
### Misc
|
156
|
-
|
157
|
-
#### Execute
|
158
|
-
|
159
|
-
`aw e` / `autowow execute`
|
160
|
-
|
161
|
-
* Executes given command
|
162
|
-
|
163
|
-
## Feedback
|
164
|
-
|
165
|
-
Any feedback is much appreciated.
|
166
|
-
|
167
|
-
I can only tailor this project to fit use-cases I know about - which are usually my own ones. If you find that this might be the right direction to solve your problem too but you find that it's suboptimal or lacks features don't hesitate to contact me.
|
168
|
-
|
169
|
-
Please let me know if you make use of this project so that I can prioritize further efforts.
|
170
|
-
|
171
|
-
## Conventions
|
172
|
-
|
173
|
-
This gem is developed using the following conventions:
|
174
|
-
- [Bundler's guide for developing a gem](http://bundler.io/v1.14/guides/creating_gem.html)
|
175
|
-
- [Better Specs](http://www.betterspecs.org/)
|
176
|
-
- [Semantic versioning](http://semver.org/)
|
177
|
-
- [RubyGems' guide on gem naming](http://guides.rubygems.org/name-your-gem/)
|
178
|
-
- [RFC memo about key words used to Indicate Requirement Levels](https://tools.ietf.org/html/rfc2119)
|
179
|
-
- [Bundler improvements](https://github.com/thisismydesign/bundler-improvements)
|
180
|
-
- [Minimal dependencies](http://www.mikeperham.com/2016/02/09/kill-your-dependencies/)
|
181
|
-
|
182
|
-
## Contributing
|
183
|
-
|
184
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/thisismydesign/autowow.
|
185
|
-
|
186
|
-
## License
|
187
|
-
|
188
|
-
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
1
|
+
# Autowow
|
2
|
+
|
3
|
+
#### Set of commands to [auto]mate [w]ay [o]f [w]orking
|
4
|
+
|
5
|
+
<!--- Version informartion -->
|
6
|
+
*You are viewing the README of version [v0.14.2[0m](https://github.com/thisismydesign/autowow/releases/tag/v0.14.2[0m). You can find other releases [here](https://github.com/thisismydesign/autowow/releases).*
|
7
|
+
<!--- Version informartion end -->
|
8
|
+
|
9
|
+
| Branch | Status |
|
10
|
+
| ------ | ------ |
|
11
|
+
| Release | [![Build Status](https://travis-ci.org/thisismydesign/autowow.svg?branch=release)](https://travis-ci.org/thisismydesign/autowow) [![Coverage Status](https://coveralls.io/repos/github/thisismydesign/autowow/badge.svg?branch=release)](https://coveralls.io/github/thisismydesign/autowow?branch=release) [![Gem Version](https://badge.fury.io/rb/autowow.svg)](https://badge.fury.io/rb/autowow) [![Total Downloads](http://ruby-gem-downloads-badge.herokuapp.com/autowow?type=total)](https://rubygems.org/gems/autowow) |
|
12
|
+
| Development | [![Build Status](https://travis-ci.org/thisismydesign/autowow.svg?branch=master)](https://travis-ci.org/thisismydesign/autowow) [![Coverage Status](https://coveralls.io/repos/github/thisismydesign/autowow/badge.svg?branch=master)](https://coveralls.io/github/thisismydesign/autowow?branch=master) [![Bountysource](https://api.bountysource.com/badge/issue?issue_id=52798961)](https://www.bountysource.com/issues/52798961-all-changes-have-been-pushed-doesn-t-take-uncommitted-changes-into-account?utm_source=52798961&utm_medium=shield&utm_campaign=ISSUE_BADGE) |
|
13
|
+
|
14
|
+
## Disclaimer
|
15
|
+
|
16
|
+
Commands are purposefully opinionated. Use it on your own responsibility.
|
17
|
+
|
18
|
+
## Usage
|
19
|
+
|
20
|
+
Install from source as `rake install`.
|
21
|
+
|
22
|
+
Run `autowow` or `aw` to see available commands.
|
23
|
+
|
24
|
+
## Commands
|
25
|
+
|
26
|
+
Commands in general
|
27
|
+
* start by outputting the status before execution
|
28
|
+
* end by outputting the status after execution
|
29
|
+
* are safe
|
30
|
+
* only touch files via other commands (e.g. `git`)
|
31
|
+
* do not cause conflicted state
|
32
|
+
* hard check for prerequisites
|
33
|
+
* store and restore uncommitted changes
|
34
|
+
* output executed commands that cause any change
|
35
|
+
* execute in current directory
|
36
|
+
* retain original output color
|
37
|
+
|
38
|
+
### VCS
|
39
|
+
|
40
|
+
Commands related to version control systems.
|
41
|
+
Currently only Git and the GitHub API are supported.
|
42
|
+
|
43
|
+
#### Branch merged
|
44
|
+
|
45
|
+
`aw bm` / `autowow branch_merged`
|
46
|
+
|
47
|
+
* Switches to master and pulls your merged changes
|
48
|
+
* Removes local working branch
|
49
|
+
|
50
|
+
Prerequisites: not on master
|
51
|
+
|
52
|
+
#### Update projects
|
53
|
+
|
54
|
+
`aw up` / `autowow update_projects`
|
55
|
+
|
56
|
+
* Updates local repositories
|
57
|
+
* Updates remote forks
|
58
|
+
* Searches for repositories on paths: `.`, `./*/`
|
59
|
+
|
60
|
+
Prerequisites: no uncommitted changes on master
|
61
|
+
|
62
|
+
#### Clear branches
|
63
|
+
|
64
|
+
`aw cb` / `autowow clear_branches`
|
65
|
+
|
66
|
+
* Removes branches without not pushed changes
|
67
|
+
* Keeps current and master branches
|
68
|
+
|
69
|
+
#### Add upstream
|
70
|
+
|
71
|
+
`aw au` / `autowow add_upstream`
|
72
|
+
|
73
|
+
* Adds parent repository as remote 'upstream'
|
74
|
+
|
75
|
+
Prerequisites: doesn't have remote called 'upstream'
|
76
|
+
|
77
|
+
#### Hi
|
78
|
+
|
79
|
+
`aw hi` / `autowow hi`
|
80
|
+
|
81
|
+
Day starter routine
|
82
|
+
|
83
|
+
* Updates projects (runs 'Update projects')
|
84
|
+
* Shows latest and deprecated repos
|
85
|
+
* Shows deprecated Ruby versions
|
86
|
+
|
87
|
+
Prerequisites: in a directory that contains git repos, not in the repo itself
|
88
|
+
|
89
|
+
#### Hi!
|
90
|
+
|
91
|
+
`aw hi!` / `autowow hi!`
|
92
|
+
|
93
|
+
Day starter routine for a new start
|
94
|
+
|
95
|
+
* Runs 'Add upstream' and 'Clear branches' for all projects
|
96
|
+
* Runs 'Hi'
|
97
|
+
|
98
|
+
#### Open
|
99
|
+
|
100
|
+
`aw open` / `autowow open`
|
101
|
+
|
102
|
+
* Opens project in browser
|
103
|
+
|
104
|
+
#### Force pull
|
105
|
+
|
106
|
+
`aw fp` / `autowow force_pull`
|
107
|
+
|
108
|
+
* Runs `git fetch --all`
|
109
|
+
* Runs `git reset --hard origin/<current_branch_name>`
|
110
|
+
|
111
|
+
### Gem
|
112
|
+
|
113
|
+
#### Gem release
|
114
|
+
|
115
|
+
`aw grls` / `autowow gem_release`
|
116
|
+
|
117
|
+
* Pulls chnages on `master`
|
118
|
+
* If [version parameter](https://github.com/svenfuchs/gem-release#options-1) is provided
|
119
|
+
* Bumps version in version.rb
|
120
|
+
* Bumps version information in README if present
|
121
|
+
* Commits and pushed changes to `master`
|
122
|
+
* Rebases `release` branch to master
|
123
|
+
* Releases gem via `rake release`
|
124
|
+
* Changes version information to development in README if present
|
125
|
+
|
126
|
+
Prerequisites: on master
|
127
|
+
|
128
|
+
#### Gem clean
|
129
|
+
|
130
|
+
`aw gc` / `autowow gem_clean`
|
131
|
+
|
132
|
+
* Removes unused gems
|
133
|
+
|
134
|
+
#### Rubocop parallel autocorrect
|
135
|
+
|
136
|
+
`aw rpa` / `autowow rubocop_parallel_autocorrect`
|
137
|
+
|
138
|
+
* Runs `rubocop` in parallel mode, autocorrects offenses on single thread
|
139
|
+
|
140
|
+
#### Bundle exec
|
141
|
+
|
142
|
+
`aw be <cmd>` / `autowow bundle_exec <cmd>`
|
143
|
+
|
144
|
+
* Runs `cmd` with `bundle exec` prefixed
|
145
|
+
|
146
|
+
### Ruby
|
147
|
+
|
148
|
+
#### Ruby versions
|
149
|
+
|
150
|
+
`aw rv` / `autowow ruby_versions`
|
151
|
+
|
152
|
+
* Shows Ruby versions in use
|
153
|
+
* Searches for repositories on paths: `.`, `./*/`
|
154
|
+
|
155
|
+
### Misc
|
156
|
+
|
157
|
+
#### Execute
|
158
|
+
|
159
|
+
`aw e` / `autowow execute`
|
160
|
+
|
161
|
+
* Executes given command
|
162
|
+
|
163
|
+
## Feedback
|
164
|
+
|
165
|
+
Any feedback is much appreciated.
|
166
|
+
|
167
|
+
I can only tailor this project to fit use-cases I know about - which are usually my own ones. If you find that this might be the right direction to solve your problem too but you find that it's suboptimal or lacks features don't hesitate to contact me.
|
168
|
+
|
169
|
+
Please let me know if you make use of this project so that I can prioritize further efforts.
|
170
|
+
|
171
|
+
## Conventions
|
172
|
+
|
173
|
+
This gem is developed using the following conventions:
|
174
|
+
- [Bundler's guide for developing a gem](http://bundler.io/v1.14/guides/creating_gem.html)
|
175
|
+
- [Better Specs](http://www.betterspecs.org/)
|
176
|
+
- [Semantic versioning](http://semver.org/)
|
177
|
+
- [RubyGems' guide on gem naming](http://guides.rubygems.org/name-your-gem/)
|
178
|
+
- [RFC memo about key words used to Indicate Requirement Levels](https://tools.ietf.org/html/rfc2119)
|
179
|
+
- [Bundler improvements](https://github.com/thisismydesign/bundler-improvements)
|
180
|
+
- [Minimal dependencies](http://www.mikeperham.com/2016/02/09/kill-your-dependencies/)
|
181
|
+
|
182
|
+
## Contributing
|
183
|
+
|
184
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/thisismydesign/autowow.
|
185
|
+
|
186
|
+
## License
|
187
|
+
|
188
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
CHANGED
File without changes
|
data/autowow.gemspec
CHANGED
File without changes
|
data/bin/autowow
CHANGED
File without changes
|
data/bin/aw
CHANGED
File without changes
|
data/bin/console
CHANGED
File without changes
|
data/bin/setup
CHANGED
File without changes
|
data/lib/autowow.rb
CHANGED
File without changes
|
data/lib/autowow/cli.rb
CHANGED
File without changes
|
data/lib/autowow/commands/gem.rb
CHANGED
File without changes
|
File without changes
|
data/lib/autowow/commands/os.rb
CHANGED
File without changes
|
File without changes
|
data/lib/autowow/commands/vcs.rb
CHANGED
File without changes
|
File without changes
|
data/lib/autowow/executor.rb
CHANGED
File without changes
|
data/lib/autowow/features/fs.rb
CHANGED
File without changes
|
data/lib/autowow/features/gem.rb
CHANGED
@@ -1,143 +1,143 @@
|
|
1
|
-
require "pastel"
|
2
|
-
|
3
|
-
require_relative "../commands/gem"
|
4
|
-
require_relative "vcs"
|
5
|
-
|
6
|
-
module Autowow
|
7
|
-
module Features
|
8
|
-
module Gem
|
9
|
-
include EasyLogging
|
10
|
-
include Commands::Gem
|
11
|
-
include Commands::Vcs
|
12
|
-
include Executor
|
13
|
-
|
14
|
-
def gem_release(version_bump = nil)
|
15
|
-
unless rubygems_credentials_set?
|
16
|
-
logger.error("Set RubyGems credentials first via `gem push`")
|
17
|
-
return
|
18
|
-
end
|
19
|
-
pretty_with_output.run(git_status)
|
20
|
-
start_branch = Vcs.working_branch
|
21
|
-
logger.error("Not on master.") and return unless start_branch.eql?("master")
|
22
|
-
pretty.run(pull)
|
23
|
-
version = nil
|
24
|
-
|
25
|
-
if version_bump
|
26
|
-
version = pretty_with_output.run(bump(version_bump)).out.clean_lines.select { |line| line.match(/Bumping|bump/) }.first.split(" ").last
|
27
|
-
bump_readme_version_information(version)
|
28
|
-
# Full command is needed because of faulty escaping otherwise
|
29
|
-
pretty.run("git add README.md *version.rb")
|
30
|
-
pretty.run("git commit -m \"Bumps version to v#{version}\"")
|
31
|
-
end
|
32
|
-
|
33
|
-
pretty.run(push)
|
34
|
-
|
35
|
-
Vcs.on_branch("release") do
|
36
|
-
result = pretty.run!(pull)
|
37
|
-
pretty_with_output.run(set_upstream("origin", "release")) unless result.success?
|
38
|
-
pretty.run(rebase(start_branch))
|
39
|
-
pretty_with_output.run(release)
|
40
|
-
end
|
41
|
-
|
42
|
-
if version && change_readme_version_information_to_development(version)
|
43
|
-
pretty.run(add(["README.md"]))
|
44
|
-
# Full command is needed because of faulty escaping otherwise
|
45
|
-
pretty.run("git commit -m \"Changes README to development version\"")
|
46
|
-
pretty.run(push)
|
47
|
-
end
|
48
|
-
|
49
|
-
pretty_with_output.run(git_status)
|
50
|
-
end
|
51
|
-
|
52
|
-
def rubygems_credentials_set?
|
53
|
-
!quiet.run!("gem push --silent").err.clean_lines.blank?
|
54
|
-
end
|
55
|
-
|
56
|
-
def gem_clean
|
57
|
-
pretty_with_output.run(clean)
|
58
|
-
end
|
59
|
-
|
60
|
-
def rubocop_parallel_autocorrect
|
61
|
-
pastel = Pastel.new
|
62
|
-
result = pretty_with_output.run!(rubocop_parallel)
|
63
|
-
if result.failed?
|
64
|
-
filtered = result.out.each_line.select { |line| line.match(%r{(.*):([0-9]*):([0-9]*):}) }
|
65
|
-
.map { |line| line.split(":")[0] }
|
66
|
-
.uniq
|
67
|
-
.map { |line| pastel.strip(line) }
|
68
|
-
pretty_with_output.run(rubocop_autocorrect(filtered)) if filtered.any?
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def bundle_exec(cmd)
|
73
|
-
Autowow::Executor.pretty_with_output.run(["bundle", "exec"] + cmd)
|
74
|
-
end
|
75
|
-
|
76
|
-
def db_migrate
|
77
|
-
pretty_with_output.run(rake_db_migrate)
|
78
|
-
end
|
79
|
-
|
80
|
-
def db_schema
|
81
|
-
pretty_with_output.run(rake_db_schema)
|
82
|
-
end
|
83
|
-
|
84
|
-
def db_structure
|
85
|
-
pretty_with_output.run(rake_db_structure)
|
86
|
-
end
|
87
|
-
|
88
|
-
def bump_readme_version_information(version)
|
89
|
-
readme = "README.md"
|
90
|
-
return unless File.exists?(readme)
|
91
|
-
text = File.read(readme)
|
92
|
-
return unless contains_version_information?(text)
|
93
|
-
|
94
|
-
version_information = get_version_information(text)
|
95
|
-
|
96
|
-
new_version_information = if version_information.include?("development version")
|
97
|
-
releases_link = version_information.match(/\[.+\]\(.+\)/)[0].split("(")[1].split("/tag")[0]
|
98
|
-
<<-HEREDOC
|
99
|
-
<!--- Version informartion -->
|
100
|
-
*You are viewing the README of version [v#{version}](#{releases_link}/tag/v#{version}). You can find other releases [here](#{releases_link}).*
|
101
|
-
<!--- Version informartion end -->
|
102
|
-
HEREDOC
|
103
|
-
else
|
104
|
-
version_information.gsub(/[0-9]\.[0-9]\.[0-9]/, version)
|
105
|
-
end
|
106
|
-
|
107
|
-
text.gsub!(version_information, new_version_information.chomp)
|
108
|
-
File.write(readme, text)
|
109
|
-
end
|
110
|
-
|
111
|
-
def change_readme_version_information_to_development(version)
|
112
|
-
readme = "README.md"
|
113
|
-
return false unless File.file?(readme)
|
114
|
-
text = File.read(readme)
|
115
|
-
return false unless contains_version_information?(text)
|
116
|
-
version_information = get_version_information(text)
|
117
|
-
return false if version_information.include?("development version")
|
118
|
-
|
119
|
-
releases_link = version_information.match(/\[.+\]\(.+\)/)[0].split("(")[1].split("/tag")[0]
|
120
|
-
|
121
|
-
new_version_information = <<-HEREDOC
|
122
|
-
<!--- Version informartion -->
|
123
|
-
*You are viewing the README of the development version. You can find the README of the latest release (v#{version}) [here](#{releases_link}/tag/v#{version}).*
|
124
|
-
<!--- Version informartion end -->
|
125
|
-
HEREDOC
|
126
|
-
|
127
|
-
text.gsub!(version_information, new_version_information.chomp)
|
128
|
-
File.write(readme, text)
|
129
|
-
true
|
130
|
-
end
|
131
|
-
|
132
|
-
def contains_version_information?(text)
|
133
|
-
text.match(/<!--- Version informartion -->(.+)<!--- Version informartion end -->/m).length > 0
|
134
|
-
end
|
135
|
-
|
136
|
-
def get_version_information(text)
|
137
|
-
text.match(/<!--- Version informartion -->(.+)<!--- Version informartion end -->/m)[0]
|
138
|
-
end
|
139
|
-
|
140
|
-
include ReflectionUtils::CreateModuleFunctions
|
141
|
-
end
|
142
|
-
end
|
143
|
-
end
|
1
|
+
require "pastel"
|
2
|
+
|
3
|
+
require_relative "../commands/gem"
|
4
|
+
require_relative "vcs"
|
5
|
+
|
6
|
+
module Autowow
|
7
|
+
module Features
|
8
|
+
module Gem
|
9
|
+
include EasyLogging
|
10
|
+
include Commands::Gem
|
11
|
+
include Commands::Vcs
|
12
|
+
include Executor
|
13
|
+
|
14
|
+
def gem_release(version_bump = nil)
|
15
|
+
unless rubygems_credentials_set?
|
16
|
+
logger.error("Set RubyGems credentials first via `gem push`")
|
17
|
+
return
|
18
|
+
end
|
19
|
+
pretty_with_output.run(git_status)
|
20
|
+
start_branch = Vcs.working_branch
|
21
|
+
logger.error("Not on master.") and return unless start_branch.eql?("master")
|
22
|
+
pretty.run(pull)
|
23
|
+
version = nil
|
24
|
+
|
25
|
+
if version_bump
|
26
|
+
version = pretty_with_output.run(bump(version_bump)).out.clean_lines.select { |line| line.match(/Bumping|bump/) }.first.split(" ").last
|
27
|
+
bump_readme_version_information(version)
|
28
|
+
# Full command is needed because of faulty escaping otherwise
|
29
|
+
pretty.run("git add README.md *version.rb")
|
30
|
+
pretty.run("git commit -m \"Bumps version to v#{version}\"")
|
31
|
+
end
|
32
|
+
|
33
|
+
pretty.run(push)
|
34
|
+
|
35
|
+
Vcs.on_branch("release") do
|
36
|
+
result = pretty.run!(pull)
|
37
|
+
pretty_with_output.run(set_upstream("origin", "release")) unless result.success?
|
38
|
+
pretty.run(rebase(start_branch))
|
39
|
+
pretty_with_output.run(release)
|
40
|
+
end
|
41
|
+
|
42
|
+
if version && change_readme_version_information_to_development(version)
|
43
|
+
pretty.run(add(["README.md"]))
|
44
|
+
# Full command is needed because of faulty escaping otherwise
|
45
|
+
pretty.run("git commit -m \"Changes README to development version\"")
|
46
|
+
pretty.run(push)
|
47
|
+
end
|
48
|
+
|
49
|
+
pretty_with_output.run(git_status)
|
50
|
+
end
|
51
|
+
|
52
|
+
def rubygems_credentials_set?
|
53
|
+
!quiet.run!("gem push --silent").err.clean_lines.blank?
|
54
|
+
end
|
55
|
+
|
56
|
+
def gem_clean
|
57
|
+
pretty_with_output.run(clean)
|
58
|
+
end
|
59
|
+
|
60
|
+
def rubocop_parallel_autocorrect
|
61
|
+
pastel = Pastel.new
|
62
|
+
result = pretty_with_output.run!(rubocop_parallel)
|
63
|
+
if result.failed?
|
64
|
+
filtered = result.out.each_line.select { |line| line.match(%r{(.*):([0-9]*):([0-9]*):}) }
|
65
|
+
.map { |line| line.split(":")[0] }
|
66
|
+
.uniq
|
67
|
+
.map { |line| pastel.strip(line) }
|
68
|
+
pretty_with_output.run(rubocop_autocorrect(filtered)) if filtered.any?
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def bundle_exec(cmd)
|
73
|
+
Autowow::Executor.pretty_with_output.run(["bundle", "exec"] + cmd)
|
74
|
+
end
|
75
|
+
|
76
|
+
def db_migrate
|
77
|
+
pretty_with_output.run(rake_db_migrate)
|
78
|
+
end
|
79
|
+
|
80
|
+
def db_schema
|
81
|
+
pretty_with_output.run(rake_db_schema)
|
82
|
+
end
|
83
|
+
|
84
|
+
def db_structure
|
85
|
+
pretty_with_output.run(rake_db_structure)
|
86
|
+
end
|
87
|
+
|
88
|
+
def bump_readme_version_information(version)
|
89
|
+
readme = "README.md"
|
90
|
+
return unless File.exists?(readme)
|
91
|
+
text = File.read(readme)
|
92
|
+
return unless contains_version_information?(text)
|
93
|
+
|
94
|
+
version_information = get_version_information(text)
|
95
|
+
|
96
|
+
new_version_information = if version_information.include?("development version")
|
97
|
+
releases_link = version_information.match(/\[.+\]\(.+\)/)[0].split("(")[1].split("/tag")[0]
|
98
|
+
<<-HEREDOC
|
99
|
+
<!--- Version informartion -->
|
100
|
+
*You are viewing the README of version [v#{version}](#{releases_link}/tag/v#{version}). You can find other releases [here](#{releases_link}).*
|
101
|
+
<!--- Version informartion end -->
|
102
|
+
HEREDOC
|
103
|
+
else
|
104
|
+
version_information.gsub(/[0-9]\.[0-9]\.[0-9]/, version)
|
105
|
+
end
|
106
|
+
|
107
|
+
text.gsub!(version_information, new_version_information.chomp)
|
108
|
+
File.write(readme, text)
|
109
|
+
end
|
110
|
+
|
111
|
+
def change_readme_version_information_to_development(version)
|
112
|
+
readme = "README.md"
|
113
|
+
return false unless File.file?(readme)
|
114
|
+
text = File.read(readme)
|
115
|
+
return false unless contains_version_information?(text)
|
116
|
+
version_information = get_version_information(text)
|
117
|
+
return false if version_information.include?("development version")
|
118
|
+
|
119
|
+
releases_link = version_information.match(/\[.+\]\(.+\)/)[0].split("(")[1].split("/tag")[0]
|
120
|
+
|
121
|
+
new_version_information = <<-HEREDOC
|
122
|
+
<!--- Version informartion -->
|
123
|
+
*You are viewing the README of the development version. You can find the README of the latest release (v#{version}) [here](#{releases_link}/tag/v#{version}).*
|
124
|
+
<!--- Version informartion end -->
|
125
|
+
HEREDOC
|
126
|
+
|
127
|
+
text.gsub!(version_information, new_version_information.chomp)
|
128
|
+
File.write(readme, text)
|
129
|
+
true
|
130
|
+
end
|
131
|
+
|
132
|
+
def contains_version_information?(text)
|
133
|
+
text.match(/<!--- Version informartion -->(.+)<!--- Version informartion end -->/m).length > 0
|
134
|
+
end
|
135
|
+
|
136
|
+
def get_version_information(text)
|
137
|
+
text.match(/<!--- Version informartion -->(.+)<!--- Version informartion end -->/m)[0]
|
138
|
+
end
|
139
|
+
|
140
|
+
include ReflectionUtils::CreateModuleFunctions
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|