-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create Deploy Gem task to publish new releases at rubygems.org
This commit also creates the Git & Content Ruby modules.
- Loading branch information
1 parent
f96e9cf
commit 2904a84
Showing
6 changed files
with
111 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative 'jekyll_theme_marketing/content' | ||
require_relative 'jekyll_theme_marketing/customers' | ||
require_relative 'jekyll_theme_marketing/dates' | ||
require_relative 'jekyll_theme_marketing/deploy' | ||
require_relative 'jekyll_theme_marketing/git' | ||
require_relative 'jekyll_theme_marketing/serve' | ||
require_relative 'jekyll_theme_marketing/test' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# frozen_string_literal: true | ||
|
||
# Customers module to configure jekyll's bundle per website | ||
module Content | ||
module_function | ||
|
||
def append(file, data) | ||
File.open(file, 'a') do |f| | ||
f.write data | ||
end | ||
end | ||
|
||
def prepend(file, data) | ||
new_content = '' | ||
|
||
File.open(file, 'r') do |f| | ||
old_content = f.read | ||
new_content = +data << old_content | ||
end | ||
|
||
File.open(file, 'w') { |f| f.write new_content } | ||
end | ||
|
||
def replace(file, old, new) | ||
content = File.read(file) | ||
new_content = content.gsub(old, new) | ||
|
||
File.open(file, 'w') { |f| f.puts new_content } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# frozen_string_literal: true | ||
|
||
# Git module to performe git operations | ||
module Git | ||
module_function | ||
|
||
def checkout_new_branch(name) | ||
system 'git checkout master' | ||
system 'git pull origin master' | ||
system "git checkout #{name}" # if the branch doesn't exist, create it | ||
system "git checkout -b #{name}" # if the branch does exist, switch to it | ||
end | ||
|
||
def push(remote = '', branch = '', options = '') | ||
system "git push #{options} #{remote} #{branch}" | ||
end | ||
|
||
def list_commits(old, new, options = '') | ||
`git log #{options} #{old}..#{new}` | ||
end | ||
end |