rmline 1.0.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
+ SHA1:
3
+ metadata.gz: ccbc23b7a8346674d6377fb468f66c772b20b20b
4
+ data.tar.gz: 94427f91b56b0ab96f9a967878e006cfa212d3f8
5
+ SHA512:
6
+ metadata.gz: 39c50a7c56d3a378dee126da56d04dcb5a308a62083b48a5090a19eaf15bb3e366d0d437f82ab8c37c0d03434343d2cb6258052e85870e5e1d749cf7e46c43d6
7
+ data.tar.gz: 7103e16174925626cde166e8e7fd5d6ecee3588d7029141c4e924754383cd8a69ec845d03c0f5e4d7997c7ad6f5d0343bbaa8e22892a96a5c675753b3d29bb85
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.1
5
+ before_install: gem install bundler -v 1.12.4
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rmline.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 James Wren
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,29 @@
1
+ # Rmline
2
+
3
+ I originally made this to remove comments from an input file. It could probably
4
+ remove anything passed to it but have not tested it.
5
+
6
+ This was made fairly quickly, it may not be following best practices.
7
+
8
+ ## Installation
9
+
10
+ ```ruby
11
+ gem install 'rmline'
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ $ rmline path/to/file "character(s) to part lines on"
17
+
18
+ ## Development
19
+
20
+ I plan on adding some form of error checking.
21
+
22
+ ## Contributing
23
+
24
+ Bug reports and pull requests are welcome on GitHub at https://github.com/jameslwren/rmline.
25
+
26
+ ## License
27
+
28
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
29
+
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task :default => :test
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "rmline"
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
data/bin/rmline ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rmline'
4
+
5
+ Rmline::Rmline.new
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,3 @@
1
+ module Rmline
2
+ VERSION = "1.0.0"
3
+ end
data/lib/rmline.rb ADDED
@@ -0,0 +1,34 @@
1
+ require 'rmline/version'
2
+ require 'tempfile'
3
+
4
+ module Rmline
5
+ class Rmline
6
+ def initialize
7
+ @temp_file = Tempfile.new('tmp')
8
+ @input = IO.read(ARGV[0])
9
+
10
+ self.input_to_tempfile
11
+ self.remove_line
12
+ end
13
+
14
+ def input_to_tempfile
15
+ @temp_file << @input
16
+
17
+ @temp_file.rewind
18
+ end
19
+
20
+ def remove_line
21
+ File.delete(ARGV[0])
22
+ File.open(ARGV[0], "a") do |out|
23
+ @temp_file.read.each_line do |current_line|
24
+ if current_line.match(ARGV[1])
25
+ part_line = current_line.partition(ARGV[1]).first.strip
26
+ out.puts part_line
27
+ else
28
+ out.puts(current_line)
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
data/rmline.gemspec ADDED
@@ -0,0 +1,40 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rmline/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rmline"
8
+ spec.homepage = "https://github.com/jameslwren/rmline"
9
+ spec.version = Rmline::VERSION
10
+ spec.authors = ["James Wren"]
11
+ spec.email = ["jameslwren@gmail.com"]
12
+
13
+ spec.summary = %q{Takes a file as input and an argument to part lines on}
14
+ spec.description = %q{This has been deprecated and renamed to partline. Please use that instead.}
15
+ spec.license = "MIT"
16
+
17
+ if spec.respond_to?(:metadata)
18
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
19
+ else
20
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
21
+ end
22
+
23
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
+ spec.bindir = "bin"
25
+ spec.executables = spec.files.grep(%r{^bin/}).map { |f| File.basename(f) }
26
+ spec.require_paths = ["lib"]
27
+
28
+ spec.add_development_dependency "bundler", "~> 1.12"
29
+ spec.add_development_dependency "rake", "~> 10.0"
30
+ spec.add_development_dependency "minitest", "~> 5.0"
31
+
32
+ spec.post_install_message = <<-MESSAGE
33
+ !
34
+ ! ATTENTION
35
+ !
36
+ ! rmline has been renamed to partline
37
+ ! See: https://rubygems.org/gems/partline
38
+ ! And: https://github.com/jameslwren/partline
39
+ MESSAGE
40
+ end
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rmline
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - James Wren
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-07-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.12'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.12'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5.0'
55
+ description: This has been deprecated and renamed to partline. Please use that instead.
56
+ email:
57
+ - jameslwren@gmail.com
58
+ executables:
59
+ - console
60
+ - rmline
61
+ - setup
62
+ extensions: []
63
+ extra_rdoc_files: []
64
+ files:
65
+ - ".gitignore"
66
+ - ".travis.yml"
67
+ - Gemfile
68
+ - LICENSE.txt
69
+ - README.md
70
+ - Rakefile
71
+ - bin/console
72
+ - bin/rmline
73
+ - bin/setup
74
+ - lib/rmline.rb
75
+ - lib/rmline/version.rb
76
+ - rmline.gemspec
77
+ homepage: https://github.com/jameslwren/rmline
78
+ licenses:
79
+ - MIT
80
+ metadata:
81
+ allowed_push_host: https://rubygems.org
82
+ post_install_message: " ! \n ! ATTENTION\n !\n ! rmline has been renamed
83
+ to partline\n ! See: https://rubygems.org/gems/partline\n ! And: https://github.com/jameslwren/partline\n"
84
+ rdoc_options: []
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ requirements: []
98
+ rubyforge_project:
99
+ rubygems_version: 2.6.1
100
+ signing_key:
101
+ specification_version: 4
102
+ summary: Takes a file as input and an argument to part lines on
103
+ test_files: []