Permalink
Browse files

Added output for all commands.

Fixed YAMLHelper, which is used by db.save_yaml
  • Loading branch information...
listrophy committed Dec 1, 2008
1 parent 11dcc14 commit 9f6963a650ae022972139e44792126425e7bdf29
Showing with 32 additions and 18 deletions.
  1. +10 −18 lib/runner.rb
  2. +22 −0 lib/yaml_helper.rb
View
@@ -56,22 +56,21 @@ def run
db = DB.new Runner.app_name
@base = File.expand_path "./#{Runner.app_name}"
Dir.mkdir(@base)
- # text = File.read(@runfile).split('\n')
- # text.each {|l| instance_eval(l)}
text = File.read(@runfile)
instance_eval(text)
end
def sources sourcefolder
@sources = File.expand_path "#{sourcefolder}/"
+ puts "Using #{@sources} for file sources"
end
def rails
- `rails #{Runner.app_name}`
+ shell "rails #{Runner.app_name}"
end
def frozen_rails
- `rails #{Runner.app_name} --freeze`
+ shell "rails #{Runner.app_name} --freeze"
end
def debug p = ''
@@ -88,6 +87,7 @@ def generate generator, *opts
def folder folder_name
path = "#{@base}/"
+ puts "New folder: #{@base}"
paths = folder_name.split('/')
paths.each do |p|
path += "#{p}/"
@@ -103,11 +103,12 @@ def file source_file, destination, absolute = false
source = File.expand_path "#{@sources}/#{source_file}"
end
dest = File.expand_path "./#{Runner.app_name}/#{destination}"
- File.copy(source, dest, false) if File.exists? source
+ File.copy(source, dest, true) if File.exists? source
end
def delete file_name
file_name = "#{@base}/#{file_name}"
+ puts "Deleting: #{@file_name}"
File.delete file_name if File.exists?(file_name)
end
@@ -135,21 +136,11 @@ def rake *opts
end
def git
- gem = false
- begin
- gem = require 'git'
- rescue LoadError => e
- nil
- end
- if gem
- g = Git.init(@base)
- else
- runinside 'git init'
- end
+ runinside('git init')
end
def svn
- runinside 'svnadmin create'
+ runinside('svnadmin create')
end
def runinside *opts
@@ -164,12 +155,13 @@ def new_file filename, contents
File.open(File.expand_path("./#{Runner.app_name}/#{filename}"), 'w') do |f|
f.puts contents
end
+ puts "Generating file: #{filename}"
end
private
def shell cmd
- `#{cmd}`
+ puts `#{cmd}`
end
end
View
@@ -1,3 +1,25 @@
+#
+# Suprails: The customizable wrapper to the rails command
+#
+# Copyright 2008 Bradley Grzesiak
+# This file is part of Suprails.
+#
+# Suprails is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Suprails is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Suprails. If not, see <http://www.gnu.org/licenses/>.
+#
+
+require 'yaml'
+
class YAMLHelper
def self.create_yaml(file, values)
directory = File.dirname(file)

0 comments on commit 9f6963a

Please sign in to comment.