jumpstart 0.5.1 → 0.5.2
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.
- data/config/jumpstart_version.yml +1 -1
- data/lib/jumpstart/filetools.rb +3 -0
- metadata +3 -3
data/lib/jumpstart/filetools.rb
CHANGED
@@ -114,6 +114,7 @@ module JumpStart::FileTools
|
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
117
|
+
# TODO Write test for new file permissions functionality
|
117
118
|
# This method generates string replacements via a hash passed to the method, this enables versatile string replacement.
|
118
119
|
# To replace values in the target file, simply add the name of the key for that replacement in CAPS.
|
119
120
|
# e.g. You might call the method with something like: FileUtils.replace_strings(target_file, :name => "Ian", :country => "England")
|
@@ -124,6 +125,7 @@ module JumpStart::FileTools
|
|
124
125
|
# Finally if you specify a symbol and append _CLASS in the template, that instance will be replace with a capitalized version of the string.
|
125
126
|
def replace_strings(target_file, args)
|
126
127
|
if File.file?(target_file)
|
128
|
+
permissions = File.executable?(target_file)
|
127
129
|
txt = IO.read(target_file)
|
128
130
|
old_dir = target_file.sub(/\/\w+\.*\w*$/, '')
|
129
131
|
new_file = target_file.dup
|
@@ -137,6 +139,7 @@ module JumpStart::FileTools
|
|
137
139
|
FileUtils.rm(target_file)
|
138
140
|
File.open(new_file, "w") do |file|
|
139
141
|
file.puts txt
|
142
|
+
file.chmod(0755) if permissions
|
140
143
|
end
|
141
144
|
if File.directory?(old_dir)
|
142
145
|
if (Dir.entries(old_dir) - JumpStart::IGNORE_DIRS).empty?
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 5
|
8
|
-
-
|
9
|
-
version: 0.5.
|
8
|
+
- 2
|
9
|
+
version: 0.5.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Ian Alexander Wood (i0n)
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-06-
|
17
|
+
date: 2010-06-04 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|