u-menu 0.4.0 → 0.6.0

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: 413a453b9fa4da63d069763afd994f5fe0afe3298057dbc58afc5a25df3fe2a0
4
- data.tar.gz: fa0edfa226e1026d15556b429706bd4b6f17d407c58c8bafd01aa9783e0f31c6
3
+ metadata.gz: 3cfb79ad584788fb2205a567eef99fac9881cb7aac9bef195be99062de4f8af4
4
+ data.tar.gz: ec105fc48dcd1520dfdd7320f3f0c194ce2ede0dba0f3fc880963ff4d4513b0e
5
5
  SHA512:
6
- metadata.gz: c76ebb0ccad068b713cd1adfdc32b796748a51a7dba9a657dafcffc73f005df750ff3371600c6607659f850b235fd3e314360b03fab06f8876ef58ab70aa30df
7
- data.tar.gz: c4f80d5d1abc512a810eac30d4c4f79a70097594f9bdec0f54074c74a72e8b7ce5a948091899cd4600a1813ab8501170b5a2318b82ace4f87b80a82923f20456
6
+ metadata.gz: e8c7e430dca9ed7b865b8a0a9a384ed5f10419963487bde9d86a43f7b0e4cce788b55a9ba8d51bc71578a761c7e81ec29096eb91b5e649e22da20036c5237466
7
+ data.tar.gz: eb9f1f36bb549c73836306a15d87de2741acf0313fc3822f43ef353fcd222da01205de5ccaf4fdf99e2dc74f05e7616ed6c52622f4008d4ee8dfecb4df94c691
data/Gemfile CHANGED
@@ -7,3 +7,10 @@ gemspec
7
7
 
8
8
  gem 'rake', '~> 13.0'
9
9
  gem 'rspec', '~> 3.0'
