amiba 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/amiba/all.rb +1 -1
 - data/lib/amiba/repo.rb +3 -0
 - data/lib/amiba/site.rb +21 -4
 - metadata +9 -7
 
    
        data/lib/amiba/all.rb
    CHANGED
    
    
    
        data/lib/amiba/repo.rb
    CHANGED
    
    
    
        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. 
     | 
| 
      
 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 
     | 
    
         
            -
                         
     | 
| 
      
 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 
     | 
    
         
            -
                       
     | 
| 
      
 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. 
     | 
| 
      
 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- 
     | 
| 
      
 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 
     | 
| 
      
 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:  
     | 
| 
      
 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:  
     | 
| 
      
 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. 
     | 
| 
      
 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: []
         
     |