Sha256: 8861d0a52adedb3822577165b3274cf3df20582492bfce2d32a25c47add9754f

Contents?: true

Size: 1.48 KB

Versions: 1

Compression:

Stored size: 1.48 KB

Contents

require "Sasskture/version"

module Sasskture
  class GenerateStructure

  	attr_reader :maintext

  	def initialize
  		@maintext = ""
  	end
  	###
  	# Structure files
  	def files
  		return [
  			{
		      :folder => "helpers",
		      :description => "// Sass utilities",
		      :files => ["variables", "functions", "mixins", "helpers"]
		    },
		    {
		    	:folder => "vendors",
		    	:description => "// Vendors and external stylesheets",
		    	:files => []
		    },
		    {
		      :folder => "base", 
		      :description => "// Base stuff",
		      :files => ["reset", "typography"]
		    },
		    {
		      :folder => "layout", 
		      :description => "// Layout related stylesheets",
		      :files => ["grid", "header", "footer"]
		    }
		  ]
  	end

  	###
  	# Simple map to read data
  	def generateData
  		files.each do |folder|
  			createFolder folder[:folder]
  			@maintext += folder[:description] + "\n"
  			folder[:files].each do |file|
  				createFile folder[:folder], file
  				@maintext += "@import '" + folder[:folder] + "/" + file + "';\n"
  			end
  			@maintext += "\n"
  		end
  	end

  	###
  	# Generate folder
  	def createFolder(name)
  		system 'mkdir', '-p', name
  	end

  	###
  	# Generate files
  	def createFile(folderName, folderFile)
  		system 'touch', "#{folderName}/_#{folderFile}.scss"
  	end

  	##
  	# Generate main
  	def generateMain
  		system 'touch', 'app.scss'
  		File.open('app.scss', "wb") { |file| file.write(@maintext) }
  	end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
Sasskture-0.0.1 lib/Sasskture.rb