nikhaldi / exception_notification-rake

Sends mail upon failures in Rake tasks
MIT License
39 stars 14 forks source link

Remove 'git ls-files' from gemspec #2

Closed nvd closed 11 years ago

nvd commented 11 years ago

I just got bit by this.

Our prod environment doesn't have git and if you try adding a gem through git or path option in bundler, 'git ls-files' in the .gemspec fails.

similar issue

Wondering if it is better to specify files rather than count on git being installed. Thoughts?

--- a/exception_notification-rake.gemspec
+++ b/exception_notification-rake.gemspec
@@ -17,8 +17,7 @@ Gem::Specification.new do |s|
   s.add_runtime_dependency 'rake', '>= 0.9.0'
   s.add_development_dependency 'rails', '~> 3.2.0'

-  s.files         = `git ls-files`.split("\n")
-  s.test_files    = `git ls-files -- {test,spec,features}/*`.split("\n")
-  s.executables   = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+  s.files         = Dir['LICENSE.md', 'README.md', 'lib/**/*']
+  s.test_files    = Dir['test/**/*.rb']
   s.require_paths = ['lib']
 end
nikhaldi commented 11 years ago

If you look at the issue you reference, it seems Bundler is still recommending the git ls-files approach (their gemspec template uses it). Does the solution proposed in that issue (using Bundler 1.3) not work for you?

nvd commented 11 years ago

Yup I saw both of them. The proposed solution should work.

Unfortunately bundler actually says something different about .gemspec in their doc:

"It MUST NOT have any dependencies, other than on the files in the git repository itself and any built-in functionality of Ruby or Rubygems." Bundler doc

Ideally a .gemspec or any file should not be trying to include things it's not using anyway (like executables in this case)

I guess it's a matter of style (rails, simple_form don't use this approach; bundler, kaminari do). Anyways it's just a suggestion. Thanks for the push.

nikhaldi commented 11 years ago

Ok, I did some research to figure out what the best approach is here, and you're right that relying on git is not in general a good idea. I made the changes to the gemspec and pushed a new version 0.0.5. Hope that helps!