10
+
11
+ group :development do
12
+ gem "guard-rspec", "~> 4.7"
13
+ gem "rubocop", "~> 1.51"
14
+ gem "rubocop-rspec", "~> 2.22"
15
+ end
16
+
data/Gemfile.lock ADDED
@@ -0,0 +1,116 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ u-menu (0.6.0)
5
+ pastel
6
+ tty-prompt
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ ast (2.4.2)
12
+ coderay (1.1.3)
13
+ diff-lcs (1.5.0)
14
+ ffi (1.15.5)
15
+ formatador (1.1.0)
16
+ guard (2.18.0)
17
+ formatador (>= 0.2.4)
18
+ listen (>= 2.7, < 4.0)
19
+ lumberjack (>= 1.0.12, < 2.0)
20
+ nenv (~> 0.1)
21
+ notiffany (~> 0.0)
22
+ pry (>= 0.13.0)
23
+ shellany (~> 0.0)
24
+ thor (>= 0.18.1)
25
+ guard-compat (1.2.1)
26
+ guard-rspec (4.7.3)
27
+ guard (~> 2.1)
28
+ guard-compat (~> 1.1)
29
+ rspec (>= 2.99.0, < 4.0)
30
+ json (2.6.3)
31
+ listen (3.8.0)
32
+ rb-fsevent (~> 0.10, >= 0.10.3)
33
+ rb-inotify (~> 0.9, >= 0.9.10)
34
+ lumberjack (1.2.8)
35
+ method_source (1.0.0)
36
+ nenv (0.3.0)
37
+ notiffany (0.1.3)
38
+ nenv (~> 0.1)
39
+ shellany (~> 0.0)
40
+ parallel (1.23.0)
41
+ parser (3.2.2.1)
42
+ ast (~> 2.4.1)
43
+ pastel (0.8.0)
44
+ tty-color (~> 0.5)
45
+ pry (0.14.2)
46
+ coderay (~> 1.1)
47
+ method_source (~> 1.0)
48
+ rainbow (3.1.1)
49
+ rake (13.0.6)
50
+ rb-fsevent (0.11.2)
51
+ rb-inotify (0.10.1)
52
+ ffi (~> 1.0)
53
+ regexp_parser (2.8.0)
54
+ rexml (3.2.5)
55
+ rspec (3.12.0)
56
+ rspec-core (~> 3.12.0)
57
+ rspec-expectations (~> 3.12.0)
58
+ rspec-mocks (~> 3.12.0)
59
+ rspec-core (3.12.1)
60
+ rspec-support (~> 3.12.0)
61
+ rspec-expectations (3.12.2)
62
+ diff-lcs (>= 1.2.0, < 2.0)
63
+ rspec-support (~> 3.12.0)
64
+ rspec-mocks (3.12.4)
65
+ diff-lcs (>= 1.2.0, < 2.0)
66
+ rspec-support (~> 3.12.0)
67
+ rspec-support (3.12.0)
68
+ rubocop (1.51.0)
69
+ json (~> 2.3)
70
+ parallel (~> 1.10)
71
+ parser (>= 3.2.0.0)
72
+ rainbow (>= 2.2.2, < 4.0)
73
+ regexp_parser (>= 1.8, < 3.0)
74
+ rexml (>= 3.2.5, < 4.0)
75
+ rubocop-ast (>= 1.28.0, < 2.0)
76
+ ruby-progressbar (~> 1.7)
77
+ unicode-display_width (>= 2.4.0, < 3.0)
78
+ rubocop-ast (1.28.1)
79
+ parser (>= 3.2.1.0)
80
+ rubocop-capybara (2.18.0)
81
+ rubocop (~> 1.41)
82
+ rubocop-factory_bot (2.22.0)
83
+ rubocop (~> 1.33)
84
+ rubocop-rspec (2.22.0)
85
+ rubocop (~> 1.33)
86
+ rubocop-capybara (~> 2.17)
87
+ rubocop-factory_bot (~> 2.22)
88
+ ruby-progressbar (1.13.0)
89
+ shellany (0.0.1)
90
+ thor (1.2.2)
91
+ tty-color (0.6.0)
92
+ tty-cursor (0.7.1)
93
+ tty-prompt (0.23.1)
94
+ pastel (~> 0.8)
95
+ tty-reader (~> 0.8)
96
+ tty-reader (0.9.0)
97
+ tty-cursor (~> 0.7)
98
+ tty-screen (~> 0.8)
99
+ wisper (~> 2.0)
100
+ tty-screen (0.8.1)
101
+ unicode-display_width (2.4.2)
102
+ wisper (2.0.1)
103
+
104
+ PLATFORMS
105
+ ruby
106
+
107
+ DEPENDENCIES
108
+ guard-rspec (~> 4.7)
109
+ rake (~> 13.0)
110
+ rspec (~> 3.0)
111
+ rubocop (~> 1.51)
112
+ rubocop-rspec (~> 2.22)
113
+ u-menu!
114
+
115
+ BUNDLED WITH
116
+ 2.4.13
data/Guardfile ADDED
@@ -0,0 +1,42 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ ## Uncomment and set this to only include directories you want to watch
5
+ # directories %w(app lib config test spec features) \
6
+ # .select{|d| Dir.exist?(d) ? d : UI.warning("Directory #{d} does not exist")}
7
+
8
+ ## Note: if you are using the `directories` clause above and you are not
9
+ ## watching the project directory ('.'), then you will want to move
10
+ ## the Guardfile to a watched dir and symlink it back, e.g.
11
+ #
12
+ # $ mkdir config
13
+ # $ mv Guardfile config/
14
+ # $ ln -s config/Guardfile .
15
+ #
16
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
17
+
18
+ # Note: The cmd option is now required due to the increasing number of ways
19
+ # rspec may be run, below are examples of the most common uses.
20
+ # * bundler: 'bundle exec rspec'
21
+ # * bundler binstubs: 'bin/rspec'
22
+ # * spring: 'bin/rspec' (This will use spring if running and you have
23
+ # installed the spring binstubs per the docs)
24
+ # * zeus: 'zeus rspec' (requires the server to be started separately)
25
+ # * 'just' rspec: 'rspec'
26
+
27
+ guard :rspec, cmd: "bundle exec rspec --format documentation" do
28
+ require "guard/rspec/dsl"
29
+ dsl = Guard::RSpec::Dsl.new(self)
30
+
31
+ # Feel free to open issues for suggestions and improvements
32
+
33
+ # RSpec files
34
+ rspec = dsl.rspec
35
+ watch(rspec.spec_helper) { rspec.spec_dir }
36
+ watch(rspec.spec_support) { rspec.spec_dir }
37
+ watch(rspec.spec_files)
38
+
39
+ # Ruby files
40
+ ruby = dsl.ruby
41
+ dsl.watch_spec_files_for(ruby.lib_files)
42
+ end
data/bin/u-menu CHANGED
@@ -1,38 +1,23 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'pastel'
4
- require 'tty-prompt'
5
-
6
- require 'yaml'
3
+ require_relative '../lib/u-menu'
7
4
 
8
- paths = [
9
- File.expand_path("#{Dir.home}/.umenurc.yml", __dir__),
10
- File.expand_path("#{Dir.home}/.umenu/umenurc.yml", __dir__),
11
- ]
5
+ require 'tty-prompt'
12
6
 
13
- config_path = paths.first { |path| File.exist? path }
14
- config = YAML.load_file(config_path, symbolize_names: true)
7
+ config = Micro::Menu.configurations.load
15
8
 
16
- pastel = Pastel.new
17
- prompt = TTY::Prompt.new(prefix: pastel.magenta("\uea85 \u00b5menu "), interrupt: :signal)
9
+ colors = Micro::Menu.colors
10
+ prompt = TTY::Prompt.new(prefix: colors.magenta("\uea85 \u00b5menu "), interrupt: :signal)
18
11
 
19
- icons = {
20
- 'run' => "\ueb9e",
21
- 'terminal' => "\uea85",
22
- 'github' => "\uea84",
23
- 'chart' => "\ue760",
24
- 'jira' => "\ue75c",
25
- 'settings' => "\ue615",
26
- 'link' => "\ueb15"
27
- }
12
+ icons = Micro::Menu.icons.all
28
13
 
