Skip to content

Commit

Permalink
move files for shevy gem into this repo
Browse files Browse the repository at this point in the history
  • Loading branch information
kyleshevlin committed Apr 7, 2016
1 parent 8bc49b8 commit 7531e44
Show file tree
Hide file tree
Showing 9 changed files with 153 additions and 4 deletions.
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source 'https://rubygems.org'

# Specify your gem's dependencies in shevy.gemspec
gemspec
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require "bundler/gem_tasks"
task :default => :spec
14 changes: 14 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env ruby

require "bundler/setup"
require "shevy"

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.

# (If you use this, don't forget to add pry to your Gemfile!)
# require "pry"
# Pry.start

require "irb"
IRB.start
8 changes: 8 additions & 0 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
set -vx

bundle install

# Do any other automated setup that you need to do here
13 changes: 9 additions & 4 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
"demo",
"Gruntfile.js",
"package.json",
"sache.json"
"sache.json",
"shevy.gemspec",
"Rakefile",
"Gemfile",
"lib/",
"bin/"
],
"keywords": [
"css",
Expand All @@ -20,11 +25,11 @@
"rhythm"
],
"license": "MIT",
"main": "lib/_shevy.scss",
"main": "core/_shevy.scss",
"name": "shevy",
"repository": {
"type": "git",
"url": "https://github.com/kyleshevlin/shevy.git"
},
"version": "1.0.0"
}
"version": "2.0.0"
}
8 changes: 8 additions & 0 deletions lib/shevy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require "shevy/generator"

shevy_path = File.expand_path('../../core', __FILE__)

ENV["SASS_PATH"] = [
ENV["SASS_PATH"],
shevy_path
].compact.join(FILE::PATH_SEPARATOR)
81 changes: 81 additions & 0 deletions lib/shevy/generator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
require 'shevy/version'
require 'fileutils'
require 'thor'
require 'pathname'

module Shevy
class Generator < Thor
map ["-v", "--version"] => :version

desc "install", "Install Shevy into your project"
method_options :path => :string, :force => :boolean
def install
if shevy_files_already_exist? && !options[:force]
puts "Shevy files already installed, doing nothing."
else
install_files
puts "Shevy files installed to #{install_path}/"
end
end

desc "update", "Update Shevy"
method_options :path => :string
def update
if shevy_files_already_exist?
remove_shevy_directory
install_files
puts "Shevy files updated."
else
puts "No existing shevy installation. Doing nothing."
end
end

desc "version", "Show Shevy version"
def version
say "Shevy #{Shevy::VERSION}"
end

private

def shevy_files_already_exist?
install_path.exist?
end

def install_path
@install_path ||= if options[:path]
Pathname.new(File.join(options[:path], "shevy"))
else
Pathname.new("shevy")
end
end

def install_files
make_install_directory
copy_in_scss_files
end

def remove_shevy_directory
FileUtils.rm_rf("shevy")
end

def make_install_directory
FileUtils.mkdir_p(install_path)
end

def copy_in_scss_files
FileUtils.cp_r(all_stylesheets, install_path)
end

def all_stylesheets
Dir["#{stylesheets_directory}/*"]
end

def stylesheets_directory
File.join(top_level_directory, "core")
end

def top_level_directory
File.dirname(File.dirname(File.dirname(__FILE__)))
end
end
end
3 changes: 3 additions & 0 deletions lib/shevy/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module Shevy
VERSION = "2.0.0"
end
24 changes: 24 additions & 0 deletions shevy.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'shevy/version'

Gem::Specification.new do |spec|
spec.name = "shevy"
spec.version = Shevy::VERSION
spec.authors = ["Kyle Shevlin"]
spec.email = ["[email protected]"]

spec.summary = %q{Sass library for typography and perfect vertical rhythm.}
spec.description = %q{Shevy is a small Sass library for simple, configurable typography with perfect vertical rhythm.}
spec.homepage = "https://github.com/kyleshevlin/shevy"
spec.licenses = ['MIT']

spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_development_dependency "bundler", "~> 1.11"
spec.add_development_dependency "rake", "~> 10.0"
end

0 comments on commit 7531e44

Please sign in to comment.