make_menu 0.0.3 → 0.0.5

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
  SHA256:
3
- metadata.gz: 6709a0676bcc3bca7afa26690fb7efd8048006c48bf96edd1697941e685762dd
4
- data.tar.gz: 213d207ec9167cd91fcfcfeb0fce94772109ed3cad93a778280c9607d5f30b6a
3
+ metadata.gz: 65183bccb23144d7c413ce5d010e5226e368922de246e83397964025e6a5c063
4
+ data.tar.gz: '0960af7c003da69e8e1ada2b18021ec50772a7661204939201a664c33cd67669'
5
5
  SHA512:
6
- metadata.gz: e3e6ce5aa039336be1d51a98e305075b4fc41747063f77f07bd3d73199f5d929b854c2b26057429962a4a12b0b5ff65a5f2fd0105e0680fe8e887a2173bb1e6d
7
- data.tar.gz: 5826d84e6da06b2fcae5e53206d6e7a1056899ad060b8ad64b559e6d770914aa332d08bf53170c1e80953f747404acc6c66bf6cc73c4b4e3166cb9e34fd77686
6
+ metadata.gz: ad13806ee0806d253bcc8435aa23e1ea5b1942e865e871270991ec7ae56da9d3ae77b0785dbb4e053c270ceb668f8baaa26d10a5799d6dc6a849c4ffd21183a2
7
+ data.tar.gz: 77478754c06435ddcf96e1dbf495c47260166606f0fbcf35f8f00403e37792e22ede5f37668b978951f205eb8b11ef5ea6a398d4d933909c2f3cdcb2ddbcb14f
data/Gemfile CHANGED
@@ -3,3 +3,7 @@
3
3
  source 'http://rubygems.org'
4
4
 
5
5
  gemspec
6
+
7
+ group :development do
8
+ gem 'bump'
9
+ end
data/Gemfile.lock CHANGED
@@ -1,16 +1,20 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- make_menu (0.0.1)
4
+ make_menu (0.0.5)
5
+ tty-screen (~> 0.8.2)
5
6
 
6
7
  GEM
7
8
  remote: http://rubygems.org/
8
9
  specs:
10
+ bump (0.10.0)
11
+ tty-screen (0.8.2)
9
12
 
10
13
  PLATFORMS
11
14
  arm64-darwin-21
12
15
 
13
16
  DEPENDENCIES
17
+ bump
14
18
  make_menu!
15
19
 
16
20
  BUNDLED WITH
@@ -83,7 +83,7 @@ module MakeMenu
83
83
  end
84
84
 
85
85
  unless current_group
86
- current_group = MenuItemGroup.new
86
+ current_group = MenuItemGroup.new('Commands'.color(group_title_color))
87
87
  groups << current_group
88
88
  end
89
89
 
@@ -94,7 +94,18 @@ module MakeMenu
94
94
  option_number += 1
95
95
  end
96
96
  end
97
+
98
+ if option_number == 1
99
+ puts
100
+ puts 'No annotated targets found!'.red.bold
101
+ puts
102
+ puts 'Expecting something like this....'
103
+ puts " #{'my_target:'.cyan} #{'## Do some things'.yellow}"
104
+ puts
105
+ exit 1
106
+ end
97
107
  end
108
+
98
109
  end
99
110
 
100
111
  # rubocop:enable Metrics/MethodLength
@@ -144,7 +155,7 @@ module MakeMenu
144
155
 
145
156
  # Get the menu logo from the LOGO constant
146
157
  def logo
147
- return "\n#{' make '.black_bg.light_yellow}#{' menu '.light_yellow_bg.black}\n".bold unless Object.const_defined?("#{self.class.name}::LOGO")
158
+ return "\n#{" #{Dir.pwd.split('/').last} ".light_yellow_bg.black.bold}\n \n" unless Object.const_defined?("#{self.class.name}::LOGO")
148
159
 
149
160
  Object.const_get("#{self.class.name}::LOGO")
150
161
  end
@@ -153,9 +164,9 @@ module MakeMenu
153
164
 
154
165
  # Override the following methods to customise the menu display
155
166
 
156
- # @return [Symbol] Color for group title
167
+ # @return [Symbol,Array[Symbol]] Color for group title
157
168
  def group_title_color
158
- :light_green
169
+ %i[yellow bold]
159
170
  end
160
171
 
161
172
  # Clean screen before and after each command
@@ -1,3 +1,3 @@
1
1
  module MakeMenu
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.5'
3
3
  end
data/lib/make_menu.rb CHANGED
@@ -19,18 +19,18 @@ module MakeMenu
19
19
  else
20
20
  MakeMenu::Menu.new(makefile).run
21
21
  end
22
- rescue LoadError => _e
23
- puts "ERROR! Expected file ./#{menu_name.downcase}_menu.rb to define class #{menu_name.capitalize}Menu < MakeMenu::Menu"
22
+ rescue LoadError, NameError => _e
23
+ puts "ERROR! Expected file ./#{menu_name.downcase}_menu.rb to define class #{menu_name.capitalize}Menu < MakeMenu::Menu".red
24
24
  end
25
25
 
