ordinare 0.2.8 → 0.3.0
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/bin/ordinare +1 -2
- data/lib/ordinare.rb +21 -4
- data/lib/ordinare/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8eefbe9b6d3f26de2734863db44c6545edbad95
|
4
|
+
data.tar.gz: 3caea8639b118c3b4165a0d59921c9735cc72279
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c8dc9e5021c9ed77f65a9da1822f34ba02bffe5e87de87a939f164ec423ba6b8d478e7c847f42c181a94de59f2a588e7d749aa817768848e3cbfd34f6187f5b
|
7
|
+
data.tar.gz: 7ebb521a7018e5ea544837411ffd4c5ed6d5cf4289a183eb0db6a8ffe40f0ae74c7dee332829348fa43fa2466b0d0272ea89f4616aa8605508a44c5df03eb92e
|
data/bin/ordinare
CHANGED
data/lib/ordinare.rb
CHANGED
@@ -9,24 +9,39 @@ module Ordinare
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def parse_args
|
12
|
+
path = "Gemfile"
|
13
|
+
overwrite = true
|
14
|
+
version = nil
|
15
|
+
help = nil
|
16
|
+
|
12
17
|
OptionParser.new do |opts|
|
13
18
|
opts.banner = "Usage: ordinare inside your Rails project"
|
19
|
+
opts.separator ""
|
20
|
+
opts.separator "Specific options:"
|
14
21
|
|
15
22
|
opts.on("-pFILE", "--path=FILE", "Order file") do |filename|
|
16
|
-
|
23
|
+
path = filename
|
24
|
+
end
|
25
|
+
|
26
|
+
opts.on("-n", "--no-overwrite", "Don't overwrite Gemfile") do
|
27
|
+
overwrite = false
|
17
28
|
end
|
18
29
|
|
19
30
|
opts.on("-v", "--version", "Check gem version") do
|
20
31
|
puts Ordinare::VERSION
|
32
|
+
version = true
|
21
33
|
end
|
22
34
|
|
23
35
|
opts.on("-h", "--help", "Get help") do
|
24
36
|
puts opts
|
37
|
+
help = true
|
25
38
|
end
|
26
39
|
end.parse!
|
40
|
+
|
41
|
+
Ordinare.sort(overwrite, path) unless version || help
|
27
42
|
end
|
28
43
|
|
29
|
-
def sort(path = "Gemfile")
|
44
|
+
def sort(overwrite = true, path = "Gemfile")
|
30
45
|
unless File.file?(path)
|
31
46
|
abort("No Gemfile found in the current directory, is this a Rails project with Gemfile?")
|
32
47
|
end
|
@@ -40,11 +55,13 @@ module Ordinare
|
|
40
55
|
content[range[:start_index]..range[:end_index]].sort
|
41
56
|
end
|
42
57
|
|
43
|
-
|
58
|
+
path = "#{path}.ordinare" unless overwrite
|
59
|
+
|
60
|
+
File.open(path, "w+") do |file|
|
44
61
|
content.each { |line| file.puts(line) }
|
45
62
|
end
|
46
63
|
|
47
|
-
puts "Your sorted Gemfile can be found at #{path}
|
64
|
+
puts "Your sorted Gemfile can be found at #{path} path"
|
48
65
|
end
|
49
66
|
|
50
67
|
def find_ranges_of_gems(content)
|
data/lib/ordinare/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ordinare
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nikola Đuza
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -60,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
60
|
version: '0'
|
61
61
|
requirements: []
|
62
62
|
rubyforge_project:
|
63
|
-
rubygems_version: 2.5.2
|
63
|
+
rubygems_version: 2.4.5.2
|
64
64
|
signing_key:
|
65
65
|
specification_version: 4
|
66
66
|
summary: Sort your gems in Gemfile with ease
|