swissknife 0.0.8 → 0.1.0
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/README.md +16 -9
- data/bin/{gita → ga} +0 -0
- data/bin/gb +5 -0
- data/bin/gc +5 -0
- data/bin/gp +5 -0
- data/lib/swissknife.rb +32 -30
- data/lib/swissknife/version.rb +3 -0
- data/swissknife.gemspec +3 -2
- metadata +29 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1543bb35a8f3b08fc02536bdf0be9da4ff5d741f
|
4
|
+
data.tar.gz: 357ca154de857478d61a5d9e4e68076f9b92d906
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e7d8d3fd29f36cd76e93a93318143642ce3dc16364f8fa178c8024670dfd0b70a21fff09f311c9bd513cb1e4bc410271628406bddc5e022fec197fea9f7b022
|
7
|
+
data.tar.gz: 564bc27caa9d0642ace48baef2524d8f6b91e8940ad52e042a4d5a716dab692eda19c53e4268709f9df378f8b666d5c9712b4bb1b2a70b4d5ad99cd8ddc94df1
|
data/README.md
CHANGED
@@ -2,8 +2,7 @@
|
|
2
2
|
A simple gem with sneaky commands!
|
3
3
|
***
|
4
4
|
If you're tired of having to type out long commands excessively, then meet swissknife!
|
5
|
-
The whole purpose of the
|
6
|
-
can be easy to both remember and type! The project is continually seeking new commands to add!
|
5
|
+
The whole purpose of the project is to provide a slew of shortened and simple commands to help developers.
|
7
6
|
|
8
7
|
## Adding a command
|
9
8
|
To create a new command, start by opening up the `swissknife.rb` file in `lib`, and create a new definition in the `Util`
|
@@ -20,7 +19,7 @@ end
|
|
20
19
|
```
|
21
20
|
Next, create a new file without an extension with the name of your command. Having it match the name of the definition
|
22
21
|
you created earlier is recommended. For my example, it would be `hello`. Finally, all that's needed is to add a shebang,
|
23
|
-
require for the module, and
|
22
|
+
require for the module, and method initialization, as follows:
|
24
23
|
``` ruby
|
25
24
|
# bin/hello
|
26
25
|
|
@@ -31,18 +30,26 @@ require 'swissknife'
|
|
31
30
|
SwissKnife::Util.new.hello
|
32
31
|
```
|
33
32
|
|
34
|
-
### Available commands
|
33
|
+
### Available [commands](https://github.com/T145/swissknife/tree/master/bin)
|
35
34
|
| Command | Description |
|
36
35
|
|:-------:|:-----------:|
|
37
|
-
| x | Exits a console |
|
38
36
|
| c | Clears the console screen (puts the cursor on the bottom for easy console browsing) |
|
39
|
-
| pack | Bundles a Ruby project's dependencies to `vendor/bundle` |
|
40
|
-
| gita | Basically just like `git add`, but with the added advantage of having the `-A` option when no files are specified |
|
41
37
|
| clean | Removes some of the junk we all encounter, such as the `.DS_Store` |
|
42
|
-
|
|
38
|
+
| delete | (Alias for `r`) |
|
39
|
+
| erase | (Alias for `r`) |
|
40
|
+
| ga | Basically just like `git add`, but with the added advantage of having the `-A` option when no files are specified |
|
41
|
+
| gb | Creates a new Git branch or switches to an exsisting one |
|
42
|
+
| gc | Either clones a repo or commits some content; having `.git` inside the input determines whether or not to clone |
|
43
|
+
| gp | The equivalent of `git push` |
|
44
|
+
| install | A sleek command that can install Homebrew and/or RVM (installs the latest Ruby version alongside it) |
|
45
|
+
| move | Moves a file or directory from one place to another! |
|
46
|
+
| pack | Bundles a Ruby project's dependencies to `vendor/bundle` |
|
47
|
+
| r | Deletes a file or directory |
|
48
|
+
| remove | (Alias for `r`) |
|
49
|
+
| x | Exits a console |
|
43
50
|
|
44
51
|
## Contributing
|
45
52
|
1. Fork it
|
46
53
|
2. Add or remove some stuff
|
47
54
|
3. Commit your changes (`git commit -am "My awesome change!"`)
|
48
|
-
4. Create a new pull request!
|
55
|
+
4. Create a new pull request!
|
data/bin/{gita → ga}
RENAMED
File without changes
|
data/bin/gb
ADDED
data/bin/gc
ADDED
data/bin/gp
ADDED
data/lib/swissknife.rb
CHANGED
@@ -1,25 +1,8 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
require 'git'
|
3
|
+
require 'os'
|
3
4
|
|
4
5
|
module SwissKnife
|
5
|
-
VERSION = '0.0.8'
|
6
|
-
|
7
|
-
def SwissKnife.windows?
|
8
|
-
(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
|
9
|
-
end
|
10
|
-
|
11
|
-
def SwissKnife.mac?
|
12
|
-
(/darwin/ =~ RUBY_PLATFORM) != nil
|
13
|
-
end
|
14
|
-
|
15
|
-
def SwissKnife.unix?
|
16
|
-
!OS.windows?
|
17
|
-
end
|
18
|
-
|
19
|
-
def SwissKnife.linux?
|
20
|
-
OS.unix? && !OS.mac?
|
21
|
-
end
|
22
|
-
|
23
6
|
def install_homebrew
|
24
7
|
system 'ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"'
|
25
8
|
end
|
@@ -45,27 +28,41 @@ module SwissKnife
|
|
45
28
|
end
|
46
29
|
end
|
47
30
|
|
48
|
-
def git_add(
|
31
|
+
def git_add(file)
|
49
32
|
git = Git.open Dir.pwd
|
50
33
|
|
51
|
-
if
|
34
|
+
if file == nil
|
52
35
|
git.add all: true
|
53
36
|
else
|
54
|
-
git.add
|
37
|
+
git.add file
|
55
38
|
end
|
56
39
|
end
|
57
40
|
|
58
|
-
def
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
41
|
+
def git_branch(branch)
|
42
|
+
git = Git.open Dir.pwd
|
43
|
+
git.branch branch
|
44
|
+
end
|
45
|
+
|
46
|
+
def git_clone_or_commit(message)
|
47
|
+
git = Git.open Dir.pwd
|
48
|
+
|
49
|
+
if message.include? '.git'
|
50
|
+
name = message.split('/')[4]
|
51
|
+
name.slice! '.git'
|
52
|
+
Git.clone message, name
|
53
|
+
puts "Successfully cloned the \"#{name}\" project!"
|
54
|
+
else
|
55
|
+
git.commit message
|
56
|
+
puts "Created commit: \"#{message}\""
|
66
57
|
end
|
67
58
|
end
|
68
59
|
|
60
|
+
def git_push(remote, branch)
|
61
|
+
git = Git.open Dir.pwd
|
62
|
+
git.push remote, branch
|
63
|
+
puts "Push to #{branch} was successful!"
|
64
|
+
end
|
65
|
+
|
69
66
|
def install(program)
|
70
67
|
case program
|
71
68
|
when 'homebrew' || 'brew'
|
@@ -83,7 +80,12 @@ module SwissKnife
|
|
83
80
|
end
|
84
81
|
|
85
82
|
def delete(file)
|
86
|
-
FileUtils.
|
83
|
+
FileUtils.rm_r file, secure: true
|
84
|
+
end
|
85
|
+
|
86
|
+
def clean
|
87
|
+
junk = %w(.DS_Store _MACOSX Thumbs.db)
|
88
|
+
junk.each { |litter| delete litter }
|
87
89
|
end
|
88
90
|
|
89
91
|
def move(file, destination)
|
data/swissknife.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'swissknife'
|
4
|
+
require 'swissknife/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'swissknife'
|
@@ -22,5 +22,6 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_development_dependency 'rake', '~> 10.0'
|
23
23
|
spec.add_development_dependency 'rubocop', '~> 0.27.1'
|
24
24
|
|
25
|
-
spec.add_dependency 'git'
|
25
|
+
spec.add_dependency 'git', '~> 1.2.8'
|
26
|
+
spec.add_dependency 'os', '~> 0.9.6'
|
26
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: swissknife
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taylor Shuler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -56,16 +56,30 @@ dependencies:
|
|
56
56
|
name: git
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 1.2.8
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.2.8
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: os
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.9.6
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
82
|
+
version: 0.9.6
|
69
83
|
description:
|
70
84
|
email:
|
71
85
|
- gnosoman@gmail.com
|
@@ -74,7 +88,10 @@ executables:
|
|
74
88
|
- clean
|
75
89
|
- delete
|
76
90
|
- erase
|
77
|
-
-
|
91
|
+
- ga
|
92
|
+
- gb
|
93
|
+
- gc
|
94
|
+
- gp
|
78
95
|
- install
|
79
96
|
- move
|
80
97
|
- pack
|
@@ -93,7 +110,10 @@ files:
|
|
93
110
|
- bin/clean
|
94
111
|
- bin/delete
|
95
112
|
- bin/erase
|
96
|
-
- bin/
|
113
|
+
- bin/ga
|
114
|
+
- bin/gb
|
115
|
+
- bin/gc
|
116
|
+
- bin/gp
|
97
117
|
- bin/install
|
98
118
|
- bin/move
|
99
119
|
- bin/pack
|
@@ -101,6 +121,7 @@ files:
|
|
101
121
|
- bin/remove
|
102
122
|
- bin/x
|
103
123
|
- lib/swissknife.rb
|
124
|
+
- lib/swissknife/version.rb
|
104
125
|
- swissknife.gemspec
|
105
126
|
homepage: https://github.com/T145/swissknife
|
106
127
|
licenses:
|