No commit activity in last 3 years
No release in over 3 years
Class for generating gem dependencies from Gemfile
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

gemspec_deps_gen

gem for generating project dependencies inside gemspec file

Installation

Add this line to to your Gemfile:

gem "gemspec_deps_gen"

And then execute:

$ bundle

Usage

Create <project_name>.gemspec.erb file:

Gem::Specification.new do |spec|
  spec.name = "sample"
  spec.summary = %q{Summary.}
  spec.description = %q{Description.}
  spec.email = "alexander.shvets@gmail.com"
  spec.authors = ["Alexander Shvets"]
  spec.homepage = "http://github.com/shvets/sample"

  spec.files = `git ls-files`.split($\)
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})

  spec.version = "1.0.0"

  <%= project_dependencies %>
end

You can see ERB fragment (project_dependencies) included inside the body of the specification.

Now, run this command:

$ gemspec_deps_gen <project_name>

It will generate <project_name>.gemspec and replace ERB fragment with dependencies from Gemfile:

Gem::Specification.new do |spec|
  ...

  spec.add_runtime_dependency "bundler", [">= 0"]
  spec.add_runtime_dependency "file_utils", [">= 0"]
  spec.add_development_dependency "gemcutter", [">= 0"]

end

As alternative, you can call it as rake command:

require "gemspec_deps_gen"

project_name = <your project name>

task :gen do
  generator = GemspecDepsGen.new project_name

  generator.generate_dependencies "spec", "#{project_name}.gemspec.erb", "#{project_name}.gemspec"
end
$ rake gen

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request