pincerna 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/.rubocop.yml +77 -0
- data/.travis-gemfile +17 -0
- data/.travis.yml +7 -0
- data/.yardopts +1 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +23 -0
- data/LICENSE.md +21 -0
- data/README.md +211 -0
- data/Rakefile +45 -0
- data/bin/pincernad +56 -0
- data/docs/Pincerna.html +130 -0
- data/docs/Pincerna/Base.html +3051 -0
- data/docs/Pincerna/Bookmark.html +523 -0
- data/docs/Pincerna/Cache.html +767 -0
- data/docs/Pincerna/ChromeBookmark.html +308 -0
- data/docs/Pincerna/CurrencyConversion.html +589 -0
- data/docs/Pincerna/FirefoxBookmark.html +328 -0
- data/docs/Pincerna/Ip.html +1017 -0
- data/docs/Pincerna/Map.html +399 -0
- data/docs/Pincerna/SafariBookmark.html +308 -0
- data/docs/Pincerna/Server.html +673 -0
- data/docs/Pincerna/Translation.html +517 -0
- data/docs/Pincerna/UnitConversion.html +1042 -0
- data/docs/Pincerna/Version.html +189 -0
- data/docs/Pincerna/Vpn.html +561 -0
- data/docs/Pincerna/Weather.html +837 -0
- data/docs/_index.html +298 -0
- data/docs/class_list.html +54 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +57 -0
- data/docs/css/style.css +338 -0
- data/docs/file.README.html +327 -0
- data/docs/file_list.html +56 -0
- data/docs/frames.html +28 -0
- data/docs/index.html +327 -0
- data/docs/js/app.js +214 -0
- data/docs/js/full_list.js +178 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +389 -0
- data/docs/top-level-namespace.html +112 -0
- data/icon.png +0 -0
- data/images/chrome.png +0 -0
- data/images/currency.png +0 -0
- data/images/firefox.png +0 -0
- data/images/map.png +0 -0
- data/images/network.png +0 -0
- data/images/safari.png +0 -0
- data/images/translate.png +0 -0
- data/images/unit.png +0 -0
- data/images/vpn.png +0 -0
- data/images/weather.png +0 -0
- data/info.plist +961 -0
- data/it.cowtech.pincernad.plist +19 -0
- data/lib/pincerna.rb +30 -0
- data/lib/pincerna/base.rb +258 -0
- data/lib/pincerna/bookmark.rb +80 -0
- data/lib/pincerna/cache.rb +61 -0
- data/lib/pincerna/chrome_bookmark.rb +40 -0
- data/lib/pincerna/currency_conversion.rb +134 -0
- data/lib/pincerna/firefox_bookmark.rb +92 -0
- data/lib/pincerna/ip.rb +135 -0
- data/lib/pincerna/map.rb +30 -0
- data/lib/pincerna/safari_bookmark.rb +40 -0
- data/lib/pincerna/server.rb +85 -0
- data/lib/pincerna/translation.rb +67 -0
- data/lib/pincerna/unit_conversion.rb +120 -0
- data/lib/pincerna/version.rb +24 -0
- data/lib/pincerna/vpn.rb +74 -0
- data/lib/pincerna/weather.rb +188 -0
- data/pincerna.alfredworkflow +0 -0
- data/pincerna.gemspec +36 -0
- data/pincerna.sh +9 -0
- data/spec/cassettes/Pincerna_CurrencyConversion/_perform_filtering/should_return_valid_values.yml +38 -0
- data/spec/cassettes/Pincerna_Ip/_get_local_addresses/should_return_a_list_of_addresses.yml +47 -0
- data/spec/cassettes/Pincerna_Ip/_get_public_address/should_return_public_IP_address.yml +44 -0
- data/spec/cassettes/Pincerna_Translation/_perform_filtering/should_default_from_English_to_the_given_language_when_only_one_is_present.yml +124 -0
- data/spec/cassettes/Pincerna_Translation/_perform_filtering/should_query_Google_Translate_for_sentences_returning_no_alternatives.yml +51 -0
- data/spec/cassettes/Pincerna_Translation/_perform_filtering/should_query_Google_Translate_for_single_words.yml +71 -0
- data/spec/cassettes/Pincerna_Weather/_get_forecast/should_append_name.yml +177 -0
- data/spec/cassettes/Pincerna_Weather/_get_forecast/should_get_correct_forecasts.yml +339 -0
- data/spec/cassettes/Pincerna_Weather/_lookup_places/should_return_an_existing_WOEID_without_making_any_request.yml +56 -0
- data/spec/cassettes/Pincerna_Weather/_lookup_places/should_search_for_places.yml +189 -0
- data/spec/cassettes/Pincerna_Weather/_perform_filtering/should_get_forecast.yml +56 -0
- data/spec/coverage_helper.rb +44 -0
- data/spec/pincerna/base_spec.rb +166 -0
- data/spec/pincerna/bookmark_spec.rb +65 -0
- data/spec/pincerna/cache_spec.rb +88 -0
- data/spec/pincerna/chrome_bookmark_spec.rb +114 -0
- data/spec/pincerna/currency_conversion_spec.rb +46 -0
- data/spec/pincerna/firefox_bookmark_spec.rb +46 -0
- data/spec/pincerna/ip_spec.rb +194 -0
- data/spec/pincerna/map_spec.rb +24 -0
- data/spec/pincerna/safari_bookmark_spec.rb +237 -0
- data/spec/pincerna/server_spec.rb +108 -0
- data/spec/pincerna/translation_spec.rb +55 -0
- data/spec/pincerna/unit_conversion_spec.rb +98 -0
- data/spec/pincerna/vpn_spec.rb +68 -0
- data/spec/pincerna/weather_spec.rb +131 -0
- data/spec/spec_helper.rb +48 -0
- metadata +283 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 91b919b925687890856cfe6c641081d4b036fdce954f5053fd34f7c789ba31b8
|
4
|
+
data.tar.gz: 374710a2bba34e0a03f250ee2aa6dadc7285154c821667230893ac0247dace7d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 193e2432e2ed8de9bbded02e758f3ed8c1c5cf9b5797eed15b6b833fbb55c6bbbe288d027cbe325cfb618bbe671ffaf9e0a4971f3b6cc7c74ac6570ee6e16801
|
7
|
+
data.tar.gz: 0d177b5b2522d1d39d56d07872154d7ba75401a2bab484c97dc131a17c7ef9db08302a479b343e8d1cf7d7372491a59519c8c93c3ea97e0554fed21e56645ce4
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.3
|
3
|
+
Include:
|
4
|
+
- "*/**/.rb"
|
5
|
+
- "config.ru"
|
6
|
+
- "Rakefile"
|
7
|
+
- "Gemfile"
|
8
|
+
Exclude:
|
9
|
+
- "config/**/*"
|
10
|
+
- "db/**/*"
|
11
|
+
- "spec/**/*"
|
12
|
+
|
13
|
+
Alias:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
AsciiComments:
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
BracesAroundHashParameters:
|
20
|
+
Enabled: false
|
21
|
+
|
22
|
+
CyclomaticComplexity:
|
23
|
+
Max: 15
|
24
|
+
|
25
|
+
ClassLength:
|
26
|
+
Max: 150
|
27
|
+
|
28
|
+
Documentation:
|
29
|
+
Enabled: false
|
30
|
+
|
31
|
+
EachWithObject:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
FormatString:
|
35
|
+
Enabled: false
|
36
|
+
|
37
|
+
FrozenStringLiteralComment:
|
38
|
+
Enabled: false
|
39
|
+
|
40
|
+
IndentationConsistency:
|
41
|
+
Enabled: false
|
42
|
+
|
43
|
+
LineLength:
|
44
|
+
Max: 160
|
45
|
+
|
46
|
+
MethodLength:
|
47
|
+
Max: 15
|
48
|
+
|
49
|
+
ModuleLength:
|
50
|
+
Max: 200
|
51
|
+
|
52
|
+
MultilineMethodCallIndentation:
|
53
|
+
Enabled: false
|
54
|
+
|
55
|
+
ParameterLists:
|
56
|
+
Max: 8
|
57
|
+
|
58
|
+
RegexpLiteral:
|
59
|
+
Enabled: false
|
60
|
+
|
61
|
+
SignalException:
|
62
|
+
Enabled: false
|
63
|
+
|
64
|
+
SpaceInsideHashLiteralBraces:
|
65
|
+
Enabled: false
|
66
|
+
|
67
|
+
StringLiterals:
|
68
|
+
Enabled: false
|
69
|
+
|
70
|
+
StringLiteralsInInterpolation:
|
71
|
+
Enabled: false
|
72
|
+
|
73
|
+
StringReplacement:
|
74
|
+
Enabled: false
|
75
|
+
|
76
|
+
WordArray:
|
77
|
+
Enabled: false
|
data/.travis-gemfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# This file is part of the pincerna gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
|
4
|
+
# Licensed under the MIT license, which can be found at https://choosealicense.com/licenses/mit.
|
5
|
+
#
|
6
|
+
|
7
|
+
source "http://rubygems.org"
|
8
|
+
|
9
|
+
gemspec
|
10
|
+
|
11
|
+
# Testing
|
12
|
+
gem "rspec", "~> 2.14.1"
|
13
|
+
gem "rake", "~> 10.1.0"
|
14
|
+
gem "vcr", "~> 2.5.0"
|
15
|
+
gem "webmock", "~> 1.13.0"
|
16
|
+
gem "simplecov", ">= 0.7.1"
|
17
|
+
gem "coveralls", ">= 0.6.7", require: false
|
data/.travis.yml
ADDED
data/.yardopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
-o ./docs -m markdown
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# This file is part of the pincerna gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
|
4
|
+
# Licensed under the MIT license, which can be found at https://choosealicense.com/licenses/mit.
|
5
|
+
#
|
6
|
+
|
7
|
+
source "http://rubygems.org"
|
8
|
+
|
9
|
+
gemspec
|
10
|
+
|
11
|
+
# Testing
|
12
|
+
gem "rspec", "~> 2.14.1"
|
13
|
+
gem "rake", "~> 10.1.0"
|
14
|
+
gem "vcr", "~> 2.5.0"
|
15
|
+
gem "webmock", "~> 1.13.0"
|
16
|
+
|
17
|
+
# Documentation
|
18
|
+
gem "simplecov", ">= 0.7.1"
|
19
|
+
gem "coveralls", ">= 0.6.7", :require => false
|
20
|
+
gem "pry", ">= 0"
|
21
|
+
gem "yard", ">= 0.8.7"
|
22
|
+
gem "kramdown", ">= 1.2.0"
|
23
|
+
gem "github-markup", ">= 0.7.5"
|
data/LICENSE.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (C) 2018 and above Shogun <shogun@cowtech.it>
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,211 @@
|
|
1
|
+
# pincerna
|
2
|
+
|
3
|
+
## END OF DEVELOPMENT NOTICE - This gem has been discontinued
|
4
|
+
|
5
|
+
A bunch of useful Alfred 2 workflows.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
### Preparation of the environment
|
10
|
+
|
11
|
+
#### Users of MacOSX Mavericks
|
12
|
+
|
13
|
+
On OSX Mountain Lion (10.9), the default Ruby version is 2.0.0, so no additional steps are required.
|
14
|
+
|
15
|
+
#### Users of MacOSX Mountain Lion and older
|
16
|
+
|
17
|
+
On OSX Mountain Lion (10.8) and older, the default Ruby version is 1.8.7.
|
18
|
+
|
19
|
+
This version is really older and no longer maintained. Pincerna requires at least Ruby 1.9 and works on 2.0 too.
|
20
|
+
|
21
|
+
The scripts support using [rvm](https://rvm.io/) for loading a new Ruby version. To install, check its documentation. In short, it should resolv to these steps:
|
22
|
+
|
23
|
+
\curl -L https://get.rvm.io | sudo bash -s stable
|
24
|
+
rvm install [1.9.3|2.0.0]
|
25
|
+
rvm use [1.9.3|2.0.0] --default
|
26
|
+
|
27
|
+
### Installation of the gem and the workflow
|
28
|
+
|
29
|
+
From the terminal:
|
30
|
+
|
31
|
+
gem i pincerna
|
32
|
+
pincernad install
|
33
|
+
|
34
|
+
## Uninstallation
|
35
|
+
|
36
|
+
From the terminal:
|
37
|
+
|
38
|
+
pincernad uninstall
|
39
|
+
gem uni pincerna
|
40
|
+
|
41
|
+
Then remove the workflow from Alfred settings.
|
42
|
+
|
43
|
+
## Usage
|
44
|
+
|
45
|
+
Pincerna supports many shortcut which will save your work. Here's the comprehensive list.
|
46
|
+
|
47
|
+
### Unit conversion
|
48
|
+
|
49
|
+
Thanks to the [ruby-units](http://github.com/olbrich/ruby-units) gem, you can convert values between units.
|
50
|
+
|
51
|
+
The recognized syntaxes are:
|
52
|
+
|
53
|
+
- `convert 123 $FROM_UNIT to $TO_UNIT`
|
54
|
+
- `c 123.45 $FROM_UNIT to $TO_UNIT`
|
55
|
+
|
56
|
+
`to` can be omitted. Actioning on the result will copy the result to the clipboard.
|
57
|
+
|
58
|
+
If `with rate` is appended, also the conversion rate will be copied as well.
|
59
|
+
|
60
|
+
If `split units` is appended, the value in feet will be shown in `X ft Y in` form, pounds (lbs) or ounces (oz) will be shown in `X lbs Y oz` form.
|
61
|
+
|
62
|
+
Examples:
|
63
|
+
|
64
|
+
- `convert 123.45 m to m`
|
65
|
+
- `c 123 kg oz with rate split units`
|
66
|
+
|
67
|
+
### Currency conversion
|
68
|
+
|
69
|
+
Thanks to the [rate-exchange API](http://rate-exchange.appspot.com/), you can convert values between currencies.
|
70
|
+
|
71
|
+
The recognized syntaxes are:
|
72
|
+
|
73
|
+
- `currency 123 $FROM_CURRENCY to $TO_CURRENCY`
|
74
|
+
- `cc 123.45 $FROM_CURRENCY to $TO_CURRENCY`
|
75
|
+
|
76
|
+
`to` can be omitted. Actioning on the result will copy the result to the clipboard.
|
77
|
+
|
78
|
+
If `with rate` is appended, also the conversion rate will be copied as well.
|
79
|
+
|
80
|
+
Examples:
|
81
|
+
|
82
|
+
- `currency 123.45 EUR to USD`
|
83
|
+
- `cc 123 EUR JPY with rate`
|
84
|
+
- `cc 123 € $ with rate`
|
85
|
+
|
86
|
+
### Translation with Google Translate
|
87
|
+
|
88
|
+
You can translate words or sentences between languages using [Google Translate](http://translate.google.com/).
|
89
|
+
|
90
|
+
The recognized syntax is:
|
91
|
+
|
92
|
+
- `translate $FROM_LANGUAGE to $TO_LANGUAGE $TEXT`
|
93
|
+
- `t $FROM_LANGUAGE to $TO_LANGUAGE $TEXT`
|
94
|
+
|
95
|
+
`to` can be omitted. Actioning on the result will copy the first result to the clipboard.
|
96
|
+
|
97
|
+
`$FROM_LANGUAGE` can also be omitted as well, will default to `en`.
|
98
|
+
|
99
|
+
Examples:
|
100
|
+
|
101
|
+
- `translate it to en Ciao mondo`
|
102
|
+
- `t it en Ciao mondo`
|
103
|
+
- `t it Hello`
|
104
|
+
|
105
|
+
### View location in Google Maps
|
106
|
+
|
107
|
+
You can view locations on [Google Maps](http://maps.google.com).
|
108
|
+
|
109
|
+
The recognized syntax is:
|
110
|
+
|
111
|
+
- `map $LOCATION`
|
112
|
+
- `m $LOCATION`
|
113
|
+
|
114
|
+
Actioning on the result will open the location in Google Maps on the default browser.
|
115
|
+
|
116
|
+
Examples:
|
117
|
+
|
118
|
+
- `map Campobasso, Italy`
|
119
|
+
- `m San Mateo, CA`
|
120
|
+
- `m 12.34,56.78`
|
121
|
+
|
122
|
+
### Yahoo! Weather Forecast
|
123
|
+
|
124
|
+
You can view the current weather condition and tomorrow's forecast on [Yahoo! Weather](http://weather.yahoo.com).
|
125
|
+
|
126
|
+
The recognized syntax is:
|
127
|
+
|
128
|
+
- `forecast $LOCATION`
|
129
|
+
|
130
|
+
The location can be a name or a WOEID. Actioning on the result will open the forecast in Yahoo! Weather on the default browser.
|
131
|
+
|
132
|
+
Examples:
|
133
|
+
|
134
|
+
- `forecast San Mateo`
|
135
|
+
- `forecast 2406170`
|
136
|
+
|
137
|
+
### Fetch the list of local and public IP
|
138
|
+
|
139
|
+
You can view the list of all IP address of the current machine, including the public IP (thanks to [exip.org](http://exip.org)). Both IPv4 and IPv6 are supported.
|
140
|
+
|
141
|
+
The recognized syntax is:
|
142
|
+
|
143
|
+
- `ip $INTERFACE`
|
144
|
+
|
145
|
+
`$INTERFACE` is optional and it is only used to filter results (use `public` to get only the public IP).
|
146
|
+
|
147
|
+
Actioning on the results will copy the IP on the clipboard.
|
148
|
+
|
149
|
+
Examples:
|
150
|
+
|
151
|
+
- `ip`
|
152
|
+
- `ip Ethernet`
|
153
|
+
- `ip lo0`
|
154
|
+
- `ip public`
|
155
|
+
|
156
|
+
### Connect or disconnect from VPNs
|
157
|
+
|
158
|
+
You can connect or disconnect from your VPNs.
|
159
|
+
|
160
|
+
The recognized syntax is:
|
161
|
+
|
162
|
+
- `vpn $NAME`
|
163
|
+
|
164
|
+
`$NAME` is optional and it is only used to filter results.
|
165
|
+
|
166
|
+
Examples:
|
167
|
+
|
168
|
+
- `vpn`
|
169
|
+
- `vpn Office`
|
170
|
+
|
171
|
+
### Open Chrome, Firefox or Safari bookmarks
|
172
|
+
|
173
|
+
You can search and open your Chrome, Firefox or Safari bookmarks and open in the respective browsers.
|
174
|
+
|
175
|
+
The recognized syntax is:
|
176
|
+
|
177
|
+
- `bc $NAME` for Chrome
|
178
|
+
- `bs $NAME` for Safari
|
179
|
+
- `bf $NAME` for Firefox
|
180
|
+
|
181
|
+
`$NAME` is optional and it is only used to filter results.
|
182
|
+
|
183
|
+
Examples:
|
184
|
+
|
185
|
+
- `bc Google`
|
186
|
+
- `bf Google`
|
187
|
+
- `bs Google`
|
188
|
+
|
189
|
+
Actioning on the results will open the bookmark in the browser. Note that this won't use the default browser but the one the bookmarks belongs to.
|
190
|
+
|
191
|
+
## API Documentation
|
192
|
+
|
193
|
+
The API documentation can be found [here](https://sw.cowtech.it/pincerna/docs).
|
194
|
+
|
195
|
+
## Contributing to pincerna
|
196
|
+
|
197
|
+
- Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
198
|
+
- Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
199
|
+
- Fork the project.
|
200
|
+
- Start a feature/bugfix branch.
|
201
|
+
- Commit and push until you are happy with your contribution.
|
202
|
+
- Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
203
|
+
- Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
204
|
+
|
205
|
+
## Copyright
|
206
|
+
|
207
|
+
Copyright (C) 2013 and above Shogun (shogun@cowtech.it).
|
208
|
+
|
209
|
+
Licensed under the MIT license, which can be found at https://choosealicense.com/licenses/mit.
|
210
|
+
|
211
|
+
The icons used are by the [Cold Fusion HD set](http://chrisbanks2.deviantart.com/art/Cold-Fusion-HD-Icon-Pack-277808597) by _chrisbanks2_.
|
data/Rakefile
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# This file is part of the pincerna gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
|
4
|
+
# Licensed under the MIT license, which can be found at https://choosealicense.com/licenses/mit.
|
5
|
+
#
|
6
|
+
|
7
|
+
require "bundler/gem_tasks"
|
8
|
+
require "rspec/core/rake_task"
|
9
|
+
|
10
|
+
# Compatibility layer for Rake 11.0
|
11
|
+
Rake.application.class.send(:alias_method, :last_comment, :last_description) unless Rake.application.respond_to?(:last_comment)
|
12
|
+
|
13
|
+
RSpec::Core::RakeTask.new("spec")
|
14
|
+
|
15
|
+
RSpec::Core::RakeTask.new("spec:coverage") do
|
16
|
+
ENV["COVERAGE"] = "true"
|
17
|
+
end
|
18
|
+
|
19
|
+
RSpec::Core::RakeTask.new("spec:ci") do
|
20
|
+
ENV["COVERAGE"] = "true"
|
21
|
+
ENV["NO_COLOR"] = "true"
|
22
|
+
end
|
23
|
+
|
24
|
+
desc "Performs linting of the code using rubocop"
|
25
|
+
task "lint" do
|
26
|
+
Kernel.exec("rubocop -ED app lib")
|
27
|
+
end
|
28
|
+
|
29
|
+
desc "Generates the documentation"
|
30
|
+
task :docs do
|
31
|
+
system("yardoc") || raise("Failed Execution of: yardoc")
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "Gets the current release version"
|
35
|
+
task :version, :with_name do |_, args|
|
36
|
+
gem = Bundler::GemHelper.instance.gemspec
|
37
|
+
puts [args[:with_name] == "true" ? gem.name : nil, gem.version].compact.join("-")
|
38
|
+
end
|
39
|
+
|
40
|
+
desc "Prepares the release"
|
41
|
+
task :prerelease => ["spec:coverage", "docs"] do
|
42
|
+
["git add -A", "git commit -am \"Version #{Bundler::GemHelper.instance.gemspec.version}\""].each do |cmd|
|
43
|
+
system(cmd) || raise("Failed Execution of: #{cmd}")
|
44
|
+
end
|
45
|
+
end
|
data/bin/pincernad
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
#
|
4
|
+
# This file is part of the pincerna gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
|
5
|
+
# Licensed under the MIT license, which can be found at https://choosealicense.com/licenses/mit.
|
6
|
+
#
|
7
|
+
|
8
|
+
require "pincerna"
|
9
|
+
|
10
|
+
helper = "#{ENV["HOME"]}/.rvm/bin/pincernad"
|
11
|
+
agent = "#{ENV["HOME"]}/Library/LaunchAgents/it.cowtech.pincernad.plist"
|
12
|
+
local_agent = Pincerna::Base::ROOT + "/it.cowtech.pincernad.plist"
|
13
|
+
workflow = Pincerna::Base::ROOT + "/pincerna.alfredworkflow"
|
14
|
+
|
15
|
+
def perform_commands(commands)
|
16
|
+
commands.each do |cmd|
|
17
|
+
puts("Running: #{cmd}")
|
18
|
+
system(cmd)
|
19
|
+
end
|
20
|
+
|
21
|
+
puts "\n"
|
22
|
+
end
|
23
|
+
|
24
|
+
case ARGV[0]
|
25
|
+
when "install" then
|
26
|
+
perform_commands([
|
27
|
+
"rvm wrapper $(rvm-prompt i v g) --no-prefix pincernad",
|
28
|
+
"cp \"#{local_agent}\" \"#{agent}\"",
|
29
|
+
"launchctl load \"#{agent}\"",
|
30
|
+
"open \"#{workflow}\""
|
31
|
+
])
|
32
|
+
|
33
|
+
puts "Installation of Pincerna into Alfred completed! Have fun! :)"
|
34
|
+
when "uninstall" then
|
35
|
+
perform_commands([
|
36
|
+
"launchctl unload \"#{agent}\"",
|
37
|
+
"rm -rf \"#{agent}\" \"#{helper}\"",
|
38
|
+
])
|
39
|
+
|
40
|
+
puts "Installation of Pincerna from the system completed! :("
|
41
|
+
puts "Remember to remove the workflow from Alfred's settings."
|
42
|
+
puts "Hope you enjoyed it!"
|
43
|
+
when "quit"
|
44
|
+
system("curl -s http://localhost:#{13000 + Process.uid}/quit")
|
45
|
+
else
|
46
|
+
require "goliath"
|
47
|
+
require "pincerna/server"
|
48
|
+
Goliath.env = "production" if !ENV["PINCERNA_DEBUG"]
|
49
|
+
|
50
|
+
runner = Goliath::Runner.new(ARGV, nil)
|
51
|
+
runner.api = Pincerna::Server.new
|
52
|
+
runner.port = 13000 + Process.uid
|
53
|
+
runner.log_file = "/var/log/pincerna-#{Process.uid}.log"
|
54
|
+
runner.app = Goliath::Rack::Builder.build(Pincerna::Server, runner.api)
|
55
|
+
runner.run
|
56
|
+
end
|