skeletal 0.0.0 → 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.
- data/README.md +1 -1
- data/VERSION +1 -1
- data/bin/skeletal +26 -0
- data/lib/skeletal.rb +57 -0
- data/spec/{appbones_spec.rb → skeletal_spec.rb} +3 -3
- data/spec/spec_helper.rb +1 -1
- metadata +9 -16
- data/.document +0 -5
- data/.gitignore +0 -21
- data/Rakefile +0 -57
- data/bin/appbones +0 -16
- data/features/appbones.feature +0 -9
- data/features/step_definitions/appbones_steps.rb +0 -0
- data/features/support/env.rb +0 -4
- data/lib/appbones.rb +0 -27
- data/lib/templates/app.erb +0 -19
data/README.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.1
|
data/bin/skeletal
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require File.join(File.expand_path(File.dirname(__FILE__)),'..', 'lib', 'skeletal')
|
4
|
+
require 'optparse'
|
5
|
+
|
6
|
+
options = {
|
7
|
+
:classic => true,
|
8
|
+
:rspec => false,
|
9
|
+
:cucumber => false
|
10
|
+
}
|
11
|
+
OptionParser.new do |opts|
|
12
|
+
opts.banner = "Usage: skeletal [OPTIONS] app_name"
|
13
|
+
opts.on("-c", "--classic", "Specify to use classic style of sinatra app (currently not the default)") do |dir|
|
14
|
+
options[:classic] = true
|
15
|
+
end
|
16
|
+
opts.on("-r", "--rspec", "Generate the bare rspec structure") do |dir|
|
17
|
+
options[:rspec] = true
|
18
|
+
end
|
19
|
+
opts.on("-u", "--cucumber", "Generate the bare cucumber structure") do |dir|
|
20
|
+
options[:cucumber] = true
|
21
|
+
end
|
22
|
+
end.parse!
|
23
|
+
|
24
|
+
raise "You must specify an app name" if ARGV.empty? || ARGV.first.strip.empty?
|
25
|
+
|
26
|
+
Skeletal.create! ARGV.first.strip, options
|
data/lib/skeletal.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
class Skeletal
|
4
|
+
def self.create! app_name
|
5
|
+
# Create the initial directory
|
6
|
+
# FileUtils.mkpath(File.expand_path(directory))
|
7
|
+
|
8
|
+
@app_dir = File.expand_path(app_name)
|
9
|
+
puts "Generating application #{app_name}..."
|
10
|
+
|
11
|
+
# Create the basic folder structure
|
12
|
+
|
13
|
+
folders = %w( app/models app/helpers app/views app/views/layouts lib logs config tasks db/migrations public/images public/js public/css )
|
14
|
+
unless options[:classic]
|
15
|
+
folders << 'app/routes'
|
16
|
+
end
|
17
|
+
if options[:rspec]
|
18
|
+
folders << 'spec'
|
19
|
+
end
|
20
|
+
if options[:cucumber]
|
21
|
+
folders << %w( features/step_definitions features/support )
|
22
|
+
end
|
23
|
+
|
24
|
+
folders.flatten.each do |dir|
|
25
|
+
puts '> '+dir
|
26
|
+
FileUtils.mkpath(File.join(@app_dir, dir))
|
27
|
+
end
|
28
|
+
|
29
|
+
# Create the application file
|
30
|
+
@app_file = File.join(File.expand_path(app_name), 'app', "#{app_name}.rb")
|
31
|
+
@class_name = app_name.downcase.gsub(/[-_\s]+/, ' ').split(' ').map{|word| word.capitalize }.join
|
32
|
+
puts '> '+@app_file
|
33
|
+
File.open(@app_file, 'w') do |file|
|
34
|
+
file.write(%Q{
|
35
|
+
require 'rubygems'
|
36
|
+
require 'sinatra'
|
37
|
+
|
38
|
+
class #{@class_name} < Sinatra::Application
|
39
|
+
|
40
|
+
configure do
|
41
|
+
# Configuration here
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
})
|
46
|
+
end
|
47
|
+
|
48
|
+
# Add a few files
|
49
|
+
['Gemfile', '.gitignore', 'spec/spec_helper.rb', "spec/#{app_name}_spec.rb" ].each do |file|
|
50
|
+
puts '> '+file
|
51
|
+
FileUtils.touch(File.join(@app_dir, file))
|
52
|
+
end
|
53
|
+
|
54
|
+
# Add everything to git
|
55
|
+
`cd #{@app_dir} && git init && git add . && git commit -m "Initial Commit"`
|
56
|
+
end
|
57
|
+
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
require '
|
2
|
+
require 'skeletal'
|
3
3
|
|
4
|
-
describe
|
4
|
+
describe Skeletal do
|
5
5
|
it 'should respond to creating an app bone structure' do
|
6
|
-
|
6
|
+
Skeletal.respond_to? :create!
|
7
7
|
end
|
8
8
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- BJ Neilsen
|
@@ -14,8 +14,8 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-08-
|
18
|
-
default_executable:
|
17
|
+
date: 2010-08-05 00:00:00 -06:00
|
18
|
+
default_executable: skeletal
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rake
|
@@ -115,27 +115,20 @@ dependencies:
|
|
115
115
|
description: A gem to handle generating application structures for non-rails applications. Currently supports only Sinatra.
|
116
116
|
email: bj.neilsen@gmail.com
|
117
117
|
executables:
|
118
|
-
-
|
118
|
+
- skeletal
|
119
119
|
extensions: []
|
120
120
|
|
121
121
|
extra_rdoc_files:
|
122
122
|
- LICENSE
|
123
123
|
- README.md
|
124
124
|
files:
|
125
|
-
- .document
|
126
|
-
- .gitignore
|
127
125
|
- LICENSE
|
128
126
|
- README.md
|
129
|
-
- Rakefile
|
130
127
|
- VERSION
|
131
|
-
-
|
132
|
-
-
|
133
|
-
- features/step_definitions/appbones_steps.rb
|
134
|
-
- features/support/env.rb
|
135
|
-
- lib/appbones.rb
|
136
|
-
- lib/templates/app.erb
|
137
|
-
- spec/appbones_spec.rb
|
128
|
+
- lib/skeletal.rb
|
129
|
+
- spec/skeletal_spec.rb
|
138
130
|
- spec/spec_helper.rb
|
131
|
+
- bin/skeletal
|
139
132
|
has_rdoc: true
|
140
133
|
homepage: http://github.com/localshred/skeletal
|
141
134
|
licenses: []
|
@@ -169,5 +162,5 @@ signing_key:
|
|
169
162
|
specification_version: 3
|
170
163
|
summary: Application structure generator
|
171
164
|
test_files:
|
172
|
-
- spec/
|
165
|
+
- spec/skeletal_spec.rb
|
173
166
|
- spec/spec_helper.rb
|
data/.document
DELETED
data/.gitignore
DELETED
data/Rakefile
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rake'
|
3
|
-
require 'bundler'
|
4
|
-
|
5
|
-
begin
|
6
|
-
require 'jeweler'
|
7
|
-
Jeweler::Tasks.new do |gem|
|
8
|
-
gem.name = 'skeletal'
|
9
|
-
gem.summary = %Q{Application structure generator}
|
10
|
-
gem.description = %Q{A gem to handle generating application structures for non-rails applications. Currently supports only Sinatra.}
|
11
|
-
gem.email = 'bj.neilsen@gmail.com'
|
12
|
-
gem.homepage = 'http://github.com/localshred/skeletal'
|
13
|
-
gem.authors = ['BJ Neilsen']
|
14
|
-
gem.add_bundler_dependencies
|
15
|
-
end
|
16
|
-
Jeweler::GemcutterTasks.new
|
17
|
-
rescue LoadError
|
18
|
-
puts 'Jeweler (or a dependency) not available. Install it with: gem install jeweler'
|
19
|
-
end
|
20
|
-
|
21
|
-
require 'rspec/core/rake_task'
|
22
|
-
RSpec::Core::RakeTask.new(:spec) do |spec|
|
23
|
-
# spec.libs << 'lib' << 'spec'
|
24
|
-
# spec.spec_files = FileList['spec/**/*_spec.rb']
|
25
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
26
|
-
end
|
27
|
-
|
28
|
-
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
29
|
-
# spec.libs << 'lib' << 'spec'
|
30
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
31
|
-
spec.rcov = true
|
32
|
-
end
|
33
|
-
|
34
|
-
task :spec => :check_dependencies
|
35
|
-
|
36
|
-
begin
|
37
|
-
require 'cucumber/rake/task'
|
38
|
-
Cucumber::Rake::Task.new(:features)
|
39
|
-
|
40
|
-
task :features => :check_dependencies
|
41
|
-
rescue LoadError
|
42
|
-
task :features do
|
43
|
-
abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
task :default => :spec
|
48
|
-
|
49
|
-
require 'rake/rdoctask'
|
50
|
-
Rake::RDocTask.new do |rdoc|
|
51
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
52
|
-
|
53
|
-
rdoc.rdoc_dir = 'rdoc'
|
54
|
-
rdoc.title = "appbones #{version}"
|
55
|
-
rdoc.rdoc_files.include('README*')
|
56
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
57
|
-
end
|
data/bin/appbones
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require File.join(File.expand_path(File.dirname(__FILE__)),'..', 'lib', 'appbones')
|
4
|
-
require 'optparse'
|
5
|
-
|
6
|
-
# options = {}
|
7
|
-
# OptionParser.new do |opts|
|
8
|
-
# opts.banner = "Usage: appbones [OPTIONS] app_name"
|
9
|
-
# opts.on("-d", "--directory", "Specify the base application directory") do |dir|
|
10
|
-
# options[:directory] = dir
|
11
|
-
# end
|
12
|
-
# end.parse!
|
13
|
-
|
14
|
-
raise "You must specify an app name" if ARGV.empty? || ARGV.first.strip.empty?
|
15
|
-
|
16
|
-
AppBones.create! ARGV.first.strip
|
data/features/appbones.feature
DELETED
File without changes
|
data/features/support/env.rb
DELETED
data/lib/appbones.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'erb'
|
2
|
-
require 'fileutils'
|
3
|
-
|
4
|
-
class AppBones
|
5
|
-
def self.create! app_name
|
6
|
-
# Create the initial directory
|
7
|
-
# FileUtils.mkpath(File.expand_path(directory))
|
8
|
-
|
9
|
-
@app_dir = File.expand_path(app_name)
|
10
|
-
puts @app_dir
|
11
|
-
|
12
|
-
# Create the basic folder structure
|
13
|
-
%w( app app/models app/helpers app/views app/views/layouts app/routes lib spec features features/step_definitions features/support config tmp tasks db db/migrations ).each do |dir|
|
14
|
-
puts dir
|
15
|
-
FileUtils.mkpath(File.join(@app_dir, dir))
|
16
|
-
end
|
17
|
-
|
18
|
-
# Create the application file
|
19
|
-
@app_file = File.join(File.expand_path(app_name), 'app', "#{name}.rb")
|
20
|
-
File.open(@app_file, 'w') do |file|
|
21
|
-
template = ERB.new 'templates/app.erb'
|
22
|
-
file.write(template.run(binding))
|
23
|
-
end
|
24
|
-
|
25
|
-
# Add everything to git
|
26
|
-
end
|
27
|
-
end
|
data/lib/templates/app.erb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'sinatra'
|
3
|
-
|
4
|
-
class <%= @name %> < Sinatra::Application
|
5
|
-
|
6
|
-
configure do
|
7
|
-
# Configuration here
|
8
|
-
end
|
9
|
-
|
10
|
-
helpers do
|
11
|
-
# Helper methods here
|
12
|
-
end
|
13
|
-
|
14
|
-
# Routes Here
|
15
|
-
get '/hi' do
|
16
|
-
"Hello World!"
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|