I’m writing a gem that requires a config.ru file for it to start a sinatra app. My executable files are installed but the config.ru is not installed when I look at what the pace my gems get stored. This is the structure of my gem
gemservice
|-- bin
| |-- gemservice
|-- lib
| |-- gemservice
| | |-- version.rb
| |-- gemservice.rb
| |-- config.ru
|-- Gemfile
|-- gemservice.gemspec
|-- Rakefile
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.24
- RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [x86_64-darwin11.4.0]
- INSTALLATION DIRECTORY: /Users/Armanm/.rvm/gems/ruby-1.9.3-p194
- RUBY EXECUTABLE: /Users/Armanm/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
- EXECUTABLE DIRECTORY: /Users/Armanm/.rvm/gems/ruby-1.9.3-p194/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-11
- GEM PATHS:
- /Users/Armanm/.rvm/gems/ruby-1.9.3-p194
- /Users/Armanm/.rvm/gems/ruby-1.9.3-p194@global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
There is no sign of the config.ru file once the gem installed (using rake install command)
$ ls -la /Users/Armanm/.rvm/gems/ruby-1.9.3-p194/gems/gemservice-0.0.1/lib/
total 8
drwxr-xr-x 4 Armanm staff 136 24 Sep 13:52 .
drwxr-xr-x 10 Armanm staff 340 24 Sep 13:52 ..
drwxr-xr-x 3 Armanm staff 102 24 Sep 13:52 gemservice
-rw-r--r-- 1 Armanm staff 124 24 Sep 13:52 gemservice.rb
Oka this was a newbie question and it has a newbie answer.
So I found out the hard way that files that get listed in the gemsepc file end up getting packaged inside the gem. More specifically this code is what does it:
It uses git to populate the files it needs to package up when you build your gem. So the way to make sure my config.ru file was included was to make sure git knows about it using
git add lib/config.ru. Once the file was added to git it was included in my gem.