goku 0.1.2 → 0.1.3
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/goku.rb +1 -0
- data/lib/goku/cli.rb +9 -3
- data/lib/goku/path.rb +46 -0
- data/lib/goku/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 776341da05c544fc602e6a1eb8a08600d5591263
|
4
|
+
data.tar.gz: 0b6aff84049e139254a3a2cb05e079e63fea6e65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 124795947a1c067c4dae64d71c122bcbd47e411c733b37df242d0ade7e6407402c81c96877535751cee0edb456b296df80385dd835d7a6bffe8034f2f295c1a2
|
7
|
+
data.tar.gz: ffd1051312be156c5495d9317570988311a1bc3548ae65dbe8d95e1f9c04b61b0f72fae6a4db06f4525b33b857029aea986d61f343101a5470e8c21b92f9be26
|
data/lib/goku.rb
CHANGED
data/lib/goku/cli.rb
CHANGED
@@ -2,13 +2,19 @@ module Goku
|
|
2
2
|
class CLI < Thor
|
3
3
|
|
4
4
|
desc "c PATH", "Create a class"
|
5
|
-
def c(
|
6
|
-
|
5
|
+
def c(raw_path)
|
6
|
+
path = Goku::Path.new(raw_path)
|
7
|
+
|
8
|
+
puts path.full
|
9
|
+
puts path.to_spec.full
|
7
10
|
end
|
8
11
|
|
9
12
|
desc "m PATH", "Create a module"
|
10
13
|
def m(path)
|
11
|
-
|
14
|
+
path = Goku::Path.new(raw_path)
|
15
|
+
|
16
|
+
puts path.full
|
17
|
+
puts path.to_spec.full
|
12
18
|
end
|
13
19
|
|
14
20
|
map "module" => "m"
|
data/lib/goku/path.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
module Goku
|
2
|
+
class PathConversionError < StandardError; end
|
3
|
+
|
4
|
+
class Path
|
5
|
+
attr_reader :full
|
6
|
+
|
7
|
+
def initialize(raw_path)
|
8
|
+
@full= raw_path
|
9
|
+
end
|
10
|
+
|
11
|
+
def directories
|
12
|
+
File.dirname(full).split("/")
|
13
|
+
end
|
14
|
+
|
15
|
+
def filename
|
16
|
+
File.basename(full, extension)
|
17
|
+
end
|
18
|
+
|
19
|
+
def extension
|
20
|
+
File.extname(full)
|
21
|
+
end
|
22
|
+
|
23
|
+
def spec?
|
24
|
+
directories.first == "spec"
|
25
|
+
end
|
26
|
+
|
27
|
+
def implementation?
|
28
|
+
!spec?
|
29
|
+
end
|
30
|
+
|
31
|
+
def to_spec
|
32
|
+
raise Goku::PathConversionError.new("Path is already a specification") if spec?
|
33
|
+
|
34
|
+
Goku::Path.new(File.join(["spec", directories, "#{filename}_spec#{extension}"]))
|
35
|
+
end
|
36
|
+
|
37
|
+
def to_implementation
|
38
|
+
raise Goku::PathConversionError.new("Path is already an implementation") if implementation?
|
39
|
+
|
40
|
+
Goku::Path.new(File.join([directories.drop(1), "#{filename.gsub(/_spec$/, "")}#{extension}"]))
|
41
|
+
end
|
42
|
+
|
43
|
+
alias :test? :spec?
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
data/lib/goku/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: goku
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Šarčević
|
@@ -87,6 +87,7 @@ files:
|
|
87
87
|
- goku.gemspec
|
88
88
|
- lib/goku.rb
|
89
89
|
- lib/goku/cli.rb
|
90
|
+
- lib/goku/path.rb
|
90
91
|
- lib/goku/version.rb
|
91
92
|
homepage: https://github.com/shiroyasha/goku
|
92
93
|
licenses:
|