ember 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CREDITS ADDED
@@ -0,0 +1,13 @@
1
+ %#----------------------------------------------------------------------------
2
+ ## CREDITS
3
+ %#----------------------------------------------------------------------------
4
+
5
+ Suraj N. Kurapati,
6
+ Kamil Kukura
7
+
8
+ %#----------------------------------------------------------------------------
9
+ ## LICENSE
10
+ %#----------------------------------------------------------------------------
11
+
12
+ %# See the file named "LICENSE".
13
+ %< "LICENSE"
data/bin/ember CHANGED
@@ -3,9 +3,16 @@
3
3
  require 'ember'
4
4
 
5
5
  if ARGV.delete('-h') or ARGV.delete('--help')
6
- man_dir = File.join(Ember::INSTDIR, 'man')
7
- system 'man', '-M', man_dir, '-a', 'ember' or
8
- puts Dir["#{man_dir}/**/*.html"].push(Ember::WEBSITE).map {|s| "See #{s}" }
6
+ # try to display UNIX version of help manual
7
+ man_path = File.join(Ember::INSTDIR, 'man')
8
+ unless system 'man', '-M', man_path, '-a', 'ember'
9
+ # try to display HTML version of help manual
10
+ man_html = man_path + '.html'
11
+ unless %w[$BROWSER open start].any? {|b| system "#{b} #{man_html}" }
12
+ # no luck; direct user to project website
13
+ puts "See #{Ember::WEBSITE}"
14
+ end
15
+ end
9
16
  exit
10
17
  elsif ARGV.delete('-v') or ARGV.delete('--version')
11
18
  puts Ember::VERSION
@@ -0,0 +1,32 @@
1
+ module ActionView
2
+ module TemplateHandlers
3
+ #
4
+ # @example Setting processing options for Ember
5
+ #
6
+ # ActionView::TemplateHandlers::Ember.options = {
7
+ # :unindent => true,
8
+ # :shorthand => true,
9
+ # :infer_end => true
10
+ # }
11
+ #
12
+ # @see Ember::Template
13
+ #
14
+ class Ember < TemplateHandler
15
+ include Compilable
16
+
17
+ @@options = {}
18
+ cattr_accessor :options
19
+
20
+ def compile(template)
21
+ options = @@options.merge(:result_variable => :@output_buffer,
22
+ :source_file => template.filename)
23
+ ember = ::Ember::Template.new(template.source, options)
24
+ "__in_erb_template = true; #{ember.program}"
25
+ end
26
+ end
27
+ end
28
+
29
+ ember_handler = TemplateHandlers::Ember
30
+ Template.register_default_template_handler :erb, ember_handler
31
+ Template.register_template_handler :rhtml, ember_handler
32
+ end
@@ -18,12 +18,12 @@ module Ember
18
18
  ##
19
19
  # Number of this release of this project.
20
20
  #
21
- VERSION = "0.1.1"
21
+ VERSION = "0.2.0"
22
22
 
23
23
  ##
24
24
  # Date of this release of this project.
25
25
  #
26
- RELDATE = "2010-04-20"
26
+ RELDATE = "2010-04-25"
27
27
 
28
28
  ##
29
29
  # Description of this release of this project.
@@ -363,7 +363,7 @@ module Ember
363
363
 
364
364
  # directive
365
365
  template_class_name = '::Ember::Template'
366
- nested_template_args = "(#{arguments}), #{@options.inspect}"
366
+ nested_template_args = "(#{arguments.strip}), #{@options.inspect}"
367
367
 
368
368
  nest_template_with = lambda do |meth|
369
369
  @program.emit_code "#{template_class_name}.#{meth}(#{
@@ -12,19 +12,18 @@
12
12
  line-height:1.3;
13
13
  color:#343331;
14
14
  background:#fff; }
15
- #man { max-width:81ex; text-align:justify; margin:0 25px 25px 25px }
15
+ #man { max-width:87ex; margin:0 3ex 1ex 1ex; text-align:justify; }
16
16
  #man div.man-navigation {
17
17
  position:fixed;
18
18
  top:0;
19
- left:87ex;
19
+ left:91ex;
20
20
  height:100%;
21
21
  width:100%;
22
- padding-top:1ex;
23
- padding-left:2ex;
24
- border-left:1ex solid #DCDCDC;
22
+ padding:1ex 0 0 2ex;
23
+ border-left:0.5ex solid #DCDCDC;
25
24
  background-color: #F5F5F5;
26
25
  }
