cmd_tools 4.3.0 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/bin/command/em CHANGED
@@ -1,9 +1,14 @@
1
1
  #!/bin/sh
2
2
 
3
+ files="$@"
3
4
  case $(uname) in
4
5
  # emacs_launch do not work satisfactory on Mac.
5
6
  "Darwin")
6
- /Applications/MacPorts/Emacs.app/Contents/MacOS/Emacs --no-window-system "$@"
7
+ for file in ${files}
8
+ do
9
+ [ -e ${file} ] || touch ${file}
10
+ /Applications/MacPorts/Emacs.app/Contents/MacOS/Emacs --no-window-system --no-init --no-splash ${file}
11
+ done
7
12
  ;;
8
13
  *)
9
14
  cmd_tools emacs_launch --mode=cui "$@"
@@ -4,22 +4,27 @@ class ::CmdTools::Application < Thor
4
4
  require 'ruby_patch'
5
5
  extend ::RubyPatch::AutoLoad
6
6
 
7
+ desc "version", "Show CmdTools version"
8
+ def version
9
+ puts ::CmdTools::VERSION
10
+ end
11
+
7
12
  desc "min_max < FILE", "Return the minmum and maximum value of each column."
8
13
  method_option :min_max_separator, default: "\t", aliases: "-m"
9
14
  method_option :field_separator, default: "\t", aliases: "-f"
10
15
  def min_max()
11
- puts ::CmdTools::Commands::MinMax.run($stdin.read, options[:min_max_separator])\
16
+ puts ::CmdTools::Command::MinMax.run($stdin.read, options[:min_max_separator])\
12
17
  .join(options[:field_separator])
13
18
  end
14
19
 
15
20
  desc "backup FILE1 FILE2 ...", "Backup files and directories."
16
21
  def backup(*files)
17
- puts ::CmdTools::Commands::Backup.run(*files).join("\t")
22
+ puts ::CmdTools::Command::Backup.run(*files).join("\t")
18
23
  end
19
24
 
20
25
  desc "trash FILE1 FILE2 ...", "Move files and directories to ~/.myTrash"
21
26
  def trash(*files)
22
- puts ::CmdTools::Commands::Trash.run(*files).join("\t")
27
+ puts ::CmdTools::Command::Trash.run(*files).join("\t")
23
28
  end
24
29
 
25
30
  desc "emacs_launch FILE1 FILE2 ...", "Launch emacs in MODE mode."
@@ -35,11 +40,11 @@ Launch emacs in (G|C)UI mode.
35
40
  method_option :mode, type: :string, required: true, desc: "MODE should be 'gui' or 'cui'."
36
41
  def emacs_launch(*files)
37
42
  mode = options['mode'].to_sym
38
- ::CmdTools::Commands::EmacsLaunch.run(mode, *files)
43
+ ::CmdTools::Command::EmacsLaunch.run(mode, *files)
39
44
  end
40
45
 
41
46
  desc "emacs_stop", "Stop emacs daemon."
42
47
  def emacs_stop
43
- ::CmdTools::Commands::EmacsLaunch.stop
48
+ ::CmdTools::Command::EmacsLaunch.stop
44
49
  end
45
50
  end
@@ -1,4 +1,4 @@
1
- module ::CmdTools::Commands::Backup
1
+ module ::CmdTools::Command::Backup
2
2
  require 'fileutils'
3
3
  require 'find'
4
4
  require 'ruby_patch'
@@ -1,4 +1,4 @@
1
- module ::CmdTools::Commands::EmacsLaunch
1
+ module ::CmdTools::Command::EmacsLaunch
2
2
  require 'ruby_patch'
3
3
  extend ::RubyPatch::AutoLoad
4
4
 
@@ -1,4 +1,4 @@
1
- module ::CmdTools::Commands::MinMax
1
+ module ::CmdTools::Command::MinMax
2
2
  require 'ruby_patch'
3
3
  extend ::RubyPatch::AutoLoad
4
4
 
@@ -1,4 +1,4 @@
1
- module ::CmdTools::Commands::Trash
1
+ module ::CmdTools::Command::Trash
2
2
  require 'fileutils'
3
3
  require 'ruby_patch'
4
4
  extend ::RubyPatch::AutoLoad
