Skip to content

Commit

Permalink
KBP-141 #time 2h - Git and git flow integrated.
Browse files Browse the repository at this point in the history
  • Loading branch information
esref.viduslu committed Nov 22, 2017
1 parent c153106 commit c1a306a
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/cybele/app_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ def setup_gitignore_folders
end
end

def git_and_git_flow_commands
git :init
git flow: 'init -d -f'
git add: '.'
git commit: '-m "Project initialized"'
end

private

def configure_environment(rails_env, config)
Expand Down
5 changes: 5 additions & 0 deletions lib/cybele/generators/app_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ def configure_error_pages
build :configure_error_pages
end

def setup_git_and_git_flow
say 'Initialize git'
build :git_and_git_flow_commands
end

def goodbye
say 'Congratulations! That\'s all...', :green
end
Expand Down
33 changes: 33 additions & 0 deletions spec/features/git_and_git_flow_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'Create new project without default configuration' do
before do
drop_dummy_database
remove_project_directory
run_cybele('--database=sqlite3 --skip-create-database --skip-sidekiq --skip-simple-form --skip-show-for'\
' --skip-haml')
setup_app_dependencies
end

let(:git_branch) { cybele_help_run(command: "git branch") }


it 'git branch test' do
expect(git_branch).to include <<~EOH
* develop
master
EOH
end

it 'git flow test' do
cybele_help_run(command: "git flow feature start test")
git_flow = cybele_help_run(command: "git branch")
expect(git_flow).to include <<~EOH
develop
* feature/test
master
EOH
end
end
10 changes: 10 additions & 0 deletions spec/support/cybele_test_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ def cybele_help_command
end
end

def cybele_help_run(command: 'ls')
Dir.chdir("#{tmp_path}/#{app_name}") do
Bundler.with_clean_env do
`
#{command}
`
end
end
end

def setup_app_dependencies
return unless File.exist?(project_path)
Dir.chdir(project_path) do
Expand Down

0 comments on commit c1a306a

Please sign in to comment.