Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
grid5000
reference-repository
Commits
344c1dd2
Commit
344c1dd2
authored
Nov 04, 2016
by
MICHON Nicolas
Browse files
[dev] Set default mode for created yaml and json files to 0644
parent
3fbeae02
Changes
1
Hide whitespace changes
Inline
Side-by-side
generators/lib/hash/hash.rb
View file @
344c1dd2
...
@@ -23,15 +23,15 @@ def rec_sort(h)
...
@@ -23,15 +23,15 @@ def rec_sort(h)
end
end
# Write pretty and sorted JSON files
# Write pretty and sorted JSON files
def
write_json
(
filepath
,
data
)
def
write_json
(
filepath
,
data
,
perm
=
0644
)
File
.
open
(
filepath
,
'w'
)
do
|
f
|
File
.
open
(
filepath
,
'w'
,
perm
)
do
|
f
|
f
.
write
(
JSON
.
pretty_generate
(
rec_sort
(
data
)))
f
.
write
(
JSON
.
pretty_generate
(
rec_sort
(
data
)))
end
end
end
end
# Write sorted YAML files
# Write sorted YAML files
def
write_yaml
(
filepath
,
data
)
def
write_yaml
(
filepath
,
data
,
perm
=
0644
)
File
.
open
(
filepath
,
'w'
)
do
|
f
|
File
.
open
(
filepath
,
'w'
,
perm
)
do
|
f
|
f
.
write
(
rec_sort
(
data
).
to_yaml
)
f
.
write
(
rec_sort
(
data
).
to_yaml
)
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment