amiba 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/lib/amiba/all.rb CHANGED
@@ -3,7 +3,7 @@ require 'haml'
3
3
  require 'active_support/all'
4
4
  require 'active_model'
5
5
  require 'i18n'
6
- require 'rdiscount'
6
+ require 'redcarpet'
7
7
 
8
8
  require 'amiba/core_ext/file'
9
9
  require 'amiba/core_ext/symbol'
data/lib/amiba/repo.rb CHANGED
@@ -26,5 +26,8 @@ module Amiba
26
26
  filenames.map {|fn| last_commit_date(fn)}
27
27
  end
28
28
 
29
+ def push(remote=nil,branch=nil,args={})
30
+ repo.git.push(args,remote,branch)
31
+ end
29
32
  end
30
33
  end
data/lib/amiba/site.rb CHANGED
@@ -9,8 +9,10 @@ module Amiba
9
9
 
10
10
  namespace :"site:preview"
11
11
  class_option :port, :default => 4321
12
+ # class_option :drafts, :default => false
12
13
 
13
14
  def create
15
+ # invoke Amiba::Site::Generate, [], :drafts => options[:drafts]
14
16
  invoke Amiba::Site::Generate
15
17
  end
16
18
 
@@ -34,6 +36,7 @@ module Amiba
34
36
 
35
37
  class S3Upload < Thor::Group
36
38
  include Amiba::Generator
39
+ include Amiba::Repo
37
40
 
38
41
  namespace :"site:upload:s3"
39
42
 
@@ -73,6 +76,11 @@ module Amiba
73
76
  end
74
77
  end
75
78
 
79
+ def git_push
80
+ push
81
+ say_status "Changes pushed to git", "", :green
82
+ end
83
+
76
84
  def complete
77
85
  host = "http://#{bucket}.s3-website-#{Fog.credentials[:region]}.amazonaws.com/"
78
86
  say_status "Available at", host, :green
@@ -93,6 +101,7 @@ module Amiba
93
101
  include Amiba::Generator
94
102
 
95
103
  namespace :"site:generate"
104
+ class_option :drafts, :default => false
96
105
 
97
106
  def self.source_root
98
107
  Dir.pwd
@@ -142,7 +151,7 @@ module Amiba
142
151
  end
143
152
 
144
153
  def build_entries
145
- Amiba::Source::Entry.all.each do |entry|
154
+ Amiba::Source::Entry.send(state).each do |entry|
146
155
  build_page entry
147
156
  end
148
157
  end
@@ -151,7 +160,7 @@ module Amiba
151
160
  Dir.glob('pages/**/[^_]*').each do |page_file|
152
161
  next if File.directory? page_file
153
162
  page = Amiba::Source::Page.new(File.relpath(page_file, "pages"))
154
- next unless page.state == "published"
163
+ next unless (page.state == "published" || options[:drafts])
155
164
  build_page page
156
165
  end
157
166
  end
@@ -177,13 +186,21 @@ module Amiba
177
186
  Tilt.new(feed.filename).render(Amiba::Scope.new(feed), :xml => Builder::XmlMarkup.new)
178
187
  end
179
188
  rescue
180
- puts "Unable to process #{feed.name}, skipping"
189
+ say_status "Failed", "Unable to process #{feed.name}: #{$!}, skipping", :red
181
190
  end
182
191
  end
183
192
  end
184
193
 
185
194
  private
186
195
 
196
+ def state
197
+ if options[:drafts]
198
+ :any
199
+ else
200
+ :published
201
+ end
202
+ end
203
+
187
204
  def build_layout(page)
188
205
  layout = Amiba::Source::Layout.new(page.layout)
189
206
  return layout if File.exists? layout.staged_filename
@@ -199,7 +216,7 @@ module Amiba
199
216
  Tilt.new(layout.staged_filename).render(Amiba::Scope.new(page))
200
217
  end
201
218
  rescue
202
- puts "Unable to process #{page.name}: #{$!}, skipping"
219
+ say_status "Failed", "Unable to process #{page.name}: #{$!}, skipping", :red
203
220
  end
204
221
  end
205
222
 
metadata CHANGED
@@ -2,15 +2,16 @@
2
2
  name: amiba
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.7
5
+ version: 0.0.8
6
6
  platform: ruby
7
7
  authors:
8
8
  - Steven Mohapi-Banks
9
+ - Thom May
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
13
 
13
- date: 2011-05-23 00:00:00 +01:00
14
+ date: 2011-06-01 00:00:00 +01:00
14
15
  default_executable:
15
16
  dependencies:
16
17
  - !ruby/object:Gem::Dependency
@@ -32,7 +33,7 @@ dependencies:
32
33
  requirements:
33
34
  - - ~>
34
35
  - !ruby/object:Gem::Version
35
- version: 1.2.1
36
+ version: 1.3.2
36
37
  type: :runtime
37
38
  version_requirements: *id002
38
39
  - !ruby/object:Gem::Dependency
@@ -80,14 +81,14 @@ dependencies:
80
81
  type: :runtime
81
82
  version_requirements: *id006
82
83
  - !ruby/object:Gem::Dependency
83
- name: rdiscount
84
+ name: redcarpet
84
85
  prerelease: false
85
86
  requirement: &id007 !ruby/object:Gem::Requirement
86
87
  none: false
87
88
  requirements:
88
- - - ~>
89
+ - - ">="
89
90
  - !ruby/object:Gem::Version
90
- version: 1.6.8
91
+ version: "0"
91
92
  type: :runtime
92
93
  version_requirements: *id007
93
94
  - !ruby/object:Gem::Dependency
@@ -98,7 +99,7 @@ dependencies:
98
99
  requirements:
99
100
  - - ">="
100
101
  - !ruby/object:Gem::Version
101
- version: 0.6.0
102
+ version: 0.7.0
102
103
  type: :runtime
103
104
  version_requirements: *id008
104
105
  - !ruby/object:Gem::Dependency
@@ -159,6 +160,7 @@ dependencies:
159
160
  description: Description TBD
160
161
  email:
161
162
  - s.mohapi-banks@digital-science.com
163
+ - thom@digital-science.com
162
164
  executables:
163
165
  - amiba
164
166
  extensions: []