Skip to content

Commit

Permalink
gem name change
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarferreira committed Mar 25, 2015
1 parent cc2ba29 commit 686c182
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 30 deletions.
2 changes: 2 additions & 0 deletions .rspec
@@ -0,0 +1,2 @@
--color
--format documentation
2 changes: 1 addition & 1 deletion Gemfile
@@ -1,4 +1,4 @@
source 'https://rubygems.org'

# Specify your gem's dependencies in AndroidPlease.gemspec
# Specify your gem's dependencies in alf.gemspec
gemspec
14 changes: 6 additions & 8 deletions README.md
@@ -1,15 +1,13 @@
# AndroidPlease
# alf https://travis-ci.org/cesarferreira/alf.svg

Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/AndroidPlease`. To experiment with that code, run `bin/console` for an interactive prompt.

TODO: Delete this and the text above, and describe your gem
TODO: Delete this, and describe the gem

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'AndroidPlease'
gem 'alf'
```

And then execute:
Expand All @@ -18,13 +16,13 @@ And then execute:

Or install it yourself as:

$ gem install AndroidPlease
$ gem install alf

## Usage

TODO: Write usage instructions here

![Header](https://raw.github.com/cesarferreira/AndroidPlease/master/extras/images/screenshot01.png)
![Header](https://raw.github.com/cesarferreira/alf/master/extras/images/screenshot01.png)


## Development
Expand All @@ -35,7 +33,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To

## Contributing

1. Fork it ( https://github.com/cesarferreira/AndroidPlease/fork )
1. Fork it ( https://github.com/cesarferreira/alf/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
Expand Down
7 changes: 4 additions & 3 deletions Androidplease.gemspec → alf.gemspec
@@ -1,11 +1,11 @@
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'AndroidPlease/version'
require 'Alf/version'

Gem::Specification.new do |spec|
spec.name = 'AndroidPlease'
spec.version = AndroidPlease::VERSION
spec.name = 'alf'
spec.version = Alf::VERSION
spec.authors = ['cesar ferreira']
spec.email = ['cesar.manuel.ferreira@gmail.com']

Expand All @@ -25,6 +25,7 @@ Gem::Specification.new do |spec|

spec.add_development_dependency 'bundler', '~> 1.8'
spec.add_development_dependency 'rake', '~> 10.0'
spec.add_development_dependency 'webmock', '~> 1.20'
spec.add_dependency 'json', '~> 1.8.2'
spec.add_dependency 'colorize', '~> 0.7.5'

Expand Down
7 changes: 7 additions & 0 deletions bin/alf
@@ -0,0 +1,7 @@
#!/usr/bin/env ruby

require 'bundler/setup'
require 'alf'

Alf::SearchModel::initialize(ARGV[0])

11 changes: 2 additions & 9 deletions bin/console
@@ -1,14 +1,7 @@
#!/usr/bin/env ruby

require 'bundler/setup'
require 'AndroidPlease'
require 'alf'

# if ARGV.length != 1
# puts 'INVALID AMOUNT OF PARAMS'
# exit 1
# end
#
# param = ARGV[0]

AndroidPlease::SearchModel::initialize(ARGV[0])
Alf::SearchModel::initialize(ARGV[0])

19 changes: 11 additions & 8 deletions lib/Androidplease.rb → lib/alf.rb
@@ -1,11 +1,11 @@
require 'AndroidPlease/version'
require 'Alf/version'
require 'rubygems'
require 'json'
require 'net/http'
require 'uri'
require 'colorize'

module AndroidPlease
module Alf

class SearchModel

Expand Down Expand Up @@ -40,7 +40,7 @@ def self.fetch_results(query)

# Iterate the libraries
result['response']['docs'].each do |doc|
output = "compile '#{doc['id']}:#{doc['latestVersion']}'"
output = " compile '#{doc['id']}:#{doc['latestVersion']}'"
result_list << output
end

Expand All @@ -67,23 +67,26 @@ def self.query_offline_reps(query)
#com.google.android.gms:play-services:6.5.87
end


def self.initialize (param)

# puts param?.lenght

if param == nil
puts "Missing query parameter\n\tusage: AndroidPlease SEARCH_QUERY\n".red
puts "Missing query parameter\n\tusage: alf SEARCH_QUERY\n".red
else
if param.size>=3

puts "Searching..."

num_results, result_list, suggestions = fetch_results(param)

puts "Found: #{num_results} result#{num_results>1?'s':''} for '#{param}'"

# Iterate to print results
result_list.each do |result|
puts result.green
end

puts "Found: #{num_results} result#{num_results>1?'s':''} for '#{param}'"


# handle the suggestions
if suggestions!=nil

Expand Down
2 changes: 1 addition & 1 deletion lib/Androidplease/version.rb → lib/alf/version.rb
@@ -1,3 +1,3 @@
module AndroidPlease
module Alf
VERSION = '0.1.0'
end
17 changes: 17 additions & 0 deletions spec/alf_spec.rb
@@ -0,0 +1,17 @@
require 'spec_helper'
require 'vcr'
require 'minitest/autorun'

describe Alf do

it 'Test the query_url' do
str = Alf::SearchModel.query_url('picasso')
expect(str).to eq 'http://search.maven.org/solrsearch/select?q=picasso&rows=350&wt=json'
end

it 'Request the webservice MOCK' do
str = Alf::SearchModel.query_url("quickutils")
expect(str).to eq 'http://search.maven.org/solrsearch/select?q=quickutils&rows=350&wt=json'
end

end
25 changes: 25 additions & 0 deletions spec/spec_helper.rb
@@ -0,0 +1,25 @@
require 'Alf'
require 'vcr'

VCR.configure do |c|
c.cassette_library_dir = 'spec/cassettes'
c.hook_into :webmock
c.configure_rspec_metadata!
end

RSpec.configure do |config|

config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end

# rspec-mocks config goes here. You can use an alternate test double
# library (such as bogus or mocha) by changing the `mock_with` option here.
config.mock_with :rspec do |mocks|
# Prevents you from mocking or stubbing a method that does not exist on
# a real object. This is generally recommended, and will default to
# `true` in RSpec 4.
mocks.verify_partial_doubles = true
end

end

0 comments on commit 686c182

Please sign in to comment.