27
- #man div.man-navigation a { display:block; margin-bottom:15px }
26
+ #man div.man-navigation a { display:block; margin-bottom:1.5ex }
28
27
  #man h1, #man h2, #man h3 { color:#232221;clear:left }
29
28
  #man h1 { font-size:28px; margin:15px 0 30px 0; text-align:center }
30
29
  #man h2 { font-size:18px; margin-bottom:0; margin-top:10px; line-height:1.3; }
@@ -61,6 +60,7 @@
61
60
  #man ol.man li.tr { text-align:right; float: right }
62
61
  #man ol.man a { color:#999 }
63
62
  #man ol.man a:hover { color:#333231 }
63
+ #man img { display:block; margin:auto }
64
64
  </style>
65
65
  <style type='text/css' media='print'>
66
66
  #man { max-width:none }
@@ -79,7 +79,7 @@
79
79
 
80
80
  <ol class='head man'>
81
81
  <li class='tl'>ember(1)</li>
82
- <li class='tc'>Version 0.1.1</li>
82
+ <li class='tc'>Version 0.2.0</li>
83
83
  <li class='tr'>ember(1)</li>
84
84
  </ol>
85
85
 
@@ -129,6 +129,11 @@ Ruby.</p></li>
129
129
  <pre><code>gem install ember
130
130
  </code></pre>
131
131
 
132
+ <p>Installing as a <a href="http://rubyonrails.org">Ruby on Rails</a> plugin:</p>
133
+
134
+ <pre><code>script/plugin install git://github.com/sunaku/ember.git
135
+ </code></pre>
136
+
132
137
  <p>Upgrading:</p>
133
138
 
134
139
  <pre><code>gem update ember
@@ -152,15 +157,15 @@ given, then the standard input stream (STDIN) is evaluated instead.</p>
152
157
  <h2 id="OPTIONS">OPTIONS</h2>
153
158
 
154
159
  <dl>
155
- <dt><code>-s</code>, <code>--shorthand</code></dt><dd><p> Treat lines beginning with zero or more whitespace
156
- followed by the "%" character as eRuby directives.</p></dd>
157
- <dt><code>-i</code>, <code>--infer_end</code></dt><dd><p> Add missing <code>&lt;% end %></code> directives based on indentation.</p></dd>
158
- <dt><code>-u</code>, <code>--unindent</code></dt><dd><p> Unindent the bodies of directives that define a
159
- Ruby block (do ... end) or scope (begin ... end).</p></dd>
160
- <dt><code>-c</code>, <code>--compile</code></dt><dd><p> Print underlying Ruby program compiled
161
- from the input eRuby template and exit.</p></dd>
162
- <dt><code>-h</code>, <code>--help</code></dt><dd><p> Print this message and exit.</p></dd>
163
- <dt><code>-v</code>, <code>--version</code></dt><dd><p> Print version number and exit.</p></dd>
160
+ <dt><code>-s</code>, <code>--shorthand</code></dt><dd><p>Treat lines beginning with zero or more whitespace
161
+ followed by the "%" character as eRuby directives.</p></dd>
162
+ <dt><code>-i</code>, <code>--infer_end</code></dt><dd><p>Add missing <code>&lt;% end %></code> directives based on indentation.</p></dd>
163
+ <dt><code>-u</code>, <code>--unindent</code></dt><dd><p>Unindent the bodies of directives that define a
164
+ Ruby block (do ... end) or scope (begin ... end).</p></dd>
165
+ <dt><code>-c</code>, <code>--compile</code></dt><dd><p>Print underlying Ruby program compiled
166
+ from the input eRuby template and exit.</p></dd>
167
+ <dt><code>-h</code>, <code>--help</code></dt><dd><p>Display this manual and exit.</p></dd>
168
+ <dt><code>-v</code>, <code>--version</code></dt><dd><p>Print version number and exit.</p></dd>
164
169
  </dl>
165
170
 
166
171
 
@@ -512,9 +517,9 @@ _erbout &lt;&lt; " \n"
512
517
  above template compiles into:</p>
513
518
 
514
519
  <pre><code>(_erbout = []; _erbout &lt;&lt; "\n"
515
- _erbout &lt;&lt; (::Ember::Template.read_file(( "doc/example.txt" ), {:shorthand=&gt;true, :source_file=&gt;"./EXAMPLES"})) &lt;&lt; "\n"
520
+ _erbout &lt;&lt; (::Ember::Template.read_file(("doc/example.txt"), {:shorthand=&gt;true, :source_file=&gt;"./EXAMPLES"})) &lt;&lt; "\n"
516
521
  _erbout &lt;&lt; "\n"
517
- _erbout &lt;&lt; (::Ember::Template.read_file(( "doc/example.txt"), {:shorthand=&gt;true, :source_file=&gt;"./EXAMPLES"})) &lt;&lt; "\n"
522
+ _erbout &lt;&lt; (::Ember::Template.read_file(("doc/example.txt"), {:shorthand=&gt;true, :source_file=&gt;"./EXAMPLES"})) &lt;&lt; "\n"
518
523
  _erbout &lt;&lt; "\n"
519
524
  _erbout &lt;&lt; " \n"
520
525
  ; _erbout.join)
