$: << "./lib"
require 'shoes'

Shoes.app do
	stack do
		flow do
			para "Project Name"
			@project_name = edit_line
		end
		
		flow do
			para "Author (That's you, yo!)"
			@author = edit_line
		end
		
		flow do
			para "Version Name"
			@version = edit_line
		end
		
		para "Where is this mess? Browse for your entry point rb file. "+
			"This shymaker will guess the remaining questions based on the path. "+
			"Feel free to correct the shymaker if it makes bold assumptions. ;)"
		
		flow do
			button "Browse to the entry point" do
				browse = ask_open_file
				sep = browse['/'] || '\\'
				parts = browse.split(sep)
				@path.text = parts[0..-2].join(sep) + sep
				@entry_rel.text = parts[-1]
				@dest.text = parts[0..-2].join(sep) +'.shy'
			end
		end
		
		flow do
			para "Absolute Path to zip up"
			@path = edit_line
		end
		
		flow do
			para "Entry point, relative to zipped up path"
			@entry_rel = edit_line
		end
		
		flow do
			para "Absolute Path to shy archive you'd like to create"
			@dest = edit_line
		end
		
		button "Make Shy" do  
		    @status.replace "Making a shy, please wait.."
			s = Shy.new
			s.name = @project_name.text
			s.creator = @author.text
			s.version = @version.text
			s.launch = @entry_rel.text
			Shy.c(@dest.text, s, @path.text)
			@status.replace "Shy made! So.. you can totally make another if you want."
		end
		
		flow do
		  para "Status: "
		  @status = para "Waiting for you to push the 'Make Shy' button"
		end
	end
end