space2underscore 0.0.5 → 0.0.6
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 +4 -4
- data/.rspec +2 -0
- data/README.md +18 -0
- data/Rakefile +9 -1
- data/bin/space2underscore +1 -1
- data/lib/space2underscore/version.rb +1 -1
- data/lib/space2underscore.rb +2 -2
- data/space2underscore.gemspec +11 -10
- data/spec/space2underscore_spec.rb +8 -0
- data/spec/spec_helper.rb +14 -0
- metadata +22 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86ff16536a69bdcb282f7c4bfbfa874998ea6287
|
4
|
+
data.tar.gz: cc876ae811e74eb85941f3372a3c7ab7d3e67830
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8326a13c042c63b6afd8a44053f1ed67276f2f75a619c8503bfe63ef6032b2fb26d93da36e8657ff46be52e892f77f9c8df39d985a6b2ef45212850412778ba4
|
7
|
+
data.tar.gz: 72cf2ce70a187d41bafd86c39ad8c6f834d0ce36fd9e1facf16e41eae825c5ff18b52a21d9e634bab1549808c3e70dc6faf3b3b04d66d39c7c3b1c02d1c136b6
|
data/.rspec
ADDED
data/README.md
CHANGED
@@ -16,6 +16,23 @@ Or install it yourself as:
|
|
16
16
|
|
17
17
|
$ gem install space2underscore
|
18
18
|
|
19
|
+
If your computer is linux
|
20
|
+
|
21
|
+
$ sudo apt-get install xclip
|
22
|
+
|
23
|
+
You need alias
|
24
|
+
|
25
|
+
$ alias pbcopy='xclip -selection clipboard'
|
26
|
+
|
27
|
+
$ alias pbpaste='xclip -selection clipboard -o'
|
28
|
+
|
29
|
+
## How to use
|
30
|
+
|
31
|
+
From the terminal:
|
32
|
+
|
33
|
+
$ space2underscore target sentence
|
34
|
+
=> target_sentence # copied to the clipboard
|
35
|
+
|
19
36
|
## Contributing
|
20
37
|
|
21
38
|
1. Fork it
|
@@ -23,3 +40,4 @@ Or install it yourself as:
|
|
23
40
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
24
41
|
4. Push to the branch (`git push origin my-new-feature`)
|
25
42
|
5. Create new Pull Request
|
43
|
+
|
data/Rakefile
CHANGED
data/bin/space2underscore
CHANGED
data/lib/space2underscore.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
require
|
1
|
+
require 'space2underscore/version'
|
2
2
|
|
3
3
|
module Space2underscore
|
4
4
|
def self.convert_to_underscore(argv)
|
5
5
|
space_include_sentence = argv.length == 1 ? argv.first.gsub(/\s/, '_') : argv.join('_')
|
6
|
-
copy_command =
|
6
|
+
copy_command = "echo #{space_include_sentence} | ruby -pe 'chomp' | pbcopy"
|
7
7
|
return space_include_sentence, copy_command
|
8
8
|
end
|
9
9
|
end
|
data/space2underscore.gemspec
CHANGED
@@ -4,20 +4,21 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'space2underscore/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'space2underscore'
|
8
8
|
spec.version = Space2underscore::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
11
|
-
spec.description =
|
12
|
-
spec.summary =
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
9
|
+
spec.authors = ['sachin21']
|
10
|
+
spec.email = ['sachin21.developer@gmail.com']
|
11
|
+
spec.description = 'Convert to underscore the space'
|
12
|
+
spec.summary = 'Convert to underscore the space'
|
13
|
+
spec.homepage = ''
|
14
|
+
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = [
|
19
|
+
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_development_dependency
|
22
|
-
spec.add_development_dependency
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
22
|
+
spec.add_development_dependency 'rake'
|
23
|
+
spec.add_development_dependency 'rspec'
|
23
24
|
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Space2underscore do
|
4
|
+
it 'Successful execution' do
|
5
|
+
expect(Space2underscore.convert_to_underscore(['fuga hoge foo']).first).to eq('fuga_hoge_foo') # String case
|
6
|
+
expect(Space2underscore.convert_to_underscore(%w(fuga hoge foo)).first).to eq('fuga_hoge_foo') # Array case
|
7
|
+
end
|
8
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
require 'space2underscore'
|
3
|
+
Bundler.setup
|
4
|
+
|
5
|
+
RSpec.configure do |config|
|
6
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
7
|
+
config.run_all_when_everything_filtered = true
|
8
|
+
config.filter_run :focus
|
9
|
+
config.order = 'random'
|
10
|
+
|
11
|
+
config.expect_with :rspec do |rspec|
|
12
|
+
rspec.syntax = :expect
|
13
|
+
end
|
14
|
+
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.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sachin21
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
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'
|
41
55
|
description: Convert to underscore the space
|
42
56
|
email:
|
43
57
|
- sachin21.developer@gmail.com
|
@@ -47,6 +61,7 @@ extensions: []
|
|
47
61
|
extra_rdoc_files: []
|
48
62
|
files:
|
49
63
|
- .gitignore
|
64
|
+
- .rspec
|
50
65
|
- Gemfile
|
51
66
|
- LICENSE.txt
|
52
67
|
- README.md
|
@@ -55,6 +70,8 @@ files:
|
|
55
70
|
- lib/space2underscore.rb
|
56
71
|
- lib/space2underscore/version.rb
|
57
72
|
- space2underscore.gemspec
|
73
|
+
- spec/space2underscore_spec.rb
|
74
|
+
- spec/spec_helper.rb
|
58
75
|
homepage: ''
|
59
76
|
licenses:
|
60
77
|
- MIT
|
@@ -79,4 +96,6 @@ rubygems_version: 2.0.2
|
|
79
96
|
signing_key:
|
80
97
|
specification_version: 4
|
81
98
|
summary: Convert to underscore the space
|
82
|
-
test_files:
|
99
|
+
test_files:
|
100
|
+
- spec/space2underscore_spec.rb
|
101
|
+
- spec/spec_helper.rb
|