Skip to content

Commit

Permalink
Merge 5361022 into 3b4c563
Browse files Browse the repository at this point in the history
  • Loading branch information
ruedap committed Dec 14, 2013
2 parents 3b4c563 + 5361022 commit 854fbd2
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 17 deletions.
8 changes: 8 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
AllCops:
Excludes:
- converter/**
- materials/**
- workflow/bundle/**

HashSyntax:
EnforcedStyle: hash_rockets
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ You can incremental search for [Font Awesome Icons](http://fontawesome.io/icons/
![screencast-illustrator.gif](https://github.com/ruedap/alfred2-font-awesome-workflow/raw/master/screenshots/screencast-illustrator.gif)


## Install
## Installation

Download **[Font Awesome.alfredworkflow](https://github.com/ruedap/alfred2-font-awesome-workflow/raw/master/Font%20Awesome.alfredworkflow)** and import to [Alfred 2](http://www.alfredapp.com/) (require Powerpack).

The current version is **Font Awesome 4.0.3** support. Old version is [here](https://github.com/ruedap/alfred2-font-awesome-workflow/blob/master/CHANGELOG.md).
The current version is **Font Awesome 4.0.3** support. Previous versions are available [here](https://github.com/ruedap/alfred2-font-awesome-workflow/blob/master/CHANGELOG.md).


## Usage
Expand All @@ -36,6 +36,11 @@ The current version is **Font Awesome 4.0.3** support. Old version is [here](htt
![Disable pasting](https://github.com/ruedap/alfred2-font-awesome-workflow/raw/master/screenshots/option-disable-pasting.png)


## Changelog

Changelog is available [here](https://github.com/ruedap/alfred2-font-awesome-workflow/blob/master/CHANGELOG.md).


## Links

- [Hidden Productivity Secrets With Alfred | Smashing Coding](http://coding.smashingmagazine.com/2013/10/25/hidden-productivity-secrets-with-alfred/)
Expand All @@ -60,3 +65,6 @@ The current version is **Font Awesome 4.0.3** support. Old version is [here](htt
GNU General Public License version 3


## Author

<a href="http://ruedap.com"><img src="https://dl.dropboxusercontent.com/u/281168/images/github-ruedap-avatar-1500x1500.png" alt="ruedap" title="ruedap" width="100" height="100"></a>
26 changes: 13 additions & 13 deletions workflow/lib/font_awesome.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ class Icon

def initialize(id)
@id = id
unicode = detect_unicode_from_id(id)
@unicode = unicode ? unicode : detect_unicode_from_aliases(id)
unicode = find_unicode_from_id(id)
@unicode = unicode ? unicode : find_unicode_from_aliases(id)
end

def detect_unicode_from_id(id)
detected_icon = ICONS.detect { |icon| icon['id'] == id }
detected_icon ? detected_icon['unicode'] : nil
def find_unicode_from_id(id)
found_icon = ICONS.find { |icon| icon['id'] == id }
found_icon ? found_icon['unicode'] : nil
end

def detect_unicode_from_aliases(id)
detected_icon = ICONS.detect do |icon|
def find_unicode_from_aliases(id)
found_icon = ICONS.find do |icon|
icon['aliases'].include?(id) if icon['aliases']
end
detected_icon ? detected_icon['unicode'] : nil
found_icon ? found_icon['unicode'] : nil
end
end

Expand All @@ -52,12 +52,12 @@ def select!(queries, icons = @icons)

def item_hash(icon)
{
:uid => '',
:title => icon.id,
:uid => '',
:title => icon.id,
:subtitle => "Paste class name: fa-#{icon.id}",
:arg => "#{icon.id}|||#{icon.unicode}",
:icon => { :type => 'default', :name => "./icons/fa-#{icon.id}.png" },
:valid => 'yes',
:arg => "#{icon.id}|||#{icon.unicode}",
:icon => { :type => 'default', :name => "./icons/fa-#{icon.id}.png" },
:valid => 'yes',
}
end

Expand Down
12 changes: 10 additions & 2 deletions workflow/spec/font_awesome_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@

it 'must equal icon names' do
icon_ids = icons.map { |icon| icon.id }
expectation = %w(arrow-circle-left arrow-circle-o-left arrow-left long-arrow-left)
expectation = %w(
arrow-circle-left
arrow-circle-o-left
arrow-left long-arrow-left
)
expect(icon_ids).to eq(expectation)
end
end
Expand All @@ -90,7 +94,11 @@

it 'must equal icon names' do
icon_ids = icons.map { |icon| icon.id }
expectation = %w(arrow-circle-left arrow-circle-o-left arrow-left long-arrow-left)
expectation = %w(
arrow-circle-left
arrow-circle-o-left
arrow-left long-arrow-left
)
expect(icon_ids).to eq(expectation)
end
end
Expand Down

0 comments on commit 854fbd2

Please sign in to comment.