Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Version bump to 0.0.0
  • Loading branch information
anuj dutta authored and anuj dutta committed Nov 21, 2009
1 parent 9caea64 commit f97969a
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 33 deletions.
3 changes: 2 additions & 1 deletion Rakefile
Expand Up @@ -6,7 +6,7 @@ begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "decoct"
gem.summary = "Its a simple gem which creates a project structure for sinatra to work with rspec, ZenTest, Growl, RedGreen, Rcov"
gem.summary = "Its a simple gem which creates a project structure for sinatra to work with rspec, ZenTest, RedGreen, Rcov"
gem.email = "anuj@andhapp.com"
gem.homepage = "http://github.com/andhapp/decoct"
gem.description = "Sinatra Rspec project generator"
Expand All @@ -16,6 +16,7 @@ begin
gem.add_dependency 'redgreen'
gem.add_dependency 'rcov'
end
Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
end
Expand Down
1 change: 1 addition & 0 deletions VERSION
@@ -0,0 +1 @@
0.0.0
2 changes: 1 addition & 1 deletion bin/decoct
Expand Up @@ -4,4 +4,4 @@ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), "..", 'lib')
require 'decoct'

decoct = Decoct::Dscript.new(app_path)
decoct.run
decoct.run
2 changes: 2 additions & 0 deletions lib/decoct.rb
@@ -1,3 +1,5 @@
$: << File.join(File.dirname(__FILE__), "..", "lib")

require 'decoct/dconstants'
require 'decoct/dmeta'
require 'decoct/dscript'
17 changes: 4 additions & 13 deletions lib/decoct/dscript.rb
Expand Up @@ -19,40 +19,31 @@ def run
create_spec
create_views
create_public
create_icons
copy_autotest_file
copy_rspec_files
copy_app_file
copy_icons
end

def create_app_dir
Dir.mkdir("#{app_name}") if !test(?d, "#{app_name}")
puts "Created application directory - #{app_name}"
puts "\nCreated application directory - #{app_name}"
end

def copy_autotest_file
copy_file(".autotest", "#{app_name}#{File::SEPARATOR}.autotest")
puts "Copied autotest files"
puts "\nCopied autotest files"
end

def copy_rspec_files
from = ["spec#{File::SEPARATOR}spec.opts", "spec#{File::SEPARATOR}rcov.opts", "spec#{File::SEPARATOR}spec_helper.rb", "spec#{File::SEPARATOR}app_spec.rb"]
to = ["#{app_name}#{File::SEPARATOR}spec#{File::SEPARATOR}spec.opts", "#{app_name}#{File::SEPARATOR}spec#{File::SEPARATOR}rcov.opts", "#{app_name}#{File::SEPARATOR}spec#{File::SEPARATOR}spec_helper.rb", "#{app_name}#{File::SEPARATOR}spec#{File::SEPARATOR}#{app_name}_spec.rb"]
copy_file(from, to)
puts "Copied rspec files"
puts "\nCopied rspec files"
end

def copy_app_file
copy_file("generic_app.rb", "#{app_name}#{File::SEPARATOR}#{app_name}.rb")
puts "Copied application file"
end

def copy_icons
from = ["icons#{File::SEPARATOR}fail.png", "icons#{File::SEPARATOR}ok.png"]
to = [ "#{app_name}#{File::SEPARATOR}icons#{File::SEPARATOR}fail.png", "#{app_name}#{File::SEPARATOR}icons#{File::SEPARATOR}ok.png"]
copy_file(from, to)
puts "Copied icons"
puts "\nCopied application file"
end

end
Expand Down
2 changes: 1 addition & 1 deletion lib/templates/generic_app.rb
@@ -1,6 +1,6 @@
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../sinatra/lib'

%w{rubygems sinatra}.each {|x| require x}
%w{sinatra}.each {|x| require x}

get '/' do
'It works!!!'
Expand Down
Binary file removed lib/templates/icons/fail.png
Binary file not shown.
Binary file removed lib/templates/icons/ok.png
Binary file not shown.
4 changes: 1 addition & 3 deletions lib/templates/spec/spec_helper.rb
@@ -1,6 +1,4 @@
require 'spec/autorun'

%w{spec spec/interop/test rack/test}.each {|x| require x}
%w{spec spec/autorun spec/interop/test rack/test}.each {|x| require x}

set :environment, :test

Expand Down
13 changes: 3 additions & 10 deletions test/decoct/ts_script.rb
Expand Up @@ -6,7 +6,7 @@ def dir_in_app_folder
Dir.entries("epoxys").each {|x| [] << x if !File.directory?(x)}
end

context "creating a brand new sinatra-rspec app" do
context "Creation - sinatra-rspec app" do
setup do
@script = Decoct::Dscript.new('epoxys')
@app_name = @script.app_name
Expand Down Expand Up @@ -53,21 +53,14 @@ def dir_in_app_folder
@script.copy_app_file
assert File.exists?("#{@app_name}#{File::SEPARATOR}#{@app_name}.rb")
end

should 'copy the icons' do
@script.create_icons
@script.copy_icons
assert File.exists?("#{@app_name}#{File::SEPARATOR}icons#{File::SEPARATOR}fail.png")
assert File.exists?("#{@app_name}#{File::SEPARATOR}icons#{File::SEPARATOR}ok.png")
end


teardown do
FileUtils.rmtree @app_name
end

end

context "raise exception when app name is nil or empty" do
context "Exceptions" do

should 'raise an error if there is app_name is empty' do
assert_raises(RuntimeError) {Decoct::Dscript.new('')}
Expand Down
5 changes: 1 addition & 4 deletions test/test_helper.rb
@@ -1,5 +1,2 @@
$: << File.join(File.dirname(__FILE__), "/../lib")

%w(redgreen test/unit shoulda fileutils).each{|x| require x}

require 'decoct'
require File.join(File.dirname(__FILE__), "..", "lib", "decoct")

0 comments on commit f97969a

Please sign in to comment.