Permalink
Browse files

Add GLI Scaffolding

  • Loading branch information...
1 parent 435bc08 commit 7d30400b15b14986f47754a729d23f752dc0f3cc @groundwater committed Jan 6, 2013
View
@@ -0,0 +1,2 @@
+source :rubygems
+gemspec
View
@@ -0,0 +1,6 @@
+= binfuse
+
+Describe your project here
+
+:include:binfuse.rdoc
+
View
@@ -0,0 +1,44 @@
+require 'rake/clean'
+require 'rubygems'
+require 'rubygems/package_task'
+require 'rdoc/task'
+require 'cucumber'
+require 'cucumber/rake/task'
+Rake::RDocTask.new do |rd|
+ rd.main = "README.rdoc"
+ rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
+ rd.title = 'Your application title'
+end
+
+spec = eval(File.read('binfuse.gemspec'))
+
+Gem::PackageTask.new(spec) do |pkg|
+end
+CUKE_RESULTS = 'results.html'
+CLEAN << CUKE_RESULTS
+desc 'Run features'
+Cucumber::Rake::Task.new(:features) do |t|
+ opts = "features --format html -o #{CUKE_RESULTS} --format progress -x"
+ opts += " --tags #{ENV['TAGS']}" if ENV['TAGS']
+ t.cucumber_opts = opts
+ t.fork = false
+end
+
+desc 'Run features tagged as work-in-progress (@wip)'
+Cucumber::Rake::Task.new('features:wip') do |t|
+ tag_opts = ' --tags ~@pending'
+ tag_opts = ' --tags @wip'
+ t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty -x -s#{tag_opts}"
+ t.fork = false
+end
+
+task :cucumber => :features
+task 'cucumber:wip' => 'features:wip'
+task :wip => 'features:wip'
+require 'rake/testtask'
+Rake::TestTask.new do |t|
+ t.libs << "test"
+ t.test_files = FileList['test/*_test.rb']
+end
+
+task :default => [:test,:features]
View
@@ -0,0 +1,91 @@
+#!/usr/bin/env ruby
+require 'gli'
+begin # XXX: Remove this begin/rescue before distributing your app
+require 'binfuse'
+rescue LoadError
+ STDERR.puts "In development, you need to use `bundle exec bin/binfuse` to run your app"
+ STDERR.puts "At install-time, RubyGems will make sure lib, etc. are in the load path"
+ STDERR.puts "Feel free to remove this message from bin/binfuse now"
+ exit 64
+end
+
+include GLI::App
+
+program_desc 'Describe your application here'
+
+version Binfuse::VERSION
+
+desc 'Describe some switch here'
+switch [:s,:switch]
+
+desc 'Describe some flag here'
+default_value 'the default'
+arg_name 'The name of the argument'
+flag [:f,:flagname]
+
+desc 'Describe create here'
+arg_name 'Describe arguments to create here'
+command :create do |c|
+ c.desc 'Describe a switch to create'
+ c.switch :s
+
+ c.desc 'Describe a flag to create'
+ c.default_value 'default'
+ c.flag :f
+ c.action do |global_options,options,args|
+
+ # Your command logic here
+
+ # If you have any errors, just raise them
+ # raise "that command made no sense"
+
+ puts "create command ran"
+ end
+end
+
+desc 'Describe test here'
+arg_name 'Describe arguments to test here'
+command :test do |c|
+ c.action do |global_options,options,args|
+ puts "test command ran"
+ end
+end
+
+desc 'Describe spawn here'
+arg_name 'Describe arguments to spawn here'
+command :spawn do |c|
+ c.action do |global_options,options,args|
+ puts "spawn command ran"
+ end
+end
+
+desc 'Describe publish here'
+arg_name 'Describe arguments to publish here'
+command :publish do |c|
+ c.action do |global_options,options,args|
+ puts "publish command ran"
+ end
+end
+
+pre do |global,command,options,args|
+ # Pre logic here
+ # Return true to proceed; false to abort and not call the
+ # chosen command
+ # Use skips_pre before a command to skip this block
+ # on that command only
+ true
+end
+
+post do |global,command,options,args|
+ # Post logic here
+ # Use skips_post before a command to skip this
+ # block on that command only
+end
+
+on_error do |exception|
+ # Error logic here
+ # return false to skip default error handling
+ true
+end
+
+exit run(ARGV)
View
@@ -1,22 +1,27 @@
-Gem::Specification.new do |s|
-
- s.name = "binfuse"
- s.version = "0.0.1"
- s.platform = Gem::Platform::RUBY
-
- s.authors = ["Jacob Groundwater"]
- s.email = ["groundwater@gmail.com"]
-
- s.homepage = "http://github.com/jacobgroundwater/binary-fusion"
- s.summary = "A Rapid Application Development and Distribution Tool"
- s.description = %q{Hi}
-
- s.rubyforge_project = "binary-fusion"
-
- s.files = ["bin/binfuse.rb"]
- s.executables = ["binfuse.rb"]
-
- # Dependencies
- s.add_dependency("gli")
-
-end
+# Ensure we require the local version and not one we might have installed already
+require File.join([File.dirname(__FILE__),'lib','binfuse','version.rb'])
+spec = Gem::Specification.new do |s|
+ s.name = 'binfuse'
+ s.version = Binfuse::VERSION
+ s.author = 'Your Name Here'
+ s.email = 'your@email.address.com'
+ s.homepage = 'http://your.website.com'
+ s.platform = Gem::Platform::RUBY
+ s.summary = 'A description of your project'
+# Add your other files here if you make them
+ s.files = %w(
+bin/binfuse
+lib/binfuse/version.rb
+lib/binfuse.rb
+ )
+ s.require_paths << 'lib'
+ s.has_rdoc = true
+ s.extra_rdoc_files = ['README.rdoc','binfuse.rdoc']
+ s.rdoc_options << '--title' << 'binfuse' << '--main' << 'README.rdoc' << '-ri'
+ s.bindir = 'bin'
+ s.executables << 'binfuse'
+ s.add_development_dependency('rake')
+ s.add_development_dependency('rdoc')
+ s.add_development_dependency('aruba')
+ s.add_runtime_dependency('gli','2.5.3')
+end
View
@@ -0,0 +1,5 @@
+= binfuse
+
+Generate this with
+ binfuse rdoc
+After you have described your command line interface
@@ -0,0 +1,8 @@
+Feature: My bootstrapped app kinda works
+ In order to get going on coding my awesome app
+ I want to have aruba and cucumber setup
+ So I don't have to do it myself
+
+ Scenario: App just runs
+ When I get help for "binfuse"
+ Then the exit status should be 0
@@ -0,0 +1,6 @@
+When /^I get help for "([^"]*)"$/ do |app_name|
+ @app_name = app_name
+ step %(I run `#{app_name} help`)
+end
+
+# Add more step definitions here
@@ -0,0 +1,15 @@
+require 'aruba/cucumber'
+
+ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
+LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')
+
+Before do
+ # Using "announce" causes massive warnings on 1.9.2
+ @puts = true
+ @original_rubylib = ENV['RUBYLIB']
+ ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
+end
+
+After do
+ ENV['RUBYLIB'] = @original_rubylib
+end
View
@@ -0,0 +1,4 @@
+require 'binfuse/version.rb'
+
+# Add requires for other files you add to your project here, so
+# you just need to require this one file in your bin file
@@ -0,0 +1,3 @@
+module Binfuse
+ VERSION = '0.0.1'
+end
View
@@ -0,0 +1,14 @@
+require 'test_helper'
+
+class DefaultTest < Test::Unit::TestCase
+
+ def setup
+ end
+
+ def teardown
+ end
+
+ def test_the_truth
+ assert true
+ end
+end
View
@@ -0,0 +1,9 @@
+require 'test/unit'
+
+# Add test libraries you want to use here, e.g. mocha
+
+class Test::Unit::TestCase
+
+ # Add global extensions to the test case class here
+
+end

0 comments on commit 7d30400

Please sign in to comment.