ginatra 2.2.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile CHANGED
@@ -48,7 +48,7 @@ namespace :setup do
48
48
 
49
49
  desc "Clones the Test Repository"
50
50
  task :repo do |t|
51
- FileUtils.cd(File.join(current_path, "repos")) do
51
+ FileUtils.cd(File.join(Dir.pwd, "repos")) do
52
52
  puts `git clone git://github.com/atmos/hancock-client.git test`
53
53
  end
54
54
  end
data/config.ru CHANGED
@@ -2,6 +2,8 @@ $:.unshift File.expand_path("#{File.dirname(__FILE__)}/lib")
2
2
 
3
3
  require "ginatra"
4
4
 
5
+
6
+
5
7
  map '/' do
6
8
  run Ginatra::App
7
9
  end
@@ -1,5 +1,5 @@
1
- current_path = File.expand_path(File.dirname(__FILE__))
2
- require "#{current_path}/../../spec/spec_helper"
1
+ $:.unshift File.expand_path("#{File.dirname(__FILE__)}/../../spec")
2
+ require "spec_helper"
3
3
 
4
4
  World do
5
5
  def app
@@ -41,7 +41,7 @@ module Ginatra
41
41
  end
42
42
  end
43
43
 
44
- VERSION = "2.2.0"
44
+ VERSION = "2.2.1"
45
45
 
46
46
  # The main application class.
47
47
  #
@@ -242,6 +242,8 @@ module Ginatra
242
242
  [stdout, stderr].each {|io| io.close }
243
243
  end
244
244
  html_output
245
+ rescue Errno::ENOENT
246
+ return "<div class=\"highlight\"><pre>#{content}</pre></div>"
245
247
  end
246
248
 
247
249
  def pygmentize_type(filename)
@@ -251,6 +253,8 @@ module Ginatra
251
253
  [stdin, stdout, stderr].each {|io| io.close }
252
254
  end
253
255
  type
256
+ rescue Errno::ENOENT
257
+ return "text"
254
258
  end
255
259
  end
256
260
  end
data/rackup.ru CHANGED
@@ -2,6 +2,8 @@ $:.unshift File.expand_path("#{File.dirname(__FILE__)}/lib")
2
2
 
3
3
  require "ginatra"
4
4
 
5
+
6
+
5
7
  map '/' do
6
8
  run Ginatra::App
7
9
  end
@@ -1,10 +1,14 @@
1
- current_path = File.expand_path(File.dirname(__FILE__))
2
- require File.join(current_path, "spec_helper")
1
+ $:.unshift File.dirname(__FILE__)
2
+ require "spec_helper"
3
3
 
4
4
  describe "Ginatra" do
5
5
 
6
6
  describe "RepoList" do
7
7
 
8
+ def current_path
9
+ File.expand_path(File.dirname(__FILE__))
10
+ end
11
+
8
12
  before do
9
13
  @repo_list = Ginatra::RepoList.list
10
14
  @repo = Ginatra::RepoList.find("test")
@@ -28,9 +32,6 @@ describe "Ginatra" do
28
32
 
29
33
  describe "New repos added to repo directory" do
30
34
 
31
- NEW_REPO_NAME = "temp-new-repo"
32
- REPO_DIR = File.join(current_path, "..", "repos")
33
-
34
35
  def print_repos_found
35
36
  Ginatra::Config.git_dirs.map! do |git_dir|
36
37
  files = Dir.glob(git_dir)
@@ -39,9 +40,12 @@ describe "Ginatra" do
39
40
  end
40
41
 
41
42
  before(:each) do
42
- FileUtils.cd(REPO_DIR) do |dir|
43
- FileUtils.mkdir(NEW_REPO_NAME)
44
- FileUtils.cd(NEW_REPO_NAME) do |dir|
43
+ @new_repo_name = "temp-new-repo"
44
+ @repo_dir = File.join(current_path, "..", "repos")
45
+
46
+ FileUtils.cd(@repo_dir) do |dir|
47
+ FileUtils.mkdir(@new_repo_name)
48
+ FileUtils.cd(@new_repo_name) do |dir|
45
49
  `git init`
46
50
  end
47
51
  end
@@ -50,31 +54,31 @@ describe "Ginatra" do
50
54
  it "should detect new repo after refresh" do
51
55
  repo_list = Ginatra::RepoList.list # calling this should refresh the list
52
56
 
53
- Ginatra::RepoList.instance.has_repo?(NEW_REPO_NAME).should == true
57
+ Ginatra::RepoList.instance.has_repo?(@new_repo_name).should == true
54
58
 
55
- new_repo = Ginatra::RepoList.find(NEW_REPO_NAME)
59
+ new_repo = Ginatra::RepoList.find(@new_repo_name)
56
60
  repo_list.should include(new_repo)
57
61
  end
58
62
 
59
63
  it "should detect when a repo has been removed after refresh" do
60
64
  repo_list = Ginatra::RepoList.list # calling this should refresh the list
61
65
 
