missing files added to git

did committed Jan 14, 2013
commit 20ae28b194a5162096c50e8416d8b83c7a44af1b
Showing 7 changed files with 107 additions and 17 deletions
.gitignore +2 -2
@@ @@ -1,5 +1,5 @@
.DS_Store
- site
+ /site
*.gem
*.rbc
.bundle
@@ @@ -21,4 +21,4 @@ tmp
/.rbenv-gemsets
/.sass-cache/
- /tests
\ No newline at end of file
+ /tests
TODO +4 -0
@@ @@ -36,6 +36,10 @@ x content types / liquid
- --force option
- pull
+ - version checkings:
+ - builder when running it
+ - engine when pushing a site
+
- translations
- tests
locomotive/builder.rb b/lib/locomotive/builder.rb +10 -10
@@ @@ -42,16 +42,6 @@ module Locomotive
generator.invoke_all
end
- # TODO
- def self.pull(path, site_url, email, password)
- require 'locomotive/mounter'
-
- reader = Locomotive::Mounter::Reader::Api.instance
- reader.run!(uri: "#{site_url.chomp('/')}/locomotive/api", email: email, password: password)
- writer = Locomotive::Mounter::Writer::FileSystem.instance
- writer.run!(mounting_point: reader.mounting_point, target_path: path)
- end
-
# TODO
def self.push(path, site_url, email, password)
require 'locomotive/mounter'
@@ @@ -62,5 +52,15 @@ module Locomotive
writer.run!(mounting_point: reader.mounting_point, uri: "#{site_url.chomp('/')}/locomotive/api", email: email, password: password)
end
+ # TODO
+ def self.pull(path, site_url, email, password)
+ require 'locomotive/mounter'
+
+ reader = Locomotive::Mounter::Reader::Api.instance
+ reader.run!(uri: "#{site_url.chomp('/')}/locomotive/api", email: email, password: password)
+ writer = Locomotive::Mounter::Writer::FileSystem.instance
+ writer.run!(mounting_point: reader.mounting_point, target_path: path)
+ end
+
end
end
\ No newline at end of file
locomotive/builder/cli.rb b/lib/locomotive/builder/cli.rb +5 -5
@@ @@ -94,16 +94,16 @@ module Locomotive
Locomotive::Builder.serve(path, options)
end
+ # desc "push [PATH] SITE_URL EMAIL PASSWORD", "Push a site created by the builder to a remote LocomotiveCMS engine"
+ # def push(path, site_url, email, password)
+ # Locomotive::Builder.push(path, site_url, email, password)
+ # end
+
# desc "pull NAME SITE_URL EMAIL PASSWORD", "Pull an existing LocomotiveCMS site powered by the engine"
# def pull(name, site_url, email, password)
# say("ERROR: \"#{name}\" directory already exists", :red) and return if File.exists?(name)
# Locomotive::Builder.pull(name, site_url, email, password)
# end
-
- # desc "push PATH SITE_URL EMAIL PASSWORD", "Push a site created by the builder to a remote LocomotiveCMS engine"
- # def push(path, site_url, email, password)
- # Locomotive::Builder.push(path, site_url, email, password)
- # end
end
end
locomotive/builder/generators/site/base.rb b/lib/locomotive/builder/generators/site/base.rb +30 -0
@@ @@ -0,0 +1,30 @@
+ require 'thor/group'
+ require 'active_support'
+ require 'active_support/core_ext'
+
+ module Locomotive
+ module Builder
+ module Generators
+ module Site
+
+ class Base < Thor::Group
+
+ include Thor::Actions
+
+ argument :name
+ argument :target_path
+
+ def self.source_root
+ File.join(File.dirname(__FILE__), '..', '..', '..', '..', '..', 'generators', self.name.demodulize.underscore)
+ end
+
+ def destination
+ File.join(target_path, name)
+ end
+
+ end
+
+ end
+ end
+ end
+ end
\ No newline at end of file
locomotive/builder/generators/site/blank.rb b/lib/locomotive/builder/generators/site/blank.rb +22 -0
@@ @@ -0,0 +1,22 @@
+ module Locomotive
+ module Builder
+ module Generators
+ module Site
+
+ class Blank < Base
+
+ def copy_sources
+ directory('.', self.destination, { recursive: true }, {
+ name: self.name
+ })
+ end
+
+ end
+
+ Locomotive::Builder::Generators::Site.register(:blank, Blank, %{
+ A blank LocomotiveCMS site with the minimal files.
+ })
+ end
+ end
+ end
+ end
\ No newline at end of file
locomotive/builder/generators/site/bootstrap.rb b/lib/locomotive/builder/generators/site/bootstrap.rb +34 -0
@@ @@ -0,0 +1,34 @@
+ module Locomotive
+ module Builder
+ module Generators
+ module Site
+
+ class Bootstrap < Base
+
+ def copy_sources
+ directory('.', self.destination, { recursive: true }, {
+ name: self.name
+ })
+ end
+
+ def choose_haml_over_html
+ if yes?('Do you prefer HAML templates ?')
+ remove_file File.join(self.destination, 'app/views/pages/index.liquid')
+ remove_file File.join(self.destination, 'app/views/pages/404.liquid')
+ remove_file File.join(self.destination, 'app/views/snippets/footer.liquid')
+ else
+ remove_file File.join(self.destination, 'app/views/pages/index.liquid.haml')
+ remove_file File.join(self.destination, 'app/views/pages/404.liquid.haml')
+ remove_file File.join(self.destination, 'app/views/snippets/footer.liquid.haml')
+ end
+ end
+
+ end
+
+ Locomotive::Builder::Generators::Site.register(:bootstrap, Bootstrap, %{
+ A LocomotiveCMS site powered by Twitter boostrap.
+ })
+ end
+ end
+ end
+ end
\ No newline at end of file