26
- def self.status
27
- if (menu_name = ENV.fetch('MENU', nil))
28
- require "./#{menu_name.downcase}_status_panel.rb"
29
- Object.const_get("#{menu_name.capitalize}StatusPanel").new.display
30
- else
31
- MakeMenu::StatusPanel.new.display
32
- end
33
- rescue LoadError => _e
34
- puts "ERROR! Expected file ./#{menu_name.downcase}_status_panel.rb to define class #{menu_name.capitalize}StatusPanel < MakeMenu::StatusPanel"
35
- end
26
+ # def self.status
27
+ # if (menu_name = ENV.fetch('MENU', nil))
28
+ # require "./#{menu_name.downcase}_status_panel.rb"
29
+ # Object.const_get("#{menu_name.capitalize}StatusPanel").new.display
30
+ # else
31
+ # MakeMenu::StatusPanel.new.display
32
+ # end
33
+ # rescue LoadError => _e
34
+ # puts "ERROR! Expected file ./#{menu_name.downcase}_status_panel.rb to define class #{menu_name.capitalize}StatusPanel < MakeMenu::StatusPanel".red
35
+ # end
36
36
  end
data/make_menu.gemspec CHANGED
@@ -16,44 +16,5 @@ Gem::Specification.new do |s|
16
16
  "https://rubygems.org/gems/make_menu"
17
17
  s.license = "MIT"
18
18
  s.add_dependency 'tty-screen', '~> 0.8.2'
19
- s.description = %(
20
- Creates a number-selection menu from a Makefile. The menu will attempt to fill the width of the terminal window.
21
-
22
- - Any targets in the Makefile with a double-hash comment will be displayed, e.g.:
23
- serve: ## Start Rails server in background
24
- This will display a line such as '1. Start Rails server in background' which runs the command `make serve`.
25
-
26
- - A line that starts with a triple-hash will create a new menu group, e.g.:
27
- ### Docker Commands
28
- This will begin a new group with the header 'Docker Commands'
29
-
30
- - The environment variable MENU can be used to specify a custom menu class, e.g.:
31
- export MENU=Accounts
32
- This assumes that a class `AccountsMenu` is defined in the file `accounts_menu.rb`
33
-
34
- You can define two constants in your custom class:
35
- LOGO (String) text or ASCII art to display above the menu
36
- HIGHLIGHTS (Hash{String=>[Symbol,Array<Symbol>]}) Add coloring to specific words or phrases
37
-
38
- - The environment variable MAKEFILE can specify a Makefile. The default is './Makefile'.
39
-
40
- The menu will not display any targets called 'menu' or 'status'. The latter, if present, is called each
41
- time the menu displays.
42
-
43
- -----------------------------
44
- Docker Container Status Panel
45
- -----------------------------
46
-
47
- Displays a color-coded panel indicating whether or not a Docker container is running.
48
-
49
- You must define a custom class inheriting from `MakeMenu::StatusPanel` and indicate this using
50
- the environment variable MENU, e.g.:
51
- export MENU=Accounts
52
- This assumes that a class `AccountsStatusPanel` is defined in the file `accounts_status_panel.rb`
53
-
54
- You can define a constant CONTAINERS {String=>String} in this custom class to map the displayed
55
- label to the container name, e.g.:
56
- CONTAINERS = { 'Backend' => 'myapp-backend-1' }
57
-
58
- )
19
+ s.description = ""
59
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: make_menu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Barri Mason
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-20 00:00:00.000000000 Z
11
+ date: 2023-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tty-screen
@@ -24,46 +24,7 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.8.2
27
- description: |2+
28
-
29
- Creates a number-selection menu from a Makefile. The menu will attempt to fill the width of the terminal window.
30
-
31
- - Any targets in the Makefile with a double-hash comment will be displayed, e.g.:
32
- serve: ## Start Rails server in background
33
- This will display a line such as '1. Start Rails server in background' which runs the command `make serve`.
34
-
35
- - A line that starts with a triple-hash will create a new menu group, e.g.:
36
- ### Docker Commands
37
- This will begin a new group with the header 'Docker Commands'
38
-
39
- - The environment variable MENU can be used to specify a custom menu class, e.g.:
40
- export MENU=Accounts
41
- This assumes that a class `AccountsMenu` is defined in the file `accounts_menu.rb`
42
-
43
- You can define two constants in your custom class:
44
- LOGO (String) text or ASCII art to display above the menu
45
- HIGHLIGHTS (Hash{String=>[Symbol,Array<Symbol>]}) Add coloring to specific words or phrases
46
-
47
- - The environment variable MAKEFILE can specify a Makefile. The default is './Makefile'.
48
-
49
- The menu will not display any targets called 'menu' or 'status'. The latter, if present, is called each
50
- time the menu displays.
51
-
52
- -----------------------------
53
- Docker Container Status Panel
54
- -----------------------------
55
-
56
- Displays a color-coded panel indicating whether or not a Docker container is running.
57
-
58
- You must define a custom class inheriting from `MakeMenu::StatusPanel` and indicate this using
59
- the environment variable MENU, e.g.:
60
- export MENU=Accounts
61
- This assumes that a class `AccountsStatusPanel` is defined in the file `accounts_status_panel.rb`
62
-
63
- You can define a constant CONTAINERS {String=>String} in this custom class to map the displayed
64
- label to the container name, e.g.:
65
- CONTAINERS = { 'Backend' => 'myapp-backend-1' }
66
-
27
+ description: ''
67
28
  email: loki@amarantha.net
68
29
  executables: []
69
30
  extensions: []
@@ -105,4 +66,3 @@ signing_key:
105
66
  specification_version: 4
106
67
  summary: Generates an interactive menu from a Makefile
107
68
  test_files: []
108
- ...