mysh 0.6.6 → 0.6.8

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
  SHA1:
3
- metadata.gz: 36d1e9cb65e8e404c9e85ab77e29e1201a2df5f6
4
- data.tar.gz: 3e5f058a9f2a8ebbe313fff8983aa328b016652f
3
+ metadata.gz: 8403491794cc9b50c4dc0bed451e056885cc71d0
4
+ data.tar.gz: 72acbb99d7324a29ba47507c011497355fd61069
5
5
  SHA512:
6
- metadata.gz: 5d9ba17eb0a81ebc7b291767f03f9d56b077b8b82e89593b090fd689eae5acfdce02554b7b8ab0eff9a0359506328bb7a28f49101ac0b9847980d5dec10b075c
7
- data.tar.gz: fbb691b11d8daf992f152412bd4dae5b3ebe958c73abfc1f2c759ba0c757443c8bacf19174914057cb95639dcac5c8a417973ff0e02e5bd87ee2ff495b8e872a
6
+ metadata.gz: f82fd9fc077c6f6b3e205eae6cbadba360ef37c98a3a25364c8fd9ba4b6aa7ffbdeaf18fd8be0271bff3f760bdabc7c87cf7f74163c55c3464f1441ca576069d
7
+ data.tar.gz: 5ac0b97c97351f5234c4da238869682dd3dcbac81318876cc20f04d4cf97c590caca373caccfc5221f358fd7dff2fdd1593687ad830849dc31c0088c5f687b25
data/README.md CHANGED
@@ -371,8 +371,11 @@ The processing of input continues (looping) until it doesn't. This occurs when
371
371
  a command to stop looping is entered or the mini_readline gem signals
372
372
  end-of-input condition. The (internal) commands that do this are:
373
373
 
374
- * exit - exit the current mysh level.
375
- * quit - terminate the mysh program.
374
+ * cancel - exit the current mysh file/level.
375
+ * exit - terminate the mysh program.
376
+
377
+ The cancel and exit commands are also available, with the same names and
378
+ behavior, to Ruby code.
376
379
 
377
380
  An end-of-input condition is signaled by the user by entering Ctrl-z (in
378
381
  windows) or Alt-z (in Linux/Mac). See the mini_readline gem (link above) for
@@ -592,8 +595,8 @@ none | General help on mysh.
592
595
  = | Help on ruby expressions.
593
596
  ? | This help on the help command.
594
597
  @ | Help on the show command.
595
- args | Help on mysh command arguments.
596
598
  env | Help on the show env command.
599
+ gem | Help on the show gem command.
597
600
  gls | Help on gls internal mysh command.
598
601
  help | This help on the help command.
599
602
  history | Help on the history command.
@@ -605,6 +608,7 @@ quick | Help on quick commands.
605
608
  ruby | Help on the show ruby command.
606
609
  set | Help on mysh variables.
607
610
  show | Help on the show command.
611
+ term | Help on the show term command.
608
612
  types | Help on mysh file types.
609
613
  usage | Help on mysh usage options.
