cocaine 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ *.rbc
2
+ *.gem
3
+ Gemfile.lock
@@ -0,0 +1,8 @@
1
+ rvm:
2
+ - 1.8.7
3
+ - 1.9.2
4
+ - 1.9.3
5
+ - rbx
6
+ - rbx-2.0
7
+ - ree
8
+ - jruby
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec
data/README.md CHANGED
@@ -13,22 +13,22 @@ Question? Idea? Problem? Bug? Something else? Comment? Concern? Like use questio
13
13
  The basic, normal stuff.
14
14
 
15
15
  ```ruby
16
- line = Cocaine::CommandLine.run("command", "some 'crazy' options")
16
+ line = Cocaine::CommandLine.new("command", "some 'crazy' options")
17
17
  line.command # => "command some 'crazy' options"
18
18
  output = line.run # => Get you some output!
19
19
  ```
20
20
 
21
- Allowing arguments to be dynamic.
21
+ Allowing arguments to be dynamic:
22
22
 
23
23
  ```ruby
24
24
  line = Cocaine::CommandLine.new("convert", ":in -scale :resolution :out",
25
25
  :in => "omg.jpg",
26
26
  :resolution => "32x32",
27
- :out => omg_thumb.jpg")
27
+ :out => "omg_thumb.jpg")
28
28
  line.command # => "convert 'omg.jpg' -scale '32x32' 'omg_thumb.jpg'"
29
29
  ```
30
30
 
31
- It prevents attempts at being bad.
31
+ It prevents attempts at being bad:
32
32
 
33
33
  ```ruby
34
34
  line = Cocaine::CommandLine.new("cat", ":file", :file => "haha`rm -rf /`.txt")
@@ -38,7 +38,7 @@ line = Cocaine::CommandLine.new("cat", ":file", :file => "ohyeah?'`rm -rf /`.ha!
38
38
  line.command # => "cat 'ohyeah?'\\''`rm -rf /`.ha!'"
39
39
  ```
40
40
 
41
- You can ignore the result.
41
+ You can ignore the result:
42
42
 
43
43
  ```ruby
44
44
  line = Cocaine::CommandLine.new("noisy", "--extra-verbose", :swallow_stderr => true)
@@ -48,7 +48,7 @@ line.command # => "noisy --extra-verbose 2>/dev/null"
48
48
  line.command # => "noisy --extra-verbose 2>NUL"
49
49
  ```
50
50
 
51
- If your command errors, you get an exception.
51
+ If your command errors, you get an exception:
52
52
 
53
53
  ```ruby
54
54
  line = Cocaine::CommandLine.new("git", "commit")
@@ -59,7 +59,7 @@ rescue Cocaine::ExitStatusError => e
59
59
  end
60
60
  ```
61
61
 
62
- You don't have the command? You get an exception.
62
+ You don't have the command? You get an exception:
63
63
 
64
64
  ```ruby
65
65
  line = Cocaine::CommandLine.new("lolwut")
@@ -70,7 +70,7 @@ rescue Cocaine::CommandNotFoundError => e
70
70
  end
71
71
  ```
72
72
 
73
- But don't fear, you can specify where to look for the command.
73
+ But don't fear, you can specify where to look for the command:
74
74
 
75
75
  ```ruby
76
76
  Cocaine::CommandLine.path = "/opt/bin"
@@ -78,24 +78,24 @@ line = Cocaine::CommandLine.new("lolwut")
78
78
  line.command # => "lolwut", but it looks in /opt/bin for it.
79
79
  ```
80
80
 
81
- You can even give it a bunch of places to look.
81
+ You can even give it a bunch of places to look:
82
82
 
83
83
  ```ruby
84
- FileUtils.rm("/opt/bin/lolwut")
85
- `echo 'echo Hello' > /usr/local/bin/lolwut`
86
- Cocaine::CommandLine.path = ["/opt/bin", "/usr/local/bin"]
87
- line = Cocaine::CommandLine.new("lolwut")
88
- line.run # => prints 'Hello', because it searches the path
84
+ FileUtils.rm("/opt/bin/lolwut")
85
+ `echo 'echo Hello' > /usr/local/bin/lolwut`
86
+ Cocaine::CommandLine.path = ["/opt/bin", "/usr/local/bin"]
87
+ line = Cocaine::CommandLine.new("lolwut")
88
+ line.run # => prints 'Hello', because it searches the path
89
89
  ```
90
90
 
91
- Or, just, you know, put it in the command.
91
+ Or just put it in the command:
92
92
 
93
93
  ```ruby
94
94
  line = Cocaine::CommandLine.new("/opt/bin/lolwut")
95
95
  line.command # => "/opt/bin/lolwut"
96
96
  ```
97
97
 
