space2hyphen 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 13e6a2da8a7d297aec1004d2cc32bc8604923711
4
+ data.tar.gz: 4c82023d3d06f441e52f37c92fcedd9900f64ab7
5
+ SHA512:
6
+ metadata.gz: 037f76cffcf6421442dddb8c8dbcddf526afa9887bf891adc1488823ae6f3b9dd4f51de734f36bbdab67833aab47cc8723ce96cfce9b12a60229ca7a81fcbb12
7
+ data.tar.gz: b38751e108f68e737480d33136929c1184981980090b7e69f090ab32e3da59e0fd4a4c78cff5042e4393ac6640b702b7ca4c3f0eed7410c0e159a9a9640d1b41
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ /vendor/bundle
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/.rubocop.yml ADDED
@@ -0,0 +1,6 @@
1
+ AllCops:
2
+ Exclude:
3
+ - 'vendor/**/*'
4
+
5
+ Style/Encoding:
6
+ Enabled: true
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:PVRFTzXu4ovOOkZYJ6fCISbq
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # coding: utf-8
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Satoshi Ohmori
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # Space2hyphen [![Build Status](https://travis-ci.org/sachin21/space2hyphen.svg?branch=master)](https://travis-ci.org/sachin21/space2hyphen)
2
+ ## What is space2hyphen
3
+ Change the space into hyphen.
4
+ space2hyphen is a useful command when you want to check out a branch.
5
+
6
+ ## Installation
7
+ Install it yourself as:
8
+
9
+ ```
10
+ $ gem install space2hyphen
11
+ ```
12
+
13
+ ## Usage
14
+ From the terminal:
15
+
16
+ ### 1. e.g. Create the new branch
17
+
18
+ ```
19
+ $ space2hyphen new branch -c
20
+ => Switched to the new branch 'new_branch’
21
+ ```
22
+
23
+ Run with `--create` or `-c` options.
24
+
25
+ ### 2. e.g. Rename the already created a branch
26
+
27
+ ```
28
+ $ git branch -m $(space2hyphen renamed branch)
29
+ ```
30
+
31
+ When option is nothing, space2hyphen has outputted to the standard output.
32
+
33
+ ## Shorthand
34
+
35
+ A shorthand alias for space2hyphen can also be used.
36
+
37
+ ```
38
+ s2h new branch
39
+ ```
40
+
41
+ ## Credits
42
+ - Installed information based on [Tmuxinator](https://github.com/tmuxinator/tmuxinator)
43
+
44
+ ## Contributing
45
+
46
+ 1. Fork it
47
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
48
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
49
+ 4. Push to the branch (`git push origin my-new-feature`)
50
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # coding: utf-8
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
data/bin/s2h ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby
2
+ # coding: utf-8
3
+
4
+ require 'space2hyphen'
5
+
6
+ CREATE_FLAGS = %w(-c --create)
7
+
8
+ args = ARGV.reject { |arg| CREATE_FLAGS.include?(arg) }
9
+ hyphen_include_sentence = Space2hyphen.convert(args)
10
+
11
+ result =
12
+ if ARGV.include?('-c') || ARGV.include?('--create')
13
+ if Space2hyphen.create_new_branch(hyphen_include_sentence)
14
+ "Switched to a new branch '#{hyphen_include_sentence}'"
15
+ else
16
+ "fatal: A branch named '#{hyphen_include_sentence}' already exists."
17
+ end
18
+ else
19
+ hyphen_include_sentence
20
+ end
21
+
22
+ puts result
data/bin/space2hyphen ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby
2
+ # coding: utf-8
3
+
4
+ require 'space2hyphen'
5
+
6
+ CREATE_FLAGS = %w(-c --create)
7
+
8
+ args = ARGV.reject { |arg| CREATE_FLAGS.include?(arg) }
9
+ hyphen_include_sentence = Space2hyphen.convert(args)
10
+
11
+ result =
12
+ if ARGV.include?('-c') || ARGV.include?('--create')
13
+ if Space2hyphen.create_new_branch(hyphen_include_sentence)
14
+ "Switched to a new branch '#{hyphen_include_sentence}'"
15
+ else
16
+ "fatal: A branch named '#{hyphen_include_sentence}' already exists."
17
+ end
18
+ else
19
+ hyphen_include_sentence
20
+ end
21
+
22
+ puts result
@@ -0,0 +1,6 @@
1
+ # coding: utf-8
2
+
3
+ # This module holds the Space2hyphen version information.
4
+ module Space2hyphen
5
+ VERSION = '0.0.1'
6
+ end
@@ -0,0 +1,14 @@
1
+ # coding: utf-8
2
+
3
+ require 'space2hyphen/version'
4
+
5
+ # This is the main functions.
6
+ module Space2hyphen
7
+ def self.convert(argv)
8
+ argv.length == 1 ? argv[0].strip.gsub(/\s/, '-') : argv.join('-')
9
+ end
10
+
11
+ def self.create_new_branch(hyphen_include_sentence)
12
+ system "git checkout -b #{hyphen_include_sentence} &> /dev/null"
13
+ end
14
+ end
@@ -0,0 +1,47 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'space2hyphen/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'space2hyphen'
8
+ spec.version = Space2hyphen::VERSION
9
+ spec.authors = ['sachin21']
10
+ spec.email = ['sachin21.developer@gmail.com']
11
+ spec.description = 'Change the space into hyphen'
12
+ spec.summary = 'Change the space into hyphen'
13
+ spec.homepage = 'http://github.com/sachin21/space2hyphen'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files`.split($RS)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.post_install_message = <<-EOF.gsub(' ', '')
22
+ ..........................................................
23
+ __________________________________________________________
24
+
25
+ Thank you for installing space2hyphen.
26
+
27
+ ************************* Usage **************************
28
+
29
+ From the command line:
30
+
31
+ $ space2hyphen new branch -c
32
+ => Switched to the new branch 'new-branch’
33
+
34
+ Or
35
+
36
+ $ git branch -m $(space2hyphen renamed branch)
37
+
38
+ ----------------------------------------------------------
39
+ ..........................................................
40
+ EOF
41
+
42
+ spec.add_development_dependency 'bundler', '~> 1.3'
43
+ spec.add_development_dependency 'rake'
44
+ spec.add_development_dependency 'rspec'
45
+ spec.add_development_dependency 'pry'
46
+ spec.add_development_dependency 'rubocop'
47
+ end
@@ -0,0 +1,44 @@
1
+ # coding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Space2hyphen do
6
+ let(:branch_name) { 'foo-bar' }
7
+ let(:hidden) { '&> /dev/null' }
8
+
9
+ it 'returns hyphen included in string' do
10
+ expect(Space2hyphen.convert(['fuga hoge foo'])).to include('-')
11
+ expect(Space2hyphen.convert(%w(fuga hoge foo))).to include('-')
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(Space2hyphen.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(Space2hyphen.create_new_branch(branch_name)).to be_falsey
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,12 @@
1
+ # coding: utf-8
2
+
3
+ require 'bundler/setup'
4
+ require 'space2hyphen'
5
+ Bundler.setup
6
+
7
+ RSpec.configure do |config|
8
+ config.order = 'random'
9
+ config.expect_with :rspec do |rspec|
10
+ rspec.syntax = :expect
11
+ end
12
+ end
metadata ADDED
@@ -0,0 +1,151 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: space2hyphen
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - sachin21
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-12-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
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: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Change the space into hyphen
84
+ email:
85
+ - sachin21.developer@gmail.com
86
+ executables:
87
+ - s2h
88
+ - space2hyphen
89
+ extensions: []
90
+ extra_rdoc_files: []
91
+ files:
92
+ - ".gitignore"
93
+ - ".rspec"
94
+ - ".rubocop.yml"
95
+ - ".travis.yml"
96
+ - Gemfile
97
+ - LICENSE.txt
98
+ - README.md
99
+ - Rakefile
100
+ - bin/s2h
101
+ - bin/space2hyphen
102
+ - lib/space2hyphen.rb
103
+ - lib/space2hyphen/version.rb
104
+ - space2hyphen.gemspec
105
+ - spec/space2dash_spec.rb
106
+ - spec/spec_helper.rb
107
+ homepage: http://github.com/sachin21/space2hyphen
108
+ licenses:
109
+ - MIT
110
+ metadata: {}
111
+ post_install_message: |
112
+ ..........................................................
113
+ __________________________________________________________
114
+
115
+ Thank you for installing space2hyphen.
116
+
117
+ ************************* Usage **************************
118
+
119
+ From the command line:
120
+
121
+ $ space2hyphen new branch -c
122
+ => Switched to the new branch 'new-branch’
123
+
124
+ Or
125
+
126
+ $ git branch -m $(space2hyphen renamed branch)
127
+
128
+ ----------------------------------------------------------
129
+ ..........................................................
130
+ rdoc_options: []
131
+ require_paths:
132
+ - lib
133
+ required_ruby_version: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ required_rubygems_version: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
143
+ requirements: []
144
+ rubyforge_project:
145
+ rubygems_version: 2.5.1
146
+ signing_key:
147
+ specification_version: 4
148
+ summary: Change the space into hyphen
149
+ test_files:
150
+ - spec/space2dash_spec.rb
151
+ - spec/spec_helper.rb