thjalfi 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +35 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +34 -0
- data/LICENSE.txt +22 -0
- data/README.md +91 -0
- data/Rakefile +7 -0
- data/bin/thjalfi +7 -0
- data/lib/thjalfi.rb +5 -0
- data/lib/thjalfi/cli.rb +48 -0
- data/lib/thjalfi/templates/bin/newgem.tt +7 -0
- data/lib/thjalfi/templates/lib/newgem/cli.rb.tt +32 -0
- data/lib/thjalfi/version.rb +3 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/thjalfi_spec.rb +7 -0
- data/thjalfi.gemspec +27 -0
- metadata +132 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 894546c67cdfa7fd5700b1879db5ded6daeb5d0d
|
4
|
+
data.tar.gz: 53145806eee2e0dbb175f9a985057f22b989b3d8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9d8d80dbaf512db07500cbd092703a05f091a000d9870870392cafe49c13d7a9b1aec63012aa0949a4351cc4f4bab9a4683b3c9b13727b605931fc31e5dd11b9
|
7
|
+
data.tar.gz: 112c3126b95c580e94ba2d9313ce6595a77462fcb16adbc77728f4ccab8a51c14ce16760f043d322a7298784e159d5097dfd242077de08bad44db883e1b83824
|
data/.gitignore
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/test/tmp/
|
9
|
+
/test/version_tmp/
|
10
|
+
/tmp/
|
11
|
+
|
12
|
+
## Specific to RubyMotion:
|
13
|
+
.dat*
|
14
|
+
.repl_history
|
15
|
+
build/
|
16
|
+
|
17
|
+
## Documentation cache and generated files:
|
18
|
+
/.yardoc/
|
19
|
+
/_yardoc/
|
20
|
+
/doc/
|
21
|
+
/rdoc/
|
22
|
+
|
23
|
+
## Environment normalisation:
|
24
|
+
/.bundle/
|
25
|
+
/lib/bundler/man/
|
26
|
+
/vendor/bundle
|
27
|
+
|
28
|
+
# for a library or gem, you might want to ignore these files since the code is
|
29
|
+
# intended to run in multiple environments; otherwise, check them in:
|
30
|
+
# Gemfile.lock
|
31
|
+
# .ruby-version
|
32
|
+
# .ruby-gemset
|
33
|
+
|
34
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
35
|
+
.rvmrc
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
thjalfi (0.0.1)
|
5
|
+
bundler
|
6
|
+
thor
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
diff-lcs (1.2.5)
|
12
|
+
rake (10.3.2)
|
13
|
+
rspec (3.0.0)
|
14
|
+
rspec-core (~> 3.0.0)
|
15
|
+
rspec-expectations (~> 3.0.0)
|
16
|
+
rspec-mocks (~> 3.0.0)
|
17
|
+
rspec-core (3.0.3)
|
18
|
+
rspec-support (~> 3.0.0)
|
19
|
+
rspec-expectations (3.0.3)
|
20
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
21
|
+
rspec-support (~> 3.0.0)
|
22
|
+
rspec-mocks (3.0.3)
|
23
|
+
rspec-support (~> 3.0.0)
|
24
|
+
rspec-support (3.0.3)
|
25
|
+
thor (0.19.1)
|
26
|
+
|
27
|
+
PLATFORMS
|
28
|
+
ruby
|
29
|
+
|
30
|
+
DEPENDENCIES
|
31
|
+
bundler (~> 1.6)
|
32
|
+
rake (~> 10.0)
|
33
|
+
rspec
|
34
|
+
thjalfi!
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 arukoh
|
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,91 @@
|
|
1
|
+
# Thjalfi
|
2
|
+
|
3
|
+
Thhjalfi is skeleton generator of CLI gem use Thor.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'thjalfi'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install thjalfi
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
```
|
24
|
+
$ thjalfi new sample
|
25
|
+
create sample/Gemfile
|
26
|
+
create sample/Rakefile
|
27
|
+
create sample/LICENSE.txt
|
28
|
+
create sample/README.md
|
29
|
+
create sample/.gitignore
|
30
|
+
create sample/sample.gemspec
|
31
|
+
create sample/lib/sample.rb
|
32
|
+
create sample/lib/sample/version.rb
|
33
|
+
Initializing git repo in /path/to/sample
|
34
|
+
create sample/bin/sample
|
35
|
+
create sample/lib/sample/cli.rb
|
36
|
+
```
|
37
|
+
|
38
|
+
```
|
39
|
+
$ cd sample/
|
40
|
+
$ bin/sample
|
41
|
+
Commands:
|
42
|
+
sample goodbye # say goodbye to the world
|
43
|
+
sample hello NAME --from=FROM # say hello to NAME
|
44
|
+
sample help [COMMAND] # Describe available commands or one specific command
|
45
|
+
|
46
|
+
Options:
|
47
|
+
[--verbose], [--no-verbose]
|
48
|
+
```
|
49
|
+
|
50
|
+
```
|
51
|
+
$ bin/sample help hello
|
52
|
+
Usage:
|
53
|
+
sample hello NAME --from=FROM
|
54
|
+
|
55
|
+
Options:
|
56
|
+
--from=FROM
|
57
|
+
[--yell], [--no-yell]
|
58
|
+
[--verbose], [--no-verbose]
|
59
|
+
|
60
|
+
say hello to NAME
|
61
|
+
```
|
62
|
+
|
63
|
+
```
|
64
|
+
$ bin/sample hello world --from arukoh
|
65
|
+
from: arukoh
|
66
|
+
Hello world
|
67
|
+
```
|
68
|
+
|
69
|
+
```
|
70
|
+
$ bin/sample help goodbye
|
71
|
+
Usage:
|
72
|
+
sample goodbye
|
73
|
+
|
74
|
+
Options:
|
75
|
+
[--verbose], [--no-verbose]
|
76
|
+
|
77
|
+
say goodbye to the world
|
78
|
+
```
|
79
|
+
|
80
|
+
```
|
81
|
+
$ bin/sample goodbye
|
82
|
+
Goodbye World
|
83
|
+
```
|
84
|
+
|
85
|
+
## Contributing
|
86
|
+
|
87
|
+
1. Fork it ( https://github.com/[my-github-username]/thjalfi/fork )
|
88
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
89
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
90
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
91
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/thjalfi
ADDED
data/lib/thjalfi.rb
ADDED
data/lib/thjalfi/cli.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require "thor"
|
2
|
+
require 'bundler/cli'
|
3
|
+
|
4
|
+
module Thjalfi
|
5
|
+
class CLI < Thor
|
6
|
+
include Thor::Actions
|
7
|
+
|
8
|
+
def self.source_root
|
9
|
+
File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
|
10
|
+
end
|
11
|
+
|
12
|
+
desc "new GEM_NAME", "Creates a skeleton for creating a CLI rubygem"
|
13
|
+
option :ext, type: :boolean, aliases: '-e', default: false,
|
14
|
+
desc: "Generate the boilerplate for C extension code"
|
15
|
+
option :test, type: :string, aliases: '-t', lazy_default: 'rspec',
|
16
|
+
desc: "Generate a test directory for your library: 'rspec' is the default, but 'minitest' is also supported."
|
17
|
+
def new(name)
|
18
|
+
argv = ["gem", name]
|
19
|
+
argv << "--ext" if options[:ext]
|
20
|
+
argv += ["-t", options[:test]] if options[:text]
|
21
|
+
Bundler::CLI.start(argv)
|
22
|
+
|
23
|
+
target = Pathname.pwd.join(name)
|
24
|
+
return unless File.directory?(target)
|
25
|
+
|
26
|
+
name = name.chomp("/")
|
27
|
+
namespaced_path = name.tr('-', '/')
|
28
|
+
constant_name = name.split('_').map{|p| p[0..0].upcase + p[1..-1] }.join
|
29
|
+
constant_name = constant_name.split('-').map{|q| q[0..0].upcase + q[1..-1] }.join('::') if constant_name =~ /-/
|
30
|
+
constant_array = constant_name.split('::')
|
31
|
+
opts = {
|
32
|
+
namespaced_path: namespaced_path,
|
33
|
+
constant_name: constant_name,
|
34
|
+
constant_array: constant_array,
|
35
|
+
}
|
36
|
+
|
37
|
+
templates = {
|
38
|
+
"bin/newgem.tt" => "bin/#{name}",
|
39
|
+
"lib/newgem/cli.rb.tt" => "lib/#{namespaced_path}/cli.rb",
|
40
|
+
}
|
41
|
+
|
42
|
+
templates.each do |src, dst|
|
43
|
+
template(src, target.join(dst), opts)
|
44
|
+
end
|
45
|
+
Dir.chdir(target) { `chmod +x bin/#{name}; git add .` }
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
<%- config[:constant_array].each_with_index do |c,i| -%>
|
4
|
+
<%= ' '*i %>module <%= c %>
|
5
|
+
<%- end -%>
|
6
|
+
# Sample CLI class.
|
7
|
+
# See also: http://whatisthor.com/
|
8
|
+
class CLI < Thor
|
9
|
+
class_option :verbose, :type => :boolean
|
10
|
+
|
11
|
+
desc "hello NAME", "say hello to NAME"
|
12
|
+
options :from => :required, :yell => :boolean
|
13
|
+
def hello(name)
|
14
|
+
puts "> saying hello" if options[:verbose]
|
15
|
+
output = []
|
16
|
+
output << "from: #{options[:from]}" if options[:from]
|
17
|
+
output << "Hello #{name}"
|
18
|
+
output = output.join("\n")
|
19
|
+
puts options[:yell] ? output.upcase : output
|
20
|
+
puts "> done saying hello" if options[:verbose]
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "goodbye", "say goodbye to the world"
|
24
|
+
def goodbye
|
25
|
+
puts "> saying goodbye" if options[:verbose]
|
26
|
+
puts "Goodbye World"
|
27
|
+
puts "> done saying goodbye" if options[:verbose]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
<%- (config[:constant_array].size-1).downto(0) do |i| -%>
|
31
|
+
<%= ' '*i %>end
|
32
|
+
<%- end -%>
|
data/spec/spec_helper.rb
ADDED
data/thjalfi.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'thjalfi/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "thjalfi"
|
8
|
+
spec.version = Thjalfi::VERSION
|
9
|
+
spec.authors = ["arukoh"]
|
10
|
+
spec.email = ["arukoh10@gmail.com"]
|
11
|
+
spec.summary = %q{Thhjalfi is skeleton generator of CLI gem use Thor.}
|
12
|
+
spec.description = %q{Thhjalfi is skeleton generator of CLI gem use Thor.}
|
13
|
+
spec.homepage = "https://github.com/arukoh/thjalfi"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
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.add_dependency "bundler"
|
22
|
+
spec.add_dependency "thor"
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "rspec"
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: thjalfi
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- arukoh
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-01 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: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: thor
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
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: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.6'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.6'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
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: Thhjalfi is skeleton generator of CLI gem use Thor.
|
84
|
+
email:
|
85
|
+
- arukoh10@gmail.com
|
86
|
+
executables:
|
87
|
+
- thjalfi
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- .gitignore
|
92
|
+
- Gemfile
|
93
|
+
- Gemfile.lock
|
94
|
+
- LICENSE.txt
|
95
|
+
- README.md
|
96
|
+
- Rakefile
|
97
|
+
- bin/thjalfi
|
98
|
+
- lib/thjalfi.rb
|
99
|
+
- lib/thjalfi/cli.rb
|
100
|
+
- lib/thjalfi/templates/bin/newgem.tt
|
101
|
+
- lib/thjalfi/templates/lib/newgem/cli.rb.tt
|
102
|
+
- lib/thjalfi/version.rb
|
103
|
+
- spec/spec_helper.rb
|
104
|
+
- spec/thjalfi_spec.rb
|
105
|
+
- thjalfi.gemspec
|
106
|
+
homepage: https://github.com/arukoh/thjalfi
|
107
|
+
licenses:
|
108
|
+
- MIT
|
109
|
+
metadata: {}
|
110
|
+
post_install_message:
|
111
|
+
rdoc_options: []
|
112
|
+
require_paths:
|
113
|
+
- lib
|
114
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - '>='
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - '>='
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
requirements: []
|
125
|
+
rubyforge_project:
|
126
|
+
rubygems_version: 2.0.3
|
127
|
+
signing_key:
|
128
|
+
specification_version: 4
|
129
|
+
summary: Thhjalfi is skeleton generator of CLI gem use Thor.
|
130
|
+
test_files:
|
131
|
+
- spec/spec_helper.rb
|
132
|
+
- spec/thjalfi_spec.rb
|