Commit 689be11936550dba4b5bfea435477de8500ed0f8
1 parent
29e95ea9
Exists in
master
and in
11 other branches
Add slim: fatest and prettiest templates for rails
Showing
3 changed files
with
40 additions
and
3 deletions
Show diff stats
Gemfile
| ... | ... | @@ -30,6 +30,7 @@ gem 'locale', '~> 2.1' |
| 30 | 30 | gem 'whenever', :require => false |
| 31 | 31 | gem 'eita-jrails', '~> 0.10.0', require: 'jrails' |
| 32 | 32 | gem 'diffy', '~> 3.0' |
| 33 | +gem 'slim' | |
| 33 | 34 | |
| 34 | 35 | # API dependencies |
| 35 | 36 | gem 'grape', '~> 0.12' |
| ... | ... | @@ -54,9 +55,6 @@ group :production do |
| 54 | 55 | gem 'dalli', '~> 2.7.0' |
| 55 | 56 | end |
| 56 | 57 | |
| 57 | -group :development do | |
| 58 | -end | |
| 59 | - | |
| 60 | 58 | group :development, :test do |
| 61 | 59 | gem 'spring' |
| 62 | 60 | end | ... | ... |
debian/control
| ... | ... | @@ -0,0 +1,38 @@ |
| 1 | +#!/usr/bin/env ruby | |
| 2 | + | |
| 3 | +require 'html2haml' | |
| 4 | +require 'haml2slim' | |
| 5 | + | |
| 6 | +def run cmd | |
| 7 | + puts cmd | |
| 8 | + system cmd | |
| 9 | +end | |
| 10 | + | |
| 11 | +def convert erb | |
| 12 | + run <<-CMD | |
| 13 | + html2haml --erb #{erb} | haml2slim | sed 's/ *\\\\$//g' > $(echo #{erb} | sed 's/erb/slim/') && rm #{erb} | |
| 14 | + CMD | |
| 15 | +end | |
| 16 | + | |
| 17 | +erb = ARGV[0] | |
| 18 | +if erb and not erb.empty? | |
| 19 | + if File.file? erb | |
| 20 | + convert erb | |
| 21 | + else | |
| 22 | + STDERR.puts "file '#{erb}' not found" | |
| 23 | + end | |
| 24 | +else | |
| 25 | + GLOB_ALL = '**/*.erb' | |
| 26 | + GLOB_HTML = '**/*.html.erb' | |
| 27 | + GLOB = GLOB_HTML | |
| 28 | + | |
| 29 | + Dir.glob(GLOB).each do |erb| | |
| 30 | + if File.file? erb | |
| 31 | + convert erb | |
| 32 | + elsif File.symlink? erb | |
| 33 | + run <<-CMD | |
| 34 | + mv #{erb} $(echo #{erb} | sed 's/erb/slim/') | |
| 35 | + CMD | |
| 36 | + end | |
| 37 | + end | |
| 38 | +end | ... | ... |