@@ -548,9 +553,9 @@ This is a plain-text file. Notice that &lt;%=
548
553
  above template compiles into:</p>
549
554
 
550
555
  <pre><code>(_erbout = []; _erbout &lt;&lt; "\n"
551
- ::Ember::Template.load_file(( "doc/example.erb" ), {:shorthand=&gt;true, :source_file=&gt;"./EXAMPLES"}.merge!(:continue_result =&gt; true)).render(nil, 79777922); _erbout &lt;&lt; "\n"
556
+ ::Ember::Template.load_file(("doc/example.erb"), {:shorthand=&gt;true, :source_file=&gt;"./EXAMPLES"}.merge!(:continue_result =&gt; true)).render(nil, 78416100); _erbout &lt;&lt; "\n"
552
557
  _erbout &lt;&lt; "\n"
553
- ::Ember::Template.load_file(( "doc/example.erb"), {:shorthand=&gt;true, :source_file=&gt;"./EXAMPLES"}.merge!(:continue_result =&gt; true)).render(nil, 79777922); _erbout &lt;&lt; "\n"
558
+ ::Ember::Template.load_file(("doc/example.erb"), {:shorthand=&gt;true, :source_file=&gt;"./EXAMPLES"}.merge!(:continue_result =&gt; true)).render(nil, 78416100); _erbout &lt;&lt; "\n"
554
559
  _erbout &lt;&lt; "\n"
555
560
  _erbout &lt;&lt; " \n"
556
561
  ; _erbout.join)
@@ -574,9 +579,9 @@ This is an eRuby template. Notice that eRuby directives do take effect here!
574
579
  above template compiles into:</p>
575
580
 
576
581
  <pre><code>(_erbout = []; _erbout &lt;&lt; "\n"
577
- ::Ember::Template.new(( "%= 2 + 2" ), {:shorthand=&gt;true}.merge!(:continue_result =&gt; true)).render(nil, 79408546); _erbout &lt;&lt; "\n"
582
+ ::Ember::Template.new(("%= 2 + 2"), {:shorthand=&gt;true}.merge!(:continue_result =&gt; true)).render(nil, 77958272); _erbout &lt;&lt; "\n"
578
583
  _erbout &lt;&lt; "\n"
579
- ::Ember::Template.new(( "%= 2 + 2"), {:shorthand=&gt;true}.merge!(:continue_result =&gt; true)).render(nil, 79408546); _erbout &lt;&lt; "\n"
584
+ ::Ember::Template.new(("%= 2 + 2"), {:shorthand=&gt;true}.merge!(:continue_result =&gt; true)).render(nil, 77958272); _erbout &lt;&lt; "\n"
580
585
  _erbout &lt;&lt; "\n"
581
586
  _erbout &lt;&lt; " \n"
582
587
  ; _erbout.join)
@@ -602,12 +607,13 @@ _erbout &lt;&lt; " \n"
602
607
 
603
608
  <h3 id="Infrastructure">Infrastructure</h3>
604
609
 
605
- <p><a href="http://snk.tuxfamily.org/lib/inochi/">Inochi</a> serves as Ember's project infrastructure.
606
- It handles tasks such as building this manual and API documentation, and
607
- packaging, announcing, and publishing new releases. See its manual to get
608
- started:</p>
610
+ <p><a href="http://snk.tuxfamily.org/lib/inochi/">Inochi</a> serves as the project infrastructure for Ember. It handles tasks
611
+ such as building this help manual and API documentation, and packaging,
612
+ announcing, and publishing new releases. See its help manual and list of
613
+ tasks to get started:</p>
609
614
 
610
- <pre><code>inochi --help
615
+ <pre><code>inochi --help # display help manual
616
+ inochi --tasks # list available tasks
611
617
  </code></pre>
612
618
 
613
619
  <h3 id="-LOAD_PATH-setup">$LOAD_PATH setup</h3>
@@ -617,7 +623,8 @@ use any libraries therein or run any executables in the <code>bin/</code> direct
617
623
 
618
624
  <p>This can be achieved by passing an option to Ruby:</p>
619
625
 
