wanda 0.0.1.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.travis.yml +6 -0
- data/CHANGELOG +9 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +53 -0
- data/LICENSE.txt +21 -0
- data/README.md +57 -0
- data/Rakefile +12 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/docs/CONTRIBUTION.md +14 -0
- data/docs/README.md +10 -0
- data/docs/TODO.md +26 -0
- data/docs/_config.yml +22 -0
- data/docs/_includes/head_custom.html +9 -0
- data/docs/assets/images/android-chrome-192x192.png +0 -0
- data/docs/assets/images/apple-touch-icon.png +0 -0
- data/docs/assets/images/favicon-16x16.png +0 -0
- data/docs/assets/images/favicon-32x32.png +0 -0
- data/docs/assets/images/favicon.ico +0 -0
- data/docs/assets/images/mstile-150x150.png +0 -0
- data/docs/assets/images/safari-pinned-tab.svg +20 -0
- data/docs/browserconfig.xml +9 -0
- data/docs/favicon.ico +0 -0
- data/docs/installation.md +23 -0
- data/docs/site.webmanifest +14 -0
- data/exe/wanda +6 -0
- data/lib/wanda.rb +9 -0
- data/lib/wanda/cli.rb +66 -0
- data/lib/wanda/rails.rb +156 -0
- data/lib/wanda/sub_command_base.rb +11 -0
- data/lib/wanda/version.rb +5 -0
- data/wanda.gemspec +35 -0
- metadata +144 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 07ef56bb158d1f8765b06f1a54d9a6778920b52899dc19eebebf3139a7766cb6
|
4
|
+
data.tar.gz: 918911c72ff0f3ba65fd98f84416631dc94d88da33cdd844840e458c8ca4879d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a8302bf60c791f5fafafa63cf3c716aeb813e971886cded32a7863cb984cb1ece27de77e1a764704246025440f5de5e4247cbca47292678c104cf4064de796b2
|
7
|
+
data.tar.gz: '0830ff644187bfd980d05dccd99ed28664ff66d22df107ca99319444f399f47fa220be6b80365b7c0ecfa4eb1d6ade3d442db63abe802fc02dcf2964a05a1254'
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CHANGELOG
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at deepakmahakale@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
wanda (0.1.0)
|
5
|
+
rails5-spec-converter (~> 2.0, >= 2.0.0)
|
6
|
+
rubocop-rspec (~> 1.28, >= 1.28.0)
|
7
|
+
thor (~> 1.0, >= 1.0.0)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
ast (2.4.2)
|
13
|
+
astrolabe (1.3.1)
|
14
|
+
parser (~> 2.2)
|
15
|
+
minitest (5.14.4)
|
16
|
+
parallel (1.20.1)
|
17
|
+
parser (2.7.2.0)
|
18
|
+
ast (~> 2.4.1)
|
19
|
+
rails5-spec-converter (2.0.0)
|
20
|
+
astrolabe (~> 1.2)
|
21
|
+
parser (>= 2.3.0.7)
|
22
|
+
rainbow (3.0.0)
|
23
|
+
rake (12.3.3)
|
24
|
+
regexp_parser (2.1.1)
|
25
|
+
rexml (3.2.5)
|
26
|
+
rubocop (0.93.1)
|
27
|
+
parallel (~> 1.10)
|
28
|
+
parser (>= 2.7.1.5)
|
29
|
+
rainbow (>= 2.2.2, < 4.0)
|
30
|
+
regexp_parser (>= 1.8)
|
31
|
+
rexml
|
32
|
+
rubocop-ast (>= 0.6.0)
|
33
|
+
ruby-progressbar (~> 1.7)
|
34
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
35
|
+
rubocop-ast (1.4.1)
|
36
|
+
parser (>= 2.7.1.5)
|
37
|
+
rubocop-rspec (1.44.1)
|
38
|
+
rubocop (~> 0.87)
|
39
|
+
rubocop-ast (>= 0.7.1)
|
40
|
+
ruby-progressbar (1.11.0)
|
41
|
+
thor (1.1.0)
|
42
|
+
unicode-display_width (1.7.0)
|
43
|
+
|
44
|
+
PLATFORMS
|
45
|
+
ruby
|
46
|
+
|
47
|
+
DEPENDENCIES
|
48
|
+
minitest (~> 5.0)
|
49
|
+
rake (~> 12.0)
|
50
|
+
wanda!
|
51
|
+
|
52
|
+
BUNDLED WITH
|
53
|
+
2.1.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021 Deepak Mahakale
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# Wanda
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be
|
4
|
+
able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/wanda`.
|
5
|
+
To experiment with that code, run `bin/console` for an interactive prompt.
|
6
|
+
|
7
|
+
TODO: Delete this and the text above, and describe your gem
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'wanda'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle install
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install wanda
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
TODO: Write usage instructions here
|
28
|
+
|
29
|
+
## Development
|
30
|
+
|
31
|
+
After checking out the repo, run `bin/setup` to install dependencies.
|
32
|
+
Then, run `rake test` to run the tests. You can also run `bin/console` for an
|
33
|
+
interactive prompt that will allow you to experiment.
|
34
|
+
|
35
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
36
|
+
To release a new version, update the version number in `version.rb`, and then
|
37
|
+
run `bundle exec rake release`, which will create a git tag for the version,
|
38
|
+
push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
39
|
+
|
40
|
+
## Contributing
|
41
|
+
|
42
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/deepakmahakale/wanda.
|
43
|
+
This project is intended to be a safe, welcoming space for collaboration, and
|
44
|
+
contributors are expected to adhere to the
|
45
|
+
[code of conduct](https://github.com/deepakmahakale/wanda/blob/master/CODE_OF_CONDUCT.md).
|
46
|
+
|
47
|
+
|
48
|
+
## License
|
49
|
+
|
50
|
+
The gem is available as open source under the terms of the
|
51
|
+
[MIT License](https://opensource.org/licenses/MIT).
|
52
|
+
|
53
|
+
## Code of Conduct
|
54
|
+
|
55
|
+
Everyone interacting in the Wanda project's codebases, issue trackers,
|
56
|
+
chat rooms and mailing lists is expected to follow the
|
57
|
+
[code of conduct](https://github.com/deepakmahakale/wanda/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'wanda'
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require 'irb'
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
---
|
2
|
+
layout: default
|
3
|
+
title: Contribution
|
4
|
+
nav_order: 4
|
5
|
+
description: Contribution
|
6
|
+
permalink: /contribution
|
7
|
+
---
|
8
|
+
|
9
|
+
# Contribution
|
10
|
+
|
11
|
+
PR's are welcome.
|
12
|
+
Feel free to contribute by:
|
13
|
+
- Raising a pull request for any of the [TODO items](https://deepakmahakale.in/wanda/todo)
|
14
|
+
- Opening issues or feature requests [here](https://github.com/deepakmahakale/wanda/issues)
|
data/docs/README.md
ADDED
data/docs/TODO.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
---
|
2
|
+
layout: default
|
3
|
+
title: Todo
|
4
|
+
nav_order: 3
|
5
|
+
description: Todo
|
6
|
+
permalink: /todo
|
7
|
+
---
|
8
|
+
|
9
|
+
# TODO
|
10
|
+
|
11
|
+
### [v0.0.1.beta](https://github.com/deepakmahakale/wanda/milestone/1)
|
12
|
+
- [ ] keep updated list of latest rails versions without releasing new gem version
|
13
|
+
- [ ] **Test cases**
|
14
|
+
- [ ] ⇨ Test for different versions
|
15
|
+
- [ ] **GitHub action**
|
16
|
+
- [ ] ⇨ Action to run test cases
|
17
|
+
- [ ] ⇨ Action to deploy to rubygems
|
18
|
+
- [ ] **4 -> 5.0**
|
19
|
+
- [ ] ⇨ remove `gem 'quiet_assets'` from Gemfile
|
20
|
+
- [ ] **5.0 -> 5.2**
|
21
|
+
- [ ] **5.2 -> 6.0**
|
22
|
+
|
23
|
+
### [v0.1.0](https://github.com/deepakmahakale/wanda/milestone/3)
|
24
|
+
Add support for popular gems:
|
25
|
+
- [ ] devise
|
26
|
+
- [ ] aasm
|
data/docs/_config.yml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
remote_theme: pmarsceill/just-the-docs
|
2
|
+
title: UPGRADER
|
3
|
+
description: Upgrade Rails with one command
|
4
|
+
|
5
|
+
# Theme specific config
|
6
|
+
# ==============================================================================
|
7
|
+
# Footer last edited timestamp
|
8
|
+
# Show or hide edit time - page must have `last_modified_date` defined in the
|
9
|
+
# frontmatter
|
10
|
+
# last_edit_timestamp: true
|
11
|
+
# Uses ruby's time format:
|
12
|
+
# https://ruby-doc.org/stdlib-2.7.0/libdoc/time/rdoc/Time.html
|
13
|
+
# last_edit_time_format: "%b %e %Y at %I:%M %p"
|
14
|
+
|
15
|
+
# Footer "Edit this page on GitHub" link text
|
16
|
+
gh_edit_link: true
|
17
|
+
gh_edit_link_text: Edit this page on GitHub.
|
18
|
+
gh_edit_repository: https://github.com/deepakmahakale/wanda
|
19
|
+
gh_edit_branch: master
|
20
|
+
gh_edit_source: docs
|
21
|
+
gh_edit_view_mode: tree
|
22
|
+
# ==============================================================================
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<link rel="apple-touch-icon" sizes="180x180" href="assets/images/apple-touch-icon.png">
|
2
|
+
<link rel="icon" type="image/png" sizes="32x32" href="assets/images/favicon-32x32.png">
|
3
|
+
<link rel="icon" type="image/png" sizes="16x16" href="assets/images/favicon-16x16.png">
|
4
|
+
<link rel="manifest" href="site.webmanifest">
|
5
|
+
<link rel="mask-icon" href="assets/images/safari-pinned-tab.svg" color="#2d89ef">
|
6
|
+
<link rel="shortcut icon" href="assets/images/favicon.ico">
|
7
|
+
<meta name="msapplication-TileColor" content="#2d89ef">
|
8
|
+
<meta name="msapplication-config" content="browserconfig.xml">
|
9
|
+
<meta name="theme-color" content="#ffffff">
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<?xml version="1.0" standalone="no"?>
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
3
|
+
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
4
|
+
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
|
5
|
+
width="2400.000000pt" height="2400.000000pt" viewBox="0 0 2400.000000 2400.000000"
|
6
|
+
preserveAspectRatio="xMidYMid meet">
|
7
|
+
<metadata>
|
8
|
+
Created by potrace 1.14, written by Peter Selinger 2001-2017
|
9
|
+
</metadata>
|
10
|
+
<g transform="translate(0.000000,2400.000000) scale(0.100000,-0.100000)"
|
11
|
+
fill="#000000" stroke="none">
|
12
|
+
<path d="M11863 22736 c-79 -19 -178 -66 -241 -116 -76 -59 -10159 -9732
|
13
|
+
-10220 -9803 -171 -200 -199 -486 -69 -717 47 -84 168 -198 257 -242 148 -74
|
14
|
+
-146 -68 3302 -68 l3108 0 2 -5023 3 -5022 22 -58 c85 -221 237 -363 449 -417
|
15
|
+
76 -20 126 -20 3524 -20 3398 0 3448 0 3524 20 227 58 398 229 456 456 20 76
|
16
|
+
20 134 20 5071 l0 4993 3108 0 c3445 0 3153 -6 3301 67 89 43 211 158 258 243
|
17
|
+
128 228 103 514 -64 712 -26 31 -2337 2252 -5134 4935 -3381 3242 -5105 4889
|
18
|
+
-5142 4911 -132 79 -319 111 -464 78z"/>
|
19
|
+
</g>
|
20
|
+
</svg>
|
data/docs/favicon.ico
ADDED
Binary file
|
@@ -0,0 +1,23 @@
|
|
1
|
+
---
|
2
|
+
layout: default
|
3
|
+
title: Installation
|
4
|
+
nav_order: 2
|
5
|
+
description: Installation
|
6
|
+
permalink: /installation
|
7
|
+
---
|
8
|
+
|
9
|
+
# Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'wanda'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle install
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install wanda
|
@@ -0,0 +1,14 @@
|
|
1
|
+
{
|
2
|
+
"name": "Wanda",
|
3
|
+
"short_name": "Wanda",
|
4
|
+
"icons": [
|
5
|
+
{
|
6
|
+
"src": "assets/images/android-chrome-192x192.png",
|
7
|
+
"sizes": "192x192",
|
8
|
+
"type": "image/png"
|
9
|
+
}
|
10
|
+
],
|
11
|
+
"theme_color": "#ffffff",
|
12
|
+
"background_color": "#ffffff",
|
13
|
+
"display": "standalone"
|
14
|
+
}
|
data/exe/wanda
ADDED
data/lib/wanda.rb
ADDED
data/lib/wanda/cli.rb
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'thor'
|
4
|
+
require 'wanda/rails'
|
5
|
+
|
6
|
+
# Ref: https://nandovieira.com/creating-generators-and-executables-with-thor
|
7
|
+
module Wanda
|
8
|
+
# CLI implementation for wanda
|
9
|
+
class CLI < Thor
|
10
|
+
include Thor::Actions
|
11
|
+
|
12
|
+
# Keep sorted list | except rails
|
13
|
+
SUPPORTED_GEMS = {
|
14
|
+
rails: [
|
15
|
+
{ from: 4.2, to: 5.2 },
|
16
|
+
{ from: 5.2, to: 6.0 }
|
17
|
+
]
|
18
|
+
}.freeze
|
19
|
+
|
20
|
+
def self.exit_on_failure?
|
21
|
+
true
|
22
|
+
end
|
23
|
+
|
24
|
+
desc 'version', 'Display version'
|
25
|
+
map %w[-v --version] => :version
|
26
|
+
def version
|
27
|
+
say "Wanda #{VERSION}"
|
28
|
+
end
|
29
|
+
|
30
|
+
desc 'rails', 'rails upgrade'
|
31
|
+
subcommand 'rails', Wanda::Rails
|
32
|
+
|
33
|
+
# option :project_directory, aliases: '-d'
|
34
|
+
# def upgrade(gem, *extras)
|
35
|
+
# klass = Object.const_get("Wanda::#{classify(gem)}")
|
36
|
+
# obj = klass.new(options)
|
37
|
+
# obj.rails4_2_to_5_2(extras)
|
38
|
+
# end
|
39
|
+
|
40
|
+
# desc 'list [options]', 'List supported gems'
|
41
|
+
# def list
|
42
|
+
# message = <<~STR
|
43
|
+
# Supports upgrade for:
|
44
|
+
# #{'=' * 76}
|
45
|
+
# #{format_list}
|
46
|
+
# STR
|
47
|
+
# puts set_color(message, :green)
|
48
|
+
# end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def classify(gem)
|
53
|
+
gem.split('_').collect(&:capitalize).join
|
54
|
+
end
|
55
|
+
|
56
|
+
def format_list
|
57
|
+
SUPPORTED_GEMS.map do |gem, versions|
|
58
|
+
version_list = versions.map do |version|
|
59
|
+
"#{version[:from]} => #{version[:to]}"
|
60
|
+
end.join(', ')
|
61
|
+
|
62
|
+
"#{gem}: " + version_list
|
63
|
+
end.join("\n ")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
data/lib/wanda/rails.rb
ADDED
@@ -0,0 +1,156 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'thor'
|
4
|
+
require 'wanda/sub_command_base'
|
5
|
+
|
6
|
+
module Wanda
|
7
|
+
class Rails < SubCommandBase
|
8
|
+
include Thor::Actions
|
9
|
+
|
10
|
+
REQUIRED_RUBY = {
|
11
|
+
# rails_version => required_ruby_version
|
12
|
+
'6.2' => { required: '2.5.0', recommended: '3.0' },
|
13
|
+
'6.1' => { required: '2.5.0', recommended: '3.0' },
|
14
|
+
'6.0' => { required: '2.5.0', recommended: '2.6' },
|
15
|
+
'5.2' => { required: '2.2.2', recommended: '2.5' },
|
16
|
+
'5.1' => { required: '2.2.2', recommended: '2.5' },
|
17
|
+
'5.0' => { required: '2.2.2', recommended: '2.4' },
|
18
|
+
'4.2' => { required: '1.9.3', recommended: '2.2' }
|
19
|
+
}.freeze
|
20
|
+
|
21
|
+
desc 'upgrade [options]', 'rails upgrade'
|
22
|
+
option :from, aliases: '-f'
|
23
|
+
option :to, aliases: '-t'
|
24
|
+
option :project_directory, aliases: '-d'
|
25
|
+
def upgrade
|
26
|
+
case format_version(options[:to])
|
27
|
+
when '5.2'
|
28
|
+
rails4_2_to_5_2
|
29
|
+
else
|
30
|
+
puts set_color('WARN: Not supported', :red)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def rails4_2_to_5_2
|
37
|
+
inside options[:project_directory].to_s do
|
38
|
+
# https://rubydoc.info/github/wycats/thor/master/Thor/Actions#uncomment_lines-instance_method
|
39
|
+
gsub_file 'Gemfile', /gem\s+["']+rails['"\s,]+([~>\s\d\.]+)/ do |match|
|
40
|
+
match.gsub(/(~>\s*)*[\d\.]+/, latest_rails_version(options[:to]))
|
41
|
+
end
|
42
|
+
gsub_file 'Gemfile', /^\s*ruby\s+.?([\d\.]+(p\d+)?)/ do |match|
|
43
|
+
match.gsub(/[\d\.]+(p\d+)?/, required_ruby_version(latest_rails_version(options[:to])))
|
44
|
+
end
|
45
|
+
gsub_file 'config/application.rb', /^.*active_record.raise_in_transactional_callbacks.*\n/, ''
|
46
|
+
gsub_file 'config/application.rb', /^.*config.serve_static_assets.*\n/ do |match|
|
47
|
+
match.gsub('serve_static_assets', 'public_file_server.enabled')
|
48
|
+
end
|
49
|
+
gsub_file 'config/application.rb', /^.*config.serve_static_files.*\n/ do |match|
|
50
|
+
match.gsub('serve_static_files', 'public_file_server.enabled')
|
51
|
+
end
|
52
|
+
gsub_file 'config/application.rb', /^.*config.static_cache_control.*\n/ do |match|
|
53
|
+
match.gsub(/(static_cache_control\s*=\s*)(.*)/) { "#{Regexp.last_match(1)} { 'Cache-Control' => #{Regexp.last_match(2)} }" }
|
54
|
+
end
|
55
|
+
gsub_file 'config/routes.rb', /^.*::Application.routes.draw.*\n/ do |match|
|
56
|
+
match.gsub(/^\s*(.*::Application)/, 'Rails.application')
|
57
|
+
end
|
58
|
+
|
59
|
+
# TODO: Check if we should do this at bash level
|
60
|
+
Dir.glob('app/controllers/*.rb') do |file_name|
|
61
|
+
gsub_file file_name, /before_filter/ do |match|
|
62
|
+
match.tr('before_filter', 'before_action')
|
63
|
+
end
|
64
|
+
gsub_file file_name, /skip_before_filter/ do |match|
|
65
|
+
match.tr('skip_before_filter', 'skip_before_action')
|
66
|
+
end
|
67
|
+
gsub_file file_name, /redirect_to\(:back\)/ do |match|
|
68
|
+
match.tr('redirect_to(:back)', 'redirect_back(fallback_location: root_path)')
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
unless File.exist?('app/models/application_record.rb')
|
73
|
+
create_file 'app/models/application_record.rb' do
|
74
|
+
<<~STR
|
75
|
+
class ApplicationRecord < ActiveRecord::Base
|
76
|
+
self.abstract_class = true
|
77
|
+
end
|
78
|
+
STR
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
Dir.glob('app/models/*.rb') do |file_name|
|
83
|
+
next if file_name == 'app/models/application_record.rb'
|
84
|
+
|
85
|
+
gsub_file file_name, /ActiveRecord::Base/ do |match|
|
86
|
+
match.gsub('ActiveRecord::Base', 'ApplicationRecord')
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
unless File.exist?('app/mailers/application_mailer.rb')
|
91
|
+
create_file 'app/mailers/application_mailer.rb' do
|
92
|
+
<<~STR
|
93
|
+
class ApplicationMailer < ActionMailer::Base
|
94
|
+
default from: "sample@\#{ActionMailer::Base.smtp_settings[:domain]}"
|
95
|
+
end
|
96
|
+
STR
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
Dir.glob('app/mailers/*.rb') do |file_name|
|
101
|
+
next if file_name == 'app/mailers/application_mailer.rb'
|
102
|
+
|
103
|
+
gsub_file file_name, /ActionMailer::Base/ do |match|
|
104
|
+
match.gsub('ActionMailer::Base', 'ApplicationMailer')
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
Dir.glob('db/migrate/*.rb') do |file_name|
|
109
|
+
gsub_file file_name, /ActiveRecord::Migration$/ do |match|
|
110
|
+
match.gsub('ActiveRecord::Migration', 'ActiveRecord::Migration[4.2]')
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
warning = <<~STR
|
115
|
+
To ensure belongs_to associations work as they were in the previous
|
116
|
+
version `config.active_record.belongs_to_required_by_default = \
|
117
|
+
false` will be added to `config/application.rb`.
|
118
|
+
Please enable this once you have tested the application with the new \
|
119
|
+
behavior.
|
120
|
+
STR
|
121
|
+
puts set_color(warning, :red)
|
122
|
+
insert_into_file 'config/application.rb',
|
123
|
+
after: "Application < Rails::Application\n" do
|
124
|
+
" config.active_record.belongs_to_required_by_default = false\n"
|
125
|
+
end
|
126
|
+
|
127
|
+
run(
|
128
|
+
<<~STR
|
129
|
+
rubocop \
|
130
|
+
--require rubocop-rspec \
|
131
|
+
--only FactoryBot/AttributeDefinedStatically \
|
132
|
+
--auto-correct \
|
133
|
+
spec/factories/
|
134
|
+
STR
|
135
|
+
)
|
136
|
+
|
137
|
+
run('rails5-spec-converter')
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
def format_version(version)
|
142
|
+
/\d.\d/.match(version)[0]
|
143
|
+
end
|
144
|
+
|
145
|
+
def latest_rails_version(version)
|
146
|
+
case format_version(version)
|
147
|
+
when '5.2'
|
148
|
+
'5.2.6'
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
def required_ruby_version(rails_version)
|
153
|
+
REQUIRED_RUBY.dig(format_version(rails_version), :recommended)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class SubCommandBase < Thor
|
4
|
+
def self.banner(command, _namespace = nil, _subcommand = false)
|
5
|
+
"#{basename} #{subcommand_prefix} #{command.usage}"
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.subcommand_prefix
|
9
|
+
name.gsub(/.*::/, '').gsub(/^[A-Z]/) { |match| match[0].downcase }.gsub(/[A-Z]/) { |match| "-#{match[0].downcase}" }
|
10
|
+
end
|
11
|
+
end
|
data/wanda.gemspec
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'lib/wanda/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'wanda'
|
7
|
+
spec.version = Wanda::VERSION
|
8
|
+
spec.authors = ['Deepak Mahakale']
|
9
|
+
spec.email = ['deepakmahakale@gmail.com']
|
10
|
+
|
11
|
+
spec.summary = 'Helps you upgrade rails application easily'
|
12
|
+
spec.description = 'Helps you upgrade rails application easily.
|
13
|
+
Additional support for other gems as well'
|
14
|
+
spec.homepage = 'https://github.com/deepakmahakale/wanda'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 1.9.3')
|
17
|
+
|
18
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
19
|
+
|
20
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
21
|
+
spec.metadata['source_code_uri'] = 'https://github.com/deepakmahakale/wanda'
|
22
|
+
spec.metadata['changelog_uri'] = 'https://github.com/deepakmahakale/wanda/CHANGELOG'
|
23
|
+
|
24
|
+
# Specify which files should be added to the gem when it is released.
|
25
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
26
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
27
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
28
|
+
end
|
29
|
+
spec.bindir = 'exe'
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ['lib']
|
32
|
+
spec.add_dependency 'rails5-spec-converter', '~> 2.0', '>= 2.0.0'
|
33
|
+
spec.add_dependency 'rubocop-rspec', '~> 1.28', '>= 1.28.0'
|
34
|
+
spec.add_dependency 'thor', '~> 1.0', '>= 1.0.0'
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: wanda
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1.beta
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Deepak Mahakale
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-05-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails5-spec-converter
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.0.0
|
20
|
+
- - "~>"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '2.0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 2.0.0
|
30
|
+
- - "~>"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2.0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: rubocop-rspec
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 1.28.0
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '1.28'
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 1.28.0
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '1.28'
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: thor
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 1.0.0
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '1.0'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 1.0.0
|
70
|
+
- - "~>"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '1.0'
|
73
|
+
description: |-
|
74
|
+
Helps you upgrade rails application easily.
|
75
|
+
Additional support for other gems as well
|
76
|
+
email:
|
77
|
+
- deepakmahakale@gmail.com
|
78
|
+
executables:
|
79
|
+
- wanda
|
80
|
+
extensions: []
|
81
|
+
extra_rdoc_files: []
|
82
|
+
files:
|
83
|
+
- ".gitignore"
|
84
|
+
- ".travis.yml"
|
85
|
+
- CHANGELOG
|
86
|
+
- CODE_OF_CONDUCT.md
|
87
|
+
- Gemfile
|
88
|
+
- Gemfile.lock
|
89
|
+
- LICENSE.txt
|
90
|
+
- README.md
|
91
|
+
- Rakefile
|
92
|
+
- bin/console
|
93
|
+
- bin/setup
|
94
|
+
- docs/CONTRIBUTION.md
|
95
|
+
- docs/README.md
|
96
|
+
- docs/TODO.md
|
97
|
+
- docs/_config.yml
|
98
|
+
- docs/_includes/head_custom.html
|
99
|
+
- docs/assets/images/android-chrome-192x192.png
|
100
|
+
- docs/assets/images/apple-touch-icon.png
|
101
|
+
- docs/assets/images/favicon-16x16.png
|
102
|
+
- docs/assets/images/favicon-32x32.png
|
103
|
+
- docs/assets/images/favicon.ico
|
104
|
+
- docs/assets/images/mstile-150x150.png
|
105
|
+
- docs/assets/images/safari-pinned-tab.svg
|
106
|
+
- docs/browserconfig.xml
|
107
|
+
- docs/favicon.ico
|
108
|
+
- docs/installation.md
|
109
|
+
- docs/site.webmanifest
|
110
|
+
- exe/wanda
|
111
|
+
- lib/wanda.rb
|
112
|
+
- lib/wanda/cli.rb
|
113
|
+
- lib/wanda/rails.rb
|
114
|
+
- lib/wanda/sub_command_base.rb
|
115
|
+
- lib/wanda/version.rb
|
116
|
+
- wanda.gemspec
|
117
|
+
homepage: https://github.com/deepakmahakale/wanda
|
118
|
+
licenses:
|
119
|
+
- MIT
|
120
|
+
metadata:
|
121
|
+
allowed_push_host: https://rubygems.org
|
122
|
+
homepage_uri: https://github.com/deepakmahakale/wanda
|
123
|
+
source_code_uri: https://github.com/deepakmahakale/wanda
|
124
|
+
changelog_uri: https://github.com/deepakmahakale/wanda/CHANGELOG
|
125
|
+
post_install_message:
|
126
|
+
rdoc_options: []
|
127
|
+
require_paths:
|
128
|
+
- lib
|
129
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: 1.9.3
|
134
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 1.3.1
|
139
|
+
requirements: []
|
140
|
+
rubygems_version: 3.0.9
|
141
|
+
signing_key:
|
142
|
+
specification_version: 4
|
143
|
+
summary: Helps you upgrade rails application easily
|
144
|
+
test_files: []
|