bundler-reorganizer 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1a8463b6a38ebf55a95c7e57edf2c567efdc1c14
4
+ data.tar.gz: dc64b4ab06ffef4a4b4db335e8b40c2fd7cea2fb
5
+ SHA512:
6
+ metadata.gz: 7183ec8af2f689250cccecf9919d353c76dd9eac75b6fcedf256ecb31233949ff568d86e85bb02cee899df19fda9cc28033c4e39392e5bfa9d4de429c91bac81
7
+ data.tar.gz: 591f1b461911797a72c68e8c71850ebf4227b8236ae8c76f6e6929e26e0b42ee89a382936ad8468b37e8d19ee5b7386666af5e8904beddcbda4ed6bc9019bb6b
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,6 @@
1
+ ## Contribution Guidelines
2
+ 1. Fork the repository
3
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
4
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
5
+ 4. Push to the branch (`git push origin my-new-feature`)
6
+ 5. Create new Pull Request
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bundler-reorganizer.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Ryan Sonnek
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,51 @@
1
+ # Bundler::Reorganizer
2
+
3
+ > Automated reorganization for all your Gemfiles.
4
+
5
+ One simple command turns your **unwieldy** Gemfile from this:
6
+ ```ruby
7
+ gem "utils", :group => :development
8
+ gem "more-tools", :group => :development
9
+ gem "testsuite-runner", :group => [:development, :test]
10
+ ```
11
+
12
+ Into this!
13
+ ```ruby
14
+ group :development do
15
+ gem "utils"
16
+ gem "more-tools"
17
+ end
18
+
19
+ group :development, :test do
20
+ gem "testsuite-runner"
21
+ end
22
+ ```
23
+
24
+ ## Usage
25
+
26
+ ```bash
27
+ $ bundler-reorganizer reorganize path/to/Gemfile
28
+ ```
29
+
30
+ #### (optional) `--output path/to/reorganized/Gemfile`
31
+
32
+ Controls the location of reorganized Gemfile.
33
+
34
+ aliased to `-o`
35
+
36
+ example:
37
+ ```bash
38
+ $ bundler-reorganizer reorganize path/to/original/Gemfile --output path/to/reorganized/Gemfile
39
+ ```
40
+
41
+ ## Installation
42
+
43
+ ```bash
44
+ $ gem install bundler-reorganizer
45
+ ```
46
+
47
+ ## Contributing
48
+
49
+ Patches are always welcome and thank you to all [project contributors](https://github.com/wireframe/bundler-reorganizer/graphs/contributors)!
50
+
51
+ Interested in contributing? Review the project [contribution guidelines](CONTRIBUTING.md) and get started!
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/bundler/reorganizer/cli'
4
+ Bundler::Reorganizer::CLI.start(ARGV)
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bundler/reorganizer/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "bundler-reorganizer"
8
+ spec.version = Bundler::Reorganizer::VERSION
9
+ spec.authors = ["Ryan Sonnek"]
10
+ spec.email = ["ryan@codecrate.com"]
11
+ spec.description = %q{Reorganize your gemfile into sane groupings of gems}
12
+ spec.summary = %q{Cleanup your Gemfile by reordering gems into declarative groups}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency 'thor'
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.3"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency 'rspec'
26
+ spec.add_development_dependency 'pry'
27
+ end
@@ -0,0 +1,81 @@
1
+ require 'thor'
2
+
3
+ module Bundler
4
+ module Reorganizer
5
+ class CLI < Thor
6
+ attr_accessor :sources, :rubies, :groups, :current_group
7
+
8
+ desc "reorganize PATH_TO_GEMFILE [OPTIONS]", "reorganize Gemfile into groups of gems"
9
+ option :output, desc: 'path to write output of reorganized Gemfile', aliases: '-o'
10
+ def reorganize(gemfile_path)
11
+ @sources = []
12
+ @rubies = []
13
+ @groups = {}
14
+
15
+ parse gemfile_path
16
+ output_gemfile gemfile_path
17
+ end
18
+ default_command :reorganize
19
+
20
+ private
21
+
22
+ def output_gemfile(gemfile_path)
23
+ output_path = options[:output] || gemfile_path
24
+ output_buffer = File.open(output_path, 'w')
25
+ say "Writing reorganized Gemfile to: #{output_path}"
26
+
27
+ output_buffer << sources.map {|s| "source #{stringify_arg(*s)}"}.join("\n")
28
+ output_buffer << rubies.map {|s| "\nruby #{stringify_arg(*s)}"}.join("\n")
29
+
30
+ groups.each do |group, gems|
31
+ output_buffer << "\n"
32
+ indent = group == :default ? '' : ' '
33
+ output_buffer << "\ngroup #{stringify_args(*group)} do" unless group == :default
34
+ gems.each do |gem_args|
35
+ output_buffer << "\n#{indent}gem #{stringify_args(*gem_args.reject(&:empty?))}"
36
+ end
37
+ output_buffer << "\nend" unless group == :default
38
+ end
39
+ output_buffer << "\n"
40
+ end
41
+
42
+ # pretty print arguments as ruby parsable string
43
+ def stringify_args(*args)
44
+ args.map {|a| stringify_arg(a) }.join(', ')
45
+ end
46
+
47
+ def stringify_arg(arg)
48
+ arg.inspect
49
+ end
50
+
51
+ def source(*args)
52
+ sources << args
53
+ end
54
+
55
+ def ruby(*args)
56
+ rubies << args
57
+ end
58
+
59
+ def gem(*args)
60
+ options = args.last.is_a?(Hash) ? args.last : nil
61
+ group = current_group || (options && options.delete(:group))
62
+ group ||= :default
63
+ groups[group] ||= []
64
+ groups[group] << args
65
+ end
66
+
67
+ def group(*args, &block)
68
+ self.current_group = args
69
+ yield
70
+ ensure
71
+ current_group = nil
72
+ end
73
+
74
+ def parse(path)
75
+ say "Parsing Gemfile: #{path}"
76
+ contents = File.read path
77
+ instance_eval contents
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,5 @@
1
+ module Bundler
2
+ module Reorganizer
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ require "bundler/reorganizer/version"
2
+
3
+ module Bundler
4
+ module Reorganizer
5
+ # Your code goes here...
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,126 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bundler-reorganizer
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ryan Sonnek
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Reorganize your gemfile into sane groupings of gems
84
+ email:
85
+ - ryan@codecrate.com
86
+ executables:
87
+ - bundler-reorganizer
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - .gitignore
92
+ - CONTRIBUTING.md
93
+ - Gemfile
94
+ - LICENSE.txt
95
+ - README.md
96
+ - Rakefile
97
+ - bin/bundler-reorganizer
98
+ - bundler-reorganizer.gemspec
99
+ - lib/bundler/reorganizer.rb
100
+ - lib/bundler/reorganizer/cli.rb
101
+ - lib/bundler/reorganizer/version.rb
102
+ homepage: ''
103
+ licenses:
104
+ - MIT
105
+ metadata: {}
106
+ post_install_message:
107
+ rdoc_options: []
108
+ require_paths:
109
+ - lib
110
+ required_ruby_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - '>='
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ required_rubygems_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - '>='
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ requirements: []
121
+ rubyforge_project:
122
+ rubygems_version: 2.0.14
123
+ signing_key:
124
+ specification_version: 4
125
+ summary: Cleanup your Gemfile by reordering gems into declarative groups
126
+ test_files: []