require_gist 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md ADDED
@@ -0,0 +1,13 @@
1
+ ## require_gist
2
+
3
+ Require code snippets from [Gist](http://gist.github.com) directly
4
+ from your Ruby code
5
+
6
+ gem install require_gist
7
+
8
+ require "require_gist"
9
+ require_gist "371861/ae8eb899fab486c99c423554b19ebdb40e37f021/shell_out.rb", "668ebf9fc9ed9fba98d1f44171cdfcb6dbccf3e3" # http://gist.github.com/371861
10
+
11
+ Comes with handy [Greasemonkey](https://addons.mozilla.org/addon/748) extension.
12
+ [Install extension](http://userscripts.org/scripts/show/74844) to generate require
13
+ snippets like the one above directly on the Gist page.
data/lib/require_gist.rb CHANGED
@@ -5,7 +5,7 @@ def require_gist(gist_url, gist_sha1 = nil)
5
5
  if gist_url =~ /^\d/
6
6
  gist_url = "http://gist.github.com/raw/#{ gist_url }"
7
7
  end
8
- gist_id, gist_rev, file = gist_url.match(%r{ https://gist.github.com/raw/(.+?)/(.+?)/(.+) }x).captures
8
+ gist_id, gist_rev, file = gist_url.match(%r{ http://gist.github.com/raw/(.+?)/(.+?)/(.+) }x).captures
9
9
  dir = FileUtils.mkdir_p(File.join(ENV["HOME"], ".gist"))
10
10
  feature_name = [ gist_id, gist_rev, file ] * "-"
11
11
  feature_path = File.join(dir, feature_name)
data/require_gist.gemspec CHANGED
@@ -2,13 +2,13 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{require_gist}
5
- s.version = "0.0.3"
5
+ s.version = "0.0.4"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Evgeniy Dolzhenko"]
9
9
  s.date = %q{2010-04-20}
10
10
  s.email = %q{dolzenko@gmail.com}
11
- s.files = ["lib/require_gist.rb", "require_gist.gemspec", "spec/require_gist_spec.rb", "spec/require_gist_test_gist.rb", "thirdparty/require_gist.user.js"]
11
+ s.files = ["README.md", "lib/require_gist.rb", "require_gist.gemspec", "spec/require_gist_spec.rb", "spec/require_gist_test_gist.rb", "thirdparty/require_gist.user.js"]
12
12
  s.homepage = %q{http://github.com/dolzenko/require_gist}
13
13
  s.require_paths = ["lib"]
14
14
  s.rubygems_version = %q{1.3.6}
@@ -13,6 +13,10 @@ describe "RequireGist" do
13
13
  it "requires gists and checks SHA1" do
14
14
  require_gist "372689/df2b91fc88db48e3fa58a1cfffdbf214651a1bbf/require_gist_test_gist.rb", "cddb5f13eb08f46a6e0b1c9fdccb80bc237f3c99" # http://gist.github.com/372689
15
15
  ::RequireGistTestGist.should == 4
16
+
17
+ lambda do
18
+ require_gist "372689/df2b91fc88db48e3fa58a1cfffdbf214651a1bbf/require_gist_test_gist.rb", "bad SHA1" # http://gist.github.com/372689
19
+ end.should raise_error(LoadError)
16
20
  end
17
21
  end
18
22
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 3
9
- version: 0.0.3
8
+ - 4
9
+ version: 0.0.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Evgeniy Dolzhenko
@@ -27,6 +27,7 @@ extensions: []
27
27
  extra_rdoc_files: []
28
28
 
29
29
  files:
30
+ - README.md
30
31
  - lib/require_gist.rb
31
32
  - require_gist.gemspec
32
33
  - spec/require_gist_spec.rb