touch_p 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: 5e8c7dd1d7dff3b94de729962983912f40fe4b617a3478ecad82676aadc48bb6
4
+ data.tar.gz: 38b3bbf629a953c85807839aa44a3462409ec5a6aefd4ea38d404dd95476c9b8
5
+ SHA512:
6
+ metadata.gz: 6f857dc20589a8706bc021ffe8cdb45c5759ab1e79deb7cc18b00fd7a244709706f44ee127659d7a1ff597ccdc3a0d4a86ca5b758ac4b8665b5129501a6addd0
7
+ data.tar.gz: fa1a01f5f93e1c46e271cbf2776e842723341ba09c2587191ee2addcd3dc15e143446b15011bffb20cc415e19cf6bcca8a4685994906fa50e6def10d1e723bf3
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ Gemfile.lock
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.7.2
6
+ before_install: gem install bundler -v 2.1.4
data/Dockerfile ADDED
@@ -0,0 +1,9 @@
1
+ FROM ruby:2.7.2
2
+
3
+ RUN apt-get update
4
+
5
+ WORKDIR /touch_p
6
+
7
+ ADD . /touch_p
8
+
9
+ RUN bundle install
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in touch_p.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 TODO: Write your name
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/Makefile ADDED
@@ -0,0 +1,22 @@
1
+ NAME=touch_p
2
+ VERSION=latest
3
+
4
+ build:
5
+ docker build -t $(NAME):$(VERSION) .
6
+
7
+ restart: stop start
8
+
9
+ start:
10
+ docker run -it \
11
+ -v $(CURDIR):/touch_p \
12
+ --name $(NAME) \
13
+ $(NAME):$(VERSION) bash
14
+
15
+ stop:
16
+ docker rm -f $(NAME)
17
+
18
+ attach:
19
+ docker exec -it $(NAME) /bin/bash
20
+
21
+ logs:
22
+ docker logs $(NAME)
data/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # TouchP
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/touch_p`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'touch_p'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install touch_p
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/touch_p.
36
+
37
+
38
+ ## License
39
+
40
+ 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,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "touch_p"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ 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
File without changes
data/exe/touch_p ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "touch_p"
4
+
5
+ TouchP.exe
data/lib/touch_p.rb ADDED
@@ -0,0 +1,39 @@
1
+ require "touch_p/version"
2
+
3
+ module TouchP
4
+ def self.exe
5
+ return if !is_valid?(ARGV)
6
+ touch_p(ARGV)
7
+ end
8
+
9
+ def self.touch_p(argv)
10
+ argv.each do |file_path|
11
+ if file_path.include?("/")
12
+ dir = extract_dir(file_path)
13
+ begin
14
+ FileUtils.mkdir_p(dir)
15
+ rescue Errno::EEXIST
16
+ end
17
+ end
18
+ end
19
+
20
+ begin
21
+ FileUtils.touch(argv)
22
+ rescue => exception
23
+ puts exception
24
+ end
25
+ end
26
+
27
+ private
28
+ def self.is_valid?(argv)
29
+ return puts("Usage: touch_p FILE...") if argv[0] == "--help"
30
+ return puts("touch_p: '#{TouchP::VERSION}'") if argv[0] == "--version"
31
+ return puts("Try 'touch_p --help' for more information.") if argv.length == 0 || argv[0][0] == "-"
32
+ return true
33
+ end
34
+
35
+ def self.extract_dir(file_path)
36
+ return file_path if file_path[-1] == "/"
37
+ return file_path.split("/").slice(0..-2).join("/")
38
+ end
39
+ end
@@ -0,0 +1,3 @@
1
+ module TouchP
2
+ VERSION = "0.1.0"
3
+ end
data/touch_p.gemspec ADDED
@@ -0,0 +1,32 @@
1
+ require_relative 'lib/touch_p/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "touch_p"
5
+ spec.version = TouchP::VERSION
6
+ spec.authors = ["H0R15H0"]
7
+ spec.email = ["info.horisho13@gmail.com"]
8
+
9
+ spec.summary = "touch_p is a cli tool to make file even if directory doesn't exist, like 'mkdir -p'"
10
+ spec.description = "touch_p is a cli tool to make file even if directory doesn't exist, like 'mkdir -p'"
11
+ spec.homepage = "https://github.com/H0R15H0/touch_p"
12
+ spec.license = "MIT"
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
+
15
+ # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = "https://github.com/H0R15H0/touch_p"
19
+ # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
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('..', __FILE__)) do
24
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ end
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+
30
+ spec.add_development_dependency "rake", "~> 12.0"
31
+ spec.add_development_dependency "rspec", "~> 3.0"
32
+ end
metadata ADDED
@@ -0,0 +1,92 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: touch_p
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - H0R15H0
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-06-28 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: '12.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '12.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: '3.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.0'
41
+ description: touch_p is a cli tool to make file even if directory doesn't exist, like
42
+ 'mkdir -p'
43
+ email:
44
+ - info.horisho13@gmail.com
45
+ executables:
46
+ - touch_p
47
+ extensions: []
48
+ extra_rdoc_files: []
49
+ files:
50
+ - ".gitignore"
51
+ - ".rspec"
52
+ - ".travis.yml"
53
+ - Dockerfile
54
+ - Gemfile
55
+ - LICENSE.txt
56
+ - Makefile
57
+ - README.md
58
+ - Rakefile
59
+ - bin/console
60
+ - bin/setup
61
+ - docker-compose.yml
62
+ - exe/touch_p
63
+ - lib/touch_p.rb
64
+ - lib/touch_p/version.rb
65
+ - touch_p.gemspec
66
+ homepage: https://github.com/H0R15H0/touch_p
67
+ licenses:
68
+ - MIT
69
+ metadata:
70
+ homepage_uri: https://github.com/H0R15H0/touch_p
71
+ source_code_uri: https://github.com/H0R15H0/touch_p
72
+ post_install_message:
73
+ rdoc_options: []
74
+ require_paths:
75
+ - lib
76
+ required_ruby_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: 2.3.0
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ requirements: []
87
+ rubygems_version: 3.1.4
88
+ signing_key:
89
+ specification_version: 4
90
+ summary: touch_p is a cli tool to make file even if directory doesn't exist, like
91
+ 'mkdir -p'
92
+ test_files: []