98
- If your command might return something non-zero, and you expect that, it's cool.
98
+ If your command might return something non-zero, and you expect that, it's cool:
99
99
 
100
100
  ```ruby
101
101
  line = Cocaine::CommandLine.new("/usr/bin/false", "", :expected_outcodes => [0, 1])
data/Rakefile CHANGED
@@ -1,6 +1,5 @@
1
- require 'rubygems'
2
1
  require 'bundler/setup'
3
- require 'rake'
2
+ require 'bundler/gem_tasks'
4
3
  require 'rspec/core/rake_task'
5
4
 
6
5
  desc 'Default: Run specs.'
@@ -12,4 +11,3 @@ namespace :spec do
12
11
  t.pattern = 'spec/cocaine/**/*_spec.rb'
13
12
  end
14
13
  end
15
-
@@ -0,0 +1,24 @@
1
+ $LOAD_PATH.push File.expand_path("../lib", __FILE__)
2
+ require 'cocaine/version'
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "cocaine"
6
+ s.version = Cocaine::VERSION.dup
7
+ s.platform = Gem::Platform::RUBY
8
+ s.author = "Jon Yurek"
9
+ s.email = "jyurek@thoughtbot.com"
10
+ s.homepage = "http://www.thoughtbot.com/projects/cocaine"
11
+ s.summary = "A small library for doing (command) lines"
12
+ s.description = "A small library for doing (command) lines"
13
+
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ s.require_paths = ["lib"]
18
+
19
+ s.add_development_dependency('rspec')
20
+ s.add_development_dependency('bourne')
21
+ s.add_development_dependency('mocha')
22
+ s.add_development_dependency('rake')
23
+ end
24
+
@@ -91,7 +91,7 @@ module Cocaine
91
91
  end
92
92
 
93
93
  def self.unix?
94
- (Config::CONFIG['host_os'] =~ /mswin|mingw/).nil?
94
+ (RbConfig::CONFIG['host_os'] =~ /mswin|mingw/).nil?
95
95
  end
96
96
  end
97
97
  end
@@ -1,3 +1,3 @@
1
1
  module Cocaine
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1".freeze
3
3
  end
@@ -9,6 +9,6 @@ module StubOS
9
9
 
10
10
  def stub_os(host_string)
11
11
  # http://blog.emptyway.com/2009/11/03/proper-way-to-detect-windows-platform-in-ruby/
12
- Config::CONFIG.stubs(:[]).with('host_os').returns(host_string)
12
+ RbConfig::CONFIG.stubs(:[]).with('host_os').returns(host_string)
13
13
  end
14
14
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocaine
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 0
10
- version: 0.2.0
9
+ - 1
10
+ version: 0.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jon Yurek
@@ -15,8 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-17 00:00:00 -04:00
19
- default_executable:
18
+ date: 2011-12-13 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: rspec
@@ -60,6 +59,20 @@ dependencies:
60
59
  version: "0"
61
60
  type: :development
62
61
  version_requirements: *id003
62
+ - !ruby/object:Gem::Dependency
63
+ name: rake
64
+ prerelease: false
65
+ requirement: &id004 !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ hash: 3
71
+ segments:
72
+ - 0
73
+ version: "0"
74
+ type: :development
75
+ version_requirements: *id004
63
76
  description: A small library for doing (command) lines
64
77
  email: jyurek@thoughtbot.com
65
78
  executables: []
@@ -69,18 +82,21 @@ extensions: []
69
82
  extra_rdoc_files: []
70
83
 
71
84
  files:
72
- - README.md
85
+ - .gitignore
86
+ - .travis.yml
87
+ - Gemfile
73
88
  - LICENSE
89
+ - README.md
74
90
  - Rakefile
91
+ - cocaine.gemspec
92
+ - lib/cocaine.rb
75
93
  - lib/cocaine/command_line.rb
76
94
  - lib/cocaine/exceptions.rb
77
95
  - lib/cocaine/version.rb
78
- - lib/cocaine.rb
79
96
  - spec/cocaine/command_line_spec.rb
80
97
  - spec/spec_helper.rb
81
98
  - spec/support/stub_os.rb
82
99
  - spec/support/with_exitstatus.rb
83
- has_rdoc: true
84
100
  homepage: http://www.thoughtbot.com/projects/cocaine
85
101
  licenses: []
86
102
 
@@ -110,9 +126,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
126
  requirements: []
111
127
 
112
128
  rubyforge_project:
113
- rubygems_version: 1.6.2
129
+ rubygems_version: 1.8.6
114
130
  signing_key:
115
131
  specification_version: 3
116
132
  summary: A small library for doing (command) lines
117
133
  test_files:
118
134
  - spec/cocaine/command_line_spec.rb
135
+ - spec/spec_helper.rb
136
+ - spec/support/stub_os.rb
137
+ - spec/support/with_exitstatus.rb