Skip to content

Commit

Permalink
2.0.0-b10
Browse files Browse the repository at this point in the history
Changed all of the shell scripts to ruby scripts. Still ned to finish the upgrade script and tests need to e run on windows still
  • Loading branch information
atomicpages authored and atomicpages committed Jul 7, 2014
1 parent aa686b4 commit 2d885cd
Show file tree
Hide file tree
Showing 12 changed files with 252 additions and 250 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
23 changes: 1 addition & 22 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,26 +1,5 @@
*.gem
*.rbc
.bundle
.config
.sass-cache
flavors/*/css
*.config.scss
skeleton.scss
skeleton.css
skeleton.*
skeleton_template.css
*.html
coverage
InstalledFiles
lib/bundler/man
pkg
rdoc
spec/reports
test/tmp
test/version_tmp
tmp
TODO.md

# YARD artifacts
.yardoc
_yardoc
doc/
62 changes: 62 additions & 0 deletions bin/assets/helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
module Helper

def isValidName(name)
if name !~ /[-a-zA-Z0-9_]+/i
return false
end

return true
end

def yesno(question)
puts question
answer = gets.chomp
while answer !~ /y(es)?|n(o)?/i do
puts "Invalid input. #{question} [y/n]"
answer = gets.chomp
yesno(question)
end

if answer =~ /y(es)/i
return true
end

return false
end

def nfqr(question, regex, errorMsg = "Invalid input. #{question}", isValid = nil)
puts isValid != 0 ? question : errorMsg
reply = gets.chomp

if reply =~ regex
return nfqr(question, regex, errorMsg, 0)
end

return reply
end

def cp(file, destination)
if !File.exists?(file) # fail quickly if not found
raise SystemCallError, "#{file} was not found or does not exist"
end

dest = File.open(destination, "w")

File.open(file, "r") do |f|
f.each_line do |line|
dest.puts(line)
end
end

dest.close
end

def gem_available?(name)
Gem::Specification.find_by_name(name)
rescue Gem::LoadError
return false
rescue
return Gem.available?(name)
end

end
35 changes: 35 additions & 0 deletions bin/setup.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env ruby -w

require_relative("assets/helper")

BEGIN {
if Dir.pwd =~ /bin$/i
Dir.chdir("../")
end
puts "Setup utility working..."
}

include Helper

STDOUT.flush
name = Helper.nfqr("Please enter in the name of your project with no spaces or special characters other than - or _ and press [ENTER]", /[^\w\-]/, "Project name invalid, please try again and press [ENTER]")

puts "Project name is #{name}"
puts "Renaming _MYconfig.scss to _#{name}.config.scss"
File.rename("_MYconfig.scss", "_#{name}.config.scss")

puts "Renaming skeleton_template to skeleton"
if File.exists?("skeleton_template.scss")
File.rename("skeleton_template.scss", "skeleton.scss")
else
puts "skeleton_template.scss does not exist. Skipping..."
end

puts "Adding user override to core/_config.scss"
file = File.open("skeleton/core/_config.scss", "a")
file.puts "@import \"../../_#{name}.config.scss\""
file.close

END {
puts "Setup utility is complete!"
}
49 changes: 0 additions & 49 deletions bin/setup.sh

This file was deleted.

40 changes: 40 additions & 0 deletions bin/theme_setup.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env ruby -w

require_relative("assets/helper")

BEGIN {
if Dir.pwd =~ /bin$/i
Dir.chdir("../")
end
puts "Theme setup utility working..."
}

include Helper

STDOUT.flush
name = Helper.nfqr("Please enter in the name of your theme with no spaces or special characters other than - or _ and press [ENTER]", /[^\w\-]/, "Theme name invalid, please try again and press [ENTER]")
puts "Theme name is #{name}"

if !Dir.exists?("skeleton/themes/#{name}")
Dir.mkdir("skeleton/themes/#{name}")
end

# create files and folders
puts "Creating required files and folders..."
file = File.open("skeleton/themes/_loader.scss", "w")
file.puts("// #{name} theme created with love using Skeleton Sass theme setup script!")
file.puts("\n@import \"#{name}/vars\";")
file.puts("@import \"#{name}/base\";")
file.puts("@import \"sphenoid/skeleton\"; // Override manually if you wish to create your own grid")
puts "skeleton/themes/_loader.scss has been updated... moving on"

if !Dir.exists?("skeleton/themes/#{name}/marrow")
Dir.mkdir("skeleton/themes/#{name}/marrow")
end

Helper.cp("skeleton/themes/demo/_base.scss", "skeleton/themes/#{name}/_base.scss")
Helper.cp("skeleton/themes/demo/_vars.scss", "skeleton/themes/#{name}/_vars.scss")

END {
puts "Theme setup complete!"
}
128 changes: 0 additions & 128 deletions bin/theme_setup.sh

This file was deleted.

Loading

0 comments on commit 2d885cd

Please sign in to comment.