flgen 0.16.0 → 0.16.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: 73f400f84753663384d40487070b0cc511740b0084aa9e7ecfea84e845304fcf
4
- data.tar.gz: '091045c56dc31bd9f11768c0c94a6451e0dd9872f052c5e199470fa9b5e4e2e7'
3
+ metadata.gz: 9ffab1952f67689d9675b1a5f0ee47b4905b7ea098b5013b2467cfa54360e311
4
+ data.tar.gz: bd33d9997f06c4b6a00ab54a2df2fefe9ff86d9eb766d098ed787e500f289db6
5
5
  SHA512:
6
- metadata.gz: '066887c84c2348296e9692a620e893f1b0e97087a48f50b4c938baf9e66da27f8206f9ab7012e6ceb4d7c790cc71abfd2d34c0a7b95c7c301e500942ca6f0b43'
7
- data.tar.gz: 051a76f99641f3673b777ee7702200b1ea4c11b5512952bd72bbb81c8a54fe440f7ac5a7c11be1c2d4b1b36639c6fee54ee6618e9b92cca5d44bf8e28376b2df
6
+ metadata.gz: d698fd487524fd93687db00ff03b73351579fd8499092960f6b077f42afc3fdbc2910926e95bd8a00e9d08cc47c60baa1478cf17309c008bc131371af1cd977f
7
+ data.tar.gz: 66c01f900315edc6d7355281112be92ef2e28eccfc174049c611959a5385b56b9ba1a9ee73f2102e34e250ead4a1a3805440c3e6c07a109d2c367312d279b1f1
data/lib/flgen/context.rb CHANGED
@@ -78,17 +78,15 @@ module FLGen
78
78
  end
79
79
 
80
80
  def source_file_already_added?(file)
81
- checksum = file.checksum
82
- path = file.path
81
+ return true if source_files.include?(file.path)
82
+ return true if checksums.include?(file.checksum)
83
83
 
84
- return true if checksums[path].include?(checksum)
85
-
86
- checksums[path] << checksum
84
+ checksums << file.checksum
87
85
  false
88
86
  end
89
87
 
90
88
  def checksums
91
- @checksums ||= Hash.new { |h, k| h[k] = [] }
89
+ @checksums ||= []
92
90
  end
93
91
 
94
92
  def add_macro_definition(name, value)
@@ -109,7 +109,7 @@ module FLGen
109
109
 
110
110
  pre_source_files(io)
111
111
  @context.source_files.each do |file|
112
- io.puts(format_file_path(file.full_path))
112
+ io.puts(format_file_path(file.path))
113
113
  end
114
114
  post_source_files(io)
115
115
  end
@@ -3,35 +3,27 @@
3
3
  module FLGen
4
4
  class SourceFile
5
5
  def initialize(root, path)
6
- @root = root
7
- @path = path
6
+ @path = File.join(root, path)
8
7
  end
9
8
 
10
- attr_reader :root
11
9
  attr_reader :path
12
10
 
13
- def full_path
14
- File.join(@root, @path)
15
- end
16
-
17
11
  def match_ext?(ext_list)
18
12
  return false if ext_list.nil? || ext_list.empty?
19
13
 
20
- file_ext = File.extname(@path)
21
- ext_list.any? do |ext|
22
- (ext[0] == '.' && ext || ".#{ext}") == file_ext
23
- end
14
+ file_ext = File.extname(@path)[1..]
15
+ ext_list.any? { |ext| (ext[0] == '.' && ext[1..] || ext) == file_ext }
24
16
  end
25
17
 
26
18
  def remove_ext(ext_list)
27
19
  return self unless match_ext?(ext_list)
28
20
 
29
21
  path = Pathname.new(@path).sub_ext('').to_s
30
- self.class.new(@root, path)
22
+ self.class.new('', path)
31
23
  end
32
24
 
33
25
  def checksum
34
- @checksum ||= Digest::MD5.digest(File.read(full_path))
26
+ @checksum ||= Digest::MD5.digest(File.read(@path))
35
27
  end
36
28
  end
37
29
  end
data/lib/flgen/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FLGen
4
- VERSION = '0.16.0'
4
+ VERSION = '0.16.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flgen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.16.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taichi Ishitani
@@ -160,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
160
  - !ruby/object:Gem::Version
161
161
  version: '0'
162
162
  requirements: []
163
- rubygems_version: 3.4.2
163
+ rubygems_version: 3.4.5
164
164
  signing_key:
165
165
  specification_version: 4
166
166
  summary: Filelist generator