Sha256: 2dc45847bfd47c89953cc4ae9ca835501296105aa632cd2539e2b6b49a2f7a91

Contents?: true

Size: 1.86 KB

Versions: 24

Compression:

Stored size: 1.86 KB

Contents

require 'erb'

module Daddy
  module Formatter
    module DaddyHtml

      def ruby_version_dir
        unless @_ruby_version_dir
          @_ruby_version_dir = RUBY_VERSION.split('.')[0..1].join('.') + '.0'
        end
        @_ruby_version_dir
      end

      def title
        ret = ENV['TITLE']
        ret ||= Daddy.config.cucumber.title if Daddy.config.cucumber.title?
        ret ||= 'Daddy'
        ret
      end
      
      def before_menu
        if ENV['PUBLISH']
          @builder << "<div>"

          @builder.div(:id => 'menu') do
              @builder << make_menu_for_publish
          end

          @builder << "<div class='contents'>"
        end
      end

      def after_menu
        if ENV['PUBLISH']
          @builder << '</div>'
          @builder << '</div>'
        end
      end

      def make_menu_for_publish
        template = File.join(File.dirname(__FILE__), 'menu.html.erb')
        ERB.new(File.read(template), 0, '-').result
      end

      def feature_id
        @feature.file.gsub(/(\/|\.|\\)/, '_')
      end

      def feature_dir(feature, short = false)
        ret = ''
        
        split = feature.file.split(File::SEPARATOR)
        split.reverse[1..-2].each_with_index do |dir, i|
          break if dir == '仕様書' or dir == '開発日記'

          if i == 0
            if short
              ret = dir.split('.').first + '.'
            else
              ret = dir
            end
          else
            ret = dir.split('.').first + '.' + ret
          end
        end

        ret
      end

      def should_expand
        ['t', 'true'].include?(ENV['EXPAND'].to_s.downcase)
      end

      def magic_comment?(comment_line)
        comment = comment_line.to_s

        ['language', 'format'].each do |magic|
          return true if /#\s*#{magic}\s*:.*/ =~ comment
        end
        
        false
      end

    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
daddy-0.3.32 lib/daddy/formatter/daddy_html.rb
daddy-0.3.31 lib/daddy/formatter/daddy_html.rb
daddy-0.3.30 lib/daddy/formatter/daddy_html.rb
daddy-0.3.29 lib/daddy/formatter/daddy_html.rb
daddy-0.3.28 lib/daddy/formatter/daddy_html.rb
daddy-0.3.27 lib/daddy/formatter/daddy_html.rb
daddy-0.3.26 lib/daddy/formatter/daddy_html.rb
daddy-0.3.25 lib/daddy/formatter/daddy_html.rb
daddy-0.3.24 lib/daddy/formatter/daddy_html.rb
daddy-0.3.23 lib/daddy/formatter/daddy_html.rb
daddy-0.3.22 lib/daddy/formatter/daddy_html.rb
daddy-0.3.21 lib/daddy/formatter/daddy_html.rb
daddy-0.3.20 lib/daddy/formatter/daddy_html.rb
daddy-0.3.19 lib/daddy/formatter/daddy_html.rb
daddy-0.3.18 lib/daddy/formatter/daddy_html.rb
daddy-0.3.17 lib/daddy/formatter/daddy_html.rb
daddy-0.3.16 lib/daddy/formatter/daddy_html.rb
daddy-0.3.15 lib/daddy/formatter/daddy_html.rb
daddy-0.3.14 lib/daddy/formatter/daddy_html.rb
daddy-0.3.13 lib/daddy/formatter/daddy_html.rb