Module: Gitnesse::Cli::WikiHelpers

Included in:
Task
Defined in:
lib/gitnesse/cli/helpers/wiki_helpers.rb

Instance Method Summary collapse

Instance Method Details

#clone_wikiObject

Public: Clones or updates local copy of remote git-based wiki. Also prints message indicating which operation is taking place

Returns instance of Gitnesse::Wiki referring to new/updated local wiki



8
9
10
11
12
13
14
15
16
17
# File 'lib/gitnesse/cli/helpers/wiki_helpers.rb', line 8

def clone_wiki
  opts = {}
  @dir = Gitnesse::DirManager.project_dir

  unless Gitnesse::DirManager.project_dir_present?
    Gitnesse::DirManager.make_project_dir
  end

  @wiki = Gitnesse::Wiki.new @config.repository_url, @dir
end

#commit_and_push_changesObject

Public: Commits wiki changes, and pushes changes to remote wiki.

Returns nothing.



29
30
31
32
33
34
35
# File 'lib/gitnesse/cli/helpers/wiki_helpers.rb', line 29

def commit_and_push_changes
  puts "  Commiting changes."
  @wiki.commit

  puts "  Pushing changes to remote wiki."
  @wiki.push
end

#extract_features_from_wikiObject

Public: Extracts wiki pages that contain cucumber features.

Returns an array of wiki pages containing features



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/gitnesse/cli/helpers/wiki_helpers.rb', line 40

def extract_features_from_wiki
  unless @wiki.pages.any?
    abort "  Wiki contains no features."
  end

  puts "  Extracting wiki pages containing features."

  @feature_pages = @wiki.pages.select do |page|
    Gitnesse::FeatureExtractor.contains_features? page.read
  end
end

#remove_existing_featuresObject

Public: Removes existing features from local copy of remote wiki.

Returns nothing.



22
23
24
# File 'lib/gitnesse/cli/helpers/wiki_helpers.rb', line 22

def remove_existing_features
  @wiki.remove_features
end