gitnesse 1.0.0.beta2 → 1.0.0
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.
- checksums.yaml +4 -4
- data/CONTRIBUTORS.md +15 -0
- data/Rakefile +2 -0
- data/features/pull.feature +13 -0
- data/features/push.feature +13 -0
- data/features/step_definitions/gitnesse_steps.rb +45 -0
- data/features/step_definitions/pull_steps.rb +5 -0
- data/features/step_definitions/push_steps.rb +5 -0
- data/features/support/env.rb +70 -0
- data/lib/gitnesse/cli/task/cleanup.rb +55 -0
- data/lib/gitnesse/cli/task/run.rb +5 -1
- data/lib/gitnesse/config_loader.rb +0 -2
- data/lib/gitnesse/dependency_checker.rb +11 -11
- data/lib/gitnesse/dir_manager.rb +3 -2
- data/lib/gitnesse/version.rb +1 -1
- data/lib/gitnesse/wiki.rb +28 -8
- data/lib/gitnesse/wiki/page.rb +1 -1
- data/readme.md +194 -0
- data/spec/lib/cli/task/cleanup_spec.rb +23 -0
- data/spec/lib/cli/task/help_spec.rb +5 -4
- data/spec/lib/dependency_checker_spec.rb +1 -1
- data/spec/lib/wiki_spec.rb +1 -1
- metadata +22 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f0e8d676922e813e166be577a0a5866452c9029
|
4
|
+
data.tar.gz: 40ca9a4ccfa71c4308a90d1f4d1f9c1dd0a4339e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af6deb49255c922a75add6ce18912ba23e491b0cc7e24ee2bd4d852d1c4971b092ea08bf0e99c51d5f0c5f105e06055354137d4c0d6833bf313cc1d35d289758
|
7
|
+
data.tar.gz: ba274b9548f2f867dd64890e67e298d8b45d05451e227e49bddb0b1ca7a17861eb04aa236b210de3e7c17d23aec0f49803a65a4ada266fe52b9f417640c11ee9
|
data/CONTRIBUTORS.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# Contributors
|
2
|
+
|
3
|
+
Gitnesse exists thanks to the work of these wonderful individuals:
|
4
|
+
|
5
|
+
- Dennis Walters ([@ess](https://github.com/ess))
|
6
|
+
- Jon Kinney ([@jondkinney](https://github.com/jondkinney))
|
7
|
+
- Ron Evans ([@deadprogram](https://github.com/deadprogram))
|
8
|
+
- Andrew Stewart ([@stewart](https://github.com/stewart))
|
9
|
+
- Luis Hurtado ([@luishurtado](https://github.com/luishurtado))
|
10
|
+
- Gary Iams ([@gary](https://github.com/gary))
|
11
|
+
- Daniel Fischer ([@dfischer](https://github.com/dfischer))
|
12
|
+
|
13
|
+
Thank you!
|
14
|
+
|
15
|
+
Please join us, we'd love your contribution too!
|
data/Rakefile
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
@pull
|
2
|
+
Feature: Pull
|
3
|
+
Scenario: Features already exist in remote wiki, but not locally
|
4
|
+
Given there is a wiki with Cucumber features defined
|
5
|
+
And there are no local features
|
6
|
+
When I pull features
|
7
|
+
Then the local features should match the wiki
|
8
|
+
|
9
|
+
Scenario: Features exist both in remote wiki and locally
|
10
|
+
Given there is a wiki with Cucumber features defined
|
11
|
+
And there are local features
|
12
|
+
When I pull features
|
13
|
+
Then the local features should match the wiki
|
@@ -0,0 +1,13 @@
|
|
1
|
+
@push
|
2
|
+
Feature: Push
|
3
|
+
Scenario: Features already exist in local, but not remote wiki
|
4
|
+
Given there is a wiki with no Cucumber features defined
|
5
|
+
And there are local features
|
6
|
+
When I push features
|
7
|
+
Then the local features should match the wiki
|
8
|
+
|
9
|
+
Scenario: Features exist both in remote wiki and locally
|
10
|
+
Given there is a wiki with Cucumber features defined
|
11
|
+
And there are local features
|
12
|
+
When I push features
|
13
|
+
Then the local features should match the wiki
|
@@ -0,0 +1,45 @@
|
|
1
|
+
def change_repo_url
|
2
|
+
config_file = File.join(@repo_dir, "gitnesse.rb")
|
3
|
+
config = File.read(config_file)
|
4
|
+
config.gsub!(/c\.repository_url.*$/, "c.repository_url = '#{@wiki_dir}'")
|
5
|
+
File.open(config_file, 'w') { |file| file.puts config }
|
6
|
+
end
|
7
|
+
|
8
|
+
Given(/^there is a wiki with Cucumber features defined$/) do
|
9
|
+
@wiki_dir = File.join(Dir.home, ".gitnesse/_features/wiki_with_features")
|
10
|
+
end
|
11
|
+
|
12
|
+
Given(/^there is a wiki with no Cucumber features defined$/) do
|
13
|
+
@wiki_dir = File.join(Dir.home, ".gitnesse/_features/wiki_without_features")
|
14
|
+
end
|
15
|
+
|
16
|
+
Given(/^there are no local features$/) do
|
17
|
+
@repo_dir = File.join(Dir.home, ".gitnesse/_features/repo_without_features")
|
18
|
+
change_repo_url
|
19
|
+
end
|
20
|
+
|
21
|
+
Given(/^there are local features$/) do
|
22
|
+
@repo_dir = File.join(Dir.home, ".gitnesse/_features/repo_with_features")
|
23
|
+
change_repo_url
|
24
|
+
end
|
25
|
+
|
26
|
+
Then(/^the local features should match the wiki$/) do
|
27
|
+
@assertion_dir = File.join(Dir.home, ".gitnesse/_features/assert")
|
28
|
+
|
29
|
+
system "git clone #{@wiki_dir} #{@assertion_dir} &> /dev/null"
|
30
|
+
|
31
|
+
wiki_features = Dir.glob("#{@assertion_dir}/**/*.feature.md")
|
32
|
+
repo_features = Dir.glob("#{@repo_dir}/features/**/*.feature")
|
33
|
+
|
34
|
+
repo_features.map! { |f| File.basename(f).downcase }
|
35
|
+
wiki_features.map! do |f|
|
36
|
+
File.basename(f, ".md").scan(/(\w+.feature)/).flatten[0].downcase
|
37
|
+
end
|
38
|
+
|
39
|
+
FileUtils.rm_rf(@assertion_dir)
|
40
|
+
FileUtils.mkdir_p(@assertion_dir)
|
41
|
+
|
42
|
+
wiki_features.each do |feature|
|
43
|
+
expect(repo_features).to include feature
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'gitnesse'
|
2
|
+
|
3
|
+
require 'rspec'
|
4
|
+
require 'cucumber/rspec/doubles'
|
5
|
+
|
6
|
+
wiki_url = "https://github.com/hybridgroup/gitnesse-demo.wiki.git"
|
7
|
+
repo_url = "https://github.com/hybridgroup/gitnesse-example-sinatra.git"
|
8
|
+
|
9
|
+
RSpec::Mocks::setup(self)
|
10
|
+
|
11
|
+
puts "Setting up Gitnesse for Cucumber testing:"
|
12
|
+
|
13
|
+
@root = File.join(Dir.home, ".gitnesse/_features")
|
14
|
+
FileUtils.mkdir_p(@root) unless File.directory?(@root)
|
15
|
+
|
16
|
+
@wiki_with_features = File.join(@root, "/wiki_with_features")
|
17
|
+
@wiki_without_features = File.join(@root, "/wiki_without_features")
|
18
|
+
@repo_with_features = File.join(@root, "/repo_with_features")
|
19
|
+
@repo_without_features = File.join(@root, "/repo_without_features")
|
20
|
+
@assertion_dir = File.join(@root, "/assertion")
|
21
|
+
|
22
|
+
dirs = [@wiki_with_features, @wiki_without_features, @repo_with_features,
|
23
|
+
@repo_without_features, @assertion_dir]
|
24
|
+
|
25
|
+
dirs.each do |dir|
|
26
|
+
FileUtils.rm_rf dir
|
27
|
+
FileUtils.mkdir_p dir
|
28
|
+
end
|
29
|
+
|
30
|
+
Dir.chdir(@wiki_with_features) do
|
31
|
+
puts "Cloning demo features wiki."
|
32
|
+
system("git clone --bare #{wiki_url} . &> /dev/null")
|
33
|
+
abort "Failed to clone demo features to #{@wiki_with_features}." if $? != 0
|
34
|
+
end
|
35
|
+
|
36
|
+
Dir.chdir(@wiki_without_features) do
|
37
|
+
puts "Creating demo wiki without features"
|
38
|
+
system("git init --bare &> /dev/null")
|
39
|
+
abort "Failed to create demo wiki in #{@wiki_without_features}." if $? != 0
|
40
|
+
end
|
41
|
+
|
42
|
+
Dir.chdir(@repo_with_features) do
|
43
|
+
puts "Cloning repo with existing features"
|
44
|
+
system "git clone #{repo_url} . &> /dev/null"
|
45
|
+
abort "Failed to clone demo repo to #{@repo_with_features}." if $? != 0
|
46
|
+
|
47
|
+
puts "Installing gems for demo repo."
|
48
|
+
if defined?(Bundler)
|
49
|
+
Bundler.with_clean_env do
|
50
|
+
system "bundle install --path vendor/bundle &> /dev/null"
|
51
|
+
end
|
52
|
+
else
|
53
|
+
system "bundle install --path vendor/bundle &> /dev/null"
|
54
|
+
end
|
55
|
+
abort "Failed to install gems for demo repo #{@repo_with_features}" if $? != 0
|
56
|
+
end
|
57
|
+
|
58
|
+
Dir.chdir(@repo_without_features) do
|
59
|
+
puts "Creating demo repo without features."
|
60
|
+
FileUtils.cp_r("#{@repo_with_features}/.", @repo_without_features)
|
61
|
+
Dir.glob("#{@repo_without_features}/**/*.feature") { |f| File.unlink(f) }
|
62
|
+
end
|
63
|
+
|
64
|
+
puts "Finished setting up Gitnesse for testing. Running features.", ''
|
65
|
+
|
66
|
+
at_exit do
|
67
|
+
dirs.each do |dir|
|
68
|
+
FileUtils.rm_rf dir
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
Gitnesse::Cli.task :cleanup do
|
2
|
+
desc "Cleans up project folders in ~/.gitnesse"
|
3
|
+
|
4
|
+
help do
|
5
|
+
<<-EOS
|
6
|
+
USAGE: gitnesse cleanup
|
7
|
+
|
8
|
+
#{desc}
|
9
|
+
|
10
|
+
Cleans up the folders for local copies of wikis Gitnesse leaves in ~/.gitnesse.
|
11
|
+
|
12
|
+
Examples:
|
13
|
+
gitnesse cleanup # will remove all subfolders from ~/.gitnesse
|
14
|
+
EOS
|
15
|
+
end
|
16
|
+
|
17
|
+
def perform
|
18
|
+
confirm
|
19
|
+
delete_folders
|
20
|
+
puts " Done."
|
21
|
+
end
|
22
|
+
|
23
|
+
def confirm
|
24
|
+
@folders = Dir["#{Dir.home}/.gitnesse/*"].reject { |f| f =~ /\/\_features/ }
|
25
|
+
|
26
|
+
unless @folders.any?
|
27
|
+
abort " No folders to delete."
|
28
|
+
end
|
29
|
+
|
30
|
+
puts " This will delete the following folders:"
|
31
|
+
|
32
|
+
@folders.each do |folder|
|
33
|
+
puts " - #{folder}"
|
34
|
+
end
|
35
|
+
|
36
|
+
puts " Please confirm (y|n):"
|
37
|
+
begin
|
38
|
+
until %w( k ok y yes n no ).include?(answer = $stdin.gets.chomp.downcase)
|
39
|
+
puts ' Please type y/yes or n/no.'
|
40
|
+
puts ' Remove folders? (y|n)'
|
41
|
+
end
|
42
|
+
rescue Interrupt
|
43
|
+
abort
|
44
|
+
end
|
45
|
+
|
46
|
+
abort if answer =~ /n/
|
47
|
+
end
|
48
|
+
|
49
|
+
def delete_folders
|
50
|
+
@folders.each do |folder|
|
51
|
+
puts " Deleting #{folder}."
|
52
|
+
FileUtils.rm_rf(folder)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -68,7 +68,11 @@ Examples:
|
|
68
68
|
def run_features
|
69
69
|
puts " Running cucumber."
|
70
70
|
puts ' -------------------', ''
|
71
|
-
|
71
|
+
if defined?(Bundler)
|
72
|
+
Bundler.with_clean_env { system "cucumber #{@config.features_dir}" }
|
73
|
+
else
|
74
|
+
system "cucumber #{@config.features_dir}"
|
75
|
+
end
|
72
76
|
puts ' -------------------', ''
|
73
77
|
end
|
74
78
|
|
@@ -16,14 +16,14 @@ module Gitnesse
|
|
16
16
|
display_errors if @errors.any?
|
17
17
|
end
|
18
18
|
|
19
|
+
def add_error(message)
|
20
|
+
@errors << message
|
21
|
+
end
|
22
|
+
|
19
23
|
def display_errors
|
20
24
|
puts "Configuration errors were found!"
|
21
|
-
|
22
|
-
|
23
|
-
puts " - #{error}"
|
24
|
-
end
|
25
|
-
|
26
|
-
exit
|
25
|
+
@errors.each { |error| puts " - #{error}" }
|
26
|
+
abort
|
27
27
|
end
|
28
28
|
|
29
29
|
# Checks that Git is installed on the system.
|
@@ -33,7 +33,7 @@ module Gitnesse
|
|
33
33
|
if system("git --version &> /dev/null")
|
34
34
|
true
|
35
35
|
else
|
36
|
-
|
36
|
+
add_error "Git not found or not working"
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -44,7 +44,7 @@ module Gitnesse
|
|
44
44
|
if system("cucumber --version &> /dev/null")
|
45
45
|
true
|
46
46
|
else
|
47
|
-
|
47
|
+
add_error "Cucumber not found or not working"
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
@@ -54,7 +54,7 @@ module Gitnesse
|
|
54
54
|
def check_repository_url
|
55
55
|
url = Gitnesse::Config.instance.repository_url
|
56
56
|
if url.nil? || url.empty?
|
57
|
-
|
57
|
+
add_error "You must specify a repository_url to run Gitnesse"
|
58
58
|
else
|
59
59
|
true
|
60
60
|
end
|
@@ -68,7 +68,7 @@ module Gitnesse
|
|
68
68
|
return true unless Gitnesse::Config.instance.annotate_results
|
69
69
|
identifier = Gitnesse::Config.instance.identifier
|
70
70
|
if identifier.nil? || identifier.empty?
|
71
|
-
|
71
|
+
add_error "You must specify identifier to use the annotate_results option"
|
72
72
|
else
|
73
73
|
true
|
74
74
|
end
|
@@ -79,7 +79,7 @@ module Gitnesse
|
|
79
79
|
if File.directory?(dir)
|
80
80
|
true
|
81
81
|
else
|
82
|
-
|
82
|
+
add_error "The features directory './#{dir}' does not exist."
|
83
83
|
end
|
84
84
|
end
|
85
85
|
end
|
data/lib/gitnesse/dir_manager.rb
CHANGED
@@ -30,8 +30,9 @@ module Gitnesse
|
|
30
30
|
#
|
31
31
|
# Returns a string path
|
32
32
|
def self.project_dir
|
33
|
-
|
34
|
-
|
33
|
+
@project_dir ||= begin
|
34
|
+
"#{Dir.home}/.gitnesse/#{File.basename(Dir.pwd)}"
|
35
|
+
end
|
35
36
|
end
|
36
37
|
end
|
37
38
|
end
|
data/lib/gitnesse/version.rb
CHANGED
data/lib/gitnesse/wiki.rb
CHANGED
@@ -20,7 +20,7 @@ module Gitnesse
|
|
20
20
|
@opts = opts
|
21
21
|
@config = Gitnesse::Config.instance
|
22
22
|
|
23
|
-
|
23
|
+
clone_or_update unless !opts[:clone]
|
24
24
|
|
25
25
|
@repo ||= Git.init(dir)
|
26
26
|
|
@@ -99,21 +99,41 @@ module Gitnesse
|
|
99
99
|
end
|
100
100
|
|
101
101
|
private
|
102
|
+
|
102
103
|
# Private: Clones or Updates the local copy of the remote wiki
|
103
104
|
#
|
104
105
|
# Returns nothing
|
105
|
-
def
|
106
|
+
def clone_or_update
|
106
107
|
if File.directory?(@dir + "/.git")
|
107
|
-
|
108
|
-
|
109
|
-
|
108
|
+
if Git.open(@dir).remote.url == @config.repository_url
|
109
|
+
update
|
110
|
+
else
|
111
|
+
clone
|
112
|
+
end
|
110
113
|
else
|
111
|
-
|
112
|
-
Dir.mkdir @dir unless File.directory?(@dir)
|
113
|
-
@repo = Git.clone @url, @dir
|
114
|
+
clone
|
114
115
|
end
|
115
116
|
|
116
117
|
@repo.checkout(@config.branch)
|
117
118
|
end
|
119
|
+
|
120
|
+
# Private: Clones the remote wiki into a local folder.
|
121
|
+
#
|
122
|
+
# Returns nothing
|
123
|
+
def clone
|
124
|
+
puts " Creating local copy of remote wiki."
|
125
|
+
FileUtils.rm_rf(@dir) if File.directory?(@dir)
|
126
|
+
Dir.mkdir(@dir)
|
127
|
+
@repo = Git.clone @url, @dir
|
128
|
+
end
|
129
|
+
|
130
|
+
# Private: Updates the local copy of the remote wiki
|
131
|
+
#
|
132
|
+
# Returns nothing
|
133
|
+
def update
|
134
|
+
puts " Updating local copy of remote wiki."
|
135
|
+
@repo = Git.open @dir
|
136
|
+
@repo.pull 'origin', @config.branch
|
137
|
+
end
|
118
138
|
end
|
119
139
|
end
|
data/lib/gitnesse/wiki/page.rb
CHANGED
@@ -13,7 +13,7 @@ module Gitnesse
|
|
13
13
|
@wiki_path = path
|
14
14
|
@relative_path = get_relative_path
|
15
15
|
@filename = get_filename
|
16
|
-
@path = "#{@relative_path}/#{@filename}"
|
16
|
+
@path = "#{@relative_path}/#{@filename}".gsub("//", "/")
|
17
17
|
end
|
18
18
|
|
19
19
|
# Public: Reads the file's contents. Caches result so only reads from FS
|
data/readme.md
ADDED
@@ -0,0 +1,194 @@
|
|
1
|
+
# Gitnesse
|
2
|
+
|
3
|
+
Gitnesse is an acceptance testing tool, enabling a project to store Cucumber
|
4
|
+
feature stories in a git-based wiki, test them against the code, and then update
|
5
|
+
the wiki with the latest test results.
|
6
|
+
|
7
|
+
Because the features are in a wiki, non-programmers can see them more easily,
|
8
|
+
and edit them using the wiki.
|
9
|
+
|
10
|
+
Gitnesse provides an awesome bi-directional testing flow between developers and
|
11
|
+
non-developers on a team.
|
12
|
+
|
13
|
+
Conceptually influenced by [Fitnesse][]. Thanks, Uncle Bob!
|
14
|
+
|
15
|
+
## Table Of Contents
|
16
|
+
- [Installation](#installation)
|
17
|
+
- [Dependencies](#dependencies)
|
18
|
+
- [Config](#config)
|
19
|
+
- [Tasks](#tasks)
|
20
|
+
- [Pull](#pull)
|
21
|
+
- [Push](#push)
|
22
|
+
- [Run](#run)
|
23
|
+
- [Info](#info)
|
24
|
+
- [Cleanup](#cleanup)
|
25
|
+
- [~/.gitnesse](#gitnesse)
|
26
|
+
- [Contributing](#contributing)
|
27
|
+
|
28
|
+
## Installation
|
29
|
+
|
30
|
+
You can add Gitnesse to your project's Gemfile:
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
gem 'gitnesse'
|
34
|
+
```
|
35
|
+
|
36
|
+
Or install it manually (recommended):
|
37
|
+
|
38
|
+
```
|
39
|
+
gem install gitnesse
|
40
|
+
```
|
41
|
+
|
42
|
+
Now add a `gitnesse.rb` file to your project. This will be used to configure
|
43
|
+
Gitnesse's behaviour.
|
44
|
+
|
45
|
+
An example config file:
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
# ~/dev/awesome_rails_app/config/
|
49
|
+
Gitnesse::Config.config do |c|
|
50
|
+
c.repository_url = "git@github.com:hybridgroup/gitnesse.wiki.git"
|
51
|
+
c.annotate_results = true
|
52
|
+
c.identifier = "Uncle Bob's Laptop"
|
53
|
+
end
|
54
|
+
```
|
55
|
+
|
56
|
+
A full description of each config option can be found in the [Config](#config)
|
57
|
+
section.
|
58
|
+
|
59
|
+
|
60
|
+
## Dependencies
|
61
|
+
|
62
|
+
Gitnesse has a few dependencies it needs to function properly:
|
63
|
+
|
64
|
+
1. Git must be installed
|
65
|
+
2. Cucumber must be installed and globally accessible (`gem install cucumber`)
|
66
|
+
|
67
|
+
## Config
|
68
|
+
|
69
|
+
Gitnesse loads config values from a `gitnesse.rb` file in your project. The
|
70
|
+
available configuration options are:
|
71
|
+
|
72
|
+
- **repository_url** - the Git URL to the remote git-based wiki you'd like to
|
73
|
+
use with Gitnesse. We recommend using the SSH url
|
74
|
+
(e.g `git@github.com:hybridgroup/gitnesse.wiki.git`)
|
75
|
+
- **features_dir** - the local directory Cucumber features are store in. This
|
76
|
+
defaults to `features`.
|
77
|
+
- **branch** - The git branch of the remote wiki to use. Defaults to `master`.
|
78
|
+
- **annotate_results** - Boolean, determines if Gitnesse will annotate Cucumber
|
79
|
+
results to wiki pages when `gitnesse run` is called. Defaults to `false`.
|
80
|
+
- **identifier** - If annotate_results is true, an identifier to use to indicate
|
81
|
+
who ran the results. e.g. `Uncle Bob's Laptop`.
|
82
|
+
|
83
|
+
## Tasks
|
84
|
+
|
85
|
+
Gitnesse comes with a few commands:
|
86
|
+
|
87
|
+
```
|
88
|
+
gitnesse pull
|
89
|
+
gitnesse push
|
90
|
+
gitnesse run
|
91
|
+
gitnesse info
|
92
|
+
gitnesse help
|
93
|
+
gitnesse cleanup
|
94
|
+
```
|
95
|
+
|
96
|
+
All of these commands are also available as Rake tasks, if you've added Gitnesse
|
97
|
+
to your Gemfile:
|
98
|
+
|
99
|
+
```
|
100
|
+
rake gitnesse:pull
|
101
|
+
rake gitnesse:push
|
102
|
+
rake gitnesse:run
|
103
|
+
rake gitnesse:info
|
104
|
+
rake gitnesse:cleanup
|
105
|
+
```
|
106
|
+
|
107
|
+
If you're using Gitnesse with a Rails app, these rake tasks will be hooked up
|
108
|
+
automatically. If you're not using Rails, but still want the rake tasks, add
|
109
|
+
this line to your Rakefile:
|
110
|
+
|
111
|
+
```ruby
|
112
|
+
require 'gitnesse/tasks'
|
113
|
+
```
|
114
|
+
|
115
|
+
### pull
|
116
|
+
|
117
|
+
`gitnesse pull` pulls features from the remote git wiki, and updates/replaces
|
118
|
+
the relevant local features. It also creates new local features if they don't
|
119
|
+
already exist.
|
120
|
+
|
121
|
+
### push
|
122
|
+
|
123
|
+
`gitnesse push` pushes local features to the remote git wiki,
|
124
|
+
updating/replacing/creating as necessary. It also adds index pages, so for
|
125
|
+
example if your `features` folder looked like this:
|
126
|
+
|
127
|
+
```
|
128
|
+
features
|
129
|
+
├── purchasing
|
130
|
+
│ ├── purchasing.feature
|
131
|
+
└── subscribing
|
132
|
+
├── subscriping_logged_in.feature
|
133
|
+
├── subscribing_logged_out.feature
|
134
|
+
└── subscribing_fail.feature
|
135
|
+
```
|
136
|
+
|
137
|
+
Gitnesse would create these wiki pages:
|
138
|
+
|
139
|
+
```
|
140
|
+
features.md
|
141
|
+
features > purchasing.md
|
142
|
+
features > purchasing > purchasing.feature.md
|
143
|
+
features > subscribing.md
|
144
|
+
features > subscribing > subscriping_logged_in.feature.md
|
145
|
+
features > subscribing > subscribing_logged_out.feature.md
|
146
|
+
features > subscribing > subscribing_fail.feature.md
|
147
|
+
```
|
148
|
+
|
149
|
+
### run
|
150
|
+
|
151
|
+
`gitnesse run` pulls remote wiki features to local, similarly to `gitnesse
|
152
|
+
pull`, but then it runs Cucumber on the updated feature. If the
|
153
|
+
**annotate_results** settings is enabled, it will push annotated Cucumber
|
154
|
+
results for each feature scenario to the remote wiki.
|
155
|
+
|
156
|
+
### info
|
157
|
+
|
158
|
+
`gitnesse info` prints the current Gitnesse configuration info. Useful for
|
159
|
+
debugging purposes and sanity checking.
|
160
|
+
|
161
|
+
### cleanup
|
162
|
+
|
163
|
+
`gitnesse cleanup` cleans up the folders Gitnesse creates in `~/.gitnesse` to
|
164
|
+
store local copies of remote wikis. It prompts for confirmatino before deleting
|
165
|
+
anything.
|
166
|
+
|
167
|
+
## ~/.gitnesse
|
168
|
+
|
169
|
+
To store local copies of your remote wikis, Gitnesse creates a hidden folder in
|
170
|
+
your home folder called `~/.gitnesse`. The wikis are stored in the project
|
171
|
+
folder, so for example if you have a project called 'awesome_rails_app', it's
|
172
|
+
wiki would appear in `~/.gitnesse/awesome_rails_app`.
|
173
|
+
|
174
|
+
## Contributing
|
175
|
+
|
176
|
+
First of all, thanks! We appreciate any help you can give Gitnesse.
|
177
|
+
|
178
|
+
The main way you can contribute is with some code! Here's how:
|
179
|
+
|
180
|
+
1. [Fork](https://help.github.com/articles/fork-a-repo) Gitnesse
|
181
|
+
2. Create a topic branch: `git checkout -b my_awesome_feature`
|
182
|
+
3. Push to your branch - `git push origin my_awesome_feature`
|
183
|
+
4. Create a [Pull Request](http://help.github.com/pull-requests/) from your branch
|
184
|
+
5. That's it!
|
185
|
+
|
186
|
+
We use RSpec for testing. Please include tests with your pull request. A simple
|
187
|
+
`bundle exec rake` will run the suite. Also, please try to [TomDoc][] your
|
188
|
+
methods, it makes it easier to see what the code does and makes it easier for
|
189
|
+
future contributors to get started.
|
190
|
+
|
191
|
+
(c) 2012-2013 The Hybrid Group
|
192
|
+
|
193
|
+
[Fitnesse]: http://fitnesse.org/
|
194
|
+
[TomDoc]: http://tomdoc.org/
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'gitnesse/cli'
|
3
|
+
|
4
|
+
module Gitnesse
|
5
|
+
describe Cli, type: :cli do
|
6
|
+
let(:help) do
|
7
|
+
<<-EOS
|
8
|
+
USAGE: gitnesse cleanup
|
9
|
+
|
10
|
+
Cleans up project folders in ~/.gitnesse
|
11
|
+
|
12
|
+
Cleans up the folders for local copies of wikis Gitnesse leaves in ~/.gitnesse.
|
13
|
+
|
14
|
+
Examples:
|
15
|
+
gitnesse cleanup # will remove all subfolders from ~/.gitnesse
|
16
|
+
EOS
|
17
|
+
end
|
18
|
+
|
19
|
+
it "has help info" do
|
20
|
+
expect(gitnesse("help cleanup")).to eq help
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -8,10 +8,11 @@ module Gitnesse
|
|
8
8
|
USAGE: gitnesse <task> [<args>]
|
9
9
|
|
10
10
|
The gitnesse tasks are:
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
cleanup Cleans up project folders in ~/.gitnesse
|
12
|
+
info Prints current Gitnesse configuration
|
13
|
+
pull Pulls features from remote git-based wiki
|
14
|
+
push Pushes local features to remote git-based wiki
|
15
|
+
run Pulls changes from remote git-based wiki, and runs Cucumber.
|
15
16
|
|
16
17
|
See 'gitnesse help <task>' for more information on a specific task.
|
17
18
|
EOS
|
@@ -37,7 +37,7 @@ module Gitnesse
|
|
37
37
|
|
38
38
|
checker.should_receive(:puts).with("Configuration errors were found!")
|
39
39
|
checker.should_receive(:puts).with(" - this is an example error")
|
40
|
-
checker.should_receive(:
|
40
|
+
checker.should_receive(:abort)
|
41
41
|
end
|
42
42
|
|
43
43
|
it "prints a note saying errors were found" do
|
data/spec/lib/wiki_spec.rb
CHANGED
@@ -4,7 +4,7 @@ module Gitnesse
|
|
4
4
|
describe Wiki do
|
5
5
|
describe "#remove_features" do
|
6
6
|
before do
|
7
|
-
Wiki.any_instance.stub(:
|
7
|
+
Wiki.any_instance.stub(:clone_or_update).and_return(true)
|
8
8
|
|
9
9
|
@repo = double('repo', status: [])
|
10
10
|
expect(Git).to receive(:init).with("~/.gitnesse/gitnesse").and_return(@repo)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitnesse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- www.hybridgroup.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,12 +94,19 @@ extra_rdoc_files: []
|
|
94
94
|
files:
|
95
95
|
- .gitignore
|
96
96
|
- .travis.yml
|
97
|
+
- CONTRIBUTORS.md
|
97
98
|
- Gemfile
|
98
99
|
- LICENSE.txt
|
99
100
|
- Rakefile
|
100
101
|
- bin/.keep
|
101
102
|
- bin/gitnesse
|
102
103
|
- config/gitnesse.rb.example
|
104
|
+
- features/pull.feature
|
105
|
+
- features/push.feature
|
106
|
+
- features/step_definitions/gitnesse_steps.rb
|
107
|
+
- features/step_definitions/pull_steps.rb
|
108
|
+
- features/step_definitions/push_steps.rb
|
109
|
+
- features/support/env.rb
|
103
110
|
- gitnesse.gemspec
|
104
111
|
- lib/gitnesse.rb
|
105
112
|
- lib/gitnesse/cli.rb
|
@@ -107,6 +114,7 @@ files:
|
|
107
114
|
- lib/gitnesse/cli/helpers/feature_helpers.rb
|
108
115
|
- lib/gitnesse/cli/helpers/wiki_helpers.rb
|
109
116
|
- lib/gitnesse/cli/task.rb
|
117
|
+
- lib/gitnesse/cli/task/cleanup.rb
|
110
118
|
- lib/gitnesse/cli/task/help.rb
|
111
119
|
- lib/gitnesse/cli/task/info.rb
|
112
120
|
- lib/gitnesse/cli/task/pull.rb
|
@@ -127,6 +135,8 @@ files:
|
|
127
135
|
- lib/gitnesse/version.rb
|
128
136
|
- lib/gitnesse/wiki.rb
|
129
137
|
- lib/gitnesse/wiki/page.rb
|
138
|
+
- readme.md
|
139
|
+
- spec/lib/cli/task/cleanup_spec.rb
|
130
140
|
- spec/lib/cli/task/help_spec.rb
|
131
141
|
- spec/lib/cli/task/info_spec.rb
|
132
142
|
- spec/lib/cli/task/pull_spec.rb
|
@@ -165,16 +175,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
165
175
|
version: '0'
|
166
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
177
|
requirements:
|
168
|
-
- - '
|
178
|
+
- - '>='
|
169
179
|
- !ruby/object:Gem::Version
|
170
|
-
version:
|
180
|
+
version: '0'
|
171
181
|
requirements: []
|
172
182
|
rubyforge_project:
|
173
|
-
rubygems_version: 2.
|
183
|
+
rubygems_version: 2.1.2
|
174
184
|
signing_key:
|
175
185
|
specification_version: 4
|
176
186
|
summary: Sync your feature stories using a Git-based wiki!
|
177
187
|
test_files:
|
188
|
+
- features/pull.feature
|
189
|
+
- features/push.feature
|
190
|
+
- features/step_definitions/gitnesse_steps.rb
|
191
|
+
- features/step_definitions/pull_steps.rb
|
192
|
+
- features/step_definitions/push_steps.rb
|
193
|
+
- features/support/env.rb
|
194
|
+
- spec/lib/cli/task/cleanup_spec.rb
|
178
195
|
- spec/lib/cli/task/help_spec.rb
|
179
196
|
- spec/lib/cli/task/info_spec.rb
|
180
197
|
- spec/lib/cli/task/pull_spec.rb
|