Permalink
Browse files

Remove `gem` command, replace it by an option

This allows the project generator to generate a gemspec fitting the project add some files to assist
in gem development.
  • Loading branch information...
skade committed Jan 14, 2013
1 parent 6a87867 commit af1efbf18861fb21660481e29821465fa54e4dd8

This file was deleted.

Oops, something went wrong.
@@ -33,6 +33,7 @@ def self.banner; "padrino-gen project [name] [options]"; end
class_option :tiny, :desc => 'Generate tiny app skeleton', :aliases => '-i', :default => false, :type => :boolean
class_option :adapter, :desc => 'SQL adapter for ORM (sqlite, mysql, mysql2, postgres)', :aliases => '-a', :default => 'sqlite', :type => :string
class_option :template, :desc => 'Generate project from template', :aliases => '-p', :default => nil, :type => :string
class_option :gem, :desc => 'Generate project as a gem', :aliases => '-g', :default => false, :type => :boolean
# Definitions for the available customizable components
component_option :orm, 'database engine', :aliases => '-d', :choices => [:activerecord, :mini_record, :datamapper, :mongomapper, :mongoid, :sequel, :couchrest, :ohm, :mongomatic, :ripple], :default => :none
@@ -64,6 +65,12 @@ def setup_project
app_skeleton('app', options[:tiny])
template 'templates/Gemfile.tt', destination_root('Gemfile')
template 'templates/Rakefile.tt', destination_root('Rakefile')
if options.gem?
template 'templates/gem/gemspec.tt', destination_root(name + '.gemspec')
template 'templates/gem/README.md.tt', destination_root('README.md')
template 'templates/gem/lib/libname.tt', destination_root("lib/#{name}.rb")
template 'templates/gem/lib/libname/version.tt', destination_root("lib/#{name}/version.rb")
end
end
end
@@ -1,5 +1,8 @@
source :rubygems
# Distribute your app as a gem
<% unless options.gem? %>#<% end %> gemspec
# Server requirements
# gem 'thin' # or mongrel
# gem 'trinidad', :platform => 'jruby'

This file was deleted.

Oops, something went wrong.
@@ -0,0 +1,29 @@
# <%=name.camelcase%>
A padrino gem
## Usage
Add the following to your `Gemfile`:
```ruby
gem '<%=name%>'
```
and mount the app in your `apps.rb`:
```ruby
Padrino.mount("<%=name.camelcase%>::App").to("/<%=name%>")
```
## Development
The app can be run as a standalone Padrino application as you would expect from a normal one:
```ruby
$ bundle exec padrino start
# Alternatively
$ rackup #or thin or whatever
```
The Rakefile also works like the normal Padrino one and supports all standard integrations.
@@ -12,7 +12,7 @@ Gem::Specification.new do |gem|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.name = <%=name.inspect%>
gem.require_paths = ["lib"]
gem.require_paths = ["lib", "app"]
gem.version = <%=name.camelcase%>::VERSION
gem.add_dependency "padrino-core"

0 comments on commit af1efbf

Please sign in to comment.