gitsu 0.0.2 → 0.0.3

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/.gitignore CHANGED
@@ -19,3 +19,4 @@ test/version_tmp
19
19
  tmp
20
20
  man/git-su.1
21
21
  man/git-su.1.html
22
+ .DS_Store
@@ -0,0 +1,4 @@
1
+ SimpleCov.start do
2
+ add_filter "/spec/"
3
+ add_filter "/features/"
4
+ end
data/Rakefile CHANGED
@@ -4,11 +4,13 @@ require 'gitsu'
4
4
  require 'bundler/gem_tasks'
5
5
  require 'rspec/core/rake_task'
6
6
  require 'cucumber/rake/task'
7
+ require 'coveralls/rake/task'
7
8
 
9
+ Coveralls::RakeTask.new
8
10
  Cucumber::Rake::Task.new(:features)
9
11
  RSpec::Core::RakeTask.new(:spec)
10
12
 
11
- task :default => [:spec, :features]
13
+ task :default => [:spec, :features, 'coveralls:push']
12
14
 
13
15
  task :push_release => [:spec, :features] do
14
16
  git = GitSu::Git.new(GitSu::Shell.new)
data/bin/git-su CHANGED
@@ -4,10 +4,10 @@ lib_path = File.expand_path('../../lib', __FILE__)
4
4
  $LOAD_PATH.unshift lib_path unless $LOAD_PATH.include? lib_path
5
5
  require 'gitsu'
6
6
 
7
- factory = GitSu::Factory.new(STDOUT)
8
- git_su = factory.git_su
7
+ factory = GitSu::Factory.new(STDOUT, "~/.gitsu")
8
+ gitsu = factory.gitsu
9
9
  runner = factory.runner
10
10
 
11
11
  runner.run do
12
- git_su.go ARGV
12
+ gitsu.go ARGV
13
13
  end
@@ -159,19 +159,23 @@ def output
159
159
  end
160
160
 
161
161
  def git
162
- @git ||= StubGit.new
162
+ factory.git
163
163
  end
164
164
 
165
165
  def gitsu
166
- @gitsu ||= GitSu::Gitsu.new(switcher, output)
166
+ factory.gitsu
167
167
  end
168
168
 
169
- def switcher
170
- @switcher ||= GitSu::Switcher.new(git, user_list, output)
169
+ def user_list
170
+ factory.user_list
171
171
  end
172
172
 
173
- def user_list
174
- @user_list ||= GitSu::UserList.new(user_list_file)
173
+ def factory
174
+ if @factory.nil?
175
+ @factory = GitSu::Factory.new(output, user_list_file)
176
+ @factory.git = StubGit.new
177
+ end
178
+ @factory
175
179
  end
176
180
 
177
181
  def user_list_file
@@ -1,2 +1,5 @@
1
- $LOAD_PATH << File.expand_path('../../../lib', __FILE__)
1
+ require 'simplecov'
2
+
3
+ lib_path = File.expand_path('../../../lib', __FILE__)
4
+ $LOAD_PATH << lib_path unless $LOAD_PATH.include? lib_path
2
5
  require 'gitsu'
@@ -8,6 +8,7 @@ Gem::Specification.new do |gem|
8
8
  gem.version = GitSu::VERSION
9
9
  gem.authors = ["drrb"]
10
10
  gem.email = ["drrb@github.com"]
11
+ gem.license = "GPL-3"
11
12
  gem.description = %q{Manage your Git users}
12
13
  gem.summary = <<-EOF
13
14
  Gitsu allows you to quickly configure and switch between Git users, for
@@ -21,7 +22,7 @@ Gem::Specification.new do |gem|
21
22
  gem.require_paths = ["lib"]
22
23
 
23
24
  # Dependencies
24
- gem.add_development_dependency('coveralls')
25
+ gem.add_development_dependency('coveralls', '>= 0.6.3')
25
26
  gem.add_development_dependency('rake')
26
27
  gem.add_development_dependency('rspec')
27
28
  gem.add_development_dependency('cucumber')
@@ -1,19 +1,24 @@
1
1
  module GitSu
2
2
  class Factory
3
- def initialize(output)
4
- @output = output
3
+ attr_accessor :git
4
+ def initialize(output, user_list_file)
5
+ @output, @user_list_file = output, File.expand_path(user_list_file)
6
+ end
7
+
8
+ def git
9
+ @git ||= CachingGit.new(Shell.new)
10
+ end
11
+
12
+ def user_list
13
+ @user_list ||= UserList.new(@user_list_file)
5
14
  end
6
15
 
7
16
  def switcher
8
- user_list_file = File.expand_path("~/.gitsu")
9
- shell = Shell.new
10
- git = CachingGit.new(shell)
11
- user_list = UserList.new(user_list_file)
12
- Switcher.new(git, user_list, @output)
17
+ @switcher ||= Switcher.new(git, user_list, @output)
13
18
  end
14
19
 
15
- def git_su
16
- Gitsu.new(switcher, @output)
20
+ def gitsu
21
+ @gitsu ||= Gitsu.new(switcher, @output)
17
22
  end
18
23
 
19
24
  def runner
@@ -1,5 +1,5 @@
1
1
  module GitSu
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
 
4
4
  class Version
5
5
  class ParseError < StandardError
@@ -1,3 +1,3 @@
1
+ require 'simplecov'
2
+
1
3
  require 'gitsu'
2
- require 'coveralls'
3
- Coveralls.wear!
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitsu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
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-03-18 00:00:00.000000000 Z
12
+ date: 2013-03-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: coveralls
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: 0.6.3
22
22
  type: :development
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
- version: '0'
29
+ version: 0.6.3
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: rake
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -85,6 +85,7 @@ extensions: []
85
85
  extra_rdoc_files: []
86
86
  files:
87
87
  - .gitignore
88
+ - .simplecov
88
89
  - .travis.yml
89
90
  - Gemfile
90
91
  - LICENSE.txt
@@ -127,7 +128,8 @@ files:
127
128
  - spec/gitsu/version_spec.rb
128
129
  - spec/spec_helper.rb
129
130
  homepage: http://drrb.github.com/gitsu
130
- licenses: []
131
+ licenses:
132
+ - GPL-3
131
133
  post_install_message:
132
134
  rdoc_options: []
133
135
  require_paths: