Skip to content

Commit

Permalink
made sing new xxx work
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Greulich committed Apr 9, 2012
1 parent 47299c4 commit 1c072b0
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 105 deletions.
112 changes: 95 additions & 17 deletions bin/sing
Expand Up @@ -23,29 +23,107 @@ program_desc 'Sing will create the basic directory structure and base files for


version Sing::VERSION version Sing::VERSION


desc 'Describe some switch here' desc 'display the version'
switch [:s,:switch] switch [:v,:version]


desc 'Describe some flag here' desc 'runs with output (default)'
default_value 'the default' switch [:V,:verbose]
arg_name 'The name of the argument'
flag [:f,:flagname]


desc 'Describe new here' desc 'runs with minimal output'
arg_name 'Describe arguments to new here' switch [:q,:quiet]

# desc 'the project name'
# default_value 'my_app'
# arg_name 'project_name'
# flag [:p,:project]

desc 'Creates new project'
arg_name 'project_name'
command :new do |c| command :new do |c|
c.desc 'Describe a switch to new' # c.desc 'Describe a switch to new'
c.switch :s # c.switch :s


c.desc 'Describe a flag to new' # c.desc 'Describe a flag to new'
c.default_value 'default' # c.default_value 'default'
c.flag :f # c.flag :f
c.action do |global_options,options,args| c.action do |global_options,options,args|
###############################################################################
# From sow.rb #
# TODO: Clean up, test #
###############################################################################
# Here you can define the directory structure that you want on the base level
dir_structure = ['stylesheets','javascript','images']
javascript_dir = 'javascript'

#TODO Need to add some code for css and maybe some automatic image stuff
css_dir = 'stylesheets'

# This makes sure that a variable has been passed
if args.length == 0
puts "Please enter the name of your Project"
exit 0
end

# Sets the project name
project = args[0]
FileUtils.mkdir_p project
puts "#{project}:CREATED"
FileUtils.cd project
# Creates a XHTML Strict Doctype Index file
File.open("index.html", 'w') {|file|
file.puts "<!DOCTYPE html>"
file.puts "<html>"
file.puts " <head>"
file.puts " <title></title>"
file.puts " </head>"
file.puts " <body>"
file.puts " "
file.puts " </body>"
file.puts "</html>"}
puts "index.html........done"

# Runs through the array defined in options to create the Directory Structure.

dir_structure.each do |i|
FileUtils.mkdir_p i
puts "#{i}:CREATED"
end
#Here we load the base CSS file
File.open("stylesheets/style.css", 'w'){ |file|
file.puts "# Insert style Here"
}
puts "style.css.....done"
#this is where we load the JavaScript Libraries into the JavaScript folder
FileUtils.cd javascript_dir
Net::HTTP.start("script.aculo.us") { |http|
resp = http.get("/dist/scriptaculous-js-1.8.3.tar.bz2")
open("scriptaculous-js-1.8.3.tar.bz2", "wb") { |file|
file.write(resp.body)
}
}
puts "Prototype.........Downloaded"
puts "Scriptaculous.....Downloaded"

# TODO Need to add some code to extract the prototype/scriptaculous libraries

Net::HTTP.start("code.jquery.com") { |http|
resp = http.get("/jquery-1.4.2.js")
open("jquery-1.4.2.js", "wb") { |file|
file.write(resp.body)
}
}
puts "JQuery............Downloaded"


# Your command logic here Net::HTTP.start("mootools.net") { |http|

resp = http.get("/download/get/mootools-1.2.4-core-nc.js")
# If you have any errors, just raise them open("mootools-1.2.4-core-nc.js", "wb") { |file|
# raise "that command made no sense" file.write(resp.body)
}
}
puts "MooTools..........Downloaded"
###############################################################################
# END: From sow.rb #
###############################################################################
end end
end end


Expand Down
88 changes: 0 additions & 88 deletions sing.rb

This file was deleted.

0 comments on commit 1c072b0

Please sign in to comment.