righteous 0.0.0 → 0.0.1.pre

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
@@ -3,4 +3,5 @@
3
3
  [Bb]in
4
4
  [Oo]bj
5
5
  .idea
6
- *.iml
6
+ *.iml
7
+ *.gem
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-1.9.3-p448
1
+ 1.9.3-p448
data/Gemfile CHANGED
@@ -1,2 +1,4 @@
1
1
  source 'https://rubygems.org'
2
- gem 'nokogiri'
2
+ gem 'nokogiri'
3
+ gem 'command-unit', '~> 0.0.3'
4
+ gem 'rake', '~> 10.1.0'
data/Gemfile.lock CHANGED
@@ -1,12 +1,16 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
+ command-unit (0.0.3)
4
5
  mini_portile (0.5.1)
5
6
  nokogiri (1.6.0)
6
7
  mini_portile (~> 0.5.0)
8
+ rake (10.1.0)
7
9
 
8
10
  PLATFORMS
9
11
  ruby
10
12
 
11
13
  DEPENDENCIES
14
+ command-unit (~> 0.0.3)
12
15
  nokogiri
16
+ rake (~> 10.1.0)
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ desc 'Print help.'
2
+ task :default do
3
+ puts 'Try `rake -T` to list tasks.'
4
+ end
5
+
6
+ namespace :test do
7
+
8
+ desc 'Run all tests.'
9
+ task :all do
10
+ puts 'Running tests...'
11
+ sh './test/runtests.sh'
12
+ end
13
+
14
+ end
data/righteous.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "righteous"
3
- s.version = "0.0.0"
3
+ s.version = "0.0.1.pre"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.author = "Samuel R. Salisbury"
6
6
  s.email = "samsalisbury@gmail.com"
@@ -3,44 +3,69 @@
3
3
  # 3. Get the commit sha, then poke around in the repo and try to commit, running the tests...
4
4
 
5
5
  require 'securerandom'
6
+ require 'command-unit'
7
+
8
+ include CommandUnit
6
9
 
7
10
  def generate_dirname()
8
11
  "~/.righteous-git-hooks-temp-test-repo-" + SecureRandom.uuid[0..7]
9
12
  end
10
13
 
11
- temp_dir = File.expand_path(generate_dirname())
12
- if File.directory? temp_dir
13
- puts "Directory #{temp_dir} already exists, can't continue."
14
- exit 1
15
- end
14
+ scenario "Solution has linked files and none of them are in the repository" do
15
+
16
+ tests_root = File.expand_path(File.dirname(__FILE__))
17
+ temp_dir = File.expand_path(generate_dirname())
18
+ master_data_dir = File.join(tests_root, 'GitHooksTestSolution')
19
+ hook_script = File.join(tests_root, "../lib/hooks/go_go_righteous_git_hooks.rb")
16
20
 
17
- `mkdir #{temp_dir}`
18
-
19
- tests_root = File.expand_path(File.dirname(__FILE__))
20
-
21
- master_data_dir = File.join(tests_root, 'GitHooksTestSolution')
22
- hook_script = File.join(tests_root, "../lib/hooks/go_go_righteous_git_hooks.rb")
23
-
24
- a_test_failed = 0
25
-
26
- Dir.chdir(File.expand_path(temp_dir)) do
27
- # Arrange - copy files, create test repo and commit
28
- `cp -r #{master_data_dir}/* #{temp_dir}`
29
- `git init`
30
- `git add -A`
31
- `git commit -m 'Test commit.'`
32
- # Act
33
- result = `ruby #{hook_script} $PWD GitHooksTest GitHooksTest.csproj linked-files`
34
- # Assert
35
- if result.split("\n").last == 'Congratulations, this is a righteous commit!' then
36
- puts 'Test passed!'
37
- else
38
- puts 'Test failed.'
39
- a_test_failed += 1
21
+ scenario_set_up do |context|
22
+ if File.directory? temp_dir
23
+ puts "Directory #{temp_dir} already exists, can't continue."
24
+ exit 1
25
+ end
26
+
27
+ `mkdir #{temp_dir}`
28
+
29
+ Dir.chdir(temp_dir) do
30
+ # Copy files, create test repo and commit
31
+ `cp -r #{master_data_dir}/* #{temp_dir}`
32
+ `git init`
33
+ `git add -A`
34
+ `git commit -m 'Test commit.'`
35
+ end
40
36
  end
41
- end
42
37
 
