space2underscore 0.2.0 → 0.2.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: d2738908178f6199a9b3237597ab4c34c13edc87
4
- data.tar.gz: 22f3fdb477ad34dc564bcdb4d25fe324b00573bd
3
+ metadata.gz: d8e7442b6358f4bb2fc54e592a4197266541618b
4
+ data.tar.gz: badb4e88737c2d1558e17f7a9cf0a6665f7da8c7
5
5
  SHA512:
6
- metadata.gz: 23c73e4ab92821e8e32ab31714683fb1d1bb5d594f0fec68c2ffdf00221e32002f6122c9e174a325e07cd1738d20d2b763e372ce442683146c0cf53d67ca1b93
7
- data.tar.gz: 2b833e905a46468bed9d3a0eab95d73d7bd73e293e630c9512b71a67c40b27a7b1ee19c8a549b71cdabb78dfd2f5a6bb34fdf81f450df1efc8b39cc9f87c4f28
6
+ metadata.gz: 4d7f099abbc3f07e4d2255853cd35820f6348524d279b2cfd014efb23c99e576c1b31ed61aa4b6c9b6cb66ca2eda9974c8c6843f44038cb0c74976231f38fbc2
7
+ data.tar.gz: 0a6aff6aa29cb919cdf62f69f2f54b26a4006d20e63a293d9c625c2878da77ab18c1f74be317086e02b89b26aa7fa5ee7d44ccc1a2ba34ad622d60818aaa7c49
data/README.md CHANGED
@@ -1,7 +1,9 @@
1
1
  # Space2underscore
2
- ## What
2
+ ## What is space2underscore
3
3
  Change the space into underscore.
4
4
 
5
+ space2underscore is a useful command when you want to check out a branch.
6
+
5
7
  ## Installation
6
8
 
7
9
  Add this line to your application's Gemfile:
@@ -28,17 +30,10 @@ If your computer is CentOS then
28
30
 
29
31
  From the terminal:
30
32
 
31
- $ space2underscore target sentence
32
- => target_sentence # copied to the clipboard
33
-
34
- # Example of use
35
-
36
- ![example of use](http://i.imgur.com/1teIk4j.png)
37
-
38
- From the terminal:
39
-
40
- $ space2underscore add stock function to user feed # underscore included branch name is copied to clipboard
41
- $ git checkout -b add_stock_function_to_user_feed # paste
33
+ $ space2underscore new branch
34
+ => Do you create the new branch? [y/Y] # y
35
+ => Switched to the new branch 'new_branch’
36
+ => Branch has been created.
42
37
 
43
38
  ## Contributing
44
39
 
@@ -47,4 +42,3 @@ From the terminal:
47
42
  3. Commit your changes (`git commit -am 'Add some feature'`)
48
43
  4. Push to the branch (`git push origin my-new-feature`)
49
44
  5. Create new Pull Request
50
-
data/bin/space2underscore CHANGED
@@ -3,6 +3,4 @@
3
3
  require 'space2underscore'
4
4
 
5
5
  result = Space2underscore.convert(ARGV)
6
- command = Space2underscore.generate_command(result)
7
6
  puts Space2underscore.create_new_branch(result)
8
- system(command)
@@ -10,6 +10,10 @@ module Space2underscore
10
10
  "echo #{underscore_include_sentence} | ruby -pe 'chomp' | #{copy_cmd}"
11
11
  end
12
12
 
13
+ def execute_command(command)
14
+ system command
15
+ end
16
+
13
17
  def copy_cmd
14
18
  if system("type pbcopy > /dev/null 2>&1")
15
19
  "pbcopy"
@@ -20,14 +24,16 @@ module Space2underscore
20
24
  end
21
25
  end
22
26
 
23
- def create_new_branch(branch)
27
+ def create_new_branch(underscore_include_sentence)
24
28
  print "Do you create the new branch? [y/Y]"
25
29
  flag = $stdin.gets.chomp
26
30
 
27
- if flag == "y" || flag == "Y"
28
- system "git checkout -b #{branch}"
31
+ if !!(flag =~ /^y(es)?$/i) || flag == ''
32
+ system "git checkout -b #{underscore_include_sentence}"
29
33
  "Branch has been created."
30
34
  else
35
+ execute_command(generate_command(underscore_include_sentence))
36
+
31
37
  "Branch name has been copied to clipboard."
32
38
  end
33
39
  end
@@ -1,3 +1,3 @@
1
1
  module Space2underscore
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  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.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - sachin21
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-02 00:00:00.000000000 Z
11
+ date: 2015-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler