Skip to content

Commit

Permalink
Make add script check for github repos
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepycat committed Jul 18, 2016
1 parent d48a904 commit d675ef4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions add
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,14 @@ begin
}
extract_url with: "[class~='up-and-out']", and_run: proc {|url| url.attr('href').value }
extract_founding_year with: "li.founded", and_run: proc {|tds| tds.last ? tds.last.text[/(\d{4})/] : nil }
extract_code with: ".github", and_run: proc {|code| code.empty? ? nil : code.attr('href').value }
end

raise StandardError 'No technologies were listed!' if raw_results[:technology_list].empty?
raise Exception.new 'No technologies were listed!' if raw_results[:technology_list].empty?

organization[:name] = raw_results[:name]
organization[:url] = raw_results[:url]
organization[:code] = raw_results[:code]
organization[:founding_year] = raw_results[:founding_year]


Expand All @@ -122,7 +124,9 @@ begin
location[:address] = address
elsif choice.to_i == 2
puts "Enter a comma separated lat/lng: "
location[:lat], location[:lng] = STDIN.gets.strip.split(',')
lat, lng = STDIN.gets.strip.split(',')
location[:lat] = lat.chomp.to_f
location[:lng] = lng.chomp.to_f
location[:address] = loc
end
else
Expand All @@ -146,11 +150,13 @@ begin
name: "#{organization[:name]}"
#{ " founding_year: " + organization[:founding_year] if organization[:founding_year]}
url: "#{organization[:url]}"
#{ 'code: "' + organization[:code] + '"' if organization[:code]}
locations: [#{organization[:locations].map(&:to_graphql).join(", ")}]
technologies: [#{organization[:technologies].map(&:to_graphql).join(", ")}]
) {
name
founding_year
code
url
}
}
Expand Down

0 comments on commit d675ef4

Please sign in to comment.