29
14
  thanks = [
30
- pastel.green('Great job! o/'),
31
- pastel.green('See you later! =)'),
32
- pastel.green('Baby bye bye bye...'),
33
- "Bring me #{pastel.green('a cookie')} when you come back!?",
34
- "Have a nice #{pastel.cyan('day')}! =)",
35
- "See you later #{pastel.green('olligator')}! =)"
15
+ colors.green('Great job! o/'),
16
+ colors.green('See you later! =)'),
17
+ colors.green('Baby bye bye bye...'),
18
+ "Bring me #{colors.green('a cookie')} when you come back!?",
19
+ "Have a nice #{colors.cyan('day')}! =)",
20
+ "See you later #{colors.green('olligator')}! =)"
36
21
  ]
37
22
 
38
23
  trap('INT') do
@@ -47,7 +32,7 @@ options << {
47
32
  name: '{{settings}} Edit Settings',
48
33
  type: 'edit',
49
34
  value: 'settings',
50
- execute: config_path
35
+ execute: config[:_path]
51
36
  }
52
37
  options = options.sort { |a, b| a[:name] <=> b[:name] }
53
38
 
@@ -69,15 +54,15 @@ loop do
69
54
  when 'command'
70
55
  system action[:execute]
71
56
  when 'link'
72
- puts "#{pastel.bold('Sure... opening link')} '#{pastel.cyan(action[:execute])}'"
57
+ puts "#{colors.bold('Sure... opening link')} '#{colors.cyan(action[:execute])}'"
73
58
  system "open #{action[:execute]} &"
74
59
  when 'edit'
75
- puts "#{pastel.bold('Sure... opening file')} '#{pastel.cyan(action[:execute])}'"
60
+ puts "#{colors.bold('Sure... opening file')} '#{colors.cyan(action[:execute])}'"
76
61
  system "#{config[:settings][:editor]} #{action[:execute]}"
77
62
  end
78
63
 
79
64
  exit(0)
80
65
  rescue StandardError => e
81
- puts "#{pastel.red('[error]')} #{e}"
66
+ puts "#{colors.red('[error]')} #{e}"
82
67
  exit(1)
83
68
  end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'yaml'
4
+
5
+ module Micro
6
+ module Menu
7
+ module Configurations
8
+ CONFIGURATION_PATHS = [
9
+ File.expand_path("#{Dir.home}/.umenurc.yml", __dir__),
10
+ File.expand_path("#{Dir.home}/.umenu/umenurc.yml", __dir__),
11
+ ]
12
+
13
+ def self.load
14
+ path = CONFIGURATION_PATHS.first { |file_path| File.exist? file_path }
15
+ @@config = YAML.load_file(path, symbolize_names: true)
16
+ @@config.update(_path: path)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Micro
4
+ module Menu
5
+ module Icons
6
+ ICON_LIST = {
7
+ 'run' => "\ueb9e",
8
+ 'terminal' => "\uea85",
9
+ 'github' => "\uea84",
10
+ 'chart' => "\ue760",
11
+ 'jira' => "\ue75c",
12
+ 'settings' => "\ue615",
13
+ 'link' => "\ueb15"
14
+ }
15
+
16
+ def self.all
17
+ ICON_LIST
18
+ end
19
+ end
20
+ end
21
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Micro
4
4
  module Menu
5
- VERSION = '0.4.0'
5
+ VERSION = '0.6.0'
6
6
  end
7
7
  end
data/lib/micro/menu.rb CHANGED
@@ -1,10 +1,25 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'menu/version'
3
+ require_relative 'menu/configurations'
4
4
  require_relative 'menu/icons'
5
+ require_relative 'menu/version'
6
+
7
+ require 'pastel'
5
8
 
6
9
  module Micro
7
10
  module Menu
8
11
  class Error < StandardError; end
12
+
13
+ def self.configurations
14
+ Configurations
15
+ end
16
+
17
+ def self.icons
18
+ Icons
19
+ end
20
+
21
+ def self.colors
22
+ @colors ||= Pastel.new
23
+ end
9
24
  end
10
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: u-menu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Vinciguerra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-10 00:00:00.000000000 Z
11
+ date: 2023-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pastel
@@ -51,11 +51,15 @@ files:
51
51
  - CHANGELOG.md
52
52
  - CODE_OF_CONDUCT.md
53
53
  - Gemfile
54
+ - Gemfile.lock
55
+ - Guardfile
54
56
  - LICENSE.txt
55
57
  - README.md
56
58
  - Rakefile
57
59
  - bin/u-menu
58
60
  - lib/micro/menu.rb
61
+ - lib/micro/menu/configurations.rb
62
+ - lib/micro/menu/icons.rb
59
63
  - lib/micro/menu/version.rb
60
64
  - lib/u-menu.rb
61
65
  - u-menu.gemspec
@@ -82,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
86
  - !ruby/object:Gem::Version
83
87
  version: '0'
84
88
  requirements: []
85
- rubygems_version: 3.4.12
89
+ rubygems_version: 3.4.13
86
90
  signing_key:
87
91
  specification_version: 4
88
92
  summary: u-menu (micro menu) is a simple command pallet for terminals