crishoj-commander 3.3.0

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
data/spec/ui_spec.rb ADDED
@@ -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
data/tasks/docs.rake ADDED
@@ -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]
data/tasks/spec.rake ADDED
@@ -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,121 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: crishoj-commander
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.3.0
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/blank.rb
59
+ - lib/commander/command.rb
60
+ - lib/commander/core_ext/array.rb
61
+ - lib/commander/core_ext/object.rb
62
+ - lib/commander/core_ext.rb
63
+ - lib/commander/help_formatters/base.rb
64
+ - lib/commander/help_formatters/terminal/command_help.erb
65
+ - lib/commander/help_formatters/terminal/help.erb
66
+ - lib/commander/help_formatters/terminal.rb
67
+ - lib/commander/help_formatters/terminal_compact/command_help.erb
68
+ - lib/commander/help_formatters/terminal_compact/help.erb
69
+ - lib/commander/help_formatters/terminal_compact.rb
70
+ - lib/commander/help_formatters.rb
71
+ - lib/commander/runner.rb
72
+ - lib/commander/user_interaction.rb
73
+ - lib/commander/version.rb
74
+ - lib/commander.rb
75
+ - Manifest
76
+ - Rakefile
77
+ - README.rdoc
78
+ - spec/command_spec.rb
79
+ - spec/core_ext/array_spec.rb
80
+ - spec/core_ext/object_spec.rb
81
+ - spec/help_formatters/base_spec.rb
82
+ - spec/help_formatters/terminal_spec.rb
83
+ - spec/runner_spec.rb
84
+ - spec/spec_helper.rb
85
+ - spec/ui_spec.rb
86
+ - tasks/docs.rake
87
+ - tasks/gemspec.rake
88
+ - tasks/spec.rake
89
+ has_rdoc: false
90
+ homepage: http://visionmedia.github.com/commander
91
+ post_install_message:
92
+ rdoc_options:
93
+ - --line-numbers
94
+ - --inline-source
95
+ - --title
96
+ - Commander
97
+ - --main
98
+ - README.rdoc
99
+ require_paths:
100
+ - lib
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: "0"
106
+ version:
107
+ required_rubygems_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: "1.2"
112
+ version:
113
+ requirements: []
114
+
115
+ rubyforge_project: commander
116
+ rubygems_version: 1.2.0
117
+ signing_key:
118
+ specification_version: 3
119
+ summary: The complete solution for Ruby command-line executables
120
+ test_files: []
121
+