rlt 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/exe/rlt +12 -2
- data/lib/rlt/cli.rb +43 -0
- data/lib/rlt/commands/close.rb +94 -0
- data/lib/rlt/commands/{cmt_command.rb → cmt.rb} +12 -38
- data/lib/rlt/commands/switch.rb +57 -0
- data/lib/rlt/config.rb +8 -8
- data/lib/rlt/debug.rb +7 -0
- data/lib/rlt/error.rb +6 -0
- data/lib/rlt/utils/colored_text.rb +29 -0
- data/lib/rlt/utils/git_util.rb +113 -0
- data/lib/rlt/utils/logger.rb +29 -0
- data/lib/rlt/utils/shell.rb +39 -0
- data/lib/rlt/utils/string_util.rb +19 -0
- data/lib/rlt/version.rb +1 -1
- data/lib/rlt.rb +8 -20
- metadata +36 -35
- data/.gitignore +0 -13
- data/.rlt.sample.yml +0 -27
- data/.rspec +0 -3
- data/.rubocop.yml +0 -9
- data/.ruby-version +0 -1
- data/.travis.yml +0 -5
- data/CODE_OF_CONDUCT.md +0 -74
- data/Gemfile +0 -8
- data/Gemfile.lock +0 -78
- data/LICENSE.txt +0 -21
- data/README.md +0 -142
- data/Rakefile +0 -8
- data/bin/console +0 -15
- data/bin/setup +0 -8
- data/lib/rlt/base_command.rb +0 -17
- data/lib/rlt/colored_text.rb +0 -27
- data/lib/rlt/command_runner.rb +0 -37
- data/lib/rlt/commands/switch_command.rb +0 -78
- data/lib/rlt/commands_map.rb +0 -37
- data/lib/rlt/git_native_command_builder.rb +0 -25
- data/lib/rlt/logger.rb +0 -27
- data/lib/rlt/register_aliases.rb +0 -14
- data/lib/rlt/register_commands.rb +0 -25
- data/lib/rlt/shell.rb +0 -23
- data/releases/rlt-0.1.0.tar.gz +0 -0
- data/rlt.gemspec +0 -34
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rlt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Eunjae Lee
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pastel
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.7.2
|
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.20.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.20.0
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: tty-command
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,49 +122,36 @@ dependencies:
|
|
108
122
|
- - ">="
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: '0'
|
111
|
-
description:
|
125
|
+
description: Start using Git on command line again with `rlt`
|
112
126
|
email:
|
113
|
-
-
|
127
|
+
- karis612@gmail.com
|
114
128
|
executables:
|
115
129
|
- rlt
|
116
130
|
extensions: []
|
117
131
|
extra_rdoc_files: []
|
118
132
|
files:
|
119
|
-
- ".gitignore"
|
120
|
-
- ".rlt.sample.yml"
|
121
|
-
- ".rspec"
|
122
|
-
- ".rubocop.yml"
|
123
|
-
- ".ruby-version"
|
124
|
-
- ".travis.yml"
|
125
|
-
- CODE_OF_CONDUCT.md
|
126
|
-
- Gemfile
|
127
|
-
- Gemfile.lock
|
128
|
-
- LICENSE.txt
|
129
|
-
- README.md
|
130
|
-
- Rakefile
|
131
|
-
- bin/console
|
132
|
-
- bin/setup
|
133
133
|
- exe/rlt
|
134
134
|
- lib/rlt.rb
|
135
|
-
- lib/rlt/
|
136
|
-
- lib/rlt/
|
137
|
-
- lib/rlt/
|
138
|
-
- lib/rlt/commands/
|
139
|
-
- lib/rlt/commands/switch_command.rb
|
140
|
-
- lib/rlt/commands_map.rb
|
135
|
+
- lib/rlt/cli.rb
|
136
|
+
- lib/rlt/commands/close.rb
|
137
|
+
- lib/rlt/commands/cmt.rb
|
138
|
+
- lib/rlt/commands/switch.rb
|
141
139
|
- lib/rlt/config.rb
|
142
|
-
- lib/rlt/
|
143
|
-
- lib/rlt/
|
144
|
-
- lib/rlt/
|
145
|
-
- lib/rlt/
|
146
|
-
- lib/rlt/
|
140
|
+
- lib/rlt/debug.rb
|
141
|
+
- lib/rlt/error.rb
|
142
|
+
- lib/rlt/utils/colored_text.rb
|
143
|
+
- lib/rlt/utils/git_util.rb
|
144
|
+
- lib/rlt/utils/logger.rb
|
145
|
+
- lib/rlt/utils/shell.rb
|
146
|
+
- lib/rlt/utils/string_util.rb
|
147
147
|
- lib/rlt/version.rb
|
148
|
-
- releases/rlt-0.1.0.tar.gz
|
149
|
-
- rlt.gemspec
|
150
148
|
homepage: https://github.com/eunjae-lee/rlt
|
151
149
|
licenses:
|
152
150
|
- MIT
|
153
|
-
metadata:
|
151
|
+
metadata:
|
152
|
+
source_code_uri: https://github.com/eunjae-lee/rlt
|
153
|
+
changelog_uri: https://github.com/eunjae-lee/rlt/blob/master/CHANGES.md
|
154
|
+
bug_tracker_uri: https://github.com/eunjae-lee/rlt/issues
|
154
155
|
post_install_message:
|
155
156
|
rdoc_options: []
|
156
157
|
require_paths:
|
@@ -167,8 +168,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
168
|
version: '0'
|
168
169
|
requirements: []
|
169
170
|
rubyforge_project:
|
170
|
-
rubygems_version: 2.
|
171
|
+
rubygems_version: 2.5.1
|
171
172
|
signing_key:
|
172
173
|
specification_version: 4
|
173
|
-
summary:
|
174
|
+
summary: Start using Git on command line again with `rlt`
|
174
175
|
test_files: []
|
data/.gitignore
DELETED
data/.rlt.sample.yml
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
command:
|
2
|
-
switch:
|
3
|
-
branch_name_template: JIRA-<%= branch_name %>
|
4
|
-
exclude:
|
5
|
-
- some_branch
|
6
|
-
- some_other_branch
|
7
|
-
cmt:
|
8
|
-
subject_template: >
|
9
|
-
<%=
|
10
|
-
if branch_name.start_with?('JIRA-')
|
11
|
-
"[#{branch_name}] #{subject}"
|
12
|
-
else
|
13
|
-
subject
|
14
|
-
end
|
15
|
-
%>
|
16
|
-
body_template: >
|
17
|
-
<%=
|
18
|
-
if branch_name.start_with?('JIRA-')
|
19
|
-
"http://myjira.com/#{branch_name}\n\n#{body}"
|
20
|
-
else
|
21
|
-
body
|
22
|
-
end
|
23
|
-
%>
|
24
|
-
alias:
|
25
|
-
br: branch
|
26
|
-
sw: switch
|
27
|
-
l: log --oneline
|
data/.rspec
DELETED
data/.rubocop.yml
DELETED
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.5.0
|
data/.travis.yml
DELETED
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
2
|
-
|
3
|
-
## Our Pledge
|
4
|
-
|
5
|
-
In the interest of fostering an open and welcoming environment, we as
|
6
|
-
contributors and maintainers pledge to making participation in our project and
|
7
|
-
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
-
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
-
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
-
orientation.
|
11
|
-
|
12
|
-
## Our Standards
|
13
|
-
|
14
|
-
Examples of behavior that contributes to creating a positive environment
|
15
|
-
include:
|
16
|
-
|
17
|
-
* Using welcoming and inclusive language
|
18
|
-
* Being respectful of differing viewpoints and experiences
|
19
|
-
* Gracefully accepting constructive criticism
|
20
|
-
* Focusing on what is best for the community
|
21
|
-
* Showing empathy towards other community members
|
22
|
-
|
23
|
-
Examples of unacceptable behavior by participants include:
|
24
|
-
|
25
|
-
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
-
advances
|
27
|
-
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
-
* Public or private harassment
|
29
|
-
* Publishing others' private information, such as a physical or electronic
|
30
|
-
address, without explicit permission
|
31
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
-
professional setting
|
33
|
-
|
34
|
-
## Our Responsibilities
|
35
|
-
|
36
|
-
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
-
behavior and are expected to take appropriate and fair corrective action in
|
38
|
-
response to any instances of unacceptable behavior.
|
39
|
-
|
40
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
-
threatening, offensive, or harmful.
|
45
|
-
|
46
|
-
## Scope
|
47
|
-
|
48
|
-
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
-
when an individual is representing the project or its community. Examples of
|
50
|
-
representing a project or community include using an official project e-mail
|
51
|
-
address, posting via an official social media account, or acting as an appointed
|
52
|
-
representative at an online or offline event. Representation of a project may be
|
53
|
-
further defined and clarified by project maintainers.
|
54
|
-
|
55
|
-
## Enforcement
|
56
|
-
|
57
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at paul@valuepotion.com. All
|
59
|
-
complaints will be reviewed and investigated and will result in a response that
|
60
|
-
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
-
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
-
Further details of specific enforcement policies may be posted separately.
|
63
|
-
|
64
|
-
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
-
faith may face temporary or permanent repercussions as determined by other
|
66
|
-
members of the project's leadership.
|
67
|
-
|
68
|
-
## Attribution
|
69
|
-
|
70
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
-
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
-
|
73
|
-
[homepage]: http://contributor-covenant.org
|
74
|
-
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
rlt (0.1.4)
|
5
|
-
pastel (~> 0.7.2)
|
6
|
-
tty-command (~> 0.8.0)
|
7
|
-
tty-prompt (~> 0.16.1)
|
8
|
-
|
9
|
-
GEM
|
10
|
-
remote: https://rubygems.org/
|
11
|
-
specs:
|
12
|
-
ast (2.4.0)
|
13
|
-
diff-lcs (1.3)
|
14
|
-
equatable (0.5.0)
|
15
|
-
hitimes (1.2.6)
|
16
|
-
necromancer (0.4.0)
|
17
|
-
parallel (1.12.1)
|
18
|
-
parser (2.5.1.0)
|
19
|
-
ast (~> 2.4.0)
|
20
|
-
pastel (0.7.2)
|
21
|
-
equatable (~> 0.5.0)
|
22
|
-
tty-color (~> 0.4.0)
|
23
|
-
powerpack (0.1.1)
|
24
|
-
rainbow (3.0.0)
|
25
|
-
rake (10.5.0)
|
26
|
-
rspec (3.7.0)
|
27
|
-
rspec-core (~> 3.7.0)
|
28
|
-
rspec-expectations (~> 3.7.0)
|
29
|
-
rspec-mocks (~> 3.7.0)
|
30
|
-
rspec-core (3.7.1)
|
31
|
-
rspec-support (~> 3.7.0)
|
32
|
-
rspec-expectations (3.7.0)
|
33
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
-
rspec-support (~> 3.7.0)
|
35
|
-
rspec-mocks (3.7.0)
|
36
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
-
rspec-support (~> 3.7.0)
|
38
|
-
rspec-support (3.7.1)
|
39
|
-
rubocop (0.55.0)
|
40
|
-
parallel (~> 1.10)
|
41
|
-
parser (>= 2.5)
|
42
|
-
powerpack (~> 0.1)
|
43
|
-
rainbow (>= 2.2.2, < 4.0)
|
44
|
-
ruby-progressbar (~> 1.7)
|
45
|
-
unicode-display_width (~> 1.0, >= 1.0.1)
|
46
|
-
ruby-progressbar (1.9.0)
|
47
|
-
timers (4.1.2)
|
48
|
-
hitimes
|
49
|
-
tty-color (0.4.2)
|
50
|
-
tty-command (0.8.0)
|
51
|
-
pastel (~> 0.7.0)
|
52
|
-
tty-cursor (0.5.0)
|
53
|
-
tty-prompt (0.16.1)
|
54
|
-
necromancer (~> 0.4.0)
|
55
|
-
pastel (~> 0.7.0)
|
56
|
-
timers (~> 4.0)
|
57
|
-
tty-cursor (~> 0.5.0)
|
58
|
-
tty-reader (~> 0.3.0)
|
59
|
-
tty-reader (0.3.0)
|
60
|
-
tty-cursor (~> 0.5.0)
|
61
|
-
tty-screen (~> 0.6.4)
|
62
|
-
wisper (~> 2.0.0)
|
63
|
-
tty-screen (0.6.4)
|
64
|
-
unicode-display_width (1.3.2)
|
65
|
-
wisper (2.0.0)
|
66
|
-
|
67
|
-
PLATFORMS
|
68
|
-
ruby
|
69
|
-
|
70
|
-
DEPENDENCIES
|
71
|
-
bundler (~> 1.16)
|
72
|
-
rake (~> 10.0)
|
73
|
-
rlt!
|
74
|
-
rspec (~> 3.0)
|
75
|
-
rubocop
|
76
|
-
|
77
|
-
BUNDLED WITH
|
78
|
-
1.16.1
|
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2018 Paul Lee
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
data/README.md
DELETED
@@ -1,142 +0,0 @@
|
|
1
|
-
# Rlt
|
2
|
-
|
3
|
-
rlt is a git wrapper with convenient methods included.
|
4
|
-
|
5
|
-
## Commands
|
6
|
-
|
7
|
-
### cmt
|
8
|
-
```bash
|
9
|
-
$ rlt cmt
|
10
|
-
Commiting to 'master'
|
11
|
-
|
12
|
-
Subject: Fix a bug where user cannot login
|
13
|
-
Body:
|
14
|
-
> There was a problem at ......
|
15
|
-
>
|
16
|
-
```
|
17
|
-
|
18
|
-
If there's nothing to put as body, you can just hit enter to skip it.
|
19
|
-
|
20
|
-
### switch
|
21
|
-
```bash
|
22
|
-
$ rlt switch <branch_name>
|
23
|
-
```
|
24
|
-
|
25
|
-
This will switch to `<branch_name>`. If the branch does not exist, then it will create it.
|
26
|
-
|
27
|
-
And it automatically stashes uncommitted changes including untracked files switching to other branch.
|
28
|
-
When coming back, it automatically unstashes it.
|
29
|
-
|
30
|
-
## Configuration
|
31
|
-
|
32
|
-
The great power in rlt comes from configuration, using ERB syntax in YAML.
|
33
|
-
|
34
|
-
```yaml
|
35
|
-
command:
|
36
|
-
switch:
|
37
|
-
branch_name_template: feature-<%= branch_name %>
|
38
|
-
cmt:
|
39
|
-
subject_template: My prefix <%= subject %>
|
40
|
-
body_template: <%= body %> http://...
|
41
|
-
alias:
|
42
|
-
br: branch
|
43
|
-
sw: switch
|
44
|
-
l: log --oneline
|
45
|
-
```
|
46
|
-
|
47
|
-
### switch
|
48
|
-
When you type `rlt switch login`, then it will automatically switch to a branch named `feature-login`.
|
49
|
-
* Variable available for `branch_name_template` is `branch_name`.
|
50
|
-
|
51
|
-
### cmt
|
52
|
-
When you `cmt` with subject 'Hello' and body 'World', then the commit message will be:
|
53
|
-
|
54
|
-
```
|
55
|
-
My prefix Hello
|
56
|
-
|
57
|
-
World http://...
|
58
|
-
```
|
59
|
-
|
60
|
-
* Variables available for `subject_template` are `branch_name` and `subject`.
|
61
|
-
* Variables available for `body_template` are `branch_name` and `body`.
|
62
|
-
|
63
|
-
### alias
|
64
|
-
You can define alias as you want.
|
65
|
-
|
66
|
-
### Advanced
|
67
|
-
You can utilize this configuration as you want. Just for your information, you can do things like this:
|
68
|
-
|
69
|
-
```yaml
|
70
|
-
command:
|
71
|
-
switch:
|
72
|
-
branch_name_template: JIRA-<%= branch_name %>
|
73
|
-
cmt:
|
74
|
-
subject_template: >
|
75
|
-
<%=
|
76
|
-
if branch_name.start_with?('JIRA-')
|
77
|
-
"[#{branch_name}] #{subject}"
|
78
|
-
else
|
79
|
-
subject
|
80
|
-
end
|
81
|
-
%>
|
82
|
-
body_template: >
|
83
|
-
<%=
|
84
|
-
if branch_name.start_with?('JIRA-')
|
85
|
-
"http://myjira.com/#{branch_name}\n\n#{body}"
|
86
|
-
else
|
87
|
-
body
|
88
|
-
end
|
89
|
-
%>
|
90
|
-
alias:
|
91
|
-
br: branch
|
92
|
-
sw: switch
|
93
|
-
l: log --oneline
|
94
|
-
```
|
95
|
-
|
96
|
-
If you do `rlt switch 123`, then you'll be in `JIRA-123` branch.
|
97
|
-
|
98
|
-
As long as you're in that branch, when you `cmt` with subject 'Hello' and body 'World', then the commit message will be:
|
99
|
-
|
100
|
-
```
|
101
|
-
[JIRA-123] Hello
|
102
|
-
|
103
|
-
http://myjira.com/JIRA-123
|
104
|
-
|
105
|
-
World
|
106
|
-
```
|
107
|
-
|
108
|
-
This helps you construct commit message with a convention of yours.
|
109
|
-
|
110
|
-
## Installation
|
111
|
-
|
112
|
-
$ gem install rlt
|
113
|
-
|
114
|
-
(not ready yet for brew)
|
115
|
-
|
116
|
-
rlt wraps all the native commands of git. So you can make the alias like the following:
|
117
|
-
|
118
|
-
$ echo "alias git='rlt'" >> ~/.bash_profile && source ~/.bash_profile
|
119
|
-
|
120
|
-
## TODO
|
121
|
-
|
122
|
-
* `undo` : Uncommit latest commit
|
123
|
-
* `close` : Merge this branch into master(or whatever you configure) and delete this branch
|
124
|
-
* any suggestion?
|
125
|
-
|
126
|
-
## Development
|
127
|
-
|
128
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
129
|
-
|
130
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
131
|
-
|
132
|
-
## Contributing
|
133
|
-
|
134
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/eunjae-lee/rlt. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
135
|
-
|
136
|
-
## License
|
137
|
-
|
138
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
139
|
-
|
140
|
-
## Code of Conduct
|
141
|
-
|
142
|
-
Everyone interacting in the Rlt project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/eunjae-lee/rlt/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require 'bundler/setup'
|
5
|
-
require 'rlt'
|
6
|
-
|
7
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
-
# with your gem easier. You can also use a different console, if you like.
|
9
|
-
|
10
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
-
# require "pry"
|
12
|
-
# Pry.start
|
13
|
-
|
14
|
-
require 'irb'
|
15
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
data/lib/rlt/base_command.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Rlt
|
4
|
-
class BaseCommand
|
5
|
-
def self.run(config, *arguments)
|
6
|
-
raise 'implement me'
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.print_help(*arguments)
|
10
|
-
raise 'implement me'
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.valid_parameters?(*arguments)
|
14
|
-
raise 'implement me'
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
data/lib/rlt/colored_text.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'pastel'
|
4
|
-
|
5
|
-
module Rlt
|
6
|
-
class ColoredText
|
7
|
-
def self.verbose(msg)
|
8
|
-
Pastel.new.white(msg)
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.info(msg)
|
12
|
-
Pastel.new.cyan(msg)
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.desc(msg)
|
16
|
-
Pastel.new.magenta(msg)
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.warn(msg)
|
20
|
-
Pastel.new.yellow(msg)
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.error(msg)
|
24
|
-
Pastel.new.red(msg)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
data/lib/rlt/command_runner.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Rlt
|
4
|
-
module CommandRunner
|
5
|
-
def run(argv)
|
6
|
-
command = argv[0]
|
7
|
-
arguments = argv[1..-1]
|
8
|
-
info = Rlt::CommandsMap.get(command)
|
9
|
-
return print_help if info.nil? || info[:class].nil?
|
10
|
-
validate_and_run_command(command, info[:default_args] + arguments, info[:class])
|
11
|
-
end
|
12
|
-
|
13
|
-
def print_help
|
14
|
-
puts 'Available commands:'
|
15
|
-
Rlt::CommandsMap.commands.each do |command|
|
16
|
-
desc = Rlt::CommandsMap.desc(command)
|
17
|
-
puts " #{command}#{spaces(command)} #{desc}"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def spaces(command)
|
22
|
-
size = max_command_length - command.size
|
23
|
-
' ' * size
|
24
|
-
end
|
25
|
-
|
26
|
-
def max_command_length
|
27
|
-
@max_command_length ||= Rlt::CommandsMap.commands.map(&:size).max
|
28
|
-
end
|
29
|
-
|
30
|
-
def validate_and_run_command(command, arguments, command_class)
|
31
|
-
valid = command_class.valid_parameters?(*arguments)
|
32
|
-
return command_class.print_help(*arguments) unless valid
|
33
|
-
config = Rlt.config('command', command)
|
34
|
-
command_class.run(config, *arguments)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|