no-style-please2-plugins 0.7.0 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/lib/enc.rb +25 -0
  3. data/lib/ext.rb +16 -0
  4. data/lib/version/version.rb +1 -1
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 729be7c6880999d50f668bc647674a327bf94f3bfa6775479862578358cf16d3
4
- data.tar.gz: 2dae3211a7ce7913f274243851f75d7a5fc8307c444ac6175504d5fb890a7165
3
+ metadata.gz: dc515e26a7e6fffd53735f17e0b55ddb20613ca5cdae59954b24cdeb30289048
4
+ data.tar.gz: f0e210e5345a415bd45beb978ad8eb01419bc8d63b261b4c585ce8c58d95387e
5
5
  SHA512:
6
- metadata.gz: ad14f9cbaf2e2184d03daae6f988a042622d9c550c8d0b6b358d919a9e1a873cf0b2ecc2de277d4e8038cf0383d0e96648a7226d4cbe39558844b603be09a421
7
- data.tar.gz: c330e3af02d3651c3f07bc5bb0957ccca5bc12e0e25ab148338df5f1116305f46540b2cdef2c22f26ca7fabf1d823dbc2b047da4d5f395bdbf242aede53cb0cb
6
+ metadata.gz: 5e3b2f44e495078570a425aea46e2ecaaeec1ec560c7708f61e013c3a27883d211850bb4a8e0f594e4dd8b11e2ce8d7e30a98183b668840bee35037b0cbcec3d
7
+ data.tar.gz: c466e2fc225cbad83ef61408235a0dc3f5aa66f6fed80bdfb4198b4dbeb097899453172129124d4a31ba65bded3c349a4ab37baefa15ce4806da2de6f15a8202
data/lib/enc.rb CHANGED
@@ -3,6 +3,7 @@ require 'base64'
3
3
  require 'digest'
4
4
  require 'ltec'
5
5
  require "jekyll"
6
+ require "fileutils"
6
7
  module Jekyll
7
8
  def test
8
9
  end
@@ -98,6 +99,30 @@ module Jekyll
98
99
  return encrypt content,psw
99
100
  end
100
101
 
102
+ def write_file(new_content,file_path)
103
+
104
+ dirpath = File.dirname(file_path)
105
+ File.dirname(dirpath)
106
+
107
+
108
+ if File.exist?(file_path)
109
+ # 读取现有文件内容
110
+ current_content = File.read(file_path)
111
+ # 如果内容不同,则写入新内容
112
+ unless current_content == new_content
113
+ File.write(file_path, new_content)
114
+ puts "文件内容已更新。"
115
+ else
116
+ puts "文件内容相同,无需更新。"
117
+ end
118
+ else
119
+ # 文件不存在,直接写入
120
+ File.write(file_path, new_content)
121
+ puts "文件不存在,已创建新文件并写入内容。"
122
+ end
123
+ return ''
124
+ end
125
+
101
126
 
102
127
  end
103
128
 
data/lib/ext.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require "jekyll"
2
2
  require "liquid"
3
+ require "fileutils"
3
4
 
4
5
  module Jekyll
5
6
  class RenderTimeTag < Liquid::Tag
@@ -254,6 +255,21 @@ end
254
255
  File.open(filename , 'w+') { |f| f.write(tagTmp) }
255
256
  print 'generate ' + filename
256
257
  end
258
+
259
+ assets = 'assets'
260
+
261
+ if !Dir.exist?(assets)
262
+ Dir.mkdir(assets)
263
+ end
264
+
265
+ dynpath = assets +'/dyn'
266
+ puts dynpath
267
+ if Dir.exist?(dynpath)
268
+ FileUtils.rm_rf(dynpath)
269
+ end
270
+ FileUtils.mkdir(dynpath)
271
+
272
+
257
273
  end
258
274
 
259
275
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NoStylePlease2
4
- VERSION = "0.7.0"
4
+ VERSION = "0.7.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: no-style-please2-plugins
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - vitock
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-14 00:00:00.000000000 Z
11
+ date: 2024-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll