Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Support --no-private

  • Loading branch information...
commit 383147194173d61696e8a74aa3c9bb1a6f582324 1 parent bd69d87
@ConradIrwin authored
Showing with 16 additions and 3 deletions.
  1. +6 −2 bin/gist
  2. +5 −1 lib/gist.rb
  3. +5 −0 spec/gist_spec.rb
View
8 bin/gist
@@ -59,8 +59,12 @@ Usage: #{executable_name} [-o|-c|-e] [-p] [-s] [-d DESC] -a] [-u URL] [-P] [-f N
options[:filename] = "foo.#{extension}"
end
- opts.on("-p", "--private", "Makes your gist private.") do |private|
- options[:private] = private
+ opts.on("-p", "--private", "Makes your gist private.") do
+ options[:private] = true
+ end
+
+ opts.on("--no-private") do
+ options[:private] = false
end
opts.on("-d", "--description DESCRIPTION", "Adds a description to your gist.") do |description|
View
6 lib/gist.rb
@@ -350,6 +350,10 @@ def legacy_private_gister?
end
def should_be_public?(options={})
- !(options[:private] || Gist.legacy_private_gister?)
+ if options.key? :private
+ !options[:private]
+ else
+ !Gist.legacy_private_gister?
+ end
end
end
View
5 spec/gist_spec.rb
@@ -10,6 +10,11 @@
Gist.should_be_public?.should be_false
end
+ it "should return true if --no-private is specified" do
+ Gist.stub(:legacy_private_gister?).and_return(true)
+ Gist.should_be_public?(private: false).should be_true
+ end
+
it "should return true by default" do
Gist.should_be_public?.should be_true
end
Please sign in to comment.
Something went wrong with that request. Please try again.