pax_global_header00006660000000000000000000000064125042457530014521gustar00rootroot0000000000000052 comment=450ae361dde7ef4fd6247daaa642601767bb5159 ruby-haml-rails-0.9.0/000077500000000000000000000000001250424575300145375ustar00rootroot00000000000000ruby-haml-rails-0.9.0/.gitignore000066400000000000000000000000721250424575300165260ustar00rootroot00000000000000*.gem .bundle/ *.lock gemfiles/*.lock tmp/ /vendor/bundle ruby-haml-rails-0.9.0/.travis.yml000066400000000000000000000004501250424575300166470ustar00rootroot00000000000000language: ruby rvm: - 1.9.3 - 2.0.0 - 2.1.0 - 2.2.0 - jruby-19mode - rbx gemfile: - gemfiles/rails_4_0.gemfile - gemfiles/rails_4_1.gemfile - gemfiles/rails_4_2.gemfile matrix: exclude: - rvm: 1.9.3 gemfile: gemfiles/rails_4_1.gemfile script: "bundle exec rake test"ruby-haml-rails-0.9.0/Appraisals000066400000000000000000000002311250424575300165550ustar00rootroot00000000000000appraise "rails_4_0" do gem "rails", "~> 4.0.1" end appraise "rails_4_1" do gem "rails", "4.1" end appraise "rails_4_2" do gem "rails", "4.2" endruby-haml-rails-0.9.0/Gemfile000066400000000000000000000002701250424575300160310ustar00rootroot00000000000000source 'https://rubygems.org' # Specify your gem's dependencies in haml-rails.gemspec gemspec gem 'rubysl', '~> 2.0', platforms: :rbx gem 'minitest', platforms: :rbx gem 'html2haml' ruby-haml-rails-0.9.0/LICENSE000066400000000000000000000020611250424575300155430ustar00rootroot00000000000000Copyright (c) 2010-2015 André Arko MIT Licence Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ruby-haml-rails-0.9.0/README.md000066400000000000000000000045161250424575300160240ustar00rootroot00000000000000# Haml-rails Haml-rails provides Haml generators for Rails 4. It also enables Haml as the templating engine for you, so you don't have to screw around in your own application.rb when your Gemfile already clearly indicated what templating engine you have installed. Hurrah. To use it, add this line to your Gemfile: gem "haml-rails", "~> 0.9" This ensures that: * Any time you generate a resource, view, or mailer, you'll get Haml templates (instead of ERB) * When your Rails application loads, Haml will be loaded and initialized automatically * Haml templates will be respected by the view template cache digestor Pretty fancy, eh? The modern world is just so amazing. ### Converting Rails application layout file to haml format Once Haml-rails is installed on the Rails application, you can convert the erb layout file, `app/views/layouts/application.html.erb` to `app/views/layouts/application.html.haml` using this command: $ rails generate haml:application_layout convert After the application layout file is converted successfully, make sure to delete `app/views/layouts/application.html.erb`, so Rails can start using `app/views/layouts/application.html.haml` instead. ### Converting all .erb views to haml format If you want to convert all of your .erb views into .haml, you can do so using the following command: $ rake haml:erb2haml If you already have .haml files for one or more of the .erb files, the rake task will give you the option of either replacing these .haml files or leaving them in place. Once the task is complete, you will have the option of deleting the original .erb files. Unless you are under version control, it is recommended that you decline this option. ### Older versions of Rails The current version of Haml-rails requires 4.0.1 or later. Haml-rails version 0.4 is the last version to support Rails 3. To use it, add this line to your Gemfile: gem "haml-rails", "~> 0.4.0" ### Contributors Haml generators originally from [rails3-generators](http://github.com/indirect/rails3-generators), and written by José Valim, André Arko, Paul Barry, Anuj Dutta, Louis T, and Chris Rhoden. Tests originally written by Louis T. ### Code Status [![Build Status](https://travis-ci.org/indirect/haml-rails.png)](https://travis-ci.org/indirect/haml-rails) ### License Ruby license or MIT license, take your pick. ruby-haml-rails-0.9.0/Rakefile000066400000000000000000000003711250424575300162050ustar00rootroot00000000000000require 'rubygems' require 'bundler' Bundler::GemHelper.install_tasks require 'rake/testtask' Rake::TestTask.new(:test) do |test| test.libs << 'lib' << 'test' test.pattern = 'test/**/*_test.rb' test.verbose = true end task :default => :test ruby-haml-rails-0.9.0/gemfiles/000077500000000000000000000000001250424575300163325ustar00rootroot00000000000000ruby-haml-rails-0.9.0/gemfiles/rails_4_0.gemfile000066400000000000000000000003251250424575300214400ustar00rootroot00000000000000# This file was generated by Appraisal source "https://rubygems.org" gem "rubysl", "~> 2.0", :platforms => :rbx gem "minitest", :platforms => :rbx gem "html2haml" gem "rails", "~> 4.0.1" gemspec :path => "../" ruby-haml-rails-0.9.0/gemfiles/rails_4_1.gemfile000066400000000000000000000003201250424575300214340ustar00rootroot00000000000000# This file was generated by Appraisal source "https://rubygems.org" gem "rubysl", "~> 2.0", :platforms => :rbx gem "minitest", :platforms => :rbx gem "html2haml" gem "rails", "4.1" gemspec :path => "../" ruby-haml-rails-0.9.0/gemfiles/rails_4_2.gemfile000066400000000000000000000003201250424575300214350ustar00rootroot00000000000000# This file was generated by Appraisal source "https://rubygems.org" gem "rubysl", "~> 2.0", :platforms => :rbx gem "minitest", :platforms => :rbx gem "html2haml" gem "rails", "4.2" gemspec :path => "../" ruby-haml-rails-0.9.0/haml-rails.gemspec000066400000000000000000000026001250424575300201330ustar00rootroot00000000000000# -*- encoding: utf-8 -*- require File.expand_path("../lib/haml-rails/version", __FILE__) Gem::Specification.new do |s| s.name = "haml-rails" s.version = Haml::Rails::VERSION s.platform = Gem::Platform::RUBY s.authors = ["André Arko"] s.email = ["andre@arko.net"] s.homepage = "http://github.com/indirect/haml-rails" s.summary = "let your Gemfile do the configuring" s.description = "Haml-rails provides Haml generators for Rails 4. It also enables Haml as the templating engine for you, so you don't have to screw around in your own application.rb when your Gemfile already clearly indicated what templating engine you have installed. Hurrah." s.licenses = ["MIT"] s.rubyforge_project = "haml-rails" s.required_rubygems_version = ">= 1.3.6" s.add_dependency "haml", [">= 4.0.6", "< 5.0"] s.add_dependency "activesupport", [">= 4.0.1"] s.add_dependency "actionpack", [">= 4.0.1"] s.add_dependency "railties", [">= 4.0.1"] s.add_dependency "html2haml", [">= 1.0.1"] s.add_development_dependency "rails", [">= 4.0.1"] s.add_development_dependency "bundler", "~> 1.7" s.add_development_dependency "rake" s.add_development_dependency 'appraisal', '~> 1.0' s.files = `git ls-files`.split("\n") s.executables = `git ls-files`.split("\n").select{|f| f =~ /^bin/} s.require_path = 'lib' end ruby-haml-rails-0.9.0/lib/000077500000000000000000000000001250424575300153055ustar00rootroot00000000000000ruby-haml-rails-0.9.0/lib/generators/000077500000000000000000000000001250424575300174565ustar00rootroot00000000000000ruby-haml-rails-0.9.0/lib/generators/haml/000077500000000000000000000000001250424575300203775ustar00rootroot00000000000000ruby-haml-rails-0.9.0/lib/generators/haml/controller/000077500000000000000000000000001250424575300225625ustar00rootroot00000000000000ruby-haml-rails-0.9.0/lib/generators/haml/controller/controller_generator.rb000066400000000000000000000004571250424575300273460ustar00rootroot00000000000000require 'rails/generators/erb/controller/controller_generator' module Haml module Generators class ControllerGenerator < Erb::Generators::ControllerGenerator source_root File.expand_path("../templates", __FILE__) protected def handler :haml end end end end ruby-haml-rails-0.9.0/lib/generators/haml/controller/templates/000077500000000000000000000000001250424575300245605ustar00rootroot00000000000000ruby-haml-rails-0.9.0/lib/generators/haml/controller/templates/view.html.haml000066400000000000000000000001001250424575300273270ustar00rootroot00000000000000%h1 <%= class_name %>#<%= @action %> %p Find me in <%= @path %> ruby-haml-rails-0.9.0/lib/generators/haml/mailer/000077500000000000000000000000001250424575300216505ustar00rootroot00000000000000ruby-haml-rails-0.9.0/lib/generators/haml/mailer/mailer_generator.rb000066400000000000000000000017321250424575300255170ustar00rootroot00000000000000require 'generators/haml/controller/controller_generator' module Haml module Generators class MailerGenerator < ControllerGenerator source_root File.expand_path("../templates", __FILE__) def copy_view_files view_base_path = File.join("app/views", class_path, file_name) empty_directory view_base_path if self.behavior == :invoke formats.each do |format| layout_path = File.join("app/views/layouts", filename_with_extensions("mailer", format)) template filename_with_extensions(:layout, format), layout_path end end actions.each do |action| @action = action formats.each do |format| @path = File.join(view_base_path, filename_with_extensions(action, format)) template filename_with_extensions(:view, format), @path end end end protected def formats [:text, :html] end end end end ruby-haml-rails-0.9.0/lib/generators/haml/mailer/templates/000077500000000000000000000000001250424575300236465ustar00rootroot00000000000000ruby-haml-rails-0.9.0/lib/generators/haml/mailer/templates/layout.html.haml000066400000000000000000000000311250424575300267630ustar00rootroot00000000000000%hmtl %body = yieldruby-haml-rails-0.9.0/lib/generators/haml/mailer/templates/layout.text.haml000066400000000000000000000000071250424575300270060ustar00rootroot00000000000000= yieldruby-haml-rails-0.9.0/lib/generators/haml/mailer/templates/view.html.haml000066400000000000000000000001171250424575300264250ustar00rootroot00000000000000%h1= class_name + "#" + @action %p = @greeting + ", find me in <%= @path %>"ruby-haml-rails-0.9.0/lib/generators/haml/mailer/templates/view.text.haml000066400000000000000000000001141250424575300264420ustar00rootroot00000000000000<%= class_name %>#<%= @action %> = @greeting + ", find me in <%= @path %>" ruby-haml-rails-0.9.0/lib/generators/haml/scaffold/000077500000000000000000000000001250424575300221605ustar00rootroot00000000000000ruby-haml-rails-0.9.0/lib/generators/haml/scaffold/scaffold_generator.rb000066400000000000000000000015621250424575300263400ustar00rootroot00000000000000require 'rails/generators/erb/scaffold/scaffold_generator' module Haml module Generators class ScaffoldGenerator < Erb::Generators::ScaffoldGenerator source_root File.expand_path("../templates", __FILE__) def copy_view_files available_views.each do |view| filename = filename_with_extensions(view) template "#{view}.html.haml", File.join("app/views", controller_file_path, filename) end end hook_for :form_builder, :as => :scaffold def copy_form_file if options[:form_builder].nil? filename = filename_with_extensions("_form") template "_form.html.haml", File.join("app/views", controller_file_path, filename) end end protected def available_views %w(index edit show new) end def handler :haml end end end end ruby-haml-rails-0.9.0/lib/generators/haml/scaffold/templates/000077500000000000000000000000001250424575300241565ustar00rootroot00000000000000ruby-haml-rails-0.9.0/lib/generators/haml/scaffold/templates/_form.html.haml000066400000000000000000000010351250424575300270650ustar00rootroot00000000000000= form_for @<%= singular_table_name %> do |f| - if @<%= singular_table_name %>.errors.any? #error_explanation %h2= "#{pluralize(@<%= singular_table_name %>.errors.count, "error")} prohibited this <%= singular_table_name %> from being saved:" %ul - @<%= singular_table_name %>.errors.full_messages.each do |msg| %li= msg <% for attribute in attributes -%> .field = f.label :<%= attribute.name %> = f.<%= attribute.field_type %> :<%= attribute.name %> <% end -%> .actions = f.submit 'Save' ruby-haml-rails-0.9.0/lib/generators/haml/scaffold/templates/edit.html.haml000066400000000000000000000002251250424575300267100ustar00rootroot00000000000000%h1 Editing <%= singular_table_name %> = render 'form' = link_to 'Show', @<%= singular_table_name %> \| = link_to 'Back', <%= index_helper %>_path ruby-haml-rails-0.9.0/lib/generators/haml/scaffold/templates/index.html.haml000066400000000000000000000013211250424575300270700ustar00rootroot00000000000000%h1 Listing <%= plural_table_name %> %table %thead %tr <% for attribute in attributes -%> %th <%= attribute.human_name %> <% end -%> %th %th %th %tbody - @<%= plural_table_name %>.each do |<%= singular_table_name %>| %tr <% for attribute in attributes -%> %td= <%= singular_table_name %>.<%= attribute.name %> <% end -%> %td= link_to 'Show', <%= singular_table_name %> %td= link_to 'Edit', edit_<%= singular_table_name %>_path(<%= singular_table_name %>) %td= link_to 'Destroy', <%= singular_table_name %>, :method => :delete, :data => { :confirm => 'Are you sure?' } %br = link_to 'New <%= human_name %>', new_<%= singular_table_name %>_path ruby-haml-rails-0.9.0/lib/generators/haml/scaffold/templates/new.html.haml000066400000000000000000000001401250424575300265500ustar00rootroot00000000000000%h1 New <%= singular_table_name %> = render 'form' = link_to 'Back', <%= index_helper %>_path ruby-haml-rails-0.9.0/lib/generators/haml/scaffold/templates/show.html.haml000066400000000000000000000004371250424575300267500ustar00rootroot00000000000000%p#notice= notice <% for attribute in attributes -%> %p %b <%= attribute.human_name %>: = @<%= singular_table_name %>.<%= attribute.name %> <% end -%> = link_to 'Edit', edit_<%= singular_table_name %>_path(@<%= singular_table_name %>) \| = link_to 'Back', <%= index_helper %>_path ruby-haml-rails-0.9.0/lib/haml-rails.rb000066400000000000000000000043361250424575300176710ustar00rootroot00000000000000require 'haml' require 'rails' require 'haml/railtie' module Haml module Rails class Engine < ::Rails::Engine end class Railtie < ::Rails::Railtie config.app_generators.template_engine :haml config.before_initialize do Haml::Template.options[:format] = :html5 end initializer 'haml_rails.configure_template_digestor' do # Configure cache digests to parse haml view templates # when calculating cache keys for view fragments ActiveSupport.on_load(:action_view) do ActiveSupport.on_load(:after_initialize) do begin if defined?(CacheDigests::DependencyTracker) # 'cache_digests' gem being used (overrides Rails 4 implementation) CacheDigests::DependencyTracker.register_tracker :haml, CacheDigests::DependencyTracker::ERBTracker if ::Rails.env.development? # recalculate cache digest keys for each request CacheDigests::TemplateDigestor.cache = ActiveSupport::Cache::NullStore.new end else # will only apply if Rails 4, which includes 'action_view/dependency_tracker' require 'action_view/dependency_tracker' ActionView::DependencyTracker.register_tracker :haml, ActionView::DependencyTracker::ERBTracker ActionView::Base.cache_template_loading = false if ::Rails.env.development? end rescue # likely this version of Rails doesn't support dependency tracking # so, we can't parse haml templates without 'cache_digests' gem anyway :) end end end end # Configure source annoatation on haml files (support for HAML was # provided directly by railties 3.2..4.1 but was dropped in 4.2. if Gem::Requirement.new(">= 4.2").satisfied_by?(Gem::Version.new(::Rails.version)) initializer 'haml_rails.configure_source_annotation' do SourceAnnotationExtractor::Annotation.register_extensions('haml') do |tag| /\s*-#\s*(#{tag}):?\s*(.*)/ end end end rake_tasks do load 'tasks/erb2haml.rake' end end end end ruby-haml-rails-0.9.0/lib/haml-rails/000077500000000000000000000000001250424575300173365ustar00rootroot00000000000000ruby-haml-rails-0.9.0/lib/haml-rails/version.rb000066400000000000000000000000721250424575300213470ustar00rootroot00000000000000module Haml module Rails VERSION = "0.9.0" end endruby-haml-rails-0.9.0/lib/rails/000077500000000000000000000000001250424575300164175ustar00rootroot00000000000000ruby-haml-rails-0.9.0/lib/rails/generators/000077500000000000000000000000001250424575300205705ustar00rootroot00000000000000ruby-haml-rails-0.9.0/lib/rails/generators/haml/000077500000000000000000000000001250424575300215115ustar00rootroot00000000000000ruby-haml-rails-0.9.0/lib/rails/generators/haml/application_layout/000077500000000000000000000000001250424575300254115ustar00rootroot00000000000000ruby-haml-rails-0.9.0/lib/rails/generators/haml/application_layout/application_layout_generator.rb000066400000000000000000000020241250424575300337020ustar00rootroot00000000000000require 'rails' module Haml module Generators class ApplicationLayoutGenerator < ::Rails::Generators::Base # Converts existing application.html.erb to haml format, # and creates app/views/layouts/application.html.haml # with some error checking. def convert app_layout_from = ::Rails.root.join('app/views/layouts/application.html.erb') app_layout_to = ::Rails.root.join('app/views/layouts/application.html.haml') if File.exist?(app_layout_from) if !File.exist?(app_layout_to) `html2haml #{app_layout_from} #{app_layout_to}` puts "Success! app/views/layouts/application.html.haml is created.\n" \ "Please remove the erb file: app/views/layouts/application.html.erb" else puts "Error! There is a file named app/views/layouts/application.html.haml already." end else puts "Error! There is no file named app/views/layouts/application.html.erb." end end end end end ruby-haml-rails-0.9.0/lib/tasks/000077500000000000000000000000001250424575300164325ustar00rootroot00000000000000ruby-haml-rails-0.9.0/lib/tasks/erb2haml.rake000066400000000000000000000045401250424575300207750ustar00rootroot00000000000000namespace :haml do desc 'Convert html.erb to html.haml each file in app/views' task :erb2haml do erb_files = Dir.glob('app/views/**/*.erb').select { |f| File.file? f} haml_files = Dir.glob('app/views/**/*.haml').select { |f| File.file? f} if erb_files.empty? puts "No .erb files found. Task will now exit." exit end haml_files_w_out_ext = haml_files.map { |f| f.gsub(/\.haml\z/, '') } # Get a list of all those erb files that already seem to have .haml equivalents already_existing = erb_files.select { |f| short = f.gsub(/\.erb\z/, ''); haml_files_w_out_ext.include?(short) } puts '-'*80 if already_existing.any? puts "Some of your .html.erb files seem to already have .haml equivalents:" already_existing.map { |f| puts "\t#{f}" } # Ask the user whether he/she would like to overwrite them. begin puts "Would you like to overwrite these .haml files? (y/n)" should_overwrite = STDIN.gets.chomp.downcase[0] end until ['y', 'n'].include?(should_overwrite) puts '-'*80 # If we are not overwriting, remove each already_existing from our erb_files list if should_overwrite == 'n' erb_files = erb_files - already_existing if erb_files.empty? # It is possible no .erb files remain, after we remove already_existing puts "No .erb files remain. Task will now exit." return end else # Delete the current .haml already_existing.each { |f| File.delete(f.gsub(/\.erb\z/, '.haml')) } end end erb_files.each do |file| puts "Generating HAML for #{file}..." `html2haml #{file} #{file.gsub(/\.erb\z/, '.haml')}` end puts '-'*80 puts "HAML generated for the following files:" erb_files.each do |file| puts "\t#{file}" end puts '-'*80 begin puts 'Would you like to delete the original .erb files? (This is not recommended unless you are under version control.) (y/n)' should_delete = STDIN.gets.chomp.downcase[0] end until ['y', 'n'].include?(should_delete) if should_delete == 'y' puts "Deleting original .erb files." File.delete *erb_files else puts "Please remember to delete your .erb files once you have ensured they were translated correctly." end puts '-'*80 puts "Task complete!" end endruby-haml-rails-0.9.0/metadata.yml000066400000000000000000000133721250424575300170500ustar00rootroot00000000000000--- !ruby/object:Gem::Specification name: haml-rails version: !ruby/object:Gem::Version version: 0.9.0 platform: ruby authors: - André Arko autorequire: bindir: bin cert_chain: [] date: 2015-03-11 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: haml requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: 4.0.6 - - "<" - !ruby/object:Gem::Version version: '5.0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: 4.0.6 - - "<" - !ruby/object:Gem::Version version: '5.0' - !ruby/object:Gem::Dependency name: activesupport requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: 4.0.1 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: 4.0.1 - !ruby/object:Gem::Dependency name: actionpack requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: 4.0.1 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: 4.0.1 - !ruby/object:Gem::Dependency name: railties requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: 4.0.1 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: 4.0.1 - !ruby/object:Gem::Dependency name: html2haml requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: 1.0.1 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: 1.0.1 - !ruby/object:Gem::Dependency name: rails requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: 4.0.1 type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: 4.0.1 - !ruby/object:Gem::Dependency name: bundler requirement: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: '1.7' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: '1.7' - !ruby/object:Gem::Dependency name: rake requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: appraisal requirement: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: '1.0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: '1.0' description: Haml-rails provides Haml generators for Rails 4. It also enables Haml as the templating engine for you, so you don't have to screw around in your own application.rb when your Gemfile already clearly indicated what templating engine you have installed. Hurrah. email: - andre@arko.net executables: [] extensions: [] extra_rdoc_files: [] files: - ".gitignore" - ".travis.yml" - Appraisals - Gemfile - LICENSE - README.md - Rakefile - gemfiles/rails_4_0.gemfile - gemfiles/rails_4_1.gemfile - gemfiles/rails_4_2.gemfile - haml-rails.gemspec - lib/generators/haml/controller/controller_generator.rb - lib/generators/haml/controller/templates/view.html.haml - lib/generators/haml/mailer/mailer_generator.rb - lib/generators/haml/mailer/templates/layout.html.haml - lib/generators/haml/mailer/templates/layout.text.haml - lib/generators/haml/mailer/templates/view.html.haml - lib/generators/haml/mailer/templates/view.text.haml - lib/generators/haml/scaffold/scaffold_generator.rb - lib/generators/haml/scaffold/templates/_form.html.haml - lib/generators/haml/scaffold/templates/edit.html.haml - lib/generators/haml/scaffold/templates/index.html.haml - lib/generators/haml/scaffold/templates/new.html.haml - lib/generators/haml/scaffold/templates/show.html.haml - lib/haml-rails.rb - lib/haml-rails/version.rb - lib/rails/generators/haml/application_layout/application_layout_generator.rb - lib/tasks/erb2haml.rake - test/fixtures/routes.rb - test/lib/generators/haml/controller_generator_test.rb - test/lib/generators/haml/mailer_generator_test.rb - test/lib/generators/haml/scaffold_generator_test.rb - test/lib/generators/haml/testing_helper.rb - test/test_helper.rb homepage: http://github.com/indirect/haml-rails licenses: - MIT metadata: {} post_install_message: rdoc_options: [] require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: 1.3.6 requirements: [] rubyforge_project: haml-rails rubygems_version: 2.4.5 signing_key: specification_version: 4 summary: let your Gemfile do the configuring test_files: [] ruby-haml-rails-0.9.0/test/000077500000000000000000000000001250424575300155165ustar00rootroot00000000000000ruby-haml-rails-0.9.0/test/fixtures/000077500000000000000000000000001250424575300173675ustar00rootroot00000000000000ruby-haml-rails-0.9.0/test/fixtures/routes.rb000066400000000000000000000033631250424575300212420ustar00rootroot00000000000000TestApp.routes.draw do |map| # The priority is based upon order of creation: # first created -> highest priority. # Sample of regular route: # match 'products/:id' => 'catalog#view' # Keep in mind you can assign values other than :controller and :action # Sample of named route: # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase # This route can be invoked with purchase_url(:id => product.id) # Sample resource route (maps HTTP verbs to controller actions automatically): # resources :products # Sample resource route with options: # resources :products do # member do # get :short # post :toggle # end # # collection do # get :sold # end # end # Sample resource route with sub-resources: # resources :products do # resources :comments, :sales # resource :seller # end # Sample resource route with more complex sub-resources # resources :products do # resources :comments # resources :sales do # get :recent, :on => :collection # end # end # Sample resource route within a namespace: # namespace :admin do # # Directs /admin/products/* to Admin::ProductsController # # (app/controllers/admin/products_controller.rb) # resources :products # end # You can have the root of your site routed with "root" # just remember to delete public/index.html. # root :to => "welcome#index" # See how all your routes lay out with "rake routes" # This is a legacy wild controller route that's not recommended for RESTful applications. # Note: This route will make all actions in every controller accessible via GET requests. # match ':controller(/:action(/:id(.:format)))' end ruby-haml-rails-0.9.0/test/lib/000077500000000000000000000000001250424575300162645ustar00rootroot00000000000000ruby-haml-rails-0.9.0/test/lib/generators/000077500000000000000000000000001250424575300204355ustar00rootroot00000000000000ruby-haml-rails-0.9.0/test/lib/generators/haml/000077500000000000000000000000001250424575300213565ustar00rootroot00000000000000ruby-haml-rails-0.9.0/test/lib/generators/haml/controller_generator_test.rb000066400000000000000000000007561250424575300272030ustar00rootroot00000000000000require 'test_helper' require 'lib/generators/haml/testing_helper' class Haml::Generators::ControllerGeneratorTest < Rails::Generators::TestCase destination Rails.root tests Rails::Generators::ControllerGenerator setup :prepare_destination setup :copy_routes arguments %w(Account foo bar --template-engine haml) test "should invoke haml engine" do run_generator assert_file "app/views/account/foo.html.haml" assert_file "app/views/account/bar.html.haml" end end ruby-haml-rails-0.9.0/test/lib/generators/haml/mailer_generator_test.rb000066400000000000000000000024371250424575300262670ustar00rootroot00000000000000require 'test_helper' require 'lib/generators/haml/testing_helper' class Haml::Generators::MailerGeneratorTest < Rails::Generators::TestCase destination File.join(Rails.root) tests Rails::Generators::MailerGenerator arguments %w(notifier foo bar --template-engine haml) setup :prepare_destination setup :copy_routes test "should invoke template engine" do run_generator assert_file "app/views/layouts/mailer.text.haml" do |view| assert_match /\= yield/, view end assert_file "app/views/layouts/mailer.html.haml" do |view| assert_match /\= yield/, view end assert_file "app/views/notifier/foo.text.haml" do |view| assert_match %r(app/views/notifier/foo\.text\.haml), view assert_match /\= @greeting/, view end assert_file "app/views/notifier/foo.html.haml" do |view| assert_match %r(app/views/notifier/foo\.html\.haml), view assert_match /\= @greeting/, view end assert_file "app/views/notifier/bar.text.haml" do |view| assert_match %r(app/views/notifier/bar\.text\.haml), view assert_match /\= @greeting/, view end assert_file "app/views/notifier/bar.html.haml" do |view| assert_match %r(app/views/notifier/bar\.html\.haml), view assert_match /\= @greeting/, view end end end ruby-haml-rails-0.9.0/test/lib/generators/haml/scaffold_generator_test.rb000066400000000000000000000020361250424575300265720ustar00rootroot00000000000000require 'test_helper' require 'lib/generators/haml/testing_helper' class Haml::Generators::ScaffoldGeneratorTest < Rails::Generators::TestCase destination File.join(Rails.root) tests Rails::Generators::ScaffoldGenerator arguments %w(product_line title:string price:integer --template-engine haml) setup :prepare_destination setup :copy_routes test "should invoke template engine" do run_generator %w(index edit new show _form).each { |view| assert_file "app/views/product_lines/#{view}.html.haml" } assert_no_file "app/views/layouts/product_lines.html.haml" end test "should revoke template engine" do run_generator run_generator ["product_line"], :behavior => :revoke assert_no_file "app/views/product_lines" assert_no_file "app/views/layouts/product_lines.html.haml" end test "should invoke form builder" do run_generator %w(product_line title:string price:integer --template-engine haml --form-builder some-form-builder) assert_no_file "app/views/product_lines/_form.html.haml" end end ruby-haml-rails-0.9.0/test/lib/generators/haml/testing_helper.rb000066400000000000000000000001001250424575300247060ustar00rootroot00000000000000require_generators :haml => ['scaffold', 'controller', 'mailer']ruby-haml-rails-0.9.0/test/test_helper.rb000066400000000000000000000040201250424575300203550ustar00rootroot00000000000000require 'rubygems' require 'minitest/autorun' require 'rails/all' require 'rails/generators' require 'rails/generators/test_case' class TestApp < Rails::Application config.root = File.dirname(__FILE__) end module Rails def self.root @root ||= File.expand_path(File.join(File.dirname(__FILE__), '..', 'tmp', 'rails')) end end # Call configure to load the settings from # Rails.application.config.generators to Rails::Generators Rails.application.load_generators Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f} def copy_routes routes = File.join(File.dirname(__FILE__), 'fixtures', 'routes.rb') destination = File.join(Rails.root, "config") FileUtils.mkdir_p(destination) FileUtils.cp File.expand_path(routes), File.expand_path(destination) end # Asserts the given class exists in the given content. When a block is given, # it yields the content of the class. # # assert_file "test/functional/accounts_controller_test.rb" do |controller_test| # assert_class "AccountsControllerTest", controller_test do |klass| # assert_match /context "index action"/, klass # end # end # def assert_class(klass, content) assert content =~ /class #{klass}(\(.+\))?(.*?)\nend/m, "Expected to have class #{klass}" yield $2.strip if block_given? end def generator_list { :rails => ['scaffold', 'controller', 'mailer'], :haml => ['scaffold', 'controller', 'mailer'] } end def path_prefix(name) case name when :rails 'rails/generators' else 'generators' end end def require_generators(generator_list) generator_list.each do |name, generators| generators.each do |generator_name| if name.to_s == 'rails' && generator_name.to_s == 'mailer' require File.join(path_prefix(name), generator_name.to_s, "#{generator_name}_generator") else require File.join(path_prefix(name), name.to_s, generator_name.to_s, "#{generator_name}_generator") end end end end alias :require_generator :require_generators require_generators generator_list