Permalink
Browse files

create the provisional executable and document it

  • Loading branch information...
1 parent 5457ded commit 22f1ed858ce011f905b09e64e0868825c8af0230 @markcornick markcornick committed Jan 26, 2009
Showing with 82 additions and 8 deletions.
  1. +2 −1 .gitignore
  2. +18 −1 README.rdoc
  3. +4 −6 Rakefile
  4. +24 −0 bin/provisional
  5. +34 −0 provisional.gemspec
View
@@ -1,3 +1,4 @@
/pkg/
/doc/
-/coverage/
+/coverage/
+*.gem
View
@@ -12,7 +12,24 @@ In the future, Provisional may be expanded to create production and staging envi
== Usage
- provisional project_name
+ Options:
+ --name, -n <s>: Name of the project (required)
+ --scm, -s <s>: SCM to use (git or svn) (default: git)
+ --rails, -r <s>: Path to rails generator script (default: first occurrence of rails in $PATH)
+ --template, -t <s>: Rails template to use (default: viget)
+ --version, -v: Print version and exit
+ --help, -h: Show this message
+
+The default viget template does the following:
+
+* freezes edge rails
+* installs gems: mocha, factory_girl, shoulda
+* installs plugins: hoptoad_notifier, jrails, model_generator_with_factories, viget_deployment, vl_cruise_control
+* installs a .gitignore file to ignore logs, temp files, sqlite3 databases, rcov reports, and database.yml
+* generates Capistrano configuration with viget_deployment
+* copies database.yml to database.yml-sample
+* removes public/index.html, test/fixtures, prototype, and script.aculo.us
+* creates a SCM repository and checks the application in (FIXME: not yet)
== License
View
@@ -6,7 +6,7 @@ require 'lib/provisional/version'
task :default => :test
-spec = Gem::Specification.new do |s|
+spec = Gem::Specification.new do |s|
s.name = 'provisional'
s.version = Provisional::Version.to_s
s.has_rdoc = true
@@ -17,10 +17,8 @@ spec = Gem::Specification.new do |s|
s.email = 'mark@viget.com'
s.homepage = 'http://www.viget.com'
s.files = %w(README.rdoc Rakefile) + Dir.glob("{lib,test}/**/*")
-
- # FIXME: to be written
- # s.executables = ['provisional']
-
+ s.executables = ['provisional']
+ s.add_dependency('trollop', '>=1.10.2')
# FIXME: there are no 2.3.0 gems yet
# s.add_dependency('rails', '~> 2.3.0')
end
@@ -40,4 +38,4 @@ task :github do
file = File.dirname(__FILE__) + "/#{spec.name}.gemspec"
File.open(file, 'w') {|f| f << spec.to_ruby }
puts "Created gemspec: #{file}"
-end
+end
View
@@ -0,0 +1,24 @@
+#!/usr/bin/env ruby
+
+require 'rubygems'
+require 'provisional'
+require 'provisional/version'
+require 'trollop'
+
+opts = Trollop::options do
+ version "Provisional #{Provisional::Version}"
+ opt :name, "Name of the project", :type => String
+ opt :scm, "SCM to use (git or svn)", :type => String, :default => 'git'
+ opt :rails, "Path to rails generator script", :type => String, :default => `which rails`.chomp
+ opt :template, "Rails template to use", :type => String, :default => 'viget'
+end
+
+full_path_to_template = File.join(File.dirname(__FILE__),'..','lib','provisional','templates',"#{opts[:template]}.rb")
+
+Trollop::die(:name, "must be specified") unless opts[:name]
+Trollop::die(:scm, "is not supported: #{opts[:scm]}") unless %w(git svn).include?(opts[:scm])
+Trollop::die(:rails, "must be specified") if opts[:rails].to_s.empty?
+Trollop::die(:rails, "is not valid: #{opts[:rails]}") unless File.exist?(opts[:rails]) && File.executable?(opts[:rails])
+Trollop::die(:template, "is not valid: #{opts[:template]}") unless File.exist?(full_path_to_template)
+
+`#{opts[:rails]} #{opts[:name]} -m #{full_path_to_template}`
View
@@ -0,0 +1,34 @@
+# -*- encoding: utf-8 -*-
+
+Gem::Specification.new do |s|
+ s.name = %q{provisional}
+ s.version = "0.1.0"
+
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+ s.authors = ["Mark Cornick"]
+ s.date = %q{2009-01-26}
+ s.default_executable = %q{provisional}
+ s.email = %q{mark@viget.com}
+ s.executables = ["provisional"]
+ s.extra_rdoc_files = ["README.rdoc"]
+ s.files = ["README.rdoc", "Rakefile", "lib/provisional", "lib/provisional/templates", "lib/provisional/templates/viget.rb", "lib/provisional/version.rb", "lib/provisional.rb", "test/test_helper.rb", "test/unit", "test/unit/provisional_test.rb", "bin/provisional"]
+ s.has_rdoc = true
+ s.homepage = %q{http://www.viget.com}
+ s.rdoc_options = ["--main", "README.rdoc"]
+ s.require_paths = ["lib"]
+ s.rubygems_version = %q{1.3.1}
+ s.summary = %q{Automation for new Rails Projects}
+
+ if s.respond_to? :specification_version then
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
+ s.specification_version = 2
+
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
+ s.add_runtime_dependency(%q<trollop>, [">= 1.10.2"])
+ else
+ s.add_dependency(%q<trollop>, [">= 1.10.2"])
+ end
+ else
+ s.add_dependency(%q<trollop>, [">= 1.10.2"])
+ end
+end

0 comments on commit 22f1ed8

Please sign in to comment.