espalhe-firefly 1.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +11 -0
- data/.rspec +1 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +71 -0
- data/HISTORY +117 -0
- data/LICENSE +20 -0
- data/README.md +191 -0
- data/Rakefile +9 -0
- data/config.ru.example +40 -0
- data/firefly.gemspec +35 -0
- data/lib/firefly.rb +41 -0
- data/lib/firefly/base62.rb +27 -0
- data/lib/firefly/code_factory.rb +24 -0
- data/lib/firefly/config.rb +29 -0
- data/lib/firefly/server.rb +334 -0
- data/lib/firefly/url.rb +67 -0
- data/lib/firefly/version.rb +4 -0
- data/public/favicon.ico +0 -0
- data/public/images/twitter.png +0 -0
- data/public/jquery-1.4.2.min.js +154 -0
- data/public/reset.css +48 -0
- data/public/style.css +94 -0
- data/spec/firefly/api_spec.rb +166 -0
- data/spec/firefly/base62_spec.rb +21 -0
- data/spec/firefly/code_factory_spec.rb +12 -0
- data/spec/firefly/server_spec.rb +76 -0
- data/spec/firefly/sharing_facebook_spec.rb +65 -0
- data/spec/firefly/sharing_hyves_spec.rb +107 -0
- data/spec/firefly/sharing_twitter_spec.rb +104 -0
- data/spec/firefly/url_spec.rb +121 -0
- data/spec/fixtures/urls.yml +11 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +55 -0
- data/views/error.haml +11 -0
- data/views/index.haml +91 -0
- data/views/info.haml +26 -0
- data/views/layout.haml +18 -0
- metadata +308 -0
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--format progress --colour
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
firefly (1.5.3)
|
5
|
+
dm-aggregates (~> 1.0.2)
|
6
|
+
dm-core (~> 1.0.2)
|
7
|
+
dm-migrations (~> 1.0.2)
|
8
|
+
dm-mysql-adapter (~> 1.0.2)
|
9
|
+
dm-transactions (~> 1.0.2)
|
10
|
+
escape_utils (~> 0.2.3)
|
11
|
+
haml (~> 3.0.18)
|
12
|
+
sinatra (~> 1.2.6)
|
13
|
+
|
14
|
+
GEM
|
15
|
+
remote: http://rubygems.org/
|
16
|
+
specs:
|
17
|
+
addressable (2.2.5)
|
18
|
+
data_objects (0.10.3)
|
19
|
+
addressable (~> 2.1)
|
20
|
+
database_cleaner (0.6.6)
|
21
|
+
diff-lcs (1.1.2)
|
22
|
+
dm-aggregates (1.0.2)
|
23
|
+
dm-core (~> 1.0.2)
|
24
|
+
dm-core (1.0.2)
|
25
|
+
addressable (~> 2.2)
|
26
|
+
extlib (~> 0.9.15)
|
27
|
+
dm-do-adapter (1.0.2)
|
28
|
+
data_objects (~> 0.10.2)
|
29
|
+
dm-core (~> 1.0.2)
|
30
|
+
dm-migrations (1.0.2)
|
31
|
+
dm-core (~> 1.0.2)
|
32
|
+
dm-mysql-adapter (1.0.2)
|
33
|
+
dm-do-adapter (~> 1.0.2)
|
34
|
+
do_mysql (~> 0.10.2)
|
35
|
+
dm-sqlite-adapter (1.0.2)
|
36
|
+
dm-do-adapter (~> 1.0.2)
|
37
|
+
do_sqlite3 (~> 0.10.2)
|
38
|
+
dm-transactions (1.0.2)
|
39
|
+
dm-core (~> 1.0.2)
|
40
|
+
do_mysql (0.10.3)
|
41
|
+
data_objects (= 0.10.3)
|
42
|
+
do_sqlite3 (0.10.3)
|
43
|
+
data_objects (= 0.10.3)
|
44
|
+
escape_utils (0.2.3)
|
45
|
+
extlib (0.9.15)
|
46
|
+
haml (3.0.25)
|
47
|
+
rack (1.2.2)
|
48
|
+
rack-test (0.5.7)
|
49
|
+
rack (>= 1.0)
|
50
|
+
rspec (2.5.0)
|
51
|
+
rspec-core (~> 2.5.0)
|
52
|
+
rspec-expectations (~> 2.5.0)
|
53
|
+
rspec-mocks (~> 2.5.0)
|
54
|
+
rspec-core (2.5.1)
|
55
|
+
rspec-expectations (2.5.0)
|
56
|
+
diff-lcs (~> 1.1.2)
|
57
|
+
rspec-mocks (2.5.0)
|
58
|
+
sinatra (1.2.6)
|
59
|
+
rack (~> 1.1)
|
60
|
+
tilt (>= 1.2.2, < 2.0)
|
61
|
+
tilt (1.3.2)
|
62
|
+
|
63
|
+
PLATFORMS
|
64
|
+
ruby
|
65
|
+
|
66
|
+
DEPENDENCIES
|
67
|
+
database_cleaner (~> 0.6.6)
|
68
|
+
dm-sqlite-adapter (~> 1.0.2)
|
69
|
+
firefly!
|
70
|
+
rack-test (~> 0.5.4)
|
71
|
+
rspec (~> 2.5.0)
|
data/HISTORY
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
- 1.5.3 - 2011-05-05
|
2
|
+
|
3
|
+
* 2011-05-05 Force all instances of Firefly to use the same session_secret so logins work properly with multi-instance setups (issue #30) [ariejan]
|
4
|
+
|
5
|
+
= 1.5.2 - 2011-05-02
|
6
|
+
|
7
|
+
* 2011-05-02 Fixed issue with sharing a link without a title (issue #26) [ariejan]
|
8
|
+
|
9
|
+
= 1.5.1 - 2011-04-22
|
10
|
+
|
11
|
+
* 2011-04-22 Truncate long URLs in the backend to preserve layout (issue #25) [ariejan]
|
12
|
+
* 2011-04-22 Accept URL encoded titles when sharing to Twitter and Hyves (issue #28) [ariejan]
|
13
|
+
|
14
|
+
= 1.5.0 - 2011-04-21
|
15
|
+
|
16
|
+
* 2011-04-21 Firefly is now compatible with ruby 1.8.7, 1.9.2 and ree-1.8 [ariejan]
|
17
|
+
* 2011-04-21 Added support for sharing to hyves [stalkert]
|
18
|
+
* 2011-04-21 Added support for sharing to facebook [stalkert]
|
19
|
+
* 2011-04-21 Removed exports because they add to much overhead [ariejan]
|
20
|
+
|
21
|
+
= 1.4.1 - 2011-02-11
|
22
|
+
|
23
|
+
* 2011-02-11 Strip leading and trailing whitespace from titles when sharing [ariejan]
|
24
|
+
* 2011-02-11 Make sure shared titles don't exceed a total of 140 characters for twitter [ariejan]
|
25
|
+
|
26
|
+
= 1.4.0 - 2011-02-11
|
27
|
+
|
28
|
+
* 2011-02-21 Added support for 'share to twitter' links [ariejan]
|
29
|
+
|
30
|
+
= 1.3.1 / 2011-02-20
|
31
|
+
|
32
|
+
* 2011-02-20 Fixed issue with escaped characters in URL (ticket #21) [ariejan]
|
33
|
+
|
34
|
+
= 1.3.0 / 2011-02-01
|
35
|
+
|
36
|
+
* 2011-02-01 Improved GUI [ariejan]
|
37
|
+
* 2011-02-01 Improved error handling / reporting [ariejan]
|
38
|
+
* 2011-01-31 Added a CodeFactory to generate unique short codes (and prevent collisions with custom short codes) [ariejan]
|
39
|
+
* 2011-01-30 Use dm-mysql-adapater as default, dm-sqlite-adapter is optional [ariejan]
|
40
|
+
|
41
|
+
= 1.2.1/1.2.2 / 2011-01-26
|
42
|
+
|
43
|
+
* 2011-01-26 - Added GUI support for custom short codes. [ariejan]
|
44
|
+
|
45
|
+
= 1.2.0 / 2011-01-26
|
46
|
+
|
47
|
+
* 2010-12-30 - Support for specifying one's own preferred short codes via the API. Also, invalid URL creations return a 422 code, not 200. [ariejan]
|
48
|
+
* 2010-12-30 - Make Barby optional to save some gems for those of us who don't need QR code generation. [mboeh]
|
49
|
+
|
50
|
+
= 1.1.0 / 2010-10-02
|
51
|
+
|
52
|
+
* 2010-10-02 - Generate a QR Code image when accessing http://:host/:code.png [ariejan]
|
53
|
+
|
54
|
+
= 1.0.0 / 2010-09-19
|
55
|
+
|
56
|
+
* 2010-09-18 - Added better support for URLs with spaces and other special characters. Closes #19 [ariejan]
|
57
|
+
|
58
|
+
= 0.4.5 / 2010-08-10
|
59
|
+
|
60
|
+
* 2010-08-10 - Added sorting of shortened URLs. Closes #12. [ariejan]
|
61
|
+
* 2010-08-10 - Added CSV, XML and YAML export of all shortened URLs. Closes #11. [ariejan]
|
62
|
+
* 2010-08-10 - Updated bookmarklet JavaScript to escape URL-unsafe charachters in the API key. Fixes #17 [ariejan]
|
63
|
+
|
64
|
+
= 0.4.4 / 2010-06-20
|
65
|
+
|
66
|
+
* 2010-06-20 - Updated gem dependencies for DataMapper 1.0.0 [ariejan]
|
67
|
+
|
68
|
+
= 0.4.3 / 2010-06-06
|
69
|
+
|
70
|
+
* 2010-06-06 - Handle invalid API keys correctly. [ariejan]
|
71
|
+
|
72
|
+
= 0.4.2 / 2010-06-06
|
73
|
+
|
74
|
+
* 2010-06-06 - Added a fix for MySQL users to update the `code` column to use the correct collation. Fixes #9 [ariejan]
|
75
|
+
|
76
|
+
= 0.4.1 / 2010-04-30
|
77
|
+
|
78
|
+
* 2010-04-30 - Normalize URLs before shortening them. This prevents false duplicates. [ariejan]
|
79
|
+
* 2010-04-30 - Validate URLs to be valid HTTP or HTTPS, don't accept others. [ariejan]
|
80
|
+
* 2010-04-30 - Don't ask for the API key after shortening a URL with the bookmarklet. [ariejan]
|
81
|
+
* 2010-04-15 - Show the highlighted URL separately. Closes #7. [ariejan]
|
82
|
+
|
83
|
+
= 0.4.0.1 / 2010-04-14
|
84
|
+
|
85
|
+
* 2010-04-14 - Correct file permission of `public/images/twitter.png`. [ariejan]
|
86
|
+
|
87
|
+
= 0.4.0 / 2010-04-14
|
88
|
+
|
89
|
+
* 2010-04-14 - Added button to quickly tweet a URL. Closes #3 [ariejan]
|
90
|
+
* 2010-04-14 - Disable autocomplete and spellcheck for the big url input field. Closes #6 [ariejan]
|
91
|
+
* 2010-04-14 - After shortening an URL highlight the url that was added in the overview. [ariejan]
|
92
|
+
* 2010-04-14 - Made it easy to copy a short url from the overview. Closes #4 [ariejan]
|
93
|
+
* 2010-04-13 - Added links to source and issues in footer. [ariejan]
|
94
|
+
- Include domain name in page title. [ariejan]
|
95
|
+
|
96
|
+
= 0.3.1 / 2010-04-13
|
97
|
+
|
98
|
+
* 2010-04-13 - Fixed issue with setting `created_at` timestamp. [ariejan]
|
99
|
+
|
100
|
+
= 0.3.0 / 2010-04-13
|
101
|
+
|
102
|
+
* 2010-04-13 - Added recent urls to dashboard [ariejan]
|
103
|
+
- Added bookmarklet [ariejan]
|
104
|
+
- Split up Firefly codebase for better testing and maintainability [ariejan]
|
105
|
+
* 2010-04-02 - Added Ruby 1.9.x compatibility. [ariejan]
|
106
|
+
|
107
|
+
= 0.2.0 / 2010-03-29
|
108
|
+
|
109
|
+
* 2010-03-29 - Added some GUI sugar at '/'. [ariejan]
|
110
|
+
* 2010-03-29 - Added /api/info/:code for basic stats on the specified URL. [ariejan]
|
111
|
+
* 2010-03-29 - Keep count of the number of visits to a given URL. [ariejan]
|
112
|
+
* 2010-03-29 - Fill in `created_at` for Firefly::Url. [ariejan]
|
113
|
+
* 2010-03-29 - Changed Firefly::Url String properties to a length of 255 instead of the default of 50. [ariejan]
|
114
|
+
|
115
|
+
= 0.1 / 2010-03-28
|
116
|
+
|
117
|
+
* First official release [ariejan]
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Ariejan de Vroom
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,191 @@
|
|
1
|
+
# FireFly [![Build Status](http://travis-ci.org/ariejan/firefly.png)](http://travis-ci.org/ariejan/firefly)
|
2
|
+
|
3
|
+
|
4
|
+
FireFly is a simple URL shortener for personal (or not so personal) use.
|
5
|
+
|
6
|
+
# Quick-Start (2 minutes) with Heroku
|
7
|
+
|
8
|
+
See the [screencast][1] or [written instructions][2] on how to setup Firefly within 2 minutes on [Heroku][3]
|
9
|
+
|
10
|
+
# Installation
|
11
|
+
|
12
|
+
sudo gem install firefly
|
13
|
+
|
14
|
+
After you have installed the Firefly gem you should create a `config.ru` file that tells your webserver what to do. Here is a sample `config.ru`:
|
15
|
+
|
16
|
+
require 'rubygems'
|
17
|
+
require 'firefly'
|
18
|
+
|
19
|
+
disable :run
|
20
|
+
|
21
|
+
app = Firefly::Server.new do
|
22
|
+
# The domain you use for shortening.
|
23
|
+
set :hostname, "localhost:9393"
|
24
|
+
# set :hostname, "aj.gs"
|
25
|
+
|
26
|
+
# Used for authenticating you.
|
27
|
+
set :api_key, "changeme"
|
28
|
+
|
29
|
+
# Default MySQL:
|
30
|
+
set :database, "mysql://root:password@localhost/firefly"
|
31
|
+
|
32
|
+
# Use Sqlite3: gem install dm-sqlite-adapter
|
33
|
+
# set :database, "sqlite3://#{Dir.pwd}/firefly.sqlite3"
|
34
|
+
|
35
|
+
# Set the number of recent urls to show in the overview.
|
36
|
+
# Defaults to 25
|
37
|
+
# set :recent_urls, 10
|
38
|
+
|
39
|
+
# Set the tweet template.
|
40
|
+
# The tag %short_url% will be replaced with the actual url.
|
41
|
+
#
|
42
|
+
# Default: Check this out: %short_url%
|
43
|
+
# set :tweet, "I loved this: %short_url% - Go check it out now!"
|
44
|
+
|
45
|
+
# If you want to enable 'share to sharing targets'
|
46
|
+
|
47
|
+
# A secure key to be used with 'share to sharing targets'
|
48
|
+
# set :sharing_key, "set-a-long-secure-key-here"
|
49
|
+
|
50
|
+
# Currently only twitter, hyves and facebook are supported
|
51
|
+
# set :sharing_targets, [:twitter, :hyves, :facebook]
|
52
|
+
|
53
|
+
# Set the TLDs (in URLs) that are allowed to be shortened
|
54
|
+
# set :sharing_domains, ["example.com", "mydomain.com"]
|
55
|
+
|
56
|
+
# Set your session secret here.
|
57
|
+
# If you're unsure what to use, open IRB console and run `'%x' % rand(2**255)`
|
58
|
+
set :session_secret, "change-me"
|
59
|
+
end
|
60
|
+
|
61
|
+
run app
|
62
|
+
|
63
|
+
Next you can start your web server. You may try thin:
|
64
|
+
|
65
|
+
thin start -R config.ru
|
66
|
+
|
67
|
+
Now visit `http://:hostname/` and enter your `:api_key`. Happy URL shortening!
|
68
|
+
|
69
|
+
# Enabling QR Codes
|
70
|
+
|
71
|
+
To enable QR Codes install the `barby` and `png` gems:
|
72
|
+
|
73
|
+
gem install barby png
|
74
|
+
|
75
|
+
Firefly will detect you have these gems available and enable QR Code support automatically.
|
76
|
+
|
77
|
+
# Configuration
|
78
|
+
|
79
|
+
All configuration is done in `config.ru`.
|
80
|
+
|
81
|
+
* `:hostname` sets the hostname to use for shortened URLs.
|
82
|
+
* `:api_key` sets the API key. This key is required when posting new URLs
|
83
|
+
* `:database` a database URI that [DataMapper][4] can understand.
|
84
|
+
* `:recent_urls` sets the number of URLs to show in the overview. Default: 25.
|
85
|
+
* `:tweet` set the template to use for tweets. Default: `"Check this out: %short_url%"`
|
86
|
+
* `:sharing_key` set this to something long and secure, used for
|
87
|
+
creating 'share to sharing targets' links.
|
88
|
+
* `:sharing_targets` set to `[:twitter, :hyves, :facebook]` if you want to enable sharing
|
89
|
+
to twitter, hyves or facebook
|
90
|
+
* `:sharing_domains` set to an array of TLDs. Only urls shared in those
|
91
|
+
domains will be allowed. Set to an empty array (`[]`) if you want to
|
92
|
+
accept all domains.
|
93
|
+
|
94
|
+
It's possible to use all kinds of backends with DataMapper. Sqlite3 and MySQL have been tested, but others may work as well.
|
95
|
+
|
96
|
+
# Usage
|
97
|
+
|
98
|
+
Simply visit `http://:hostname/` and enter your `:api_key`. You can now shorten URLs.
|
99
|
+
|
100
|
+
## Using the API
|
101
|
+
|
102
|
+
You may also use the API to automate URL shortening. Here's how.
|
103
|
+
|
104
|
+
Adding a URL is done by doing a simple POST request that includes the URL and your API key.
|
105
|
+
|
106
|
+
curl -d "url=http://ariejan.net" -d "api_key=test" http://localhost:3000/api/add
|
107
|
+
|
108
|
+
If you're on a MacOSX you could add the following function to your `~/.profile` to automate URL shortening:
|
109
|
+
|
110
|
+
shorten(){
|
111
|
+
URL=$1
|
112
|
+
SHORT_URL=`curl -s -d "url=$URL&api_key=test" http://localhost:3000/api/add`
|
113
|
+
echo $SHORT_URL | pbcopy
|
114
|
+
|
115
|
+
echo "-- $URL => $SHORT_URL"
|
116
|
+
echo "Short URL copied to clipboard."
|
117
|
+
}
|
118
|
+
|
119
|
+
After you restart Terminal.app (or at least reload the `.profile` file) you can use it like this:
|
120
|
+
|
121
|
+
$ shorten http://ariejan.net
|
122
|
+
-- http://ariejan.net => http://aj.gs/1
|
123
|
+
Short URL copied to clipboard.
|
124
|
+
|
125
|
+
## Using the social features (Twitter, Facebook, etc.)
|
126
|
+
|
127
|
+
The share to sharing targets feature allows you to create custom links on your
|
128
|
+
site. When clicked, the specified URL will be shortened and the user
|
129
|
+
will be redirect to Twitter to share the new short URL.
|
130
|
+
|
131
|
+
GET /api/share
|
132
|
+
POST /api/share
|
133
|
+
|
134
|
+
Parameters:
|
135
|
+
url - Long URL to share (required)
|
136
|
+
key - The sharing key, specified in `config.ru` (required)
|
137
|
+
target - Target to share to. E.g. `twitter` or `facebook` (required)
|
138
|
+
title - Title of text to use in the tweet (optional)
|
139
|
+
|
140
|
+
# Bugs, Feature Requests, etc.
|
141
|
+
|
142
|
+
* [Source][5]
|
143
|
+
* [Issue tracker][6]
|
144
|
+
|
145
|
+
Feel free to fork Firefly and create patches for it. Here are some basic instructions:
|
146
|
+
|
147
|
+
* [Fork][7] Firefly
|
148
|
+
* Create a topic branch - `git checkout -b my_branch`
|
149
|
+
* Write tests and code
|
150
|
+
* Push to your branch - `git push origin my_branch`
|
151
|
+
* Create a GitHub Pull Request so I can merge your changes
|
152
|
+
* That's it!
|
153
|
+
|
154
|
+
[1]: http://ariejan.net/2010/07/12/screencast-firefly-url-shortener-in-less-than-25-minutes/
|
155
|
+
[2]: http://ariejan.net/2010/06/06/setup-your-own-firefly-url-shortener-in-25-minutes/
|
156
|
+
[3]: http://heroku.com
|
157
|
+
[4]: http://datamapper.org/
|
158
|
+
[5]: http://github.com/ariejan/firefly
|
159
|
+
[6]: http://github.com/ariejan/firefly/issues
|
160
|
+
[7]: http://help.github.com/forking/
|
161
|
+
[8]: http://github.com/ariejan/firefly/issues
|
162
|
+
|
163
|
+
# Contributors
|
164
|
+
|
165
|
+
* Ariejan de Vroom - Original author
|
166
|
+
* Matthew Boeh - Contributor
|
167
|
+
* Joost Saanen - Contributor
|
168
|
+
|
169
|
+
# License
|
170
|
+
|
171
|
+
Copyright (c) 2009 Ariejan de Vroom
|
172
|
+
|
173
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
174
|
+
a copy of this software and associated documentation files (the
|
175
|
+
"Software"), to deal in the Software without restriction, including
|
176
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
177
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
178
|
+
permit persons to whom the Software is furnished to do so, subject to
|
179
|
+
the following conditions:
|
180
|
+
|
181
|
+
The above copyright notice and this permission notice shall be
|
182
|
+
included in all copies or substantial portions of the Software.
|
183
|
+
|
184
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
185
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
186
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
187
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
188
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
189
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
190
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
191
|
+
|
data/Rakefile
ADDED
data/config.ru.example
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'firefly'
|
3
|
+
|
4
|
+
disable :run
|
5
|
+
|
6
|
+
app = Firefly::Server.new do
|
7
|
+
set :hostname, "localhost:3000"
|
8
|
+
set :api_key, "test"
|
9
|
+
|
10
|
+
# Use Sqlite3 by default
|
11
|
+
set :database, "sqlite3://#{Dir.pwd}/firefly.sqlite3"
|
12
|
+
|
13
|
+
# Set number of recent urls to show
|
14
|
+
set :recent_urls, 10
|
15
|
+
|
16
|
+
# You can use MySQL as well.
|
17
|
+
# Make sure to install the do_mysql gem:
|
18
|
+
# sudo gem install do_mysql
|
19
|
+
# set :database, "mysql://root@localhost/firefly"
|
20
|
+
|
21
|
+
# If you want to enable 'share to twitter'
|
22
|
+
|
23
|
+
# A secure key to be used with 'share to twitter'
|
24
|
+
# set :sharing_key, "set-a-long-secure-key-here"
|
25
|
+
set :sharing_key, ""
|
26
|
+
|
27
|
+
# Currently only twitter is supported
|
28
|
+
# set :sharing_targets, [:twitter, :hyves, :facebook]
|
29
|
+
set :sharing_targets, []
|
30
|
+
|
31
|
+
# Set the TLDs (in URLs) that are allowed to be shortened
|
32
|
+
# set :sharing_domains, ["example.com", "mydomain.com"]
|
33
|
+
set :sharing_domain, []
|
34
|
+
|
35
|
+
# Set your session secret here.
|
36
|
+
# If you're unsure what to use, open IRB console and run `'%x' % rand(2**255)`
|
37
|
+
set :session_secret, "change-me"
|
38
|
+
end
|
39
|
+
|
40
|
+
run app
|