touch_erb 0.4.0 → 0.4.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 93417af23f0f30e1d28b5ec6b1544b29c338800f9662d7c41baa886099f4b550
4
- data.tar.gz: b852e0908f6a2233b55c2b353a99d7566bd9509a0f958d292cdb13ed4ba27ed4
3
+ metadata.gz: 43b83ecfab130e38db23c0fe1c3caa436f02980b154cd4d44bb468ef2c37a490
4
+ data.tar.gz: 982c4e2f08371f2542759c93920f86557badd1bb02c8641547a838b70791e9f0
5
5
  SHA512:
6
- metadata.gz: 78605df3524ebf6ff54ce60a01e0ddb72b8ba8a6dc518b38cbdb1ac119b7b5394c8693360c3e29c144bb4fdc71beebd39d03eefa37d6e8bec0dafa6644d15cf1
7
- data.tar.gz: 5a60f88315305aba15d05cc77112b30368c2e8bdc3658868d99c3775efe55ac82238ed884bbc2393ff35e6f15c0f592129b8d5032c2b26fc5b01c551799fce8a
6
+ metadata.gz: 9073d819b42635dd2f87e477c113192dc69e78d885d5559475d3e8feeca6c2ae1a943d725a6cf4ff4699628fb5362a17f19e1d32fbb918a3ed1f52eff9057986
7
+ data.tar.gz: 66f4f87bd136f97a5a9420b2724360db8a55416ce03d1b529a57b0c1f9d840f00156f1ed2bcafae6a745b6fce6c4a785b26a545cae7756f4bf875ff8b472c1f7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ### HEAD (Sat Mar 23 18:51:59 2019 +0900)
2
+
3
+
4
+
5
+ ### v0.4.0 (Sat Mar 23 18:51:59 2019 +0900)
6
+
7
+ - Update CHANGELOG (Thu Feb 21 03:01:12 2019 +0900) [01e4c9f](https://github.com/himanoa/touch_erb/commit/01e4c9ffe10236d42580d11a0625d896edfbd081)
8
+ - chore: Add activesupport in dependencies (Sat Mar 23 07:51:04 2019 +0900) [d803bab](https://github.com/himanoa/touch_erb/commit/d803bab70f0e20102d6270a98e46e986801ffbc6)
9
+ - feat: Add support for template name and file name in ERB (Sat Mar 23 07:59:22 2019 +0900) [9661627](https://github.com/himanoa/touch_erb/commit/96616272269edf4ea8efb4343ff3b836a5bca6f2)
10
+ - test: Add test (Sat Mar 23 18:36:38 2019 +0900) [4372d30](https://github.com/himanoa/touch_erb/commit/4372d30d538957a2430a848f7832864070f65a66)
11
+ - Merge pull request #25 from himanoa/file-name (Sat Mar 23 18:48:27 2019 +0900) [ffce796](https://github.com/himanoa/touch_erb/commit/ffce7964cdbde0346933a79cd95c34ccd2d1d4c6)
12
+ - Release v0.4.0 (Sat Mar 23 18:51:59 2019 +0900) [321ba61](https://github.com/himanoa/touch_erb/commit/321ba615fa92a7eb5cf0642ecf355bc96db641c8)
13
+
1
14
  ### v0.3.1 (Thu Feb 21 02:59:35 2019 +0900)
2
15
 
3
16
  - Generate CHANGELOG (Wed Feb 20 13:00:27 2019 +0900) [77bbb12](https://github.com/himanoa/touch_erb/commit/77bbb1278a934d4691615ddef786296ee8a9b8b7)
data/Gemfile.lock CHANGED
@@ -1,14 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- touch_erb (0.4.0)
4
+ touch_erb (0.4.1)
5
5
  activesupport
6
6
  thor (~> 0.20)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activesupport (5.2.2.1)
11
+ activesupport (5.2.3)
12
12
  concurrent-ruby (~> 1.0, >= 1.0.2)
13
13
  i18n (>= 0.7, < 2)
14
14
  minitest (~> 5.1)
data/lib/touch_erb/cli.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'touch_erb'
2
4
  require 'thor'
3
5
  require 'erb'
@@ -7,7 +9,6 @@ require 'active_support/core_ext'
7
9
 
8
10
  module TouchErb
9
11
  class CLI < Thor
10
-
11
12
  def initialize(*args)
12
13
  super
13
14
  @template_dir = TouchErb::TemplateDir.new
@@ -18,43 +19,54 @@ module TouchErb
18
19
  )
19
20
  end
20
21
 
21
- desc "add <source>", "Create new erb file"
22
- option "local", aliases: "l", type: :boolean
23
- method_option :source, :type => :string, :desc => "Create new erb template to {current directory}/.touch_erb/"
22
+ desc 'add <source>', 'Create new erb file'
23
+ option 'local', aliases: 'l', type: :boolean
24
+ method_option :source, type: :string, desc: 'Create new erb template to {current directory}/.touch_erb/'
24
25
  def add(source)
25
26
  target_dir = @template_dir
26
- if options[:local]
27
- target_dir = @local_template_dir
28
- end
27
+ target_dir = @local_template_dir if options[:local]
29
28
  path = target_dir.add(source)
30
- system("#{ENV['EDITOR']}", path)
29
+ system((ENV['EDITOR']).to_s, path)
31
30
  end
32
31
 
33
- desc "<template_name> <output_name>", "Create file to current directory from execute erb template"
34
- option :template_name, :type => :string
35
- option :output_name, :type => :string, :default => nil
32
+ desc '<template_name> <output_name>', 'Create file to current directory from execute erb template'
33
+ option :template_name, type: :string
34
+ option :output_name, type: :string, default: nil
36
35
  def touch(template_name, output_name = nil)
36
+ if template_name.start_with?("--")
37
+ invoke :help
38
+ return
39
+ end
37
40
  file_name = output_name || template_name
38
41
  if FileTest.exists?(file_name)
39
42
  FileUtils.touch(file_name)
40
43
  else
41
44
  File.open(file_name, 'w') do |f|
42
- f.write(ERB.new(@local_template_dir.find(template_name) || @template_dir.find(template_name) || "", nil, "%<>").result(binding))
45
+ f.write(ERB.new(@local_template_dir.find(template_name) || @template_dir.find(template_name) || '', nil, '%<>').result(binding))
43
46
  end
44
47
  end
45
48
  end
46
49
 
47
- desc "list", "Show erb templates"
48
- option "local", aliases: "l", type: :boolean, desc: "Show templates only local directory .touch_erb"
49
- def list()
50
- if(options[:local])
51
- @local_template_dir.list().each{ |name| puts name }
50
+ desc 'list', 'Show erb templates'
51
+ option 'local', aliases: 'l', type: :boolean, desc: 'Show templates only local directory .touch_erb'
52
+ def list
53
+ if options[:local]
54
+ @local_template_dir.list.each { |name| puts name }
55
+ else
56
+ (@template_dir.list + @local_template_dir.list).each { |name| puts name }
57
+ end
58
+ end
59
+
60
+ desc 'list', 'Show erb templates'
61
+ option 'local', aliases: 'l', type: :boolean, desc: 'Show templates only local directory .touch_erb'
62
+ def list
63
+ if options[:local]
64
+ @local_template_dir.list.each { |name| puts name }
52
65
  else
53
- (@template_dir.list() + @local_template_dir.list()).each{ |name| puts name }
66
+ (@template_dir.list + @local_template_dir.list).each { |name| puts name }
54
67
  end
55
68
  end
56
69
 
57
70
  default_task :touch
58
71
  end
59
72
  end
60
-
@@ -1,3 +1,3 @@
1
1
  module TouchErb
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: touch_erb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - himanoa
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-23 00:00:00.000000000 Z
11
+ date: 2019-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  - !ruby/object:Gem::Version
157
157
  version: '0'
158
158
  requirements: []
159
- rubygems_version: 3.0.2
159
+ rubygems_version: 3.0.3
160
160
  signing_key:
161
161
  specification_version: 4
162
162
  summary: Better touch command