dirt 0.1.1

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.
Files changed (41) hide show
  1. data/Gemfile +22 -0
  2. data/Gemfile.lock +91 -0
  3. data/MIT-LICENSE +23 -0
  4. data/README.md +150 -0
  5. data/core/contexts/commit_git_repository.rb +56 -0
  6. data/core/contexts/create_basic_face.rb +60 -0
  7. data/core/contexts/create_default_structure.rb +57 -0
  8. data/core/contexts/create_git_repository.rb +45 -0
  9. data/core/contexts/roles/.gitkeep +0 -0
  10. data/core/contexts/roles/generating.rb +26 -0
  11. data/core/dirt.rb +14 -0
  12. data/core/models/.gitkeep +0 -0
  13. data/core/tests/behaviours/commit_files.feature +36 -0
  14. data/core/tests/behaviours/create_basic_face.feature +49 -0
  15. data/core/tests/behaviours/create_default_structure.feature +55 -0
  16. data/core/tests/behaviours/create_vcs_repository.feature +26 -0
  17. data/core/tests/behaviours/step_definitions/given.rb +18 -0
  18. data/core/tests/behaviours/step_definitions/then.rb +55 -0
  19. data/core/tests/behaviours/step_definitions/when.rb +21 -0
  20. data/core/tests/behaviours/support/env.rb +100 -0
  21. data/core/tests/behaviours/support/helpers.rb +21 -0
  22. data/core/tests/factories.rb +23 -0
  23. data/core/version.rb +3 -0
  24. data/faces/cli/bin/dirt +6 -0
  25. data/faces/cli/integrations/generate_context.feature +40 -0
  26. data/faces/cli/integrations/generate_face.feature +53 -0
  27. data/faces/cli/integrations/generate_model.feature +11 -0
  28. data/faces/cli/integrations/generate_project.feature +143 -0
  29. data/faces/cli/integrations/generate_role.feature +12 -0
  30. data/faces/cli/integrations/step_definitions/given.rb +16 -0
  31. data/faces/cli/integrations/step_definitions/then.rb +48 -0
  32. data/faces/cli/integrations/step_definitions/when.rb +28 -0
  33. data/faces/cli/integrations/support/env.rb +21 -0
  34. data/faces/cli/optparse/main.rb +143 -0
  35. data/faces/cli/thor/.gitkeep +0 -0
  36. data/templates/faces/web/template.helpers.rb +4 -0
  37. data/templates/template.Gemfile +18 -0
  38. data/templates/template.env.rb +13 -0
  39. data/templates/template.gitignore +21 -0
  40. data/templates/template.project_name.rb +14 -0
  41. metadata +104 -0
