rubisc 0.1.3 → 0.2.0

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/substitute +1 -1
  3. data/lib/fileutil.rb +2 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aa40c1635d083a76dd9bffd9167d9e0186838224
4
- data.tar.gz: 96f0ce6febebae9dd7f69e5cbf0cdfee0342ab7a
3
+ metadata.gz: 197848ffd9fc6c255962d98c3b3b1bfe456b06ce
4
+ data.tar.gz: 85b3833b812595960f719c48b5a9b793db614c6f
5
5
  SHA512:
6
- metadata.gz: 29927064b928c64398de60a8df1e53fddcfc83c7178dc87806842713ba09c55c4adb53855b4b23b5ea647b85887a2d606f0fbfddd30b3925cac81f5db124d78c
7
- data.tar.gz: 2ede67daf3b60b3e00f913a1dd9319c8c10127b71ee5096fbe4ef3343c7e5eef0b1e34a2faea37c5b7fe4d9b500bcd3b38edf14cc88bf6d8986879d27acc092b
6
+ metadata.gz: b1a57984823c174fc5fcab371d88282d6b6d1fd85d86c4c74814e67e4b42bf34adcf6a536a7f088afe82a0801e62eb5e36a3827fb82d03aa705d274d7c637a5f
7
+ data.tar.gz: 560862c1f34c0a8a765d3a570223887b2ae1a057dfe1b5499da7e260bcc4f7507e4d9a4403d6965906e4276c2cc4aff33fa8bf25502c4cf2706b9b9c535138df
data/bin/substitute CHANGED
@@ -18,7 +18,7 @@ path=ARGV[0]
18
18
  @new_content=ARGV[2]
19
19
 
20
20
  def file_substitute file_path
21
- success=Rubisc::FileUtil::process_file(file_path) do |content|
21
+ success=Rubisc::FileUtil::process_file file_path,true do |content|
22
22
  pattern=content.match /#{@old_content}/
23
23
  if !pattern
24
24
  puts "No matching found."
data/lib/fileutil.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/ruby
2
2
  module Rubisc
3
3
  module FileUtil
4
- def self.process_file file_path
4
+ def self.process_file file_path,write
5
5
  return true unless block_given?
6
6
  if !File.file? file_path
7
7
  puts "Not a file: "+file_path
@@ -18,6 +18,7 @@ module Rubisc
18
18
  end
19
19
  content=yield content
20
20
  file.close
21
+ return true unless write
21
22
  file=File.new file_path,"w"
22
23
  if !file
23
24
  puts "Failed to write file "+file_path
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubisc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - luqyluqe