gemfile_utils 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/lib/gemfile_utils/cli/modules/comments.rb +17 -6
- data/lib/gemfile_utils/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b99a898ff374ff4088852d74e247345bea7d1b50
|
4
|
+
data.tar.gz: 324307b0a9e45f56eee9ff88531386eb2d903484
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d8050f9e223d02eacfe12bd3ec9522908d0596c5cbc3fb44dea409080063339f520e95e1508baf837797e548d2b1b5bd2ff5e301f0c1764413a09a7dca52e69
|
7
|
+
data.tar.gz: 28d29146db66524745e59e963afdf24937fa74eb7b66780c6cb7bdd330d8f36a4b749cd63e3d40fa71f32e368ad22acd1cdd1b9de9a823767e610f18986eac42
|
data/README.md
CHANGED
@@ -8,6 +8,7 @@ module GemfileUtils
|
|
8
8
|
desc 'comments', 'Comment Gemfile with gems descriptions fetched from rubygems'
|
9
9
|
method_option :gemfile, default: 'Gemfile'
|
10
10
|
method_option :licenses, default: 'false'
|
11
|
+
method_option :homepage, default: 'false'
|
11
12
|
|
12
13
|
def comments
|
13
14
|
gemfile_dependencies.each do |dependency|
|
@@ -18,13 +19,23 @@ module GemfileUtils
|
|
18
19
|
protected
|
19
20
|
|
20
21
|
def add_comment(gem_name, gem_data, indention = '')
|
22
|
+
before_regexp = Regexp.new("[\s]*gem[\s]+['\"]#{gem_name}['\"]")
|
21
23
|
info = gem_data['info']
|
22
|
-
if options[:licenses]
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
info = add_licences(info, gem_data) if options[:licenses]
|
25
|
+
info = add_homepage(info, gem_data) if options[:homepage]
|
26
|
+
inject_into_file(options[:gemfile], comment_block(info, indention), before: before_regexp) if info
|
27
|
+
end
|
28
|
+
|
29
|
+
def add_licences(info, gem_data)
|
30
|
+
licenses = gem_data['licenses']
|
31
|
+
licenses = Base::UNKNOWN_LICENCES if licenses.nil? || licenses.empty?
|
32
|
+
"(#{licenses * ', '}) #{info}"
|
33
|
+
end
|
34
|
+
|
35
|
+
def add_homepage(info, gem_data)
|
36
|
+
homepage = gem_data['homepage_uri']
|
37
|
+
return info if homepage.nil? || homepage.empty?
|
38
|
+
"#{info} (#{homepage})"
|
28
39
|
end
|
29
40
|
|
30
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gemfile_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Fedoronchuk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|