620
- <pre><code>ruby -Ilib
626
+ <pre><code>ruby -Ilib bin/ember
627
+ irb -Ilib -r ember
621
628
  </code></pre>
622
629
 
623
630
  <p>Or by setting the <code>$RUBYLIB</code> environment variable:</p>
@@ -625,19 +632,23 @@ use any libraries therein or run any executables in the <code>bin/</code> direct
625
632
  <pre><code>export RUBYLIB=lib # bash, ksh, zsh
626
633
  setenv RUBYLIB lib # csh
627
634
  set -x RUBYLIB lib # fish
635
+
636
+ ruby bin/ember
637
+ irb -r ember
628
638
  </code></pre>
629
639
 
630
640
  <p>Or by installing the <a href="http://github.com/chneukirchen/rup">ruby-wrapper</a> tool.</p>
631
641
 
632
642
  <h3 id="RubyGems-setup">RubyGems setup</h3>
633
643
 
634
- <p>If you use Ruby 1.8 and RubyGems to manage your Ruby software, then ensure
635
- that RubyGems is activated before you use any libraries in the <code>lib/</code>
636
- directory or run any executables in the <code>bin/</code> directory.</p>
644
+ <p>If you use Ruby 1.8 or older, then ensure that RubyGems is activated before
645
+ you use any libraries in the <code>lib/</code> directory or run any executables in the
646
+ <code>bin/</code> directory.</p>
637
647
 
638
648
  <p>This can be achieved by passing an option to Ruby:</p>
639
649
 
640
- <pre><code>ruby -rubygems
650
+ <pre><code>ruby -rubygems bin/ember
651
+ irb -rubygems -r ember
641
652
  </code></pre>
642
653
 
643
654
  <p>Or by setting the <code>$RUBYOPT</code> environment variable:</p>
@@ -668,6 +679,29 @@ in the <code>test/test_helper.rb</code> file.</p>
668
679
 
669
680
  <p>This section contains release notes of current and past releases.</p>
670
681
 
682
+ <h3 id="Version-0-2-0-2010-04-25-">Version 0.2.0 (2010-04-25)</h3>
683
+
684
+ <p>This release adds <a href="http://rubyonrails.org">Ruby on Rails</a> integration.</p>
685
+
686
+ <p>New features:</p>
687
+
688
+ <ul>
689
+ <li><p>Ember can now be used directly as a <a href="http://rubyonrails.org">Ruby on Rails</a> (2.3 or newer) plugin.
690
+ The plugin registers Ember as the default Rails template handler for "erb"
691
+ and "rhtml" file types. Ember processing options can be set in the Rails
692
+ environment file:</p>
693
+
694
+ <pre><code>ActionView::TemplateHandlers::Ember.options = {
695
+ :unindent =&gt; true,
696
+ :shorthand =&gt; true,
697
+ :infer_end =&gt; true
698
+ }
699
+ </code></pre>
700
+
701
+ <p>This feature was contributed by Kamil Kukura.</p></li>
702
+ </ul>
703
+
704
+
671
705
  <h3 id="Version-0-1-1-2010-04-20-">Version 0.1.1 (2010-04-20)</h3>
672
706
 
673
707
  <p>This release fixes a nested rendering bug, updates the manual, and further
@@ -679,9 +713,9 @@ beautifies the Ruby code that results from eRuby template compilation.</p>
679
713
  <li><p><code>Ember::Template#render()</code> now creates isolated contexts by default to
680
714
  prevent nested calls from clobbering each other's output!</p>
681
715
 
682
- <p>For example, if template A calls method X which renders template B (thinking
683
- that template B's rendering is isolated and will not affect the rendering of
684
- template A) then you're in for a hell of a wild bug chase! >8-(</p></li>
716
+ <p>For example, if template A calls method X which renders template B
717
+ (thinking that template B's rendering is isolated and will not affect the
718
+ rendering of template A) then you're in for a wild bug chase! >8-(</p></li>
685
719
  </ul>
686
720
 
687
721
 
@@ -710,13 +744,13 @@ with section separators made from single-line comment directives:</p>
710
744
 
711
745
  Inside some_block_directive.
712
746
 
713
- %#---------------------------------------------------------------------
747
+ %#-------------------------------------------------------------------
714
748
 
715
749
  Still inside some_block_directive!
716
750
 
717
- %#-------------------------------------------------------------------
751
+ %#-----------------------------------------------------------------
718
752
  %| nested_block_directive
719
- %#-------------------------------------------------------------------
753
+ %#-----------------------------------------------------------------
720
754
 
721
755
  Inside nested_block_directive.
