shelltastic 0.5.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 89419f6c9c35e7a71c2e181f12baa3999c7722e93908952008730c106ede5ca6
4
- data.tar.gz: e1a6101fb87f0f06f1d09d605d9554342f081a57c186ef6432a1a042f748e054
3
+ metadata.gz: 20dc0136766aee9463af6c60624299cf3501267df0eb529b4b0f609434aeb9a2
4
+ data.tar.gz: b1daff36ac9f708334715dad20aab079ed2ca43bea163c820373639342cf1142
5
5
  SHA512:
6
- metadata.gz: 1398fe39bca978e54368015448baa52ae6807d68533142180a07021a40ed3f67ee1a42694dd4e32a0741b903ba85dcd4b90af661fa6efb2006fd07228bd83e8c
7
- data.tar.gz: 8356a89b04eb97814b99711b13fb2b802c64e2af205cdccf5cbb820e464b03ec1f6a803598823e402fa51dfe1253b7f39df7e5b90c6c1f986602bc4a885f7085
6
+ metadata.gz: fbb7ebf36c4682cb9062ed86a04a033bc7d46a2ed87382ac9d3999573539228c5f5159327601731114423e0d5abeb0cdb24a54e725ada965372036a845ee2348
7
+ data.tar.gz: 307c95d92238bb2776dec664b4a6be2335541787d172cfa63334fe18181f3cb3a0291234d4d562766825586b33540160390cc79e504ac9069c7932746f785ee4
@@ -0,0 +1,38 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ "main" ]
13
+ pull_request:
14
+ branches: [ "main" ]
15
+
16
+ permissions:
17
+ contents: read
18
+
19
+ jobs:
20
+ test:
21
+
22
+ runs-on: ubuntu-latest
23
+ strategy:
24
+ matrix:
25
+ ruby-version: ['2.6', '2.7', '3.0']
26
+
27
+ steps:
28
+ - uses: actions/checkout@v3
29
+ - name: Set up Ruby
30
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
31
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
32
+ # uses: ruby/setup-ruby@v1
33
+ uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
34
+ with:
35
+ ruby-version: ${{ matrix.ruby-version }}
36
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
37
+ - name: Run tests
38
+ run: bundle exec rake
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ .tool-versions
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.0
4
+ * Added `start` command to run commands in the background. Bump Version 0.5.0
5
+
3
6
  ## 0.4.0
4
7
  * `:error` returns false now if there is not an error--instead of empty string
5
8
 
data/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Shelltastic
2
2
  Shelltastic is simple *nix shell wrapper for ruby. You can pass a single command or multiple commands to run.
3
3
 