62
- Ginatra::RepoList.instance.has_repo?(NEW_REPO_NAME).should == true
66
+ Ginatra::RepoList.instance.has_repo?(@new_repo_name).should == true
63
67
 
64
- new_repo = Ginatra::RepoList.find(NEW_REPO_NAME)
68
+ new_repo = Ginatra::RepoList.find(@new_repo_name)
65
69
  repo_list.should include(new_repo)
66
70
 
67
71
  # remove the new repository from the file system
68
- FileUtils.rm_rf File.join(REPO_DIR, NEW_REPO_NAME), :secure => true
72
+ FileUtils.rm_rf File.join(@repo_dir, @new_repo_name), :secure => true
69
73
 
70
74
  repo_list = Ginatra::RepoList.list # refresh the repo list
71
75
 
72
- Ginatra::RepoList.instance.has_repo?(NEW_REPO_NAME).should == false
76
+ Ginatra::RepoList.instance.has_repo?(@new_repo_name).should == false
73
77
  repo_list.should_not include(new_repo)
74
78
  end
75
79
 
76
80
  after(:each) do
77
- FileUtils.rm_rf File.join(REPO_DIR, NEW_REPO_NAME), :secure => true
81
+ FileUtils.rm_rf File.join(@repo_dir, @new_repo_name), :secure => true
78
82
  end
79
83
  end
80
84
  end
@@ -1,9 +1,13 @@
1
- current_path = File.expand_path(File.dirname(__FILE__))
2
- require File.join(current_path, "spec_helper")
1
+ $:.unshift File.dirname(__FILE__)
2
+ require "spec_helper"
3
3
 
4
4
  describe "Ginatra" do
5
5
  describe "Repo" do
6
-
6
+
7
+ def current_path
8
+ File.expand_path(File.dirname(__FILE__))
9
+ end
10
+
7
11
  before do
8
12
  @repo_list = Ginatra::RepoList
9
13
  @ginatra_repo = @repo_list.find("test")
@@ -31,28 +35,28 @@ describe "Ginatra" do
31
35
  it "should be the same thing using #find or #new" do
32
36
  @repo_list.find("test") == Ginatra::Repo.new(File.join(current_path, "..", "repos", "test"))
33
37
  end
34
-
38
+
35
39
  it "should contain this commit" do
36
40
  @commit.refs.should_not be_empty
37
41
  end
38
-
42
+
39
43
  it "should not contain this other commit" do
40
44
  lambda { @ginatra_repo.commit("totallyinvalid") }.should raise_error(Ginatra::InvalidCommit, "Could not find a commit with the id of totallyinvalid")
41
45
  end
42
-
46
+
43
47
  it "should have a list of commits" do
44
48
  @ginatra_repo.commits.should_not be_blank
45
49
  end
46
-
50
+
47
51
  it "should raise an error when asked to invert itself" do
48
52
  lambda { @ginatra_repo.commits("master", -1) }.should raise_error(Ginatra::Error, "max_count cannot be less than 0")
49
53
  end
50
-
54
+
51
55
  it "should be able to add refs to a commit" do
52
56
  @commit.refs = []
53
57
  @ginatra_repo.add_refs(@commit)
54
58
  @commit.refs.should_not be_empty
55
59
  end
56
-
60
+
57
61
  end
58
62
  end
@@ -1,12 +1,12 @@
1
1
  require 'rubygems'
2
2
 
3
- gem 'rspec'
3
+ #gem 'rspec'
4
4
  require 'spec'
5
5
 
6
- current_path = File.expand_path(File.dirname(__FILE__))
7
- require "#{current_path}/../lib/ginatra"
6
+ $:.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib")
7
+ require "ginatra"
8
8
 
9
- gem 'webrat', '>=0.4.4'
9
+ #gem 'webrat', '>=0.4.4'
10
10
  begin
11
11
  # When using webrat 0.6.0, there is no webrat/sinatra.rb file.
12
12
  # Looking at the gem's code, it looks like it autoloads the sinatra adapter at webrat/adapters/sinatra.rb.
@@ -17,23 +17,25 @@ rescue LoadError
17
17
  require 'webrat'
18
18
  end
19
19
 
20
- gem 'rack-test', '>=0.3.0'
20
+ #gem 'rack-test', '>=0.3.0'
21
21
  require 'rack/test'
22
22
 
23
23
  Webrat.configure do |config|
24
24
  config.mode = :sinatra
25
25
  end
26
26
 
27
+ current_path = File.expand_path(File.dirname(__FILE__))
28
+
27
29
  Ginatra::App.set :environment, :test
28
30
  Ginatra::Config[:git_dirs] = ["#{current_path}/../repos/*"]
29
-
31
+
30
32
  Spec::Runner.configure do |config|
31
33
  def app
32
34
  Ginatra::App
33
35
  end
34
-
36
+
35
37
  config.include(Rack::Test::Methods)
36
38
  config.include(Webrat::Methods)
37
39
  config.include(Webrat::Matchers)
38
- end
40
+ end
39
41
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ginatra
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Elliott