almanack 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5284cadfc609e3a8a9ed16fa80b5c80607c3d922
4
- data.tar.gz: a2ba774e37e39820483a979f4fd1315e75e195b1
3
+ metadata.gz: c39fea3d02a2700be92b1899af873e7ca32aafd4
4
+ data.tar.gz: 29c54092d575add88cdac6dda027c653c60f7c0e
5
5
  SHA512:
6
- metadata.gz: 7c3cc747278612494441caf410a86dcc6ecd16f719be394da132eb31b4cc3ef992adafe037d1dc4329c904e2d67ae94e876825bb276b23ad5741ad0b80159daf
7
- data.tar.gz: 37ab70dee79424f70633593700bc84cbe526c6832c652a53e8a45299335bcd26972d2a5ac22baba4f0c6bf28eafca77067c578d20a41af5231a4774f6096dae6
6
+ metadata.gz: 46fadc971f44e0e7a0ebe0206e3ef1bc35f8499966d7a2801af61252ee26f821fb3dc5932ee8979631d558797f737fc9b8a01d86a7797dc46c0d872f00c939b9
7
+ data.tar.gz: 4fbcc1013b4bf0b07792a7c121ae7965183a884dd041ba48cb0d469a84ef52988a670d4bdd165bd0ee40850162c22e28dde35e7ee4b4f6200efd5f06faa17f2a
data/.travis.yml CHANGED
@@ -2,6 +2,8 @@ language: ruby
2
2
  cache: bundler
3
3
  rvm:
4
4
  - 2.1.2
5
+ - 2.1.0
6
+ - 2.0.0
5
7
  addons:
6
8
  code_climate:
7
9
  repo_token:
data/README.md CHANGED
@@ -1,11 +1,17 @@
1
1
  # Almanack
2
2
 
