Module: Gitnesse
- Extended by:
- Gitnesse
- Included in:
- Gitnesse
- Defined in:
- lib/gitnesse.rb,
lib/gitnesse/wiki.rb,
lib/gitnesse/hooks.rb,
lib/gitnesse/tasks.rb,
lib/gitnesse/railtie.rb,
lib/gitnesse/version.rb,
lib/gitnesse/features.rb,
lib/gitnesse/git_config.rb,
lib/gitnesse/dependencies.rb,
lib/gitnesse/configuration.rb
Overview
core module
Defined Under Namespace
Classes: Configuration, Dependencies, Features, GitConfig, Hooks, Railtie, Tasks, Wiki
Constant Summary collapse
- VERSION =
"0.12.5"
Class Attribute Summary collapse
-
.commit_info ⇒ Object
Returns the value of attribute commit_info.
-
.configuration ⇒ Object
Returns the value of attribute configuration.
Class Method Summary collapse
- .clone_feature_repo(dir) ⇒ Object
- .configure {|configuration| ... } ⇒ Object
- .generate_commit_info ⇒ Object
-
.pull ⇒ Object
pull features from git wiki, and sync up with features dir.
-
.push ⇒ Object
push features back up to git wiki from features directory.
- .push_results ⇒ Object
- .run ⇒ Object
Class Attribute Details
.commit_info ⇒ Object
Returns the value of attribute commit_info.
17 18 19 |
# File 'lib/gitnesse.rb', line 17 def commit_info @commit_info end |
.configuration ⇒ Object
Returns the value of attribute configuration.
16 17 18 |
# File 'lib/gitnesse.rb', line 16 def configuration @configuration end |
Class Method Details
.clone_feature_repo(dir) ⇒ Object
90 91 92 93 94 |
# File 'lib/gitnesse.rb', line 90 def clone_feature_repo(dir) output = `git clone #{Gitnesse.configuration.repository_url} #{dir} 2>&1` puts output $?.success? end |
.configure {|configuration| ... } ⇒ Object
24 25 26 |
# File 'lib/gitnesse.rb', line 24 def self.configure yield(configuration) end |
.generate_commit_info ⇒ Object
96 97 98 99 100 101 102 |
# File 'lib/gitnesse.rb', line 96 def generate_commit_info self.commit_info ||= begin user_name = GitConfig.read("user.name") email = GitConfig.read("user.email") { :name => user_name, :email => email, :message => "Update features with Gitnesse" } end end |
.pull ⇒ Object
pull features from git wiki, and sync up with features dir
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/gitnesse.rb', line 48 def pull Dependencies.check puts "Pulling features into #{Gitnesse.configuration.target_directory} from #{Gitnesse.configuration.repository_url}..." Dir.mktmpdir do |tmp_dir| if clone_feature_repo(tmp_dir) FileUtils.mkdir(Gitnesse.configuration.target_directory) unless File.exists?(Gitnesse.configuration.target_directory) wiki_pages = Wiki.new(tmp_dir).pages wiki_pages.each do |page| name = page.name.gsub('.feature', '') filename = "#{Gitnesse.configuration.target_directory}/#{name}.feature" features = Wiki.extract_features(page) Features.write_file(filename, features) unless features.empty? end end end puts " Done pulling features." true end |
.push ⇒ Object
push features back up to git wiki from features directory
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/gitnesse.rb', line 70 def push Dependencies.check generate_commit_info puts "Pushing features from #{Gitnesse.configuration.target_directory} to #{Gitnesse.configuration.repository_url}..." Dir.mktmpdir do |tmp_dir| if clone_feature_repo(tmp_dir) feature_files = Dir.glob("#{Gitnesse.configuration.target_directory}/*.feature") Wiki.new(tmp_dir).load_feature_files(feature_files) # push the changes to the remote git Dir.chdir(tmp_dir) do puts `git push origin master` end end end puts " Done pushing features." true end |
.push_results ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/gitnesse.rb', line 39 def push_results if push Hooks.create puts "Now going to run cucumber..." exec("cucumber #{Gitnesse.configuration.target_directory}/*.feature") end end |
.run ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/gitnesse.rb', line 31 def run if pull Hooks.create puts "Now going to run cucumber..." exec("cucumber #{Gitnesse.configuration.target_directory}/*.feature") end end |