smallcage 0.2.8 → 0.2.9

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
  SHA1:
3
- metadata.gz: 0dffbb6fce3a9475d63031e493df9fca89882db8
4
- data.tar.gz: d74db6f35ee176c826eca45cb4ad466a76a54f75
3
+ metadata.gz: 41fafadb4c6e0e7cf7c9817645ff1b62f16db534
4
+ data.tar.gz: 211caeb2dce90d06bb99a792fd28f54b5a0f5412
5
5
  SHA512:
6
- metadata.gz: 1bfeb6c9c749416e15a47cd3d520530aa36fd4384bb91fcfae8b317ae2f1090e79734f16523b95b256241d0090dc1f7375026268d5fe437bfabf17efcfa58463
7
- data.tar.gz: 9106bd451c8b31d2948fcb56ce78b0cdd8987aeddd5c2fc2c4f815d6ea122362f283f20d8a755fb2e4195120010c77e0b26b618c0f9bc980e4c5ecf1f53ddb1d
6
+ metadata.gz: 3ed0f6f1f1138f4ee3880fafe5608e16c0258e3ee00bccfd38b683d272725843f65374902f40d73f3829653dc1e682517c7c2a912d410f78c17f96bc1d9fc616
7
+ data.tar.gz: f769134d6e35859313023ef692ebab37d9e284bf2f08e938b1480b883532e6d53b8bc8feb95285ca9ebbe24664dbe4972f5e0aa68542a42eb35223d8c3602979
@@ -21,8 +21,7 @@ module SmallCage::Commands
21
21
 
22
22
  list.mtimes.each do |uri, mtime|
23
23
  path = @loader.root + ".#{uri}"
24
- mtime = Time.at(mtime)
25
- @timestamps[path] = mtime
24
+ @timestamps[path] = mtime.to_i
26
25
  end
27
26
  end
28
27
  private :load_initial_timestamps
@@ -41,13 +40,39 @@ module SmallCage::Commands
41
40
  if first_loop
42
41
  first_loop = false
43
42
  if @opts[:fast]
43
+ puts 'Searching modified files since last update...'
44
44
  load_initial_timestamps
45
- update_modified_files
45
+ count, total = update_modified_files
46
+
47
+ if total == 0
48
+ notify
49
+ puts 'All files are updated. Redy to edit!'
50
+ elsif total != count
51
+ notify
52
+ notify
53
+ puts "Error (#{count}/#{total}) Redy to edit!"
54
+ else
55
+ notify
56
+ puts "Updated (#{count}/#{total}) Redy to edit!"
57
+ end
58
+ puts_line
46
59
  else
47
60
  update_target
61
+ notify
62
+ puts_line
48
63
  end
49
64
  else
50
- update_modified_files
65
+ count, total = update_modified_files
66
+ if total > 0
67
+ if total == count
68
+ notify
69
+ else
70
+ notify
71
+ notify
72
+ puts "Error (#{count} / #{total})"
73
+ end
74
+ puts_line
75
+ end
51
76
  end
52
77
  sleep @sleep
53
78
  end
@@ -60,7 +85,7 @@ module SmallCage::Commands
60
85
  Dir.chdir(root) do
61
86
  Dir.glob('_smc/{templates,filters,helpers}/*') do |f|
62
87
  f = root + f
63
- mtime = File.stat(f).mtime
88
+ mtime = File.stat(f).mtime.to_i
64
89
  if @timestamps[f] != mtime
65
90
  @timestamps[f] = mtime
66
91
  result << f
@@ -75,7 +100,7 @@ module SmallCage::Commands
75
100
  def modified_files
76
101
  result = []
77
102
  @loader.each_smc_file do |f|
78
- mtime = File.stat(f).mtime
103
+ mtime = File.stat(f).mtime.to_i
79
104
  if @timestamps[f] != mtime
80
105
  @timestamps[f] = mtime
81
106
  result << f
@@ -100,12 +125,12 @@ module SmallCage::Commands
100
125
  end
101
126
 
102
127
  update_http_server(target_files)
103
- puts_line
104
- notify
105
128
  end
106
129
  private :update_target
107
130
 
108
131
  def update_modified_files
132
+ count = 0
133
+ total = 0
109
134
  reload = false
110
135
  if modified_special_files.empty?
111
136
  target_files = modified_files
@@ -115,7 +140,10 @@ module SmallCage::Commands
115
140
  reload = true
116
141
  end
117
142
 
118
- return if target_files.empty?
143
+ return [count, total] if target_files.empty?
144
+
145
+ total = target_files.length
146
+
119
147
  target_files.each do |tf|
120
148
  if tf.basename.to_s == '_dir.smc'
121
149
  runner = SmallCage::Runner.new(:path => tf.parent, :quiet => @opts[:quiet])
@@ -123,6 +151,7 @@ module SmallCage::Commands
123
151
  runner = SmallCage::Runner.new(:path => tf, :quiet => @opts[:quiet])
124
152
  end
125
153
  runner.update
154
+ count += 1
126
155
  end
127
156
 
128
157
  if reload
@@ -130,15 +159,12 @@ module SmallCage::Commands
130
159
  else
131
160
  update_http_server(target_files)
132
161
  end
133
- puts_line
134
- notify
162
+ [count, total]
135
163
  rescue Exception => e
136
164
  STDERR.puts e.to_s
137
165
  STDERR.puts $@[0..4].join("\n")
138
166
  STDERR.puts ':'
139
- puts_line
140
- notify
141
- notify
167
+ [count, total]
142
168
  end
143
169
  private :update_modified_files
144
170
 
@@ -1,3 +1,3 @@
1
1
  module SmallCage #:nodoc:
2
- VERSION = '0.2.8'
2
+ VERSION = '0.2.9'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smallcage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - SAITO Toshihiro
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-08-31 00:00:00.000000000 Z
13
+ date: 2015-10-04 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: SmallCage is a simple, but powerful website generator. It converts content
16
16
  and template files, which has common elements in a website, to a plain, static website.
@@ -186,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
186
186
  version: '0'
187
187
  requirements: []
188
188
  rubyforge_project:
189
- rubygems_version: 2.0.14
189
+ rubygems_version: 2.0.14.1
190
190
  signing_key:
191
191
  specification_version: 4
192
192
  summary: a simple website generator