mirror of
https://github.com/moparisthebest/android.moparisthebest.org
synced 2024-10-31 23:35:00 -04:00
Learned a lot, with create structured nicely.
This commit is contained in:
parent
dc99730a8b
commit
94456bec3f
@ -1,3 +1,50 @@
|
||||
octopress create
|
||||
|
||||
|
||||
-------------------------------
|
||||
*********************************************************************
|
||||
Congratulations! Your compass project has been created.
|
||||
|
||||
You may now add and edit sass stylesheets in the sass subdirectory of your project.
|
||||
|
||||
Sass files beginning with an underscore are called partials and won't be
|
||||
compiled to CSS, but they can be imported into other sass stylesheets.
|
||||
|
||||
You can configure your project by editing the config.rb configuration file.
|
||||
|
||||
You must compile your sass stylesheets into CSS when they change.
|
||||
This can be done in one of the following ways:
|
||||
1. To compile on demand:
|
||||
compass compile [path/to/project]
|
||||
2. To monitor your project for changes and automatically recompile:
|
||||
compass watch [path/to/project]
|
||||
|
||||
More Resources:
|
||||
* Website: http://compass-style.org/
|
||||
* Sass: http://sass-lang.com
|
||||
* Community: http://groups.google.com/group/compass-users/
|
||||
|
||||
|
||||
To import your new stylesheets add the following lines of HTML (or equivalent) to your webpage:
|
||||
<head>
|
||||
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css" />
|
||||
<link href="/stylesheets/print.css" media="print" rel="stylesheet" type="text/css" />
|
||||
<!--[if IE]>
|
||||
<link href="/stylesheets/ie.css" media="screen, projection" rel="stylesheet" type="text/css" />
|
||||
<![endif]-->
|
||||
</head>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
octopress --global-option command -d myblog
|
||||
|
||||
octopress --path /my/blog post --option new "Hello"
|
||||
|
@ -3,7 +3,7 @@
|
||||
$: << File.expand_path(File.dirname(File.realpath(__FILE__)) + '/../lib')
|
||||
require 'rubygems'
|
||||
require 'gli'
|
||||
require 'octopress_version'
|
||||
require 'octopress'
|
||||
|
||||
include GLI
|
||||
|
||||
@ -29,11 +29,7 @@ command :create do |c|
|
||||
c.default_value 'default'
|
||||
c.flag :f
|
||||
c.action do |global_options,options,args|
|
||||
puts "Hello!"
|
||||
# Your command logic here
|
||||
|
||||
# If you have any errors, just raise them
|
||||
# raise "that command made no sense"
|
||||
Octopress::Commands::Create.new(args[0] || '.').execute
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,5 +1,17 @@
|
||||
Feature: Create a new Octopress Blog
|
||||
Feature: create subcommand
|
||||
|
||||
Scenario: create with no flags, switches or arguments
|
||||
In order to make blogs for hackers
|
||||
As a hacker using the octopress executable
|
||||
I want to generate a blog from a template
|
||||
|
||||
Scenario: No flags, switches or arguments
|
||||
When I successfully run `octopress create`
|
||||
Then the stdout should contain "Hello!"
|
||||
Then the octopress blog files should exist
|
||||
|
||||
Scenario: Path argument provided
|
||||
When I successfully run `octopress create pathto/myblog`
|
||||
Then a directory named "pathto/myblog" should exist
|
||||
When I cd to "pathto/myblog"
|
||||
Then the octopress blog files should exist
|
||||
|
||||
Scenario: directory exists
|
||||
|
7
octopress/features/step_definitions/octopress_steps.rb
Normal file
7
octopress/features/step_definitions/octopress_steps.rb
Normal file
@ -0,0 +1,7 @@
|
||||
Then /the octopress blog files should exist/ do
|
||||
check_file_presence(%w(
|
||||
.rvmrc
|
||||
.rbenv-version
|
||||
Gemfile
|
||||
), true)
|
||||
end
|
8
octopress/lib/octopress.rb
Normal file
8
octopress/lib/octopress.rb
Normal file
@ -0,0 +1,8 @@
|
||||
module Octopress
|
||||
def Octopress.template_root
|
||||
File.join File.expand_path(File.dirname(__FILE__)), 'octopress', 'template'
|
||||
end
|
||||
end
|
||||
|
||||
require 'octopress/version'
|
||||
require 'octopress/commands'
|
4
octopress/lib/octopress/commands.rb
Normal file
4
octopress/lib/octopress/commands.rb
Normal file
@ -0,0 +1,4 @@
|
||||
module Octopress::Commands
|
||||
end
|
||||
|
||||
require 'octopress/commands/create'
|
19
octopress/lib/octopress/commands/create.rb
Normal file
19
octopress/lib/octopress/commands/create.rb
Normal file
@ -0,0 +1,19 @@
|
||||
class Octopress::Commands::Create
|
||||
include FileUtils
|
||||
|
||||
def initialize(project_path)
|
||||
@project_root = File.expand_path project_path
|
||||
@template_root = Octopress.template_root
|
||||
puts @template_root
|
||||
end
|
||||
|
||||
def execute
|
||||
mkdir_p @project_root
|
||||
Dir.glob(File.join(@template_root, '*'), File::FNM_DOTMATCH).each do |template_path|
|
||||
basename = File.basename template_path
|
||||
next if %w(. ..).include?(basename)
|
||||
puts "File: #{basename}"
|
||||
cp template_path, @project_root
|
||||
end
|
||||
end
|
||||
end
|
1
octopress/lib/octopress/template/.rbenv-version
Normal file
1
octopress/lib/octopress/template/.rbenv-version
Normal file
@ -0,0 +1 @@
|
||||
1.9.2-p290
|
1
octopress/lib/octopress/template/.rvmrc
Normal file
1
octopress/lib/octopress/template/.rvmrc
Normal file
@ -0,0 +1 @@
|
||||
rvm use 1.9.2
|
2
octopress/lib/octopress/template/Gemfile
Normal file
2
octopress/lib/octopress/template/Gemfile
Normal file
@ -0,0 +1,2 @@
|
||||
source 'http://rubygems.org'
|
||||
gem 'compass'
|
@ -1,5 +1,5 @@
|
||||
# Ensure we require the local version and not one we might have installed already
|
||||
require File.join([File.dirname(__FILE__),'lib','octopress_version.rb'])
|
||||
require File.join([File.dirname(__FILE__),'lib','octopress','version.rb'])
|
||||
spec = Gem::Specification.new do |s|
|
||||
s.name = 'octopress'
|
||||
s.version = Octopress::VERSION
|
||||
|
Loading…
Reference in New Issue
Block a user