Class: DeployRubygem::Rubygem
Overview
Using Rubygem to deploy and manage Rubygem
Constant Summary
VERSION
Instance Attribute Summary
Attributes inherited from Project
#compliance_profile, #cookbooks, #project_options
Instance Method Summary
collapse
Methods inherited from Project
#binaries, #change_to_chefrepo, #change_to_directory, #change_to_project_folder, #chefrepo_git, #chefrepo_path, #dependencies, #deploy_cookbooks, #git, #git_commit, #initialize, #path, #project_name, #release_cookbooks, #test_compliance
#check_current_version, #help_rspec, #install_gem_via_git, #testing_chef, #testing_gem, #testing_inspec, #testing_project, #testing_workstation
#bootstrap_chef_workstation, #chef_accept_cmd, #chef_env_cmd, deployer, exemple_cookbook, #install_chef_workstation, #no_option_txt, #rubygem_test, #unknown_option_txt
Instance Method Details
#deploy ⇒ Object
78
79
80
81
82
83
84
85
|
# File 'lib/deploy_rubygem/rubygem.rb', line 78
def deploy
change_to_chefrepo
deploy_cookbooks
change_to_project_folder
test_compliance
end
|
#deploy_dependencies ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/deploy_rubygem/rubygem.rb', line 11
def deploy_dependencies
dependencies.each do |git_depends|
Dir.chdir(::File.join(Dir.home, git_depends))
system('git pull')
system('git add .')
system("git commit -m \"Deploying #{project_name}_$(git version-bump show)\"")
system('git push')
end
end
|
#deploy_with_git ⇒ Object
48
49
50
51
52
53
54
|
# File 'lib/deploy_rubygem/rubygem.rb', line 48
def deploy_with_git
deploy_dependencies
git_sync
git_prepare
push_minor_bump
end
|
#git_prepare ⇒ Object
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/deploy_rubygem/rubygem.rb', line 24
def git_prepare
binaries.each do |executable|
system("git add bin/#{executable}")
end
system('git add deploy_rubygem.gemspec')
system('git add .circleci/config.yml')
system('git add lib')
end
|
#git_sync ⇒ Object
35
36
37
38
|
# File 'lib/deploy_rubygem/rubygem.rb', line 35
def git_sync
Dir.chdir(path)
system('git pull')
end
|
#push_minor_bump ⇒ Object
40
41
42
43
44
45
46
|
# File 'lib/deploy_rubygem/rubygem.rb', line 40
def push_minor_bump
system("git commit -m \"Deploying #{project_name}_$(git version-bump show)\"")
system('git version-bump patch') system('gem build')
system('gem push deploy_rubygem-$(git version-bump show).gem')
system('git version-bump minor') end
|
#rake_release ⇒ Object
65
66
67
68
69
70
|
# File 'lib/deploy_rubygem/rubygem.rb', line 65
def rake_release
change_to_project_folder
git_commit
system('rake install') || abort("Cannot rake install #{project_name} #{GVB.version}")
end
|
#rake_test ⇒ Object
56
57
58
59
60
61
62
63
|
# File 'lib/deploy_rubygem/rubygem.rb', line 56
def rake_test
FileUtils.rm_f('Gemfile.lock')
system('bundle') || return
system('bundle install') || return
system('rake') || return
end
|
#release ⇒ Object
72
73
74
75
76
|
# File 'lib/deploy_rubygem/rubygem.rb', line 72
def release
change_to_project_folder
rake_test
rake_release
end
|