wp-fire 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/bin/wp_fire ADDED
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'pathname'
4
+ require 'rubygems'
5
+
6
+ file_path = Pathname.new(__FILE__).realpath
7
+
8
+ require File.join(File.dirname(File.dirname(file_path)), 'wp_fire.rb')
9
+ libdir = File.join(File.dirname(File.dirname(file_path)), "lib")
10
+ $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
11
+
12
+ begin
13
+ WpFire::MainCommand.run
14
+ rescue Exception => e
15
+ puts e.message
16
+ if $DEBUG
17
+ puts $!
18
+ puts $@
19
+ end
20
+ end
@@ -0,0 +1,3 @@
1
+ # JavaScript compression
2
+ # config[:compress_js] = false
3
+
@@ -0,0 +1,34 @@
1
+ <?php
2
+
3
+ add_action( 'wp_enqueue_scripts', '<%= theme_id %>_enqueue_scripts' );
4
+
5
+ if ( ! function_exists( '<%= theme_id %>_enqueue_scripts' ) ) :
6
+
7
+ /**
8
+ * Add theme styles and scripts here
9
+ */
10
+ function <%= theme_id %>_enqueue_scripts() {
11
+
12
+ if ( ! is_admin() ) {
13
+ wp_enqueue_style(
14
+ '<%= theme_id %>-style',
15
+ get_bloginfo( 'stylesheet_url' )
16
+ );
17
+ }
18
+
19
+ }
20
+
21
+ endif; // <%= theme_id %>_enqueue_scripts
22
+
23
+ add_action( 'after_setup_theme', '<%= theme_id %>_setup' );
24
+
25
+ if ( ! function_exists( '<%= theme_id %>_setup' ) ) :
26
+
27
+ /**
28
+ * Set up your theme here
29
+ */
30
+ function <%= theme_id %>_setup() {
31
+ add_theme_support( 'post-thumbnails' );
32
+ }
33
+
34
+ endif; // <%= theme_id %>_setup
@@ -0,0 +1 @@
1
+ # Regular theme CoffeeScript goes here
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Theme Name: <%= @configuration[:name] %>
3
+ * Theme URI: <%= @configuration[:uri] %>
4
+ * Author: <%= @configuration[:author] %>
5
+ * Author URI: <%= @configuration[:author_uri] %>
6
+ * Description: <%= @configuration[:description] if @configuration[:description] %>
7
+ * Version: <%= @configuration[:version_number] if @configuration[:version_number] %>
8
+ <% if @configuration[:template] -%>
9
+ * Template: <%= @configuration[:template] %>
10
+ <% end -%>
11
+ * License: <%= @configuration[:license_name] if @configuration[:license_name] %>
12
+ * License URI: <%= @configuration[:license_uri] if @configuration[:license_uri] %>
13
+ * Tags: <%= @configuration[:tags].join(", ") if @configuration[:tags] %>
14
+ <%- unless @configuration[:comments].nil? || @configuration[:comments].empty? -%>
15
+ *
16
+ * <%= @configuration[:comments] %>
17
+ <%- end -%>
18
+ */
@@ -0,0 +1,88 @@
1
+ /* Global Styles */
2
+ /* reset.css */
3
+ html {margin:0;padding:0;border:0;}
4
+ html, body { height: 100%; min-height: 100%; margin: 0; padding: 0; }
5
+ body, div, span, object, iframe, blockquote, pre, a, abbr, acronym, address, code, del, dfn, em, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, dialog, figure, footer, header, hgroup, nav, section {margin:0;padding:0;border:0;font-weight:inherit;font-style:inherit;vertical-align:baseline;}
6
+ body { font-size: 10px; line-height: 1.2 }
7
+ table {border-collapse:separate;border-spacing:0;}
8
+ table, th, td {vertical-align:middle;}
9
+ a img {border:none;}
10
+ :focus {outline:0;}
11
+
12
+ strong, b {font-weight: bold;}
13
+ em, i {font-style: italic;}
14
+
15
+ /* Trick the WordPress Theme Bot *Evil* */
16
+ .aligncenter { display: block; margin: 0 auto; }
17
+ .alignright { float: right; margin: 0 0 1em 1em; }
18
+ .alignleft { float: left; margin: 0 1em 1em 0; }
19
+ .floatleft { float: left; }
20
+ .floatright { float: right; }
21
+ img.aligncenter, img.alignright, img.alignleft { border: 1px solid #DDD; text-align: center; background: #F3F3F3; padding: 4px; }
22
+
23
+ .textcenter { text-align: center; }
24
+ .textright { text-align: right; }
25
+ .textleft { text-align: left; }
26
+ .textjustify { text-align: justify; }
27
+
28
+ .clear-left { clear: left}
29
+ .clear-right { clear: left}
30
+ .clear { clear: both; display: block;}
31
+ .clearfix { display: inline-block; }
32
+
33
+ .relative { position: relative; }
34
+ .absolute { position: absolute; }
35
+
36
+ p { padding: 0; }
37
+ input[type=text], input[type=password], textarea { background: url(../images/form.jpg) repeat-x top #FFF; border: 1px solid #CCC; padding: 3px; }
38
+
39
+ .text-overflow{
40
+ white-space: nowrap;
41
+ width: 100%;
42
+ overflow: hidden;
43
+ position: relative;
44
+ /*-o-text-overflow: ellipsis;
45
+ text-overflow: ellipsis; */
46
+ }
47
+
48
+
49
+ /* Hyperlinks */
50
+ a img { border: none; }
51
+ a:focus, a:hover, a:active { outline: none; }
52
+
53
+ /* Headings */
54
+ h2, h3, h4, h5, h6 { margin: 1em 0; }
55
+ h2 { font-size: 2em; }
56
+ h3 { font-size: 1.8em; }
57
+ h4 { font-size: 1.6em; }
58
+ h5 { font-size: 1.4em; }
59
+ h6 { font-size: 1.2em; }
60
+
61
+ /* Tables */
62
+ table { border-collapse: collapse; border-spacing: 0; }
63
+ th, td { padding: 5px; }
64
+
65
+ /* Structure */
66
+ #wrapper { min-height: 100%; position: relative; padding: 0 0 20px 0; }
67
+ #main { padding: 10px 15px 0; width:958px; margin:0 auto; position:relative; }
68
+ #nav { width:960px; margin:0 auto; position:relative; z-index: 50; }
69
+ #container { overflow: hidden}
70
+
71
+ /* Footer */
72
+ #footer { margin: 0 auto; width: 988px; padding: 20px 0 10px 0;}
73
+ #footer .footer-message { margin: 0; padding: 10px 15px 0; }
74
+ #wpstats {display: none;}
75
+
76
+ /* Background per iPad */
77
+ body {
78
+ -webkit-background-size: 1920px 1080px;
79
+ }
80
+ .underline {
81
+ text-decoration: underline;
82
+ }
83
+ .capitalize {
84
+ text-transform: capitalize;
85
+ }
86
+ .uppercase {
87
+ text-transform: uppercase;
88
+ }
@@ -0,0 +1,6 @@
1
+ @import "header";
2
+ <% if @configuration[:template] -%>
3
+ @import url('../<%= @configuration[:template] %>/style.css');
4
+ <% else -%>
5
+ @import "reset";
6
+ <% end -%>
@@ -0,0 +1,10 @@
1
+ <?php get_header(); ?>
2
+ <h1 class="page-title">
3
+ <?php _e( '404: Page Not Found', '<%= theme_id %>' ); ?>
4
+ </h1>
5
+ <div>
6
+ <p><?php _e( 'We are terribly sorry, but the URL you typed no longer exists. It might have been moved or deleted. Try searching the site:', '<%= theme_id %>' ); ?></p>
7
+ <?php get_search_form(); ?>
8
+ </div>
9
+ <?php get_sidebar(); ?>
10
+ <?php get_footer(); ?>
@@ -0,0 +1,11 @@
1
+ <?php get_header(); ?>
2
+ <div id="content" class="clear">
3
+ <?php if ( have_posts() ) : ?>
4
+ <h1 class="small-header"><?php _e( 'Blog Archives', '<%= theme_id %>' ); ?></h1>
5
+ <?php get_template_part( 'loop' ); ?>
6
+ <?php else : ?>
7
+ <p><?php _e( 'No posts found.', '<%= theme_id %>' ); ?></p>
8
+ <?php endif; ?>
9
+ </div><!--end content-->
10
+ <?php get_sidebar(); ?>
11
+ <?php get_footer(); ?>
@@ -0,0 +1,32 @@
1
+ <?php get_header(); ?>
2
+ <?php the_post(); ?>
3
+ <h1 class="page-title"><?php the_title(); ?></h1>
4
+ <div>
5
+ <a href="<?php echo wp_get_attachment_url( $post->ID ); ?>" title="<?php the_title_attribute(); ?>" rel="attachment">
6
+ <?php
7
+ if ( wp_attachment_is_image ( $post->ID ) ) {
8
+ $img_src = wp_get_attachment_image_src( $post->ID, 'large' );
9
+ $alt_text = get_post_meta( $post->ID, '_wp_attachment_image_alt', true );
10
+ ?>
11
+ <img src="<?php echo esc_url( $img_src[0] ); ?>" alt="<?php esc_attr_e( $alt_text ); ?>">
12
+ <?php
13
+ } else {
14
+ echo basename( $post->guid );
15
+ }
16
+ ?>
17
+ </a>
18
+ <?php if ( $post->post_content ) : ?>
19
+ <div class="description">
20
+ <?php the_content(); ?>
21
+ </div>
22
+ <?php endif; ?>
23
+ <div class="pagination clear">
24
+ <div class="alignleft"><?php previous_image_link( 0, __( '&larr; Previous image', '<%= theme_id %>' ) ); ?></div>
25
+ <div class="alignright"><?php next_image_link( 0, __( 'Next image &rarr;', '<%= theme_id %>' ) ); ?></div>
26
+ </div>
27
+ <div>
28
+ <a href="<?php echo get_permalink( $post->post_parent ); ?>"><?php _e( 'Return to gallery', '<%= theme_id %>' ); ?></a>
29
+ </div>
30
+ </div>
31
+ <?php get_sidebar(); ?>
32
+ <?php get_footer(); ?>
@@ -0,0 +1,2 @@
1
+ <?php
2
+ // Default comments file goes here
@@ -0,0 +1,9 @@
1
+ <div id="footer">
2
+ <p>
3
+ <a href="http://wordpress.org/" rel="generator">Proudly powered by WordPress</a>
4
+ </p>
5
+ </div><!--end footer-->
6
+ </div><!--end container-->
7
+ <?php wp_footer(); ?>
8
+ </body>
9
+ </html>
@@ -0,0 +1,29 @@
1
+ <!DOCTYPE html>
2
+ <html <?php language_attributes( 'html' ) ?>>
3
+ <head>
4
+ <meta charset="<?php bloginfo( 'charset' ); ?>" />
5
+ <title><?php wp_title(); ?></title>
6
+
7
+ <!-- WordPress -->
8
+ <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
9
+ <?php wp_head(); ?>
10
+ </head>
11
+ <body <?php body_class(); ?>>
12
+ <div id="header" class="clear">
13
+ <div id="title">
14
+ <?php if ( is_front_page() ) echo( '<h1>' ); ?>
15
+ <a href="<?php echo home_url(); ?>"><?php bloginfo( 'name' ); ?></a>
16
+ <?php if ( is_front_page() ) echo( '</h1>' ); ?>
17
+ </div>
18
+ <?php
19
+ wp_nav_menu(
20
+ array(
21
+ 'theme_location' => 'nav-1',
22
+ 'container_id' => 'navigation',
23
+ 'container_class' => 'clear',
24
+ 'menu_class' => 'nav',
25
+ 'depth' => '2'
26
+ )
27
+ );
28
+ ?>
29
+ </div><!--end header-->
@@ -0,0 +1,4 @@
1
+ <?php get_header(); ?>
2
+ <?php get_template_part( 'loop' ); ?>
3
+ <?php get_sidebar(); ?>
4
+ <?php get_footer(); ?>
@@ -0,0 +1,36 @@
1
+ <?php if ( have_posts() ) : ?>
2
+ <?php while ( have_posts() ) : the_post(); ?>
3
+ <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
4
+ <div class="post-header">
5
+ <h2 class="post-title">
6
+ <a href="<?php the_permalink(); ?>" rel="bookmark">
7
+ <?php the_title(); ?>
8
+ </a>
9
+ </h2>
10
+ <p><?php the_time( __( 'F jS, Y', '<%= theme_id %>' ) ); ?></p>
11
+ <p><?php the_author(); ?></p>
12
+ <?php if ( has_post_thumbnail() ) { ?>
13
+ <a href="<?php the_permalink(); ?>">
14
+ <?php the_post_thumbnail(); ?>
15
+ </a>
16
+ <?php } ?>
17
+ </div><!--end post-header-->
18
+ <div class="entry">
19
+ <?php the_content( __( 'Read more', '<%= theme_id %>' )); ?>
20
+ <?php edit_post_link( __( 'Edit this', '<%= theme_id %>' ), '<p>', '</p>' ); ?>
21
+ </div><!--end entry-->
22
+ <div class="post-footer">
23
+ <p><?php comments_popup_link( __( 'Leave a comment', '<%= theme_id %>' ), __( '1 Comment', '<%= theme_id %>' ), __( '% Comments', '<%= theme_id %>' ) ); ?></p>
24
+ </div><!--end post-footer-->
25
+ </div><!--end post-->
26
+ <?php endwhile; /* rewind or continue if all posts have been fetched */ ?>
27
+ <div class="pagination index">
28
+ <div class="alignleft">
29
+ <?php previous_posts_link( __( '&larr; Newer entries', '<%= theme_id %>' )); ?>
30
+ </div>
31
+ <div class="alignright">
32
+ <?php next_posts_link( __( 'Older entries &rarr;', '<%= theme_id %>' )); ?>
33
+ </div>
34
+ </div><!--end pagination-->
35
+ <?php else : ?>
36
+ <?php endif; ?>
@@ -0,0 +1,14 @@
1
+ <?php get_header(); ?>
2
+ <?php the_post(); ?>
3
+ <div id="page-<?php the_ID(); ?>">
4
+ <?php if ( has_post_thumbnail() ) { ?>
5
+ <div>
6
+ <?php the_post_thumbnail(); ?>
7
+ </div>
8
+ <?php } ?>
9
+ <h1><?php the_title(); ?></h1>
10
+ <?php the_content(); ?>
11
+ </div>
12
+ <?php comments_template( '', true ); ?>
13
+ <?php get_sidebar(); ?>
14
+ <?php get_footer(); ?>
@@ -0,0 +1,12 @@
1
+ <?php get_header(); ?>
2
+ <h1><?php printf( __( "Search results for '%s'", "<%= theme_id %>" ), get_search_query() ); ?></h1>
3
+ <?php if ( have_posts() ) : ?>
4
+ <?php get_template_part( 'loop' ); ?>
5
+ <?php else : ?>
6
+ <div>
7
+ <p><?php printf( __( 'Sorry, your search for "%s" did not turn up any results. Please try again.', '<%= theme_id %>' ), get_search_query());?></p>
8
+ <?php get_search_form(); ?>
9
+ </div>
10
+ <?php endif; ?>
11
+ <?php get_sidebar(); ?>
12
+ <?php get_footer(); ?>
@@ -0,0 +1,9 @@
1
+ <div id="sidebar">
2
+ <ul>
3
+ <?php
4
+ if ( ! dynamic_sidebar( 'sidebar' ) ) {
5
+ the_widget( 'WP_Widget_Recent_Posts', array( 'number' => 5 ), array( 'widget_id' => NULL ) );
6
+ }
7
+ ?>
8
+ </ul>
9
+ </div><!--end sidebar-->
@@ -0,0 +1,30 @@
1
+ <?php get_header(); ?>
2
+ <?php if ( have_posts() ) : ?>
3
+ <?php while ( have_posts() ) : the_post(); ?>
4
+ <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
5
+ <h1><?php the_title(); ?></h1>
6
+ <div>
7
+ <?php printf( __( 'by %s on', '<%= theme_id %>' ), get_the_author() ); ?> <?php the_date(); ?>
8
+ </div>
9
+ <div class="entry">
10
+ <?php if ( has_post_thumbnail() ) {
11
+ the_post_thumbnail();
12
+ } ?>
13
+ <?php the_content(); ?>
14
+ <?php edit_post_link( __( 'Edit this', '<%= theme_id %>' ), '<p>', '</p>' ); ?>
15
+ <?php wp_link_pages(); ?>
16
+ </div><!--end entry-->
17
+ <div class="post-footer clear">
18
+ <div class="tags">
19
+ <?php the_tags( __( 'Tags: ', '<%= theme_id %>' ), ', ', '' ); ?>
20
+ </div>
21
+ <div class="cats">
22
+ <?php printf( __( 'From: %s', '<%= theme_id %>' ), get_the_category_list( ', ' ) ); ?>
23
+ </div>
24
+ </div><!--end post footer-->
25
+ </div><!--end post-->
26
+ <?php endwhile; /* rewind or continue if all posts have been fetched */ ?>
27
+ <?php comments_template( '', true ); ?>
28
+ <?php endif; ?>
29
+ <?php get_sidebar(); ?>
30
+ <?php get_footer(); ?>
@@ -0,0 +1,46 @@
1
+ require 'coffee-script'
2
+ require 'sass'
3
+
4
+ module WpFire
5
+ class Compiler
6
+
7
+ def self.compile(filename, build_path)
8
+ extname = File.extname(filename)
9
+ basename = File.basename(filename, extname)
10
+ if not basename[0].eql?"_" and extname.eql?".scss"
11
+ sass_engine = Sass::Engine.for_file filename, {}
12
+ File.open File.join(build_path, basename), "w" do |f|
13
+ f.puts sass_engine.to_css
14
+ end
15
+ elsif extname.eql?".coffee"
16
+ File.open File.join(build_path, basename), "w" do |f|
17
+ f.puts CoffeeScript.compile File.read(filename)
18
+ end
19
+ elsif extname.eql?".php"
20
+ FileUtils.cp filename, File.join(build_path, File.basename(filename))
21
+ end
22
+ end
23
+
24
+ def self.compile_all(filenames, build_path)
25
+ files = []
26
+ filenames.each do |filename|
27
+ if(File.directory?(filename))
28
+ files = files + find(filename)
29
+ end
30
+ if(File.file?(filename))
31
+ files << filename
32
+ end
33
+ end
34
+ files.each do |f|
35
+ compile f, build_path
36
+ end
37
+ end
38
+
39
+ private
40
+
41
+ def self.find(dir, filename="*.*", subdirs=true)
42
+ Dir[ subdirs ? File.join(dir.split(/\\/), "**", filename) : File.join(dir.split(/\\/), filename) ]
43
+ end
44
+
45
+ end
46
+ end
@@ -0,0 +1,119 @@
1
+ module WpFire
2
+ class Generator
3
+
4
+ def initialize(project_name, task, configuration)
5
+ @project_name = project_name
6
+ @task = task
7
+ @configuration = configuration
8
+
9
+ @source_path = File.join(project_name,"source")
10
+ @config_file = File.join(project_name,"config.rb")
11
+ @assets_path = File.join(project_name,"source","assets")
12
+ end
13
+
14
+ def create_structure
15
+ source_paths = [
16
+ ['assets', 'images'],
17
+ ['assets', 'javascripts'],
18
+ ['assets', 'stylesheets'],
19
+ ['functions'],
20
+ ['templates']
21
+ ]
22
+
23
+ source_paths.each do |path|
24
+ @task.empty_directory File.join(@source_path, path)
25
+ end
26
+
27
+ self
28
+ end
29
+
30
+ def layout_path
31
+ @layout_path ||= File.join(WpFire::ROOT, 'generators', 'wp_fire')
32
+ end
33
+
34
+ def write_config
35
+ write_template(['generators', 'wp_fire', 'config', 'config.tt'], @config_file)
36
+ self
37
+ end
38
+
39
+ def copy_javascript
40
+ source = File.expand_path(File.join(self.layout_path, 'javascripts'))
41
+ target = File.expand_path(File.join(@assets_path, 'javascripts'))
42
+
43
+ render_directory(source, target)
44
+
45
+ self
46
+ end
47
+
48
+ def copy_stylesheets
49
+ source = File.expand_path(File.join(self.layout_path, 'stylesheets'))
50
+ target = File.expand_path(File.join(@assets_path, 'stylesheets'))
51
+
52
+ render_directory(source, target)
53
+
54
+ self
55
+ end
56
+
57
+ def copy_templates
58
+ if @configuration[:template].nil? or !File.directory?(File.join(@configuration[:template_path],@configuration[:template],"children_files"))
59
+ source = File.expand_path(File.join(self.layout_path, 'templates'))
60
+ else
61
+ source = File.expand_path(File.join(@configuration[:template_path],@configuration[:template],"children_files"))
62
+ end
63
+ target = File.expand_path(File.join(@source_path, 'templates'))
64
+
65
+ render_directory(source, target)
66
+
67
+ self
68
+ end
69
+
70
+ def copy_functions
71
+ source = File.expand_path(File.join(self.layout_path, 'functions', 'functions.php.erb'))
72
+ target = File.expand_path(File.join(@source_path, 'functions', 'functions.php'))
73
+
74
+ write_template(source, target)
75
+ end
76
+
77
+ def write_template(source, target)
78
+ source = File.join(source)
79
+ template = File.expand_path(@task.find_in_source_paths((source)))
80
+ target = File.expand_path(File.join(target))
81
+
82
+ @task.create_file target do
83
+ parse_erb(template)
84
+ end
85
+ end
86
+
87
+ def theme_id
88
+ @project_name
89
+ end
90
+
91
+ private
92
+
93
+ def parse_erb(file)
94
+ ERB.new(::File.binread(file), nil, '-', '@output_buffer').result(binding)
95
+ end
96
+
97
+ def render_directory(source, target)
98
+ Dir.glob("#{source}/**/*") do |file|
99
+ unless File.directory?(file)
100
+ source_file = file.gsub(source, '')
101
+ target_file = File.join(target, source_file)
102
+
103
+ if source_file.end_with? ".erb"
104
+ target_file = target_file.slice(0..-5)
105
+
106
+ content = parse_erb(file)
107
+ else
108
+ content = File.open(file).read
109
+ end
110
+
111
+ @task.create_file target_file do
112
+ content
113
+ end
114
+ end
115
+ end
116
+ end
117
+
118
+ end
119
+ end
@@ -0,0 +1,120 @@
1
+ require 'rubygems'
2
+ require 'clamp'
3
+ require 'thor'
4
+ require 'filewatcher'
5
+ require 'fileutils'
6
+
7
+ class ThorUtils < Thor
8
+ include Thor::Actions
9
+
10
+ def self.source_root
11
+ WpFire::ROOT
12
+ end
13
+ end
14
+
15
+ module WpFire
16
+
17
+ class BuildCommand < Clamp::Command
18
+
19
+ parameter "DIR", "The theme root path"
20
+
21
+ def execute
22
+ @assets_path = File.join(dir,"source","assets")
23
+ @templates_path = File.join(dir,"source","templates")
24
+ @functions_path = File.join(dir,"source","functions")
25
+
26
+ @build_path = File.join(dir,"build")
27
+ FileUtils.rm_rf(@build_path) if File.directory?(@build_path)
28
+ Dir.mkdir @build_path
29
+ Dir[File.join(dir.split(/\\/), "*.*")].each do |f|
30
+ File.unlink f unless File.basename(f).eql? "config.rb"
31
+ end
32
+ watch_directories = [@assets_path,@templates_path,@functions_path]
33
+ WpFire::Compiler.compile_all watch_directories, @build_path
34
+ end
35
+
36
+ end
37
+
38
+ class WatchCommand < Clamp::Command
39
+
40
+ parameter "DIR", "The theme root path"
41
+ option ["-p","--build-path"], "BUILD_PATH", "Build path. The default is the theme root path", :default => nil
42
+
43
+ def execute
44
+ @assets_path = File.join(dir,"source","assets")
45
+ @templates_path = File.join(dir,"source","templates")
46
+ @functions_path = File.join(dir,"source","functions")
47
+
48
+ if build_path and File.directory?(build_path)
49
+ @build_path = build_path
50
+ else
51
+ @build_path = dir
52
+ end
53
+
54
+ Dir[File.join(dir.split(/\\/), "*.*")].each do |f|
55
+ File.unlink f unless File.basename(f).eql? "config.rb"
56
+ end
57
+ watch_directories = [@assets_path,@templates_path,@functions_path]
58
+ WpFire::Compiler.compile_all watch_directories, @build_path
59
+
60
+ FileWatcher.new(watch_directories,"Watching files:").watch do |filename|
61
+ WpFire::Compiler.compile filename, @build_path
62
+ end
63
+ end
64
+
65
+ end
66
+
67
+ class CreateCommand < Clamp::Command
68
+
69
+ parameter "NAME", "Theme Name"
70
+ option ["-t","--template"], "TEMPLATE", "Template for new theme", :default => nil
71
+ option ["--template-path"], "TEMPLATE_PATH", "Template theme path", :default => nil
72
+ option "--theme-uri", "THEME_URI", "Theme URI", :default => "http://www.dsmart.it"
73
+ option ["-a", "--author"], "AUTHOR", "Theme author", :default => "dSmart s.r.l."
74
+ option "--author-uri", "AUTHOR_URI", "Author URI", :default => "http://www.dsmart.it"
75
+ option ["-d", "--description"], "DESCRIPTION", "Theme description", :default => nil
76
+ option ["-v", "--version"], "VERSION", "Theme version", :default => "0.0.1"
77
+ option ["-l", "--license"], "LICENSE", "License name", :default => "Copyright #{Time.now.year} dSmart s.r.l."
78
+
79
+ def execute
80
+ if template and !template.eql?""
81
+ raise ArgumentError, "Error! --template-path is required because you have specified --template" if template_path.nil?
82
+ end
83
+ if template_path and !File.directory? template_path
84
+ raise ArgumentError, "Error! template-path not found."
85
+ end
86
+ name = @name.gsub(/\W/, '_')
87
+
88
+ thor_actions = ThorUtils.new
89
+ generator = WpFire::Generator.new(name, thor_actions, generate_config)
90
+ generator.create_structure
91
+ generator.write_config
92
+ generator.copy_javascript
93
+ generator.copy_stylesheets
94
+ generator.copy_functions
95
+ generator.copy_templates
96
+ end
97
+
98
+ private
99
+
100
+ def generate_config
101
+ config = {}
102
+ config[:name] = "#{name}"
103
+ config[:uri] = "#{theme_uri}"
104
+ config[:author] = "#{author}"
105
+ config[:author_uri] = "#{author_uri}"
106
+ config[:description] = "#{description}"
107
+ config[:version_number] = "#{version}"
108
+ config[:template] = "#{template}" if template
109
+ config[:template_path] = "#{template_path}" if template_path
110
+ config[:license_name] = "#{license}"
111
+ config
112
+ end
113
+ end
114
+
115
+ class MainCommand < Clamp::Command
116
+ subcommand "create", "Create new WordpressTheme", CreateCommand
117
+ subcommand "watch", "Watch for change in assets", WatchCommand
118
+ subcommand "build", "Build theme", BuildCommand
119
+ end
120
+ end
data/wp_fire.rb ADDED
@@ -0,0 +1,6 @@
1
+ module WpFire
2
+ ROOT = File.expand_path(File.join(File.dirname(__FILE__)))
3
+ autoload :Generator, 'wp_fire/generator'
4
+ autoload :Compiler, 'wp_fire/compiler'
5
+ autoload :MainCommand, 'wp_fire/main_command'
6
+ end
metadata ADDED
@@ -0,0 +1,148 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wp-fire
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Massimo Maino
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-12-01 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: clamp
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: thor
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: filewatcher
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: sass
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: coffee-script
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ description:
95
+ email: maintux@gmail.com
96
+ executables:
97
+ - wp_fire
98
+ extensions: []
99
+ extra_rdoc_files: []
100
+ files:
101
+ - wp_fire.rb
102
+ - lib/wp_fire/generator.rb
103
+ - lib/wp_fire/compiler.rb
104
+ - lib/wp_fire/main_command.rb
105
+ - bin/wp_fire
106
+ - generators/wp_fire/functions/functions.php.erb
107
+ - generators/wp_fire/javascripts/theme.js.coffee
108
+ - generators/wp_fire/config/config.tt
109
+ - generators/wp_fire/templates/index.php
110
+ - generators/wp_fire/templates/404.php.erb
111
+ - generators/wp_fire/templates/footer.php
112
+ - generators/wp_fire/templates/attachment.php.erb
113
+ - generators/wp_fire/templates/page.php
114
+ - generators/wp_fire/templates/header.php.erb
115
+ - generators/wp_fire/templates/comments.php
116
+ - generators/wp_fire/templates/sidebar.php
117
+ - generators/wp_fire/templates/search.php.erb
118
+ - generators/wp_fire/templates/archive.php.erb
119
+ - generators/wp_fire/templates/loop.php.erb
120
+ - generators/wp_fire/templates/single.php.erb
121
+ - generators/wp_fire/stylesheets/_reset.scss
122
+ - generators/wp_fire/stylesheets/style.css.scss.erb
123
+ - generators/wp_fire/stylesheets/_header.scss.erb
124
+ homepage: https://github.com/maintux/wp-fire
125
+ licenses: []
126
+ post_install_message:
127
+ rdoc_options: []
128
+ require_paths:
129
+ - lib
130
+ required_ruby_version: !ruby/object:Gem::Requirement
131
+ none: false
132
+ requirements:
133
+ - - ! '>='
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ required_rubygems_version: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ requirements: []
143
+ rubyforge_project:
144
+ rubygems_version: 1.8.24
145
+ signing_key:
146
+ specification_version: 3
147
+ summary: Wordpress theme generator with Coffee Script and Sass support
148
+ test_files: []