prj 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.1
@@ -15,7 +15,7 @@ module Prj
15
15
 
16
16
  def run
17
17
  if @letters.empty?
18
- @output.puts config.fetch("projects_root")
18
+ @output.puts File.expand_path(config.fetch("projects_root"))
19
19
  return 0
20
20
  end
21
21
  finder = Finder.new(config.fetch("projects_root"), symbolize_keys(config))
@@ -26,40 +26,38 @@ describe "Prj::App" do
26
26
  end
27
27
  end
28
28
 
29
- context "within projcts root" do
30
- it "prints matching directory and returns 0" do
31
- with_config("projects_root" => root) do
32
- Prj::App.new(output, ["ap"]).run.should == 0
33
- output.string.chomp.should == File.join(root, "baz/craps/poops")
34
- end
29
+ it "prints matching directory and returns 0" do
30
+ with_config("projects_root" => root) do
31
+ Prj::App.new(output, ["ap"]).run.should == 0
32
+ output.string.chomp.should == File.join(root, "baz/craps/poops")
35
33
  end
34
+ end
36
35
 
37
- it "prints projects root and returns 0 if directory not found" do
38
- with_config("projects_root" => root) do
39
- Prj::App.new(output, ["nothingtofind"]).run.should == 0
40
- output.string.chomp.should == root
41
- end
36
+ it "prints projects root and returns 0 if directory not found" do
37
+ with_config("projects_root" => root) do
38
+ Prj::App.new(output, ["nothingtofind"]).run.should == 0
39
+ output.string.chomp.should == root
42
40
  end
41
+ end
43
42
 
44
- it "allows case-insensitive search if option specified in config" do
45
- with_config("projects_root" => root, "case_sensitive" => false) do
46
- Prj::App.new(output, ["Fo"]).run.should == 0
47
- output.string.chomp.should == File.join(root, "foo")
48
- end
43
+ it "allows case-insensitive search if option specified in config" do
44
+ with_config("projects_root" => root, "case_sensitive" => false) do
45
+ Prj::App.new(output, ["Fo"]).run.should == 0
46
+ output.string.chomp.should == File.join(root, "foo")
49
47
  end
48
+ end
50
49
 
51
- it "does not search nested repos by default" do
52
- with_config("projects_root" => root) do
53
- Prj::App.new(output, ["fob"]).run.should == 0
54
- output.string.chomp.should_not == File.join(root, "foo/baz")
55
- end
50
+ it "does not search nested repos by default" do
51
+ with_config("projects_root" => root) do
52
+ Prj::App.new(output, ["fob"]).run.should == 0
53
+ output.string.chomp.should_not == File.join(root, "foo/baz")
56
54
  end
55
+ end
57
56
 
58
- it "can search nested repos if 'search_nested_repositories' option is true" do
59
- with_config("projects_root" => root, "search_nested_repositories" => true) do
60
- Prj::App.new(output, ["fob"]).run.should == 0
61
- output.string.chomp.should == File.join(root, "foo/baz")
62
- end
57
+ it "can search nested repos if 'search_nested_repositories' option is true" do
58
+ with_config("projects_root" => root, "search_nested_repositories" => true) do
59
+ Prj::App.new(output, ["fob"]).run.should == 0
60
+ output.string.chomp.should == File.join(root, "foo/baz")
63
61
  end
64
62
  end
65
63
 
@@ -73,6 +71,13 @@ describe "Prj::App" do
73
71
  end
74
72
  end
75
73
 
74
+ it "outputs project root if called without argument" do
75
+ with_config("projects_root" => "~/proj") do
76
+ Prj::App.new(output, []).run.should == 0
77
+ output.string.chomp.should == File.expand_path("~/proj")
78
+ end
79
+ end
80
+
76
81
  def with_config(config = {})
77
82
  tmp = Prj::App.config_path
78
83
  config_path = File.join(Dir.tmpdir, ".prj.yml")
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: prj
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.0
5
+ version: 1.0.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Vladimir Yarotsky