project_store 0.6.4 → 0.6.5
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.
- checksums.yaml +4 -4
- data/lib/project_store/editing.rb +10 -4
- data/lib/project_store/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7aec052dcc6c2a846f386a68bf4d7be18cc4a6de
|
4
|
+
data.tar.gz: b1adf9a1a305d8722174d413f69337295ac7d9df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba4969524b48bb49d4eb86c577bdbd4c4488e047d54b8fbb1f21be321a81343c94b2b2c5b0ea582e1220176b3e321c2dd2ead34df082a7ff74145431f060220e
|
7
|
+
data.tar.gz: 2d681acf0343ce5a193f676d113e62f5d4bec9521f0179185a9836583785b81c2369762a9fe724aa51090a6655aa135b0eaf2329b715388cc1482d7d1dbf84c8
|
@@ -5,13 +5,15 @@ module ProjectStore
|
|
5
5
|
|
6
6
|
module Editing
|
7
7
|
|
8
|
+
EDITOR_ENVIRONMENT_VARIABLE = 'DM_EDITOR'
|
9
|
+
|
8
10
|
attr_writer :editor
|
9
11
|
|
10
12
|
def editor
|
11
|
-
@editor ||= ENV[
|
13
|
+
@editor ||= ENV[EDITOR_ENVIRONMENT_VARIABLE]
|
12
14
|
end
|
13
15
|
|
14
|
-
def edit(file_or_entity)
|
16
|
+
def edit(file_or_entity, &block)
|
15
17
|
file = case file_or_entity
|
16
18
|
when String
|
17
19
|
if File.exists? file_or_entity and File.readable? file_or_entity
|
@@ -25,7 +27,7 @@ module ProjectStore
|
|
25
27
|
tmp_file = Tempfile.new(self.class.name).path
|
26
28
|
begin
|
27
29
|
FileUtils.copy file, tmp_file
|
28
|
-
edit_file tmp_file
|
30
|
+
edit_file tmp_file, &block
|
29
31
|
begin
|
30
32
|
store = YAML::Store.new(tmp_file)
|
31
33
|
store.transaction do
|
@@ -51,7 +53,11 @@ module ProjectStore
|
|
51
53
|
def edit_file(file)
|
52
54
|
raise PSE, 'No editor specified' if editor.nil?
|
53
55
|
logger.debug "Editing file '#{file}', using editor '#{editor}'"
|
54
|
-
|
56
|
+
if block_given?
|
57
|
+
yield editor, file
|
58
|
+
else
|
59
|
+
system "#{editor} '#{file}'"
|
60
|
+
end
|
55
61
|
end
|
56
62
|
|
57
63
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: project_store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Laurent B.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|