vedeu_cli 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vedeu/cli/helpers.rb +17 -8
- data/lib/vedeu/cli/main.rb +17 -0
- data/lib/vedeu/cli/version.rb +1 -1
- data/test/lib/vedeu/cli/helpers_test.rb +18 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8c8109061e636bc504890350e62566771c229d1
|
4
|
+
data.tar.gz: 40da9cbda276fc872dfca89dde9850cb159cb0fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79f53e5b7e44ac7488adf63f11e6763ec3a36bb714eeeb07d6774922372965964bc0ff2b00bed51974e4f2d7450892d4747f68cad2922287d8ea3cccdb3638d2
|
7
|
+
data.tar.gz: 49d6528befaad20f517d123a1806c4cb1febde10296f6e87e922d3d0d6f01d9ff200657ea421c445ce8c7f80816ce29cb4c0a03a1fe60168be94f1195e927392
|
data/lib/vedeu/cli/helpers.rb
CHANGED
@@ -53,7 +53,7 @@ module Vedeu
|
|
53
53
|
# @param destination [String]
|
54
54
|
# @return [void]
|
55
55
|
def make_directory(destination)
|
56
|
-
|
56
|
+
log_processed_file(destination)
|
57
57
|
|
58
58
|
FileUtils.mkdir_p(destination)
|
59
59
|
end
|
@@ -63,10 +63,10 @@ module Vedeu
|
|
63
63
|
# @return [void]
|
64
64
|
def copy_file(source, destination)
|
65
65
|
if File.exist?(destination)
|
66
|
-
|
66
|
+
log_skipped_file(destination)
|
67
67
|
|
68
68
|
else
|
69
|
-
|
69
|
+
log_processed_file(destination)
|
70
70
|
|
71
71
|
FileUtils.cp(source, destination)
|
72
72
|
end
|
@@ -77,27 +77,36 @@ module Vedeu
|
|
77
77
|
# @return [void]
|
78
78
|
def make_file(source, destination)
|
79
79
|
if File.exist?(destination)
|
80
|
-
|
80
|
+
log_skipped_file(destination)
|
81
81
|
|
82
82
|
else
|
83
|
-
|
83
|
+
log_processed_file(destination)
|
84
84
|
|
85
85
|
File.write(destination, parse(source))
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
89
|
# @param destination [String]
|
90
|
-
# @return [
|
91
|
-
def
|
90
|
+
# @return [TrueClass]
|
91
|
+
def log_processed_file(destination)
|
92
|
+
Vedeu.log_stdout(type: :create, message: "#{destination}")
|
93
|
+
|
94
|
+
true
|
95
|
+
end
|
96
|
+
|
97
|
+
# @param destination [String]
|
98
|
+
# @return [TrueClass]
|
99
|
+
def log_skipped_file(destination)
|
92
100
|
Vedeu.log_stdout(type: :create,
|
93
101
|
message: "#{destination} " +
|
94
102
|
Esc.red { 'already exists, skipped.' })
|
103
|
+
true
|
95
104
|
end
|
96
105
|
|
97
106
|
# @param destination [String]
|
98
107
|
# @return [void]
|
99
108
|
def touch_file(destination)
|
100
|
-
|
109
|
+
log_processed_file(destination)
|
101
110
|
|
102
111
|
FileUtils.touch(destination)
|
103
112
|
end
|
data/lib/vedeu/cli/main.rb
CHANGED
@@ -9,6 +9,13 @@ module Vedeu
|
|
9
9
|
class Main < Thor
|
10
10
|
|
11
11
|
desc 'new <name>', 'Create a skeleton Vedeu client application.'
|
12
|
+
long_desc <<-DESC
|
13
|
+
`vedeu new <name>` will create a new skeleton Vedeu client application.
|
14
|
+
|
15
|
+
Vedeu creates a new directory, <name>. If this directory already exists
|
16
|
+
Vedeu will only add files and subdirectories which are missing. It will
|
17
|
+
not overwrite existing files.
|
18
|
+
DESC
|
12
19
|
# @param name [String]
|
13
20
|
# @return [String]
|
14
21
|
def new(name)
|
@@ -19,6 +26,16 @@ module Vedeu
|
|
19
26
|
|
20
27
|
desc 'view <name>',
|
21
28
|
'Create a new interface within the client application.'
|
29
|
+
long_desc <<-DESC
|
30
|
+
`vedeu view <name>` will create a new interface within the client
|
31
|
+
application.
|
32
|
+
|
33
|
+
Having run `vedeu new <name>` and changing into the newly created
|
34
|
+
client application directory, executing this command will create a new
|
35
|
+
view with associated files. If this view already exists Vedeu will only
|
36
|
+
add files and subdirectories which are missing. It will not overwrite
|
37
|
+
existing files.
|
38
|
+
DESC
|
22
39
|
# @param name [String]
|
23
40
|
# @return [String]
|
24
41
|
def view(name)
|
data/lib/vedeu/cli/version.rb
CHANGED
@@ -95,13 +95,29 @@ module Vedeu
|
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
98
|
-
describe '#
|
98
|
+
describe '#log_processed_file' do
|
99
99
|
let(:destination) { 'some_file.txt' }
|
100
100
|
|
101
101
|
before { Vedeu.stubs(:log_stdout) }
|
102
102
|
|
103
|
-
subject { instance.
|
103
|
+
subject { instance.log_processed_file(destination) }
|
104
104
|
|
105
|
+
it { subject.must_be_instance_of(TrueClass) }
|
106
|
+
it {
|
107
|
+
Vedeu.expects(:log_stdout).
|
108
|
+
with(type: :create, message: 'some_file.txt')
|
109
|
+
subject
|
110
|
+
}
|
111
|
+
end
|
112
|
+
|
113
|
+
describe '#log_skipped_file' do
|
114
|
+
let(:destination) { 'some_file.txt' }
|
115
|
+
|
116
|
+
before { Vedeu.stubs(:log_stdout) }
|
117
|
+
|
118
|
+
subject { instance.log_skipped_file(destination) }
|
119
|
+
|
120
|
+
it { subject.must_be_instance_of(TrueClass) }
|
105
121
|
it {
|
106
122
|
Vedeu.expects(:log_stdout).
|
107
123
|
with(type: :create,
|
@@ -129,7 +145,6 @@ module Vedeu
|
|
129
145
|
subject { instance.name }
|
130
146
|
|
131
147
|
it { subject.must_be_instance_of(String) }
|
132
|
-
|
133
148
|
it { subject.must_equal('my_first_app') }
|
134
149
|
end
|
135
150
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vedeu_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gavin Laking
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: guard
|
@@ -266,7 +266,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
266
266
|
version: '0'
|
267
267
|
requirements: []
|
268
268
|
rubyforge_project:
|
269
|
-
rubygems_version: 2.4.
|
269
|
+
rubygems_version: 2.4.8
|
270
270
|
signing_key:
|
271
271
|
specification_version: 4
|
272
272
|
summary: A plugin for Vedeu.
|