ordinare 0.0.1 → 0.0.2

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: 2327f9dcafd7fa105f2fe3a6d27c3fe22da98008
4
- data.tar.gz: 1427532dfec2415f7d9dd81aeb2c03c99111c7cd
3
+ metadata.gz: 8566fad853305a7e8df3a8fe54e3df79865c93ca
4
+ data.tar.gz: d72ccc3aae0cadb3a10306aaa73751836e0dec63
5
5
  SHA512:
6
- metadata.gz: bcb01b71c7f5437205b593c5325d57949b5c2a7eef4e4243142f28fb79fafb9fcf0078eb8c38d23c01c35f6bd530ffe9a89e98730239ce815b579d768132b9fb
7
- data.tar.gz: f8ef8fa47f7d451c40910945ff6bdb0c7852aa3bc9bb3842446df4e2e697a8f2a1bbd36a7787a7d16473a0ffeba1f612168fa8d520887d945e09a516a8995573
6
+ metadata.gz: e1188eea460b3e86824be3c654e5093fc8653820f14cf4eec4ba19a36e3b36da6800afdb864024b9de417d1caf207018a78130c7e4420184f89f1ad8196bda43
7
+ data.tar.gz: 005c9150c4b7abd6a1564baa7d7d2ac4540177ce68cbec1bf3958fdc705eda8b9c2c6d32cba70fd87959a5aa4914eaa83274458d6642a9839708e51b80769cbf
data/bin/ordinare CHANGED
@@ -2,4 +2,9 @@
2
2
 
3
3
  require "ordinare"
4
4
 
5
- puts Ordinare.hi
5
+ if ARGV.size > 0
6
+ puts Ordinare.parse_args
7
+ else
8
+ Ordinare.sort
9
+ end
10
+
data/lib/ordinare.rb CHANGED
@@ -1,7 +1,38 @@
1
1
  require "ordinare/version"
2
+ require "optparse"
2
3
 
3
4
  module Ordinare
4
- def self.hi
5
+ module_function
6
+
7
+ def hi
5
8
  "Ciao, sono Ordinare"
6
9
  end
10
+
11
+ def parse_args
12
+ OptionParser.new do |opts|
13
+ opts.banner = "Usage: ordinare inside your Rails project"
14
+
15
+ opts.on("-v", "--version", "Check gem version") do
16
+ puts Ordinare::VERSION
17
+ end
18
+
19
+ opts.on("-h", "--help", "Get help") do
20
+ puts opts
21
+ end
22
+ end.parse!
23
+ end
24
+
25
+ def sort(path = "Gemfile")
26
+ unless File.file?(path)
27
+ abort("No Gemfile found in the current directory, is this a Rails project with Gemfile?")
28
+ end
29
+
30
+ content = File.readlines(path)
31
+
32
+ content.sort
33
+
34
+ File.open("#{path}.ordinare", "w+") do |file|
35
+ content.each { |line| file.puts(line) }
36
+ end
37
+ end
7
38
  end
@@ -1,3 +1,3 @@
1
1
  module Ordinare
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ordinare
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
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-07-26 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2017-07-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  description: Ordinare sorts gems in your Gemfile alphabetically
14
28
  email: nikolaseap@gmail.com
15
29
  executables: