<commit_before>class ProductController < ApplicationController

  skip_before_filter :verify_authenticity_token

  def create
    title=params[:title]
    GitPusher.create_repo(title)
    return_string="you created a product called "+title
    render json: {message: return_string}
  end

  def index
    render json: {message: 'what did you expect here?'}
  end

  def addfile
    repo_name=params[:repo_name]
    file_path=params[:path]
    file_contents=params[:file_contents]
    GitPusher.add_file(repo_name,file_path,file_contents)
    render json: {message: 'you are trying to add a file'}
  end

  def getgit
    a=GitPusher.get_contents(params[:repo_name], params[:path])
    if a.nil?
      render json: {message: "The Repository is empty..."}
    else
      #render a.body
      render json: JSON.parse(a.body)
    end
  end


  def deploy

#    `eval $(ssh-agent)`
#    `ssh-add launchpad`

    title=params[:title]
    heroku_app_name=title+"-assembled"

    puts "Attempting to create Github Repo"
    #CREATE GITHUB REPOSITORY      WORKS, OPTIMAL
    GitPusher.create_repo(title)

    puts "Attempting to create Heroku App"
    #CREATE HEROKU REPOSITORY     WORKS, NON-OPTIMAL
    Herokutalker.create_app(heroku_app_name)

    travis_path="assemblymade/#{title}"
    puts travis_path
    Travispush.push(travis_path)

    node_contents=Nodeprep.list_node_contents()

    #EDIT NODETEMPLATE FILES     WORKS, VERY NON-OPTIMAL
    Nodeprep.edit_index_file(title)
    Nodeprep.edit_travis(heroku_app_name)
    Nodeprep.edit_packagejson(title, heroku_app_name)

    #PUSH TO GITHUB              WORKS, OK
    node_contents.each do |file_path|
<commit_msg>minor<commit_after>class ProductController < ApplicationController

  skip_before_filter :verify_authenticity_token

  def create
    title=params[:title]
    GitPusher.create_repo(title)
    return_string="you created a product called "+title
    render json: {message: return_string}
  end

  def index
    render json: {message: 'what did you expect here?'}
  end

  def addfile
    repo_name=params[:repo_name]
    file_path=params[:path]
    file_contents=params[:file_contents]
    GitPusher.add_file(repo_name,file_path,file_contents)
    render json: {message: 'you are trying to add a file'}
  end

  def getgit
    a=GitPusher.get_contents(params[:repo_name], params[:path])
    if a.nil?
      render json: {message: "The Repository is empty..."}
    else
      #render a.body
      render json: JSON.parse(a.body)
    end
  end


  def deploy

#    `eval $(ssh-agent)`
#    `ssh-add launchpad`

    title=params[:title]
    heroku_app_name=title+"-assembled"

    puts "Attempting to create Github Repo"
    #CREATE GITHUB REPOSITORY      WORKS, OPTIMAL
    GitPusher.create_repo(title)

    puts "Attempting to create Heroku App"
    #CREATE HEROKU REPOSITORY     WORKS, NON-OPTIMAL
    Herokutalker.create_app(heroku_app_name)

    travis_path="assemblymade/#{title}"
    puts travis_path
    sleep(10.0)
    Travispush.push(travis_path)

    node_contents=Nodeprep.list_node_contents()

    #EDIT NODETEMPLATE FILES     WORKS, VERY NON-OPTIMAL
    Nodeprep.edit_index_file(title)
    Nodeprep.edit_travis(heroku_app_name)
    Nodeprep.edit_packagejson(title, heroku_app_name)

    #PUSH TO GITHUB              WORKS, OK
    node_contents.each do |file_path|

{'fraction_non_alphanumeric': 0.08837627321749551, 'fraction_numerical': 0.0008987417615338526, 'mean_word_length': 3.5428571428571427, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6067550', 'n_tokens_mistral': 1179, 'n_tokens_neox': 1146, 'n_words': 249}