4
+ [![Gem Version](https://badge.fury.io/rb/shelltastic.svg)](https://badge.fury.io/rb/shelltastic)
5
+
6
+
4
7
  ## Installation
5
8
 
6
9
  Add this line to your application's Gemfile:
@@ -91,7 +94,7 @@ The parent process (you) will not wait for the child to finish or return any inf
91
94
 
92
95
  This is useful if you want to run a command, but dont care about the output or exit status.
93
96
 
94
- __BEWARE__ of long running commands that could fail. ShellTastic detaches itself from the child command.
97
+ __BEWARE__ of long running commands that could fail. ShellTastic detaches itself from the child command.
95
98
 
96
99
 
97
100
 
@@ -70,7 +70,6 @@ module ShellTastic
70
70
  Process.detach(pid) if pid
71
71
  end
72
72
  end
73
-
74
73
  end
75
74
  end
76
75
  end
@@ -1,3 +1,3 @@
1
1
  module ShellTastic
2
- VERSION = "0.5.0"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -7,20 +7,20 @@ describe ShellTastic::OutputFormatter do
7
7
  pid: "10000000",
8
8
  error: "No such file or directory")
9
9
  end
10
- it "should return a hash" do
11
- @result.inspect.should be_kind_of(Hash)
10
+ it "returns a hash" do
11
+ expect(@result.inspect).to be_kind_of(Hash)
12
12
  end
13
13
 
14
- it "should allow to add key value pairs" do
14
+ it "allows to add key value pairs" do
15
15
  @result.command = "date"
16
- @result.inspect[:command].should eq("date")
16
+ expect(@result.inspect[:command]).to eq("date")
17
17
  end
18
18
 
19
- it "should have total time" do
19
+ it "contains total time" do
20
20
  timer = ShellTastic::Timer.new
21
21
  @result.start = timer.start
22
22
  @result.stop = timer.stop
23
23
  @result.total_time = timer.total_time
24
- @result.total_time.should_not be_nil
24
+ expect(@result.total_time).to_not be_nil
25
25
  end
26
26
  end
@@ -1,65 +1,64 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe ShellTastic do
4
- it "should run a shell command" do
4
+ it "runs a shell command"do
5
5
  result = ShellTastic::Command.run("ls -l").first
6
- result.fetch(:exitstatus).should eq(0)
6
+ expect(result.fetch(:exitstatus)).to eq(0)
7
7
  end
8
8
 
9
- it "should run multiple commands" do
9
+ it "runs multiple commands"do
10
10
  result = ShellTastic::Command.run("ls -l", "date")
11
- result.size.should eq(2)
11
+ expect(result.size).to eq(2)
12
12
  end
13
13
 
14
- it "should run take an array of commands to run" do
14
+ it "takes an array of commands to run"do
15
15
  result = ShellTastic::Command.run(["ls -l", "date"])
16
- result.size.should eq(2)
16
+ expect(result.size).to eq(2)
17
17
  end
18
18
 
19
19
 
20
- it "should raise a command exception" do
20
+ it "raises a command exception"do
21
21
  expect {
22
- result = ShellTastic::Command.run("lss -l")
22
+ result = ShellTastic::Command.run("lss -l")
23
23
  }.to raise_error(ShellTastic::CommandException)
24
24
  end
25
25
 
26
- it "should alert if command is empty or nil" do
26
+ it "alerts if command is empty or nil"do
27
27
  expect {
28
28
  ShellTastic::Command.run("")
29
29
  }.to raise_error(ShellTastic::CommandException)
30
30
  end
31
31
 
32
- it "should return `false` for error if there is not any errors" do
32
+ it "returns `false` for error if there is not any errors"do
33
33
  result = ShellTastic::Command.run("date").first
34
- result[:error].should eq(false)
34
+ expect(result[:error]).to eq(false)
35
35
  end
36
36
 
37
- it "should return error" do
38
- result = ShellTastic::Command.run("du -sh /tmp/foos").first
39
- result[:error].should_not eq(false)
37
+ it "returns an error and exit status"do
38
+ result = ShellTastic::Command.run("du -sh /tmp/inotexist").first
39
+ expect(result[:error]).not_to be_nil
40
+ expect(result[:exitstatus]).to eq(1)
40
41
  end
41
42
 
42
43
  # fire and forget
43
- it "should fire a command in the background and have a pid" do
44
+ it "fires a command in the background and has a pid"do
44
45
  result = ShellTastic::Command.start("ls -al /").first
45
- result[:pid].should_not be_nil
46
+ expect(result[:pid]).not_to be_nil
46
47
  end
47
48
 
48
- it "should fire a command in the background and have a command" do
49
+ it "fires a command in the background and has a command populated"do
49
50
  result = ShellTastic::Command.start("ls -al /").first
50
- result[:command].should eq("ls -al /")
51
+ expect(result[:command]).to eq("ls -al /")
51
52
  end
52
53
 
53
- it "should fire a command in the background and have no ouput" do
54
+ it "fires a command in the background and has no ouput"do
54
55
  result = ShellTastic::Command.start("ls -al /").first
55
- result[:output].should be_nil
56
+ expect(result[:output]).to be_nil
56
57
  end
57
58
 
58
- it "should fire a command in the background and not raise an error" do
59
+ it "fires a command in the background and raises an error"do
59
60
  expect {
60
61
  ShellTastic::Command.start("foobar").first
61
62
  }.to raise_error(ShellTastic::CommandException)
62
63
  end
63
-
64
-
65
64
  end
data/spec/spec_helper.rb CHANGED
@@ -7,7 +7,6 @@
7
7
  require 'shelltastic'
8
8
 
9
9
  RSpec.configure do |config|
10
- config.treat_symbols_as_metadata_keys_with_true_values = true
11
10
  config.run_all_when_everything_filtered = true
12
11
  config.filter_run :focus
13
12
 
data/spec/timer_spec.rb CHANGED
@@ -1,23 +1,23 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe ShellTastic::Timer do
4
- it "should report start time" do
4
+ it "reports start time" do
5
5
  start = ShellTastic::Timer.new.start
6
- start.class.should eq(Time)
6
+ expect(start.class).to eq(Time)
7
7
  end
8
8
 
9
- it "should report stop time" do
9
+ it "reports the stop time" do
10
10
  stop = ShellTastic::Timer.new.stop
11
- stop.class.should eq(Time)
11
+ expect(stop.class).to eq(Time)
12
12
  end
13
13
 
14
- it "should report total time" do
14
+ it "reports total time" do
15
15
  timer = ShellTastic::Timer.new
16
16
  start = timer.start
17
17
  sleep 2
18
18
  stop = timer.stop
19
19
  total = timer.total_time
20
- total.round.should eq(2)
20
+ expect(total.round).to eq(2)
21
21
  end
22
22
 
23
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shelltastic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bradley Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-20 00:00:00.000000000 Z
11
+ date: 2024-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: open4
@@ -60,6 +60,7 @@ executables: []
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
+ - ".github/workflows/ruby.yml"
63
64
  - ".gitignore"
64
65
  - ".rspec"
65
66
  - CHANGELOG.md
@@ -98,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
99
  - !ruby/object:Gem::Version
99
100
  version: '0'
100
101
  requirements: []
101
- rubygems_version: 3.2.22
102
+ rubygems_version: 3.3.26
102
103
  signing_key:
103
104
  specification_version: 4
104
105
  summary: Shelltastic is a simple *nix shell wrapper.