wordless 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,8 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- wordless (0.0.2)
4
+ wordless (0.2.1)
5
5
  thor
6
+ wordpress_tools (~> 0.0.1)
6
7
 
7
8
  GEM
8
9
  remote: https://rubygems.org/
@@ -18,6 +19,8 @@ GEM
18
19
  diff-lcs (~> 1.1.2)
19
20
  rspec-mocks (2.8.0)
20
21
  thor (0.14.6)
22
+ wordpress_tools (0.0.1)
23
+ thor
21
24
 
22
25
  PLATFORMS
23
26
  ruby
data/lib/wordless/cli.rb CHANGED
@@ -3,6 +3,7 @@ require 'thor'
3
3
  require 'net/http'
4
4
  require 'rbconfig'
5
5
  require 'tempfile'
6
+ require 'wordpress_tools/cli'
6
7
  require 'wordless/cli_helper'
7
8
 
8
9
  module Wordless
@@ -18,65 +19,15 @@ module Wordless
18
19
  end
19
20
  end
20
21
 
21
- desc "new NAME", "download WordPress in directory NAME, install the Wordless plugin and create a Wordless theme"
22
+ desc "new [NAME]", "download WordPress in specified directory, install the Wordless plugin and create a Wordless theme"
22
23
  method_option :locale, :aliases => "-l", :desc => "WordPress locale (default is en_US)"
23
24
  def new(name)
24
- invoke('wp', [name], :bare => true, :locale => options['locale'])
25
+ WordPressTools::CLI.new.invoke('new', [name], :bare => true, :locale => options['locale'])
25
26
  Dir.chdir(name)
26
27
  Wordless::CLI.new.invoke(:install)
27
28
  invoke('theme', [name])
28
29
  end
29
30
 
30
- desc "wp DIR_NAME", "download the latest stable version of WordPress in a new directory DIR_NAME (default is wordpress)"
31
- method_option :locale, :aliases => "-l", :desc => "WordPress locale (default is en_US)"
32
- method_option :bare, :aliases => "-b", :desc => "Remove default themes and plugins"
33
- def wp(dir_name = 'wordpress')
34
- download_url, version, locale = Net::HTTP.get('api.wordpress.org', "/core/version-check/1.5/?locale=#{options[:locale]}").split[2,3]
35
- downloaded_file = Tempfile.new('wordpress')
36
- begin
37
- puts "Downloading WordPress #{version} (#{locale})..."
38
-
39
- unless download(download_url, downloaded_file.path)
40
- error "Couldn't download WordPress."
41
- return
42
- end
43
-
44
- unless unzip(downloaded_file.path, dir_name)
45
- error "Couldn't unzip WordPress."
46
- return
47
- end
48
-
49
- subdirectory = Dir["#{dir_name}/*/"].first # This is probably 'wordpress', but don't assume
50
- FileUtils.mv Dir["#{subdirectory}*"], dir_name # Remove unnecessary directory level
51
- Dir.delete subdirectory
52
- ensure
53
- downloaded_file.close
54
- downloaded_file.unlink
55
- end
56
-
57
- success %Q{Installed WordPress in directory "#{dir_name}".}
58
-
59
- if options[:bare]
60
- dirs = %w(themes plugins).map {|d| "#{dir_name}/wp-content/#{d}"}
61
- FileUtils.rm_rf dirs
62
- FileUtils.mkdir dirs
63
- dirs.each do |dir|
64
- FileUtils.cp "#{dir_name}/wp-content/index.php", dir
65
- end
66
- success "Removed default themes and plugins."
67
- end
68
-
69
- if git_installed?
70
- if run "cd #{dir_name} && git init", :verbose => false, :capture => true
71
- success "Initialized git repository."
72
- else
73
- error "Couldn't initialize git repository."
74
- end
75
- else
76
- warning "Didn't initialize git repository because git isn't installed."
77
- end
78
- end
79
-
80
31
  desc "install", "install the Wordless plugin into an existing WordPress installation"
81
32
  def install
82
33
  unless git_installed?
@@ -1,3 +1,3 @@
1
1
  module Wordless
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
data/spec/cli_spec.rb CHANGED
@@ -29,43 +29,10 @@ describe Wordless::CLI do
29
29
  end
30
30
  end
31
31
 
