Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGabriel Mazetto <brodock@gmail.com>2017-11-29 01:04:52 +0300
committerGabriel Mazetto <brodock@gmail.com>2017-11-29 01:04:52 +0300
commitff7124f2c1648c6e9b777f473d7b00cb796faa88 (patch)
tree109b207839843fb92df4a4dbd6b216d4e5fb34fa /lib
parentb0b5f90bb76cffcb4fd943cea293e483a32faf55 (diff)
Refactored Rakefile into multiple tasks and enabled git sparse-checkout
Diffstat (limited to 'lib')
-rw-r--r--lib/task_helpers.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/task_helpers.rb b/lib/task_helpers.rb
new file mode 100644
index 00000000..903cda47
--- /dev/null
+++ b/lib/task_helpers.rb
@@ -0,0 +1,26 @@
+require 'yaml'
+
+PRODUCTS = %W[ce ee omnibus runner].freeze
+
+def config
+ # Parse the config file and create a hash.
+ @config ||= YAML.load_file('./nanoc.yaml')
+end
+
+def products
+ return @products if defined?(@products)
+
+ # Pull products data from the config.
+ @products = PRODUCTS.each_with_object({}) do |key, result|
+ result[key] = config['products'][key]
+ end
+end
+
+def retrieve_branch(slug)
+ ENV.fetch("BRANCH_#{slug.upcase}", 'master')
+end
+
+def git_workdir_dirty?
+ status = `git status --porcelain`
+ !status.empty?
+end