space2underscore 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/Gemfile +3 -0
- data/README.md +6 -2
- data/bin/s2u +15 -8
- data/bin/space2underscore +15 -8
- data/lib/space2underscore/version.rb +1 -1
- data/lib/space2underscore.rb +4 -4
- data/space2underscore.gemspec +2 -2
- data/spec/space2underscore_spec.rb +49 -3
- data/spec/spec_helper.rb +14 -0
- metadata +21 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd424863837b78ec2e4f0748477abe9986c5172d
|
4
|
+
data.tar.gz: 0807ac4427afdfdf0f31594fb7e73912828f1e1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a26458786cbd60a5726e63c8c9ccadc533db3562737f03557b47cca4b57a83a35e2b1bb9e4e785679d085f80f5ff0738de5560d38e78322a8ad98b62136ba950
|
7
|
+
data.tar.gz: 4f0ef248772a46265df86e0512cfe9ba2e783fe497ff47a4f547d1b0800e7b72b89c594f7304a3b2cc8c7f70e5cf4c2ac119eeac7a12642699b1bccfa1a40e8e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
## v0.3.7
|
4
|
+
- Added gems for coverage and use COVERALLS and SimpleCov.
|
5
|
+
- Wrote configurations for COVERALLS and SimpleCov.
|
6
|
+
- Hid git command's result.
|
7
|
+
- Modified methods specifications.
|
8
|
+
- Wrote spec for .create_new_branch and .usage.
|
9
|
+
- Changed print method from print to puts.
|
10
|
+
- Added badges.
|
11
|
+
- Fixed typos.
|
12
|
+
|
13
|
+
## v0.3.6 (2015-10-16)
|
14
|
+
- Wrote CHANGELOG.md.
|
15
|
+
- Rewrote docs.
|
16
|
+
- Added credits for ghq and tmuxinator.
|
17
|
+
- Modified the help information.
|
18
|
+
- Modified the information to be printed after the installation is completed.
|
19
|
+
|
3
20
|
## v0.3.5 (2015-10-07)
|
4
21
|
- Removed line feed code in first line.
|
5
22
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
# Space2underscore
|
1
|
+
# Space2underscore
|
2
|
+
|
3
|
+
![Gem Version](https://badge.fury.io/rb/space2underscore.svg) [![Build Status](https://travis-ci.org/sachin21/space2underscore.svg?branch=master)](https://travis-ci.org/sachin21/space2underscore) [![Code Climate](https://codeclimate.com/github/sachin21/space2underscore/badges/gpa.svg)](https://codeclimate.com/github/sachin21/space2underscore) [![Coverage Status](https://coveralls.io/repos/sachin21/space2underscore/badge.svg?branch=master&service=github)](https://coveralls.io/github/sachin21/space2underscore?branch=master) [![Gem](https://img.shields.io/gem/dt/space2underscore.svg)]()
|
2
4
|
|
3
5
|
## What is space2underscore
|
4
6
|
Change the space into underscore.
|
@@ -7,7 +9,9 @@ space2underscore is a useful command when you want to check out a branch.
|
|
7
9
|
## Installation
|
8
10
|
Install it yourself as:
|
9
11
|
|
10
|
-
|
12
|
+
```
|
13
|
+
$ gem install space2underscore
|
14
|
+
```
|
11
15
|
|
12
16
|
## Usage
|
13
17
|
From the command line:
|
data/bin/s2u
CHANGED
@@ -4,14 +4,21 @@ require 'space2underscore'
|
|
4
4
|
CREATE_FLAGS = %w(-c --create)
|
5
5
|
|
6
6
|
args = ARGV.reject { |arg| CREATE_FLAGS.include?(arg) }
|
7
|
-
|
7
|
+
underscore_include_sentence = Space2underscore.convert(args)
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
if ARGV.include?('-c') || ARGV.include?('--create')
|
13
|
-
Space2underscore.create_new_branch(result)
|
9
|
+
result =
|
10
|
+
if ARGV.empty?
|
11
|
+
Space2underscore.usage
|
14
12
|
else
|
15
|
-
|
13
|
+
if ARGV.include?('-c') || ARGV.include?('--create')
|
14
|
+
if Space2underscore.create_new_branch(underscore_include_sentence)
|
15
|
+
"Switched to a new branch '#{underscore_include_sentence}'"
|
16
|
+
else
|
17
|
+
"fatal: A branch named '#{underscore_include_sentence}' already exists."
|
18
|
+
end
|
19
|
+
else
|
20
|
+
underscore_include_sentence
|
21
|
+
end
|
16
22
|
end
|
17
|
-
|
23
|
+
|
24
|
+
puts result
|
data/bin/space2underscore
CHANGED
@@ -4,14 +4,21 @@ require 'space2underscore'
|
|
4
4
|
CREATE_FLAGS = %w(-c --create)
|
5
5
|
|
6
6
|
args = ARGV.reject { |arg| CREATE_FLAGS.include?(arg) }
|
7
|
-
|
7
|
+
underscore_include_sentence = Space2underscore.convert(args)
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
if ARGV.include?('-c') || ARGV.include?('--create')
|
13
|
-
Space2underscore.create_new_branch(result)
|
9
|
+
result =
|
10
|
+
if ARGV.empty?
|
11
|
+
Space2underscore.usage
|
14
12
|
else
|
15
|
-
|
13
|
+
if ARGV.include?('-c') || ARGV.include?('--create')
|
14
|
+
if Space2underscore.create_new_branch(underscore_include_sentence)
|
15
|
+
"Switched to a new branch '#{underscore_include_sentence}'"
|
16
|
+
else
|
17
|
+
"fatal: A branch named '#{underscore_include_sentence}' already exists."
|
18
|
+
end
|
19
|
+
else
|
20
|
+
underscore_include_sentence
|
21
|
+
end
|
16
22
|
end
|
17
|
-
|
23
|
+
|
24
|
+
puts result
|
data/lib/space2underscore.rb
CHANGED
@@ -7,11 +7,11 @@ module Space2underscore
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def self.create_new_branch(underscore_include_sentence)
|
10
|
-
system "git checkout -b #{underscore_include_sentence}"
|
10
|
+
system "git checkout -b #{underscore_include_sentence} > /dev/null 2>&1"
|
11
11
|
end
|
12
12
|
|
13
|
-
def self.
|
14
|
-
message = <<-EOF
|
13
|
+
def self.usage
|
14
|
+
message = <<-EOF.chomp
|
15
15
|
NAME:
|
16
16
|
space2underscore - Change the space into underscore
|
17
17
|
|
@@ -30,6 +30,6 @@ module Space2underscore
|
|
30
30
|
--create, -c create the new branch
|
31
31
|
EOF
|
32
32
|
|
33
|
-
|
33
|
+
message.gsub(' ', '')
|
34
34
|
end
|
35
35
|
end
|
data/space2underscore.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.post_install_message =
|
21
|
+
spec.post_install_message = <<-EOF
|
22
22
|
..........................................................
|
23
23
|
__________________________________________________________
|
24
24
|
|
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
|
|
37
37
|
|
38
38
|
----------------------------------------------------------
|
39
39
|
..........................................................
|
40
|
-
|
40
|
+
EOF
|
41
41
|
|
42
42
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
43
43
|
spec.add_development_dependency 'rake'
|
@@ -1,8 +1,54 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Space2underscore do
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
let(:branch_name) { 'foo_bar' }
|
5
|
+
let(:hidden) { '> /dev/null 2>&1'}
|
6
|
+
|
7
|
+
describe '.convert' do
|
8
|
+
it 'returns underscore included in string' do
|
9
|
+
expect(Space2underscore.convert(['foo bar'])).to include('_')
|
10
|
+
expect(Space2underscore.convert(%w(foo bar))).to include('_')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def checkout_and_remove_branch
|
15
|
+
checkout_master = "git checkout master #{hidden}"
|
16
|
+
delete_branch = "git branch -D #{branch_name} #{hidden}"
|
17
|
+
|
18
|
+
system("#{checkout_master}; #{delete_branch}")
|
19
|
+
end
|
20
|
+
|
21
|
+
def create_branch
|
22
|
+
system("git branch #{branch_name} #{hidden}")
|
23
|
+
end
|
24
|
+
|
25
|
+
describe '.create_new_branch' do
|
26
|
+
after { checkout_and_remove_branch }
|
27
|
+
|
28
|
+
context "when exist a git repository" do
|
29
|
+
before { checkout_and_remove_branch }
|
30
|
+
|
31
|
+
it 'creates the new branch' do
|
32
|
+
expect(Space2underscore.create_new_branch(branch_name)).to be_truthy
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context "when exist a git repository" do
|
37
|
+
before { create_branch }
|
38
|
+
|
39
|
+
it 'creates the new branch' do
|
40
|
+
expect(Space2underscore.create_new_branch(branch_name)).to be_falsey
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe '.usage' do
|
46
|
+
it 'returns string' do
|
47
|
+
expect(Space2underscore.usage).to be_a(String)
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'does not return an blank string does' do
|
51
|
+
expect(Space2underscore.usage).not_to be_nil
|
52
|
+
end
|
7
53
|
end
|
8
54
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
require 'bundler/setup'
|
2
|
+
require 'coveralls'
|
3
|
+
Coveralls.wear!
|
4
|
+
|
2
5
|
require 'space2underscore'
|
6
|
+
require 'simplecov'
|
7
|
+
|
8
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
9
|
+
SimpleCov::Formatter::HTMLFormatter,
|
10
|
+
Coveralls::SimpleCov::Formatter
|
11
|
+
]
|
12
|
+
|
13
|
+
SimpleCov.start do
|
14
|
+
add_filter '/vendor/'
|
15
|
+
end
|
16
|
+
|
3
17
|
Bundler.setup
|
4
18
|
|
5
19
|
RSpec.configure do |config|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: space2underscore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sachin21
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,13 +94,25 @@ homepage: http://github.com/sachin21/space2underscore
|
|
94
94
|
licenses:
|
95
95
|
- MIT
|
96
96
|
metadata: {}
|
97
|
-
post_install_message:
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
97
|
+
post_install_message: |2
|
98
|
+
..........................................................
|
99
|
+
__________________________________________________________
|
100
|
+
|
101
|
+
Thank you for installing space2underscore.
|
102
|
+
|
103
|
+
************************* Usage **************************
|
104
|
+
|
105
|
+
From the command line:
|
106
|
+
|
107
|
+
$ space2underscore new branch -c
|
108
|
+
=> Switched to the new branch 'new_branch’
|
109
|
+
|
110
|
+
Or
|
111
|
+
|
112
|
+
$ git branch -m $(space2underscore renamed branch)
|
113
|
+
|
114
|
+
----------------------------------------------------------
|
115
|
+
..........................................................
|
104
116
|
rdoc_options: []
|
105
117
|
require_paths:
|
106
118
|
- lib
|