ktec-commander 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,53 @@
1
+
2
+ require 'rubygems'
3
+ require 'commander/import'
4
+ require 'stringio'
5
+
6
+ # Mock terminal IO streams so we can spec against them
7
+
8
+ def mock_terminal
9
+ @input = StringIO.new
10
+ @output = StringIO.new
11
+ $terminal = HighLine.new @input, @output
12
+ end
13
+
14
+ # Create test command for usage within several specs
15
+
16
+ def create_test_command
17
+ command :test do |c|
18
+ c.syntax = "test [options] <file>"
19
+ c.description = "test description"
20
+ c.example "description", "command"
21
+ c.example "description 2", "command 2"
22
+ c.option '-v', "--verbose", "verbose description"
23
+ c.when_called do |args, options|
24
+ "test %s" % args.join
25
+ end
26
+ end
27
+ @command = command :test
28
+ end
29
+
30
+ # Create a new command runner
31
+
32
+ def new_command_runner *args, &block
33
+ Commander::Runner.instance_variable_set :"@singleton", Commander::Runner.new(args)
34
+ program :name, 'test'
35
+ program :version, '1.2.3'
36
+ program :description, 'something'
37
+ create_test_command
38
+ yield if block
39
+ Commander::Runner.instance
40
+ end
41
+
42
+ # Comply with how specs were previously written
43
+
44
+ def command_runner
45
+ Commander::Runner.instance
46
+ end
47
+
48
+ def run *args
49
+ new_command_runner *args do
50
+ program :help_formatter, Commander::HelpFormatter::Base
51
+ end.run!
52
+ @output.string
53
+ end
@@ -0,0 +1,11 @@
1
+
2
+ describe Commander::UI do
3
+
4
+ describe ".replace_tokens" do
5
+ it "should replace tokens within a string, with hash values" do
6
+ result = Commander::UI.replace_tokens 'Welcome :name, enjoy your :object'.freeze, :name => 'TJ', :object => 'cookie'
7
+ result.should == 'Welcome TJ, enjoy your cookie'
8
+ end
9
+ end
10
+
11
+ end
@@ -0,0 +1,18 @@
1
+
2
+ desc 'Build docs with sdoc gem'
3
+ task :docs do
4
+ sh 'sdoc -N lib/commander'
5
+ end
6
+
7
+ namespace :docs do
8
+
9
+ desc 'Remove rdoc products'
10
+ task :remove => [:clobber_docs]
11
+
12
+ desc 'Build docs, and open in browser for viewing (specify BROWSER)'
13
+ task :open => [:docs] do
14
+ browser = ENV["BROWSER"] || "safari"
15
+ sh "open -a #{browser} doc/index.html"
16
+ end
17
+
18
+ end
@@ -0,0 +1,3 @@
1
+
2
+ desc 'Build gemspec file'
3
+ task :gemspec => [:build_gemspec]
@@ -0,0 +1,25 @@
1
+
2
+ require 'spec/rake/spectask'
3
+
4
+ desc "Run all specifications"
5
+ Spec::Rake::SpecTask.new(:spec) do |t|
6
+ t.libs << "lib"
7
+ t.spec_opts = ["--color", "--require", "spec/spec_helper.rb"]
8
+ end
9
+
10
+ namespace :spec do
11
+
12
+ desc "Run all specifications verbosely"
13
+ Spec::Rake::SpecTask.new(:verbose) do |t|
14
+ t.libs << "lib"
15
+ t.spec_opts = ["--color", "--format", "specdoc", "--require", "spec/spec_helper.rb"]
16
+ end
17
+
18
+ desc "Run specific specification verbosely (specify SPEC)"
19
+ Spec::Rake::SpecTask.new(:select) do |t|
20
+ t.libs << "lib"
21
+ t.spec_files = [ENV["SPEC"]]
22
+ t.spec_opts = ["--color", "--format", "specdoc", "--require", "spec/spec_helper.rb"]
23
+ end
24
+
25
+ end
metadata ADDED
@@ -0,0 +1,127 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ktec-commander
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.3.1
5
+ platform: ruby
6
+ authors:
7
+ - TJ Holowaychuk
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-05-12 00:00:00 -07:00
13
+ default_executable: commander
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: highline
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.5.0
24
+ version:
25
+ description: The complete solution for Ruby command-line executables
26
+ email: tj@vision-media.ca
27
+ executables:
28
+ - commander
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - bin/commander
33
+ - lib/commander/blank.rb
34
+ - lib/commander/command.rb
35
+ - lib/commander/core_ext/array.rb
36
+ - lib/commander/core_ext/object.rb
37
+ - lib/commander/core_ext.rb
38
+ - lib/commander/help_formatters/base.rb
39
+ - lib/commander/help_formatters/terminal/command_help.erb
40
+ - lib/commander/help_formatters/terminal/help.erb
41
+ - lib/commander/help_formatters/terminal.rb
42
+ - lib/commander/help_formatters/terminal_compact/command_help.erb
43
+ - lib/commander/help_formatters/terminal_compact/help.erb
44
+ - lib/commander/help_formatters/terminal_compact.rb
45
+ - lib/commander/help_formatters.rb
46
+ - lib/commander/runner.rb
47
+ - lib/commander/user_interaction.rb
48
+ - lib/commander/version.rb
49
+ - lib/commander.rb
50
+ - README.rdoc
51
+ - tasks/docs.rake
52
+ - tasks/gemspec.rake
53
+ - tasks/spec.rake
54
+ files:
55
+ - bin/commander
56
+ - commander.gemspec
57
+ - History.rdoc
58
+ - lib/commander.rb
59
+ - lib/commander/blank.rb
60
+ - lib/commander/core_ext.rb
61
+ - lib/commander/help_formatters.rb
62
+ - lib/commander/user_interaction.rb
63
+ - lib/commander/command.rb
64
+ - lib/commander/delegates.rb
65
+ - lib/commander/import.rb
66
+ - lib/commander/version.rb
67
+ - lib/commander/core_ext
68
+ - lib/commander/help_formatters
69
+ - lib/commander/runner.rb
70
+ - lib/commander/core_ext/array.rb
71
+ - lib/commander/core_ext/object.rb
72
+ - lib/commander/help_formatters/base.rb
73
+ - lib/commander/help_formatters/terminal.rb
74
+ - lib/commander/help_formatters/terminal_compact.rb
75
+ - lib/commander/help_formatters/terminal
76
+ - lib/commander/help_formatters/terminal_compact
77
+ - lib/commander/help_formatters/terminal/command_help.erb
78
+ - lib/commander/help_formatters/terminal/help.erb
79
+ - lib/commander/help_formatters/terminal_compact/command_help.erb
80
+ - lib/commander/help_formatters/terminal_compact/help.erb
81
+ - Manifest
82
+ - Rakefile
83
+ - README.rdoc
84
+ - spec/command_spec.rb
85
+ - spec/core_ext/array_spec.rb
86
+ - spec/core_ext/object_spec.rb
87
+ - spec/help_formatters/base_spec.rb
88
+ - spec/help_formatters/terminal_spec.rb
89
+ - spec/runner_spec.rb
90
+ - spec/spec_helper.rb
91
+ - spec/ui_spec.rb
92
+ - tasks/docs.rake
93
+ - tasks/gemspec.rake
94
+ - tasks/spec.rake
95
+ has_rdoc: false
96
+ homepage: http://visionmedia.github.com/commander
97
+ post_install_message:
98
+ rdoc_options:
99
+ - --line-numbers
100
+ - --inline-source
101
+ - --title
102
+ - Commander
103
+ - --main
104
+ - README.rdoc
105
+ require_paths:
106
+ - lib
107
+ required_ruby_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: "0"
112
+ version:
113
+ required_rubygems_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: "1.2"
118
+ version:
119
+ requirements: []
120
+
121
+ rubyforge_project: commander
122
+ rubygems_version: 1.2.0
123
+ signing_key:
124
+ specification_version: 3
125
+ summary: The complete solution for Ruby command-line executables
126
+ test_files: []
127
+