bundler-commentator 1.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d2bc0b89269e07e8a5736ab1f6c163c41d903485
4
+ data.tar.gz: 5846ca588c0c07bce7670c073c0bf21f71f77fad
5
+ SHA512:
6
+ metadata.gz: 21e0a0f0fae8381f941d9a5cf77e21509466a8479b6e38e7e541d40acd95ff79ae2a475640a000c5e2dac72b8e49a162960d72b6098388c94a0ba0bebe77f88d
7
+ data.tar.gz: b4e21374db36c94513e05375f9d21e0972081ea4c06c95af27f0241d6b14a88d3113d2c4b9955b69abbb4776fd11f7767685e3ca8bdc605220e31c482d478580
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bundler-commentator.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Kevin Traver
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # Bundler::Commentator
2
+
3
+ > Automatically comment your Gems with descriptions from RubyGems
4
+
5
+ One simple command turns this:
6
+
7
+ ```ruby
8
+ gem 'rails', '4.2.0'
9
+ gem 'sqlite3'
10
+ gem 'sass-rails', '~> 5.0'
11
+ ```
12
+
13
+ into this:
14
+
15
+ ```ruby
16
+ # Ruby on Rails is a full-stack web framework optimized for programmer happiness
17
+ # and sustainable productivity. It encourages beautiful code by favoring
18
+ # convention over configuration.
19
+ gem 'rails', '4.2.0'
20
+
21
+ # This module allows Ruby programs to interface with the SQLite3
22
+ # database engine (http://www.sqlite.org). You must have the
23
+ # SQLite engine installed in order to build this module.
24
+ # Note that this module is only compatible with SQLite 3.6.16 or newer.
25
+ gem 'sqlite3'
26
+
27
+ # Sass adapter for the Rails asset pipeline.
28
+ gem 'sass-rails', '~> 5.0'
29
+ ```
30
+
31
+ ## Installation
32
+
33
+ ```bash
34
+ > gem install bundler-commentator
35
+ ```
36
+
37
+ ## Usage
38
+
39
+ ```bash
40
+ > bundler-commentator
41
+ ```
42
+
43
+ ### Exisiting comments
44
+ At the moment `bundler-commentator` doesn't remove existing comments, so I would
45
+ highly recommend first using [bundler-reorganizer](https://github.com/wireframe/bundler-reorganizer) which organizes and cleans your Gemfile
46
+
47
+ #### Options
48
+ `--gemfile_path "path/to/Gemfile"`
49
+ `--output_path "path/to/commented/Gemfile"`
50
+
51
+ ## TODO
52
+ * Ability to leave existing comments
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/bundler/commentator'
4
+ Bundler::Commentator::new.run
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bundler/commentator/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "bundler-commentator"
8
+ spec.version = Bundler::Commentator::VERSION
9
+ spec.authors = ["Kevin Traver"]
10
+ spec.email = ["kevintraver@gmail.com"]
11
+ spec.summary = %q{Automatically add comments to your Gems}
12
+ spec.description = %q{Comment your Gemfile with descriptions from RubyGems.org}
13
+ spec.homepage = "https://github.com/kevintraver/bundler-commentator"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = ["bundler-commentator"]
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+
22
+ spec.add_dependency "gems", '~> 0.8'
23
+ spec.add_dependency "commander", "~> 4.2"
24
+ spec.add_development_dependency "bundler", "~> 1.7"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ end
@@ -0,0 +1,5 @@
1
+ module Bundler
2
+ module Commentator
3
+ VERSION = "1.0.1"
4
+ end
5
+ end
@@ -0,0 +1,68 @@
1
+ require 'gems'
2
+ require 'commander'
3
+
4
+ module Bundler
5
+ class Commentator
6
+ include Commander::Methods
7
+
8
+ def run
9
+ program :name, 'bundler-commentator'
10
+ program :version, '1.0.0'
11
+ program :description, 'Comment your Gemfile with descriptions from RubyGems.org'
12
+
13
+ command :comment do |c|
14
+ c.syntax = '[options]'
15
+ c.description = 'comments Gemfile'
16
+ c.option '--gemfile_path STRING', String, 'Path to Gemfile'
17
+ c.option '--output_path STRING', String, 'Output Path'
18
+
19
+ c.action do |args, options|
20
+ options.default gemfile_path: 'Gemfile', output_path: 'Gemfile'
21
+ say "Reading Gemfile: #{options.gemfile_path}"
22
+ begin
23
+ open(options.gemfile_path)
24
+ rescue
25
+ raise RuntimeError, 'Error opening Gemfile'
26
+ exit
27
+ end
28
+ output_buffer = ''
29
+ File.open(options.gemfile_path "r") do |f|
30
+ f.each_line do |line|
31
+ begin
32
+ if (gem = instance_eval line)
33
+ if !(description = get_description(gem)).empty?
34
+ indentation = line[/\A */]
35
+ output_buffer << "\n#{wrap(description,indentation)}"
36
+ end
37
+ end
38
+ rescue Exception
39
+ end
40
+ output_buffer << line
41
+ end
42
+ end
43
+ say "Writing commented Gemfile to: #{options.output_path}"
44
+ File.open(options.output_path, 'w') {|file| file.write(output_buffer)}
45
+ end
46
+
47
+ end
48
+
49
+ default_command :comment
50
+ run!
51
+ end
52
+
53
+ def get_description(*args)
54
+ rubygems_info = Gems.info args[0].to_s
55
+ rubygems_info["info"].chomp
56
+ end
57
+
58
+ def wrap(s, indentation="", width=78)
59
+ s.gsub(/(.{1,#{width-indentation.size}})(\s+|\Z)/, "#{indentation}# \\1\n")
60
+ end
61
+
62
+ private
63
+
64
+ def gem(*args)
65
+ args[0]
66
+ end
67
+ end
68
+ end
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bundler-commentator
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Kevin Traver
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-01-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: gems
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.8'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: commander
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '4.2'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '4.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ description: Comment your Gemfile with descriptions from RubyGems.org
70
+ email:
71
+ - kevintraver@gmail.com
72
+ executables:
73
+ - bundler-commentator
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - bin/bundler-commentator
83
+ - bundler-commentator.gemspec
84
+ - lib/bundler/commentator.rb
85
+ - lib/bundler/commentator/version.rb
86
+ homepage: https://github.com/kevintraver/bundler-commentator
87
+ licenses:
88
+ - MIT
89
+ metadata: {}
90
+ post_install_message:
91
+ rdoc_options: []
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubyforge_project:
106
+ rubygems_version: 2.4.5
107
+ signing_key:
108
+ specification_version: 4
109
+ summary: Automatically add comments to your Gems
110
+ test_files: []