@@ -1,4 +1,4 @@
1
- module ::CmdTools::Commands
1
+ module ::CmdTools::Command
2
2
  require 'ruby_patch'
3
3
  extend ::RubyPatch::AutoLoad
4
4
  end
@@ -6,8 +6,13 @@ module ::CmdTools::Config
6
6
 
7
7
  CONFIG_DIR = File.join(ENV['HOME'], '.config/cmd_tools')
8
8
  CONFIG_FILE = File.join(CONFIG_DIR, 'config.yaml')
9
+ MACPORTS_EMACS = '/Applications/MacPorts/Emacs.app/Contents/MacOS/Emacs'
9
10
  CONFIG_DEFAULT = {
10
- 'emacs' => ENV['ALTERNATE_EDITOR'] || 'emacs',
11
+ 'emacs' => if `uname`.chomp == "Darwin" && File.executable?(MACPORTS_EMACS)
12
+ MACPORTS_EMACS
13
+ else
14
+ ENV['ALTERNATE_EDITOR'] || 'emacs'
15
+ end,
11
16
  'emacs_window_systems' => %w[x ns mac],
12
17
  }
13
18
 
@@ -1,3 +1,3 @@
1
1
  module CmdTools
2
- VERSION = '4.3.0'
2
+ VERSION = '5.0.0'
3
3
  end
@@ -1,12 +1,12 @@
1
1
  require 'helper_for_test'
2
2
 
3
- class TestCommands < ::MiniTest::Unit::TestCase
3
+ class TestCommand < ::MiniTest::Unit::TestCase
4
4
  def test_min_max
5
5
  str = <<-EOS
6
6
  4 5 6
7
7
  1 2 3
8
8
  3 2 4
9
9
  EOS
10
- assert_equal(["1.0/4.0", "2.0/5.0", "3.0/6.0"], ::CmdTools::Commands::MinMax.run(str, '/'))
10
+ assert_equal(["1.0/4.0", "2.0/5.0", "3.0/6.0"], ::CmdTools::Command::MinMax.run(str, '/'))
11
11
  end
12
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cmd_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.0
4
+ version: 5.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-18 00:00:00.000000000 Z
12
+ date: 2012-12-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ruby_patch
16
- requirement: &2153756160 !ruby/object:Gem::Requirement
16
+ requirement: &2153660480 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '2.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2153756160
24
+ version_requirements: *2153660480
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: thor
27
- requirement: &2153755640 !ruby/object:Gem::Requirement
27
+ requirement: &2153659780 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0.16'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2153755640
35
+ version_requirements: *2153659780
36
36
  description: ! 'Command line tools. Please type
37
37
 
38
38
 
@@ -61,23 +61,23 @@ files:
61
61
  - cmd_tools.gemspec
62
62
  - lib/cmd_tools.rb
63
63
  - lib/cmd_tools/application.rb
64
- - lib/cmd_tools/commands.rb
65
- - lib/cmd_tools/commands/backup.rb
66
- - lib/cmd_tools/commands/emacs_launch.rb
67
- - lib/cmd_tools/commands/min_max.rb
68
- - lib/cmd_tools/commands/trash.rb
64
+ - lib/cmd_tools/command.rb
65
+ - lib/cmd_tools/command/backup.rb
66
+ - lib/cmd_tools/command/emacs_launch.rb
67
+ - lib/cmd_tools/command/min_max.rb
68
+ - lib/cmd_tools/command/trash.rb
69
69
  - lib/cmd_tools/config.rb
70
70
  - lib/cmd_tools/recommended_shell_settings.rb
71
71
  - lib/cmd_tools/version.rb
72
72
  - test/helper_for_test.rb
73
- - test/test_commands.rb
73
+ - test/test_command.rb
74
74
  homepage:
75
75
  licenses: []
76
76
  post_install_message: ! '
77
77
 
78
78
  # CmdTools
79
79
 
80
- export PATH=${HOME}/.gem/ruby/1.9.1/gems/cmd_tools-4.3.0/bin/command:${PATH}
80
+ export PATH=${HOME}/.gem/ruby/1.9.1/gems/cmd_tools-5.0.0/bin/command:${PATH}
81
81
 
82
82
 
83
83
  '