Module: StylePusher

Defined in:
lib/style_pusher.rb,
lib/style_pusher/version.rb

Constant Summary collapse

VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.push(stylesheet:, git_url:, git_branch_name:, git_commit_message:, stylesheets_location:) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/style_pusher.rb', line 5

def self.push(stylesheet:, 
              git_url:, 
              git_branch_name:, 
              git_commit_message:, 
              stylesheets_location:)
  
  parent_directory = File.expand_path("..", Dir.pwd)
  branch_name = git_branch_name.gsub(" ", "_").downcase
  project_name = project_name(git_url: git_url)
  local_repo = File.join(parent_directory, project_name)
  upload_location = "#{local_repo}/#{stylesheets_location}"

  stylesheets = [
    {
      name: "blah.scss",
      content: stylesheet
    }
  ]

  GitDriver.push(url: git_url, 
                  local_repo: local_repo,
                  branch_name: branch_name,
                  project_name: project_name,
                  stylesheets: stylesheets, #later this should be an array 
                  upload_location: upload_location,
                  commit_message: git_commit_message)
end