haml-rails-2.1.0/0000755000004100000410000000000014323154045013574 5ustar www-datawww-datahaml-rails-2.1.0/test/0000755000004100000410000000000014323154045014553 5ustar www-datawww-datahaml-rails-2.1.0/test/fixtures/0000755000004100000410000000000014323154045016424 5ustar www-datawww-datahaml-rails-2.1.0/test/fixtures/routes.rb0000644000004100000410000000336314323154045020277 0ustar www-datawww-dataTestApp.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 haml-rails-2.1.0/test/lib/0000755000004100000410000000000014323154045015321 5ustar www-datawww-datahaml-rails-2.1.0/test/lib/generators/0000755000004100000410000000000014323154045017472 5ustar www-datawww-datahaml-rails-2.1.0/test/lib/generators/haml/0000755000004100000410000000000014323154045020413 5ustar www-datawww-datahaml-rails-2.1.0/test/lib/generators/haml/mailer_generator_test.rb0000644000004100000410000000606214323154045025322 0ustar www-datawww-datarequire 'test_helper' require 'rails/generators/mailer/mailer_generator' require 'generators/haml/mailer/mailer_generator' 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 if ::Rails.version.to_s >= '4.2' 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_mailer/foo.html.haml" do |view| assert_match %r(app/views/notifier_mailer/foo\.html\.haml), view assert_match(/\= @greeting/, view) end assert_file "app/views/notifier_mailer/bar.html.haml" do |view| assert_match %r(app/views/notifier_mailer/bar\.html\.haml), view assert_match(/\= @greeting/, view) end assert_file "app/views/notifier_mailer/foo.text.haml" do |view| assert_match %r(app/views/notifier_mailer/foo\.text\.haml), view assert_match(/\= @greeting/, view) end assert_file "app/views/notifier_mailer/bar.text.haml" do |view| assert_match %r(app/views/notifier_mailer/bar\.text\.haml), view assert_match(/\= @greeting/, view) end else if ::Rails.version.to_s >= '4.1' 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.html.haml" do |view| assert_match %r(app/views/notifier/bar\.html\.haml), view assert_match(/\= @greeting/, view) end 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/bar.text.haml" do |view| assert_match %r(app/views/notifier/bar\.text\.haml), view assert_match(/\= @greeting/, view) end end end test 'suffix is not duplicated' do if ::Rails.version.to_s >= '4.2' run_generator ['notifier_mailer', 'foo', 'bar', '--template-engine', 'haml'] assert_no_file 'app/views/notifier_mailer_mailer/' assert_file 'app/views/notifier_mailer/' assert_no_file 'app/views/notifier_mailer_mailer/foo.text.haml' assert_file 'app/views/notifier_mailer/foo.text.haml' assert_no_file 'app/views/notifier_mailer_mailer/foo.html.haml' assert_file 'app/views/notifier_mailer/foo.html.haml' assert_no_file 'app/views/notifier_mailer_mailer/bar.text.haml' assert_file 'app/views/notifier_mailer/bar.text.haml' assert_no_file 'app/views/notifier_mailer_mailer/bar.html.haml' assert_file 'app/views/notifier_mailer/bar.html.haml' end end end haml-rails-2.1.0/test/lib/generators/haml/controller_generator_test.rb0000644000004100000410000000107214323154045026230 0ustar www-datawww-datarequire 'test_helper' require 'rails/generators/rails/controller/controller_generator' require 'generators/haml/controller/controller_generator' 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 haml-rails-2.1.0/test/lib/generators/haml/scaffold_generator_test.rb0000644000004100000410000000214414323154045025627 0ustar www-datawww-datarequire 'test_helper' require 'rails/generators/rails/scaffold/scaffold_generator' require 'generators/haml/scaffold/scaffold_generator' 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 haml-rails-2.1.0/test/test_helper.rb0000644000004100000410000000225114323154045017416 0ustar www-datawww-datarequire 'rubygems' require 'minitest/autorun' require 'action_pack' require 'action_controller' require 'action_view' require 'rails' require 'rails/generators' require 'rails/generators/test_case' Bundler.require(:default) class TestApp < Rails::Application config.root = File.dirname(__FILE__) config.eager_load = false end module Rails def self.root @root ||= Pathname.new(File.expand_path(File.join(File.dirname(__FILE__), '..', 'tmp', 'rails'))) end end TestApp.initialize! Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f} module Haml module Rails module GeneratorTestHelpers private 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 end end end ::Rails::Generators::TestCase.include Haml::Rails::GeneratorTestHelpers # Remove tmp directory when test suite is completed MiniTest.after_run do tmp_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'tmp')) FileUtils.rm_r(tmp_dir) end haml-rails-2.1.0/README.md0000644000004100000410000000540214323154044015053 0ustar www-datawww-data# Haml-rails [![Build Status](https://travis-ci.org/haml/haml-rails.svg)](https://travis-ci.org/haml/haml-rails) Haml-rails provides Haml generators for Rails 5. 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", "~> 2.0" 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: $ rails 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. If you are running in a script, you can use an environment variable to answer this question. $ HAML_RAILS_DELETE_ERB=true rails haml:erb2haml Running the above will not prompt for the question and will delete the original .erb files. Setting this value to false will also not prompt, however, will leave the .erb files intact. ### Older versions of Rails The current version of Haml-rails requires Rails 5.1 or later. Haml-rails version 1.0.0 is the last version to support Rails 4. To use it, add this line to your Gemfile: gem "haml-rails", "~> 1.0.0" For Rails 3, use haml-rails version 0.4 by adding this line to your Gemfile instead: 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. ### License Ruby license or MIT license, take your pick. haml-rails-2.1.0/gemfiles/0000755000004100000410000000000014323154044015366 5ustar www-datawww-datahaml-rails-2.1.0/gemfiles/rails_7_0.gemfile0000644000004100000410000000020414323154044020473 0ustar www-datawww-data# This file was generated by Appraisal source "https://rubygems.org" gem "html2haml" gem "rails", "~> 7.0.0" gemspec path: "../" haml-rails-2.1.0/gemfiles/rails_5_2.gemfile0000644000004100000410000000020414323154044020473 0ustar www-datawww-data# This file was generated by Appraisal source "https://rubygems.org" gem "html2haml" gem "rails", "~> 5.2.0" gemspec path: "../" haml-rails-2.1.0/gemfiles/rails_6_1.gemfile0000644000004100000410000000020414323154044020473 0ustar www-datawww-data# This file was generated by Appraisal source "https://rubygems.org" gem "html2haml" gem "rails", "~> 6.1.0" gemspec path: "../" haml-rails-2.1.0/gemfiles/rails_5_1.gemfile0000644000004100000410000000020414323154044020472 0ustar www-datawww-data# This file was generated by Appraisal source "https://rubygems.org" gem "html2haml" gem "rails", "~> 5.1.0" gemspec path: "../" haml-rails-2.1.0/gemfiles/rails_6_0.gemfile0000644000004100000410000000020414323154044020472 0ustar www-datawww-data# This file was generated by Appraisal source "https://rubygems.org" gem "html2haml" gem "rails", "~> 6.0.0" gemspec path: "../" haml-rails-2.1.0/Appraisals0000644000004100000410000000042214323154044015613 0ustar www-datawww-dataappraise "rails_5_1" do gem "rails", "~> 5.1.0" end appraise "rails_5_2" do gem "rails", "~> 5.2.0" end appraise "rails_6_0" do gem "rails", "~> 6.0.0" end appraise "rails_6_1" do gem "rails", "~> 6.1.0" end appraise "rails_7_0" do gem "rails", "~> 7.0.0" end haml-rails-2.1.0/haml-rails.gemspec0000644000004100000410000000254014323154044017172 0ustar www-datawww-data# -*- 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 = "https://github.com/haml/haml-rails" s.summary = "let your Gemfile do the configuring" s.description = "Haml-rails provides Haml generators for Rails 5. 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.required_rubygems_version = ">= 2.0.0" s.required_ruby_version = ">= 2.3.0" s.add_dependency "haml", [">= 4.0.6"] s.add_dependency "activesupport", [">= 5.1"] s.add_dependency "actionpack", [">= 5.1"] s.add_dependency "railties", [">= 5.1"] s.add_development_dependency "html2haml", [">= 1.0.1"] s.add_development_dependency "rails", [">= 5.1"] s.add_development_dependency "bundler" s.add_development_dependency "rake" s.add_development_dependency 'appraisal' s.files = `git ls-files`.split("\n") s.executables = `git ls-files`.split("\n").select{|f| f =~ /^bin/} s.require_path = 'lib' end haml-rails-2.1.0/.gitignore0000644000004100000410000000007614323154044015566 0ustar www-datawww-data*.gem .bundle/ *.lock gemfiles/*.lock tmp/ /vendor/bundle log haml-rails-2.1.0/LICENSE0000644000004100000410000000206114323154044014577 0ustar www-datawww-dataCopyright (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. haml-rails-2.1.0/Rakefile0000644000004100000410000000037114323154044015241 0ustar www-datawww-datarequire '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 haml-rails-2.1.0/lib/0000755000004100000410000000000014323154045014342 5ustar www-datawww-datahaml-rails-2.1.0/lib/tasks/0000755000004100000410000000000014323154045015467 5ustar www-datawww-datahaml-rails-2.1.0/lib/tasks/erb2haml.rake0000644000004100000410000000530314323154045020030 0ustar www-datawww-datanamespace :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 erb_files_to_convert = erb_files.dup 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}" } if ENV.has_key?("HAML_RAILS_OVERWRITE_HAML") && (ENV["HAML_RAILS_OVERWRITE_HAML"] == "false") should_overwrite = 'n' else # 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) end puts '-'*80 # If we are not overwriting, remove each already_existing from our erb_files list if should_overwrite == 'n' erb_files_to_convert = erb_files - already_existing if erb_files_to_convert.empty? # It is possible no .erb files remain, after we remove already_existing puts "No .erb files to convert" end else # Delete the current .haml already_existing.each { |f| File.delete(f.gsub(/\.erb\z/, '.haml')) } end end erb_files_to_convert.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_to_convert.each do |file| puts "\t#{file}" end puts '-'*80 if ENV.has_key?("HAML_RAILS_DELETE_ERB") && (ENV["HAML_RAILS_DELETE_ERB"] == "true") should_delete = 'y' else 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) end 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 end haml-rails-2.1.0/lib/haml-rails.rb0000644000004100000410000000464114323154044016724 0ustar www-datawww-datarequire 'haml' require 'rails' require 'haml/railtie' module Haml module Rails 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 annotation 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 annotation_class = if ::Rails::VERSION::STRING >= '6.0' require 'rails/source_annotation_extractor' ::Rails::SourceAnnotationExtractor::Annotation else ::SourceAnnotationExtractor::Annotation end annotation_class.register_extensions('haml') do |tag| /\s*-#\s*(#{tag}):?\s*(.*)/ end end end rake_tasks do load 'tasks/erb2haml.rake' end end end end haml-rails-2.1.0/lib/generators/0000755000004100000410000000000014323154044016512 5ustar www-datawww-datahaml-rails-2.1.0/lib/generators/haml/0000755000004100000410000000000014323154044017433 5ustar www-datawww-datahaml-rails-2.1.0/lib/generators/haml/scaffold/0000755000004100000410000000000014323154044021214 5ustar www-datawww-datahaml-rails-2.1.0/lib/generators/haml/scaffold/scaffold_generator.rb0000644000004100000410000000156114323154044025373 0ustar www-datawww-datarequire '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 private def available_views %w(index edit show new) end def handler :haml end end end end haml-rails-2.1.0/lib/generators/haml/scaffold/templates/0000755000004100000410000000000014323154044023212 5ustar www-datawww-datahaml-rails-2.1.0/lib/generators/haml/scaffold/templates/_form.html.haml0000644000004100000410000000104514323154044026122 0ustar www-datawww-data= 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 |message| %li= message <% for attribute in attributes -%> .field = f.label :<%= attribute.name %> = f.<%= attribute.field_type %> :<%= attribute.name %> <% end -%> .actions = f.submit 'Save' haml-rails-2.1.0/lib/generators/haml/scaffold/templates/show.html.haml0000644000004100000410000000043714323154044026004 0ustar www-datawww-data%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 haml-rails-2.1.0/lib/generators/haml/scaffold/templates/index.html.haml0000644000004100000410000000131014323154044026122 0ustar www-datawww-data%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 haml-rails-2.1.0/lib/generators/haml/scaffold/templates/new.html.haml0000644000004100000410000000014014323154044025604 0ustar www-datawww-data%h1 New <%= singular_table_name %> = render 'form' = link_to 'Back', <%= index_helper %>_path haml-rails-2.1.0/lib/generators/haml/scaffold/templates/edit.html.haml0000644000004100000410000000022514323154044025744 0ustar www-datawww-data%h1 Editing <%= singular_table_name %> = render 'form' = link_to 'Show', @<%= singular_table_name %> \| = link_to 'Back', <%= index_helper %>_path haml-rails-2.1.0/lib/generators/haml/mailer/0000755000004100000410000000000014323154044020704 5ustar www-datawww-datahaml-rails-2.1.0/lib/generators/haml/mailer/templates/0000755000004100000410000000000014323154044022702 5ustar www-datawww-datahaml-rails-2.1.0/lib/generators/haml/mailer/templates/layout.html.haml0000644000004100000410000000025514323154044026027 0ustar www-datawww-data!!! %html %head %meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-Type"}/ :css /* Email styles need to be inline */ %body = yield haml-rails-2.1.0/lib/generators/haml/mailer/templates/layout.text.haml0000644000004100000410000000001014323154044026034 0ustar www-datawww-data= yield haml-rails-2.1.0/lib/generators/haml/mailer/templates/view.text.haml0000644000004100000410000000011414323154044025476 0ustar www-datawww-data<%= class_name %>#<%= @action %> = @greeting + ", find me in <%= @path %>" haml-rails-2.1.0/lib/generators/haml/mailer/templates/view.html.haml0000644000004100000410000000012014323154044025453 0ustar www-datawww-data%h1= class_name + "#" + @action %p = @greeting + ", find me in <%= @path %>" haml-rails-2.1.0/lib/generators/haml/mailer/mailer_generator.rb0000644000004100000410000000043614323154044024553 0ustar www-datawww-datarequire 'rails/generators/erb/mailer/mailer_generator' module Haml module Generators class MailerGenerator < Erb::Generators::MailerGenerator source_root File.expand_path("../templates", __FILE__) private def handler :haml end end end end haml-rails-2.1.0/lib/generators/haml/controller/0000755000004100000410000000000014323154044021616 5ustar www-datawww-datahaml-rails-2.1.0/lib/generators/haml/controller/templates/0000755000004100000410000000000014323154044023614 5ustar www-datawww-datahaml-rails-2.1.0/lib/generators/haml/controller/templates/view.html.haml0000644000004100000410000000010014323154044026363 0ustar www-datawww-data%h1 <%= class_name %>#<%= @action %> %p Find me in <%= @path %> haml-rails-2.1.0/lib/generators/haml/controller/controller_generator.rb0000644000004100000410000000045614323154044026401 0ustar www-datawww-datarequire 'rails/generators/erb/controller/controller_generator' module Haml module Generators class ControllerGenerator < Erb::Generators::ControllerGenerator source_root File.expand_path("../templates", __FILE__) private def handler :haml end end end end haml-rails-2.1.0/lib/rails/0000755000004100000410000000000014323154044015453 5ustar www-datawww-datahaml-rails-2.1.0/lib/rails/generators/0000755000004100000410000000000014323154045017625 5ustar www-datawww-datahaml-rails-2.1.0/lib/rails/generators/haml/0000755000004100000410000000000014323154045020546 5ustar www-datawww-datahaml-rails-2.1.0/lib/rails/generators/haml/application_layout/0000755000004100000410000000000014323154045024446 5ustar www-datawww-datahaml-rails-2.1.0/lib/rails/generators/haml/application_layout/application_layout_generator.rb0000644000004100000410000000223514323154045032743 0ustar www-datawww-datarequire 'rails' require 'shellwords' module Haml module Generators class ApplicationLayoutGenerator < ::Rails::Generators::Base HTML_LAYOUT_PATH = 'app/views/layouts/application.html.erb' HAML_LAYOUT_PATH = 'app/views/layouts/application.html.haml' # 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(HTML_LAYOUT_PATH).to_s app_layout_to = ::Rails.root.join(HAML_LAYOUT_PATH).to_s if File.exist?(app_layout_from) if !File.exist?(app_layout_to) `html2haml #{app_layout_from.shellescape} #{app_layout_to.shellescape}` 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 haml-rails-2.1.0/lib/haml-rails/0000755000004100000410000000000014323154044016372 5ustar www-datawww-datahaml-rails-2.1.0/lib/haml-rails/version.rb0000644000004100000410000000007314323154044020404 0ustar www-datawww-datamodule Haml module Rails VERSION = "2.1.0" end end haml-rails-2.1.0/Gemfile0000644000004100000410000000016014323154044015063 0ustar www-datawww-datasource 'https://rubygems.org' # Specify your gem's dependencies in haml-rails.gemspec gemspec gem 'html2haml' haml-rails-2.1.0/.github/0000755000004100000410000000000014323154044015133 5ustar www-datawww-datahaml-rails-2.1.0/.github/workflows/0000755000004100000410000000000014323154044017170 5ustar www-datawww-datahaml-rails-2.1.0/.github/workflows/ruby.yml0000644000004100000410000000353714323154044020704 0ustar www-datawww-data# This workflow uses actions that are not certified by GitHub. # They are provided by a third-party and are governed by # separate terms of service, privacy policy, and support # documentation. # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby name: Ruby on: push: branches: [ master ] pull_request: branches: [ master ] jobs: test: runs-on: ubuntu-latest strategy: matrix: ruby-version: - 3.1 - 3.0 - 2.7 - jruby gemfile: - rails_7_0 - rails_6_1 - rails_6_0 include: - ruby-version: 2.7 gemfile: rails_5_2 - ruby-version: 2.7 gemfile: rails_5_1 - ruby-version: 2.6 gemfile: rails_6_1 - ruby-version: 2.6 gemfile: rails_6_0 - ruby-version: 2.6 gemfile: rails_5_2 - ruby-version: 2.6 gemfile: rails_5_1 exclude: - ruby-version: jruby gemfile: rails_7_0 env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile steps: - uses: actions/checkout@v3 - name: Set up Ruby # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby, # change this to (see https://github.com/ruby/setup-ruby#versioning): uses: ruby/setup-ruby@v1 # uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e with: ruby-version: ${{ matrix.ruby-version }} bundler-cache: true # runs 'bundle install' and caches installed gems automatically - name: Run tests run: bundle exec rake