frontkick 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f76198405d6525369aa2223db8121819a4f29441
4
+ data.tar.gz: 5595af1cdcf7d519531b2d7d16e08962d527ebb7
5
+ SHA512:
6
+ metadata.gz: 6bb73fb14d7d3277b7355687d5ded5d892e5e6d6f2db4f85e647353acde583987634e3ba387e93cba2cbbdcdc7e9cf276cc9fc57e40609fc4975398b8c973c29
7
+ data.tar.gz: d79066eba2c55dd71e31a8347d5c641338847c2db47025d3a1e0069032ab0979321a4bc38ee82f61a631181d1246f5b35f6d7a9692249714e70707cc27261f66
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /*.gem
2
+ ~*
3
+ #*
4
+ *~
5
+ .bundle
6
+ Gemfile.lock
7
+ .rbenv-version
8
+ .ruby-version
9
+ vendor
10
+ doc/*
11
+ tmp/*
12
+ .yardoc
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --colour
2
+ --format documentation
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ rvm:
2
+ # - 1.8.7
3
+ - 1.9.2
4
+ - 1.9.3
5
+ - 2.0.0
6
+ gemfile:
7
+ - Gemfile
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ # 0.0.1 (2013/06/23)
2
+
3
+ First Version
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+ source 'https://rubygems.org'
3
+
4
+ gemspec
5
+ gem 'frontkick', path: '.'
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Naotoshi SEO
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # frontkick [![Build Status](https://secure.travis-ci.org/sonots/frontkick.png?branch=master)](http://travis-ci.org/sonots/frontkick) [![Dependency Status](https://gemnasium.com/sonots/frontkick.png)](https://gemnasium.com/sonots/frontkick)
2
+
3
+ testing ruby: 1.9.2, 1.9.3, 2.0.0;
4
+
5
+ ## About OnePuch
6
+
7
+ frontkick is a wrapper of Open3#popen3 to execute a command easily
8
+
9
+ ## USAGE
10
+
11
+ gem install frontkick
12
+
13
+ ## Contributing
14
+
15
+ 1. Fork it
16
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
17
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
18
+ 4. Push to the branch (`git push origin my-new-feature`)
19
+ 5. Create new [Pull Request](../../pull/new/master)
20
+
21
+ ## Copyright
22
+
23
+ Copyright (c) 2013 Naotoshi SEO. See [LICENSE](LICENSE) for details.
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ # encoding: utf-8
2
+ require "bundler/gem_tasks"
3
+
4
+ require 'rspec/core'
5
+ require 'rspec/core/rake_task'
6
+ RSpec::Core::RakeTask.new(:spec) do |spec|
7
+ spec.pattern = FileList['spec/**/*_spec.rb']
8
+ end
9
+ task :default => :spec
10
+
11
+ desc 'Open an irb session preloaded with the gem library'
12
+ task :console do
13
+ sh 'irb -rubygems -I lib -r frontkick.rb'
14
+ end
15
+ task :c => :console
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
data/frontkick.gemspec ADDED
@@ -0,0 +1,24 @@
1
+ #! /usr/bin/env gem build
2
+ # encoding: utf-8
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.name = 'frontkick'
6
+ gem.version = File.read(File.expand_path('VERSION', File.dirname(__FILE__))).chomp
7
+ gem.authors = ["Naotoshi Seo"]
8
+ gem.email = ["sonots@gmail.com"]
9
+ gem.homepage = "https://github.com/sonots/frontkick"
10
+ gem.summary = "A wrapper of Open3#popen3 to execute a command easily"
11
+ gem.description = gem.summary
12
+
13
+ gem.files = `git ls-files`.split($\)
14
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
15
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
16
+ gem.require_paths = ["lib"]
17
+
18
+ # for testing
19
+ gem.add_development_dependency "rake"
20
+ gem.add_development_dependency "rspec"
21
+
22
+ # for debug
23
+ gem.add_development_dependency "pry"
24
+ end
@@ -0,0 +1,22 @@
1
+ require 'benchmark'
2
+ require 'open3'
3
+
4
+ module FrontKick
5
+ class Command
6
+ def self.exec(*cmd)
7
+ stdout = nil
8
+ stderr = nil
9
+ exit_code = nil
10
+
11
+ duration = Benchmark.realtime do
12
+ Open3.popen3(*cmd) do |stdin, out, err, wait_thr|
13
+ stdout = out.read
14
+ stderr = err.read
15
+ exit_code = wait_thr.value.exitstatus
16
+ end
17
+ end
18
+
19
+ CommandResult.new(stdout, stderr, exit_code, duration)
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,24 @@
1
+ module FrontKick
2
+ class CommandResult
3
+ attr_accessor :stdout, :stderr, :duration
4
+
5
+ def initialize(stdout, stderr, exit_code, duration)
6
+ @stdout = stdout
7
+ @stderr = stderr
8
+ @exit_code = exit_code
9
+ @duration = duration
10
+ end
11
+
12
+ def output
13
+ @stdout
14
+ end
15
+
16
+ def errors
17
+ @stderr
18
+ end
19
+
20
+ def successful?
21
+ @exit_code == 0
22
+ end
23
+ end
24
+ end
data/lib/frontkick.rb ADDED
@@ -0,0 +1,3 @@
1
+ require 'rubygems'
2
+ require 'frontkick/command'
3
+ require 'frontkick/command_result'
@@ -0,0 +1,11 @@
1
+ # encoding: utf-8
2
+ require "bundler/setup"
3
+ require "pry"
4
+
5
+ ROOT = File.dirname(__FILE__)
6
+ Dir[File.expand_path("support/**/*.rb", ROOT)].each {|f| require f }
7
+
8
+ RSpec.configure do |config|
9
+ config.treat_symbols_as_metadata_keys_with_true_values = true
10
+ config.run_all_when_everything_filtered = true
11
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: frontkick
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Naotoshi Seo
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-06-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: A wrapper of Open3#popen3 to execute a command easily
56
+ email:
57
+ - sonots@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .gitignore
63
+ - .rspec
64
+ - .travis.yml
65
+ - CHANGELOG.md
66
+ - Gemfile
67
+ - LICENSE
68
+ - README.md
69
+ - Rakefile
70
+ - VERSION
71
+ - frontkick.gemspec
72
+ - lib/frontkick.rb
73
+ - lib/frontkick/command.rb
74
+ - lib/frontkick/command_result.rb
75
+ - spec/spec_helper.rb
76
+ homepage: https://github.com/sonots/frontkick
77
+ licenses: []
78
+ metadata: {}
79
+ post_install_message:
80
+ rdoc_options: []
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - '>='
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ requirements: []
94
+ rubyforge_project:
95
+ rubygems_version: 2.0.0
96
+ signing_key:
97
+ specification_version: 4
98
+ summary: A wrapper of Open3#popen3 to execute a command easily
99
+ test_files:
100
+ - spec/spec_helper.rb