Skip to content

Instantly share code, notes, and snippets.

@nolith

nolith/.ruby-version

Last active Sep 6, 2016
Embed
What would you like to do?
engage_my_page
#!/usr/bin/env ruby
# Require the gems
require 'capybara/poltergeist'
# Configure Poltergeist to not blow up on websites with js errors aka every website with js
# See more options at https://github.com/teampoltergeist/poltergeist#customization
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, js_errors: false)
end
# Configure Capybara to use Poltergeist as the driver
Capybara.default_driver = :poltergeist
browser = Capybara.current_session
puts browser.visit('https://www.facebook.com')
puts browser.fill_in 'email', with: ENV['EMAIL']
puts browser.fill_in 'pass', with: ENV['PASSWORD']
if browser.has_button? 'Log In'
puts browser.click_button 'Log In'
elsif browser.has_button? 'Accedi'
puts browser.click_button 'Accedi'
else
$stderr.puts("Can't find login button")
exit!(1)
end
ARGV.each do |url|
puts "visiting #{url}"
puts browser.visit(url)
end
# coding: utf-8
Gem::Specification.new do |spec|
spec.name = "engage_my_page"
spec.version = '0.1.0'
spec.authors = ["Alessio Caiazza"]
spec.email = ["alessio@chorally.com"]
spec.summary = %q{FB page engager}
spec.description = %q{engage engage}
spec.homepage = 'https://gist.github.com/nolith/6f26ad8e92edc4dc46adae215ab92efc'
spec.files = %w{engage_my_page}
spec.bindir = '.'
spec.executables = %w{engage_my_page}
spec.require_paths = ['.']
spec.add_development_dependency "bundler", "~> 1.12"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "pry"
spec.add_development_dependency "pry_debug"
spec.add_dependency "capybara"
spec.add_dependency "poltergeist"
spec.add_dependency "launchy"
end
source 'https://rubygems.org'
# Specify your gem's dependencies in engage_my_page.gemspec
gemspec
PATH
remote: .
specs:
engage_my_page (0.0.1)
capybara
launchy
poltergeist
GEM
remote: https://rubygems.org/
specs:
addressable (2.4.0)
capybara (2.8.1)
addressable
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
cliver (0.3.2)
coderay (1.1.1)
launchy (2.4.3)
addressable (~> 2.3)
method_source (0.8.2)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_portile2 (2.1.0)
nokogiri (1.6.8)
mini_portile2 (~> 2.1.0)
pkg-config (~> 1.1.7)
pkg-config (1.1.7)
poltergeist (1.10.0)
capybara (~> 2.1)
cliver (~> 0.3.1)
websocket-driver (>= 0.2.0)
pry (0.9.12.6)
coderay (~> 1.0)
method_source (~> 0.8)
slop (~> 3.4)
pry_debug (0.1.0)
pry (~> 0.9.0)
rack (2.0.1)
rack-test (0.6.3)
rack (>= 1.0)
rake (10.5.0)
slop (3.6.0)
websocket-driver (0.6.4)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
xpath (2.0.0)
nokogiri (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
bundler (~> 1.12)
engage_my_page!
pry
pry_debug
rake (~> 10.0)
BUNDLED WITH
1.12.4
require "bundler/gem_tasks"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.