@@ -0,0 +1,45 @@
1
+ #--
2
+ # Copyright (c) 2014 Tenjin Inc.
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #++
23
+
24
+ module Samling
25
+ class CreateGitRepository < Dirt::Context
26
+ def initialize(project_path, bare_parent_path, host, user)
27
+ @project_path = Pathname.new(project_path)
28
+ @bare_path = Pathname.new(bare_parent_path) + (@project_path.basename.to_s + '.git')
29
+ @host = host
30
+ @user = user
31
+ end
32
+
33
+ def call
34
+ if @host.blank?
35
+ system(%Q{git init --bare #{@bare_path}})
36
+ system(%Q{git clone "#{@bare_path}" "#{@project_path}"})
37
+ else
38
+ system(%Q{ssh #{@user}@#{@host} "git init --bare #{@bare_path}"})
39
+ system(%Q{git clone #{@user}@#{@host}:#{@bare_path} "#{@project_path}"})
40
+ end
41
+ end
42
+ end
43
+ end
44
+
45
+
File without changes
@@ -0,0 +1,26 @@
1
+ module Samling
2
+ class Generating < Dirt::Role
3
+ def generate_templates(generated_project_root)
4
+ templates_dir = Dirt::PROJECT_ROOT + 'templates/'
5
+ project_name = generated_project_root.basename.to_s
6
+
7
+ @decorated.each do |f, t|
8
+ file = generated_project_root + f.gsub('project_name', project_name)
9
+
10
+ FileUtils.mkdir_p(file.dirname)
11
+
12
+ if t
13
+ template_file = templates_dir + t
14
+
15
+ file.open('w') do |file|
16
+ content = File.read(template_file.to_s).gsub('<project_name>', project_name)
17
+
18
+ file.write(content)
19
+ end
20
+ else
21
+ FileUtils.touch(file.to_s)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,14 @@
1
+ require 'pathname'
2
+ require 'dirt/core'
3
+ require 'active_support'
4
+
5
+ app_dir = Pathname.new(__FILE__).dirname
6
+
7
+ # require ALL the files!
8
+ Dir["#{app_dir}/**/*.rb"].reject { |f| f.include?('/faces/') || f.include?('/tests/') }.each do |file|
9
+ require file
10
+ end
11
+
12
+ module Dirt
13
+ PROJECT_ROOT = Pathname.new(File.dirname(__FILE__) + '/..').realpath
14
+ end
File without changes
@@ -0,0 +1,36 @@
1
+ Feature: it should commit all files and directories to VCS
2
+
3
+ Scenario Outline: committing the default structure
4
+ Given the default structure exists in "<project_directory>"
5
+ And the following files exist:
6
+ | path |
7
+ | <project_directory>/.git/some_git_file |
8
+ | <project_directory>/.git/.hidden_git_file |
9
+ When it commits all files and directories in "<project_directory>"
10
+ Then there should be .gitkeep files in exactly the following directories of "<project_directory>"
11
+ | path |
12
+ | core/contexts/roles |
13
+ | core/models |
14
+ | core/tests/isolations |
15
+ | faces |
16
+ | persist |
17
+ And it should run git add on exactly the following files in "<project_directory>":
18
+ | path |
19
+ | Gemfile |
20
+ | .gitignore |
21
+ | core/<project_name>.rb |
22
+ | core/contexts/roles/.gitkeep |
23
+ | core/models/.gitkeep |
24
+ | core/tests/behaviours/support/env.rb |
25
+ | core/tests/behaviours/step_definitions/given.rb |
26
+ | core/tests/behaviours/step_definitions/when.rb |
27
+ | core/tests/behaviours/step_definitions/then.rb |
28
+ | core/tests/isolations/.gitkeep |
29
+ | faces/.gitkeep |
30
+ | persist/.gitkeep |
31
+ And it should run "git --git-dir "<project_directory>/.git" --work-tree "<project_directory>" commit -am "Project init with Dirt.""
32
+ And it should run "git --git-dir "<project_directory>/.git" --work-tree "<project_directory>" push origin master"
33
+ Examples:
34
+ | project_directory | project_name |
35
+ | /a_path/to/the project/my_project | my_project |
36
+ | /some/other/path/my_other_project | my_other_project |
@@ -0,0 +1,49 @@
1
+ Feature: create default face
2
+
3
+ Scenario Outline: the project root directory does not exist
4
+ When I create a new basic face "<face_name>" at "<project_root>"
5
+ Then there should be exactly the following directories in "<project_root>/faces/<face_name>":
6
+ | path |
7
+ | integrations |
8
+ | integrations/support |
9
+ | integrations/step_definitions |
10
+ Examples:
11
+ | project_root | face_name |
12
+ | | my_face |
13
+ | /a_path/to/the project | my_face |
14
+ | | my_other_face |
15
+ | /some/other/path | my_other_face |
16
+
17
+ Scenario Outline: parent directories exist
18
+ Given the following directories exist:
19
+ | path |
20
+ | <project_path>/faces/<face_name>/integrations/support/ |
21
+ | <project_path>/faces/<face_name>/integrations/step_definitions/ |
22
+ When I create a new basic face "<face_name>" at "<project_path>"
23
+ Then there should be files for "<project_name>" from templates:
24
+ | path | template |
25
+ | /<project_path>/faces/<face_name>/integrations/support/env.rb | template.env.rb |
26
+ | /<project_path>/faces/<face_name>/integrations/step_definitions/given.rb | |
27
+ | /<project_path>/faces/<face_name>/integrations/step_definitions/when.rb | |
28
+ | /<project_path>/faces/<face_name>/integrations/step_definitions/then.rb | |
29
+ Examples:
30
+ | project_name | project_path | face_name |
31
+ | my_project | my_project | web |
32
+ | another_project | somewhere/another_project | web |
33
+ | my_project | my_project | cli |
34
+ | another_project | somewhere/another_project | cli |
35
+
36
+ Scenario Outline: parent directories do not exist
37
+ When I create a new basic face "<face_name>" at "<project_path>"
38
+ Then there should be files for "<project_name>" from templates:
39
+ | path | template |
40
+ | <project_path>/faces/<face_name>/integrations/support/env.rb | template.env.rb |
41
+ | <project_path>/faces/<face_name>/integrations/step_definitions/given.rb | |
42
+ | <project_path>/faces/<face_name>/integrations/step_definitions/when.rb | |
43
+ | <project_path>/faces/<face_name>/integrations/step_definitions/then.rb | |
44
+ Examples:
45
+ | project_name | project_path | face_name |
46
+ | my_project | my_project | web |
47
+ | another_project | somewhere/another_project | web |
48
+ | my_project | my_project | cli |
49
+ | another_project | somewhere/another_project | cli |
@@ -0,0 +1,55 @@
1
+ Feature: it should create the expected directory tree
2
+
3
+ Scenario Outline: the project root directory does not exist
4
+ When I create a new project in "<full_project_path>"
5
+ Then there should be exactly the following directories in "/<full_project_path>":
6
+ | path |
7
+ | core |
8
+ | core/contexts |
9
+ | core/contexts/roles |
10
+ | core/models |
11
+ | core/tests |
12
+ | core/tests/behaviours |
13
+ | core/tests/behaviours/support |
14
+ | core/tests/behaviours/step_definitions |
15
+ | core/tests/isolations |
16
+ | faces |
17
+ | persist |
18
+ Examples:
19
+ | full_project_path |
20
+ | my_project |
21
+ | a_path/to/the project/my_project |
22
+ | my_other_project |
23
+ | some/other/path/my_other_project |
24
+
25
+ Scenario Outline: parent directories exist
26
+ Given the following directories exist:
27
+ | path |
28
+ | <project_path>/core/tests/behaviours/support/ |
29
+ When I create a new project in "<project_path>"
30
+ Then there should be files for "<project_name>" from templates:
31
+ | path | template |
32
+ | <project_path>/core/<project_name>.rb | template.project_name.rb |
33
+ | <project_path>/Gemfile | template.Gemfile |
34
+ | <project_path>/.gitignore | template.gitignore |
35
+ | <project_path>/core/tests/behaviours/support/env.rb | template.env.rb |
36
+ | <project_path>/core/tests/behaviours/step_definitions/given.rb | |
37
+ | <project_path>/core/tests/behaviours/step_definitions/when.rb | |
38
+ | <project_path>/core/tests/behaviours/step_definitions/then.rb | |
39
+ Examples:
40
+ | project_path | project_name |
41
+ | my_project | my_project |
42
+ | somewhere/another_project | another_project |
43
+
44
+ Scenario Outline: parent directories do not exist
45
+ When I create a new project in "<project_path>"
46
+ Then there should be files for "<project_name>" from templates:
47
+ | path | template |
48
+ | <project_path>/core/<project_name>.rb | template.project_name.rb |
49
+ | <project_path>/Gemfile | template.Gemfile |
50
+ | <project_path>/.gitignore | template.gitignore |
51
+ | <project_path>/core/tests/behaviours/support/env.rb | template.env.rb |
52
+ Examples:
53
+ | project_name | project_path |
54
+ | my_project | my_project |
55
+ | another_project | somewhere/another_project |
@@ -0,0 +1,26 @@
1
+ Feature: create VCS repository
2
+
3
+ # It may be that one day we want to separate bare creation to a switchable step,
4
+ # but we don't need it yet - remiller
5
+
6
+ Scenario Outline: local host
7
+ When it creates a VCS bare under bare_path: "<given_bare_path>", and project_path: "<working_project_path>"
8
+ Then it should run exactly:
9
+ | command |
10
+ | git init --bare <created_bare_path> |
11
+ | git clone <created_bare_path> <working_project_path> |
12
+ Examples:
13
+ | working_project_path | given_bare_path | created_bare_path |
14
+ | the/project/path | some | some/path.git |
15
+ | another/project | different/bares | different/bares/project.git |
16
+
17
+ Scenario Outline: remote host
18
+ When it creates a bare VCS under host: "<host>", user: "<user>", bare_path: "<given_bares_path>", and project_path: "<working_project_path>"
19
+ Then it should run exactly:
20
+ | command |
21
+ | ssh <user>@<host> "git init --bare <created_bare_path>" |
22
+ | git clone <user>@<host>:<created_bare_path> <working_project_path> |
23
+ Examples:
24
+ | host | user | working_project_path | given_bares_path | created_bare_path |
25
+ | machine1 | userA | the/project/my_project | some/git/ | some/git/my_project.git |
26
+ | machine2 | userB | another/my_other_project | different/bares | different/bares/my_other_project.git |
@@ -0,0 +1,18 @@
1
+ Given(/^a step that is unimplemented$/) do
2
+ pending 'Finish defining this test!'
3
+ end
4
+
5
+ Given(/^the following (files|directories) exist:$/) do |type, table|
6
+ table.hashes.each do |h|
7
+ if type == 'directories'
8
+ FileUtils.mkdir_p(h[:path])
9
+ else
10
+ FileUtils.mkdir_p(File.dirname(h[:path]))
11
+ FileUtils.touch(h[:path])
12
+ end
13
+ end
14
+ end
15
+
16
+ Given(/^the default structure exists in "(.*?)"$/) do |project_dir|
17
+ Samling::CreateDefaultStructure.run(project_dir)
18
+ end
@@ -0,0 +1,55 @@
1
+ Then(/^it should run "(.*?)"$/) do |command|
2
+ recent_history.should include command.shellsplit
3
+ end
4
+
5
+ Then(/^it should run exactly:$/) do |table|
6
+ commands = table.hashes.collect do |h|
7
+ h[:command].shellsplit
8
+ end
9
+
10
+ recent_history(commands.size).should == commands
11
+ end
12
+
13
+ Then(/^it should run git add on exactly the following files in "(.*?)":$/) do |base_path, table|
14
+ expected_commands = table.hashes.collect do |h|
15
+ path = Pathname.new(base_path) + h[:path]
16
+
17
+ %Q{git --git-dir "#{base_path}/.git" --work-tree "#{base_path}" add -v "#{path}"}.shellsplit
18
+ end
19
+
20
+ recent_history(expected_commands.size).should =~ expected_commands
21
+ end
22
+
23
+ Then(/^there should be exactly the following (files|directories) in "(.*?)":$/) do |type, location, table|
24
+ created_files = Dir.glob(location + '/**/*').select { |f| type == 'files' ? File.file?(f) : File.directory?(f) }
25
+ expected_files = table.hashes.collect { |h| (Pathname.new(location) + h[:path]).to_s }
26
+
27
+ created_files.should =~ expected_files
28
+ end
29
+
30
+ Then(/^there should be \.gitkeep files in exactly the following directories of "(.*?)"$/) do |project_directory, table|
31
+ table.hashes.each do |h|
32
+ expected_file = (Pathname.new(project_directory) + h[:path]) + '.gitkeep'
33
+ expected_file.should exist
34
+ expected_file.file?.should be_true
35
+ end
36
+ end
37
+
38
+ Then(/^there should be files for "(.*?)" from templates:$/) do |project_name, table|
39
+ created_files = table.hashes.collect do |h|
40
+ h[:path].should exist
41
+ File.read(h[:path])
42
+ end
43
+
44
+ FakeFS.deactivate!
45
+ templates = table.hashes.collect do |h|
46
+ if h[:template].blank?
47
+ ''
48
+ else
49
+ File.read("./templates/#{h[:template]}").gsub('<project_name>', project_name)
50
+ end
51
+ end
52
+ FakeFS.activate!
53
+
54
+ created_files.should =~ templates
55
+ end
@@ -0,0 +1,21 @@
1
+ When(/^I create a new project in "(.*?)"$/) do |project_path|
2
+ Samling::CreateDefaultStructure.run(project_path)
3
+ end
4
+
5
+ When(/^it creates a VCS bare under bare_path: "(.*?)", and project_path: "(.*?)"$/) do |bare_path, project_path|
6
+ step "it creates a bare VCS under host: \"\", user: \"\", password: \"\", bare_path: \"#{bare_path}\", and project_path: \"#{project_path}\""
7
+ end
8
+
9
+ When(/^it creates a bare VCS under host: "(.*?)", user: "(.*?)", bare_path: "(.*?)", and project_path: "(.*?)"$/) do |host, user, bare_path, project_path|
10
+ Samling::CreateGitRepository.run(project_path, bare_path, host, user)
11
+ end
12
+
13
+ When(/^it commits all files and directories in "(.*?)"$/) do |path|
14
+ Samling::CommitGitRepository.run(path)
15
+ end
16
+
17
+ # faces
18
+
19
+ When(/^I create a new basic face "(.*?)" at "(.*?)"$/) do |face_name, root_path|
20
+ Samling::CreateBasicFace.run(root_path, face_name)
21
+ end
@@ -0,0 +1,100 @@
1
+ require './core/dirt'
2
+ require 'rspec/matchers'
3
+ require 'fakefs/safe'
4
+ require 'aruba-doubles'
5
+
6
+ Before do
7
+ ArubaDoubles::Double.setup
8
+
9
+ # git init
10
+ double_cmd(%q{git init --bare /some/git/my_project.git})
11
+ double_cmd(%q{git init --bare /different/bares/my_other_project.git})
12
+
13
+ double_cmd(%q{ssh userA@machine1 "git init --bare /some/git/my_project.git"})
14
+ double_cmd(%q{ssh userB@machine1 "git init --bare /some/git/my_project.git"})
15
+ double_cmd(%q{ssh userA@machine2 "git init --bare /different/bares/my_project.git"})
16
+ double_cmd(%q{ssh userB@machine2 "git init --bare /different/bares/my_project.git"})
17
+ double_cmd(%q{ssh userB@machine2 "git init --bare /different/bares/my_other_project.git"})
18
+
19
+ # git clone
20
+ double_cmd(%q{git clone "/some/git/my_project.git" "/a_path/to/the project/my_project"})
21
+ double_cmd(%q{git clone "/some/git/my_project.git" "/some/other/path/my_project"})
22
+ double_cmd(%q{git clone "/different/bares/my_other_project.git" "/some/other/path/my_other_project"})
23
+
24
+ double_cmd(%q{git clone userA@machine1:/some/git/my_project.git "/a_path/to/the project/my_project"})
25
+ double_cmd(%q{git clone userA@machine1:/different/bares/my_other_project.git "/some/other/path/my_other_project"})
26
+ double_cmd(%q{git clone userB@machine1:/some/git/my_project.git "/a_path/to/the project/my_project"})
27
+ double_cmd(%q{git clone userB@machine1:/different/bares/my_other_project.git "/some/other/path/my_other_project"})
28
+
29
+ double_cmd(%q{git clone userA@machine2:/some/git/my_project.git "/a_path/to/the project/my_project"})
30
+ double_cmd(%q{git clone userA@machine2:/different/bares/my_other_project.git "/some/other/path/my_other_project"})
31
+ double_cmd(%q{git clone userB@machine2:/some/git/my_project.git "/a_path/to/the project/my_project"})
32
+ double_cmd(%q{git clone userB@machine2:/different/bares/my_other_project.git "/some/other/path/my_other_project"})
33
+ double_cmd(%q{git clone userB@machine2:/different/bares/my_project.git "/some/other/path/my_project"})
34
+
35
+ # git add
36
+ double_cmd(%q{git --git-dir "/a_path/to/the project/my_project/.git" --work-tree "/a_path/to/the project/my_project" add -v "/a_path/to/the project/my_project/Gemfile"})
37
+ double_cmd(%q{git --git-dir "/a_path/to/the project/my_project/.git" --work-tree "/a_path/to/the project/my_project" add -v "/a_path/to/the project/my_project/.gitignore"})
38
+ double_cmd(%q{git --git-dir "/a_path/to/the project/my_project/.git" --work-tree "/a_path/to/the project/my_project" add -v "/a_path/to/the project/my_project/core/tests/behaviours/support/env.rb"})
39
+ double_cmd(%q{git --git-dir "/a_path/to/the project/my_project/.git" --work-tree "/a_path/to/the project/my_project" add -v "/a_path/to/the project/my_project/persist/.gitkeep"})
40
+ double_cmd(%q{git --git-dir "/a_path/to/the project/my_project/.git" --work-tree "/a_path/to/the project/my_project" add -v "/a_path/to/the project/my_project/core/contexts/.gitkeep"})
41
+ double_cmd(%q{git --git-dir "/a_path/to/the project/my_project/.git" --work-tree "/a_path/to/the project/my_project" add -v "/a_path/to/the project/my_project/core/contexts/roles/.gitkeep"})
42
+ double_cmd(%q{git --git-dir "/a_path/to/the project/my_project/.git" --work-tree "/a_path/to/the project/my_project" add -v "/a_path/to/the project/my_project/core/models/.gitkeep"})
43
+ double_cmd(%q{git --git-dir "/a_path/to/the project/my_project/.git" --work-tree "/a_path/to/the project/my_project" add -v "/a_path/to/the project/my_project/core/tests/behaviours/.gitkeep"})
44
+ double_cmd(%q{git --git-dir "/a_path/to/the project/my_project/.git" --work-tree "/a_path/to/the project/my_project" add -v "/a_path/to/the project/my_project/core/tests/behaviours/support/.gitkeep"})
45
+ double_cmd(%q{git --git-dir "/a_path/to/the project/my_project/.git" --work-tree "/a_path/to/the project/my_project" add -v "/a_path/to/the project/my_project/core/tests/behaviours/step_definitions/.gitkeep"})
46
+ double_cmd(%q{git --git-dir "/a_path/to/the project/my_project/.git" --work-tree "/a_path/to/the project/my_project" add -v "/a_path/to/the project/my_project/core/tests/isolations/.gitkeep"})
47
+ double_cmd(%q{git --git-dir "/a_path/to/the project/my_project/.git" --work-tree "/a_path/to/the project/my_project" add -v "/a_path/to/the project/my_project/faces/.gitkeep"})
48
+
49
+ double_cmd(%q{git --git-dir "/some/other/path/my_other_project/.git" --work-tree "/some/other/path/my_other_project" add -v "/some/other/path/my_other_project/Gemfile"})
50
+ double_cmd(%q{git --git-dir "/some/other/path/my_other_project/.git" --work-tree "/some/other/path/my_other_project" add -v "/some/other/path/my_other_project/.gitignore"})
51
+ double_cmd(%q{git --git-dir "/some/other/path/my_other_project/.git" --work-tree "/some/other/path/my_other_project" add -v "/some/other/path/my_other_project/core/tests/behaviours/support/env.rb"})
52
+ double_cmd(%q{git --git-dir "/some/other/path/my_other_project/.git" --work-tree "/some/other/path/my_other_project" add -v "/some/other/path/my_other_project/persist/.gitkeep"})
53
+ double_cmd(%q{git --git-dir "/some/other/path/my_other_project/.git" --work-tree "/some/other/path/my_other_project" add -v "/some/other/path/my_other_project/core/contexts/.gitkeep"})
54
+ double_cmd(%q{git --git-dir "/some/other/path/my_other_project/.git" --work-tree "/some/other/path/my_other_project" add -v "/some/other/path/my_other_project/core/contexts/roles/.gitkeep"})
55
+ double_cmd(%q{git --git-dir "/some/other/path/my_other_project/.git" --work-tree "/some/other/path/my_other_project" add -v "/some/other/path/my_other_project/core/models/.gitkeep"})
56
+ double_cmd(%q{git --git-dir "/some/other/path/my_other_project/.git" --work-tree "/some/other/path/my_other_project" add -v "/some/other/path/my_other_project/core/tests/behaviours/.gitkeep"})
57
+ double_cmd(%q{git --git-dir "/some/other/path/my_other_project/.git" --work-tree "/some/other/path/my_other_project" add -v "/some/other/path/my_other_project/core/tests/behaviours/support/.gitkeep"})
58
+ double_cmd(%q{git --git-dir "/some/other/path/my_other_project/.git" --work-tree "/some/other/path/my_other_project" add -v "/some/other/path/my_other_project/core/tests/behaviours/step_definitions/.gitkeep"})
59
+ double_cmd(%q{git --git-dir "/some/other/path/my_other_project/.git" --work-tree "/some/other/path/my_other_project" add -v "/some/other/path/my_other_project/core/tests/isolations/.gitkeep"})
60
+ double_cmd(%q{git --git-dir "/some/other/path/my_other_project/.git" --work-tree "/some/other/path/my_other_project" add -v "/some/other/path/my_other_project/faces/.gitkeep"})
61
+
62
+ # git commit/push
63
+ double_cmd(%q{git --git-dir "/a_path/to/the project/my_project/.git" --work-tree "/a_path/to/the project/my_project" commit -am "Dirt project init"})
64
+ double_cmd(%q{git --git-dir "/some/other/path/my_other_project/.git" --work-tree "/some/other/path/my_other_project" commit -am "Dirt project init"})
65
+ double_cmd(%q{git --git-dir "/a_path/to/the project/my_project/.git" --work-tree "/a_path/to/the project/my_project" push origin master})
66
+ double_cmd(%q{git --git-dir "/some/other/path/my_other_project/.git" --work-tree "/some/other/path/my_other_project" push origin master})
67
+
68
+ FakeFS::FileSystem.clear
69
+
70
+ # clone all persist files into the fake file system
71
+ Dir['./templates/**/*'].each do |file|
72
+ FakeFS.deactivate!
73
+
74
+ fake_loc = Dirt::PROJECT_ROOT + file
75
+
76
+ if File.directory? file
77
+ FakeFS.activate!
78
+ FileUtils.mkdir_p(fake_loc)
79
+ else
80
+ content = File.read(file)
81
+ FakeFS.activate!
82
+ FileUtils.mkdir_p(File.dirname(fake_loc))
83
+ FileUtils.touch(fake_loc)
84
+ File.open(fake_loc, 'w+') { |f| f.write(content) }
85
+ end
86
+ end
87
+ FakeFS.activate!
88
+ end
89
+
90
+ World(ArubaDoubles)
91
+
92
+ After do
93
+ FakeFS::FileSystem.clear
94
+ FakeFS.deactivate!
95
+
96
+ ArubaDoubles::Double.teardown
97
+ history.clear
98
+ end
99
+
100
+