rprogram 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,52 @@
1
+ require 'rprogram/program'
2
+
3
+ require 'spec_helper'
4
+ require 'classes/ls_program'
5
+
6
+ describe Program do
7
+ it "should create a Program from a path" do
8
+ prog = Program.new('/usr/bin/ruby')
9
+
10
+ prog.should_not be_nil
11
+ end
12
+
13
+ it "should derive the program name from a path" do
14
+ prog = Program.new('/usr/bin/ruby')
15
+
16
+ prog.name.should == 'ruby'
17
+ end
18
+
19
+ it "should return the program path when converted to a String" do
20
+ prog = Program.new('/usr/bin/ruby')
21
+
22
+ prog.to_s.should == '/usr/bin/ruby'
23
+ end
24
+
25
+ it "should raise an exception for invalid paths" do
26
+ lambda {
27
+ Program.new('/totally/doesnt/exist')
28
+ }.should raise_error(ProgramNotFound)
29
+ end
30
+
31
+ it "should find a program from a path" do
32
+ prog = Program.find_with_path('/usr/bin/dir')
33
+
34
+ prog.should_not be_nil
35
+ end
36
+
37
+ it "should find a program from given paths" do
38
+ prog = Program.find_with_paths(['/usr/bin/ls','/bin/ls'])
39
+
40
+ prog.should_not be_nil
41
+ end
42
+
43
+ it "should be able to find a program based on the program names" do
44
+ ls = nil
45
+
46
+ lambda {
47
+ ls = LS.find
48
+ }.should_not raise_error(ProgramNotFound)
49
+
50
+ File.executable?(ls.path).should == true
51
+ end
52
+ end
@@ -0,0 +1,18 @@
1
+ require 'rprogram/version'
2
+ require 'rprogram/rprogram'
3
+
4
+ require 'spec_helper'
5
+
6
+ describe RProgram do
7
+ it "should have a VERSION constant" do
8
+ RProgram.const_defined?('VERSION').should == true
9
+ end
10
+
11
+ it "should have a debug mode" do
12
+ RProgram.debug = true
13
+ RProgram.debug.should == true
14
+
15
+ RProgram.debug = false
16
+ RProgram.debug.should == false
17
+ end
18
+ end
@@ -0,0 +1,7 @@
1
+ require 'rubygems'
2
+ gem 'rspec', '>=1.1.3'
3
+ require 'spec'
4
+
5
+ require 'rprogram/version'
6
+
7
+ include RProgram
@@ -0,0 +1,85 @@
1
+ require 'rprogram/task'
2
+
3
+ require 'spec_helper'
4
+ require 'classes/ls_task'
5
+ require 'classes/ls_selinux_task'
6
+
7
+ describe Task do
8
+ describe "flag_namify" do
9
+ it "should downcase all characters" do
10
+ Task.flag_namify('-SHORT-option').should == 'short_option'
11
+ end
12
+
13
+ it "should replace dashes with underscores" do
14
+ Task.flag_namify('-short-option').should == 'short_option'
15
+ end
16
+
17
+ it "should replace dots with underscores" do
18
+ Task.flag_namify('-short.option').should == 'short_option'
19
+ end
20
+
21
+ it "should replace spaces with underscores" do
22
+ Task.flag_namify('-short option').should == 'short_option'
23
+ end
24
+
25
+ it "should replace multiple underscores with one underscore" do
26
+ Task.flag_namify('-short__option').should == 'short_option'
27
+ end
28
+
29
+ it "should namify short options" do
30
+ Task.flag_namify('-short-option').should == 'short_option'
31
+ end
32
+
33
+ it "should namify long options" do
34
+ Task.flag_namify('--long-option').should == 'long_option'
35
+ end
36
+ end
37
+
38
+ before(:each) do
39
+ @task = LSTask.new
40
+ end
41
+
42
+ it "should have no arguments by default" do
43
+ @task.arguments.should be_empty
44
+ end
45
+
46
+ it "should define reader and writter methods for options" do
47
+ @task.all.should be_nil
48
+
49
+ @task.all = true
50
+ @task.all.should == true
51
+ end
52
+
53
+ it "should default the value of multi-options to an empty Array" do
54
+ @task.hide.should be_empty
55
+ end
56
+
57
+ it "should define reader and writter methods for non-options" do
58
+ @task.files.should be_empty
59
+
60
+ @task.files << 'file.txt'
61
+ @task.files.should == ['file.txt']
62
+ end
63
+
64
+ it "should provide access to the defined options" do
65
+ LSTask.options.should_not be_empty
66
+ end
67
+
68
+ it "should provide access to the defined non-options" do
69
+ LSTask.non_options.should_not be_empty
70
+ end
71
+
72
+ it "should default the name of long options to the flag" do
73
+ LSTask.options[:author].flag.should == '--author'
74
+ end
75
+
76
+ it "should allow the name of long options to be overridden" do
77
+ LSTask.options[:group_dirs_first].flag.should == '--group-directories-first'
78
+ end
79
+
80
+ it "should allow options to be inherited" do
81
+ LSTask.has_option?(:security_context).should == false
82
+ LSSELinuxTask.has_option?(:all).should == true
83
+ LSSELinuxTask.has_option?(:security_context).should == true
84
+ end
85
+ end
metadata CHANGED
@@ -1,15 +1,36 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rprogram
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Postmodern
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain: []
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDQDCCAiigAwIBAgIBADANBgkqhkiG9w0BAQUFADBGMRgwFgYDVQQDDA9wb3N0
14
+ bW9kZXJuLm1vZDMxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixk
15
+ ARkWA2NvbTAeFw0wOTA2MDMwNDU5MDNaFw0xMDA2MDMwNDU5MDNaMEYxGDAWBgNV
16
+ BAMMD3Bvc3Rtb2Rlcm4ubW9kMzEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYK
17
+ CZImiZPyLGQBGRYDY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
18
+ 1wvANkTDHFgVih5XLjuTwTZjgBq1lBGybXJiH6Id1lY2JOMqM5FB1DDHVvvij94i
19
+ mJabN0zkzu6VKWC70y0IwOxY7CPokr0eFdK/D0y7mCq1P8QITv76i2YqAl0eYqIt
20
+ W+IhIkANQ7E6uMZIZcdnfadC6lPAtlKkqtd9crvRbFgr6e3kyflmohbRnTEJHoRd
21
+ 7SHHsybE6DSn7oTDs6XBTNrNIn5VfZA0z01eeos/+zBm1zKJOK2+/7xtLLDuDU9G
22
+ +Rd+ltUBbvxUrMNZmDG29pnmN2xTRH+Q8HxD2AxlvM5SRpK6OeZaHV7PaCCAVZ4L
23
+ T9BFl1sfMvRlABeGEkSyuQIDAQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIE
24
+ sDAdBgNVHQ4EFgQUKwsd+PqEYmBvyaTyoL+uRuk+PhEwDQYJKoZIhvcNAQEFBQAD
25
+ ggEBAB4TvHsrlbcXcKg6gX5BIb9tI+zGkpzo0Z7jnxMEcNO7NGGwmzafDBI/xZYv
26
+ xkRH3/HXbGGYDOi6Q6gWt5GujSx0bOImDtYTJTH8jnzN92HzEK5WdScm1QpZKF1e
27
+ cezArMbxbSPaosxTCtG6LQTkE28lFQsmFZ5xzouugS4h5+LVJiVMmiP+l3EfkjFa
28
+ GOURU+rNEMPWo8MCWivGW7jes6BMzWHcW7DQ0scNVmIcCIgdyMmpscuAEOSeghy9
29
+ /fFs57Ey2OXBL55nDOyvN/ZQ2Vab05UH4t+GCxjAPeirzL/29FBtePT6VD44c38j
30
+ pDj+ws7QjtH/Qcrr1l9jfN0ehDs=
31
+ -----END CERTIFICATE-----
11
32
 