43
- # clean up directory
44
- `rm -rf #{temp_dir}`
38
+ set_up do |context|
39
+ Dir.chdir(temp_dir) do
40
+ # Reset to the original commit
41
+ `git reset --hard`
42
+ `git clean -xdf`
43
+ end
44
+ end
45
+
46
+ when_i 'run the linked files checker' do |context|
47
+ Dir.chdir(temp_dir) do
48
+ context[:result] = `ruby #{hook_script} $PWD GitHooksTest GitHooksTest.csproj linked-files`
49
+ end
50
+ end
51
+
52
+ i_expect 'to see a congratulations message' do |context|
53
+ Dir.chdir(temp_dir) do
54
+ # Assert
55
+ if context[:result].split("\n").last == 'Congratulations, this is a righteous commit!' then
56
+ pass
57
+ else
58
+ puts 'Test failed.'
59
+ fail
60
+ end
61
+ end
62
+ end
63
+
64
+ scenario_tear_down do |context|
65
+ # clean up directory
66
+ `rm -rf #{temp_dir}`
67
+ end
68
+
69
+ end
45
70
 
46
- exit a_test_failed
71
+ run
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: righteous
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1.pre
5
+ prerelease: 6
5
6
  platform: ruby
6
7
  authors:
7
8
  - Samuel R. Salisbury
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-08-17 00:00:00.000000000 Z
12
+ date: 2013-11-08 00:00:00.000000000 Z
12
13
  dependencies: []
13
14
  description: ! 'ALPHA: Managing the Git sins and foibles of a large development team
14
15
  on Git-unfriendly Windows was becoming a nightmare at work. I started writing hooks
@@ -25,6 +26,7 @@ files:
25
26
  - Gemfile
26
27
  - Gemfile.lock
27
28
  - README.md
29
+ - Rakefile
28
30
  - lib/hooks/content-files-are-in-repo.rb
29
31
  - lib/hooks/go_go_righteous_git_hooks.rb
30
32
  - lib/hooks/linked-files-not-in-repo.rb
@@ -46,25 +48,26 @@ files:
46
48
  - test/runtests.sh
47
49
  homepage: http://github.com/samsalisbury/righteous-git-hooks
48
50
  licenses: []
49
- metadata: {}
50
51
  post_install_message:
51
52
  rdoc_options: []
52
53
  require_paths:
53
54
  - lib
54
55
  required_ruby_version: !ruby/object:Gem::Requirement
56
+ none: false
55
57
  requirements:
56
58
  - - ! '>='
57
59
  - !ruby/object:Gem::Version
58
60
  version: '0'
59
61
  required_rubygems_version: !ruby/object:Gem::Requirement
62
+ none: false
60
63
  requirements:
61
64
  - - ! '>='
62
65
  - !ruby/object:Gem::Version
63
66
  version: 1.3.6
64
67
  requirements: []
65
68
  rubyforge_project: righteous
66
- rubygems_version: 2.0.6
69
+ rubygems_version: 1.8.23
67
70
  signing_key:
68
- specification_version: 4
71
+ specification_version: 3
69
72
  summary: ! 'ALPHA: Useful, easy-install Git hooks for Visual Studio projects and more.'
70
73
  test_files: []
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NjRhNTExNmZmY2FhMzZlZDc2ZmNlN2E2ZGU4ZmJiYTJhYWVmNmExNg==
5
- data.tar.gz: !binary |-
6
- YmU1MzRiM2U1ZDMwZDU2Yjg4M2I3YWZhNzI0ZGVhZmQwNzI4YTRmMw==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- YmE3MmNmMjc4YmNkYTk2OTU1ODE3NWU4ODMyZjRhMjg5YmNkOGM2NGUzMDhi
10
- OTg3NGZiN2JiZDY3OTgyNDUwMjAwNGFiYmE2MTE4MTFmMzhiZTMxNjRkOWQ4
11
- ZTdhN2Y1ODJmYjE3NDBlM2NhODhjOGVhZDAzYzQyODYwODNiYTI=
12
- data.tar.gz: !binary |-
13
- ZWQzNDQ5NTA4Yjc0ZjgxMDJmMmM3NjQyOTliYjViODFhNDE5NDg5MzkyMzVi
14
- MDNmNzk5N2FhMmVhN2Q3ZTcwZWNiOTNkZWFiMTdmMWIxNjhhMTZiYzBhNzVl
15
- MDhkZmZkY2NjMDNkYmQwNWQzNTRiNzJmOWY0OTFjNzZkMWNhNTA=