722
756
  </code></pre></li>
@@ -755,9 +789,7 @@ depends on the "inochi" or "trollop" gems at runtime.</li>
755
789
  <ul>
756
790
  <li><p>Use simpler Copyright reminder at the top of every file.</p></li>
757
791
  <li><p>Rename internal <code>Program</code> class' methods to be self-documenting.</p></li>
758
- <li><p>Open source is for fun, so <a href="http://loiclemeur.com/english/2009/03/never-criticize-your-competitors.html">be
759
- nice</a>
760
- and speak of "related works" instead of "competitors".</p></li>
792
+ <li><p>Open source is for fun, so <a href="http://loiclemeur.com/english/2009/03/never-criticize-your-competitors.html">be nice</a> and speak of "related works" instead of "competitors".</p></li>
761
793
  </ul>
762
794
 
763
795
 
@@ -767,13 +799,14 @@ and speak of "related works" instead of "competitors".</p></li>
767
799
 
768
800
  <h2 id="CREDITS">CREDITS</h2>
769
801
 
770
- <p>Suraj N. Kurapati</p>
802
+ <p>Suraj N. Kurapati,
803
+ Kamil Kukura</p>
771
804
 
772
805
  <h2 id="LICENSE">LICENSE</h2>
773
806
 
774
807
  <p>(the ISC license)</p>
775
808
 
776
- <p>Copyright 2009 Suraj N. Kurapati <a href="&#109;&#97;&#105;&#x6c;&#x74;&#111;&#x3a;&#x73;&#x75;&#110;&#x61;&#107;&#117;&#64;&#x67;&#109;&#x61;&#105;&#x6c;&#x2e;&#x63;&#x6f;&#109;" data-bare-link="true">&#115;&#x75;&#x6e;&#x61;&#x6b;&#117;&#x40;&#103;&#109;&#x61;&#105;&#x6c;&#x2e;&#99;&#111;&#109;</a></p>
809
+ <p>Copyright 2009 Suraj N. Kurapati <a href="&#x6d;&#97;&#x69;&#108;&#116;&#111;&#x3a;&#x73;&#117;&#x6e;&#x61;&#x6b;&#x75;&#64;&#103;&#x6d;&#97;&#105;&#x6c;&#x2e;&#99;&#x6f;&#x6d;" data-bare-link="true">&#115;&#117;&#x6e;&#97;&#x6b;&#117;&#x40;&#x67;&#x6d;&#x61;&#105;&#108;&#46;&#99;&#x6f;&#x6d;</a></p>
777
810
 
778
811
  <p>Permission to use, copy, modify, and/or distribute this software for any
779
812
  purpose with or without fee is hereby granted, provided that the above
@@ -789,9 +822,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.</p>
789
822
 
790
823
  <h2 id="SEE-ALSO">SEE ALSO</h2>
791
824
 
792
- <p>erb(1),
793
- <a href="http://www.kuwata-lab.com/erubis/">Erubis</a>,
794
- <a href="http://modruby.net/en/">eruby</a></p>
825
+ <p>erb(1)</p>
795
826
 
796
827
 
797
828
  <ol class='foot man'>
Binary file
metadata CHANGED
@@ -4,17 +4,18 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
8
- - 1
9
- version: 0.1.1
7
+ - 2
8
+ - 0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Suraj N. Kurapati
13
+ - Kamil Kukura
13
14
  autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-04-20 00:00:00 -07:00
18
+ date: 2010-04-25 00:00:00 -07:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
@@ -41,9 +42,7 @@ dependencies:
41
42
  version: "2"
42
43
  type: :development
43
44
  version_requirements: *id002
44
- description: |-
45
- Ember (EMBEdded Ruby) is an eRuby template processor that allows
46
- debugging, reduces markup, and improves composability of eRuby templates.
45
+ description: Ember (EMBEdded Ruby) is an eRuby template processor that allows debugging, reduces markup, and improves composability of eRuby templates.
47
46
  email:
48
47
  executables:
49
48
  - ember
@@ -56,9 +55,11 @@ files:
56
55
  - lib/ember.rb
57
56
  - lib/ember/inochi.rb
58
57
  - lib/ember/template.rb
59
- - man/man1/ember.1.html
60
- - man/man1/ember.1.gz
58
+ - lib/ember/helpers/rails_helper.rb
61
59
  - LICENSE
60
+ - CREDITS
61
+ - man.html
62
+ - man/man1/ember.1.gz
62
63
  has_rdoc: true
63
64
  homepage: http://snk.tuxfamily.org/lib/ember/
64
65
  licenses: []