swissknife 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d1a84537bc006871dde7d1b29dccbc4193820c1b
4
- data.tar.gz: bc2750acb009f8c7cf1caf20f76ca4912917fdb4
3
+ metadata.gz: 82937630d258786ea7bf1ac0910e4fafe6a9c01a
4
+ data.tar.gz: c4af647a6fe051fd0513f35f90b7281a809ed478
5
5
  SHA512:
6
- metadata.gz: 03dd9286d4c0bc790777bb7c4d9feef2c548de51a0c5d7bbbb2650204ff417336fafb06d1ae3adec66eb2a6a2b370d5861bccea45d28a1c0f8d788c93e777615
7
- data.tar.gz: 15d471ec53cadea25be7a6c7ae842fd09a7a9d586d06044e9c1763f182c95aeb4637855cabdaaff223b3dec199e8892fad05b5e752ff9500a3cfe29e7f3a1aa8
6
+ metadata.gz: 4ba979377ee50c15c661925c79fd67241700a7378370eaf669d330802b5815dadb47ea145724b93713452b9c4928d9727a282b3b381f27255d4ebee812bc7ea1
7
+ data.tar.gz: 0b30b5d4f4519c4f5c60cf91f4eef67e1bf1406bedbb33251dcbe69d70860f12622af8644b44efacbc501773d49b1b7ca3de6bf217e9e7d00e450f57d20138dd
data/README.md CHANGED
@@ -11,6 +11,9 @@ class, like this:
11
11
  ``` ruby
12
12
  # lib/swissknife.rb
13
13
 
14
+ # put any helper functions in the SwissKnife module, but not in the Util class
15
+
16
+ # class Util
14
17
  def hello
15
18
  puts 'Hello World!'
16
19
  end
data/bin/clean CHANGED
File without changes
data/bin/delete ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'swissknife'
4
+
5
+ SwissKnife::Util.new.delete(ARGV[0])
data/bin/erase ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'swissknife'
4
+
5
+ SwissKnife::Util.new.delete(ARGV[0])
data/bin/install CHANGED
File without changes
data/bin/move ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'swissknife'
4
+
5
+ SwissKnife::Util.new.move(ARGV[0], ARGV[1])
data/bin/r ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'swissknife'
4
+
5
+ SwissKnife::Util.new.delete(ARGV[0])
data/bin/remove ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'swissknife'
4
+
5
+ SwissKnife::Util.new.delete(ARGV[0])
data/lib/swissknife.rb CHANGED
@@ -2,6 +2,32 @@ require 'fileutils'
2
2
  require 'git'
3
3
 
4
4
  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
+ def install_homebrew
24
+ system 'ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"'
25
+ end
26
+
27
+ def install_rvm
28
+ system 'curl -sSL https://get.rvm.io | bash -s stable --ruby'
29
+ end
30
+
5
31
  class Util
6
32
  def exit
7
33
  Process.kill 'HUP', Process.ppid
@@ -32,19 +58,14 @@ module SwissKnife
32
58
  def clean
33
59
  junk = %w(.DS_Store _MACOSX Thumbs.db)
34
60
  junk.each do |litter|
35
- FileUtils.rm_rf litter
36
- #puts "Removed #{litter}"
61
+ if File.directory? litter
62
+ FileUtils.rmdir litter
63
+ else
64
+ FileUtils.rm_r litter, secure: true
65
+ end
37
66
  end
38
67
  end
39
68
 
40
- def install_homebrew
41
- system 'ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"'
42
- end
43
-
44
- def install_rvm
45
- system 'curl -sSL https://get.rvm.io | bash -s stable --ruby'
46
- end
47
-
48
69
  def install(program)
49
70
  case program
50
71
  when 'homebrew' || 'brew'
@@ -60,5 +81,17 @@ module SwissKnife
60
81
  puts "I don't know what #{program} is!"
61
82
  end
62
83
  end
84
+
85
+ def delete(file)
86
+ FileUtils.rm_rf file
87
+ end
88
+
89
+ def move(file, destination)
90
+ FileUtils.mv file, destination
91
+ end
92
+
93
+ def copy(file, destination)
94
+ FileUtils.copy_entry file, destination, preserve: true, remove_destination: true
95
+ end
63
96
  end
64
97
  end
data/swissknife.gemspec CHANGED
@@ -1,10 +1,11 @@
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
5
 
5
6
  Gem::Specification.new do |spec|
6
7
  spec.name = 'swissknife'
7
- spec.version = '0.0.7'
8
+ spec.version = SwissKnife::VERSION
8
9
  spec.authors = ['Taylor Shuler']
9
10
  spec.email = ['gnosoman@gmail.com']
10
11
  spec.summary = %q{A simple gem with sneaky commands!}
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.7
4
+ version: 0.0.8
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-24 00:00:00.000000000 Z
11
+ date: 2014-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,9 +72,14 @@ email:
72
72
  executables:
73
73
  - c
74
74
  - clean
75
+ - delete
76
+ - erase
75
77
  - gita
76
78
  - install
79
+ - move
77
80
  - pack
81
+ - r
82
+ - remove
78
83
  - x
79
84
  extensions: []
80
85
  extra_rdoc_files: []
@@ -86,9 +91,14 @@ files:
86
91
  - Rakefile
87
92
  - bin/c
88
93
  - bin/clean
94
+ - bin/delete
95
+ - bin/erase
89
96
  - bin/gita
90
97
  - bin/install
98
+ - bin/move
91
99
  - bin/pack
100
+ - bin/r
101
+ - bin/remove
92
102
  - bin/x
93
103
  - lib/swissknife.rb
94
104
  - swissknife.gemspec