rebundler 0.5.0 → 0.5.1
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 +4 -4
- data/.rubocop.yml +0 -3
- data/CHANGELOG.md +5 -0
- data/README.md +11 -31
- data/lib/rebundler/serializer.rb +1 -1
- data/lib/rebundler/version.rb +1 -1
- data/lib/rebundler.rb +0 -1
- metadata +1 -3
- data/lib/bundler/rebundle.rb +0 -44
- data/plugins.rb +0 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ca1277ce8c48c32a188112502901feab5054e3f1169c9affafdfa67efc2ad5c6
|
|
4
|
+
data.tar.gz: 44175bed645dd17afd40630266b09d8f3455e4366078c55324da91396e59f2dc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 853ad9dfcd1305412a8ae3625f3d5a95a18a9944e1aa660b77b910accf5d0a9c1cbc1614d0410a459a82f966f3343c436a275a90eb060cfd416ddab3d7e47d8a
|
|
7
|
+
data.tar.gz: f3c323ad1ffb1b585008aa71e8b5aea817d7b54489b125f68e6cb958fa887ae2d437d37b5983af9df65cb823b863a7b5cccc657fb60ed1e86a42588f7f3f1966
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -18,41 +18,15 @@ This is a real life example from my own project. That looks a lot better, doesn'
|
|
|
18
18
|
|
|
19
19
|
## Known limitations
|
|
20
20
|
|
|
21
|
-
- **Probably does not work with all possible Gemfile configurations.** It is designed to work with the most common setups right now. If you encounter an issue, please open an issue on GitHub. I strive to support
|
|
21
|
+
- **Probably does not work with all possible Gemfile configurations.** It is designed to work with the most common setups right now. If you encounter an issue, please open an issue on GitHub. I strive to support most sensible configurations.
|
|
22
22
|
|
|
23
23
|
## Installation
|
|
24
24
|
|
|
25
|
-
There are two ways to
|
|
25
|
+
First add `rebundler` to your Gemfile. `bundle add rebundler`. There are two ways to run Rebundler.
|
|
26
26
|
|
|
27
|
-
### 1.
|
|
27
|
+
### 1. Writing mode
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
> This does not seem to work properly yet, I need to dig into why later.
|
|
31
|
-
|
|
32
|
-
Simply add them gem to your Gemfile. the location does not matter as it will be resorted immediately.
|
|
33
|
-
|
|
34
|
-
```ruby
|
|
35
|
-
gem "rebundler"
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
This installs a Bundler plugin that automatically runs after installing gems. You should see a message in your terminal after running `bundle`:
|
|
39
|
-
|
|
40
|
-
```sh
|
|
41
|
-
$ bundle
|
|
42
|
-
|
|
43
|
-
...
|
|
44
|
-
|
|
45
|
-
Reordering and annotating Gemfile...
|
|
46
|
-
Bundle complete! 10 Gemfile dependencies, 45 gems now installed.
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
### 2. Manual mode
|
|
50
|
-
|
|
51
|
-
```ruby
|
|
52
|
-
gem "rebundler", require: false
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
This does **not** load the plugin and means you have to run rebundler yourself by running the `rebundle` command:
|
|
29
|
+
If you run `bundle exec rebundle`, rebundler will reorder and annotate your Gemfile.
|
|
56
30
|
|
|
57
31
|
```sh
|
|
58
32
|
$ bundle exec rebundle
|
|
@@ -60,7 +34,7 @@ Reordering and annotating Gemfile...
|
|
|
60
34
|
✓ Gemfile has been reordered and annotated
|
|
61
35
|
```
|
|
62
36
|
|
|
63
|
-
###
|
|
37
|
+
### 2. CI mode
|
|
64
38
|
|
|
65
39
|
If you run `bundle exec rebundle --ci`, rebundler will run in CI mode, which will compare the output
|
|
66
40
|
of the current Gemfile to a freshly formatted one.
|
|
@@ -69,6 +43,12 @@ If there are differences, rebundler will exit with a non-zero status code.
|
|
|
69
43
|
|
|
70
44
|
This does not write to the Gemfile.
|
|
71
45
|
|
|
46
|
+
```sh
|
|
47
|
+
❯ bundle exec rebundle --ci
|
|
48
|
+
Checking if Gemfile is properly formatted...
|
|
49
|
+
✓ Gemfile is properly formatted
|
|
50
|
+
```
|
|
51
|
+
|
|
72
52
|
### Options
|
|
73
53
|
|
|
74
54
|
### `--force`
|
data/lib/rebundler/serializer.rb
CHANGED
|
@@ -41,7 +41,7 @@ module Rebundler
|
|
|
41
41
|
|
|
42
42
|
def self.find_spacing_character(node)
|
|
43
43
|
# Assume it's formatted with tabs if ANY line starts with a tab.
|
|
44
|
-
any_line_starts_with_tab = node.location.slice.split("\n").any? {
|
|
44
|
+
any_line_starts_with_tab = node.location.slice.split("\n").any? { |line| line.start_with?("\t") }
|
|
45
45
|
|
|
46
46
|
any_line_starts_with_tab ? "\t" : " "
|
|
47
47
|
end
|
data/lib/rebundler/version.rb
CHANGED
data/lib/rebundler.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rebundler
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dennis Paagman
|
|
@@ -22,7 +22,6 @@ files:
|
|
|
22
22
|
- README.md
|
|
23
23
|
- Rakefile
|
|
24
24
|
- exe/rebundle
|
|
25
|
-
- lib/bundler/rebundle.rb
|
|
26
25
|
- lib/rebundler.rb
|
|
27
26
|
- lib/rebundler/Rakefile
|
|
28
27
|
- lib/rebundler/formatter.rb
|
|
@@ -34,7 +33,6 @@ files:
|
|
|
34
33
|
- lib/rebundler/version.rb
|
|
35
34
|
- lib/rebundler/visitor.rb
|
|
36
35
|
- mise.toml
|
|
37
|
-
- plugins.rb
|
|
38
36
|
homepage: https://github.com/dennispaagman/rebundler
|
|
39
37
|
licenses:
|
|
40
38
|
- MIT
|
data/lib/bundler/rebundle.rb
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "bundler"
|
|
4
|
-
require "tempfile"
|
|
5
|
-
|
|
6
|
-
module Bundler
|
|
7
|
-
class Rebundle < Bundler::Plugin::API
|
|
8
|
-
command "rebundle"
|
|
9
|
-
|
|
10
|
-
hook "after-install-all" do
|
|
11
|
-
parse_and_write_gemfile!
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def exec(command, args)
|
|
15
|
-
send command, args
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def self.parse_and_write_gemfile!
|
|
19
|
-
Bundler.ui.info "Reordering and annotating Gemfile..."
|
|
20
|
-
|
|
21
|
-
file = Bundler.root.to_s + "/Gemfile"
|
|
22
|
-
|
|
23
|
-
begin
|
|
24
|
-
# Load all gems in the Gemfile so we can use them to grab the summary instead of
|
|
25
|
-
# having to hit rubygems.org
|
|
26
|
-
Bundler.setup
|
|
27
|
-
|
|
28
|
-
parser = ::Rebundler::Parser.from_file(file)
|
|
29
|
-
content = parser.format
|
|
30
|
-
|
|
31
|
-
# Use atomic write to prevent corruption if write fails
|
|
32
|
-
Tempfile.create("Gemfile", Bundler.root.to_s) do |tmp|
|
|
33
|
-
tmp.write(content)
|
|
34
|
-
tmp.flush
|
|
35
|
-
tmp.close
|
|
36
|
-
FileUtils.mv(tmp.path, file)
|
|
37
|
-
end
|
|
38
|
-
rescue StandardError => e
|
|
39
|
-
Bundler.ui.error "Error parsing Gemfile: #{e.message}"
|
|
40
|
-
raise Bundler::PluginError, e
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
data/plugins.rb
DELETED