Permalink
Browse files

renamed Sow to sing

  • Loading branch information...
1 parent f505a43 commit 281a290ac8317726163947d8ec6f7d92c5137215 Ian Greulich committed Apr 4, 2012
Showing with 144 additions and 0 deletions.
  1. +56 −0 Readme.md
  2. +88 −0 sing.rb
View
@@ -0,0 +1,56 @@
+## Sing
+Making Sinatra even easier.
+
+Sing will create the basic directory structure and base files for a Sinatra
+webapp. It creates your Gemfile (containing haml, sass, and compass),
+config.ru, index.haml, application.scss, and downloads jquery for you.
+
+I created this with ruby 1.9.2, but it should work in 1.8.7 just fine.
+
+### Examples
+---
+Create a new project; from the dirctory you want the project directory
+to live in:
+
+ sing new my_project
+
+Other examples:
+
+ sing -p my_project
+ sing --verbose my_project
+
+### Usage
+---
+ sing [options] my_project
+
+For help use:
+
+ sing -h
+
+### Options
+---
+ -h, --help Displays help message
+ -v, --version Display the version
+ -q, --quiet Output as little as possible, overrides verbose
+ -V, --verbose Verbose output (default)
+
+### Authors
+---
+ Ian Greulich
+ Based on Sow by David Duggins
+
+### Copyright
+---
+ Copyright (c) 2012 Ian Greulich. Licensed under the MIT License:
+ http://www.opensource.org/licenses/mit-license.php
+ Copyright (c) 2010 David Duggins. Licensed under GPL2:
+ http://www.opensource.org/licenses/GPL-2.0
+
+### CHANGE LOG:
+---
+#### 2012.04.04
+Changed Readme.md to define the scope of the next steps of the development of Sing.
+#### 2010.05.14
+Added code to download three js libraries and also create a index.html file with the XHTML Strict Doctype.
+#### 2010.05.04
+Created the script, got the directory structure up and running
View
88 sing.rb
@@ -0,0 +1,88 @@
+#
+# Basic Ruby script to create a new project for basic web development
+#
+# Author: David Duggins
+# Email: weatheredwatcher@gmail.com
+#
+# Created: 5/4/2010
+# License: GPL2
+#
+
+require 'fileutils'
+require 'net/http'
+#OPTIONS
+
+# Here you can define the directory structure that you want on the base level
+dir_structure = ['stylesheets','javascript','images','db']
+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 ARGV.length == 0
+ puts "Please enter the name of your Project"
+ exit 0
+end
+
+# Sets the project name
+project = ARGV[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"
+=begin
+ TODO Need to add some code to extract the prototype/scriptaculous libraries
+=end
+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"
+
+Net::HTTP.start("mootools.net") { |http|
+ resp = http.get("/download/get/mootools-1.2.4-core-nc.js")
+ open("mootools-1.2.4-core-nc.js", "wb") { |file|
+ file.write(resp.body)
+ }
+}
+puts "MooTools..........Downloaded"
+

0 comments on commit 281a290

Please sign in to comment.