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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5a25d32ec27d03d280b3e0e7bad117ab3ddec7b9
4
- data.tar.gz: 69c3d0c5d50b3198d59356397c0658fbe5ed3a95
3
+ metadata.gz: b99a898ff374ff4088852d74e247345bea7d1b50
4
+ data.tar.gz: 324307b0a9e45f56eee9ff88531386eb2d903484
5
5
  SHA512:
6
- metadata.gz: dd4207fa45e9bc93a4985891d0ae6961a48fc22871b23f9899833579c0d7a7b63deb1689c723751dfe86777e0810f409dca7ccc71c84434346e732cad91cefe3
7
- data.tar.gz: 033933a1d918ff537c96665bedadfa19dff766aa673c4670ee47d5e546ed4103fee01a5e0c18c908591ab7f922bca1acde2bb231417e8fc248efd60e4a1f12ce
6
+ metadata.gz: 7d8050f9e223d02eacfe12bd3ec9522908d0596c5cbc3fb44dea409080063339f520e95e1508baf837797e548d2b1b5bd2ff5e301f0c1764413a09a7dca52e69
7
+ data.tar.gz: 28d29146db66524745e59e963afdf24937fa74eb7b66780c6cb7bdd330d8f36a4b749cd63e3d40fa71f32e368ad22acd1cdd1b9de9a823767e610f18986eac42
data/README.md CHANGED
@@ -16,7 +16,8 @@ Options:
16
16
  # Default: Gemfile
17
17
  [--licenses=LICENSES]
18
18
  # Default: false
19
-
19
+ [--homepage=HOMEPAGE]
20
+ # Default: false
20
21
  Comment Gemfile with gems descriptions fetched from rubygems
21
22
  ```
22
23
 
@@ -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
- licenses = gem_data['licenses']
24
- licenses = Base::UNKNOWN_LICENCES if licenses.nil? || licenses.empty?
25
- info = "(#{licenses * ', '}) #{info}"
26
- end
27
- inject_into_file options[:gemfile], comment_block(info, indention), before: Regexp.new("[\s]*gem[\s]+['\"]#{gem_name}['\"]") if info
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
@@ -1,3 +1,3 @@
1
1
  module GemfileUtils
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  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.0.0
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-14 00:00:00.000000000 Z
11
+ date: 2016-12-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler