# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'vagrant-templated/version' Gem::Specification.new do |spec| spec.name = 'vagrant-templated' spec.version = Vagrant::Templated::VERSION spec.authors = ['Álvaro Faúndez'] spec.email = ['alvaro@faundez.net'] spec.summary = %q{Enable Vagrant to init with a Vagrantfile and Berksfile with specific configurations} spec.description = %q{Enable Vagrant to init with a Vagrantfile and Berksfile with specific configurations like Rails 5 and Vagrant Plugin} spec.homepage = 'https://github.com/afaundez/vagrant-templated' spec.license = 'MIT' # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host' # to allow pushing to a single host or delete this section to allow pushing to any host. if spec.respond_to?(:metadata) spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'" else raise 'RubyGems 2.0 or newer is required to protect against ' \ 'public gem pushes.' end spec.add_development_dependency 'bundler', '~> 1.15' spec.add_development_dependency 'rake', '~> 10.0' spec.add_development_dependency 'rspec', '~> 3.6' # spec.bindir = 'exe' # spec.files = `git ls-files -z`.split("\x0").reject do |f| # f.match(%r{^(test|spec|features)/}) # end # spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } # spec.require_paths = ['lib'] # copied from root_path = File.dirname(__FILE__) all_files = Dir.chdir(root_path) { Dir.glob("**/{*,.*}") } all_files.reject! { |file| [".", ".."].include?(File.basename(file)) } gitignore_path = File.join(root_path, ".gitignore") gitignore = File.readlines(gitignore_path) gitignore.map! { |line| line.chomp.strip } gitignore.reject! { |line| line.empty? || line =~ /^(#|!)/ } unignored_files = all_files.reject do |file| # Ignore any directories, the gemspec only cares about files next true if File.directory?(file) # Ignore any paths that match anything in the gitignore. We do # two tests here: # # - First, test to see if the entire path matches the gitignore. # - Second, match if the basename does, this makes it so that things # like '.DS_Store' will match sub-directories too (same behavior # as git). # gitignore.any? do |ignore| File.fnmatch(ignore, file, File::FNM_PATHNAME) || File.fnmatch(ignore, File.basename(file), File::FNM_PATHNAME) end end spec.files = unignored_files spec.executables = unignored_files.map { |f| f[/^bin\/(.*)/, 1] }.compact spec.require_path = 'lib' end