u-menu 0.2.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: c6d032f982a5911f087289f6daf524e95abeafb01a12361977c234a3a5bedb00
4
- data.tar.gz: 24b457dd8775626ec10947b2f4b5aae4ae6b3f33a94ee91734b16f77cffebe70
3
+ metadata.gz: 3cfb79ad584788fb2205a567eef99fac9881cb7aac9bef195be99062de4f8af4
4
+ data.tar.gz: ec105fc48dcd1520dfdd7320f3f0c194ce2ede0dba0f3fc880963ff4d4513b0e
5
5
  SHA512:
6
- metadata.gz: 02ebe5a7b058281495f04d0256a63eddf8f2878ba8cca8852c72e8d5a47e5a790fd081e0e06b7c4ff86b2853b1c7b47f4cd63f246d675284627d88b35dac3f15
7
- data.tar.gz: a26ffd9335fd9dfa23eba00dd8bbd5fb67bba9130be71ba774e948789ec43f1bf514da66fe4f73c90c5cb3611f8321b0a88340154fd5fe5e466249e18c4955ad
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/README.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # u-menu
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/u/menu`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ [![Maintainability](https://api.codeclimate.com/v1/badges/384f1905e6b7e6dc8153/maintainability)](https://codeclimate.com/github/dvinciguerra/u-menu/maintainability)
4
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/384f1905e6b7e6dc8153/test_coverage)](https://codeclimate.com/github/dvinciguerra/u-menu/test_coverage)
4
5
 
5
- TODO: Delete this and the text above, and describe your gem
6
+ micro-menu is a command line tool that delivers a simple and customized command pallet.
6
7
 
7
8
  ## Installation
8
9
 
data/bin/u-menu CHANGED
@@ -1,41 +1,23 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'bundler/inline'
3
+ require_relative '../lib/u-menu'
4
4
 
5
- gemfile do
6
- source 'https://rubygems.org'
5
+ require 'tty-prompt'
7
6
 
8
- gem 'pastel'
9
- gem 'tty-prompt'
10
- end
11
-
12
- require 'yaml'
13
-
14
- config_path = File.expand_path("#{ENV.fetch('HOME', nil)}/.umenurc.yml", __dir__)
15
- config_path ||= File.expand_path("#{ENV.fetch('HOME', nil)}/.umenu/umenurc.yml", __dir__)
7
+ config = Micro::Menu.configurations.load
16
8
 
17
- config = YAML.load_file(config_path, symbolize_names: true)
9
+ colors = Micro::Menu.colors
10
+ prompt = TTY::Prompt.new(prefix: colors.magenta("\uea85 \u00b5menu "), interrupt: :signal)
18
11
 
19
- pastel = Pastel.new
20
- prompt = TTY::Prompt.new(prefix: pastel.magenta("\uea85 \u00b5menu "), interrupt: :signal)
21
-
22
- icons = {
23
- 'run' => "\ueb9e",
24
- 'terminal' => "\uea85",
25
- 'github' => "\uea84",
26
- 'chart' => "\ue760",
27
- 'jira' => "\ue75c",
28
- 'settings' => "\ue615",
29
- 'link' => "\ueb15"
30
- }
12
+ icons = Micro::Menu.icons.all
31
13
 
32
14
  thanks = [
33
- "#{pastel.green('Great job! o/')}",
34
- "#{pastel.green('See you later! =)')}",
35
- "#{pastel.green('Baby bye bye bye...')}",
36
- "Bring me #{pastel.green('a cookie')} when you come back!?",
37
- "Have a nice #{pastel.cyan('day')}! =)",
38
- "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')}! =)"
39
21
  ]
40
22
 
41
23
  trap('INT') do
@@ -50,7 +32,7 @@ options << {
50
32
  name: '{{settings}} Edit Settings',
51
33
  type: 'edit',
52
34
  value: 'settings',
53
- execute: "#{config_path}"
35
+ execute: config[:_path]
54
36
  }
55
37
  options = options.sort { |a, b| a[:name] <=> b[:name] }
56
38
 
@@ -70,17 +52,17 @@ loop do
70
52
 
71
53
  case action[:type]
72
54
  when 'command'
73
- system "#{action[:execute]} &"
55
+ system action[:execute]
74
56
  when 'link'
75
- puts "#{pastel.bold('Sure... opening link')} '#{pastel.cyan(action[:execute])}'"
57
+ puts "#{colors.bold('Sure... opening link')} '#{colors.cyan(action[:execute])}'"
76
58
  system "open #{action[:execute]} &"
77
59
  when 'edit'
78
- puts "#{pastel.bold('Sure... opening file')} '#{pastel.cyan(action[:execute])}'"
60
+ puts "#{colors.bold('Sure... opening file')} '#{colors.cyan(action[:execute])}'"
79
61
  system "#{config[:settings][:editor]} #{action[:execute]}"
80
62
  end
81
63
 
82
64
  exit(0)
83
65
  rescue StandardError => e
84
- puts "#{pastel.red('[error]')} #{e}"
66
+ puts "#{colors.red('[error]')} #{e}"
85
67
  exit(1)
86
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.2.0'
5
+ VERSION = '0.6.0'
6
6
  end
7
7
  end
data/lib/micro/menu.rb CHANGED
@@ -1,9 +1,25 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative 'menu/configurations'
4
+ require_relative 'menu/icons'
3
5
  require_relative 'menu/version'
4
6
 
7
+ require 'pastel'
8
+
5
9
  module Micro
6
10
  module Menu
7
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
8
24
  end
9
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.2.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-02 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