braces 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in braces.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2011 Christopher Meiklejohn
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,30 @@
1
+ = Braces
2
+
3
+ Bootstrap sinatra applications with a minimal template and rspec.
4
+
5
+ == Usage
6
+
7
+ Include:
8
+
9
+ gem install braces
10
+
11
+ Run:
12
+
13
+ braces APP_NAME
14
+
15
+ Voila!
16
+
17
+ == What's in the package?
18
+
19
+ * Sinatra
20
+ * Thin
21
+ * Shotgun
22
+ * RSpec
23
+
24
+ == License
25
+
26
+ Braces is Copyright © 2011 Christopher Meiklejohn. It is free software, and may be redistributed under the terms specified in the LICENSE file.
27
+
28
+ == About
29
+
30
+ The braces gem was written by {Christopher Meiklejohn}[mailto:cmeiklejohn@swipely.com]
@@ -0,0 +1,28 @@
1
+ require 'bundler'
2
+ require 'rake/clean'
3
+ require 'rake/testtask'
4
+ require 'cucumber'
5
+ require 'cucumber/rake/task'
6
+ require 'rdoc/task'
7
+
8
+ include Rake::DSL
9
+
10
+ Bundler::GemHelper.install_tasks
11
+
12
+ Rake::TestTask.new do |t|
13
+ t.pattern = 'test/tc_*.rb'
14
+ end
15
+
16
+ CUKE_RESULTS = 'results.html'
17
+ CLEAN << CUKE_RESULTS
18
+ Cucumber::Rake::Task.new(:features) do |t|
19
+ t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format progress -x"
20
+ t.fork = false
21
+ end
22
+
23
+ Rake::RDocTask.new do |rd|
24
+ rd.main = "README.rdoc"
25
+ rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
26
+ end
27
+
28
+ task :default => [:test, :cucumber]
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.push File.expand_path("../../lib", __FILE__)
4
+
5
+ require 'fileutils'
6
+ require 'optparse'
7
+ require 'methadone'
8
+ require 'methadone/cli'
9
+ require 'braces'
10
+
11
+ include FileUtils
12
+ include Methadone::Main
13
+ include Methadone::CLI
14
+ include Braces
15
+
16
+ main do |name|
17
+ check_and_prepare_basedir!(name,options[:force])
18
+
19
+ app_name = File.basename(name)
20
+ app_name = app_name.downcase
21
+ app_name_constant = app_name.capitalize
22
+
23
+ chdir File.dirname(name)
24
+
25
+ debug "Creating project for sinatra app #{app_name}"
26
+
27
+ mkdir_p app_name
28
+
29
+ chdir app_name
30
+
31
+ template_dirs_in(:full).each { |dir| mkdir_p dir }
32
+
33
+ ["config.ru", "Gemfile", "Rakefile", "spec/spec_helper.rb"].each do |file|
34
+ copy_file file, :binding => binding
35
+ end
36
+
37
+ copy_file "lib/application.rb", :as => "#{app_name}.rb", :binding => binding
38
+ end
39
+
40
+ description "Braces help you quickly bootstrap a sinatra application."
41
+
42
+ on("--force","Overwrite files if they exist")
43
+
44
+ arg :app_name
45
+
46
+ go!
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "braces/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "braces"
7
+ s.version = Braces::VERSION
8
+ s.authors = ["Christopher Meiklejohn"]
9
+ s.email = ["christopher.meiklejohn@gmail.com"]
10
+ s.homepage = "https://github.com/cmeiklejohn/braces"
11
+ s.summary = %q{Braces help you quickly bootstrap a sinatra application.}
12
+ s.description = %q{Braces help you quickly bootstrap a sinatra application.}
13
+
14
+ s.rubyforge_project = "braces"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_development_dependency('rdoc')
22
+ s.add_development_dependency('aruba')
23
+ s.add_development_dependency('rake','~> 0.9.2')
24
+ s.add_dependency('methadone')
25
+ end
@@ -0,0 +1,37 @@
1
+ Feature: Bootstrap a sinatra application
2
+
3
+ In order to be able to make a lot of sinatra apps
4
+ As a great developer
5
+ I need a tool to let me bootstrap them quickly
6
+
7
+ Background:
8
+ Given the directory "tmp/thingy" does not exist
9
+
10
+ Scenario: Get help
11
+ When I run `braces --help`
12
+ Then the exit status should be 0
13
+ And the output should contain:
14
+ """
15
+ Usage: braces [options] app_name
16
+
17
+ Braces help you quickly bootstrap a sinatra application.
18
+
19
+ Options:
20
+ --force Overwrite files if they exist
21
+ """
22
+
23
+ Scenario: Bootstrap
24
+ When I successfully run `braces tmp/thingy`
25
+ Then the following directories should exist:
26
+ |tmp/thingy |
27
+ |tmp/thingy/lib |
28
+ |tmp/thingy/spec |
29
+ And the following files should exist:
30
+ |tmp/thingy/config.ru |
31
+ |tmp/thingy/Gemfile |
32
+ |tmp/thingy/Rakefile |
33
+ |tmp/thingy/lib/thingy.rb |
34
+ |tmp/thingy/spec/spec_helper.rb |
35
+ And the file "tmp/thingy/config.ru" should match /Thingy.app/
36
+ And the file "tmp/thingy/spec/spec_helper.rb" should match /Thingy.app/
37
+ And the file "tmp/thingy/lib/thingy.rb" should match /module Thingy/
@@ -0,0 +1,7 @@
1
+ require 'fileutils'
2
+ include FileUtils
3
+
4
+ Given /^the directory "([^"]*)" does not exist$/ do |dir|
5
+ dir = File.join(ARUBA_DIR,dir)
6
+ rm_rf dir,:verbose => false, :secure => true
7
+ end
@@ -0,0 +1,13 @@
1
+ require 'aruba/cucumber'
2
+ require 'methadone/cucumber'
3
+
4
+ ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
5
+
6
+ PROJECT_ROOT = File.join(File.dirname(__FILE__),'..','..')
7
+ ENV['PATH'] = "#{File.join(PROJECT_ROOT,'bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
8
+ ARUBA_DIR = File.join(%w(tmp aruba))
9
+ Before do
10
+ @dirs = [ARUBA_DIR]
11
+ @puts = true
12
+ @aruba_timeout_seconds = 60
13
+ end
@@ -0,0 +1,7 @@
1
+ require "braces/version"
2
+
3
+ module Braces
4
+ def template_dir(from)
5
+ File.join(File.dirname(__FILE__),'..','templates',from.to_s)
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ module Braces
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,16 @@
1
+ source :rubygems
2
+
3
+ gem 'sinatra'
4
+
5
+ gem 'rack'
6
+ gem 'rake'
7
+
8
+ gem 'thin'
9
+
10
+ group :test do
11
+ gem 'rspec'
12
+ end
13
+
14
+ group :development do
15
+ gem 'shotgun'
16
+ end
@@ -0,0 +1,13 @@
1
+ require 'rubygems/package_task'
2
+ require 'rubygems/specification'
3
+ require 'bundler'
4
+ require 'rspec/core/rake_task'
5
+
6
+ require "<%= app_name %>"
7
+
8
+ task :default => [:spec]
9
+
10
+ RSpec::Core::RakeTask.new do |spec|
11
+ spec.pattern = 'spec/**/*_spec.rb'
12
+ spec.rspec_opts = ['--backtrace']
13
+ end
@@ -0,0 +1,9 @@
1
+ # encoding: UTF-8
2
+
3
+ ENV['RACK_ENV'] ||= 'development'
4
+
5
+ $LOAD_PATH << File.dirname(__FILE__) + '/lib'
6
+
7
+ require "<%= app_name %>"
8
+
9
+ run <%= app_name_constant %>.app
@@ -0,0 +1,16 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ require 'sinatra'
6
+
7
+ module <%= app_name_constant %>
8
+ class Application < Sinatra::Base
9
+ end
10
+
11
+ def self.app
12
+ @app ||= Rack::Builder.new do
13
+ run Application
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,18 @@
1
+ # encoding: UTF-8
2
+
3
+ ENV["RACK_ENV"] ||= "test"
4
+
5
+ $LOAD_PATH << File.dirname(__FILE__) + '/lib'
6
+
7
+ require 'rspec'
8
+ require 'rack/test'
9
+
10
+ require "<%= app_name %>"
11
+
12
+ RSpec.configure do |config|
13
+ config.include(Rack::Test::Methods)
14
+
15
+ def app
16
+ <%= app_name_constant %>.app
17
+ end
18
+ end
@@ -0,0 +1,4 @@
1
+ require 'minitest/autorun'
2
+
3
+ class TestSomething < MiniTest::Unit::TestCase
4
+ end
metadata ADDED
@@ -0,0 +1,116 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: braces
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Christopher Meiklejohn
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-10-17 00:00:00.000000000 -04:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rdoc
17
+ requirement: &21266680 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: *21266680
26
+ - !ruby/object:Gem::Dependency
27
+ name: aruba
28
+ requirement: &21266240 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: *21266240
37
+ - !ruby/object:Gem::Dependency
38
+ name: rake
39
+ requirement: &21264980 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ version: 0.9.2
45
+ type: :development
46
+ prerelease: false
47
+ version_requirements: *21264980
48
+ - !ruby/object:Gem::Dependency
49
+ name: methadone
50
+ requirement: &21264060 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ type: :runtime
57
+ prerelease: false
58
+ version_requirements: *21264060
59
+ description: Braces help you quickly bootstrap a sinatra application.
60
+ email:
61
+ - christopher.meiklejohn@gmail.com
62
+ executables:
63
+ - braces
64
+ extensions: []
65
+ extra_rdoc_files: []
66
+ files:
67
+ - .gitignore
68
+ - Gemfile
69
+ - LICENSE
70
+ - README.rdoc
71
+ - Rakefile
72
+ - bin/braces
73
+ - braces.gemspec
74
+ - features/braces.feature
75
+ - features/step_definitions/braces_steps.rb
76
+ - features/support/env.rb
77
+ - lib/braces.rb
78
+ - lib/braces/version.rb
79
+ - templates/full/Gemfile.erb
80
+ - templates/full/Rakefile.erb
81
+ - templates/full/config.ru.erb
82
+ - templates/full/lib/application.rb.erb
83
+ - templates/full/spec/spec_helper.rb.erb
84
+ - test/tc_something.rb
85
+ has_rdoc: true
86
+ homepage: https://github.com/cmeiklejohn/braces
87
+ licenses: []
88
+ post_install_message:
89
+ rdoc_options: []
90
+ require_paths:
91
+ - lib
92
+ required_ruby_version: !ruby/object:Gem::Requirement
93
+ none: false
94
+ requirements:
95
+ - - ! '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ segments:
99
+ - 0
100
+ hash: -3256966709004082142
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ none: false
103
+ requirements:
104
+ - - ! '>='
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ segments:
108
+ - 0
109
+ hash: -3256966709004082142
110
+ requirements: []
111
+ rubyforge_project: braces
112
+ rubygems_version: 1.6.2
113
+ signing_key:
114
+ specification_version: 3
115
+ summary: Braces help you quickly bootstrap a sinatra application.
116
+ test_files: []