goku 0.2.1 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f5e2d012e6282ea96916d61a87865eb0b0011b3d
4
- data.tar.gz: 497a52b5ff6353cb6bca2960591c30b22fc8207c
3
+ metadata.gz: aacb8d1b49ad8d9479b91feb8c4a87590f90788e
4
+ data.tar.gz: a652393694032fb11062cb42467f504496e507a7
5
5
  SHA512:
6
- metadata.gz: be74f6da17fbbe9409aeee39ef1df630de58b03f4e8263eb2fc2de30941391cfb96dc345e674673468db9253155af4b2346481fe78e785ceea60f8ce1c386ea2
7
- data.tar.gz: f5a417bead73c2893a0ade5fd1facf5436c744b02c359346b4cddba426d85b23d9a15c8bc7d0030e095ba29746dac1532e7ceda36c13af8a26239897870e1fdc
6
+ metadata.gz: a7f5250939eef640e7270dabf86fa11c8fe5cdb2bb65a32d93efdf5b2a1aa7635ebd343fc7a5d99721d1903705606cb1084cb75ad5dc6e7a10cd4351daaee371
7
+ data.tar.gz: a23dd96c3d75a7557be75e1a3f79de501661c7e4a2e0a8dce13c486c15710e285cda0662229c28240522c4cfab5e287634bea884d5cf22171f136c1603835cbe
@@ -5,10 +5,20 @@ module Goku
5
5
  def c(raw_path)
6
6
  path = Goku::Path.new(raw_path)
7
7
 
8
+ modules = path.directories.drop(1).map do |module_name|
9
+ Goku::Factories::Module.new(module_name)
10
+ end
11
+
8
12
  klass = Goku::Factories::Class.new(path.filename)
9
- klass.add_method(Goku::Factories::Method.new("initialize"))
13
+ klass.add(Goku::Factories::Method.new("initialize"))
14
+
15
+ modules.last.add(klass)
16
+
17
+ modules.reverse.each_cons(2) do |submodule, parent_module|
18
+ parent_module.add(submodule)
19
+ end
10
20
 
11
- puts klass
21
+ puts modules.first.to_s
12
22
  end
13
23
 
14
24
  desc "m PATH", "Create a module"
@@ -15,7 +15,7 @@ module Goku
15
15
  end
16
16
 
17
17
  def to_s
18
- elements.map(&:to_s).map { |el| el.indent(2) }.join("\n\n")
18
+ elements.map(&:to_s).map { |el| el.indent(2) }.join
19
19
  end
20
20
 
21
21
  end
@@ -3,7 +3,7 @@ module Goku
3
3
  class Class < Base
4
4
 
5
5
  def to_s
6
- "class #{name.camelcase}\n\n#{super}\n\nend"
6
+ "class #{name.camelcase}\n#{super}\nend"
7
7
  end
8
8
 
9
9
  end
@@ -3,7 +3,7 @@ module Goku
3
3
  class Method < Base
4
4
 
5
5
  def to_s
6
- "def #{name}\nend"
6
+ "\ndef #{name}\nend\n"
7
7
  end
8
8
 
9
9
  end
@@ -3,7 +3,7 @@ module Goku
3
3
  class Module < Base
4
4
 
5
5
  def to_s
6
- "module #{name.camelcase}\n\n#{super}\n\nend"
6
+ "module #{name.camelcase}\n#{super}\nend"
7
7
  end
8
8
 
9
9
  end
@@ -1,3 +1,3 @@
1
1
  module Goku
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3"
3
3
  end
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.2.1
4
+ version: '0.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Šarčević