mysh 0.6.7 → 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: 8ccc77021991eea710a4f18df07bcbc4299ac54f
4
- data.tar.gz: b2b8547854f287ce68ae9c3f4040e9a350540a80
3
+ metadata.gz: 8403491794cc9b50c4dc0bed451e056885cc71d0
4
+ data.tar.gz: 72acbb99d7324a29ba47507c011497355fd61069
5
5
  SHA512:
6
- metadata.gz: 46d4a07ecced86317296a1d1d2b61180eb10c33baec5c45395757f466834d207af16de8f209015321f2713797ed0678ef601cc0117505ccbe4d58e6fd3bfbcb0
7
- data.tar.gz: 96c351932b68923ee8af8b75834dd8ce958b83c9e2c1c1c210abdbb16db8e720164d74568682291b031bb58915c8d0e33934fb66ff5e74d3df8379c36df531d1
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
 
@@ -669,14 +672,18 @@ $: | An easy-to-read, formatted version of $: or the ruby search path.
669
672
 
670
673
  ##### Gem (@gem)
671
674
 
672
- This command displays useful information about the current rubygems
673
- gem management system.
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:
674
680
 
675
681
  Topic | Description
676
682
  --------------|----------------------------------------------------
677
- rubygems vers | The installed version of rubygems.
678
- latest vers | The latest version of rubygems available.
679
- marshal vers | The version of the Marshal format for your Ruby.
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.
680
687
  host | Get the default RubyGems API host. This is normally https://rubygems.org.
681
688
  sources | Returns an Array of sources to fetch remote gems from.
682
689
  gem folder | The path where gems are to be installed.
@@ -690,6 +697,41 @@ gem dep files | The files where dependencies may be specified. Use Gemfile
690
697
  gem platforms | Array of platforms this RubyGems supports.
691
698
  gem path | The folders searched when looking for a gem locally.
692
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
+
693
735
 
694
736
  ### Internal Shell Commands:
695
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.
@@ -1,11 +1,15 @@
1
1
  Help: mysh show gem command summary:
2
2
 
3
3
  The show gem (or @gem) command is used to display useful information about
4
- the current gem system. This includes:
4
+ the current gem system. There are two distinct ways to use this command.
5
5
 
6
- rubygems vers - The installed version of rubygems.
7
- latest vers - The latest version of rubygems available.
8
- marshal vers - The version of the Marshal format for your Ruby.
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.
9
13
  host - Get the default RubyGems API host.
10
14
  This is normally https://rubygems.org.
11
15
  sources - Returns an Array of sources to fetch remote gems from.
@@ -20,3 +24,16 @@ gem dep files - The files where dependencies may be specified. Use Gemfile
20
24
  gem platforms - Array of platforms this RubyGems supports.
21
25
  gem path - The folders searched when looking for a gem locally.
22
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
+
@@ -29,6 +29,7 @@ module Mysh
29
29
  ['env', 'Help on the show env command.', 'env.txt' ],
30
30
  ['ruby', 'Help on the show ruby command.', 'ruby.txt' ],
31
31
  ['gem', 'Help on the show gem command.', 'gem.txt' ],
32
+ ['term', 'Help on the show term command.', 'term.txt' ],
32
33
  ['math', 'Help on math functions.', 'math.txt' ],
33
34
  ['usage', 'Help on mysh usage.', 'usage.txt' ],
34
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
@@ -3,29 +3,41 @@
3
3
  # Get help on the gem environment.
4
4
  module Mysh
5
5
 
6
- #* mysh/internal/actions/show/env.rb -- Get help on the mysh environment.
6
+ # Get help on the gem environment.
7
7
  class GemInfoCommand < Action
8
8
 
9
- #Execute the ? shell command.
10
- def process_command(_args)
11
- print "Working...\r" unless @ran_once
9
+ #Execute the @gem shell command.
10
+ def process_command(input)
11
+ print WORKING unless @ran_once
12
12
 
13
- puts "Key gem system information.", "",
14
- info.format_mysh_bullets, "",
15
- path.format_mysh_bullets, ""
13
+ args = input.cooked_body.split(" ")[1..-1]
14
+
15
+ if args.empty?
16
+ general
17
+ else
18
+ specific(args)
19
+ end
16
20
 
17
21
  @ran_once = true
18
22
  end
19
23
 
20
24
  private
21
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
+
22
33
  # Get the info
23
- #<br>Endemic Code Smells
24
- #* :reek:UtilityFunction
34
+ # Endemic Code Smells :reek:UtilityFunction
25
35
  def info
26
- [["rubygems vers", Gem.rubygems_version.to_s],
27
- ["latest vers", Gem.latest_rubygems_version.to_s],
28
- ["marshal vers", Gem.marshal_version],
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],
29
41
  ["host", Gem.host],
30
42
  ["sources", Gem.sources.map(&:to_s)],
31
43
  ["gem folder", Gem.dir.to_host_spec],
@@ -41,15 +53,41 @@ module Mysh
41
53
  end
42
54
 
43
55
  # Get the Gem path.
44
- #<br>Endemic Code Smells
45
- #* :reek:UtilityFunction
56
+ # Endemic Code Smells :reek:UtilityFunction
46
57
  def path
47
58
  [["gem path"].concat(Gem.path)]
48
59
  end
49
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
+
50
88
  end
51
89
 
52
- desc = 'Get information about the current gem support. ' +
53
- 'See ?gem for more.'
54
- SHOW.add_action(GemInfoCommand.new('gem', desc))
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))
55
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.7"
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.7
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-04 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
@@ -198,6 +198,7 @@ files:
198
198
  - lib/mysh/internal/actions/help/ruby.txt
199
199
  - lib/mysh/internal/actions/help/show.txt
200
200
  - lib/mysh/internal/actions/help/sub_help.rb
201
+ - lib/mysh/internal/actions/help/term.txt
201
202
  - lib/mysh/internal/actions/help/timed.txt
202
203
  - lib/mysh/internal/actions/help/types.txt
203
204
  - lib/mysh/internal/actions/help/usage.txt
@@ -211,6 +212,7 @@ files:
211
212
  - lib/mysh/internal/actions/show/env.rb
212
213
  - lib/mysh/internal/actions/show/gem.rb
213
214
  - lib/mysh/internal/actions/show/ruby.rb
215
+ - lib/mysh/internal/actions/show/term.rb
214
216
  - lib/mysh/internal/actions/type.rb
215
217
  - lib/mysh/internal/actions/vars.rb
216
218
  - lib/mysh/internal/format.rb