public
Rubygem
Description: Take FogBugz offline with you
Clone URL: git://github.com/francois/fogbugz_offline.git
Search Repo:
FogbugzOffline#global and #local specifications.

Removed FogbugzOffline::Config, in favor of two different implementations 
for global/local differences.
francois (author)
Thu May 15 13:00:16 -0700 2008
commit  5dff84aafc55995fdb520cfe78595b33ed73cdfa
tree    d9beeb88f218a8a50578484553c5e781fad3a74b
parent  f9b6b6fc00020aa8ebb945b0d108b665e6f624a1
...
1
 
 
2
3
4
5
...
18
19
20
21
 
 
22
23
24
25
 
 
26
27
28
...
 
1
2
3
4
5
6
...
19
20
21
 
22
23
24
25
26
 
27
28
29
30
31
0
@@ -1,4 +1,5 @@
0
-require "fogbugz_offline/config"
0
+require "fogbugz_offline/global_config"
0
+require "fogbugz_offline/local_config"
0
 require "fogbugz_offline/connection"
0
 require "fogbugz_offline/commands"
0
 
0
0
@@ -18,11 +19,13 @@
0
   end
0
 
0
   def self.global
0
- FogbugzOffline::Config.new(home_path + ".fogbugz_offline/config.yml")
0
+ return @global_config if @global_config
0
+ @global_config = FogbugzOffline::GlobalConfig.new(home_path + ".fogbugz_offline/config.yml")
0
   end
0
 
0
   def self.local
0
- FogbugzOffline::Config.new(project_path + ".fogbugz_offline/config.yml")
0
+ return @local_config if @local_config
0
+ FogbugzOffline::LocalConfig.new(project_path + ".fogbugz_offline/config.yml")
0
   end
0
 
0
   def self.connection_to(url)
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,17 +1 @@
0
-require "singleton"
0
-
0
-module FogbugzOffline
0
- class Config
0
- include Singleton
0
-
0
- def add_project(url)
0
- end
0
-
0
- def known_url?(url)
0
- end
0
-
0
- def write
0
- end
0
- end
0
-end
...
 
 
 
 
...
1
2
3
4
0
@@ -1 +1,5 @@
0
+module FogbugzOffline
0
+ class GlobalConfig
0
+ end
0
+end
...
 
 
 
 
...
1
2
3
4
0
@@ -1 +1,5 @@
0
+module FogbugzOffline
0
+ class LocalConfig
0
+ end
0
+end
...
43
44
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
0
@@ -43,4 +43,26 @@
0
     FogbugzOffline.project_path.should == Pathname.new(Dir.getwd)
0
   end
0
 end
0
+
0
+describe FogbugzOffline, "#global" do
0
+ before do
0
+ FogbugzOffline.stub!(:home_path).and_return(Pathname.new("/home/me"))
0
+ end
0
+
0
+ it "should instantiate a FogbugzOffline::GlobalConfig with #home_path + .fogbugz_offline/config.yml" do
0
+ FogbugzOffline::GlobalConfig.should_receive(:new).with(Pathname.new("/home/me/.fogbugz_offline/config.yml")).and_return(mock("config"))
0
+ FogbugzOffline.global
0
+ end
0
+end
0
+
0
+describe FogbugzOffline, "#local" do
0
+ before do
0
+ FogbugzOffline.stub!(:project_path).and_return(Pathname.new("/home/me/project"))
0
+ end
0
+
0
+ it "should instantiate a FogbugzOffline::LocalConfig with #project_path + .fogbugz_offline/config.yml" do
0
+ FogbugzOffline::LocalConfig.should_receive(:new).with(Pathname.new("/home/me/project/.fogbugz_offline/config.yml")).and_return(mock("config"))
0
+ FogbugzOffline.local
0
+ end
0
+end

Comments

    No one has commented yet.