thot 1.0.1 → 1.1.0

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
  SHA256:
3
- metadata.gz: 66b39148b6f0d21ab8174c953757815943eda80b28000caba1dbdd7821d12ef2
4
- data.tar.gz: 5a904474b751660d49e77f1c835490b3c945dda97dc49f9d16c427db9664ecdf
3
+ metadata.gz: 57ada5bc80f13298187297034ec1b9c754cdf0cd2313bd5a2674f8bc8ad2f165
4
+ data.tar.gz: '0961751bbb5709516c88958ee50fee4e62c0802a9ce7b0d58c72bf1a2d544b1a'
5
5
  SHA512:
6
- metadata.gz: 42cb44934894d02699bcd17c3ba22c7d32b2b1effe5d4e19acdc1e6c9662c4fb623103742de2f54d375cbfbcac47086d17ffb4ca2b2771ea34cc13159be020f4
7
- data.tar.gz: 77c8256484294a9e089a2b7320bdf02382600ffd62e26b4e8967843d91710ad3a23dca2d4cce7b127e49b2126ce0150544604455aaaea727cc975a3d85dc52dd
6
+ metadata.gz: bb39588c702fbc6ba92ffb46cc16dff45401f18bd8e82c68e10639f242b0ff571b3119b0ba3be83b83f212dffd6b354cfa1519a13603bba0a32e50e3da1d379f
7
+ data.tar.gz: a6533192e004e53ea6a9f456a60f11b72fa4e57ff7c9840a19b7e75f7846fa9a8477560f0655f5d2c1ad5d9f3898e4c05c5a52e23124a3f4b9e808a519117782
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.1.0
data/exe/thot CHANGED
@@ -7,7 +7,7 @@ require 'thot/cli'
7
7
 
8
8
  options = {}
9
9
  OptionParser.new do |opts|
10
- opts.banner = "Usage: example.rb [options]"
10
+ opts.banner = "Usage: thot [options]"
11
11
  opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
12
12
  options[:verbose] = v
13
13
  end
data/lib/thot/cli.rb CHANGED
@@ -28,6 +28,7 @@ module Thot
28
28
  end
29
29
 
30
30
  def getting_content
31
+ @content = ""
31
32
  if @list_templates_file.empty?
32
33
  STDERR.puts "Reading content from STDIN" if @options[:verbose]
33
34
  @content = ARGF.readlines.join
@@ -35,7 +36,7 @@ module Thot
35
36
  STDERR.puts "Reading content from file(s) : #{@list_templates_file}" if @options[:verbose]
36
37
  @list_templates_file.each do |item|
37
38
  if File::exist? item
38
- @content.concat(File::readlines(item)).join
39
+ @content.concat(File::readlines(item).join)
39
40
  else
40
41
  raise "file not found #{item}"
41
42
  end
data/lib/thot.rb CHANGED
@@ -73,7 +73,6 @@ module Thot
73
73
  raise ArgumentError::new("#{item} : Not a String") unless val.class == String
74
74
  _data[item.to_s.downcase] = val
75
75
  }
76
- raise InvalidTokenList::new("Token list malformation") unless _data.keys.sort == @list_token.map{|_token| _token.to_s }.sort
77
76
  @hash_token = _data
78
77
  end
79
78
 
@@ -89,7 +88,7 @@ module Thot
89
88
  @result = @content
90
89
  @list_token.each{|_token|
91
90
  self.filtering @content.scan(/%%(#{_token.to_s.upcase}[\.\w+]+)%%/).flatten
92
- @result.gsub!(/%%#{_token.to_s.upcase}%%/,@hash_token[_token.to_s])
91
+ @result.gsub!(/%%#{_token.to_s.upcase}%%/,@hash_token[_token.to_s]) if @hash_token.include? _token.to_s
93
92
  }
94
93
  return @result
95
94
  end
@@ -0,0 +1 @@
1
+ Hello %%NAME.capitalize%% %%SURNAME.upcase%% !!
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Romain GEORGES
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-17 00:00:00.000000000 Z
11
+ date: 2022-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -146,6 +146,7 @@ files:
146
146
  - lib/thot/version.rb
147
147
  - samples/.env.prod
148
148
  - samples/template.txt
149
+ - samples/template2.txt
149
150
  - thot.gemspec
150
151
  - ultragreen_roodi_coding_convention.yml
151
152
  homepage: https://github.com/Ultragreen/thot
@@ -168,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
169
  - !ruby/object:Gem::Version
169
170
  version: '0'
170
171
  requirements: []
171
- rubygems_version: 3.1.2
172
+ rubygems_version: 3.3.5
172
173
  signing_key:
173
174
  specification_version: 4
174
175
  summary: THe Operative Templating