gboom 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +29 -0
- data/bin/gboom +92 -0
- data/gboom.rdoc +43 -0
- data/lib/gboom/version.rb +3 -0
- data/lib/gboom.rb +4 -0
- metadata +154 -0
data/README.rdoc
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
= gboom
|
2
|
+
|
3
|
+
Create Gists from your command line. That's pretty much it. It's pretty fucking cool.
|
4
|
+
|
5
|
+
== Setup
|
6
|
+
gem install gboom
|
7
|
+
|
8
|
+
configure github credentials:
|
9
|
+
* set these ENV variables
|
10
|
+
export ENV['GITHUB_USERNAME']="username"
|
11
|
+
export ENV['GITHUB_PASSWORD']="password"
|
12
|
+
|
13
|
+
|
14
|
+
* or setup your global gitconfig (~/.gitconfig)
|
15
|
+
git config --global github.username "username"
|
16
|
+
git config --global github.password "password"
|
17
|
+
|
18
|
+
== Usage
|
19
|
+
This is how you *gboom*
|
20
|
+
gboom add recipes.txt
|
21
|
+
|
22
|
+
This is how you *gboom* with a description
|
23
|
+
gboom add recipes.txt -d "whatthefuckshouldimakefordinner.com recipes"
|
24
|
+
|
25
|
+
This is how you *gboom* privately
|
26
|
+
gboom add recipes.txt -p
|
27
|
+
|
28
|
+
:include:gboom.rdoc
|
29
|
+
|
data/bin/gboom
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'gli'
|
3
|
+
require 'github_api'
|
4
|
+
require 'clipboard'
|
5
|
+
# begin # XXX: Remove this begin/rescue before distributing your app
|
6
|
+
# require 'gist'
|
7
|
+
# rescue LoadError
|
8
|
+
# STDERR.puts "In development, you need to use `bundle exec bin/todo` to run your app"
|
9
|
+
# STDERR.puts "At install-time, RubyGems will make sure lib, etc. are in the load path"
|
10
|
+
# STDERR.puts "Feel free to remove this message from bin/gist now"
|
11
|
+
# exit 64
|
12
|
+
# end
|
13
|
+
|
14
|
+
include GLI::App
|
15
|
+
|
16
|
+
program_desc 'Create Gists from your command line like a pimp.'
|
17
|
+
|
18
|
+
version GBoom::VERSION
|
19
|
+
|
20
|
+
desc "Create a Gist from an existing file. You just gboom'ed!"
|
21
|
+
arg_name '[path to file]'
|
22
|
+
command :add do |c|
|
23
|
+
c.desc 'Use this flag to hide your embarassing code. Refactor that shit.'
|
24
|
+
c.arg_name 'public'
|
25
|
+
c.default_value true
|
26
|
+
c.switch [:p, :public]
|
27
|
+
|
28
|
+
c.desc 'What the fuck is happening in this gist?'
|
29
|
+
c.arg_name 'description'
|
30
|
+
c.default_value ''
|
31
|
+
c.flag :d
|
32
|
+
|
33
|
+
c.action do |global_options,options,args|
|
34
|
+
file = args[0]
|
35
|
+
raise "You need to specify a file. C'mon man." unless file
|
36
|
+
|
37
|
+
begin
|
38
|
+
content = File.open(file, 'r') {|f| f.read}
|
39
|
+
file_name = File.basename(file)
|
40
|
+
rescue
|
41
|
+
raise "Unable to read file. Dude, you're fucking this up."
|
42
|
+
end
|
43
|
+
|
44
|
+
# grab credentials from env or global gitfile
|
45
|
+
username = ENV['GITHUB_USERNAME'].empty? ? `git config --global --get github.user` : ENV['GITHUB_USERNAME']
|
46
|
+
password = ENV['GITHUB_PASSWORD'].empty? ? `git config --global --get github.password` : ENV['GITHUB_PASSWORD']
|
47
|
+
|
48
|
+
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?
|
49
|
+
github = Github.new basic_auth: "#{username.strip}:#{password.strip}"
|
50
|
+
github.oauth.create 'scopes' => ['gist']
|
51
|
+
|
52
|
+
begin
|
53
|
+
resp = github.gists.create(
|
54
|
+
'description' => options[:d],
|
55
|
+
'public' => options[:p],
|
56
|
+
'files' => {
|
57
|
+
file_name => {
|
58
|
+
'content' => content
|
59
|
+
}
|
60
|
+
}
|
61
|
+
)
|
62
|
+
rescue Github::Error::GithubError => e
|
63
|
+
raise e.message
|
64
|
+
end
|
65
|
+
|
66
|
+
Clipboard.copy("https://gist.github.com/#{resp[:id]}")
|
67
|
+
puts "GBoom! Copied https://gist.github.com/#{resp[:id]} to your clipboard!"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
pre do |global,command,options,args|
|
72
|
+
# Pre logic here
|
73
|
+
# Return true to proceed; false to abourt and not call the
|
74
|
+
# chosen command
|
75
|
+
# Use skips_pre before a command to skip this block
|
76
|
+
# on that command only
|
77
|
+
true
|
78
|
+
end
|
79
|
+
|
80
|
+
post do |global,command,options,args|
|
81
|
+
# Post logic here
|
82
|
+
# Use skips_post before a command to skip this
|
83
|
+
# block on that command only
|
84
|
+
end
|
85
|
+
|
86
|
+
on_error do |exception|
|
87
|
+
# Error logic here
|
88
|
+
# return false to skip default error handling
|
89
|
+
true
|
90
|
+
end
|
91
|
+
|
92
|
+
exit run(ARGV)
|
data/gboom.rdoc
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
== gboom - Create Gists from your command line like a pimp.
|
2
|
+
|
3
|
+
v0.0.1
|
4
|
+
|
5
|
+
=== Global Options
|
6
|
+
=== --help
|
7
|
+
Show this message
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
=== --version
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
=== Commands
|
17
|
+
==== Command: <tt>add [path to file]</tt>
|
18
|
+
Create a Gist from an existing file. You just gboom'ed!
|
19
|
+
|
20
|
+
|
21
|
+
===== Options
|
22
|
+
===== -d description
|
23
|
+
|
24
|
+
What the fuck is happening in this gist?
|
25
|
+
|
26
|
+
[Default Value]
|
27
|
+
|
28
|
+
|
29
|
+
===== -p|--[no-]public
|
30
|
+
Use this flag to hide your embarassing code. Refactor that shit.
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
==== Command: <tt>help command</tt>
|
35
|
+
Shows a list of commands or help for one command
|
36
|
+
|
37
|
+
Gets help for the application or its commands. Can also list the commands in a way helpful to creating a bash-style completion function
|
38
|
+
===== Options
|
39
|
+
===== -c
|
40
|
+
List commands one per line, to assist with shell completion
|
41
|
+
|
42
|
+
|
43
|
+
|
data/lib/gboom.rb
ADDED
metadata
ADDED
@@ -0,0 +1,154 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gboom
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Stephen Chen
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-11-20 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: clipboard
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - '='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.0.1
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - '='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.0.1
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: github_api
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - '='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.8.1
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - '='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.8.1
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rdoc
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: aruba
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: gli
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - '='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 2.4.1
|
102
|
+
type: :runtime
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - '='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 2.4.1
|
110
|
+
description:
|
111
|
+
email: stephenchen13@gmail.com
|
112
|
+
executables:
|
113
|
+
- gboom
|
114
|
+
extensions: []
|
115
|
+
extra_rdoc_files:
|
116
|
+
- README.rdoc
|
117
|
+
- gboom.rdoc
|
118
|
+
files:
|
119
|
+
- bin/gboom
|
120
|
+
- lib/gboom/version.rb
|
121
|
+
- lib/gboom.rb
|
122
|
+
- README.rdoc
|
123
|
+
- gboom.rdoc
|
124
|
+
homepage:
|
125
|
+
licenses: []
|
126
|
+
post_install_message:
|
127
|
+
rdoc_options:
|
128
|
+
- --title
|
129
|
+
- gboom
|
130
|
+
- --main
|
131
|
+
- README.rdoc
|
132
|
+
- -ri
|
133
|
+
require_paths:
|
134
|
+
- lib
|
135
|
+
- lib
|
136
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
|
+
none: false
|
144
|
+
requirements:
|
145
|
+
- - ! '>='
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '0'
|
148
|
+
requirements: []
|
149
|
+
rubyforge_project:
|
150
|
+
rubygems_version: 1.8.24
|
151
|
+
signing_key:
|
152
|
+
specification_version: 3
|
153
|
+
summary: A description of your project
|
154
|
+
test_files: []
|