insert_from_file 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +3 -0
- data/README.md +3 -5
- data/all.sh +3 -15
- data/code_test.sh +10 -10
- data/git_check.sh +13 -0
- data/insert_from_file.gemspec +14 -14
- data/lib/insert_from_file.rb +6 -6
- data/lib/insert_from_file/version.rb +1 -1
- data/upgrade_gems.sh +17 -0
- metadata +48 -60
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 757bc088888af33f08b0e91769b80a4bbc71e3bfa3bee93ae90afdaa4ec9fd66
|
4
|
+
data.tar.gz: bdc8b3121363725767234ec3184346adcd2b0a4caddac74f53810c8aee67bfa4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59459a351b472890d291d7e5dd006fe1aed6fe264ceceab00c3b84a5c5dd2c6797ad294d1b4bcf4c6ae578ef6312e374ef0d0053e9111a1a43ed733d94f62004
|
7
|
+
data.tar.gz: 2490d0a48cd9a5dfb2a818e7628a47a53f497f5a9f30ec0ec4290f7a8d98e3942343cf2fa2721c7cd44b568789c256a59ebbdeb42d794f42e416dc6973a6accd
|
data/.rubocop.yml
CHANGED
data/README.md
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
# InsertFromFile
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/insert_from_file.svg)](https://badge.fury.io/rb/insert_from_file)
|
4
|
-
[![Build Status](https://
|
5
|
-
[![
|
6
|
-
[![
|
7
|
-
[![Code Climate](https://codeclimate.com/github/jhsu802701/insert_from_file/badges/gpa.svg)](https://codeclimate.com/github/jhsu802701/insert_from_file)
|
8
|
-
[![Test Coverage](https://codeclimate.com/github/jhsu802701/insert_from_file/badges/coverage.svg)](https://codeclimate.com/github/jhsu802701/insert_from_file/coverage)
|
4
|
+
[![Build Status](https://semaphoreci.com/api/v1/jhsu802701/insert_from_file/branches/master/badge.svg)](https://semaphoreci.com/jhsu802701/insert_from_file)
|
5
|
+
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/ad95b790c84c46bca9a19456a838377a)](https://www.codacy.com/app/jhsu802701/insert_from_file?utm_source=jhsu802701@bitbucket.org&utm_medium=referral&utm_content=jhsu802701/insert_from_file&utm_campaign=Badge_Grade)
|
6
|
+
[![codecov](https://codecov.io/bb/jhsu802701/insert_from_file/branch/master/graph/badge.svg)](https://codecov.io/bb/jhsu802701/insert_from_file)
|
9
7
|
|
10
8
|
## What This Gem Does
|
11
9
|
|
data/all.sh
CHANGED
@@ -1,17 +1,5 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
FILE_INSTALL_GEM='log/3-install-gem.log'
|
7
|
-
sh gem_test.sh 2>&1 | tee $FILE_TEST_GEM
|
8
|
-
sh code_test.sh 2>&1 | tee $FILE_TEST_CODE
|
9
|
-
sh gem_install.sh 2>&1 | tee $FILE_INSTALL_GEM
|
10
|
-
|
11
|
-
echo 'Results are logged in:'
|
12
|
-
echo $FILE_TEST_GEM
|
13
|
-
echo $FILE_TEST_CODE
|
14
|
-
echo $FILE_INSTALL_GEM
|
15
|
-
echo
|
16
|
-
echo 'Gemsurance Report: log/gemsurance_report.html'
|
17
|
-
echo 'Gem dependency diagram: log/diagram-gems.svg'
|
3
|
+
sh gem_test.sh
|
4
|
+
sh gem_install.sh
|
5
|
+
sh code_test.sh
|
data/code_test.sh
CHANGED
@@ -14,22 +14,22 @@ echo '----------------------'
|
|
14
14
|
echo 'bundle exec rubocop -D'
|
15
15
|
bundle exec rubocop -D
|
16
16
|
|
17
|
-
|
18
|
-
echo '
|
19
|
-
echo 'bundle exec
|
20
|
-
bundle exec
|
17
|
+
# Update the local ruby-advisory-db advisory database
|
18
|
+
echo '-------------------------------'
|
19
|
+
echo 'bundle exec bundle-audit update'
|
20
|
+
bundle exec bundle-audit update
|
21
21
|
|
22
|
-
|
22
|
+
# Audit the gems listed in Gemfile.lock for vulnerabilities
|
23
23
|
echo '------------------------'
|
24
24
|
echo 'bundle exec bundle-audit'
|
25
25
|
bundle exec bundle-audit
|
26
26
|
|
27
|
+
echo '------------------------------------------------------------------------'
|
28
|
+
echo 'bundle viz --file=log/diagram-gems --format=svg --requirements --version'
|
29
|
+
bundle viz --file=log/diagram-gems --format=jpg --requirements --version
|
30
|
+
echo 'Gem dependency diagram: log/diagram-gems.jpg'
|
31
|
+
|
27
32
|
echo '----------------------------------------------------------'
|
28
33
|
echo 'bundle exec gemsurance --output log/gemsurance_report.html'
|
29
34
|
bundle exec gemsurance --output log/gemsurance_report.html
|
30
35
|
echo 'Gemsurance Report: log/gemsurance_report.html'
|
31
|
-
|
32
|
-
echo '------------------------------------------------------------------------'
|
33
|
-
echo 'bundle viz --file=log/diagram-gems --format=svg --requirements --version'
|
34
|
-
bundle viz --file=log/diagram-gems --format=svg --requirements --version
|
35
|
-
echo 'Gem dependency diagram: log/diagram-gems.svg'
|
data/git_check.sh
ADDED
data/insert_from_file.gemspec
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
lib = File.expand_path('../lib', __FILE__)
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
4
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
3
|
require 'insert_from_file/version'
|
6
4
|
|
@@ -12,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
12
10
|
|
13
11
|
spec.summary = 'Insert the contents of one file into another file.'
|
14
12
|
spec.description = 'Insert the contents of the source file into the destination file. Look for a line with certain content in the destination file, and add the contents of the source file before or after this point. You can also look for two lines with certain content in the destination file and replace everything in between with the contents of the source file.'
|
15
|
-
spec.homepage = 'https://
|
13
|
+
spec.homepage = 'https://bitbucket.org/jhsu802701/insert_from_file'
|
16
14
|
spec.license = 'MIT'
|
17
15
|
|
18
16
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
@@ -22,16 +20,18 @@ Gem::Specification.new do |spec|
|
|
22
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
21
|
spec.require_paths = ['lib']
|
24
22
|
|
25
|
-
spec.add_development_dependency 'bundler', '
|
26
|
-
spec.add_development_dependency 'rake', '
|
27
|
-
spec.add_development_dependency 'rspec', '
|
28
|
-
|
29
|
-
spec.add_development_dependency '
|
30
|
-
spec.add_development_dependency '
|
31
|
-
spec.add_development_dependency '
|
32
|
-
spec.add_development_dependency '
|
33
|
-
spec.add_development_dependency '
|
34
|
-
|
23
|
+
spec.add_development_dependency 'bundler', '1.16.3'
|
24
|
+
spec.add_development_dependency 'rake', '12.3.1'
|
25
|
+
spec.add_development_dependency 'rspec', '3.8.0'
|
26
|
+
|
27
|
+
spec.add_development_dependency 'bundler-audit', '0.6.0'
|
28
|
+
spec.add_development_dependency 'gemsurance', '0.9.0'
|
29
|
+
spec.add_development_dependency 'rubocop', '0.58.2'
|
30
|
+
spec.add_development_dependency 'ruby-graphviz', '1.2.3'
|
31
|
+
spec.add_development_dependency 'simplecov', '0.16.1'
|
32
|
+
|
33
|
+
spec.add_development_dependency 'codecov', '0.1.10'
|
34
|
+
|
35
35
|
spec.add_runtime_dependency 'line_containing'
|
36
36
|
spec.add_runtime_dependency 'string_in_file'
|
37
37
|
end
|
data/lib/insert_from_file.rb
CHANGED
@@ -8,7 +8,7 @@ module InsertFromFile
|
|
8
8
|
def self.add_before(file_source, file_dest, str_dest)
|
9
9
|
path_old = file_dest
|
10
10
|
path_new = "#{path_old}.new"
|
11
|
-
file_w = open(path_new, 'w')
|
11
|
+
file_w = File.open(path_new, 'w')
|
12
12
|
File.readlines(path_old).each do |line|
|
13
13
|
if line.include? str_dest
|
14
14
|
File.readlines(file_source).each do |line_s|
|
@@ -25,7 +25,7 @@ module InsertFromFile
|
|
25
25
|
def self.add_after(file_source, file_dest, str_dest)
|
26
26
|
path_old = file_dest
|
27
27
|
path_new = "#{path_old}.new"
|
28
|
-
file_w = open(path_new, 'w')
|
28
|
+
file_w = File.open(path_new, 'w')
|
29
29
|
File.readlines(path_old).each do |line|
|
30
30
|
file_w.write(line)
|
31
31
|
# rubocop:disable Style/Next
|
@@ -44,7 +44,7 @@ module InsertFromFile
|
|
44
44
|
def self.replace(file_source, file_dest, str_dest)
|
45
45
|
path_old = file_dest
|
46
46
|
path_new = "#{path_old}.new"
|
47
|
-
file_w = open(path_new, 'w')
|
47
|
+
file_w = File.open(path_new, 'w')
|
48
48
|
File.readlines(path_old).each do |line|
|
49
49
|
if line.include? str_dest
|
50
50
|
File.readlines(file_source).each do |line_s|
|
@@ -63,7 +63,7 @@ module InsertFromFile
|
|
63
63
|
LineContaining.delete_between(str1, str2, file_dest)
|
64
64
|
path_old = file_dest
|
65
65
|
path_new = "#{path_old}.new"
|
66
|
-
file_w = open(path_new, 'w')
|
66
|
+
file_w = File.open(path_new, 'w')
|
67
67
|
is_before = true
|
68
68
|
is_after = false
|
69
69
|
File.readlines(path_old).each do |line|
|
@@ -89,7 +89,7 @@ module InsertFromFile
|
|
89
89
|
def self.add_beginning(file_source, file_dest)
|
90
90
|
path_old = file_dest
|
91
91
|
path_new = "#{path_old}.new"
|
92
|
-
file_w = open(path_new, 'w')
|
92
|
+
file_w = File.open(path_new, 'w')
|
93
93
|
File.readlines(file_source).each do |line|
|
94
94
|
file_w.write(line)
|
95
95
|
end
|
@@ -104,7 +104,7 @@ module InsertFromFile
|
|
104
104
|
def self.add_end(file_source, file_dest)
|
105
105
|
path_old = file_dest
|
106
106
|
path_new = "#{path_old}.new"
|
107
|
-
file_w = open(path_new, 'w')
|
107
|
+
file_w = File.open(path_new, 'w')
|
108
108
|
File.readlines(path_old).each do |line|
|
109
109
|
file_w.write(line)
|
110
110
|
end
|
data/upgrade_gems.sh
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
# Use this script for upgrading gems.
|
4
|
+
|
5
|
+
# If the version of a gem is pinned in the Gemfile, you must update
|
6
|
+
# the version number specified in that file.
|
7
|
+
|
8
|
+
echo '-------------'
|
9
|
+
echo 'bundle update'
|
10
|
+
bundle update
|
11
|
+
|
12
|
+
sh git_check.sh
|
13
|
+
|
14
|
+
echo '----------------------------------------------------------'
|
15
|
+
echo 'bundle exec gemsurance --output log/gemsurance_report.html'
|
16
|
+
bundle exec gemsurance --output log/gemsurance_report.html
|
17
|
+
echo 'The Gemsurance Report is at log/gemsurance_report.html .'
|
metadata
CHANGED
@@ -1,155 +1,141 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: insert_from_file
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Hsu
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.16.3
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.16.3
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 12.3.1
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 12.3.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 3.8.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 3.8.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: codeclimate-test-reporter
|
56
|
+
name: bundler-audit
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
|
-
- -
|
59
|
+
- - '='
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
61
|
+
version: 0.6.0
|
76
62
|
type: :development
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
|
-
- -
|
66
|
+
- - '='
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
68
|
+
version: 0.6.0
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
70
|
+
name: gemsurance
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
86
72
|
requirements:
|
87
|
-
- -
|
73
|
+
- - '='
|
88
74
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
75
|
+
version: 0.9.0
|
90
76
|
type: :development
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
|
-
- -
|
80
|
+
- - '='
|
95
81
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
82
|
+
version: 0.9.0
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
84
|
+
name: rubocop
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
100
86
|
requirements:
|
101
|
-
- -
|
87
|
+
- - '='
|
102
88
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
89
|
+
version: 0.58.2
|
104
90
|
type: :development
|
105
91
|
prerelease: false
|
106
92
|
version_requirements: !ruby/object:Gem::Requirement
|
107
93
|
requirements:
|
108
|
-
- -
|
94
|
+
- - '='
|
109
95
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
96
|
+
version: 0.58.2
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
98
|
+
name: ruby-graphviz
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
114
100
|
requirements:
|
115
|
-
- -
|
101
|
+
- - '='
|
116
102
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
103
|
+
version: 1.2.3
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
107
|
requirements:
|
122
|
-
- -
|
108
|
+
- - '='
|
123
109
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
110
|
+
version: 1.2.3
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
112
|
+
name: simplecov
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
128
114
|
requirements:
|
129
|
-
- -
|
115
|
+
- - '='
|
130
116
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
117
|
+
version: 0.16.1
|
132
118
|
type: :development
|
133
119
|
prerelease: false
|
134
120
|
version_requirements: !ruby/object:Gem::Requirement
|
135
121
|
requirements:
|
136
|
-
- -
|
122
|
+
- - '='
|
137
123
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
124
|
+
version: 0.16.1
|
139
125
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
126
|
+
name: codecov
|
141
127
|
requirement: !ruby/object:Gem::Requirement
|
142
128
|
requirements:
|
143
|
-
- -
|
129
|
+
- - '='
|
144
130
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
131
|
+
version: 0.1.10
|
146
132
|
type: :development
|
147
133
|
prerelease: false
|
148
134
|
version_requirements: !ruby/object:Gem::Requirement
|
149
135
|
requirements:
|
150
|
-
- -
|
136
|
+
- - '='
|
151
137
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
138
|
+
version: 0.1.10
|
153
139
|
- !ruby/object:Gem::Dependency
|
154
140
|
name: line_containing
|
155
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -207,10 +193,12 @@ files:
|
|
207
193
|
- gem_console.sh
|
208
194
|
- gem_install.sh
|
209
195
|
- gem_test.sh
|
196
|
+
- git_check.sh
|
210
197
|
- insert_from_file.gemspec
|
211
198
|
- lib/insert_from_file.rb
|
212
199
|
- lib/insert_from_file/version.rb
|
213
|
-
|
200
|
+
- upgrade_gems.sh
|
201
|
+
homepage: https://bitbucket.org/jhsu802701/insert_from_file
|
214
202
|
licenses:
|
215
203
|
- MIT
|
216
204
|
metadata: {}
|
@@ -230,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
230
218
|
version: '0'
|
231
219
|
requirements: []
|
232
220
|
rubyforge_project:
|
233
|
-
rubygems_version: 2.
|
221
|
+
rubygems_version: 2.7.7
|
234
222
|
signing_key:
|
235
223
|
specification_version: 4
|
236
224
|
summary: Insert the contents of one file into another file.
|