middleman-remover 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 64796027fb9070fcaa5e09932f04704f0257b97d
4
+ data.tar.gz: e24f33b02b4d3c725a59a55291190dd522966956
5
+ SHA512:
6
+ metadata.gz: 29a70fd5f3cdbdb29f2853c96e954be6b8502d49d4d02cb7cdf64d6b88232a877f2cf49d8b91ac58ccbcafb8f075a1e356dc284c2b67037e202403500b2ff7e6
7
+ data.tar.gz: b93d0df325d43677366b03987c6400ece9097738b6d9172867779b094674891ca748c2f34700d161f476e963cef4aa2d9628997244dd18b82878271162d35a9e
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/.travis.yml ADDED
@@ -0,0 +1,14 @@
1
+ language: ruby
2
+ script: "bundle exec cucumber"
3
+ rvm:
4
+ - 1.9.3
5
+ - 2.0.0
6
+ - 2.1.2
7
+ - jruby-19mode
8
+ env: TEST=true TRAVIS=true
9
+ gemfile:
10
+ - Gemfile
11
+ notifications:
12
+ webhooks:
13
+ - https://idobata.io/hook/travis_ci/d75034d3-11f7-4e03-9abc-8d84f783a855
14
+
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in middleman-remover.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 yterajima
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.jp.md ADDED
@@ -0,0 +1,65 @@
1
+ # middleman-remover
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/middleman-remover.svg)](http://badge.fury.io/rb/middleman-remover)
4
+ [![Build Status](https://travis-ci.org/yterajima/middleman-remover.svg?branch=master)](https://travis-ci.org/yterajima/middleman-remover)
5
+
6
+ `middleman-remover` は [Middleman](http://middlemanapp.com/) の拡張機能です。
7
+ この拡張は `$ middleman build` を実行した際に動作し, `build` ディレクトリの中の指定したファイルやディレクトリを削除する機能を提供します。
8
+
9
+ ## Installation
10
+
11
+ Gemfile に次の行を追加してください:
12
+
13
+ ```ruby
14
+ gem 'middleman-remover'
15
+ ```
16
+
17
+ コマンドを実行します:
18
+
19
+ $ bundle
20
+
21
+ Gemfile を使わずにインストールする場合は次のコマンドを実行してください:
22
+
23
+ $ gem install middleman-remover
24
+
25
+ ## Usage
26
+
27
+ 基本的な使い方:
28
+
29
+ ```ruby
30
+ configure :build do
31
+ activate :remover, :paths => %w(empty)
32
+ end
33
+ ```
34
+
35
+ この例の場合, `middleman-remover` は `build/empty` を削除します。
36
+ `:paths` オプションを指定することで, `build` ディレクトリからファイルやディレクトリを削除することができます。
37
+
38
+ ワイルドカードを使ってパスを指定することもできます:
39
+
40
+ ```ruby
41
+ configure :build do
42
+ activate :remover, :paths => %w(dir/*.html .DS_Store)
43
+ end
44
+ ```
45
+
46
+ この例の場合, `middleman-remover` は `build/dir/*.html` と `build/.DS_Store` を削除します。
47
+
48
+ ディレクトリを削除することもできます:
49
+
50
+ ```ruby
51
+ configure :build do
52
+ activate :remover, :paths => %w(/dir)
53
+ end
54
+ ```
55
+
56
+ この例の場合, `middleman-remover` は `build/dir/` ディレクトリを削除します。
57
+
58
+ ## Contributing
59
+
60
+ 1. Fork it ( https://github.com/yterajima/middleman-remover/fork )
61
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
62
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
63
+ 4. Push to the branch (`git push origin my-new-feature`)
64
+ 5. Create a new Pull Request
65
+
data/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # middleman-remover
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/middleman-remover.svg)](http://badge.fury.io/rb/middleman-remover)
4
+ [![Build Status](https://travis-ci.org/yterajima/middleman-remover.svg?branch=master)](https://travis-ci.org/yterajima/middleman-remover)
5
+
6
+ `middleman-remover` is an extension of [Middleman](http://middlemanapp.com/).
7
+ This extension works when `$ middleman build` and provides Delete function of files or Directories in `build` directory.
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'middleman-remover'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install middleman-remover
24
+
25
+ ## Usage
26
+
27
+ Basic usage:
28
+
29
+ ```ruby
30
+ configure :build do
31
+ activate :remover, :paths => %w(empty)
32
+ end
33
+ ```
34
+
35
+ `middleman-remover` will remove `build/empty`.
36
+ By specifying `:paths` option, you can remove files and directories from `build` directory.
37
+
38
+ You can also specify the path using the wild card:
39
+
40
+ ```ruby
41
+ configure :build do
42
+ activate :remover, :paths => %w(dir/*.html .DS_Store)
43
+ end
44
+ ```
45
+
46
+ `middleman-remover` will remove `build/dir/*.html` and `build/.DS_Store`.
47
+
48
+ Also you can remove directory:
49
+
50
+ ```ruby
51
+ configure :build do
52
+ activate :remover, :paths => %w(/dir)
53
+ end
54
+ ```
55
+
56
+ `middleman-remover` will remove `build/dir/` directory.
57
+
58
+ ## Contributing
59
+
60
+ 1. Fork it ( https://github.com/yterajima/middleman-remover/fork )
61
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
62
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
63
+ 4. Push to the branch (`git push origin my-new-feature`)
64
+ 5. Create a new Pull Request
65
+
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,169 @@
1
+ Feature: Middleman-Remover
2
+
3
+ Scenario: Remover dosen't delete file
4
+ Given a fixture app "basic-app"
5
+ And a file named "config.rb" with:
6
+ """
7
+ configure :build do
8
+ activate :remover
9
+ end
10
+ """
11
+ And a file named "source/empty" with:
12
+ """
13
+ """
14
+ And a successfully built app at "basic-app"
15
+ When I cd to "build"
16
+ Then a file named "empty" should exist
17
+
18
+ Scenario: Removed Message
19
+ Given a fixture app "basic-app"
20
+ And a file named "config.rb" with:
21
+ """
22
+ configure :build do
23
+ activate :remover, :paths => %w(empty)
24
+ end
25
+ """
26
+ And a file named "source/empty" with:
27
+ """
28
+ """
29
+ And a successfully built app at "basic-app"
30
+ When I cd to "build"
31
+ Then a file named "empty" should not exist
32
+ And the output should contain "middleman-remover:"
33
+ And the output should contain "is removed"
34
+
35
+ Scenario: File not exist Message
36
+ Given a fixture app "basic-app"
37
+ And a file named "config.rb" with:
38
+ """
39
+ configure :build do
40
+ activate :remover, :paths => %w(empty)
41
+ end
42
+ """
43
+ And a successfully built app at "basic-app"
44
+ When I cd to "build"
45
+ Then the output should contain "middleman-remover:"
46
+ And the output should contain "is not exist"
47
+
48
+ Scenario: Directory not exist Message
49
+ Given a fixture app "basic-app"
50
+ And a file named "config.rb" with:
51
+ """
52
+ configure :build do
53
+ activate :remover, :paths => %w(dir)
54
+ end
55
+ """
56
+ And a successfully built app at "basic-app"
57
+ When I cd to "build"
58
+ Then the output should contain "middleman-remover:"
59
+ And the output should contain "is not exist"
60
+
61
+ Scenario: Remove file
62
+ Given a fixture app "basic-app"
63
+ And a file named "config.rb" with:
64
+ """
65
+ configure :build do
66
+ activate :remover, :paths => %w(empty)
67
+ end
68
+ """
69
+ And a file named "source/empty" with:
70
+ """
71
+ """
72
+ And a successfully built app at "basic-app"
73
+ When I cd to "build"
74
+ Then a file named "empty" should not exist
75
+
76
+ Scenario: Remove Directory
77
+ Given a fixture app "basic-app"
78
+ And a file named "config.rb" with:
79
+ """
80
+ configure :build do
81
+ activate :remover, :paths => %w(dir)
82
+ end
83
+ """
84
+ And a directory named "source/dir"
85
+ And a file named "source/dir/empty" with:
86
+ """
87
+ """
88
+ And a successfully built app at "basic-app"
89
+ When I cd to "build"
90
+ Then a directory named "dir" should not exist
91
+
92
+ Scenario: Remove file with WILDCARD
93
+ Given a fixture app "basic-app"
94
+ And a file named "config.rb" with:
95
+ """
96
+ configure :build do
97
+ activate :remover, :paths => %w(dir/*)
98
+ end
99
+ """
100
+ And a directory named "source/dir"
101
+ And a file named "source/dir/empty" with:
102
+ """
103
+ """
104
+ And a file named "source/dir/something.html" with:
105
+ """
106
+ <html><head><title>something</title></head><body></body></html>
107
+ """
108
+ And a successfully built app at "basic-app"
109
+ When I cd to "build"
110
+ Then a directory named "dir" should exist
111
+ And a file named "dir/empty" should not exist
112
+ And a file named "dir/something.html" should not exist
113
+
114
+ Scenario: Remove file with WILDCARD and extension
115
+ Given a fixture app "basic-app"
116
+ And a file named "config.rb" with:
117
+ """
118
+ configure :build do
119
+ activate :remover, :paths => %w(dir/*.html)
120
+ end
121
+ """
122
+ And a directory named "source/dir"
123
+ And a file named "source/dir/empty" with:
124
+ """
125
+ """
126
+ And a file named "source/dir/something.html" with:
127
+ """
128
+ <html><head><title>something</title></head><body></body></html>
129
+ """
130
+ And a successfully built app at "basic-app"
131
+ When I cd to "build"
132
+ Then a directory named "dir" should exist
133
+ And a file named "dir/empty" should exist
134
+ And a file named "dir/something.html" should not exist
135
+
136
+ Scenario: Remove Some files/Directories
137
+ Given a fixture app "basic-app"
138
+ And a file named "config.rb" with:
139
+ """
140
+ configure :build do
141
+ activate :remover, :paths => %w(dir1/*.html dir2/*.dat /dir3)
142
+ end
143
+ """
144
+ And a directory named "source/dir1"
145
+ And a directory named "source/dir2"
146
+ And a directory named "source/dir3"
147
+ And a file named "source/dir1/empty" with:
148
+ """
149
+ """
150
+ And a file named "source/dir1/something.html" with:
151
+ """
152
+ <html><head><title>something</title></head><body></body></html>
153
+ """
154
+ And a file named "source/dir2/sample.dat" with:
155
+ """
156
+ sample
157
+ """
158
+ And a file named "source/dir3/empty" with:
159
+ """
160
+ """
161
+ And a successfully built app at "basic-app"
162
+ When I cd to "build"
163
+ Then a directory named "dir1" should exist
164
+ And a directory named "dir2" should exist
165
+ And a directory named "dir3" should not exist
166
+ And a file named "dir1/empty" should exist
167
+ And a file named "dir1/something.html" should not exist
168
+ And a file named "dir2/sample.dat" should not exist
169
+
@@ -0,0 +1,5 @@
1
+ PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
2
+ require 'middleman-core'
3
+ require 'middleman-core/step_definitions'
4
+ require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-remover')
5
+
@@ -0,0 +1,11 @@
1
+ ---
2
+ title: Welcome to Middleman
3
+ ---
4
+
5
+ <div class="welcome">
6
+ <h1>Middleman is Watching</h1>
7
+ <p class="doc">
8
+ <%= link_to "Read Online Documentation", "http://middlemanapp.com/" %>
9
+ </p><!-- .doc -->
10
+ </div><!-- .welcome -->
11
+
@@ -0,0 +1,18 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+
6
+ <!-- Always force latest IE rendering engine or request Chrome Frame -->
7
+ <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
8
+
9
+ <!-- Use title if it's in the page YAML frontmatter -->
10
+ <title><%= current_page.data.title || "The Middleman" %></title>
11
+
12
+ </head>
13
+
14
+ <body class="<%= page_classes %>">
15
+ <%= yield %>
16
+ </body>
17
+ </html>
18
+
@@ -0,0 +1,8 @@
1
+ require "middleman-core"
2
+ require "middleman-remover/version"
3
+
4
+ ::Middleman::Extensions.register(:remover) do
5
+ require 'middleman-remover/extension'
6
+ ::Middleman::Remover::Extension
7
+ end
8
+
@@ -0,0 +1,36 @@
1
+ require 'fileutils'
2
+
3
+ module Middleman
4
+ module Remover
5
+ class Extension < ::Middleman::Extension
6
+ option :paths, [], 'List of remove files/directories paths'
7
+
8
+ def initialize(app, options_hash = {}, &block)
9
+ super
10
+
11
+ paths = options.paths
12
+ build_dir = app.build_dir
13
+ ext = self
14
+
15
+ app.after_build do
16
+ ext.remove(paths, build_dir)
17
+ end
18
+ end
19
+
20
+ def remove(paths, dir)
21
+ paths.each do |path|
22
+ path = File.join(dir, path)
23
+ list = Dir.glob(path)
24
+
25
+ if list.length > 0
26
+ FileUtils.rm_rf(list)
27
+ puts " middleman-remover: #{path} is removed"
28
+ else
29
+ puts " middleman-remover: #{path} is not exist"
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+
@@ -0,0 +1,5 @@
1
+ module Middleman
2
+ module Remover
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ require 'middleman-remover'
2
+
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'middleman-remover/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "middleman-remover"
8
+ spec.version = Middleman::Remover::VERSION
9
+ spec.authors = ["yterajima"]
10
+ spec.email = ["terra@e2esound.com"]
11
+ spec.summary = %q{Remove some files from build dir.}
12
+ spec.description = %q{Remove some files fron build dir}
13
+ spec.homepage = "https://github.com/yterajima/middleman-remover"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+ spec.required_ruby_version = '>=1.9.3'
21
+
22
+ spec.add_runtime_dependency "middleman", "~>3.3"
23
+
24
+ spec.add_development_dependency "cucumber", "~> 1.3"
25
+ spec.add_development_dependency "aruba", "~> 0.6"
26
+ spec.add_development_dependency "bundler", "~> 1.5"
27
+ spec.add_development_dependency "rake", "~>10"
28
+ end
metadata ADDED
@@ -0,0 +1,132 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: middleman-remover
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - yterajima
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: middleman
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.3'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: cucumber
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: aruba
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.6'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.6'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.5'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.5'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10'
83
+ description: Remove some files fron build dir
84
+ email:
85
+ - terra@e2esound.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - ".travis.yml"
92
+ - Gemfile
93
+ - LICENSE.txt
94
+ - README.jp.md
95
+ - README.md
96
+ - Rakefile
97
+ - features/remover.feature
98
+ - features/support/env.rb
99
+ - fixtures/basic-app/source/index.html.erb
100
+ - fixtures/basic-app/source/layouts/layout.erb
101
+ - lib/middleman-remover.rb
102
+ - lib/middleman-remover/extension.rb
103
+ - lib/middleman-remover/version.rb
104
+ - lib/middleman_extension.rb
105
+ - middleman-remover.gemspec
106
+ homepage: https://github.com/yterajima/middleman-remover
107
+ licenses:
108
+ - MIT
109
+ metadata: {}
110
+ post_install_message:
111
+ rdoc_options: []
112
+ require_paths:
113
+ - lib
114
+ required_ruby_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: 1.9.3
119
+ required_rubygems_version: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ requirements: []
125
+ rubyforge_project:
126
+ rubygems_version: 2.2.2
127
+ signing_key:
128
+ specification_version: 4
129
+ summary: Remove some files from build dir.
130
+ test_files:
131
+ - features/remover.feature
132
+ - features/support/env.rb