Skip to content

Commit

Permalink
'bootstar init' now creates an empty dir structure
Browse files Browse the repository at this point in the history
Ref. #5
  • Loading branch information
Matteo Centenaro committed Sep 11, 2012
1 parent 469ae93 commit 16fa163
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 45 deletions.
12 changes: 4 additions & 8 deletions bin/bootstar
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#!/usr/bin/env ruby
require 'rubygems' # ruby1.9 doesn't "require" it though
require 'thor'
require 'bootstar/cli'

require 'bootstar'

begin
Bootstar::CLI.new *ARGV.dup
rescue StandardError => e
puts "Error: #{e.message}"
puts e.backtrace
end
Bootstar::CLI.start
21 changes: 12 additions & 9 deletions bootstar.gemspec
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "bootstar/version"
$:.push File.expand_path('../lib', __FILE__)
require 'bootstar/version'

Gem::Specification.new do |s|
s.name = "bootstar"
s.name = 'bootstar'
s.version = Bootstar::VERSION
s.authors = ["Giovanni Cappellotto"]
s.email = ["[email protected]"]
s.homepage = "http://github.com/hackatron/bootstar"
s.authors = ['Nicola Brisotto', 'Giovanni Cappellotto', 'Matteo Centenaro', 'Eugenio Depalo', 'Matteo Depalo', 'Francesco Tartaggia']

This comment has been minimized.

Copy link
@potomak

potomak Sep 11, 2012

Member

Hackatron team FTW!

s.email = ['[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]']
s.homepage = 'http://github.com/hackatron/bootstar'
s.summary = %q{A tool to bootstrap your service oriented app}
s.description = %q{Bootstar is a tool to bootstrap your service oriented app.}

s.rubyforge_project = "bootstar"
s.rubyforge_project = 'bootstar'

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
s.require_paths = ['lib']

s.add_dependency 'thor'

# specify any dependencies here; for example:
s.add_development_dependency "rspec"
s.add_development_dependency 'rspec'
s.add_development_dependency 'debugger'
# s.add_runtime_dependency "rest-client"
end
33 changes: 8 additions & 25 deletions lib/bootstar/cli.rb
Original file line number Diff line number Diff line change
@@ -1,29 +1,12 @@
require 'optparse'
require 'thor'

module Bootstar
class CLI

attr_accessor :params, :action

def initialize(*args)
@params = {}
@action = :output

OptionParser.new do |opts|
opts.banner = "Usage: bootstar new"

opts.on_tail("-h", "--help", "Show this message") do
puts opts
exit
end

if args.empty?
puts opts
exit
end
end.parse!(args)

puts "Bootstar executable..."
class CLI < Thor
desc 'init APP_NAME', 'Create a new basic bootstar app'
def init(name)
Dir.mkdir(File.join('.', name))
Dir.chdir(File.join('.', name))
['api', 'client', 'ruby'].each {|dir| Dir.mkdir(File.join('.', "#{name}-#{dir}"))}
end
end
end
end
29 changes: 29 additions & 0 deletions spec/acceptance/app_creation_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
require 'spec_helper'

describe 'App creation' do
context 'bootstar init' do
before(:all) do
system('bootstar init test-app')
end

after(:all) do
system('rm -rf test-app')
end

it 'should create folder with the app name' do
File.directory?('./test-app').should be_true
end

it 'should create a directory for the API' do
File.directory?('./test-app/test-app-api').should be_true
end

it 'should create a directory for the client' do
File.directory?('./test-app/test-app-client').should be_true
end

it 'should create a directory for the API wrapper gem' do
File.directory?('./test-app/test-app-ruby').should be_true
end
end
end
3 changes: 1 addition & 2 deletions spec/bootstar_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require 'spec_helper'

describe Bootstar do
pending "write it"
end
end
3 changes: 2 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
require 'rubygems'
require 'bundler/setup'

require 'bootstar'
# require 'bootstar'
require 'debugger'

RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
Expand Down

0 comments on commit 16fa163

Please sign in to comment.