gboom 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.rdoc +8 -0
  2. data/bin/gboom +18 -8
  3. data/lib/gboom/version.rb +1 -1
  4. metadata +2 -2
@@ -16,6 +16,11 @@ configure github credentials:
16
16
  git config --global github.user "username"
17
17
  git config --global github.password "password"
18
18
 
19
+ you may set github.password to a command to run to get the password if it
20
+ begins with a bang ('!'):
21
+
22
+ git config --global github.password "!security find-generic-password -gs github.password -w"
23
+
19
24
  == Usage
20
25
  This is how you *gboom*
21
26
  gboom add recipes.txt
@@ -31,5 +36,8 @@ This is how you *gboom* lines 15 to 30
31
36
 
32
37
  This is how you *gboom* all lines after line 15
33
38
  gboom add recipes.txt 15
39
+
40
+ This is how you *gboom* from stdin
41
+ echo "important stuff" | gboom add
34
42
  :include:gboom.rdoc
35
43
 
data/bin/gboom CHANGED
@@ -34,18 +34,22 @@ command :add do |c|
34
34
  start_line = args[1].to_i
35
35
  end_line = args[2].to_i
36
36
 
37
- content = File.open(file, 'r') {|f| f.read}
37
+ if file && !file.empty?
38
+ content = File.open(file, 'r') {|f| f.read}
39
+ file_name = File.basename(file)
40
+ else
41
+ content = ARGF.read
42
+ file_name = 'stdin'
43
+ end
44
+
38
45
  start_line = start_line == 0 ? 1 : start_line
39
46
  end_line = end_line > 0 ? end_line : content.lines.count
40
47
 
41
48
  raise "Is your shit backwards?" if start_line > end_line
42
49
  raise "Start at 1 buddy." if start_line == 0 && end_line > 0
43
- raise "You need to specify a file. C'mon man." unless file
44
50
  content = content.lines.to_a.slice(start_line-1, end_line-start_line+1).join
45
-
46
- file_name = File.basename(file)
47
- rescue
48
- raise "Unable to read file. Dude, you're fucking this up."
51
+ rescue Exception => e
52
+ raise "#{e}. Unable to read file. Dude, you're fucking this up."
49
53
  end
50
54
 
51
55
  # grab credentials from env or global gitfile
@@ -53,9 +57,15 @@ command :add do |c|
53
57
  env_password = ENV['GITHUB_PASSWORD']
54
58
  username = env_username.nil? || env_username.empty? ? `git config --global --get github.user` : env_username
55
59
  password = env_password.nil? || env_password.empty? ? `git config --global --get github.password` : env_password
56
-
60
+
57
61
  raise "You probably didn't read the instructions did you? You can't just skip to the good stuff, setup your github credentials. Noob." if username.empty? || password.empty?
58
- github = Github.new basic_auth: "#{username.strip}:#{password.strip}"
62
+
63
+ if password[0].chr == '!'
64
+ command = password[1, password.length]
65
+ password = `#{command}`
66
+ end
67
+
68
+ github = Github.new :basic_auth => "#{username.strip}:#{password.strip}"
59
69
  github.oauth.create 'scopes' => ['gist']
60
70
 
61
71
  begin
@@ -1,3 +1,3 @@
1
1
  module GBoom
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gboom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-26 00:00:00.000000000 Z
12
+ date: 2012-12-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: clipboard