terminal_commands 0.1.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c793ea17530cf3f02885f9e248e4df96c3af46144cda586f1b4d0f2aeb9f204d
4
+ data.tar.gz: 41e2eba3c2d9530cb5b13ec1916553384323ce5523d7c60ebeb2b5c2ae794987
5
+ SHA512:
6
+ metadata.gz: 5329db06f7ccb216a779a8b6d0944d5924c22f4684668ec00f63709d49d90aa926965b8b3e6446e5909837742c046cc56970c16f049e636283fdccf14dfe3967
7
+ data.tar.gz: 3ed70ed6f865dc8425cfca8280b39d0c3c2207a6a598eac7c86743e5ad504bb20571b55ad66adb139abc99662cfe0f36e6805df080c1de44ace2ab3a60bb4bb0
data/.standard.yml ADDED
@@ -0,0 +1,2 @@
1
+ # For available configuration options, see:
2
+ # https://github.com/testdouble/standard
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2022-03-21
4
+
5
+ - Initial release
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in terminal_commands.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+ gem "minitest", "~> 5.0"
10
+ gem "standard", "~> 1.3"
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Gabriel Zayas
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # TerminalCommands
2
+
3
+ A gem for running terminal commands specific to the OS you're working in.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'terminal_commands'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle install
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install terminal_commands
20
+
21
+ ## Usage
22
+
23
+ ```Ruby
24
+ TerminalCommands.open_file_or_link("https://www.github.com")
25
+ TerminalCommands.open_folder("path/to/open")
26
+ ```
27
+
28
+ ## Contributing
29
+
30
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/terminal_commands.
31
+
32
+ ## License
33
+
34
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/*_test.rb"]
10
+ end
11
+
12
+ require "standard/rake"
13
+
14
+ task default: %i[test standard]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "terminal_commands"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TerminalCommands
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "terminal_commands/version"
4
+
5
+ module TerminalCommands
6
+ def self.open_file_or_link(file_or_link, options = {})
7
+ command = if macosx?
8
+ "open"
9
+ elsif linux?
10
+ "xdg-open"
11
+ end
12
+ `#{command} #{file_or_link}`
13
+ end
14
+
15
+ def self.open_folder(path_name, options = {})
16
+ command = if macosx?
17
+ "open"
18
+ elsif linux?
19
+ "nautilus"
20
+ end
21
+ `#{command} #{path_name}`
22
+ end
23
+
24
+ private
25
+
26
+ def self.os
27
+ Gem::Platform.local.os
28
+ end
29
+
30
+ def self.macosx?
31
+ os == macosx
32
+ end
33
+
34
+ def self.linux?
35
+ os == linux
36
+ end
37
+
38
+ def self.macosx
39
+ "darwin"
40
+ end
41
+
42
+ def self.linux
43
+ "linux"
44
+ end
45
+
46
+ class Error < StandardError; end
47
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/terminal_commands/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "terminal_commands"
7
+ spec.version = TerminalCommands::VERSION
8
+ spec.authors = ["Gabriel Zayas"]
9
+ spec.email = ["g-zayas@hotmail.com"]
10
+
11
+ spec.summary = "A Ruby gem for running terminal commands"
12
+ spec.description = "Run terminal commands specific to the OS you're working in"
13
+ spec.homepage = "https://github.com/gazayas/terminal_commands"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 2.6.0"
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = "https://github.com/gazayas/terminal_commands"
19
+ spec.metadata["changelog_uri"] = "https://github.com/gazayas/terminal_commands/CHANGELOG.md"
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
24
+ `git ls-files -z`.split("\x0").reject do |f|
25
+ (f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
26
+ end
27
+ end
28
+ spec.bindir = "exe"
29
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ["lib"]
31
+
32
+ # Uncomment to register a new dependency of your gem
33
+ # spec.add_dependency "example-gem", "~> 1.0"
34
+
35
+ # For more information and examples about making a new gem, checkout our
36
+ # guide at: https://bundler.io/guides/creating_gem.html
37
+ end
metadata ADDED
@@ -0,0 +1,57 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: terminal_commands
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Gabriel Zayas
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-03-21 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Run terminal commands specific to the OS you're working in
14
+ email:
15
+ - g-zayas@hotmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".standard.yml"
21
+ - CHANGELOG.md
22
+ - Gemfile
23
+ - LICENSE.txt
24
+ - README.md
25
+ - Rakefile
26
+ - bin/console
27
+ - bin/setup
28
+ - lib/terminal_commands.rb
29
+ - lib/terminal_commands/version.rb
30
+ - terminal_commands.gemspec
31
+ homepage: https://github.com/gazayas/terminal_commands
32
+ licenses:
33
+ - MIT
34
+ metadata:
35
+ homepage_uri: https://github.com/gazayas/terminal_commands
36
+ source_code_uri: https://github.com/gazayas/terminal_commands
37
+ changelog_uri: https://github.com/gazayas/terminal_commands/CHANGELOG.md
38
+ post_install_message:
39
+ rdoc_options: []
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 2.6.0
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ requirements: []
53
+ rubygems_version: 3.2.32
54
+ signing_key:
55
+ specification_version: 4
56
+ summary: A Ruby gem for running terminal commands
57
+ test_files: []