Sha256: 5d94742323b9448c96ebd25dacb6eda79c3f2dd95be3657b82739b92d901c9cb

Contents?: true

Size: 770 Bytes

Versions: 21

Compression:

Stored size: 770 Bytes

Contents

module FileHelpers
  def append_to(path, contents)
    cd(".") do
      File.open(path, "a") do |file|
        file.puts
        file.puts contents
      end
    end
  end

  def append_to_gemfile(contents)
    append_to('Gemfile', contents)
  end

  def comment_out_gem_in_gemfile(gemname)
    cd(".") do
      gemfile = File.read("Gemfile")
      gemfile.sub!(/^(\s*)(gem\s*['"]#{gemname})/, "\\1# \\2")
      File.open("Gemfile", 'w'){ |file| file.write(gemfile) }
    end
  end

  def read_from_web(url)
    file = if url.match %r{^https?://}
             Net::HTTP.get(URI.parse(url))
           else
             visit(url)
             page.source
           end
    file.force_encoding("UTF-8") if file.respond_to?(:force_encoding)
  end
end

World(FileHelpers)

Version data entries

21 entries across 21 versions & 5 rubygems

Version Path
kt-paperclip-5.4.0 features/support/file_helpers.rb
kt-paperclip-4.4.0 features/support/file_helpers.rb
paperclip-6.1.0 features/support/file_helpers.rb
paperclip-6.0.0 features/support/file_helpers.rb
paperclip-5.3.0 features/support/file_helpers.rb
paperclip-5.2.1 features/support/file_helpers.rb
paperclip-5.2.0 features/support/file_helpers.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/paperclip-5.1.0/features/support/file_helpers.rb
paperclip-5.1.0 features/support/file_helpers.rb
paperclip-5.0.0 features/support/file_helpers.rb
paperclip-4.3.7 features/support/file_helpers.rb
paperclip_jk-5.0.0.beta2 features/support/file_helpers.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/paperclip-4.3.6/features/support/file_helpers.rb
paperclip-5.0.0.beta2 features/support/file_helpers.rb
paperclip-5.0.0.beta1 features/support/file_helpers.rb
paperclip-4.3.6 features/support/file_helpers.rb
paperclip-4.3.5 features/support/file_helpers.rb
paperclip-4.3.4 features/support/file_helpers.rb
paperclip-4.3.3 features/support/file_helpers.rb
paperclip-4.3.2 features/support/file_helpers.rb