forge 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/.document +5 -0
  2. data/.gitmodules +3 -0
  3. data/.rspec +1 -0
  4. data/Gemfile +24 -0
  5. data/Gemfile.lock +81 -0
  6. data/LICENSE +20 -0
  7. data/README.md +24 -0
  8. data/Rakefile +53 -0
  9. data/VERSION +1 -0
  10. data/bin/forge +12 -0
  11. data/features/create.feature +34 -0
  12. data/features/link.feature +14 -0
  13. data/features/step_definitions/forge_steps.rb +38 -0
  14. data/features/support/env.rb +17 -0
  15. data/forge.gemspec +135 -0
  16. data/layouts/config/config.json.erb +13 -0
  17. data/layouts/config/stylesheet_header.erb +11 -0
  18. data/layouts/default/functions/functions.php.erb +21 -0
  19. data/layouts/default/stylesheets/_reset.scss +5 -0
  20. data/layouts/default/stylesheets/_typography.scss +5 -0
  21. data/layouts/default/stylesheets/style.css.scss.erb +28 -0
  22. data/layouts/default/templates/404.php.erb +10 -0
  23. data/layouts/default/templates/archive.php.erb +11 -0
  24. data/layouts/default/templates/attachment.php.erb +34 -0
  25. data/layouts/default/templates/comments.php +2 -0
  26. data/layouts/default/templates/footer.php +9 -0
  27. data/layouts/default/templates/header.php.erb +30 -0
  28. data/layouts/default/templates/index.php +6 -0
  29. data/layouts/default/templates/page.php +18 -0
  30. data/layouts/default/templates/partials/loop.php.erb +30 -0
  31. data/layouts/default/templates/search.php.erb +14 -0
  32. data/layouts/default/templates/sidebar.php +9 -0
  33. data/layouts/default/templates/single.php.erb +32 -0
  34. data/layouts/lib/forge-settings/README.md +43 -0
  35. data/layouts/lib/forge-settings/classes/settings.php +11 -0
  36. data/layouts/lib/forge-settings/classes/settings/collection.php +190 -0
  37. data/layouts/lib/forge-settings/classes/settings/option.php +125 -0
  38. data/layouts/lib/forge-settings/classes/settings/option/select.php +30 -0
  39. data/layouts/lib/forge-settings/classes/settings/option/text.php +15 -0
  40. data/layouts/lib/forge-settings/classes/settings/section.php +56 -0
  41. data/lib/forge.rb +11 -0
  42. data/lib/forge/builder.rb +165 -0
  43. data/lib/forge/cli.rb +86 -0
  44. data/lib/forge/config.rb +63 -0
  45. data/lib/forge/error.rb +8 -0
  46. data/lib/forge/generator.rb +128 -0
  47. data/lib/forge/guard.rb +57 -0
  48. data/lib/forge/project.rb +91 -0
  49. data/lib/forge/version.rb +3 -0
  50. data/lib/guard/forge/assets.rb +31 -0
  51. data/lib/guard/forge/config.rb +31 -0
  52. data/lib/guard/forge/functions.rb +31 -0
  53. data/lib/guard/forge/templates.rb +28 -0
  54. data/spec/lib/forge/config_spec.rb +79 -0
  55. data/spec/lib/forge/project_spec.rb +34 -0
  56. data/spec/spec_helper.rb +13 -0
  57. metadata +263 -0
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
@@ -0,0 +1,3 @@
1
+ [submodule "layouts/lib/forge-settings"]
2
+ path = layouts/lib/forge-settings
3
+ url = git@github.com:jestro/forge-settings.git
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,24 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ gem "thor"
7
+ gem "guard"
8
+ gem "sprockets"
9
+ gem "rubyzip"
10
+ gem "json"
11
+ gem "sass"
12
+ gem "sprockets-sass"
13
+ gem "compass"
14
+
15
+ # Add dependencies to develop your gem here.
16
+ # Include everything needed to run rake, tests, features, etc.
17
+ group :development do
18
+ gem "rspec"
19
+ gem "cucumber", ">= 0"
20
+ gem "aruba"
21
+ gem "bundler", "~> 1.0.0"
22
+ gem "jeweler", "~> 1.6.4"
23
+ gem "rcov", ">= 0"
24
+ end
@@ -0,0 +1,81 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ aruba (0.4.6)
5
+ bcat (>= 0.6.1)
6
+ childprocess (>= 0.2.0)
7
+ cucumber (>= 1.0.2)
8
+ rdiscount (>= 1.6.8)
9
+ rspec (>= 2.6.0)
10
+ bcat (0.6.2)
11
+ rack (~> 1.0)
12
+ builder (3.0.0)
13
+ childprocess (0.2.2)
14
+ ffi (~> 1.0.6)
15
+ chunky_png (1.2.5)
16
+ compass (0.11.5)
17
+ chunky_png (~> 1.2)
18
+ fssm (>= 0.2.7)
19
+ sass (~> 3.1)
20
+ cucumber (1.1.0)
21
+ builder (>= 2.1.2)
22
+ diff-lcs (>= 1.1.2)
23
+ gherkin (~> 2.5.0)
24
+ json (>= 1.4.6)
25
+ term-ansicolor (>= 1.0.6)
26
+ diff-lcs (1.1.3)
27
+ ffi (1.0.9)
28
+ fssm (0.2.7)
29
+ gherkin (2.5.1)
30
+ json (>= 1.4.6)
31
+ git (1.2.5)
32
+ guard (0.8.1)
33
+ thor (~> 0.14.6)
34
+ hike (1.2.1)
35
+ jeweler (1.6.4)
36
+ bundler (~> 1.0)
37
+ git (>= 1.2.5)
38
+ rake
39
+ json (1.6.1)
40
+ rack (1.3.3)
41
+ rake (0.9.2)
42
+ rcov (0.9.10)
43
+ rdiscount (1.6.8)
44
+ rspec (2.6.0)
45
+ rspec-core (~> 2.6.0)
46
+ rspec-expectations (~> 2.6.0)
47
+ rspec-mocks (~> 2.6.0)
48
+ rspec-core (2.6.4)
49
+ rspec-expectations (2.6.0)
50
+ diff-lcs (~> 1.1.2)
51
+ rspec-mocks (2.6.0)
52
+ rubyzip (0.9.4)
53
+ sass (3.1.7)
54
+ sprockets (2.0.0)
55
+ hike (~> 1.2)
56
+ rack (~> 1.0)
57
+ tilt (!= 1.3.0, ~> 1.1)
58
+ sprockets-sass (0.2.3)
59
+ sprockets (~> 2.0)
60
+ term-ansicolor (1.0.6)
61
+ thor (0.14.6)
62
+ tilt (1.3.3)
63
+
64
+ PLATFORMS
65
+ ruby
66
+
67
+ DEPENDENCIES
68
+ aruba
69
+ bundler (~> 1.0.0)
70
+ compass
71
+ cucumber
72
+ guard
73
+ jeweler (~> 1.6.4)
74
+ json
75
+ rcov
76
+ rspec
77
+ rubyzip
78
+ sass
79
+ sprockets
80
+ sprockets-sass
81
+ thor
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Jestro LLC
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,24 @@
1
+ ## Forge is a toolkit for bootstrapping and developing WordPress themes.
2
+
3
+ [Forge website and screencast](http://forge.thethemefoundry.com/)
4
+
5
+ [User's manual](http://forge.thethemefoundry.com/manual)
6
+
7
+ -----
8
+
9
+ Current Version: **0.1.0**
10
+
11
+ Install Forge (requires [Ruby](http://www.ruby-lang.org/) and [RubyGems](http://rubygems.org/)):
12
+
13
+ $ gem install forge
14
+
15
+ Create your new theme project:
16
+
17
+ $ forge create themename
18
+
19
+ Watch for changes and start developing!
20
+
21
+ $ cd themename
22
+ $ forge watch
23
+
24
+ See the [user's manual](http://forge.thethemefoundry.com/manual) for more information.
@@ -0,0 +1,53 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "forge"
18
+ gem.homepage = "http://nohomepageyet.org"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{A tool for developing wordpress themes}
21
+ gem.description = %Q{A toolkit for bootstrapping and developing WordPress themes.}
22
+ gem.email = "aadams@jestro.com"
23
+ gem.authors = ["Andy Adams", "Drew Strojny", "Matt Button"]
24
+ # dependencies defined in Gemfile
25
+ gem.files.include Dir.glob('layouts/lib/forge-settings/**/*')
26
+ end
27
+ Jeweler::RubygemsDotOrgTasks.new
28
+
29
+ require 'rspec/core'
30
+ require 'rspec/core/rake_task'
31
+ RSpec::Core::RakeTask.new(:spec) do |spec|
32
+ spec.pattern = FileList['spec/**/*_spec.rb']
33
+ end
34
+
35
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
36
+ spec.pattern = 'spec/**/*_spec.rb'
37
+ spec.rcov = true
38
+ end
39
+
40
+ require 'cucumber/rake/task'
41
+ Cucumber::Rake::Task.new(:features)
42
+
43
+ task :default => :spec
44
+
45
+ require 'rake/rdoctask'
46
+ Rake::RDocTask.new do |rdoc|
47
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
+
49
+ rdoc.rdoc_dir = 'rdoc'
50
+ rdoc.title = "forge #{version}"
51
+ rdoc.rdoc_files.include('README*')
52
+ rdoc.rdoc_files.include('lib/**/*.rb')
53
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'pathname'
4
+ require 'rubygems'
5
+
6
+ file_path = Pathname.new(__FILE__).realpath
7
+ libdir = File.join(File.dirname(File.dirname(file_path)), "lib")
8
+ $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
9
+
10
+ require 'forge'
11
+
12
+ Forge::CLI.start
@@ -0,0 +1,34 @@
1
+ Feature: Initialize a new Forge project
2
+
3
+ Scenario: Creating a brand new project with all arguments
4
+ Given a WordPress installation exists at "wordpress"
5
+ When I successfully run `forge create foo --wp_dir=wordpress --name=foo_theme --uri=http://www.footheme.com --author="Foo Man" --author_uri=http://www.fooman.com`
6
+ Then the forge skeleton should be created in directory "foo"
7
+ And the file "foo/config.json" should contain:
8
+ | "name": "foo_theme" |
9
+ | "uri": "http://www.footheme.com" |
10
+ | "author": "Foo Man" |
11
+ | "author_uri": "http://www.fooman.com" |
12
+
13
+ Scenario: Creating a new project without any arguments
14
+ Given a WordPress installation exists at "wordpress"
15
+ When I run `forge create foo` interactively
16
+ And I type "wordpress"
17
+ Then the forge skeleton should be created in directory "foo"
18
+ And the file "foo/config.json" should contain:
19
+ | "name": "foo" |
20
+
21
+ Scenario: Creating a new project with all prompts
22
+ Given a WordPress installation exists at "wordpress"
23
+ When I run `forge create foo -i` interactively
24
+ And I type "foo_theme"
25
+ And I type "http://www.footheme.com"
26
+ And I type "Foo Man"
27
+ And I type "http://www.fooman.com"
28
+ And I type "wordpress"
29
+ Then the forge skeleton should be created in directory "foo"
30
+ And the file "foo/config.json" should contain:
31
+ | "name": "foo_theme" |
32
+ | "uri": "http://www.footheme.com" |
33
+ | "author": "Foo Man" |
34
+ | "author_uri": "http://www.fooman.com" |
@@ -0,0 +1,14 @@
1
+ Feature: Symbolic link creation via the link command
2
+
3
+ Scenario: Linking a project to a WordPress install
4
+ Given a WordPress installation exists at "wordpress"
5
+ And I am in a forge project named "awesome_theme"
6
+ When I successfully run `forge link ../wordpress`
7
+ Then a directory named "../wordpress/wp-content/themes/awesome_theme" should exist
8
+
9
+ Scenario: Linking a project to a bogus directory
10
+ Given I am in a forge project named "awesome_theme"
11
+ When I run `forge link ../wordpress`
12
+ Then the exit status should be 1
13
+ And the output should contain "Sorry, we couldn't find a wordpress installation"
14
+ And a directory named "../wordpress/wp-content/themes/awesome_theme" should not exist
@@ -0,0 +1,38 @@
1
+ Given /^I am in a forge project named "([^"]*)"$/ do |name|
2
+ cli = Forge::CLI.new
3
+
4
+ cli.shell.mute do
5
+ Forge::Project.create(File.join(current_dir, name), {:name => name}, cli)
6
+ end
7
+
8
+ cd name
9
+ end
10
+
11
+ Given /^a WordPress installation exists at "([^"]*)"$/ do |directory|
12
+ create_dir directory
13
+ end
14
+
15
+ Then /^the file "([^"]*)" should contain:$/ do |filename, content_partials|
16
+ content_partials.raw.each do |content|
17
+ check_file_content(filename, content[0], true)
18
+ end
19
+ end
20
+
21
+ Then /^the forge skeleton should be created in directory "([^"]*)"$/ do |base_dir|
22
+ skeleton_dirs = [
23
+ ['assets', 'images'],
24
+ ['assets', 'javascripts'],
25
+ ['assets', 'stylesheets'],
26
+
27
+ ['functions'],
28
+
29
+ ['templates', 'core'],
30
+ ['templates', 'custom', 'pages'],
31
+ ['templates', 'custom', 'partials']
32
+ ]
33
+
34
+ skeleton_dirs.each do |skeleton_dir|
35
+ full_path = File.join(base_dir, skeleton_dir)
36
+ check_directory_presence([full_path], true)
37
+ end
38
+ end
@@ -0,0 +1,17 @@
1
+ require 'bundler'
2
+ begin
3
+ Bundler.setup(:default, :development)
4
+ rescue Bundler::BundlerError => e
5
+ $stderr.puts e.message
6
+ $stderr.puts "Run `bundle install` to install missing gems"
7
+ exit e.status_code
8
+ end
9
+
10
+ file_path = Pathname.new(__FILE__).realpath
11
+ libdir = File.join(File.dirname(File.dirname(File.dirname(file_path))), "lib")
12
+ $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
13
+
14
+ require 'forge'
15
+
16
+ require 'rspec/expectations'
17
+ require 'aruba/cucumber'
@@ -0,0 +1,135 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "forge"
8
+ s.version = "0.0.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Andy Adams", "Drew Strojny", "Matt Button"]
12
+ s.date = "2011-10-06"
13
+ s.description = "A toolkit for bootstrapping and developing WordPress themes."
14
+ s.email = "aadams@jestro.com"
15
+ s.executables = ["forge"]
16
+ s.extra_rdoc_files = [
17
+ "LICENSE",
18
+ "README.md"
19
+ ]
20
+ s.files = [
21
+ ".document",
22
+ ".gitmodules",
23
+ ".rspec",
24
+ "Gemfile",
25
+ "Gemfile.lock",
26
+ "LICENSE",
27
+ "README.md",
28
+ "Rakefile",
29
+ "VERSION",
30
+ "bin/forge",
31
+ "features/create.feature",
32
+ "features/link.feature",
33
+ "features/step_definitions/forge_steps.rb",
34
+ "features/support/env.rb",
35
+ "forge.gemspec",
36
+ "layouts/config/config.json.erb",
37
+ "layouts/config/stylesheet_header.erb",
38
+ "layouts/default/functions/functions.php.erb",
39
+ "layouts/default/stylesheets/_reset.scss",
40
+ "layouts/default/stylesheets/_typography.scss",
41
+ "layouts/default/stylesheets/style.css.scss.erb",
42
+ "layouts/default/templates/404.php.erb",
43
+ "layouts/default/templates/archive.php.erb",
44
+ "layouts/default/templates/attachment.php.erb",
45
+ "layouts/default/templates/comments.php",
46
+ "layouts/default/templates/footer.php",
47
+ "layouts/default/templates/header.php.erb",
48
+ "layouts/default/templates/index.php",
49
+ "layouts/default/templates/page.php",
50
+ "layouts/default/templates/partials/loop.php.erb",
51
+ "layouts/default/templates/search.php.erb",
52
+ "layouts/default/templates/sidebar.php",
53
+ "layouts/default/templates/single.php.erb",
54
+ "layouts/lib/forge-settings/README.md",
55
+ "layouts/lib/forge-settings/classes/settings.php",
56
+ "layouts/lib/forge-settings/classes/settings/collection.php",
57
+ "layouts/lib/forge-settings/classes/settings/option.php",
58
+ "layouts/lib/forge-settings/classes/settings/option/select.php",
59
+ "layouts/lib/forge-settings/classes/settings/option/text.php",
60
+ "layouts/lib/forge-settings/classes/settings/section.php",
61
+ "lib/forge.rb",
62
+ "lib/forge/builder.rb",
63
+ "lib/forge/cli.rb",
64
+ "lib/forge/config.rb",
65
+ "lib/forge/error.rb",
66
+ "lib/forge/generator.rb",
67
+ "lib/forge/guard.rb",
68
+ "lib/forge/project.rb",
69
+ "lib/forge/version.rb",
70
+ "lib/guard/forge/assets.rb",
71
+ "lib/guard/forge/config.rb",
72
+ "lib/guard/forge/functions.rb",
73
+ "lib/guard/forge/templates.rb",
74
+ "spec/lib/forge/config_spec.rb",
75
+ "spec/lib/forge/project_spec.rb",
76
+ "spec/spec_helper.rb"
77
+ ]
78
+ s.homepage = "http://nohomepageyet.org"
79
+ s.licenses = ["MIT"]
80
+ s.require_paths = ["lib"]
81
+ s.rubygems_version = "1.8.11"
82
+ s.summary = "A tool for developing wordpress themes"
83
+
84
+ if s.respond_to? :specification_version then
85
+ s.specification_version = 3
86
+
87
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
88
+ s.add_runtime_dependency(%q<thor>, [">= 0"])
89
+ s.add_runtime_dependency(%q<guard>, [">= 0"])
90
+ s.add_runtime_dependency(%q<sprockets>, [">= 0"])
91
+ s.add_runtime_dependency(%q<rubyzip>, [">= 0"])
92
+ s.add_runtime_dependency(%q<json>, [">= 0"])
93
+ s.add_runtime_dependency(%q<sass>, [">= 0"])
94
+ s.add_runtime_dependency(%q<sprockets-sass>, [">= 0"])
95
+ s.add_runtime_dependency(%q<compass>, [">= 0"])
96
+ s.add_development_dependency(%q<rspec>, [">= 0"])
97
+ s.add_development_dependency(%q<cucumber>, [">= 0"])
98
+ s.add_development_dependency(%q<aruba>, [">= 0"])
99
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
100
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
101
+ s.add_development_dependency(%q<rcov>, [">= 0"])
102
+ else
103
+ s.add_dependency(%q<thor>, [">= 0"])
104
+ s.add_dependency(%q<guard>, [">= 0"])
105
+ s.add_dependency(%q<sprockets>, [">= 0"])
106
+ s.add_dependency(%q<rubyzip>, [">= 0"])
107
+ s.add_dependency(%q<json>, [">= 0"])
108
+ s.add_dependency(%q<sass>, [">= 0"])
109
+ s.add_dependency(%q<sprockets-sass>, [">= 0"])
110
+ s.add_dependency(%q<compass>, [">= 0"])
111
+ s.add_dependency(%q<rspec>, [">= 0"])
112
+ s.add_dependency(%q<cucumber>, [">= 0"])
113
+ s.add_dependency(%q<aruba>, [">= 0"])
114
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
115
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
116
+ s.add_dependency(%q<rcov>, [">= 0"])
117
+ end
118
+ else
119
+ s.add_dependency(%q<thor>, [">= 0"])
120
+ s.add_dependency(%q<guard>, [">= 0"])
121
+ s.add_dependency(%q<sprockets>, [">= 0"])
122
+ s.add_dependency(%q<rubyzip>, [">= 0"])
123
+ s.add_dependency(%q<json>, [">= 0"])
124
+ s.add_dependency(%q<sass>, [">= 0"])
125
+ s.add_dependency(%q<sprockets-sass>, [">= 0"])
126
+ s.add_dependency(%q<compass>, [">= 0"])
127
+ s.add_dependency(%q<rspec>, [">= 0"])
128
+ s.add_dependency(%q<cucumber>, [">= 0"])
129
+ s.add_dependency(%q<aruba>, [">= 0"])
130
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
131
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
132
+ s.add_dependency(%q<rcov>, [">= 0"])
133
+ end
134
+ end
135
+