menuizer 0.1.5 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/menuizer/menu/item.rb +23 -0
- data/lib/menuizer/menu.rb +15 -9
- data/lib/menuizer.rb +1 -0
- data/release.sh +1 -1
- data/version-dump.sh +38 -0
- data/version.txt +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZmVjY2I2NzQwMzg1NTI1YzhkMjA2YjE3MTE0M2U0ZmU3ZjdjNzM0Nw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NTJmOTVhZGFhMmY3MWQzNzc2OWQzYzA3ZmVhYzkwMWMzY2Q2ZGVkMw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MjhmMTNhMTczYjEwYTJkODc2NmU2NTdlZDA4YmFkODRlMDliZDViYjRiNDRm
|
10
|
+
OTcyMDdjNmMzMDQ0YTBkOGQ5YWE3YTFhYmZiMDc0Mzc1NDQ2ZDQxNTMwZjdh
|
11
|
+
MDMyN2U2ODdiZmUwMWJmOGEwZmNmZGVjMjZmMTRiOWFhZTAwMzQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ODA2NDM1NmVhOTg5OGNiZmU3NjljMjljMWFhYTRhOWY5MzNmZmE4MzJjYmRl
|
14
|
+
OTViYzAwMjczZTIyMDY4NzU0YmFkOWIxMzJhN2Q0YWIxNzdlZjkwMTM0YWIy
|
15
|
+
MWI4NWU4MjZjN2E1NTIyYjJlMDE2ZjkwOWQ1Y2Q1M2JjODUzMzY=
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class Menuizer::Menu::Item < OpenStruct
|
2
|
+
def initialize(public_hash,opts)
|
3
|
+
super(public_hash)
|
4
|
+
@opts = opts
|
5
|
+
end
|
6
|
+
|
7
|
+
def title
|
8
|
+
if @opts[:title].respond_to?(:model_name) && @opts[:title].model_name.respond_to?(:human)
|
9
|
+
@opts[:title].model_name.human
|
10
|
+
else
|
11
|
+
@opts[:title]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
def path
|
15
|
+
if @opts[:path]
|
16
|
+
@opts[:path]
|
17
|
+
else
|
18
|
+
if @opts[:title].respond_to?(:model_name) && @opts[:title].model_name.respond_to?(:plural)
|
19
|
+
:"#{@opts[:namespace]}#{@opts[:title].model_name.plural}_path"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/menuizer/menu.rb
CHANGED
@@ -29,32 +29,38 @@ class Menuizer::Menu
|
|
29
29
|
|
30
30
|
|
31
31
|
def header(title)
|
32
|
-
current <<
|
32
|
+
current << Item.new({
|
33
33
|
type: :header,
|
34
|
+
},{
|
35
|
+
namespace: @namespace,
|
34
36
|
title: title,
|
35
|
-
)
|
37
|
+
})
|
36
38
|
end
|
37
39
|
def item(title, path: nil, **opts)
|
38
40
|
unless block_given?
|
39
|
-
item =
|
41
|
+
item = Item.new({
|
40
42
|
type: :item,
|
41
|
-
title: to_title(title),
|
42
|
-
path: to_path(path: path, title: title),
|
43
43
|
parent: @parent,
|
44
44
|
**opts,
|
45
|
-
|
45
|
+
},{
|
46
|
+
namespace: @namespace,
|
47
|
+
title: title,
|
48
|
+
path: path,
|
49
|
+
})
|
46
50
|
map[title] = item
|
47
51
|
current << item
|
48
52
|
else
|
49
53
|
owner = @parent
|
50
54
|
parents = @current
|
51
|
-
item = @parent =
|
55
|
+
item = @parent = Item.new({
|
52
56
|
type: :tree,
|
53
|
-
title: to_title(title),
|
54
57
|
children: [],
|
55
58
|
parent: owner,
|
56
59
|
**opts,
|
57
|
-
|
60
|
+
},{
|
61
|
+
namespace: @namespace,
|
62
|
+
title: title,
|
63
|
+
})
|
58
64
|
@current = item.children
|
59
65
|
yield
|
60
66
|
children, @current, @parent = @current, parents, owner
|
data/lib/menuizer.rb
CHANGED
data/release.sh
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
#!/bin/bash
|
2
|
-
git tag v$(cat
|
2
|
+
git up && git tag v$(cat version.txt) && git push origin --tags
|
data/version-dump.sh
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
. version-functions.sh
|
4
|
+
|
5
|
+
mode=$1
|
6
|
+
if [ -z "$mode" ]; then
|
7
|
+
mode=patch
|
8
|
+
fi
|
9
|
+
|
10
|
+
version_file=version.txt
|
11
|
+
current_version=$(cat $version_file)
|
12
|
+
|
13
|
+
git pull --tags
|
14
|
+
current_tag=$(git tag | tail -1)
|
15
|
+
|
16
|
+
if [ "v$current_version" != "$current_tag" ]; then
|
17
|
+
read -p "file: '$current_version', tag: '$current_tag'. continue? [Y/n] " confirm
|
18
|
+
case $confirm in
|
19
|
+
Y*|y*)
|
20
|
+
;;
|
21
|
+
*)
|
22
|
+
exit 1
|
23
|
+
;;
|
24
|
+
esac
|
25
|
+
fi
|
26
|
+
|
27
|
+
version_build_next "$mode" $(cat $version_file)
|
28
|
+
|
29
|
+
read -p "dump version: $version. OK? [Y/n] " confirm
|
30
|
+
case $confirm in
|
31
|
+
Y*|y*)
|
32
|
+
echo $version > $version_file
|
33
|
+
git add $version_file && git commit -m "version dump: $version"
|
34
|
+
;;
|
35
|
+
*)
|
36
|
+
exit 1
|
37
|
+
;;
|
38
|
+
esac
|
data/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.7
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: menuizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- shun
|
@@ -83,9 +83,11 @@ files:
|
|
83
83
|
- bin/setup
|
84
84
|
- lib/menuizer.rb
|
85
85
|
- lib/menuizer/menu.rb
|
86
|
+
- lib/menuizer/menu/item.rb
|
86
87
|
- lib/menuizer/version.rb
|
87
88
|
- menuizer.gemspec
|
88
89
|
- release.sh
|
90
|
+
- version-dump.sh
|
89
91
|
- version.txt
|
90
92
|
homepage: https://github.com/getto-systems/menuizer
|
91
93
|
licenses:
|