12
- date: 2009-01-14 00:00:00 -08:00
33
+ date: 2009-06-30 00:00:00 -07:00
13
34
  default_executable:
14
35
  dependencies:
15
36
  - !ruby/object:Gem::Dependency
@@ -20,9 +41,13 @@ dependencies:
20
41
  requirements:
21
42
  - - ">="
22
43
  - !ruby/object:Gem::Version
23
- version: 1.8.2
44
+ version: 2.2.0
24
45
  version:
25
- description: RProgram is a library for creating wrappers around command-line programs. RProgram provides a Rubyful interface to programs and all their options or non-options. RProgram can also search for programs installed on a system.
46
+ description: |-
47
+ RProgram is a library for creating wrappers around command-line programs.
48
+ RProgram provides a Rubyful interface to programs and all their options
49
+ or non-options. RProgram can also search for programs installed on a
50
+ system.
26
51
  email:
27
52
  - postmodern.mod3@gmail.com
28
53
  executables: []
@@ -32,21 +57,20 @@ extensions: []
32
57
  extra_rdoc_files:
33
58
  - History.txt
34
59
  - Manifest.txt
60
+ - LICENSE.txt
35
61
  - README.txt
36
62
  files:
37
63
  - History.txt
38
64
  - Manifest.txt
65
+ - LICENSE.txt
39
66
  - README.txt
