line_containing 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fc22ec2ca3168f956e817aebe27805c3b1e11e96
4
- data.tar.gz: 6c64a43c546870b13028a7fb778c930edf526b47
3
+ metadata.gz: 37bc73226cd2f003c4047ef19c03799162375917
4
+ data.tar.gz: 9306e7d8cdc3bc2318dfe74c4526ae6a790c6fa9
5
5
  SHA512:
6
- metadata.gz: 93a95d57745c77ad59151eb6bb05c361b3c8188f9ab7956ebf26aeae7913c56d436bca04bfd9a2a448472453abbab648b79f036385c62b7212728c6cea4de70e
7
- data.tar.gz: 1cfb56a051af03a39bb3ea007cad765e8410ac49b2058f9550dc1ff329289d02c3f5466428378706c312764ea1d56fb6c816cc406070bcffb80142a2ca70d119
6
+ metadata.gz: 0e79493eb76682c11c56aaf3bd8c56a2f99269f394e19881af5bf423e95745db0706775f3bb0ce0bf4f3033f349da525fa7969f79515ac86b4b6b8b4df6d5c95
7
+ data.tar.gz: c852e018ead196ff2a5cc6ab6ad6f55791b649da9931edc6c6c75fe327475f00a476e603de70f834a2a40549d7c2a85d13e4a0576f85a0116a36531994eb367b
data/.travis.yml CHANGED
@@ -1,5 +1,9 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.3.1
4
+ - 2.4.1
5
+ - 2.3.4
5
6
  before_install: gem install bundler
7
+
8
+ after_success:
9
+ - bundle exec codeclimate-test-reporter
data/code_test.sh CHANGED
@@ -10,23 +10,23 @@ echo 'bundle install'
10
10
  bin/setup >/dev/null
11
11
 
12
12
  echo
13
- echo '----------'
14
- echo 'rubocop -D'
15
- rubocop -D
13
+ echo '----------------------'
14
+ echo 'bundle exec rubocop -D'
15
+ bundle exec rubocop -D
16
16
 
17
17
  echo
18
- echo '-----------'
19
- echo 'sandi_meter'
20
- sandi_meter
18
+ echo '-----------------------'
19
+ echo 'bundle exec sandi_meter'
20
+ bundle exec sandi_meter
21
21
 
22
22
  echo
23
- echo '------------'
24
- echo 'bundle-audit'
25
- bundle-audit
23
+ echo '------------------------'
24
+ echo 'bundle exec bundle-audit'
25
+ bundle exec bundle-audit
26
26
 
27
- echo '----------------------------------------------'
28
- echo 'gemsurance --output log/gemsurance_report.html'
29
- gemsurance --output log/gemsurance_report.html
27
+ echo '----------------------------------------------------------'
28
+ echo 'bundle exec gemsurance --output log/gemsurance_report.html'
29
+ bundle exec gemsurance --output log/gemsurance_report.html
30
30
  echo 'Gemsurance Report: log/gemsurance_report.html'
31
31
 
32
32
  echo '------------------------------------------------------------------------'
data/credentials.sh ADDED
@@ -0,0 +1,53 @@
1
+ #!/bin/bash
2
+
3
+ # Output:
4
+ # First argument if it is not blank
5
+ # Second argument if first argument is blank
6
+ anti_blank () {
7
+ if [ -z "$1" ]; then
8
+ echo "$2"
9
+ else
10
+ echo "$1"
11
+ fi
12
+ }
13
+
14
+ # Setting Git email if necessary
15
+ GIT_EMAIL="$(git config user.email)"
16
+ if [ -z "$GIT_EMAIL" ]; then
17
+ EMAIL_DEF='you@example.com'
18
+ echo
19
+ echo "Default email address: ${EMAIL_DEF}"
20
+ echo
21
+ echo 'Enter your Git email address:'
22
+ read EMAIL_SEL
23
+ EMAIL=$(anti_blank $EMAIL_SEL $EMAIL_DEF)
24
+ echo
25
+
26
+ echo
27
+ echo '------------------------------'
28
+ echo "git config --global user.email"
29
+ echo "$EMAIL"
30
+ git config --global user.email "$EMAIL"
31
+ fi
32
+
33
+ # Setting Git name if necessary
34
+ GIT_NAME="$(git config user.name)"
35
+ if [ -z "$GIT_NAME" ]; then
36
+ NAME_DEF='Your Name'
37
+ echo
38
+ echo "Default name: ${NAME_DEF}"
39
+ echo
40
+ echo 'Enter your Git name:'
41
+ read NAME_SEL
42
+
43
+ # NOTE: The double quotes are needed to avoid truncating the string
44
+ # at the space.
45
+ NAME=$(anti_blank "$NAME_SEL" "$NAME_DEF")
46
+
47
+ echo
48
+ echo '-----------------------------'
49
+ echo "git config --global user.name"
50
+ echo "$NAME"
51
+ git config --global user.name "$NAME"
52
+ echo
53
+ fi
@@ -1,3 +1,3 @@
1
1
  module LineContaining
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.1'.freeze
3
3
  end
@@ -3,7 +3,6 @@ require 'line_containing/version'
3
3
  #
4
4
  module LineContaining
5
5
  def self.add_before(str_orig, str_add, path)
6
- system('pwd')
7
6
  path_old = path
8
7
  path_new = "#{path_old}.new"
9
8
  file_w = open(path_new, 'w')
@@ -21,12 +20,10 @@ module LineContaining
21
20
  path_new = "#{path_old}.new"
22
21
  file_w = open(path_new, 'w')
23
22
  File.readlines(path_old).each do |line|
23
+ file_w.write(line)
24
24
  if line.include? str_orig
25
- file_w.write(line)
26
25
  file_w.write("\n") if line[-1] != "\n"
27
26
  file_w.write("#{str_add}\n")
28
- else
29
- file_w.write(line)
30
27
  end
31
28
  end
32
29
  file_w.close
@@ -1,4 +1,5 @@
1
1
  # coding: utf-8
2
+
2
3
  lib = File.expand_path('../lib', __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'line_containing/version'
@@ -22,18 +23,11 @@ Gem::Specification.new do |spec|
22
23
  spec.add_development_dependency 'bundler', '~> 1.8'
23
24
  spec.add_development_dependency 'rake', '~> 10.0'
24
25
  spec.add_development_dependency 'rspec'
25
-
26
26
  spec.add_development_dependency 'simplecov'
27
-
28
27
  spec.add_development_dependency 'ruby-graphviz'
29
-
30
28
  spec.add_development_dependency 'gemsurance'
31
-
32
29
  spec.add_development_dependency 'bundler-audit'
33
-
34
30
  spec.add_development_dependency 'sandi_meter'
35
-
36
31
  spec.add_development_dependency 'rubocop'
37
-
38
32
  spec.add_development_dependency 'codeclimate-test-reporter'
39
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: line_containing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Hsu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-05 00:00:00.000000000 Z
11
+ date: 2017-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -170,6 +170,7 @@ files:
170
170
  - bin/console
171
171
  - bin/setup
172
172
  - code_test.sh
173
+ - credentials.sh
173
174
  - gem_console.sh
174
175
  - gem_install.sh
175
176
  - gem_test.sh
@@ -196,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
197
  version: '0'
197
198
  requirements: []
198
199
  rubyforge_project:
199
- rubygems_version: 2.5.1
200
+ rubygems_version: 2.6.11
200
201
  signing_key:
201
202
  specification_version: 4
202
203
  summary: Remove or replace a line from a file based on its content. Look for a line