thrifty_file_applier 0.1.0 → 0.1.3

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: 58b42a98514fbbff94d3e6ccba1c76911823da29916f3679fa069314f936c6a3
4
- data.tar.gz: af23d20cddb15c5dbd36faf8944b9521ae4b9d935bb309e0c2f53d1af4a2094b
3
+ metadata.gz: 4b1666a3ee44acad92c754263c4f5293f38ad08c8fd886ad23efcc1695e192c9
4
+ data.tar.gz: a07a11186f32bc2e6c53a22dd62275f83f0844bcf41024ffd1a5507415fbed2c
5
5
  SHA512:
6
- metadata.gz: 3b60306546dbb495d4d625e5af866d85793a4c9683316a75d75af81cabaf0bd071e2cd1ef50321e884b18bb359d0bc8f671f98d479f542c4bc7120c97110a401
7
- data.tar.gz: 44bca0172cb783cad89490afd9cdcaf2a174c00fb0cba092af990fd15905c82aa05039e3fdfd571319bbada861cbe20845f3fd2e5bfaab522cddf1f9362c54ef
6
+ metadata.gz: 3207fcb861f4a3da5c22612b10bbfd514e916a13fc5191fa6f640f9d12385e8f7d777e6ab550218484a17ce6b94d93474251f1f8b5f2099dd90ddf053e8c7ed9
7
+ data.tar.gz: 3e6d5eed91164714ba3a10b630fa8ae676f53f869738992bfd50b661a161684a51a26663910ba47de5182ac12e5ec8db9c3f805b0fa360e6995c5ecbac243635
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- thrifty_file_applier (0.1.0)
4
+ thrifty_file_applier (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -33,6 +33,14 @@ FileUtils.rm "source/file"
33
33
  applier.apply # => compile
34
34
  ```
35
35
 
36
+ `applier` also treats multiple source path.
37
+
38
+ ```ruby
39
+ ThriftyFileApplier.applier("tmp/last_application_time", "source1", "source2") do
40
+ puts "compile"
41
+ end
42
+ ```
43
+
36
44
  ## Development
37
45
 
38
46
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ThriftyFileApplier
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.3"
5
5
  end
@@ -13,9 +13,9 @@ module ThriftyFileApplier
13
13
 
14
14
  # Actual applier class.
15
15
  class Applier
16
- def initialize(last_execution_log_path, source_path, &executor)
16
+ def initialize(last_execution_log_path, *source_paths, &executor)
17
17
  @last_execution_log_path = Pathname.new last_execution_log_path
18
- @update_source_path = Pathname.new source_path
18
+ @update_source_paths = source_paths.map { Pathname.new _1 }
19
19
  @executor = executor
20
20
  end
21
21
 
@@ -40,10 +40,16 @@ module ThriftyFileApplier
40
40
  end
41
41
 
42
42
  def last_update_time
43
- if @update_source_path.directory? && @update_source_path.children.size.positive?
43
+ @update_source_paths.map { last_update_time_in _1 }.max
44
+ end
45
+
46
+ def last_update_time_in(path)
47
+ return Time.at 0 unless path.exist?
48
+
49
+ if path.directory? && path.children.size.positive?
44
50
  newest_mtime path
45
51
  else
46
- @update_source_path.mtime
52
+ path.mtime
47
53
  end
48
54
  end
49
55
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thrifty_file_applier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yudai Tanaka
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-30 00:00:00.000000000 Z
11
+ date: 2022-06-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -34,12 +34,12 @@ files:
34
34
  - lib/thrifty_file_applier/version.rb
35
35
  - sample/sample.rb
36
36
  - sig/update_watcher.rbs
37
- homepage: https://github.com/ytnk531/thirifty_file_appiler
37
+ homepage: https://github.com/ytnk531/thrifty_file_applier
38
38
  licenses:
39
39
  - MIT
40
40
  metadata:
41
- homepage_uri: https://github.com/ytnk531/thirifty_file_appiler
42
- source_code_uri: https://github.com/ytnk531/thirifty_file_appiler
41
+ homepage_uri: https://github.com/ytnk531/thrifty_file_applier
42
+ source_code_uri: https://github.com/ytnk531/thrifty_file_applier
43
43
  post_install_message:
44
44
  rdoc_options: []
45
45
  require_paths: