Skip to content

Commit

Permalink
Merge pull request #909 from calabash/feature/dot-dir
Browse files Browse the repository at this point in the history
Calabash can manage a ~/.calabash directory
  • Loading branch information
jmoody committed Nov 14, 2015
2 parents d38279c + 19c8305 commit 07ee4bc
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Expand Up @@ -30,6 +30,9 @@ Gemfile.lock
.ruby-gemset
.bundle

# rspec
calabash-cucumber/spec/reports

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc

Expand All @@ -52,3 +55,6 @@ __MACOSX

# emacs
(.*/)?\#[^/]*\#$

# vim
*.swp
1 change: 1 addition & 0 deletions bin
2 changes: 2 additions & 0 deletions calabash-cucumber/.rspec
Expand Up @@ -2,4 +2,6 @@
#--warnings
#--backtrace
--format documentation
--format RspecJunitFormatter
--out spec/reports/rspec.xml
--require spec_helper
1 change: 1 addition & 0 deletions calabash-cucumber/calabash-cucumber.gemspec
Expand Up @@ -76,6 +76,7 @@ Gem::Specification.new do |s|
s.add_development_dependency 'redcarpet', '3.2.0'

# Shared with run-loop.
s.add_development_dependency("rspec_junit_formatter")
s.add_development_dependency 'luffa', '>= 1.1.0' # Remove ASAP.
s.add_development_dependency 'rake'
s.add_development_dependency 'rspec'
Expand Down
1 change: 1 addition & 0 deletions calabash-cucumber/lib/calabash-cucumber.rb
@@ -1,3 +1,4 @@
require "calabash-cucumber/dot_dir"
require 'calabash-cucumber/core'
require 'calabash-cucumber/tests_helpers'
require 'calabash-cucumber/keyboard_helpers'
Expand Down
13 changes: 13 additions & 0 deletions calabash-cucumber/lib/calabash-cucumber/dot_dir.rb
@@ -0,0 +1,13 @@
# A module for managing the ~/.calabash directory.
module Calabash::DotDir

def self.directory
home = RunLoop::Environment.user_home_directory
dir = File.join(home, ".calabash")
if !File.exist?(dir)
FileUtils.mkdir_p(dir)
end
dir
end
end

17 changes: 17 additions & 0 deletions calabash-cucumber/spec/lib/dot_dir_spec.rb
@@ -0,0 +1,17 @@
describe Calabash::DotDir do

let(:home_dir) { "./tmp/dot-calaash-examples" }
let(:dot_dir) { File.join(home_dir, ".calabash") }

before do
allow(RunLoop::Environment).to receive(:user_home_directory).and_return home_dir
FileUtils.rm_rf(home_dir)
end

it ".directory" do
path = Calabash::DotDir.directory

expect(File.exist?(path)).to be_truthy
end
end

12 changes: 12 additions & 0 deletions script/ci/jenkins/rspec.sh
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

cd calabash-cucumber
rbenv local 2.2.3
gem uninstall -Vax --force --no-abort-on-dependent run_loop
bundle update
rm -rf spec/reports
rbenv exec \
bundle exec \
rspec \
spec/lib

0 comments on commit 07ee4bc

Please sign in to comment.