610
614
  {{ | Help on mysh handlebars.
@@ -629,19 +633,18 @@ Topic | Description
629
633
  ---------|----------------------------------------------------
630
634
  about | A brief description of the mysh shell program.
631
635
  version | The version of mysh in use.
636
+ installed| All installed versions of mysh.
637
+ latest | The latest version of mysh.
632
638
  init file| The init file in use or <none found> or <none>.
633
639
  user | The current user name.
634
640
  home | The current home directory.
635
641
  name | The path/name of the mysh program currently executing.
636
- shell | The path/name of the system command shell.
642
+ os shell | The path/name of the system command shell.
637
643
  host | The name of the host computer.
638
644
  os | The current operating system.
639
645
  platform | The operating platform detected by the low-level terminal gem.
640
646
  java | Is the current platform powered by Java?
641
- code page| In Windows, what code page is active?
642
- term | What terminal is defined by the system, if one is defined.
643
- disp | What display is defined by the system, if one is defined.
644
- edit | What editor is defined by the system, if one is defined.
647
+ PID | The process ID of the mysh program.
645
648
  path | An easy-to-read, formatted version of the current search path.
646
649
 
647
650
 
@@ -667,6 +670,68 @@ host os | The current operating system.
667
670
  host vendor | The current environment vendor/genre.
668
671
  $: | An easy-to-read, formatted version of $: or the ruby search path.
669
672
 
673
+ ##### Gem (@gem)
674
+
675
+ The show gem (or @gem) command is used to display useful information about
676
+ the current gem system. There are two distinct ways to use this command.
677
+
678
+ The first is without any arguments. This displays general information about the
679
+ gem subsystem. This includes:
680
+
681
+ Topic | Description
682
+ --------------|----------------------------------------------------
683
+ about | About rubygems.
684
+ version | The current version of rubygems.
685
+ latest | The latest version of rubygems available.
686
+ marshal | The version of the marshal format for your Ruby.
687
+ host | Get the default RubyGems API host. This is normally https://rubygems.org.
688
+ sources | Returns an Array of sources to fetch remote gems from.
689
+ gem folder | The path where gems are to be installed.
690
+ bin folder | The path where gem executables are to be installed.
691
+ config path | The path to standard location of the user's .gemrc file.
692
+ cert path | The default signing certificate chain path
693
+ key path | The default signing key path
694
+ spec cache | The path to where specs are cached.
695
+ file suffixes | Suffixes for require-able paths.
696
+ gem dep files | The files where dependencies may be specified. Use Gemfile
697
+ gem platforms | Array of platforms this RubyGems supports.
698
+ gem path | The folders searched when looking for a gem locally.
699
+
700
+ The alternative is to specify a list of gems of interest. For each gem in the
701
+ list, the program will list all installed versions of that gem and the latest
702
+ version of that gem on the rubygems host. For example:
703
+
704
+ 8 mysh>@gem rails gosu
705
+ Info on specified gems.
706
+
707
+ rails 4.2.0, 5.1.3, 5.1.6
708
+ latest 5.2.2
709
+
710
+ gosu 0.13.3
711
+ latest 0.14.4
712
+
713
+ ##### Term (@term)
714
+
715
+ This command displays useful information about the console.
716
+
717
+ Topic | Description
718
+ --------------|----------------------------------------------------
719
+ about | About the mini_readline gem.
720
+ version | The installed version of mini_readline.
721
+ installed | All installed versions of mini_readline.
722
+ latest | The latest version of mini_readline available.
723
+ about | About the mini_term gem.
724
+ version | The installed version of mini_term.
725
+ installed | All installed versions of mini_term.
726
+ latest | The latest version of mini_term available.
727
+ platform | The operating platform detected by mini_term.
728
+ columns | The number of columns in the console.
729
+ rows | The number of rows in the console.
730
+ code page | For Windows, what is the current code page?
731
+ term | What terminal is defined by the system, if one is defined.
732
+ disp | What display is defined by the system, if one is defined.
733
+ edit | What editor is defined by the system, if one is defined.
734
+
670
735
 
671
736
  ### Internal Shell Commands:
672
737
 
@@ -33,9 +33,16 @@ class Object
33
33
  $stdout = saved
34
34
  end
35
35
 
36
- #Unwrap one mysh layer.
36
+ # Unwrap one mysh layer.
37
37
  def cancel
38
38
  raise MyshExit
39
39
  end
40
40
 
41
+ # Run some code with no wuccas.
42
+ def insouciant
43
+ yield
44
+ rescue => err
45
+ err.to_s
46
+ end
47
+
41
48
  end
@@ -3,18 +3,19 @@ Help: mysh show env command summary:
3
3
  The show env (or @env) command is used to display useful information about the
4
4
  current execution environment. This includes:
5
5
 
6
+ about - About mysh.
7
+ version - The current version of mysh.
8
+ installed - All installed versions of mysh.
9
+ latest - The latest version of mysh.
10
+ init file - The location of the mysh init file.
6
11
  user - The current user name.
7
12
  home - The current home directory.
8
13
  name - The path/name of the mysh program currently executing.
9
- shell - The path/name of the system command shell.
14
+ os shell - The path/name of the system command shell.
10
15
  host - The name of the host computer.
11
16
  os - The current operating system.
12
17
  platform - The operating platform detected by the low-level terminal gem.
13
18
  java - Is the current platform powered by Java?
14
- code page - For Windows, what is the current code page?
15
- term - What terminal is defined by the system, if one is defined.
16
- disp - What display is defined by the system, if one is defined.
17
- edit - What editor is defined by the system, if one is defined.
18
19
  PID - The process ID of the mysh program.
19
20
 
20
21
  path - An easy-to-read, formatted version of the current search path.
@@ -0,0 +1,39 @@
1
+ Help: mysh show gem command summary:
2
+
3
+ The show gem (or @gem) command is used to display useful information about
4
+ the current gem system. There are two distinct ways to use this command.
5
+
6
+ The first is without any arguments. This displays general information about the
7
+ gem subsystem. This includes:
8
+
9
+ about - About rubygems.
10
+ version - The current version of rubygems.
11
+ latest - The latest version of rubygems available.
12
+ marshal - The version of the marshal format for your ruby.
13
+ host - Get the default RubyGems API host.
14
+ This is normally https://rubygems.org.
15
+ sources - Returns an Array of sources to fetch remote gems from.
16
+ gem folder - The path where gems are to be installed.
17
+ bin folder - The path where gem executables are to be installed.
18
+ config path - The path to standard location of the user's .gemrc file.
19
+ cert path - The default signing certificate chain path
20
+ key path - The default signing key path
21
+ spec cache - The path to where specs are cached.
22
+ file suffixes - Suffixes for require-able paths.
23
+ gem dep files - The files where dependencies may be specified. Use Gemfile
24
+ gem platforms - Array of platforms this RubyGems supports.
25
+ gem path - The folders searched when looking for a gem locally.
26
+
27
+ The alternative is to specify a list of gems of interest. For each gem in the
28
+ list, the program will list all installed versions of that gem and the latest
29
+ version of that gem on the rubygems host. For example:
30
+
31
+ 8 mysh>@gem rails gosu
32
+ Info on specified gems.
33
+
34
+ rails 4.2.0, 5.1.3, 5.1.6
35
+ latest 5.2.2
36
+
37
+ gosu 0.13.3
38
+ latest 0.14.4
39
+
@@ -28,6 +28,8 @@ module Mysh
28
28
  ['%', 'Help on timed command execution.', 'timed.txt' ],
29
29
  ['env', 'Help on the show env command.', 'env.txt' ],
30
30
  ['ruby', 'Help on the show ruby command.', 'ruby.txt' ],
31
+ ['gem', 'Help on the show gem command.', 'gem.txt' ],
32
+ ['term', 'Help on the show term command.', 'term.txt' ],
31
33
  ['math', 'Help on math functions.', 'math.txt' ],
32
34
  ['usage', 'Help on mysh usage.', 'usage.txt' ],
33
35
  ['=', 'Help on ruby expressions.', 'expr.txt' ],
@@ -0,0 +1,21 @@
1
+ Help: mysh show term command summary:
2
+
3
+ The show term (or @term) command is used to display useful information about
4
+ the current console. This includes:
5
+
6
+ about - About the mini_readline gem.
7
+ version - The installed version of mini_readline.
8
+ installed - All installed versions of mini_readline.
9
+ latest - The latest version of mini_readline available.
10
+ about - About the mini_term gem.
11
+ version - The installed version of mini_term.
12
+ installed - All installed versions of mini_term.
13
+ latest - The latest version of mini_term available.
14
+ platform - The operating platform detected by mini_term.
15
+ columns - The number of columns in the console.
16
+ rows - The number of rows in the console.
17
+ code page - For Windows, what is the current code page?
18
+ term - What terminal is defined by the system, if one is defined.
19
+ disp - What display is defined by the system, if one is defined.
20
+ edit - What editor is defined by the system, if one is defined.
21
+
@@ -3,6 +3,9 @@
3
3
  #* mysh/internal/actions/show.rb -- The mysh internal show command.
4
4
  module Mysh
5
5
 
6
+ # The working message for long duration processing.
7
+ WORKING = "Working...\r"
8
+
6
9
  #Show items.
7
10
  default = Action.new do |input|
8
11
  puts "No show data found for #{input.raw.inspect}. See ?@ for more."
@@ -1,26 +1,33 @@
1
1
  # coding: utf-8
2
2
 
3
- #* mysh/internal/actions/show/env.rb -- Get help on the mysh environment.
3
+ # Get info on the mysh environment.
4
4
  module Mysh
5
5
 
6
- #* mysh/internal/actions/show/env.rb -- Get help on the mysh environment.
6
+ # Get info on the mysh environment.
7
7
  class EnvInfoCommand < Action
8
8
 
9
- #Execute the ? shell command.
9
+ # Execute the @env shell command.
10
10
  def process_command(_args)
11
- puts "Key mysh environment information.", ""
12
- puts info.format_mysh_bullets, "",
11
+ print WORKING unless @ran_once
12
+
13
+ puts "Key mysh environment information.", "",
14
+ info.format_mysh_bullets, "",
13
15
  path.format_mysh_bullets, ""
16
+
17
+ @ran_once = true
14
18
  end
15
19
 
16
20
  private
17
21
 
18
- #Get the info
19
- #<br>Endemic Code Smells
20
- #* :reek:UtilityFunction
22
+ # Get the info
23
+ # Endemic Code Smells :reek:UtilityFunction
21
24
  def info
22
25
  [["about", Mysh::SUMMARY],
23
26
  ["version", Mysh::VERSION],
27
+ ["installed", Gem::Specification.find_all_by_name("mysh")
28
+ .map{|s| s.version.to_s}
29
+ .join(", ")],
30
+ ["latest", insouciant {Gem.latest_version_for("mysh").to_s}],
24
31
  ["init file", $mysh_init_file.to_host_spec],
25
32
  ["user", ENV['USER']],
26
33
  ["home", (ENV['HOME'] || "").to_host_spec],
@@ -30,17 +37,12 @@ module Mysh
30
37
  ["os", ENV['OS']],
31
38
  ["platform", MiniTerm::TERM_PLATFORM],
32
39
  ["java?", MiniTerm.java? ? true : false],
33
- ["code page", if MiniTerm.windows?; (`chcp`); end],
34
- ["term", ENV['TERM']],
35
- ["disp", ENV['DISPLAY']],
36
- ["edit", ENV['EDITOR']],
37
40
  ["PID", $PROCESS_ID]
38
41
  ]
39
42
  end
40
43
 
41
- #Get the path.
42
- #<br>Endemic Code Smells
43
- #* :reek:UtilityFunction
44
+ # Get the path.
45
+ # Endemic Code Smells :reek:UtilityFunction
44
46
  def path
45
47
  [["path"].concat(ENV['PATH'].split(File::PATH_SEPARATOR))]
46
48
  end
@@ -0,0 +1,93 @@
1
+ # coding: utf-8
2
+
3
+ # Get help on the gem environment.
4
+ module Mysh
5
+
6
+ # Get help on the gem environment.
7
+ class GemInfoCommand < Action
8
+
9
+ #Execute the @gem shell command.
10
+ def process_command(input)
11
+ print WORKING unless @ran_once
12
+
13
+ args = input.cooked_body.split(" ")[1..-1]
14
+
15
+ if args.empty?
16
+ general
17
+ else
18
+ specific(args)
19
+ end
20
+
21
+ @ran_once = true
22
+ end
23
+
24
+ private
25
+
26
+ # A general info request
27
+ def general
28
+ puts "Key gem system information.", "",
29
+ info.format_mysh_bullets, "",
30
+ path.format_mysh_bullets, ""
31
+ end
32
+
33
+ # Get the info
34
+ # Endemic Code Smells :reek:UtilityFunction
35
+ def info
36
+ [["about", "RubyGems is the ruby standard for publishing and " +
37
+ "managing third party libraries."],
38
+ ["version", Gem.rubygems_version.to_s],
39
+ ["latest", insouciant {Gem.latest_rubygems_version.to_s}],
40
+ ["marshal", Gem.marshal_version],
41
+ ["host", Gem.host],
42
+ ["sources", Gem.sources.map(&:to_s)],
43
+ ["gem folder", Gem.dir.to_host_spec],
44
+ ["bin folder", Gem.bindir.to_host_spec],
45
+ ["config path", Gem.config_file.to_host_spec],
46
+ ["cert path", Gem.default_cert_path.to_host_spec],
47
+ ["key path", Gem.default_key_path.to_host_spec],
48
+ ["spec cache", Gem.spec_cache_dir.to_host_spec],
49
+ ["file suffixes", Gem.suffixes.map{|sfx| '"'+sfx+'"'}.join(", ")],
50
+ ["gem dep files", Gem::GEM_DEP_FILES.map{|sfx| '"'+sfx+'"'}.join(", ")],
51
+ ["gem platforms", Gem.platforms.map{|sfx| '"'+sfx.to_s+'"'}.join(", ")]
52
+ ]
53
+ end
54
+
55
+ # Get the Gem path.
56
+ # Endemic Code Smells :reek:UtilityFunction
57
+ def path
58
+ [["gem path"].concat(Gem.path)]
59
+ end
60
+
61
+ # Get gem info on the specified gems
62
+ def specific(args)
63
+ details = []
64
+
65
+ args.each do |gem|
66
+ version_list = Gem::Specification.find_all_by_name(gem)
67
+ .map{|s| s.version.to_s}
68
+ .join(", ")
69
+ details << [gem, version_list]
70
+
71
+ latest = insouciant {latest_version_for(gem).to_s}
72
+ details << ["latest", latest]
73
+ details << [" ", " "]
74
+ end
75
+
76
+ puts "Info on specified gems.", "",
77
+ details.format_mysh_bullets
78
+ end
79
+
80
+ # Get the latest version for the named gem. Patched code.
81
+ def latest_version_for(name)
82
+ dependency = Gem::Dependency.new(name)
83
+ fetcher = Gem::SpecFetcher.fetcher
84
+ spec = fetcher.spec_for_dependency(dependency)[0][-1][0]
85
+ spec && spec.version
86
+ end
87
+
88
+ end
89
+
90
+ desc = 'Get information about the current gem support or ' +
91
+ 'the specified list of gems. See ?gem for more.'
92
+ SHOW.add_action(GemInfoCommand.new('gem <gems>', desc))
93
+ end
@@ -1,12 +1,12 @@
1
1
  # coding: utf-8
2
2
 
3
- #* mysh/internal/actions/show/ruby.rb -- Get help on the ruby environment.
3
+ # Get info on the ruby environment.
4
4
  module Mysh
5
5
 
6
- #* mysh/internal/actions/show/ruby.rb -- Get help on the ruby environment.
6
+ # Get info on the ruby environment.
7
7
  class RubyInfoCommand < Action
8
8
 
9
- #Execute the ? shell command.
9
+ #Execute the @ruby shell command.
10
10
  def process_command(_input)
11
11
  puts "Key ruby environment information.", ""
12
12
  puts info.format_mysh_bullets, "",
@@ -15,9 +15,8 @@ module Mysh
15
15
 
16
16
  private
17
17
 
18
- #Get the info
19
- #<br>Endemic Code Smells
20
- #* :reek:UtilityFunction
18
+ # Get the info
19
+ # Endemic Code Smells :reek:UtilityFunction
21
20
  def info
22
21
  [["location", RbConfig.ruby.to_host_spec],
23
22
  ["description", RUBY_DESCRIPTION],
@@ -36,9 +35,8 @@ module Mysh
36
35
  ]
37
36
  end
38
37
 
39
- #Get the path.
40
- #<br>Endemic Code Smells
41
- #* :reek:UtilityFunction
38
+ # Get the path.
39
+ # Endemic Code Smells :reek:UtilityFunction
42
40
  def path
43
41
  [["$:"].concat($:)]
44
42
  end
@@ -0,0 +1,53 @@
1
+ # coding: utf-8
2
+
3
+ # Get help on the term environment.
4
+ module Mysh
5
+
6
+ # Get help on the term environment.
7
+ class TermInfoCommand < Action
8
+
9
+ #Execute the @term shell command.
10
+ def process_command(_args)
11
+ print WORKING unless @ran_once
12
+
13
+ puts "Key term information.", "",
14
+ info.format_mysh_bullets, ""
15
+
16
+ @ran_once = true
17
+ end
18
+
19
+ private
20
+
21
+ # Get the info
22
+ # Endemic Code Smells :reek:UtilityFunction
23
+ def info
24
+ [["about", MiniReadline::DESCRIPTION],
25
+ ["version", MiniReadline::VERSION],
26
+ ["installed", Gem::Specification.find_all_by_name("mini_readline")
27
+ .map{|s| s.version.to_s}
28
+ .join(", ")],
29
+ ["latest", insouciant {Gem.latest_version_for("mini_readline").to_s}],
30
+ ["about", MiniTerm::DESCRIPTION],
31
+ ["version", MiniTerm::VERSION],
32
+ ["installed", Gem::Specification.find_all_by_name("mini_term")
33
+ .map{|s| s.version.to_s}
34
+ .join(", ")],
35
+ ["latest", insouciant {Gem.latest_version_for("mini_term").to_s}],
36
+ ["platform", MiniTerm::TERM_PLATFORM.inspect],
37
+ ["term type", MiniTerm::TERM_TYPE.inspect],
38
+ ["columns", MiniTerm.width.to_s],
39
+ ["rows", MiniTerm.height.to_s],
40
+ ["code page", if MiniTerm.windows?; (`chcp`); end],
41
+ ["term", ENV['TERM']],
42
+ ["disp", ENV['DISPLAY']],
43
+ ["edit", ENV['EDITOR']]
44
+ ]
45
+ end
46
+
47
+
48
+
49
+ end
50
+
51
+ desc = 'Get information about the console. See ?term for more.'
52
+ SHOW.add_action(TermInfoCommand.new('term', desc))
53
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Mysh
4
4
  #The version string of MY SHell.
5
- VERSION = "0.6.6"
5
+ VERSION = "0.6.8"
6
6
 
7
7
  #A brief summary of this gem.
8
8
  SUMMARY = "mysh -- a Ruby inspired command line shell."
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mysh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.6
4
+ version: 0.6.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Camilleri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-03 00:00:00.000000000 Z
11
+ date: 2018-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -184,6 +184,7 @@ files:
184
184
  - lib/mysh/internal/actions/help.rb
185
185
  - lib/mysh/internal/actions/help/env.txt
186
186
  - lib/mysh/internal/actions/help/expr.txt
187
+ - lib/mysh/internal/actions/help/gem.txt
187
188
  - lib/mysh/internal/actions/help/gls.txt
188
189
  - lib/mysh/internal/actions/help/h_o_h.txt
189
190
  - lib/mysh/internal/actions/help/hbar.txt
@@ -197,6 +198,7 @@ files:
197
198
  - lib/mysh/internal/actions/help/ruby.txt
198
199
  - lib/mysh/internal/actions/help/show.txt
199
200
  - lib/mysh/internal/actions/help/sub_help.rb
201
+ - lib/mysh/internal/actions/help/term.txt
200
202
  - lib/mysh/internal/actions/help/timed.txt
201
203
  - lib/mysh/internal/actions/help/types.txt
202
204
  - lib/mysh/internal/actions/help/usage.txt
@@ -208,7 +210,9 @@ files:
208
210
  - lib/mysh/internal/actions/say.rb
209
211
  - lib/mysh/internal/actions/show.rb
210
212
  - lib/mysh/internal/actions/show/env.rb
213
+ - lib/mysh/internal/actions/show/gem.rb
211
214
  - lib/mysh/internal/actions/show/ruby.rb
215
+ - lib/mysh/internal/actions/show/term.rb
212
216
  - lib/mysh/internal/actions/type.rb
213
217
  - lib/mysh/internal/actions/vars.rb
214
218
  - lib/mysh/internal/format.rb