make_menu 0.0.2 → 0.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 500bea8034851422400d024eb9d5383577a740f8ba9982c715af59854dffb75e
4
- data.tar.gz: ea7c6c37629eb802b34181ad8c35d7e786e7e4007b65cff8efe1f72f95816b6b
3
+ metadata.gz: 65183bccb23144d7c413ce5d010e5226e368922de246e83397964025e6a5c063
4
+ data.tar.gz: '0960af7c003da69e8e1ada2b18021ec50772a7661204939201a664c33cd67669'
5
5
  SHA512:
6
- metadata.gz: b040ed30a5c0758a070a62d85e13c1822de4fec5d6a06a97014e9862608af9da9a36c30f7d18626dffb7163fe6de46a5d122b47dfabbb8a99f07cd4daa0e33cf
7
- data.tar.gz: 29d4978cb08def247d2cf2b59fae1957648e69c5685542489524863745a281dfce049784251724df1e41be90f0f61528acc2b0000e890b6f835b7cc9286f6451
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.2'
2
+ VERSION = '0.0.5'
3
3
  end
data/lib/make_menu.rb CHANGED
@@ -19,14 +19,18 @@ module MakeMenu
19
19
  else
20
20
  MakeMenu::Menu.new(makefile).run
21
21
  end
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
22
24
  end
23
25
 
24
- def self.status
25
- if (menu_name = ENV.fetch('MENU', nil))
26
- require "./#{menu_name.downcase}_status_panel.rb"
27
- Object.const_get("#{menu_name.capitalize}StatusPanel").new.display
28
- else
29
- MakeMenu::StatusPanel.new.display
30
- end
31
- 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
32
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.2
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
- ...