slight-lang 1.2.1.1 → 1.2.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9adfa598a37c77d077cf4a4361e8515d2f878ced
4
- data.tar.gz: 88dadb89d2d451a43bed8c96628963c81911145e
3
+ metadata.gz: ce6c30afb54f39ed3a25b57b0f1f6a4324519c7f
4
+ data.tar.gz: 22949fd745f1a648590bdc9a908e58686917c464
5
5
  SHA512:
6
- metadata.gz: a43f8ee15ddd66f619c4601001848d17f7cac9670d36d35c0bad7bd2789f09ed441f0b12c8097684cb90cc37e383be890f056dde35489860095ed24a88e2fab5
7
- data.tar.gz: 955ca54e8b383cb1338744091297e210fc6a2d9da287ccc1cdfdcb09296d08e6d3af4e29be18b0b29bb52425281b555fc85a9af471338c72f7bbbe59635a69a9
6
+ metadata.gz: 2e12f88ea9848dbe64e9fb3373b802155405cbc542367b76b4d8902193b8d861a87a70cb968f138eca8ebb12bd3cef9078aad607ef30f9fc57a8c266c73c5c5d
7
+ data.tar.gz: ce78e3875eb91781358350cc2dbe38e36f2f707970175cbd86a599337f1c426ca0d7bbbbe5da3b58c046bcb215c70bf4a3858f97542177af25212393265486d0
@@ -4,25 +4,43 @@ require 'slight'
4
4
  module Slight
5
5
  default_engine = Slight::Engine.new
6
6
  io_out = STDOUT
7
+ buffer = ""
7
8
 
8
9
  at_exit{
9
10
  io_out.close
10
11
  }
11
12
 
12
13
  begin
13
- if ARGV[0] == "-v" then
14
+ if ARGV[0] == "-h" then
15
+ io_out.puts "Commands: build | <source_fn> (<dest_fn>) | -v | -h"
16
+ elsif ARGV[0] == "-v" then
14
17
  io_out.puts VERSION
18
+ elsif ARGV[0] == "build" then
19
+ path = File.expand_path(".", __FILE__)
20
+ Dir.entries(File.dirname(path)).map { |e|
21
+ ["slight", "slight.rb"].include? e.split["."][1]
22
+ }.each{ |src_file|
23
+ buffer << default_engine.render(src_file)
24
+ if buffer != nil and buffer != "" then
25
+ fn = ARGV[1] || src_file.split(".")[0] << ".htm"
26
+ io_out.puts "Source File [#{src_file}] => Dest File [#{fn}]"
27
+ io_out = File.open("#{fn}", 'w') if ARGV.size == 2
28
+ io_out.puts buffer
29
+ buffer.clear
30
+ end
31
+ }
15
32
  else
16
33
  raise IOError, "source file was not given." if ARGV.length == 0
17
34
  src_file = ARGV[0]
18
- buffer = default_engine.render(src_file)
35
+ buffer << default_engine.render(src_file)
19
36
  if buffer != nil and buffer != "" then
20
- io_out = File.open("#{ARGV[1]}", 'w') if ARGV.size == 2
37
+ fn = ARGV[1] || src_file.split(".")[0] << ".htm"
38
+ io_out = File.open("#{fn}", 'w') if ARGV.size == 2
21
39
  io_out.puts buffer
22
40
  end
23
41
  end
24
42
  rescue Exception => err
25
- STDERR.puts "[Slight]" + err.message
43
+ STDERR.puts "[Slight] " + err.message
26
44
  #STDERR.puts [err.inspect, err.backtrace.join("\n")].join("\n")
27
45
  exit 1
28
46
  end
data/lib/slight.rb CHANGED
@@ -3,7 +3,7 @@ require 'slight/engine'
3
3
  module Slight
4
4
  # Slight version string
5
5
  # @api public
6
- VERSION = '1.2.1.1'
6
+ VERSION = '1.2.1.2'
7
7
  # 1.0.0 => Basic Template features | 201703
8
8
  # 1.0.5 => Support Tilt | 201704
9
9
  # 1.1.0 => Doc Update | 201705
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slight-lang
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1.1
4
+ version: 1.2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - oliver.yu