Skip to content

Commit

Permalink
Merged in feature/git_and_gitflow_integration (pull request #26)
Browse files Browse the repository at this point in the history
KBP-141 #time 2h - Git and git flow integrated.

Approved-by: Hamdi Bayhan <[email protected]>
Approved-by: Fatih Avsan <[email protected]>
  • Loading branch information
Eşref VİDUŞLU committed Nov 24, 2017
2 parents ad8e286 + d7e1329 commit 11f3ec3
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@ Style/IndentHeredoc:

Naming/HeredocDelimiterNaming:
Exclude:
- 'spec/features/cli_help_spec.rb'
- 'spec/features/cli_help_spec.rb'
- 'spec/features/git_and_git_flow_spec.rb'
7 changes: 7 additions & 0 deletions lib/cybele/app_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,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 @@ -231,6 +231,11 @@ def configure_error_pages
build :configure_error_pages
end

def setup_git_and_git_flow
say 'Initialize git and git flow'
build :git_and_git_flow_commands
end

def docker_development_env
return if @options[:skip_docker]
say 'Setup docker development environment', :green
Expand Down
32 changes: 32 additions & 0 deletions spec/features/git_and_git_flow_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# 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 11f3ec3

Please sign in to comment.