Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix broke features

  • Loading branch information...
commit 4dffaa2375aa65f08cca8c60f1536ba73d5a3db1 1 parent fcbd9e9
@hsbt hsbt authored
View
10 ruby-tools/jpi/features/create-new-plugin.feature
@@ -1,4 +1,3 @@
-
Feature: Generating a new Jenkins Ruby Plugin
Creating a new Ruby plugin for Jenkins needs to be as simple as running a single command
@@ -6,13 +5,10 @@ that will generate a project skeleton. This skeleton will come complete with git
the goodies that you need to do your plugin develompent.
Scenario: The directory skeleton is generated
- When I run `jpi new cuke-plugin`
+ When I run `jpi new cuke`
Then I should see this structure
"""
[-] cuke-plugin
- | [+] .git
- | .gitignore
- | Gemfile
- | Rakefile
- | cuke-plugin.pluginspec
+ | Gemfile
+ | cuke.pluginspec
"""
View
38 ruby-tools/jpi/features/support/directory_structure.rb
@@ -1,24 +1,25 @@
class DirectoryStructure
def initialize(structure)
-
- @root = context = DirChild.new('.')
+ context = DirChild.new('.')
structure.each_line do |line|
- if line =~ /(\[[-+]\]|\|)?\s+(\.?\w+)$/
+ if line =~ /^(\[\-+\]|\ \|\ )\s+(.+)$/
op, name = $1, $2
- case op
- when "[+]"
- context.add(DirChild.new name)
- when "[-]"
- new_context = DirChild.new name
- context.add(new_context)
- context = new_context
- when "|"
- context.add(FileChild.new name)
- end
+ child = case op
+ when "[+]"
+ DirChild.new name
+ when "[-]"
+ # TODO: make to tree structure
+ DirChild.new name
+ when " | "
+ FileChild.new name
+ end
+ context.add child
end
end
+
+ @root = context
end
def matches?(dir)
@@ -28,22 +29,23 @@ def matches?(dir)
Entry = Struct.new(:name)
class DirChild < Entry
+ attr_accessor :entries
+
def initialize(name)
super(name)
@entries = []
end
def add(entry)
- @entries << entries
+ @entries << entry
end
def matches?(realdir)
- entries = Dir.new(realdir).entries
- !@entries.detect {|e| !entries.map{|e| File.basename(e)}.member?(e)}
+ real_entries = Dir.glob(realdir + '/**/*').map{|e| File.basename(e) }
+ (@entries.map(&:name) <=> real_entries) < 1
end
end
class FileChild < Entry
-
end
-end
View
1  ruby-tools/jpi/features/support/workdir.rb
@@ -11,4 +11,3 @@ def work_dir
FileUtils.mkdir_p work_dir
@dirs = [work_dir]
end
-
Please sign in to comment.
Something went wrong with that request. Please try again.