space2underscore 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +17 -0
- data/README.md +24 -6
- data/Rakefile +4 -7
- data/bin/s2u +17 -0
- data/bin/space2underscore +7 -3
- data/lib/space2underscore.rb +22 -8
- data/lib/space2underscore/version.rb +1 -1
- data/space2underscore.gemspec +3 -3
- data/spec/space2underscore_spec.rb +1 -1
- metadata +12 -9
- data/.magnum.yml +0 -43
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f926c0fc882b16305c0bea5bbc62e6c1563f990
|
4
|
+
data.tar.gz: 29707cae7fc8e0b8e107723238e1aa09ff7febfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22639a6b974a4490c6691e32ec040c1c059e57abdea49cfb2b6547e2749a903c7dee43a5e99e3f286581af018eded8a77c4517e8f62ef3cda6dfd598a30ec163
|
7
|
+
data.tar.gz: 898b0bfa66124201994414591be138c7bcad0ee423285285182cd968bf907962580167d46b1cf6a15a329d8ff07f6305f09eb930bfb16f9fc3ab9c4f1e05cd81
|
data/.travis.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
language: ruby
|
2
|
+
|
3
|
+
rvm:
|
4
|
+
- 2.1.2
|
5
|
+
- 2.1.1
|
6
|
+
- 2.1.0
|
7
|
+
- 1.9.3-p547
|
8
|
+
- 1.9.3-p392
|
9
|
+
- 1.9.3-p429
|
10
|
+
- 1.9.3-p448
|
11
|
+
- 1.9.3-p484
|
12
|
+
- 1.9.3-p545
|
13
|
+
|
14
|
+
script: "bundle exec rspec spec"
|
15
|
+
|
16
|
+
notifications:
|
17
|
+
slack: sachin21dev:3pEyff2UFnoCgl4NI0uxbsER
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
# Space2underscore
|
1
|
+
# Space2underscore [![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)
|
2
|
+
|
2
3
|
## What is space2underscore
|
3
4
|
Change the space into underscore.
|
4
5
|
space2underscore is a useful command when you want to check out a branch.
|
@@ -9,15 +10,32 @@ Install it yourself as:
|
|
9
10
|
$ gem install space2underscore
|
10
11
|
|
11
12
|
## Usage
|
12
|
-
|
13
13
|
From the terminal:
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
### 1. e.g. Create the new branch
|
16
|
+
|
17
|
+
```
|
18
|
+
$ space2underscore new branch -c
|
19
|
+
=> Switched to the new branch 'new_branch’
|
20
|
+
```
|
21
|
+
|
22
|
+
Run with `--create` or `-c` options.
|
23
|
+
|
24
|
+
### 2. e.g. Rename the already created a branch
|
25
|
+
|
26
|
+
```
|
27
|
+
$ git branch -m $(space2underscore renamed branch)
|
28
|
+
```
|
29
|
+
|
30
|
+
When option is nothing, space2underscore has outputted to the standard output.
|
31
|
+
|
32
|
+
## Shorthand
|
17
33
|
|
18
|
-
|
34
|
+
A shorthand alias for space2underscore can also be used.
|
19
35
|
|
20
|
-
|
36
|
+
```
|
37
|
+
s2u new branch
|
38
|
+
```
|
21
39
|
|
22
40
|
## Contributing
|
23
41
|
|
data/Rakefile
CHANGED
@@ -1,9 +1,6 @@
|
|
1
|
-
require
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
2
3
|
|
3
|
-
|
4
|
-
require 'rspec/core/rake_task'
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
5
5
|
|
6
|
-
|
7
|
-
RSpec::Core::RakeTask.new(:spec) do |t|
|
8
|
-
t.rspec_opts = ['-c', '-fs']
|
9
|
-
end
|
6
|
+
task default: :spec
|
data/bin/s2u
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'space2underscore'
|
3
|
+
|
4
|
+
CREATE_FLAGS = %w(-c --create)
|
5
|
+
|
6
|
+
args = ARGV.reject { |arg| CREATE_FLAGS.include?(arg) }
|
7
|
+
result = Space2underscore.convert(args)
|
8
|
+
|
9
|
+
if ARGV.empty?
|
10
|
+
Space2underscore.print_usage
|
11
|
+
else
|
12
|
+
if ARGV.include?('-c') || ARGV.include?('--create')
|
13
|
+
Space2underscore.create_new_branch(result)
|
14
|
+
else
|
15
|
+
print result
|
16
|
+
end
|
17
|
+
end
|
data/bin/space2underscore
CHANGED
@@ -6,8 +6,12 @@ CREATE_FLAGS = %w(-c --create)
|
|
6
6
|
args = ARGV.reject { |arg| CREATE_FLAGS.include?(arg) }
|
7
7
|
result = Space2underscore.convert(args)
|
8
8
|
|
9
|
-
if ARGV.
|
10
|
-
Space2underscore.
|
9
|
+
if ARGV.empty?
|
10
|
+
Space2underscore.print_usage
|
11
11
|
else
|
12
|
-
|
12
|
+
if ARGV.include?('-c') || ARGV.include?('--create')
|
13
|
+
Space2underscore.create_new_branch(result)
|
14
|
+
else
|
15
|
+
print result
|
16
|
+
end
|
13
17
|
end
|
data/lib/space2underscore.rb
CHANGED
@@ -1,13 +1,27 @@
|
|
1
1
|
require 'space2underscore/version'
|
2
2
|
|
3
3
|
module Space2underscore
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
4
|
+
def self.convert(argv)
|
5
|
+
argv.length == 1 ? argv[0].strip.gsub(/\s/, '_') : argv.join('_')
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.create_new_branch(underscore_include_sentence)
|
9
|
+
system "git checkout -b #{underscore_include_sentence}"
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.print_usage
|
13
|
+
message = <<-EOF
|
14
|
+
space2underscore #{Space2underscore::VERSION}
|
15
|
+
Usage: space2underscore <branch name> <options>
|
16
|
+
|
17
|
+
$ space2underscore new branch -c # Run with `--create` or `-c` options.
|
18
|
+
=> Switched to the new branch 'new_branch’
|
19
|
+
|
20
|
+
Or
|
21
|
+
|
22
|
+
$ git branch -m $(space2underscore renamed branch) # space2underscore has outputted to the standard output.
|
23
|
+
EOF
|
24
|
+
|
25
|
+
print message.gsub(' ', '')
|
12
26
|
end
|
13
27
|
end
|
data/space2underscore.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Space2underscore::VERSION
|
9
9
|
spec.authors = ['sachin21']
|
10
10
|
spec.email = ['sachin21.developer@gmail.com']
|
11
|
-
spec.description = '
|
12
|
-
spec.summary = '
|
11
|
+
spec.description = 'Change the space into underscore'
|
12
|
+
spec.summary = 'Change the space into underscore'
|
13
13
|
spec.homepage = 'http://github.com/sachin21/space2underscore'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
@@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
|
|
34
34
|
|
35
35
|
Or
|
36
36
|
|
37
|
-
$ git branch -m $(space2underscore renamed branch) #
|
37
|
+
$ git branch -m $(space2underscore renamed branch) # space2underscore has outputted to the standard output.
|
38
38
|
|
39
39
|
----------------------------------------------------------
|
40
40
|
..........................................................
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Space2underscore do
|
4
|
-
it '
|
4
|
+
it 'returns underscore included in string' do
|
5
5
|
expect(Space2underscore.convert(['fuga hoge foo'])).to include('_') # String case
|
6
6
|
expect(Space2underscore.convert(%w(fuga hoge foo))).to include('_') # Array case
|
7
7
|
end
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sachin21
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,21 +66,23 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
description:
|
69
|
+
description: Change the space into underscore
|
70
70
|
email:
|
71
71
|
- sachin21.developer@gmail.com
|
72
72
|
executables:
|
73
|
+
- s2u
|
73
74
|
- space2underscore
|
74
75
|
extensions: []
|
75
76
|
extra_rdoc_files: []
|
76
77
|
files:
|
77
78
|
- ".gitignore"
|
78
|
-
- ".magnum.yml"
|
79
79
|
- ".rspec"
|
80
|
+
- ".travis.yml"
|
80
81
|
- Gemfile
|
81
82
|
- LICENSE.txt
|
82
83
|
- README.md
|
83
84
|
- Rakefile
|
85
|
+
- bin/s2u
|
84
86
|
- bin/space2underscore
|
85
87
|
- lib/space2underscore.rb
|
86
88
|
- lib/space2underscore/version.rb
|
@@ -96,9 +98,10 @@ post_install_message: "\n ___________________________________________________
|
|
96
98
|
\ Thank you for installing space2underscore.\n\n *************************
|
97
99
|
Usage **************************\n\n From the terminal:\n\n $ space2underscore
|
98
100
|
new branch -c\n => Switched to the new branch 'new_branch’\n\n Or\n\n $
|
99
|
-
git branch -m $(space2underscore renamed branch) #
|
100
|
-
\
|
101
|
-
\ __________________________________________________________\n
|
101
|
+
git branch -m $(space2underscore renamed branch) # space2underscore has outputted
|
102
|
+
to the standard output.\n\n ----------------------------------------------------------\n
|
103
|
+
\ ..........................................................\n __________________________________________________________\n
|
104
|
+
\ "
|
102
105
|
rdoc_options: []
|
103
106
|
require_paths:
|
104
107
|
- lib
|
@@ -114,10 +117,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
117
|
version: '0'
|
115
118
|
requirements: []
|
116
119
|
rubyforge_project:
|
117
|
-
rubygems_version: 2.
|
120
|
+
rubygems_version: 2.4.5
|
118
121
|
signing_key:
|
119
122
|
specification_version: 4
|
120
|
-
summary:
|
123
|
+
summary: Change the space into underscore
|
121
124
|
test_files:
|
122
125
|
- spec/space2underscore_spec.rb
|
123
126
|
- spec/spec_helper.rb
|
data/.magnum.yml
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
ruby: 2.1.2
|
2
|
-
ruby: 2.1.1
|
3
|
-
ruby: 2.1.0
|
4
|
-
ruby: 1.9.3-p547
|
5
|
-
ruby: 1.9.3-p392
|
6
|
-
ruby: 1.9.3-p429
|
7
|
-
ruby: 1.9.3-p448
|
8
|
-
ruby: 1.9.3-p484
|
9
|
-
ruby: 1.9.3-p545
|
10
|
-
|
11
|
-
before_install:
|
12
|
-
- rvm install 2.1.2
|
13
|
-
- rvm install 2.1.1
|
14
|
-
- rvm install 2.1.0
|
15
|
-
- rvm install 1.9.3-p547
|
16
|
-
- rvm install 1.9.3-p392
|
17
|
-
- rvm install 1.9.3-p429
|
18
|
-
- rvm install 1.9.3-p448
|
19
|
-
- rvm install 1.9.3-p484
|
20
|
-
- rvm install 1.9.3-p545
|
21
|
-
|
22
|
-
install:
|
23
|
-
- bundle install --path=./vendor/bundle
|
24
|
-
|
25
|
-
script:
|
26
|
-
- bundle exec rspec
|
27
|
-
- rvm use 2.1.2
|
28
|
-
- bundle exec rspec
|
29
|
-
- rvm use 2.1.1
|
30
|
-
- bundle exec rspec
|
31
|
-
- rvm use 2.1.0
|
32
|
-
- bundle exec rspec
|
33
|
-
- rvm use 1.9.3-p547
|
34
|
-
- bundle exec rspec
|
35
|
-
- rvm use 1.9.3-p392
|
36
|
-
- bundle exec rspec
|
37
|
-
- rvm use 1.9.3-p429
|
38
|
-
- bundle exec rspec
|
39
|
-
- rvm use 1.9.3-p448
|
40
|
-
- bundle exec rspec
|
41
|
-
- rvm use 1.9.3-p484
|
42
|
-
- bundle exec rspec
|
43
|
-
- rvm use 1.9.3-p545
|