Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jschairb committed Mar 13, 2013
0 parents commit c3e398b
Show file tree
Hide file tree
Showing 17 changed files with 288 additions and 0 deletions.
Empty file added .gitignore
Empty file.
2 changes: 2 additions & 0 deletions .rspec
@@ -0,0 +1,2 @@
--color
--format progress
2 changes: 2 additions & 0 deletions Gemfile
@@ -0,0 +1,2 @@
source 'https://rubygems.org'
gemspec
49 changes: 49 additions & 0 deletions Gemfile.lock
@@ -0,0 +1,49 @@
PATH
remote: .
specs:
alonzo (0.0.1)
gli (= 2.5.4)

GEM
remote: https://rubygems.org/
specs:
aruba (0.5.1)
childprocess (~> 0.3.6)
cucumber (>= 1.1.1)
rspec-expectations (>= 2.7.0)
builder (3.2.0)
childprocess (0.3.9)
ffi (~> 1.0, >= 1.0.11)
cucumber (1.2.3)
builder (>= 2.1.2)
diff-lcs (>= 1.1.3)
gherkin (~> 2.11.6)
multi_json (~> 1.3)
diff-lcs (1.2.1)
ffi (1.4.0)
gherkin (2.11.6)
json (>= 1.7.6)
gli (2.5.4)
json (1.7.7)
multi_json (1.6.1)
rake (10.0.3)
rdoc (4.0.0)
json (~> 1.4)
rspec (2.13.0)
rspec-core (~> 2.13.0)
rspec-expectations (~> 2.13.0)
rspec-mocks (~> 2.13.0)
rspec-core (2.13.0)
rspec-expectations (2.13.0)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.13.0)

PLATFORMS
ruby

DEPENDENCIES
alonzo!
aruba
rake
rdoc
rspec
6 changes: 6 additions & 0 deletions README.rdoc
@@ -0,0 +1,6 @@
= alonzo

Describe your project here

:include:alonzo.rdoc

44 changes: 44 additions & 0 deletions Rakefile
@@ -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('alonzo.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]
28 changes: 28 additions & 0 deletions alonzo.gemspec
@@ -0,0 +1,28 @@
# Ensure we require the local version and not one we might have installed already
require File.join([File.dirname(__FILE__),'lib','alonzo','version.rb'])
spec = Gem::Specification.new do |s|
s.name = 'alonzo'
s.version = Alonzo::VERSION
s.author = 'Joshua Schairbaum'
s.email = 'joshua.schairbaum@gmail.com'
s.homepage = 'https://github.com/jschairb/alonzo'
s.platform = Gem::Platform::RUBY
s.summary = 'Your command-line butler and confident'
# Add your other files here if you make them
s.files = %w(
bin/alonzo
lib/alonzo/version.rb
lib/alonzo.rb
)
s.require_paths << 'lib'
s.has_rdoc = true
s.extra_rdoc_files = ['README.rdoc','alonzo.rdoc']
s.rdoc_options << '--title' << 'alonzo' << '--main' << 'README.rdoc' << '-ri'
s.bindir = 'bin'
s.executables << 'alonzo'
s.add_development_dependency('rake')
s.add_development_dependency('rdoc')
s.add_development_dependency('aruba')
s.add_development_dependency('rspec')
s.add_runtime_dependency('gli','2.5.4')
end
5 changes: 5 additions & 0 deletions alonzo.rdoc
@@ -0,0 +1,5 @@
= alonzo

Generate this with
alonzo rdoc
After you have described your command line interface
57 changes: 57 additions & 0 deletions bin/alonzo
@@ -0,0 +1,57 @@
#!/usr/bin/env ruby
require 'gli'
begin # XXX: Remove this begin/rescue before distributing your app
require 'alonzo'
rescue LoadError
STDERR.puts "In development, you need to use `bundle exec bin/alonzo` 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/alonzo now"
exit 64
end

include GLI::App

program_desc 'A commandline butler and confidant'

version Alonzo::VERSION

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

desc "Generate rubigen-based templates"
arg_name 'template_names'
command :gen do |c|
c.action do |global, options, args|
#Alonzo::Generator.generate(options[:type], options[:root], args)
puts options
puts args.inspect
end

c.flag [:r, :root], default_value: Dir.pwd,
arg_name: 'project_root',
desc: 'The root directory for the project'

c.flag [:t, :type], default_value: :lib,
arg_name: 'template_type',
desc: 'The type of template to generate'
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)
8 changes: 8 additions & 0 deletions features/alonzo.feature
@@ -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 "alonzo"
Then the exit status should be 0
7 changes: 7 additions & 0 deletions features/step_definitions/alonzo_steps.rb
@@ -0,0 +1,7 @@
When /^I get help for "([^"]*)"$/ do |app_name|
@app_name = app_name
root = File.expand_path(File.join(File.dirname(__FILE__), "..", ".."))
step %(I run `bundle exec #{root}/bin/#{app_name} help`)
end

# Add more step definitions here
15 changes: 15 additions & 0 deletions features/support/env.rb
@@ -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
5 changes: 5 additions & 0 deletions lib/alonzo.rb
@@ -0,0 +1,5 @@
module Alonzo
end

require 'alonzo/version.rb'
require_relative 'alonzo/generator'
21 changes: 21 additions & 0 deletions lib/alonzo/generator.rb
@@ -0,0 +1,21 @@
require 'erb'

module Alonzo
class Generator
attr_accessor :args, :root, :type

def self.generate(type, root, args)
generator = new(type, root, args)
generator.generate
end

def initialize(type, root, args)
self.args = args
self.root = root
self.type = type
end

def generate
end
end
end
3 changes: 3 additions & 0 deletions lib/alonzo/version.rb
@@ -0,0 +1,3 @@
module Alonzo
VERSION = '0.0.1'
end
19 changes: 19 additions & 0 deletions spec/alonzo/generator_spec.rb
@@ -0,0 +1,19 @@
require 'spec_helper'

module Alonzo
describe Generator do
let(:generator) { Generator.new }

describe ".generate" do
end

describe ".new" do
it "sets the args attribute"
it "sets the root attribute"
it "sets the type attribute"
end

describe "#generate" do
end
end
end
17 changes: 17 additions & 0 deletions spec/spec_helper.rb
@@ -0,0 +1,17 @@
# This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# Require this file using `require "spec_helper"` to ensure that it is only
# loaded once.
#
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.run_all_when_everything_filtered = true
config.filter_run :focus

# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = 'random'
end

0 comments on commit c3e398b

Please sign in to comment.