gritano 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.1
1
+ 2.0.2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "gritano"
8
- s.version = "2.0.1"
8
+ s.version = "2.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Igor Bonadio"]
12
- s.date = "2013-06-15"
12
+ s.date = "2013-06-18"
13
13
  s.description = "Gritano is a tool to configure git servers over ssh"
14
14
  s.email = "igorbonadio@gmail.com"
15
15
  s.executables = ["gritano", "gritano-remote"]
@@ -44,6 +44,7 @@ Gem::Specification.new do |s|
44
44
  "lib/gritano/renderer.rb",
45
45
  "lib/gritano/thor.rb",
46
46
  "spec/data/development.yml",
47
+ "spec/gritano/config_spec.rb",
47
48
  "spec/gritano/console/git_spec.rb",
48
49
  "spec/gritano/console/local_spec.rb",
49
50
  "spec/gritano/console/remote_spec.rb",
@@ -0,0 +1,12 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ module Gritano::CLI
4
+ describe Config do
5
+ it "should have default parameters" do
6
+ Config.should_receive(:database_connection=)
7
+ Config.should_receive(:repository_path=)
8
+ Config.should_receive(:remote_ssh_prefix=)
9
+ Gritano::CLI.configure {}
10
+ end
11
+ end
12
+ end
@@ -10,9 +10,16 @@ module Gritano::CLI::Console
10
10
  YAML.stub(:load)
11
11
  end
12
12
 
13
+ def model_array(model_name)
14
+ users = []
15
+ users.stub(:model).and_return(users)
16
+ users.stub(:name).and_return(model_name)
17
+ users
18
+ end
19
+
13
20
  describe "#user" do
14
21
  it "should list all users ordered by login" do
15
- Gritano::Core::User.should_receive(:order).with(:login).and_return([])
22
+ Gritano::Core::User.should_receive(:order).with(:login).and_return(model_array("Gritano::Core::User"))
16
23
  Gritano::CLI::Console::Local.start %w{user:list}
17
24
  end
18
25
 
@@ -77,7 +84,7 @@ module Gritano::CLI::Console
77
84
 
78
85
  describe "#repo" do
79
86
  it "should list repositories ordered by name" do
80
- Gritano::Core::Repository.should_receive(:order).with(:name).and_return([])
87
+ Gritano::Core::Repository.should_receive(:order).with(:name).and_return(model_array("Gritano::Core::Repository"))
81
88
  Gritano::CLI::Console::Local.start %w{repo:list}
82
89
  end
83
90
 
@@ -11,11 +11,18 @@ module Gritano::CLI::Console
11
11
  Gritano::CLI::Config.remote_user = "user_login"
12
12
  end
13
13
 
14
+ def model_array(model_name)
15
+ users = []
16
+ users.stub(:model).and_return(users)
17
+ users.stub(:name).and_return(model_name)
18
+ users
19
+ end
20
+
14
21
  it "should list user's repositories" do
15
22
  user = double('User')
16
23
  repos = double('Repositories')
17
24
  user.should_receive(:repositories).and_return(repos)
18
- repos.should_receive(:order).with(:name).and_return([])
25
+ repos.should_receive(:order).with(:name).and_return(model_array("Gritano::Core::Repository"))
19
26
  Gritano::Core::User.should_receive(:where).with(login: 'user_login').and_return([user])
20
27
  Gritano::CLI::Console::Remote.start %w{repo:list}
21
28
  end
@@ -24,7 +31,7 @@ module Gritano::CLI::Console
24
31
  user = double('User')
25
32
  keys = double('Keys')
26
33
  user.should_receive(:keys).and_return(keys)
27
- keys.should_receive(:order).with(:name).and_return([])
34
+ keys.should_receive(:order).with(:name).and_return(model_array("Gritano::Core::Key"))
28
35
  Gritano::Core::User.should_receive(:where).with(login: 'user_login').and_return([user])
29
36
  Gritano::CLI::Console::Remote.start %w{key:list}
30
37
  end
@@ -17,5 +17,14 @@ module Gritano::Core
17
17
  Key.stub(:all).and_return(keys)
18
18
  Key.authorized_keys.should be == "command=\"gritano-remote user_login\" some_key\ncommand=\"gritano-remote user_login\" some_key"
19
19
  end
20
+
21
+ it "should create the authorized_keys file when a new key is created" do
22
+ key = Key.new
23
+ file = double('File')
24
+ File.should_receive(:open).with(File.join(Etc.getpwuid.dir, '.ssh/authorized_keys'), "w").and_return(file)
25
+ Key.stub(:authorized_keys).and_return('authorized_keys')
26
+ file.should_receive(:write).with('authorized_keys')
27
+ key.update_authorized_keys
28
+ end
20
29
  end
21
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gritano
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-15 00:00:00.000000000 Z
12
+ date: 2013-06-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -239,6 +239,7 @@ files:
239
239
  - lib/gritano/renderer.rb
240
240
  - lib/gritano/thor.rb
241
241
  - spec/data/development.yml
242
+ - spec/gritano/config_spec.rb
242
243
  - spec/gritano/console/git_spec.rb
243
244
  - spec/gritano/console/local_spec.rb
244
245
  - spec/gritano/console/remote_spec.rb
@@ -265,7 +266,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
265
266
  version: '0'
266
267
  segments:
267
268
  - 0
268
- hash: -420660352722020068
269
+ hash: -234826800974028757
269
270
  required_rubygems_version: !ruby/object:Gem::Requirement
270
271
  none: false
271
272
  requirements: