file_editor 0.5 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/file_editor.gemspec +3 -3
- data/lib/file_editor.rb +3 -3
- metadata +3 -3
data/file_editor.gemspec
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name="file_editor"
|
3
|
-
s.version="0.
|
3
|
+
s.version="1.0.0"
|
4
4
|
s.platform=Gem::Platform::RUBY
|
5
|
-
s.date="2013-02-
|
5
|
+
s.date="2013-02-24"
|
6
6
|
s.summary="Edit a file in place"
|
7
7
|
s.description="File editor makes it easy to edit a file in place, with options for saving a backup"
|
8
8
|
s.author="Mark Buechler"
|
9
9
|
s.files=Dir["file_editor.gemspec", "Rakefile", "README.txt", "lib/**/*", "test/test*.rb"]
|
10
|
-
s.homepage="http://rubygems.org/
|
10
|
+
s.homepage="http://rubygems.org/file_editor"
|
11
11
|
s.require_paths=["lib"]
|
12
12
|
s.has_rdoc=true
|
13
13
|
s.extra_rdoc_files=["README.txt"]
|
data/lib/file_editor.rb
CHANGED
@@ -18,7 +18,7 @@ class FileEditor
|
|
18
18
|
b.arity == 0 ? editor.instance_eval(&b) : b.call(editor)
|
19
19
|
end
|
20
20
|
|
21
|
-
#
|
21
|
+
#Runs file editor
|
22
22
|
def run
|
23
23
|
raise "You need to provide a regular expression to the editor" unless @regex
|
24
24
|
raise "You need to provide a substitution string" unless @substitution_string
|
@@ -44,7 +44,7 @@ class FileEditor
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
#
|
47
|
+
#Testable write method, using io handles as arguments
|
48
48
|
#to enable the use of String.IO in testing
|
49
49
|
def write_to_file(read_handle, write_handle)
|
50
50
|
if is_multiline(@regex.to_s)
|
@@ -73,7 +73,7 @@ class FileEditor
|
|
73
73
|
regex_string.match(/\?.*?m.*?-/) || regex_string.match(/\?[^-]+:/)
|
74
74
|
end
|
75
75
|
|
76
|
-
#
|
76
|
+
#Returns a random 6-letter extension (e.g., 'kjeihl');
|
77
77
|
#this ensures that we don't inadvertantly delete a pre-existing
|
78
78
|
#backup file if we're not saving the backup
|
79
79
|
def get_random_extension
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: file_editor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-24 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: File editor makes it easy to edit a file in place, with options for saving
|
15
15
|
a backup
|
@@ -24,7 +24,7 @@ files:
|
|
24
24
|
- README.txt
|
25
25
|
- lib/file_editor.rb
|
26
26
|
- test/test_file_editor.rb
|
27
|
-
homepage: http://rubygems.org/
|
27
|
+
homepage: http://rubygems.org/file_editor
|
28
28
|
licenses: []
|
29
29
|
post_install_message:
|
30
30
|
rdoc_options:
|