40
67
  - Rakefile
41
68
  - lib/rprogram.rb
42
- - lib/rprogram/version.rb
43
69
  - lib/rprogram/compat.rb
44
70
  - lib/rprogram/exceptions/program_not_found.rb
45
71
  - lib/rprogram/exceptions.rb
46
72
  - lib/rprogram/extensions/meta/object.rb
47
73
  - lib/rprogram/extensions/meta.rb
48
- - lib/rprogram/extensions/array.rb
49
- - lib/rprogram/extensions/hash.rb
50
74
  - lib/rprogram/extensions.rb
51
75
  - lib/rprogram/option_list.rb
52
76
  - lib/rprogram/option.rb
@@ -56,9 +80,26 @@ files:
56
80
  - lib/rprogram/nameable.rb
57
81
  - lib/rprogram/program.rb
58
82
  - lib/rprogram/rprogram.rb
59
- - test/test_rprogram.rb
83
+ - lib/rprogram/version.rb
84
+ - spec/spec_helper.rb
85
+ - spec/classes/named_program.rb
86
+ - spec/classes/aliased_program.rb
87
+ - spec/classes/ls_program.rb
88
+ - spec/classes/ls_task.rb
89
+ - spec/classes/ls_selinux_task.rb
90
+ - spec/rprogram_spec.rb
91
+ - spec/compat_spec.rb
92
+ - spec/option_examples.rb
93
+ - spec/option_spec.rb
94
+ - spec/non_option_spec.rb
95
+ - spec/option_list_spec.rb
96
+ - spec/nameable_spec.rb
97
+ - spec/program_spec.rb
98
+ - spec/task_spec.rb
60
99
  has_rdoc: true
61
100
  homepage: http://rprogram.rubyforge.org/
101
+ licenses: []
102
+
62
103
  post_install_message:
63
104
  rdoc_options:
64
105
  - --main
@@ -80,9 +121,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
121
  requirements: []
81
122
 
82
123
  rubyforge_project: rprogram
83
- rubygems_version: 1.3.1
124
+ rubygems_version: 1.3.4
84
125
  signing_key:
85
- specification_version: 2
126
+ specification_version: 3
86
127
  summary: RProgram is a library for creating wrappers around command-line programs
87
- test_files:
88
- - test/test_rprogram.rb
128
+ test_files: []
129
+
Binary file
@@ -1,7 +0,0 @@
1
- class Array
2
-
3
- def arguments
4
- compact
5
- end
6
-
7
- end
@@ -1,15 +0,0 @@
1
- class Hash
2
-
3
- def arguments
4
- map { |key,value|
5
- if value
6
- if value==true
7
- key.to_s
8
- else
9
- "#{key}=#{value}"
10
- end
11
- end
12
- }.compact
13
- end
14
-
15
- end
File without changes