3
- [![Build Status](https://travis-ci.org/Aupajo/sinatra-gcal.svg)](https://travis-ci.org/Aupajo/sinatra-gcal)
4
- [![Code Climate](https://codeclimate.com/github/Aupajo/sinatra-gcal.png)](https://codeclimate.com/github/Aupajo/sinatra-gcal)
5
- [![Code Climate](https://codeclimate.com/github/Aupajo/sinatra-gcal/coverage.png)](https://codeclimate.com/github/Aupajo/sinatra-gcal)
3
+ [![Build Status](https://travis-ci.org/Aupajo/almanack.svg)](https://travis-ci.org/Aupajo/almanack)
4
+ [![Code Climate](https://codeclimate.com/github/Aupajo/almanack.png)](https://codeclimate.com/github/Aupajo/almanack)
5
+ [![Code Climate](https://codeclimate.com/github/Aupajo/almanack/coverage.png)](https://codeclimate.com/github/Aupajo/almanack)
6
+
7
+ *This project was formerly Sinatra-GCal. A [legacy branch](https://github.com/Aupajo/almanack/tree/almanack) exists for that project.*
6
8
 
7
9
  A calendar that combines events from different sources (such as Google Calendar, Meetup.com, and iCal feeds), and can be hosted for free on [Heroku](http://heroku.com).
8
10
 
11
+ ![Sinatra GCal example](http://i.imgur.com/odgyR.png)
12
+
13
+ See a demo running at [http://christchurch.events.geek.nz](http://christchurch.events.geek.nz)
14
+
9
15
  ## Features
10
16
 
11
17
  * Aggregate multiple calendars together into one stream
@@ -15,7 +21,8 @@ A calendar that combines events from different sources (such as Google Calendar,
15
21
  * Supports being freely hosted on Heroku
16
22
  * 100% customisable themes with Sass and CoffeeScript support
17
23
  * Server optional (you can use the underlying calendar library by itself)
18
- * Rack-compatible (mount inside any Rails application)
24
+ * Rack-compatible (can be mounted inside a Rails app if needed)
25
+ * Produces iCal feed for smartphone and desktop calendar apps to subscribe to
19
26
 
20
27
  ## Installation
21
28
 
@@ -46,6 +53,7 @@ See examples inside `config.ru` for iCal feeds, Meetup.com, or static events.
46
53
  Almanack.config do |c|
47
54
  c.title = 'My Calendar'
48
55
  c.theme = 'my-custom-theme'
56
+ c.days_lookahead = 30
49
57
  c.add_ical_feed 'http://example.org/events.ics'
50
58
  c.add_ical_feed 'http://example.org/more-events.ics'
51
59
  c.add_meetup_group group_urlname: 'Christchurch-Ruby-Group', key: 'mysecretkey'
@@ -70,6 +78,24 @@ Almanack.config do |c|
70
78
  end
71
79
  ```
72
80
 
81
+ ## Deploying to Heroku
82
+
83
+ Deployment works with Git and Heroku. First, add your work to git (an repository
84
+ is already initialized for you when you run `almanack new`):
85
+
86
+ git add .
87
+ git commit -m "My awesome calendar"
88
+
89
+ With the [Heroku Toolbelt](https://toolbelt.heroku.com) installed:
90
+
91
+ almanack deploy my-awesome-calendar
92
+
93
+ Will create and deploy http://my-awesome-calendar.herokuapp.com/.
94
+
95
+ Subsequent commits can be deployed with just:
96
+
97
+ almanack deploy
98
+
73
99
  ## Contributing
74
100
 
75
101
  1. Fork it ( http://github.com/Aupajo/almanack/fork )
@@ -8,7 +8,7 @@ module Almanack
8
8
  ONE_YEAR = 365 * ONE_DAY
9
9
 
10
10
  extend Forwardable
11
- def_delegators :@config, :event_sources, :title
11
+ def_delegators :@config, :event_sources, :title, :days_lookahead
12
12
 
13
13
  def initialize(config)
14
14
  @config = config
@@ -49,9 +49,5 @@ module Almanack
49
49
 
50
50
  ical.to_s
51
51
  end
52
-
53
- def days_lookahead
54
- 30
55
- end
56
52
  end
57
53
  end
data/lib/almanack/cli.rb CHANGED
@@ -33,15 +33,15 @@ module Almanack
33
33
  option :theme, default: 'legacy', desc: "Which theme to use (available: #{available_themes.join(', ')})"
34
34
  option :git, type: :boolean, default: true, desc: "Whether to initialize an empty git repo"
35
35
  def new(path)
36
- path = Pathname(path).cleanpath
36
+ @path = Pathname(path).cleanpath
37
37
 
38
38
  directory "templates/new", path
39
39
 
40
40
  if options[:git]
41
- template('templates/gitignore', path.join(".gitignore"))
41
+ template('templates/gitignore', @path.join(".gitignore"))
42
42
  end
43
43
 
44
- inside path do
44
+ inside @path do
45
45
  say_status :installing, "bundler dependencies"
46
46
  system "bundle install --quiet"
47
47
 
@@ -53,7 +53,7 @@ module Almanack
53
53
  say
54
54
  say "==> Run your new calendar!"
55
55
  say
56
- say " cd #{path}"
56
+ say " cd #{@path}"
57
57
  say " almanack start"
58
58
  say
59
59
  end
@@ -110,6 +110,20 @@ module Almanack
110
110
  options[:theme]
111
111
  end
112
112
 
113
+ def almanack_homepage
114
+ Almanack::HOMEPAGE
115
+ end
116
+
117
+ def almanack_issues
118
+ Almanack::ISSUES
119
+ end
120
+
121
+ def title
122
+ basename = @path.to_s.split('/', 2).last.split('.', 2).first
123
+ sanitized = basename.gsub('-', ' ')
124
+ sanitized.split(/\s+/).map(&:capitalize).join(' ')
125
+ end
126
+
113
127
  def git(command)
114
128
  output = `git #{command}`
115
129
  abort "Git failed: #{output}" if $?.exitstatus != 0
@@ -7,9 +7,10 @@ module Almanack
7
7
  class ThemeNotFound < StandardError; end
8
8
 
9
9
  DEFAULT_THEME = "legacy"
10
+ DEFAULT_DAYS_LOOKAHEAD = 30
10
11
 
11
12
  attr_reader :event_sources
12
- attr_accessor :title, :theme, :theme_paths, :theme_root
13
+ attr_accessor :title, :theme, :theme_paths, :theme_root, :days_lookahead
13
14
 
14
15
  def initialize
15
16
  reset!
@@ -17,6 +18,7 @@ module Almanack
17
18
 
18
19
  def reset!
19
20
  @theme = DEFAULT_THEME
21
+ @days_lookahead = DEFAULT_DAYS_LOOKAHEAD
20
22
  @event_sources = []
21
23
 
22
24
  @theme_paths = [
@@ -42,6 +42,8 @@ module Almanack
42
42
  end
43
43
 
44
44
  def location_from_venue(venue)
45
+ return nil if venue.nil?
46
+
45
47
  %w{ name address_1 address_2 address_3 city state country }.map do |attr|
46
48
  venue[attr]
47
49
  end.compact.join(', ')
@@ -1,6 +1,6 @@
1
1
  module Almanack
2
2
  CODENAME = "Garlick"
3
- VERSION = "1.0.0"
3
+ VERSION = "1.0.1"
4
4
  HOMEPAGE = "https://github.com/Aupajo/sinatra-gcal"
5
5
  ISSUES = "https://github.com/Aupajo/sinatra-gcal/issues"
6
6
  end
@@ -53,8 +53,11 @@ module Almanack
53
53
  end
54
54
  end
55
55
 
56
- it "has a 30 day lookahead" do
57
- expect(Calendar.new(double).days_lookahead).to eq(30)
56
+ describe "#days_lookahead" do
57
+ it "delegates to the configuration's days_lookahead" do
58
+ config = double(days_lookahead: :delegated)
59
+ expect(Calendar.new(config).days_lookahead).to eq(:delegated)
60
+ end
58
61
  end
59
62
 
60
63
  end
@@ -27,6 +27,16 @@ module Almanack
27
27
  end
28
28
  end
29
29
 
30
+ describe "#days_lookahead" do
31
+ specify { expect(Configuration.new.days_lookahead).to eq(30) }
32
+
33
+ specify "it can be set" do
34
+ config = Configuration.new
35
+ config.days_lookahead = 365
36
+ expect(config.days_lookahead).to eq(365)
37
+ end
38
+ end
39
+
30
40
  describe "#add_events" do
31
41
  it "adds a simple event collection event source" do
32
42
  config = Configuration.new
@@ -20,6 +20,18 @@ module Almanack::EventSource
20
20
  expect(events.length).to eq(5)
21
21
  expect(events).to all_have_properties(:title, :start_date, :end_date, :description, :location)
22
22
  end
23
+
24
+ it "handles a missing location" do
25
+ feed = MeetupGroup.new(group_urlname: 'adventurewellington', key: 'secrettoken')
26
+
27
+ Timecop.freeze(2014, 7, 23) do
28
+ VCR.use_cassette('meetup-without-location') do
29
+ from = Time.now
30
+ to = from + 30 * 24 * 60 * 60
31
+ expect { feed.events_between(from..to) }.not_to raise_error
32
+ end
33
+ end
34
+ end
23
35
  end
24
36
 
25
37
  end