Skip to content

Commit

Permalink
Merge 49263cc into 96e3ac1
Browse files Browse the repository at this point in the history
  • Loading branch information
pikesley committed Feb 7, 2018
2 parents 96e3ac1 + 49263cc commit 70bb126
Show file tree
Hide file tree
Showing 69 changed files with 1,432 additions and 1,515 deletions.
1 change: 1 addition & 0 deletions .ruby-version
@@ -0,0 +1 @@
2.5.0
12 changes: 3 additions & 9 deletions README.md
Expand Up @@ -13,14 +13,14 @@ Extremely opinionated generator for your [Sinatra](http://www.sinatrarb.com/) a
* Sinatra
* [Rspec](http://rspec.info/)
* [Jasmine](http://jasmine.github.io/2.0/introduction.html)
* [Bootstrap](http://getbootstrap.com/)
* [Compass](http://compass-style.org/)
* [Bootstrap 4](http://getbootstrap.com/)
* [Sass](https://sass-lang.com/)
* An MIT License file
* A Code-of-Conduct file

* Jekyll
* [Jekyll](https://jekyllrb.com/)
* [Bootstrap](http://getbootstrap.com/)
* [Bootstrap 4](http://getbootstrap.com/)
* Reasonable default things
* An MIT License file
* A Code-of-Conduct file
Expand Down Expand Up @@ -104,12 +104,6 @@ or just
* Default: sinatra
* Possible values: sinatra, jekyll

* --bootstrap
* Bootstrap major version to include
* Default: 3
* Possible values: 3, 4
* VERY EXPERIMENTAL

* --licensor
* Name to include in the license file

Expand Down
34 changes: 2 additions & 32 deletions Rakefile
Expand Up @@ -3,36 +3,6 @@ require 'rspec/core/rake_task'
require 'coveralls/rake/task'

Coveralls::RakeTask.new
RSpec::Core::RakeTask.new

namespace :specs do
desc 'run the trustworthy specs'
task :safe do
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = "--tag ~troublesome"
end
Rake::Task['spec'].execute
end

desc 'run the shonky specs'
task :shaky do
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = "--tag troublesome"
end
Rake::Task['spec'].execute
end

desc 'run all the specs'
task :all do
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = "--tag troublesome"
end

RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = "--tag ~troublesome"
end

Rake::Task['spec'].execute
end
end

task :default => ['specs:all', 'coveralls:push']
task :default => [:spec, 'coveralls:push']
28 changes: 21 additions & 7 deletions config/config.yaml
Expand Up @@ -15,7 +15,7 @@ sinatra:
rack-tracker:
rake:
compass:
bootstrap-sass:
bootstrap:
erubis:
puma:
test:
Expand All @@ -41,7 +41,6 @@ sinatra:
Procfile:
.rspec:
config.ru:
config.rb:
config/config.yml:
# the template has this name
lib/app.rb:
Expand Down Expand Up @@ -98,12 +97,10 @@ sinatra:
public/sass/_colours.scss:
common: sass/colours
public/sass/styles.scss:
common: sass/styles

jekyll:
gems:
github-pages:
# bootstrap: '4.0.0.alpha4'
rake:

files:
Expand All @@ -118,16 +115,15 @@ jekyll:
common: includes/nav
_includes/footer.html:
common: includes/footer
_includes/libs.html:
common: includes/libs
_includes/ie-cruft.html:
common: includes/ie-cruft
css/styles.scss:
common: sass/styles
_sass/variables.scss:
common: sass/variables
_sass/colours.scss:
common: sass/colours
_sass/nav.scss:
common: sass/nav
_sass/palettes/default.scss:
common: sass/palettes/default
_sass/fonts.scss:
Expand All @@ -139,3 +135,21 @@ jekyll:
js/app.js:
outpath: app/wormname
common: js/app.js

bootstrap:
js:
- name: jquery
url: //code.jquery.com/jquery-VERSION.slim.min.js
version: 3.2.1
hash: sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN
- name: popper
url: //cdnjs.cloudflare.com/ajax/libs/popper.js/VERSION/umd/popper.min.js
version: 1.12.9
hash: sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q
- name: bootstrap
url: //maxcdn.bootstrapcdn.com/bootstrap/VERSION/js/bootstrap.min.js
version: 4.0.0
hash: sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl
- name: fontawesome
url: //use.fontawesome.com/releases/vVERSION/js/all.js
version: 5.0.4
2 changes: 1 addition & 1 deletion lib/skellington.rb
Expand Up @@ -3,7 +3,7 @@
require 'fileutils'
require 'erubis'
require 'git'
require 'bootstrap-sass'
require 'bootstrap'

require 'skellington/version'
require 'skellington/generator'
Expand Down
4 changes: 0 additions & 4 deletions lib/skellington/cli.rb
Expand Up @@ -11,10 +11,6 @@ def version
default: 'sinatra',
description: 'Framework to generate for',
enum: ['sinatra', 'jekyll']
method_option :bootstrap,
default: '3',
description: 'Bootstrap major version to use *VERY EXPERIMENTAL*',
enum: ['3', '4']
method_option :licensor,
aliases: '-l',
description: 'Name to insert into the license file'
Expand Down
19 changes: 5 additions & 14 deletions lib/skellington/generator.rb
Expand Up @@ -6,13 +6,11 @@ class Generator
:camelname,
:files,
:gems,
:framework,
:bootstrap
:framework
attr_accessor :licensor

def initialize path, options = {}
@framework = options.fetch('framework', 'sinatra')
@bootstrap = options.fetch('bootstrap', 3).to_s
@full_path = path
@path = File.dirname @full_path
@filename = File.basename(@full_path)
Expand Down Expand Up @@ -46,18 +44,11 @@ def generate
end

def strap_boots
if @framework == 'jekyll'
if @bootstrap == '4'
Object.send(:remove_const, :Bootstrap)
require 'bootstrap'
end
root = "#{self.path}/#{self.wormname}"

root = "#{self.path}/#{self.wormname}"

FileUtils.mkdir_p "#{root}/_sass"
FileUtils.cp_r "#{Bootstrap.assets_path}/stylesheets/bootstrap", "#{root}/_sass"
FileUtils.cp "#{Bootstrap.assets_path}/stylesheets/_bootstrap.scss", "#{root}/_sass/bootstrap.scss"
end
FileUtils.mkdir_p "#{root}/_sass"
FileUtils.cp_r "#{Bootstrap.assets_path}/stylesheets/bootstrap", "#{root}/_sass"
FileUtils.cp "#{Bootstrap.assets_path}/stylesheets/_bootstrap.scss", "#{root}/_sass/bootstrap.scss"
end

def wormname
Expand Down
17 changes: 17 additions & 0 deletions lib/skellington/helpers.rb
Expand Up @@ -7,4 +7,21 @@ def self.unslash word
return word[2..-1] if word[0..1] == './'
word
end

def self.js_for_sinatra data
s = [' %s: {' % data['name']]
s.push " url: '%s'," % (data['url'].sub 'VERSION', data['version'])
s.push " hash: '%s'" % data['hash']
s.push ' }'

s.join "\n"
end

def self.js_for_jekyll data
s = [' - name: %s' % data['name']]
s.push " url: %s" % (data['url'].sub 'VERSION', data['version'])
s.push " hash: %s" % data['hash'] if data['hash']

s.join "\n"
end
end
2 changes: 1 addition & 1 deletion lib/skellington/version.rb
@@ -1,3 +1,3 @@
module Skellington
VERSION = '0.8.9'
VERSION = '0.9.0'
end
6 changes: 0 additions & 6 deletions lib/templates/common/Gemfile
@@ -1,9 +1,3 @@
<% if @gen.framework == 'sinatra' %>
<% if @gen.bootstrap == '4' %>
<% @gen.gems['production'].delete 'bootstrap-sass' %>
<% @gen.gems['production']['bootstrap'] = '4.0.0.alpha5' %>
<% end %>
<% end %>
source 'https://rubygems.org'

ruby '<%= RUBY_VERSION %>'
Expand Down
2 changes: 1 addition & 1 deletion lib/templates/common/includes/footer
@@ -1,4 +1,4 @@
<div class='footer'>
<div class='footer p-2'>
Generated with
<a href='http://sam.pikesley.org/projects/skellington/' alt='Skellington' title='Skellington'>
Skellington
Expand Down
16 changes: 1 addition & 15 deletions lib/templates/common/includes/header
Expand Up @@ -12,21 +12,7 @@
<% when 'jekyll' %>
{% include ie-cruft.html %}

{% for lib in site.data.libs.js %}
<!-- {{ lib.name }} -->
<script src='{{ lib.url }}'></script>
{% endfor %}

{% for lib in site.data.libs.css %}
<!-- {{ lib.name }} -->
<link rel='stylesheet' href='{{ lib.url }}'>
{% endfor %}

{% for font in site.data.libs.fonts %}
<!-- {{ font.name }} -->
<link rel='stylesheet' href='{{ font.url }}'>
{% endfor %}
<% end %>
{% include libs.html %}<% end %>
<% prefix = '{{ site.baseurl }}' if @gen.framework == 'jekyll' %>

<link rel='icon' type='image/png' href='<%= prefix %>/assets/favicon.ico' />
Expand Down
14 changes: 14 additions & 0 deletions lib/templates/common/includes/libs
@@ -0,0 +1,14 @@
{% for lib in site.data.libs.js %}
<!-- {{ lib.name }} -->
<script src='{{ lib.url }}' integrity='{{ lib.hash }}' crossorigin='anonymous'></script>
{% endfor %}

{% for lib in site.data.libs.css %}
<!-- {{ lib.name }} -->
<link rel='stylesheet' href='{{ lib.url }}'>
{% endfor %}

{% for font in site.data.libs.fonts %}
<!-- {{ font.name }} -->
<link rel='stylesheet' href='{{ font.url }}'>
{% endfor %}
35 changes: 11 additions & 24 deletions lib/templates/common/includes/nav
@@ -1,27 +1,14 @@
<% if @gen.framework == 'jekyll' %>
<% prefix = '{{ site.baseurl }}' %>
<% end %>
<nav class='navbar navbar-default navbar-static-top'>
<div class='container-fluid'>
<div class='navbar-header'>
<button type='button'
class='navbar-toggle collapsed'
data-toggle='collapse'
data-target='#navbar'
aria-expanded='false'
aria-controls='navbar'>
<span class='sr-only'>Toggle navigation</span>
<span class='icon-bar'></span>
<span class='icon-bar'></span>
<span class='icon-bar'></span>
</button>
<a class='navbar-brand' href='<%= prefix %>/'>Home</a>
</div>
<div id='navbar' class='navbar-collapse collapse'>
<ul class='nav navbar-nav'>
<li><a href='<%= prefix %>/foo/'>Foo</a></li>
<li><a href='<%= prefix %>/bar/'>Bar</a></li>
</ul>
</div>
</div>
</nav>
<ul class='nav nav-pills nav-fill p-3'>
<li class='nav-item'>
<a class='nav-link active' href='<%= prefix %>/'>Home</a>
</li>
<li class='nav-item'>
<a class='nav-link' href='<%= prefix %>/foo/'>Foo</a>
</li>
<li class='nav-item'>
<a class='nav-link' href='<%= prefix %>/bar/'>Bar</a>
</li>
</ul>
13 changes: 12 additions & 1 deletion lib/templates/common/sass/colours
@@ -1,10 +1,21 @@
@import 'palettes/default';

$brand-primary: $rgba-primary-0;
//$brand-primary: $rgba-primary-0;
//$brand-complement: $rgba-complement-0;
//$brand-secondary-1: $rgba-secondary-1-0;
//$brand-secondary-2: $rgba-secondary-2-0;

$grey: rgb(127, 127, 127);
$light-grey: lighten($grey, 25%);
$dark-grey: darken($grey, 25%);

$theme-colors: (
primary: $rgba-primary-0,
secondary: $rgba-secondary-1-0,
// success: $green,
// info: $cyan,
// warning: $yellow,
// danger: $red,
// light: $gray-100,
// dark: $gray-800
)
19 changes: 2 additions & 17 deletions lib/templates/common/sass/footer
Expand Up @@ -7,37 +7,22 @@ body {
margin-bottom: $footer-height;
}

<% if @gen.bootstrap == '4' %>
.footer {
position: absolute;
bottom: 0;
width: 100%;
height: $footer-height;
line-height: $footer-height;
text-align: center;
background: $brand-primary;
}
<% else %>
.footer {
position: absolute;
bottom: 0;
width: 100%;

text-align: center;

margin-top: $padding-large-vertical;
background: $brand-primary;
background: map-get($theme-colors, primary);
color: white;
height: $footer-height;

padding: $padding-large-vertical $padding-large-horizontal;

ul {
@extend .list-inline;
}

a {
color: white;
}
}
<% end %>

0 comments on commit 70bb126

Please sign in to comment.