[Git][noosfero/noosfero][master] Add slim: fatest and prettiest templates for rails
Bráulio Bhavamitra
gitlab at mg.gitlab.com
Mon Nov 16 21:57:27 BRST 2015
Bráulio Bhavamitra pushed to branch master at Noosfero / noosfero
Commits:
689be119 by Braulio Bhavamitra at 2015-11-16T20:54:52Z
Add slim: fatest and prettiest templates for rails
- - - - -
3 changed files:
- Gemfile
- debian/control
- + script/erb2slim
Changes:
=====================================
Gemfile
=====================================
--- a/Gemfile
+++ b/Gemfile
@@ -30,6 +30,7 @@ gem 'locale', '~> 2.1'
gem 'whenever', :require => false
gem 'eita-jrails', '~> 0.10.0', require: 'jrails'
gem 'diffy', '~> 3.0'
+gem 'slim'
# API dependencies
gem 'grape', '~> 0.12'
@@ -54,9 +55,6 @@ group :production do
gem 'dalli', '~> 2.7.0'
end
-group :development do
-end
-
group :development, :test do
gem 'spring'
end
=====================================
debian/control
=====================================
--- a/debian/control
+++ b/debian/control
@@ -80,6 +80,7 @@ Depends: adduser,
ruby-uglifier,
ruby-whenever,
ruby-will-paginate (>> 3.0.5-1),
+ ruby-slim,
tango-icon-theme,
unicorn (>= 4.8),
${misc:Depends}
=====================================
script/erb2slim
=====================================
--- /dev/null
+++ b/script/erb2slim
@@ -0,0 +1,38 @@
+#!/usr/bin/env ruby
+
+require 'html2haml'
+require 'haml2slim'
+
+def run cmd
+ puts cmd
+ system cmd
+end
+
+def convert erb
+ run <<-CMD
+ html2haml --erb #{erb} | haml2slim | sed 's/ *\\\\$//g' > $(echo #{erb} | sed 's/erb/slim/') && rm #{erb}
+ CMD
+end
+
+erb = ARGV[0]
+if erb and not erb.empty?
+ if File.file? erb
+ convert erb
+ else
+ STDERR.puts "file '#{erb}' not found"
+ end
+else
+ GLOB_ALL = '**/*.erb'
+ GLOB_HTML = '**/*.html.erb'
+ GLOB = GLOB_HTML
+
+ Dir.glob(GLOB).each do |erb|
+ if File.file? erb
+ convert erb
+ elsif File.symlink? erb
+ run <<-CMD
+ mv #{erb} $(echo #{erb} | sed 's/erb/slim/')
+ CMD
+ end
+ end
+end
View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/689be11936550dba4b5bfea435477de8500ed0f8
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20151116/598bdf33/attachment.html>
More information about the Noosfero-dev
mailing list