32
- context "#wp" do
33
- context "with no arguments" do
34
- it "downloads a copy of WordPress" do
35
- Wordless::CLI.start ['wp']
36
- File.exists?('wordpress/wp-content/index.php').should eq true
37
- end
38
-
39
- it "initializes a git repository" do
40
- Wordless::CLI.start ['wp']
41
- File.directory?('wordpress/.git').should eq true
42
- end
43
-
44
- it "doesn't leave a stray 'wordpress' directory" do
45
- Wordless::CLI.start ['wp']
46
- File.directory?('wordpress/wordpress').should eq false
47
- end
48
- end
49
-
50
- context "with a custom directory name" do
51
- it "downloads a copy of WordPress in directory 'myapp'" do
52
- Wordless::CLI.start ['wp', 'myapp']
53
- File.exists?('myapp/wp-content/index.php').should eq true
54
- end
55
- end
56
-
57
- context "with the 'bare' option" do
58
- it "downloads a copy of WordPress and removes default plugins and themes" do
59
- Wordless::CLI.start ['wp', '--bare']
60
- (File.exists?('wordpress/wp-content/plugins/plugin.php') || File.directory?('wordpress/wp-content/themes/theme')).should eq false
61
- end
62
- end
63
- end
64
-
65
32
  context "#install" do
66
33
  context "with a valid WordPress installation" do
67
34
  it "installs the Wordless plugin" do
68
- Wordless::CLI.start ['wp']
35
+ WordPressTools::CLI.start ['new']
69
36
  Dir.chdir 'wordpress'
70
37
  Wordless::CLI.start ['install']
71
38
  File.directory?('wp-content/plugins/wordless').should eq true
@@ -83,7 +50,7 @@ describe Wordless::CLI do
83
50
  context "#theme" do
84
51
  context "with a valid WordPress installation and the Wordless plugin" do
85
52
  before :each do
86
- Wordless::CLI.start ['wp']
53
+ WordPressTools::CLI.start ['new']
87
54
  Dir.chdir 'wordpress'
88
55
  Wordless::CLI.start ['install']
89
56
  end
@@ -103,7 +70,7 @@ describe Wordless::CLI do
103
70
  end
104
71
  end
105
72
 
106
- context "#compile", :now => true do
73
+ context "#compile" do
107
74
  context "with a valid Wordless installation" do
108
75
  before :each do
109
76
  Wordless::CLI.start ['new', 'myapp']
data/spec/spec_helper.rb CHANGED
@@ -26,6 +26,8 @@ RSpec.configure do |config|
26
26
  # end
27
27
  # end
28
28
  # end
29
+
30
+ FileUtils.mkdir('tmp') unless File.directory? 'tmp'
29
31
 
30
32
  def capture(stream)
31
33
  begin
data/wordless.gemspec CHANGED
@@ -4,11 +4,12 @@ require File.expand_path('../lib/wordless/version', __FILE__)
4
4
  Gem::Specification.new do |gem|
5
5
  gem.authors = ["Étienne Després"]
6
6
  gem.email = ["etienne@molotov.ca"]
7
- gem.description = %q{Wordless}
7
+ gem.description = %q{Command line tool to manage Wordless themes.}
8
8
  gem.summary = %q{Manage Wordless themes.}
9
9
  gem.homepage = "http://github.com/etienne/wordless_gem"
10
10
 
11
11
  gem.add_dependency "thor"
12
+ gem.add_dependency "wordpress_tools", '~> 0.0.1'
12
13
 
13
14
  gem.add_development_dependency 'rspec'
14
15
  gem.add_development_dependency 'fakeweb'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wordless
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-01 00:00:00.000000000 Z
12
+ date: 2012-04-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &70294941484300 !ruby/object:Gem::Requirement
16
+ requirement: &70234166003760 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,21 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70294941484300
24
+ version_requirements: *70234166003760
25
+ - !ruby/object:Gem::Dependency
26
+ name: wordpress_tools
27
+ requirement: &70234166002920 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 0.0.1
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70234166002920
25
36
  - !ruby/object:Gem::Dependency
26
37
  name: rspec
27
- requirement: &70294941483880 !ruby/object:Gem::Requirement
38
+ requirement: &70234166002260 !ruby/object:Gem::Requirement
28
39
  none: false
29
40
  requirements:
30
41
  - - ! '>='
@@ -32,10 +43,10 @@ dependencies:
32
43
  version: '0'
33
44
  type: :development
34
45
  prerelease: false
35
- version_requirements: *70294941483880
46
+ version_requirements: *70234166002260
36
47
  - !ruby/object:Gem::Dependency
37
48
  name: fakeweb
38
- requirement: &70294941483400 !ruby/object:Gem::Requirement
49
+ requirement: &70234166001480 !ruby/object:Gem::Requirement
39
50
  none: false
40
51
  requirements:
41
52
  - - ! '>='
@@ -43,8 +54,8 @@ dependencies:
43
54
  version: '0'
44
55
  type: :development
45
56
  prerelease: false
46
- version_requirements: *70294941483400
47
- description: Wordless
57
+ version_requirements: *70234166001480
58
+ description: Command line tool to manage Wordless themes.
48
59
  email:
49
60
  - etienne@molotov.ca
50
61
  executables: