Skip to content

Commit

Permalink
2.0.2
Browse files Browse the repository at this point in the history
Finish upgrade.rb script and fixed a few more things
  • Loading branch information
Dennis committed Aug 3, 2014
1 parent 0136297 commit 5792a04
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 29 deletions.
3 changes: 2 additions & 1 deletion _MYconfig.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
//
// HOW TO RUN AUTOMATED SETUP
// 1. Open terminal and issue the following command:
// bin/setup.sh
// bin/setup.rb - Note: You must have ruby installed
// to run this script
// 2. Follow prompts from script

// GLOBAL VARIABLES - include your variables here or alter the predefined vars
Expand Down
95 changes: 84 additions & 11 deletions bin/upgrade.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,69 @@
#!/usr/bin/env ruby -w

require_relative("assets/helper")
# Add module directly so the script works when copied
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


BEGIN {
if Dir.pwd =~ /bin$/i
Expand All @@ -13,9 +76,7 @@

STDOUT.flush

puts "Warning: this script is incomplete at the moment. If you are using a BASH shell, please run bin/upgrade instead\n\n"

puts "Disclaimer: this utility it meant to aid in upgrading from Skeleton Sass 1.x to Skeleton Sass 2.x. If you have followed the wiki articles then please do not use this script without a clean installation of Skeleton Sass 2.x. We, AtomicPages LLC, are not responsible for any unforeseen events that arise by using this script. Please follow the prompts."
puts "Disclaimer: this utility it meant to aid in upgrading from Skeleton Sass 1.x to Skeleton Sass 2.x. If you have followed the wiki articles then please do not use this script without a clean installation of Skeleton Sass 2.x. We, AtomicPages LLC, are not responsible for any unforeseen events that arise by using this script. Please follow the prompts.\n"

resp = Helper.yesno("Did you add the contents from _vars.scss in Skeleton Sass 1.x to _MYconfig.scss in Skeleton Sass 2.x? [y/n]\nNote: If you ran the setup utility, your global configuration name might differ")

Expand All @@ -36,7 +97,7 @@
abort("Global config file in root not found. Please execute bin/upgrade within the skeleton-sass directory. Current working directory is #{Dir.pwd}")
end

puts "Using #{filename}"
puts "Using #{filename}..."

variables = {
"backgroundColor" => "background-color",
Expand All @@ -50,6 +111,7 @@
"headingFamily" => "heading-family",
"headingColor" => "heading-color",
"baseWidth" => "base-width",
"baseWidthMQ" => "REMOVE_ME",
"baseColWidth" => "base-col-width",
"baseGutterWidth" => "base-gutter-width",
"isFluid" => "is-fluid",
Expand All @@ -59,12 +121,23 @@
"mobileLandscapeWidth" => "mobile-landscape-width"
}

# variables.each do |key, value|
# key = key.gsub(/(?<=[a-z])(?=[A-Z])/, '-').downcase
# end
variables.each do |key, value|
%x(ruby -i.bak -pe "gsub /#{key}/i, '#{value}'" #{filename})
end

if File.exists?("#{filename}.bak")
File.delete("#{filename}.bak")
end

File.open(Dir.pwd + "/" + filename, "r+") do |file|
file.each_line do |line|
puts line
puts "Variable conversion complete..."
if filename == "_MYconfig.scss"
resp = Helper.yesno("Launch setup utility now? [y/n]")
if(resp =~ /n(o)?/i)
abort("Upgrade is complete! Rename _MYconfig.scss to a different name if you haven't done so already and import that file into core/_config.scss. You may also run bin/setup.rb from command line to automate this task.")
else
puts "Upgrade process complete! Launching setup now..."
system("ruby -w bin/setup.rb")
end
end

puts "Upgrade is complete!"
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "skeleton-sass",
"version": "2.0.1",
"version": "2.0.2",
"author": "Dennis Thompson",
"homepage": "http://atomicpages.github.io/skeleton-sass/",
"repository": {
Expand Down
1 change: 0 additions & 1 deletion sache.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"tags": [
"framework",
"responsive",
"bower",
"grids",
"ui",
"skeleton",
Expand Down
21 changes: 7 additions & 14 deletions skeleton/themes/sphenoid/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,7 @@ select {
padding: relative(6px) relative(4px);
outline: none;
@include border-radius(2px);
font: {
family: $form-font;
};
font-family: $form-font;
@include font-size($font-size + 1);
color: #777;
margin: 0 0 relative(20px);
Expand All @@ -292,22 +290,17 @@ select { padding: 0; }
textarea { min-height: relative(60px); }
label,
legend {
span {
font-weight: normal;
@include font-size($font-size + 1);
color: #444;
}
display: block;
font: {
weight: bold;
};
font-weight: bold;
@include font-size($font-size + 1);
}
select { width: relative(220px); }
input[type="checkbox"] { display: inline; }
label span,
legend span {
font: {
weight: normal;
};
@include font-size($font-size + 1);
color: #444;
}

/* MISC
* ------------------------------------------------ */
Expand Down
2 changes: 1 addition & 1 deletion skeleton_template.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author Dennis Thompson <http://www.atomicpages.net>
* @copyright Copyright (c) 2014 AtomicPages LLC
* @license MIT
* @version 2.0.1
* @version 2.0.2
*/

@import "skeleton/themes/loader"; // sass --update -C skeleton.scss:skeleton.css
Expand Down

0 comments on commit 5792a04

Please sign in to comment.